This is the mail archive of the cluster-cvs@sourceware.org mailing list for the cluster.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gfs1-utils: master - split tree into separate projects


Gitweb:        http://git.fedorahosted.org/git/gfs1-utils.git?p=gfs1-utils.git;a=commitdiff;h=550676720582ed686d56e0812830ad039f490e11
Commit:        550676720582ed686d56e0812830ad039f490e11
Parent:        c1d0478e6c7ae3a6d40db5acd0efe28aaa6bedc6
Author:        Fabio M. Di Nitto <fdinitto@redhat.com>
AuthorDate:    Wed Jan 7 15:04:31 2009 +0100
Committer:     Fabio M. Di Nitto <fdinitto@redhat.com>
CommitterDate: Wed Jan 7 15:04:31 2009 +0100

split tree into separate projects

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
 Makefile                                           |   29 +-
 bindings/perl/Makefile                             |    2 +-
 bindings/perl/ccs/CCS.pm.in                        |  145 -
 bindings/perl/ccs/CCS.xs                           |   82 -
 bindings/perl/ccs/MANIFEST                         |    7 -
 bindings/perl/ccs/META.yml.in                      |   13 -
 bindings/perl/ccs/Makefile.PL                      |   28 -
 bindings/perl/ccs/Makefile.bindings                |   13 -
 bindings/perl/ccs/test.pl                          |   20 -
 bindings/perl/ccs/typemap                          |    1 -
 cman/Makefile                                      |    4 -
 cman/cman_tool/Makefile                            |   31 -
 cman/cman_tool/cman_tool.h                         |  100 -
 cman/cman_tool/join.c                              |  327 -
 cman/cman_tool/main.c                              | 1074 -
 cman/daemon/Makefile                               |   41 -
 cman/daemon/ais.c                                  |  343 -
 cman/daemon/ais.h                                  |   13 -
 cman/daemon/barrier.c                              |  468 -
 cman/daemon/barrier.h                              |    6 -
 cman/daemon/cman-preconfig.c                       | 1172 -
 cman/daemon/cman.h                                 |   15 -
 cman/daemon/cmanconfig.c                           |  297 -
 cman/daemon/cmanconfig.h                           |    3 -
 cman/daemon/cnxman-private.h                       |  183 -
 cman/daemon/cnxman-socket.h                        |  275 -
 cman/daemon/commands.c                             | 2232 --
 cman/daemon/commands.h                             |   37 -
 cman/daemon/daemon.c                               |  539 -
 cman/daemon/daemon.h                               |   12 -
 cman/daemon/list.h                                 |   97 -
 cman/daemon/logging.c                              |   25 -
 cman/daemon/logging.h                              |   17 -
 cman/daemon/nodelist.h                             |   93 -
 cman/init.d/Makefile                               |   25 -
 cman/init.d/cman.in                                |  712 -
 cman/init.d/qdiskd.in                              |  128 -
 cman/lib/Makefile                                  |   12 -
 cman/lib/libcman.c                                 | 1108 -
 cman/lib/libcman.h                                 |  423 -
 cman/man/Makefile                                  |    9 -
 cman/man/cman.5                                    |  222 -
 cman/man/cman_tool.8                               |  411 -
 cman/man/cmannotifyd.8                             |   66 -
 cman/man/mkqdisk.8                                 |   31 -
 cman/man/qdisk.5                                   |  470 -
 cman/man/qdiskd.8                                  |   25 -
 cman/notifyd/Makefile                              |   37 -
 cman/notifyd/cman_notify.in                        |   40 -
 cman/notifyd/main.c                                |  381 -
 cman/qdisk/Makefile                                |   52 -
 cman/qdisk/bitmap.c                                |   88 -
 cman/qdisk/daemon_init.c                           |  227 -
 cman/qdisk/disk.c                                  |  774 -
 cman/qdisk/disk.h                                  |  284 -
 cman/qdisk/disk_util.c                             |  261 -
 cman/qdisk/main.c                                  | 1755 --
 cman/qdisk/mkqdisk.c                               |   89 -
 cman/qdisk/platform.h                              |   40 -
 cman/qdisk/proc.c                                  |  259 -
 cman/qdisk/scandisk.c                              |  761 -
 cman/qdisk/scandisk.h                              |   87 -
 cman/qdisk/score.c                                 |  419 -
 cman/qdisk/score.h                                 |   44 -
 cman/services/Makefile                             |    4 -
 cman/services/cman/Makefile                        |    4 -
 cman/services/cman/include/corosync/cman.h         |   39 -
 cman/services/cman/include/corosync/ipc_cman.h     |   57 -
 cman/services/cman/lib/Makefile                    |   13 -
 cman/services/cman/lib/libcman.c                   |  812 -
 cman/services/cman/services/Makefile               |   26 -
 cman/services/cman/services/cman.c                 |  571 -
 cman/services/quorum/Makefile                      |    4 -
 cman/services/quorum/include/corosync/cmanquorum.h |  170 -
 .../quorum/include/corosync/ipc_cmanquorum.h       |  122 -
 cman/services/quorum/lib/Makefile                  |   12 -
 cman/services/quorum/lib/libcmanquorum.c           |  827 -
 cman/services/quorum/services/Makefile             |   26 -
 cman/services/quorum/services/cmanquorum.c         | 1488 -
 cman/services/quorum/test/Makefile                 |   26 -
 cman/services/quorum/test/testcmanquorum1.c        |  125 -
 cman/services/quorum/test/testcmanquorum2.c        |   63 -
 cman/tests/Makefile                                |   23 -
 cman/tests/client.c                                |  113 -
 cman/tests/libtest.c                               |  132 -
 cman/tests/qwait.c                                 |   58 -
 cman/tests/sysman.c                                |   72 -
 cman/tests/sysmand.c                               |  469 -
 cman/tests/user_service.c                          |  285 -
 common/Makefile                                    |    4 -
 common/liblogthread/Makefile                       |   13 -
 common/liblogthread/liblogthread.c                 |  326 -
 common/liblogthread/liblogthread.h                 |   19 -
 config/Makefile                                    |    4 -
 config/libs/Makefile                               |    4 -
 config/libs/libccsconfdb/Makefile                  |   24 -
 config/libs/libccsconfdb/ccs.h                     |   24 -
 config/libs/libccsconfdb/ccs_internal.h            |   29 -
 config/libs/libccsconfdb/extras.c                  |  447 -
 config/libs/libccsconfdb/fullxpath.c               |  334 -
 config/libs/libccsconfdb/libccs.c                  |  710 -
 config/libs/libccsconfdb/xpathlite.c               |  424 -
 config/man/Makefile                                |    4 -
 config/man/cluster.conf.5                          |   61 -
 config/plugins/Makefile                            |    4 -
 config/plugins/ldap/99cluster.ldif                 |  138 -
 config/plugins/ldap/Makefile                       |   30 -
 config/plugins/ldap/configldap.c                   |  279 -
 config/plugins/ldap/example.ldif                   |  137 -
 config/plugins/xml/Makefile                        |   28 -
 config/plugins/xml/config.c                        |  150 -
 config/tools/Makefile                              |    4 -
 config/tools/ccs_tool/Makefile                     |   41 -
 config/tools/ccs_tool/ccs_tool.c                   |  296 -
 config/tools/ccs_tool/editconf.c                   | 1248 -
 config/tools/ccs_tool/editconf.h                   |    8 -
 config/tools/ldap/Makefile                         |   27 -
 config/tools/ldap/confdb2ldif.c                    |  201 -
 config/tools/man/Makefile                          |    6 -
 config/tools/man/ccs_tool.8                        |  185 -
 config/tools/man/confdb2ldif.8                     |   64 -
 configure                                          |  424 -
 contrib/Makefile                                   |    2 +-
 contrib/askant/INSTALL                             |   42 -
 contrib/askant/Makefile                            |   24 -
 contrib/askant/PLUGINAPI                           |   65 -
 contrib/askant/README                              |   74 -
 contrib/askant/askant/about.py                     |    5 -
 contrib/askant/askant/askant.py                    |   24 -
 contrib/askant/askant/blktrace.py                  |   93 -
 contrib/askant/askant/commands.py                  |  333 -
 contrib/askant/askant/sysfs.py                     |   86 -
 contrib/askant/fsplugins/gfs2/gfs2.c               |  405 -
 contrib/askant/fsplugins/gfs2/gfs2.h               |    3 -
 contrib/askant/fsplugins/gfs2/gfs2module.c         |  104 -
 contrib/askant/scripts/askant                      |    6 -
 contrib/askant/setup.py                            |   15 -
 contrib/libaislock/Makefile                        |   13 -
 contrib/libaislock/libaislock.c                    |  466 -
 contrib/libaislock/libaislock.h                    |  190 -
 dlm/Makefile                                       |    4 -
 dlm/doc/dlm_tool.txt                               |  167 -
 dlm/doc/example.c                                  |   52 -
 dlm/doc/libdlm.txt                                 |  533 -
 dlm/doc/user-dlm-overview.txt                      |  325 -
 dlm/libdlm/51-dlm.rules                            |    5 -
 dlm/libdlm/Makefile                                |   61 -
 dlm/libdlm/libdlm.c                                | 1483 -
 dlm/libdlm/libdlm.h                                |  275 -
 dlm/libdlm/libdlm_internal.h                       |    9 -
 dlm/libdlmcontrol/Makefile                         |   15 -
 dlm/libdlmcontrol/libdlmcontrol.h                  |   89 -
 dlm/libdlmcontrol/main.c                           |  414 -
 dlm/man/Makefile                                   |   24 -
 dlm/man/dlm_cleanup.3                              |    1 -
 dlm/man/dlm_close_lockspace.3                      |    1 -
 dlm/man/dlm_create_lockspace.3                     |   94 -
 dlm/man/dlm_dispatch.3                             |    1 -
 dlm/man/dlm_get_fd.3                               |    1 -
 dlm/man/dlm_lock.3                                 |  239 -
 dlm/man/dlm_lock_wait.3                            |    1 -
 dlm/man/dlm_ls_lock.3                              |    1 -
 dlm/man/dlm_ls_lock_wait.3                         |    1 -
 dlm/man/dlm_ls_lockx.3                             |    1 -
 dlm/man/dlm_ls_pthread_init.3                      |    1 -
 dlm/man/dlm_ls_unlock.3                            |    1 -
 dlm/man/dlm_ls_unlock_wait.3                       |    1 -
 dlm/man/dlm_new_lockspace.3                        |    1 -
 dlm/man/dlm_open_lockspace.3                       |    1 -
 dlm/man/dlm_pthread_init.3                         |    1 -
 dlm/man/dlm_release_lockspace.3                    |    1 -
 dlm/man/dlm_tool.8                                 |   39 -
 dlm/man/dlm_unlock.3                               |   94 -
 dlm/man/dlm_unlock_wait.3                          |    1 -
 dlm/man/libdlm.3                                   |  105 -
 dlm/tests/Makefile                                 |    4 -
 dlm/tests/usertest/Makefile                        |   23 -
 dlm/tests/usertest/alternate-lvb.c                 |  165 -
 dlm/tests/usertest/asttest.c                       |  281 -
 dlm/tests/usertest/dlmtest.c                       |  291 -
 dlm/tests/usertest/dlmtest2.c                      | 1468 -
 dlm/tests/usertest/flood.c                         |  167 -
 dlm/tests/usertest/joinleave.c                     |   62 -
 dlm/tests/usertest/lstest.c                        |  326 -
 dlm/tests/usertest/lvb.c                           |  241 -
 dlm/tests/usertest/pingtest.c                      |  343 -
 dlm/tests/usertest/sublocks.c                      |  178 -
 dlm/tests/usertest/threads.c                       |  323 -
 dlm/tool/Makefile                                  |   32 -
 dlm/tool/main.c                                    | 1053 -
 fence/Makefile                                     |    4 -
 fence/agents/Makefile                              |   15 -
 fence/agents/alom/Makefile                         |    5 -
 fence/agents/alom/fence_alom.py                    |   69 -
 fence/agents/apc/Makefile                          |    5 -
 fence/agents/apc/fence_apc.py                      |  216 -
 fence/agents/apc_snmp/Makefile                     |    5 -
 fence/agents/apc_snmp/README                       |   45 -
 fence/agents/apc_snmp/fence_apc_snmp.py            |  455 -
 fence/agents/apc_snmp/powernet369.mib              |31109 --------------------
 fence/agents/baytech/Makefile                      |    4 -
 fence/agents/baytech/fence_baytech.pl              |  668 -
 fence/agents/bladecenter/Makefile                  |    5 -
 fence/agents/bladecenter/fence_bladecenter.py      |  113 -
 fence/agents/brocade/Makefile                      |    4 -
 fence/agents/brocade/fence_brocade.pl              |  246 -
 fence/agents/bullpap/Makefile                      |    4 -
 fence/agents/bullpap/fence_bullpap.pl              |  357 -
 fence/agents/cpint/Makefile                        |    4 -
 fence/agents/cpint/fence_cpint.pl                  |  134 -
 fence/agents/drac/Makefile                         |    5 -
 fence/agents/drac/fence_drac.pl                    |  656 -
 fence/agents/drac/fence_drac5.py                   |   78 -
 fence/agents/drac/test_drac.sh                     |   83 -
 fence/agents/egenera/Makefile                      |    4 -
 fence/agents/egenera/fence_egenera.pl              |  422 -
 fence/agents/eps/Makefile                          |    5 -
 fence/agents/eps/fence_eps.py                      |  112 -
 fence/agents/ibmblade/Makefile                     |    4 -
 fence/agents/ibmblade/fence_ibmblade.pl            |  264 -
 fence/agents/ifmib/Makefile                        |    5 -
 fence/agents/ifmib/README                          |   45 -
 fence/agents/ifmib/fence_ifmib.py                  |  221 -
 fence/agents/ilo/Makefile                          |    5 -
 fence/agents/ilo/fence_ilo.py                      |  101 -
 fence/agents/ipmilan/Makefile                      |   25 -
 fence/agents/ipmilan/expect.c                      |  342 -
 fence/agents/ipmilan/expect.h                      |   52 -
 fence/agents/ipmilan/ipmilan.c                     |  945 -
 fence/agents/ldom/Makefile                         |    5 -
 fence/agents/ldom/fence_ldom.py                    |  113 -
 fence/agents/lib/Makefile                          |    7 -
 fence/agents/lib/fencing.py.py                     |  586 -
 fence/agents/lib/telnet_ssl.py                     |   72 -
 fence/agents/lpar/Makefile                         |    5 -
 fence/agents/lpar/fence_lpar.py                    |  120 -
 fence/agents/manual/Makefile                       |   19 -
 fence/agents/manual/fence_ack_manual.sh            |   37 -
 fence/agents/mcdata/Makefile                       |    4 -
 fence/agents/mcdata/fence_mcdata.pl                |  282 -
 fence/agents/rackswitch/Makefile                   |   24 -
 fence/agents/rackswitch/do_rack.c                  |  748 -
 fence/agents/rackswitch/do_rack.h                  |   27 -
 fence/agents/rps10/Makefile                        |   26 -
 fence/agents/rps10/rps10.c                         |  521 -
 fence/agents/rsa/Makefile                          |    4 -
 fence/agents/rsa/fence_rsa.py                      |  286 -
 fence/agents/rsb/Makefile                          |    4 -
 fence/agents/rsb/fence_rsb.py                      |  376 -
 fence/agents/sanbox2/Makefile                      |    4 -
 fence/agents/sanbox2/fence_sanbox2.pl              |  241 -
 fence/agents/scsi/Makefile                         |   18 -
 fence/agents/scsi/fence_scsi.pl                    |  481 -
 fence/agents/scsi/fence_scsi_test.pl               |  221 -
 fence/agents/scsi/scsi_reserve.in                  |  338 -
 fence/agents/scsi/scsi_reserve_notify.in           |    5 -
 fence/agents/virsh/Makefile                        |    5 -
 fence/agents/virsh/fence_virsh.py                  |   86 -
 fence/agents/vixel/Makefile                        |    4 -
 fence/agents/vixel/fence_vixel.pl                  |  203 -
 fence/agents/vmware/Makefile                       |    4 -
 fence/agents/vmware/fence_vmware.py                |  143 -
 fence/agents/vmware_vi/Makefile                    |    5 -
 fence/agents/vmware_vi/fence_vmware_vi.py          |  149 -
 fence/agents/vmware_vi/fence_vmware_vi_helper.pl   |  237 -
 fence/agents/vmware_vmrun/Makefile                 |    4 -
 fence/agents/vmware_vmrun/fence_vmware_vmrun.py    |  154 -
 fence/agents/wti/Makefile                          |    5 -
 fence/agents/wti/fence_wti.py                      |  116 -
 fence/agents/xcat/Makefile                         |    4 -
 fence/agents/xcat/fence_xcat.pl                    |  188 -
 fence/agents/xvm/Makefile                          |   66 -
 fence/agents/xvm/README                            |  182 -
 fence/agents/xvm/TODO                              |   33 -
 fence/agents/xvm/debug.c                           |   18 -
 fence/agents/xvm/debug.h                           |   15 -
 fence/agents/xvm/fence_xvm.c                       |  375 -
 fence/agents/xvm/fence_xvmd.c                      | 1004 -
 fence/agents/xvm/ip_lookup.c                       |  307 -
 fence/agents/xvm/ip_lookup.h                       |   22 -
 fence/agents/xvm/mcast.c                           |  356 -
 fence/agents/xvm/mcast.h                           |   16 -
 fence/agents/xvm/options-ccs.c                     |  100 -
 fence/agents/xvm/options.c                         |  677 -
 fence/agents/xvm/options.h                         |   57 -
 fence/agents/xvm/simple_auth.c                     |  395 -
 fence/agents/xvm/simple_auth.h                     |   17 -
 fence/agents/xvm/tcp.c                             |  281 -
 fence/agents/xvm/tcp.h                             |    9 -
 fence/agents/xvm/tests/hvm.xml                     |   32 -
 fence/agents/xvm/tests/linux.xml                   |   31 -
 fence/agents/xvm/virt.c                            |  202 -
 fence/agents/xvm/virt.h                            |   62 -
 fence/agents/xvm/vm_states.c                       |  410 -
 fence/agents/xvm/xml.c                             |  315 -
 fence/agents/xvm/xvm.h                             |   65 -
 fence/agents/zvm/Makefile                          |    4 -
 fence/agents/zvm/fence_zvm.pl                      |  344 -
 fence/fence_node/Makefile                          |   37 -
 fence/fence_node/fence_node.c                      |  112 -
 fence/fence_tool/Makefile                          |   34 -
 fence/fence_tool/fence_tool.c                      |  660 -
 fence/fenced/Makefile                              |   42 -
 fence/fenced/config.c                              |  231 -
 fence/fenced/config.h                              |   32 -
 fence/fenced/cpg.c                                 | 1976 --
 fence/fenced/fd.h                                  |  272 -
 fence/fenced/fenced.h                              |   36 -
 fence/fenced/group.c                               |  487 -
 fence/fenced/logging.c                             |   61 -
 fence/fenced/main.c                                | 1076 -
 fence/fenced/member_cman.c                         |  272 -
 fence/fenced/recover.c                             |  314 -
 fence/include/linux_endian.h                       |   68 -
 fence/include/list.h                               |  336 -
 fence/libfence/Makefile                            |   17 -
 fence/libfence/agent.c                             |  334 -
 fence/libfence/libfence.h                          |   14 -
 fence/libfenced/Makefile                           |   16 -
 fence/libfenced/libfenced.h                        |   40 -
 fence/libfenced/main.c                             |  323 -
 fence/man/Makefile                                 |   32 -
 fence/man/fence.8                                  |   30 -
 fence/man/fence_ack_manual.8                       |   36 -
 fence/man/fence_alom.8                             |   84 -
 fence/man/fence_apc.8                              |   98 -
 fence/man/fence_baytech.8                          |   82 -
 fence/man/fence_bladecenter.8                      |   95 -
 fence/man/fence_brocade.8                          |   82 -
 fence/man/fence_bullpap.8                          |   71 -
 fence/man/fence_cpint.8                            |   52 -
 fence/man/fence_drac.8                             |   97 -
 fence/man/fence_egenera.8                          |   70 -
 fence/man/fence_eps.8                              |  106 -
 fence/man/fence_ibmblade.8                         |   61 -
 fence/man/fence_ifmib.8                            |   69 -
 fence/man/fence_ilo.8                              |   94 -
 fence/man/fence_ipmilan.8                          |  100 -
 fence/man/fence_ldom.8                             |  114 -
 fence/man/fence_manual.8                           |   49 -
 fence/man/fence_mcdata.8                           |   82 -
 fence/man/fence_node.8                             |   34 -
 fence/man/fence_rackswitch.8                       |   68 -
 fence/man/fence_rib.8                              |   10 -
 fence/man/fence_rsa.8                              |   69 -
 fence/man/fence_rsb.8                              |   75 -
 fence/man/fence_sanbox2.8                          |   82 -
 fence/man/fence_scsi.8                             |  103 -
 fence/man/fence_tool.8                             |   42 -
 fence/man/fence_virsh.8                            |  104 -
 fence/man/fence_vixel.8                            |   70 -
 fence/man/fence_vmware.8                           |  131 -
 fence/man/fence_vmware_vmrun.8                     |  137 -
 fence/man/fence_wti.8                              |   83 -
 fence/man/fence_xcat.8                             |   61 -
 fence/man/fence_xvm.8                              |  135 -
 fence/man/fence_xvmd.8                             |  120 -
 fence/man/fence_zvm.8                              |   62 -
 fence/man/fenced.8                                 |  296 -
 gfs2/Makefile                                      |    4 -
 gfs2/convert/Makefile                              |   33 -
 gfs2/convert/gfs2_convert.c                        | 1614 -
 gfs2/edit/Makefile                                 |   37 -
 gfs2/edit/gfs2hex.c                                |  581 -
 gfs2/edit/gfs2hex.h                                |   10 -
 gfs2/edit/hexedit.c                                | 2775 --
 gfs2/edit/hexedit.h                                |  324 -
 gfs2/edit/savemeta.c                               |  748 -
 gfs2/fsck/FEATURES                                 |   25 -
 gfs2/fsck/Makefile                                 |   67 -
 gfs2/fsck/TODO                                     |   49 -
 gfs2/fsck/eattr.c                                  |  103 -
 gfs2/fsck/eattr.h                                  |   21 -
 gfs2/fsck/fs_bits.h                                |   34 -
 gfs2/fsck/fs_recovery.c                            |  428 -
 gfs2/fsck/fs_recovery.h                            |    9 -
 gfs2/fsck/fsck.h                                   |   81 -
 gfs2/fsck/hash.c                                   |   91 -
 gfs2/fsck/hash.h                                   |    7 -
 gfs2/fsck/initialize.c                             |  396 -
 gfs2/fsck/inode_hash.c                             |   77 -
 gfs2/fsck/inode_hash.h                             |    9 -
 gfs2/fsck/link.c                                   |   98 -
 gfs2/fsck/link.h                                   |    8 -
 gfs2/fsck/lost_n_found.c                           |  146 -
 gfs2/fsck/lost_n_found.h                           |    8 -
 gfs2/fsck/main.c                                   |  380 -
 gfs2/fsck/metawalk.c                               | 1012 -
 gfs2/fsck/metawalk.h                               |   74 -
 gfs2/fsck/pass1.c                                  |  903 -
 gfs2/fsck/pass1b.c                                 |  523 -
 gfs2/fsck/pass1c.c                                 |  271 -
 gfs2/fsck/pass2.c                                  |  773 -
 gfs2/fsck/pass3.c                                  |  282 -
 gfs2/fsck/pass4.c                                  |  173 -
 gfs2/fsck/pass5.c                                  |  207 -
 gfs2/fsck/rgrepair.c                               |  568 -
 gfs2/fsck/test.c                                   |    8 -
 gfs2/fsck/test_bitmap.c                            |   38 -
 gfs2/fsck/test_block_list.c                        |   91 -
 gfs2/fsck/util.c                                   |   81 -
 gfs2/fsck/util.h                                   |   14 -
 gfs2/include/gfs2_disk_hash.h                      |   73 -
 gfs2/include/global.h                              |   42 -
 gfs2/include/linux_endian.h                        |   68 -
 gfs2/include/osi_list.h                            |   84 -
 gfs2/include/osi_user.h                            |  421 -
 gfs2/init.d/Makefile                               |   17 -
 gfs2/init.d/gfs2.in                                |  149 -
 gfs2/libgfs2/Makefile                              |   34 -
 gfs2/libgfs2/bitmap.c                              |  145 -
 gfs2/libgfs2/block_list.c                          |  175 -
 gfs2/libgfs2/buf.c                                 |  206 -
 gfs2/libgfs2/device_geometry.c                     |   90 -
 gfs2/libgfs2/fs_bits.c                             |  273 -
 gfs2/libgfs2/fs_geometry.c                         |  233 -
 gfs2/libgfs2/fs_ops.c                              | 1632 -
 gfs2/libgfs2/gfs1.c                                |  395 -
 gfs2/libgfs2/gfs2_log.c                            |  203 -
 gfs2/libgfs2/libgfs2.h                             |  717 -
 gfs2/libgfs2/locking.c                             |   57 -
 gfs2/libgfs2/misc.c                                |  636 -
 gfs2/libgfs2/ondisk.c                              |  599 -
 gfs2/libgfs2/ondisk.h                              |   59 -
 gfs2/libgfs2/recovery.c                            |  244 -
 gfs2/libgfs2/rgrp.c                                |  165 -
 gfs2/libgfs2/size.c                                |   82 -
 gfs2/libgfs2/structures.c                          |  597 -
 gfs2/libgfs2/super.c                               |  268 -
 gfs2/man/Makefile                                  |   13 -
 gfs2/man/gfs2.8                                    |   40 -
 gfs2/man/gfs2_convert.8                            |   46 -
 gfs2/man/gfs2_edit.8                               |  319 -
 gfs2/man/gfs2_fsck.8                               |   59 -
 gfs2/man/gfs2_grow.8                               |   60 -
 gfs2/man/gfs2_jadd.8                               |   60 -
 gfs2/man/gfs2_mount.8                              |  202 -
 gfs2/man/gfs2_quota.8                              |  105 -
 gfs2/man/gfs2_tool.8                               |  138 -
 gfs2/man/mkfs.gfs2.8                               |   95 -
 gfs2/mkfs/Makefile                                 |   51 -
 gfs2/mkfs/README                                   |   25 -
 gfs2/mkfs/gfs2_mkfs.h                              |   70 -
 gfs2/mkfs/main.c                                   |   55 -
 gfs2/mkfs/main_grow.c                              |  332 -
 gfs2/mkfs/main_jadd.c                              |  510 -
 gfs2/mkfs/main_mkfs.c                              |  476 -
 gfs2/mount/Makefile                                |   38 -
 gfs2/mount/mount.gfs2.c                            |  261 -
 gfs2/mount/mtab.c                                  |  198 -
 gfs2/mount/ondisk1.c                               |   19 -
 gfs2/mount/util.c                                  |  572 -
 gfs2/mount/util.h                                  |   93 -
 gfs2/quota/Makefile                                |   35 -
 gfs2/quota/check.c                                 |  549 -
 gfs2/quota/gfs2_quota.h                            |   88 -
 gfs2/quota/main.c                                  | 1016 -
 gfs2/quota/names.c                                 |   81 -
 gfs2/tool/Makefile                                 |   39 -
 gfs2/tool/decipher_lockstate_dump                  |  175 -
 gfs2/tool/df.c                                     |  182 -
 gfs2/tool/gfs2_tool.h                              |   63 -
 gfs2/tool/iflags.h                                 |   40 -
 gfs2/tool/layout.c                                 |  848 -
 gfs2/tool/main.c                                   |  269 -
 gfs2/tool/misc.c                                   |  721 -
 gfs2/tool/ondisk.c                                 |   13 -
 gfs2/tool/parse_lockdump                           |  158 -
 gfs2/tool/sb.c                                     |  147 -
 gfs2/tool/tune.c                                   |  106 -
 group/Makefile                                     |    8 -
 group/daemon/Makefile                              |   35 -
 group/daemon/app.c                                 | 1842 --
 group/daemon/cman.c                                |  206 -
 group/daemon/cpg.c                                 | 1072 -
 group/daemon/gd_internal.h                         |  323 -
 group/daemon/groupd.h                              |   13 -
 group/daemon/joinleave.c                           |  165 -
 group/daemon/logging.c                             |   60 -
 group/daemon/main.c                                | 1082 -
 group/dlm_controld/Makefile                        |   76 -
 group/dlm_controld/action.c                        |  936 -
 group/dlm_controld/config.c                        |  307 -
 group/dlm_controld/config.h                        |   53 -
 group/dlm_controld/cpg.c                           | 2290 --
 group/dlm_controld/crc.c                           |   72 -
 group/dlm_controld/deadlock.c                      | 1547 -
 group/dlm_controld/dlm_controld.h                  |   37 -
 group/dlm_controld/dlm_daemon.h                    |  349 -
 group/dlm_controld/group.c                         |  364 -
 group/dlm_controld/logging.c                       |   61 -
 group/dlm_controld/main.c                          | 1364 -
 group/dlm_controld/member_cman.c                   |  270 -
 group/dlm_controld/netlink.c                       |  225 -
 group/dlm_controld/pacemaker.c                     |  409 -
 group/dlm_controld/plock.c                         | 2193 --
 group/gfs_control/Makefile                         |   31 -
 group/gfs_control/main.c                           |  466 -
 group/gfs_controld/Makefile                        |   51 -
 group/gfs_controld/config.c                        |  221 -
 group/gfs_controld/config.h                        |   38 -
 group/gfs_controld/cpg-new.c                       | 3476 ---
 group/gfs_controld/cpg-old.c                       | 2442 --
 group/gfs_controld/cpg-old.h                       |   73 -
 group/gfs_controld/crc.c                           |   72 -
 group/gfs_controld/gfs_controld.h                  |   37 -
 group/gfs_controld/gfs_daemon.h                    |  331 -
 group/gfs_controld/group.c                         |  360 -
 group/gfs_controld/logging.c                       |   61 -
 group/gfs_controld/main.c                          | 1583 -
 group/gfs_controld/member_cman.c                   |  121 -
 group/gfs_controld/plock.c                         | 2361 --
 group/gfs_controld/util.c                          |  288 -
 group/include/linux_endian.h                       |   68 -
 group/include/list.h                               |  336 -
 group/lib/Makefile                                 |   14 -
 group/lib/libgroup.c                               |  524 -
 group/lib/libgroup.h                               |   81 -
 group/libgfscontrol/Makefile                       |   16 -
 group/libgfscontrol/libgfscontrol.h                |  122 -
 group/libgfscontrol/main.c                         |  426 -
 group/man/Makefile                                 |    7 -
 group/man/dlm_controld.8                           |  123 -
 group/man/gfs_controld.8                           |  122 -
 group/man/group_tool.8                             |   61 -
 group/man/groupd.8                                 |   43 -
 group/test/Makefile                                |   16 -
 group/test/client.c                                |   45 -
 group/test/clientd.c                               |  179 -
 group/tool/Makefile                                |   38 -
 group/tool/main.c                                  |  746 -
 make/cobj.mk                                       |   12 -
 make/defines.mk.input                              |   61 -
 make/fencebuild.mk                                 |   25 -
 make/install.mk                                    |   26 -
 make/uninstall.mk                                  |   18 -
 rgmanager/ChangeLog                                |  629 -
 rgmanager/Makefile                                 |    4 -
 rgmanager/README                                   |  359 -
 rgmanager/errors.txt                               |  552 -
 rgmanager/event-script.txt                         |  305 -
 rgmanager/examples/cluster.conf                    |  106 -
 rgmanager/include/cman-private.h                   |   14 -
 rgmanager/include/depends.h                        |  134 -
 rgmanager/include/ds.h                             |   13 -
 rgmanager/include/event.h                          |  128 -
 rgmanager/include/fdops.h                          |   14 -
 rgmanager/include/findproc.h                       |   11 -
 rgmanager/include/gettid.h                         |    7 -
 rgmanager/include/list.h                           |   94 -
 rgmanager/include/lock.h                           |   22 -
 rgmanager/include/logging.h                        |   11 -
 rgmanager/include/members.h                        |   38 -
 rgmanager/include/message.h                        |  160 -
 rgmanager/include/msgsimple.h                      |   64 -
 rgmanager/include/platform.h                       |   59 -
 rgmanager/include/pthread_dbg.h                    |   41 -
 rgmanager/include/res-ocf.h                        |   50 -
 rgmanager/include/resgroup.h                       |  282 -
 rgmanager/include/reslist.h                        |  222 -
 rgmanager/include/restart_counter.h                |   14 -
 rgmanager/include/rg_locks.h                       |   34 -
 rgmanager/include/rg_queue.h                       |   48 -
 rgmanager/include/rg_types.h                       |   18 -
 rgmanager/include/rmtab.h                          |  101 -
 rgmanager/include/sets.h                           |   22 -
 rgmanager/include/signals.h                        |    9 -
 rgmanager/include/vf.h                             |  177 -
 rgmanager/init.d/Makefile                          |   19 -
 rgmanager/init.d/rgmanager.in                      |  192 -
 rgmanager/man/Makefile                             |   12 -
 rgmanager/man/cluarp.8                             |   15 -
 rgmanager/man/clubufflush.8                        |   13 -
 rgmanager/man/clufindhostname.8                    |   22 -
 rgmanager/man/clulog.8                             |   35 -
 rgmanager/man/clunfsops.8                          |   14 -
 rgmanager/man/clurgmgrd.8                          |   41 -
 rgmanager/man/clurmtabd.8                          |   37 -
 rgmanager/man/clustat.8                            |   53 -
 rgmanager/man/clusvcadm.8                          |  133 -
 rgmanager/src/Makefile                             |    4 -
 rgmanager/src/clulib/Makefile                      |   49 -
 rgmanager/src/clulib/alloc.c                       | 1233 -
 rgmanager/src/clulib/ckpt_state.c                  |  535 -
 rgmanager/src/clulib/cman.c                        |  248 -
 rgmanager/src/clulib/daemon_init.c                 |  225 -
 rgmanager/src/clulib/fdops.c                       |  175 -
 rgmanager/src/clulib/gettid.c                      |   24 -
 rgmanager/src/clulib/lock.c                        |  297 -
 rgmanager/src/clulib/locktest.c                    |   67 -
 rgmanager/src/clulib/logging.c                     |  112 -
 rgmanager/src/clulib/members.c                     |  569 -
 rgmanager/src/clulib/message.c                     |  291 -
 rgmanager/src/clulib/msg_cluster.c                 | 1266 -
 rgmanager/src/clulib/msg_socket.c                  |  426 -
 rgmanager/src/clulib/msgsimple.c                   |  108 -
 rgmanager/src/clulib/msgtest.c                     |  280 -
 rgmanager/src/clulib/rg_strings.c                  |  204 -
 rgmanager/src/clulib/sets.c                        |  353 -
 rgmanager/src/clulib/signals.c                     |   68 -
 rgmanager/src/clulib/tmgr.c                        |  109 -
 rgmanager/src/clulib/vft.c                         | 1803 --
 rgmanager/src/clulib/wrap_lock.c                   |  205 -
 rgmanager/src/daemons/Makefile                     |  120 -
 rgmanager/src/daemons/depends.c                    | 2512 --
 rgmanager/src/daemons/dtest.c                      |  817 -
 rgmanager/src/daemons/event_config.c               |  520 -
 rgmanager/src/daemons/fo_domain.c                  |  640 -
 rgmanager/src/daemons/groups.c                     | 1832 --
 rgmanager/src/daemons/main.c                       | 1110 -
 rgmanager/src/daemons/reslist.c                    |  872 -
 rgmanager/src/daemons/resrules.c                   | 1174 -
 rgmanager/src/daemons/restart_counter.c            |  168 -
 rgmanager/src/daemons/restree.c                    | 1682 --
 rgmanager/src/daemons/rg_event.c                   |  585 -
 rgmanager/src/daemons/rg_forward.c                 |  279 -
 rgmanager/src/daemons/rg_locks.c                   |  318 -
 rgmanager/src/daemons/rg_queue.c                   |   67 -
 rgmanager/src/daemons/rg_state.c                   | 2189 --
 rgmanager/src/daemons/rg_thread.c                  |  732 -
 rgmanager/src/daemons/sbuf.c                       |   85 -
 rgmanager/src/daemons/service_op.c                 |  196 -
 rgmanager/src/daemons/slang_event.c                | 1241 -
 rgmanager/src/daemons/test.c                       |  490 -
 .../daemons/tests/delta-test001-test002.expected   |   22 -
 .../daemons/tests/delta-test002-test003.expected   |   34 -
 .../daemons/tests/delta-test003-test004.expected   |   46 -
 .../daemons/tests/delta-test004-test005.expected   |   58 -
 .../daemons/tests/delta-test005-test006.expected   |   70 -
 .../daemons/tests/delta-test006-test007.expected   |   70 -
 .../daemons/tests/delta-test007-test008.expected   |   80 -
 .../daemons/tests/delta-test008-test009.expected   |   96 -
 .../daemons/tests/delta-test009-test010.expected   |  110 -
 .../daemons/tests/delta-test010-test011.expected   |  180 -
 .../daemons/tests/delta-test011-test012.expected   |  248 -
 .../daemons/tests/delta-test012-test013.expected   |  254 -
 .../daemons/tests/delta-test013-test014.expected   |  319 -
 .../daemons/tests/delta-test014-test015.expected   |  384 -
 .../daemons/tests/delta-test015-test016.expected   |  385 -
 .../daemons/tests/delta-test016-test017.expected   |  408 -
 rgmanager/src/daemons/tests/deptest1.conf          |   63 -
 rgmanager/src/daemons/tests/deptest1.in            |   11 -
 rgmanager/src/daemons/tests/deptest2.conf          |   50 -
 rgmanager/src/daemons/tests/deptest2.in            |   11 -
 rgmanager/src/daemons/tests/gentests.sh            |   74 -
 rgmanager/src/daemons/tests/runtests.sh            |  122 -
 rgmanager/src/daemons/tests/test001.conf           |    7 -
 rgmanager/src/daemons/tests/test001.expected       |   11 -
 rgmanager/src/daemons/tests/test001.start.expected |    3 -
 rgmanager/src/daemons/tests/test001.stop.expected  |    3 -
 rgmanager/src/daemons/tests/test002.conf           |   13 -
 rgmanager/src/daemons/tests/test002.expected       |   11 -
 rgmanager/src/daemons/tests/test002.start.expected |    3 -
 rgmanager/src/daemons/tests/test002.stop.expected  |    3 -
 rgmanager/src/daemons/tests/test003.conf           |   14 -
 rgmanager/src/daemons/tests/test003.expected       |   23 -
 rgmanager/src/daemons/tests/test003.start.expected |    4 -
 rgmanager/src/daemons/tests/test003.stop.expected  |    4 -
 rgmanager/src/daemons/tests/test004.conf           |   15 -
 rgmanager/src/daemons/tests/test004.expected       |   23 -
 rgmanager/src/daemons/tests/test004.start.expected |    4 -
 rgmanager/src/daemons/tests/test004.stop.expected  |    4 -
 rgmanager/src/daemons/tests/test005.conf           |   16 -
 rgmanager/src/daemons/tests/test005.expected       |   35 -
 rgmanager/src/daemons/tests/test005.start.expected |    5 -
 rgmanager/src/daemons/tests/test005.stop.expected  |    5 -
 rgmanager/src/daemons/tests/test006.conf           |   16 -
 rgmanager/src/daemons/tests/test006.expected       |   35 -
 rgmanager/src/daemons/tests/test006.start.expected |    5 -
 rgmanager/src/daemons/tests/test006.stop.expected  |    5 -
 rgmanager/src/daemons/tests/test007.conf           |   17 -
 rgmanager/src/daemons/tests/test007.expected       |   35 -
 rgmanager/src/daemons/tests/test007.start.expected |    5 -
 rgmanager/src/daemons/tests/test007.stop.expected  |    5 -
 rgmanager/src/daemons/tests/test008.conf           |   20 -
 rgmanager/src/daemons/tests/test008.expected       |   45 -
 rgmanager/src/daemons/tests/test008.start.expected |    5 -
 rgmanager/src/daemons/tests/test008.stop.expected  |    5 -
 rgmanager/src/daemons/tests/test009.conf           |   19 -
 rgmanager/src/daemons/tests/test009.expected       |   51 -
 rgmanager/src/daemons/tests/test009.start.expected |    6 -
 rgmanager/src/daemons/tests/test009.stop.expected  |    6 -
 rgmanager/src/daemons/tests/test010.conf           |   19 -
 rgmanager/src/daemons/tests/test010.expected       |   59 -
 rgmanager/src/daemons/tests/test010.start.expected |    6 -
 rgmanager/src/daemons/tests/test010.stop.expected  |    6 -
 rgmanager/src/daemons/tests/test011.conf           |   38 -
 rgmanager/src/daemons/tests/test011.expected       |  121 -
 rgmanager/src/daemons/tests/test011.start.expected |    9 -
 rgmanager/src/daemons/tests/test011.stop.expected  |    9 -
 rgmanager/src/daemons/tests/test012.conf           |   33 -
 rgmanager/src/daemons/tests/test012.expected       |  127 -
 rgmanager/src/daemons/tests/test012.start.expected |   10 -
 rgmanager/src/daemons/tests/test012.stop.expected  |   10 -
 rgmanager/src/daemons/tests/test013.conf           |   34 -
 rgmanager/src/daemons/tests/test013.expected       |  127 -
 rgmanager/src/daemons/tests/test013.start.expected |   10 -
 rgmanager/src/daemons/tests/test013.stop.expected  |   10 -
 rgmanager/src/daemons/tests/test014.conf           |   46 -
 rgmanager/src/daemons/tests/test014.expected       |  192 -
 rgmanager/src/daemons/tests/test014.start.expected |   20 -
 rgmanager/src/daemons/tests/test014.stop.expected  |   20 -
 rgmanager/src/daemons/tests/test015.conf           |   51 -
 rgmanager/src/daemons/tests/test015.expected       |  192 -
 rgmanager/src/daemons/tests/test015.start.expected |   20 -
 rgmanager/src/daemons/tests/test015.stop.expected  |   20 -
 rgmanager/src/daemons/tests/test016.conf           |   50 -
 rgmanager/src/daemons/tests/test016.expected       |  193 -
 rgmanager/src/daemons/tests/test016.start.expected |   22 -
 rgmanager/src/daemons/tests/test016.stop.expected  |   22 -
 rgmanager/src/daemons/tests/test017.conf           |   68 -
 rgmanager/src/daemons/tests/test017.expected       |  215 -
 rgmanager/src/daemons/tests/test017.start.expected |   22 -
 rgmanager/src/daemons/tests/test017.stop.expected  |   22 -
 rgmanager/src/daemons/tests/test018.conf           |   78 -
 rgmanager/src/daemons/tests/test018.start.expected |   24 -
 rgmanager/src/daemons/tests/test018.stop.expected  |   24 -
 rgmanager/src/daemons/tests/testlist               |    4 -
 rgmanager/src/daemons/watchdog.c                   |   79 -
 rgmanager/src/resources/ASEHAagent.sh              |  900 -
 rgmanager/src/resources/Makefile                   |   78 -
 rgmanager/src/resources/SAPDatabase                | 1000 -
 rgmanager/src/resources/SAPInstance                |  587 -
 rgmanager/src/resources/apache.metadata            |   95 -
 rgmanager/src/resources/apache.sh                  |  251 -
 rgmanager/src/resources/clusterfs.sh               |  962 -
 rgmanager/src/resources/default_event_script.sl    |  319 -
 rgmanager/src/resources/follow-service.sl          |  151 -
 rgmanager/src/resources/fs.sh.in                   | 1304 -
 rgmanager/src/resources/ip.sh                      |  952 -
 rgmanager/src/resources/lvm.metadata               |   86 -
 rgmanager/src/resources/lvm.sh                     |  174 -
 rgmanager/src/resources/lvm_by_lv.sh               |  337 -
 rgmanager/src/resources/lvm_by_vg.sh               |  262 -
 rgmanager/src/resources/mysql.metadata             |   96 -
 rgmanager/src/resources/mysql.sh                   |  174 -
 rgmanager/src/resources/named.metadata             |  104 -
 rgmanager/src/resources/named.sh                   |  193 -
 rgmanager/src/resources/netfs.sh                   |  712 -
 rgmanager/src/resources/nfsclient.sh               |  445 -
 rgmanager/src/resources/nfsexport.sh               |  245 -
 rgmanager/src/resources/nfsserver.sh               |  409 -
 rgmanager/src/resources/ocf-shellfuncs             |  165 -
 rgmanager/src/resources/openldap.metadata          |   98 -
 rgmanager/src/resources/openldap.sh                |  209 -
 rgmanager/src/resources/oracledb.sh.in             |  888 -
 rgmanager/src/resources/postgres-8.metadata        |   95 -
 rgmanager/src/resources/postgres-8.sh              |  204 -
 rgmanager/src/resources/ra-api-1-modified.dtd      |   68 -
 rgmanager/src/resources/samba.metadata             |   89 -
 rgmanager/src/resources/samba.sh                   |  223 -
 rgmanager/src/resources/script.sh                  |  103 -
 rgmanager/src/resources/service.sh                 |  280 -
 rgmanager/src/resources/smb.sh                     |  674 -
 rgmanager/src/resources/svclib_nfslock             |  260 -
 rgmanager/src/resources/tomcat-5.metadata          |  104 -
 rgmanager/src/resources/tomcat-5.sh                |  256 -
 rgmanager/src/resources/utils/config-utils.sh.in   |  228 -
 .../src/resources/utils/httpd-parse-config.pl      |   65 -
 rgmanager/src/resources/utils/member_util.sh       |   66 -
 rgmanager/src/resources/utils/messages.sh          |  243 -
 .../src/resources/utils/named-parse-config.pl      |   26 -
 rgmanager/src/resources/utils/ra-skelet.sh         |   70 -
 .../src/resources/utils/tomcat-parse-config.pl     |   45 -
 rgmanager/src/resources/vm.sh                      |  576 -
 rgmanager/src/utils/Makefile                       |   75 -
 rgmanager/src/utils/cluarp.c                       |  158 -
 rgmanager/src/utils/clubufflush.c                  |  121 -
 rgmanager/src/utils/clufindhostname.c              |   75 -
 rgmanager/src/utils/clulog.c                       |   80 -
 rgmanager/src/utils/clunfslock.sh                  |   69 -
 rgmanager/src/utils/clunfsops.c                    |  224 -
 rgmanager/src/utils/clustat.c                      | 1148 -
 rgmanager/src/utils/clusvcadm.c                    |  442 -
 rgmanager/src/utils/syscall.h                      |  165 -
 scripts/fenceparse                                 |   35 -
 776 files changed, 6 insertions(+), 210615 deletions(-)

diff --git a/Makefile b/Makefile
index 78bcdee..fdf89b5 100644
--- a/Makefile
+++ b/Makefile
@@ -1,24 +1,12 @@
 include make/defines.mk
 
 
-REALSUBDIRS = gfs-kernel/src/gfs \
-	      common cman/lib config cman dlm fence/libfenced group \
-	      fence gfs gfs2 rgmanager bindings doc \
-	      contrib
+REALSUBDIRS = gfs-kernel/src/gfs gfs doc\
+	      bindings contrib
 
 SUBDIRS = $(filter-out \
-	  $(if ${without_common},common) \
 	  $(if ${without_gfs-kernel/src/gfs},gfs-kernel/src/gfs) \
-	  $(if ${without_config},config) \
-	  $(if ${without_cman},cman/lib) \
-	  $(if ${without_cman},cman) \
-	  $(if ${without_dlm},dlm) \
-	  $(if ${without_fence},fence/libfenced) \
-	  $(if ${without_group},group) \
-	  $(if ${without_fence},fence) \
 	  $(if ${without_gfs},gfs) \
-	  $(if ${without_gfs2},gfs2) \
-	  $(if ${without_rgmanager},rgmanager) \
 	  $(if ${without_bindings},bindings) \
 	  , $(REALSUBDIRS))
 
@@ -33,18 +21,9 @@ gfs-kernel: gfs-kernel/src/gfs
 
 # Dependencies
 
-common:
-config: cman/lib
-cman: common config
-dlm: config
-fence/libfenced:
-group: cman dlm fence/libfenced
-fence: group
 gfs:
-gfs2: group
-rgmanager: cman dlm
-bindings: cman
-contrib: gfs2
+bindings:
+contrib: 
 
 oldconfig:
 	@if [ -f $(OBJDIR)/.configure.sh ]; then \
diff --git a/bindings/perl/Makefile b/bindings/perl/Makefile
index cf3a25a..97dd817 100644
--- a/bindings/perl/Makefile
+++ b/bindings/perl/Makefile
@@ -1,4 +1,4 @@
 include ../../make/defines.mk
 include $(OBJDIR)/make/binding-passthrough.mk
 
-SUBDIRS=ccs
+SUBDIRS=
diff --git a/bindings/perl/ccs/CCS.pm.in b/bindings/perl/ccs/CCS.pm.in
deleted file mode 100644
index 97a3a87..0000000
--- a/bindings/perl/ccs/CCS.pm.in
+++ /dev/null
@@ -1,145 +0,0 @@
-package Cluster::CCS;
-
-use strict;
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
-
-require Exporter;
-require DynaLoader;
-
-@ISA = qw(Exporter DynaLoader);
-# Items to export into callers namespace by default. Note: do not export
-# names by default without a very good reason. Use EXPORT_OK instead.
-# Do not simply export all your public functions/methods/constants.
-our %EXPORT_TAGS = ( 'all' => [qw(
-
-)]);
-@EXPORT = qw(
-	
-);
-@EXPORT_OK = (@{$EXPORT_TAGS{'all'}});
-
-our $VERSION = '@VERSION@';
-
-require XSLoader;
-XSLoader::load('Cluster::CCS', $VERSION);
-
-sub new {
-	my $class = shift;
-	my $self = bless { 
-		@_
-	};
-	return $self;
-}
-
-1;
-__END__
-
-=head1 NAME
-
-Cluster::CCS - Perl wrapper for the Cluster Configuration Service library
-
-=head1 SYNOPSIS
-
-  use Cluster::CCS;
-
-  my $ccs = new Cluster::CCS();
-
-  $ccs->fullxpath(1);
-
-  my $ccshandle = $ccs->connect();
-
-  if ($ccshandle < 1) {
-    print "Cannot comunicate with libccs\n";
-    exit $ccshandle;
-  }
-
-  my $rtn;
-  my $err;
-
-  $err = $ccs->get($ccshandle, '/cluster/@name', $rtn);
-
-  if ($err != 0) {
-    print "Query is not valid\n";
-  }
-
-  print "My Cluster name is $rtn\n";
-
-  $err = $ccs->disconnect($ccshandle);
-
-  if ($err != 0) {
-    print "Problems disconnecting from libccs\n";
-  }
-
-  exit $err;
-
-=head1 DESCRIPTION
-
-  Cluster::CCS provides a perl XS wrapper for libccs. 
-
-=head1 METHODS
-
-=head2 new
-
-  Creates a new Cluster::CCS object.
-
-=head2 fullxpath(value)
-
-  Enable or disable full xpath queries. Set 1 to enable, 0 to disable.
-  This has to be set before connect() or force_connect.
-  In order to change this value, a disconnect operation is required.
-
-=head2 connect(void)
-
-  Initialize the connection to libccs/libconfdb/corosync objdb.
-  Returns 1 on success or negative on failure.
-
-=head2 force_connect(cluster_name, blocking)
-
-  Initialize the connection to libccs/libconfdb/corosync objdb.
-  If blocking is set, it will retry the operation until it succeed.
-  Returns 1 on success or negative on failure.
-
-=head2 disconnect(desc)
-
-  Disconnect and free resources allocated during opertaion.
-  Returns 0 on success.
-
-=head2 get(desc, query, rtn)
-
-  Perform a simple xpath query.
-  Returns 0 on success, negative otherwise. On success rtn will contain the
-  requested data.
-
-=head2 get_list(desc, query, rtn)
-
-  Perform a simple xpath query and retain some data to iterate over a list of
-  results.
-  Returns 0 on success, negative otherwise. On success rtn will contain the
-  requested data.
-
-=head2 set(desc, path, val)
-
-  This operation is not yet implemented in libccs.
-
-=head2 lookup_nodename(desc, nodename, rtn)
-
-  Perform a nodename lookup using several methods.
-  Return 0 on success and rtn will contain the requested data.
-
-=head1 EXPORTS
-
-Nothing is exported by default.
-
-=head1 BUGS
-
-  https://bugzilla.redhat.com/
-
-=head1 SEE ALSO
-
-  cluster.conf(5), ccs(7), ccs_tool(8)
-
-=head1 AUTHOR
-
-Fabio M. Di Nitto <fdinitto@redhat.com>
-
-=cut
diff --git a/bindings/perl/ccs/CCS.xs b/bindings/perl/ccs/CCS.xs
deleted file mode 100644
index 21a651d..0000000
--- a/bindings/perl/ccs/CCS.xs
+++ /dev/null
@@ -1,82 +0,0 @@
-#include "EXTERN.h"
-#include "perl.h"
-#include "XSUB.h"
-
-#include "ccs.h"
-
-MODULE = Cluster::CCS PACKAGE = Cluster::CCS
-
-PROTOTYPES: ENABLE
-
-void
-fullxpath(self, value)
-    int value;
-    CODE:
-	fullxpath = value;
-
-int
-connect(self)
-    CODE:
-        RETVAL = ccs_connect();
-    OUTPUT:
-    RETVAL
-
-int
-force_connect(self, cluster_name, blocking)
-    const char *cluster_name;
-    int blocking;
-    CODE:
-	RETVAL = ccs_force_connect(cluster_name, blocking);
-    OUTPUT:
-    RETVAL
-
-int
-disconnect(self, desc)
-    int desc;
-    CODE:
-	RETVAL = ccs_disconnect(desc);
-    OUTPUT:
-    RETVAL
-
-int
-get(self, desc, query, rtn)
-    int desc;
-    const char *query;
-    char *rtn;
-    CODE:
-	RETVAL = ccs_get(desc, query, &rtn);
-    OUTPUT:
-    RETVAL
-    rtn
-
-int
-get_list(self, desc, query, rtn)
-    int desc;
-    const char *query;
-    char *rtn;
-    CODE:
-	RETVAL = ccs_get_list(desc, query, &rtn);
-    OUTPUT:
-    RETVAL
-    rtn
-
-int
-set(self, desc, path, val)
-    int desc;
-    char *path;
-    char *val;
-    CODE:
-	RETVAL = ccs_set(desc, path, val);
-    OUTPUT:
-    RETVAL
-
-int
-lookup_nodename(self, desc, nodename, rtn)
-    int desc;
-    const char *nodename;
-    char *rtn;
-    CODE:
-	RETVAL = ccs_lookup_nodename(desc, nodename, &rtn);
-    OUTPUT:
-    RETVAL
-    rtn
diff --git a/bindings/perl/ccs/MANIFEST b/bindings/perl/ccs/MANIFEST
deleted file mode 100644
index c089dd7..0000000
--- a/bindings/perl/ccs/MANIFEST
+++ /dev/null
@@ -1,7 +0,0 @@
-CCS.pm
-CCS.xs
-Makefile.PL
-MANIFEST
-test.pl
-typemap
-META.yml                                 Module meta-data (added by MakeMaker)
diff --git a/bindings/perl/ccs/META.yml.in b/bindings/perl/ccs/META.yml.in
deleted file mode 100644
index 32ae9a3..0000000
--- a/bindings/perl/ccs/META.yml.in
+++ /dev/null
@@ -1,13 +0,0 @@
---- #YAML:1.0
-name:                Cluster-CCS
-version:             @VERSION@
-abstract:            ~
-license:             ~
-author:              
-    - Fabio M. Di Nitto <fdinitto@redhat.com>
-generated_by:        ExtUtils::MakeMaker version 6.42
-distribution_type:   module
-requires:     
-meta-spec:
-    url:     http://module-build.sourceforge.net/META-spec-v1.3.html
-    version: 1.3
diff --git a/bindings/perl/ccs/Makefile.PL b/bindings/perl/ccs/Makefile.PL
deleted file mode 100644
index b5504ea..0000000
--- a/bindings/perl/ccs/Makefile.PL
+++ /dev/null
@@ -1,28 +0,0 @@
-use ExtUtils::MakeMaker;
-
-my %INFOS = (
-    'NAME'	=> 'Cluster::CCS',
-    'VERSION_FROM' => 'CCS.pm', # finds $VERSION
-    'AUTHOR'	=> 'Fabio M. Di Nitto <fdinitto@redhat.com>',
-    'ABSTRACT'	=> 'Interface to Cluster Configuration Service library',
-);
-
-# read extra configurations from the commandline
-my %params;
-@params{qw(DEBUG DEFINE EXTRALIBDIR GDOME INC LIBS SKIP_SAX_INSTALL XMLPREFIX)}=();
-
-@ARGV = grep {
-  my ($key, $val) = split(/=/, $_, 2);
-  if (exists $params{$key}) {
-    $config{$key} = $val; 0
-  } else { 1 }
-} @ARGV;
-
-$extralibdir = $config{EXTRALIBDIR};
-delete $config{EXTRALIBDIR};
-
-WriteMakefile(
-              %INFOS,
-              %config,
-);
-
diff --git a/bindings/perl/ccs/Makefile.bindings b/bindings/perl/ccs/Makefile.bindings
deleted file mode 100644
index 9818a89..0000000
--- a/bindings/perl/ccs/Makefile.bindings
+++ /dev/null
@@ -1,13 +0,0 @@
-include ../../../make/defines.mk
-
-PMTARGET = CCS.pm
-
-TARGET = $(PMTARGET)
-
-CFLAGS += -I${ccsincdir}
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${ccslibdir} -lccs
-LDFLAGS += -L${libdir}
-
-include $(OBJDIR)/make/perl-binding-common.mk
diff --git a/bindings/perl/ccs/test.pl b/bindings/perl/ccs/test.pl
deleted file mode 100644
index 64d740d..0000000
--- a/bindings/perl/ccs/test.pl
+++ /dev/null
@@ -1,20 +0,0 @@
-# Before `make install' is performed this script should be runnable with
-# `make test'. After `make install' it should work as `perl test.pl'
-
-######################### We start with some black magic to print on failure.
-
-# Change 1..1 below to 1..last_test_to_print .
-# (It may become useful if the test is moved to ./t subdirectory.)
-
-BEGIN { $| = 1; print "1..1\n"; }
-END {print "not ok 1\n" unless $loaded;}
-use Cluster::CCS;
-$loaded = 1;
-print "ok 1\n";
-
-######################### End of black magic.
-
-# Insert your test code below (better if it prints "ok 13"
-# (correspondingly "not ok 13") depending on the success of chunk 13
-# of the test code):
-
diff --git a/bindings/perl/ccs/typemap b/bindings/perl/ccs/typemap
deleted file mode 100644
index 02522e8..0000000
--- a/bindings/perl/ccs/typemap
+++ /dev/null
@@ -1 +0,0 @@
-TYPEMAP
diff --git a/cman/Makefile b/cman/Makefile
deleted file mode 100644
index ead0baa..0000000
--- a/cman/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../make/defines.mk
-include $(OBJDIR)/make/passthrough.mk
-
-SUBDIRS=lib cman_tool daemon qdisk notifyd init.d man
diff --git a/cman/cman_tool/Makefile b/cman/cman_tool/Makefile
deleted file mode 100644
index 0dee578..0000000
--- a/cman/cman_tool/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-TARGET= cman_tool
-
-SBINDIRT=$(TARGET)
-
-all: depends ${TARGET}
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-OBJS=	main.o \
-	join.o
-
-CFLAGS += -DCOROSYNCBIN=\"${corosyncbin}\"
-CFLAGS += -I${cmanincdir}
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${cmanlibdir} -lcman
-LDFLAGS += -L${libdir}
-
-${TARGET}: ${OBJS}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-depends:
-	$(MAKE) -C ../lib all
-
-clean: generalclean
-
--include $(OBJS:.o=.d)
diff --git a/cman/cman_tool/cman_tool.h b/cman/cman_tool/cman_tool.h
deleted file mode 100644
index 7476e1f..0000000
--- a/cman/cman_tool/cman_tool.h
+++ /dev/null
@@ -1,100 +0,0 @@
-#ifndef __CMAN_TOOL_DOT_H__
-#define __CMAN_TOOL_DOT_H__
-
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <sys/utsname.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <net/if.h>
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <fcntl.h>
-#include <netdb.h>
-#include <limits.h>
-#include <unistd.h>
-
-extern char *prog_name;
-
-#ifndef TRUE
-#define TRUE 1
-#define FALSE 0
-#endif
-
-#define die(fmt, args...) \
-do { \
-	fprintf(stderr, "%s: ", prog_name); \
-	fprintf(stderr, fmt "\n", ##args); \
-	exit(EXIT_FAILURE); \
-} while (0)
-
-#define DEFAULT_VOTES 1
-#define MAX_INTERFACES 10
-#define MAX_FORMAT_OPTS 10
-#define MAX_NODE_NAME_LEN 65
-#define MAX_MCAST_NAME_LEN 256
-#define MAX_PATH_LEN 256
-
-#define DEBUG_STARTUP_ONLY 32
-
-enum format_opt
-{
-	FMT_NONE,
-	FMT_ID,
-	FMT_NAME,
-	FMT_TYPE,
-	FMT_ADDR,
-};
-
-struct commandline
-{
-	int operation;
-        int num_nodenames;
-	char *multicast_addr;
-	char *nodenames[MAX_INTERFACES];
-        char *interfaces[MAX_INTERFACES];
-	char *override_nodename;
-	char *key_filename;
-	char *filename;
-	char *format_opts;
-	char *config_lcrso;
-	int votes;
-	int expected_votes;
-	int two_node;
-	int port;
-	char clustername[MAX_CLUSTER_NAME_LEN];
-	int remove;
-	int force;
-        int verbose;
-        int nodeid;
-	int timeout;
-	unsigned int config_version;
-
-	int config_version_opt;
-	int votes_opt;
-	int expected_votes_opt;
-	int port_opt;
-	int nodeid_opt;
-	int clustername_opt;
-	int wait_opt;
-	int wait_quorate_opt;
-	int fence_opt;
-	int addresses_opt;
-	int noconfig_opt;
-	int nosetpri_opt;
-	int noopenais_opt;
-};
-typedef struct commandline commandline_t;
-
-int join(commandline_t *comline, char *envp[]);
-char *cman_error(int err);
-
-#endif  /*  __CMAN_TOOL_DOT_H__  */
diff --git a/cman/cman_tool/join.c b/cman/cman_tool/join.c
deleted file mode 100644
index 9c78937..0000000
--- a/cman/cman_tool/join.c
+++ /dev/null
@@ -1,327 +0,0 @@
-#include <sys/wait.h>
-#include <stdint.h>
-#include <signal.h>
-#include <netinet/in.h>
-#include "libcman.h"
-#include "cman_tool.h"
-
-#define MAX_ARGS 128
-
-static char *argv[MAX_ARGS];
-static char *envp[MAX_ARGS];
-
-static void be_daemon(int close_stderr)
-{
-	int devnull = open("/dev/null", O_RDWR);
-	if (devnull == -1) {
-		perror("Can't open /dev/null");
-		exit(3);
-	}
-
-	/* Detach ourself from the calling environment */
-	if (close(0) || close(1)) {
-		die("Error closing terminal FDs");
-	}
-
-	if (dup2(devnull, 0) < 0 || dup2(devnull, 1) < 0) {
-		die("Error setting terminal FDs to /dev/null: %m");
-	}
-
-	if (close_stderr) {
-		if (close(2)) {
-			die("Error closing stderr FD");
-		}
-		if (!dup2(devnull, 2) < 0) {
-			die("Error setting stderr FD to /dev/null: %m");
-		}
-	}
-
-	setsid();
-}
-
-
-static char *corosync_exit_reason(signed char status)
-{
-	static char reason[256];
-	switch (status) {
-	case -2:
-		return "Could not determine UID to run as";
-		break;
-	case -3:
-		return "Could not determine GID to run as";
-		break;
-	case -4:
-		return "Error initialising memory pool";
-		break;
-	case -5:
-		return "Could not fork";
-		break;
-	case -6:
-		return "Could not bind to libais socket";
-		break;
-	case -7:
-		return "Could not bind to network socket";
-		break;
-	case -8:
-		return "Could not read security key for communications";
-		break;
-	case -9:
-		return "Could not read cluster configuration";
-		break;
-	case -10:
-		return "Could not set up logging";
-		break;
-	case -11:
-		return "Could not dynamically load modules";
-		break;
-	case -12:
-		return "Could not load and initialise object database";
-		break;
-	case -13:
-		return "Could not initialise all required services";
-		break;
-	case -14:
-		return "Out of memory";
-		break;
-	default:
-		sprintf(reason, "Error, reason code is %d", status);
-		return reason;
-		break;
-	}
-}
-
-static int check_corosync_status(pid_t pid)
-{
-	int status;
-	int pidstatus;
-
-	status = waitpid(pid, &pidstatus, WNOHANG);
-	if (status == -1 && errno == ECHILD) {
-
-		return 0;
-	}
-	if ((status == 0 || status == pid) && pidstatus != 0) {
-		if (WIFEXITED(pidstatus))
-			fprintf(stderr, "corosync died: %s\n", corosync_exit_reason(WEXITSTATUS(pidstatus)));
-		if (WIFSIGNALED(pidstatus))
-			fprintf(stderr, "corosync died with signal: %d\n", WTERMSIG(pidstatus));
-		exit(1);
-	}
-	return status;
-}
-
-int join(commandline_t *comline, char *main_envp[])
-{
-	int i, err;
-	int envptr = 0;
-	int argvptr = 0;
-	char scratch[1024];
-	cman_handle_t h;
-	int status;
-	pid_t corosync_pid;
-	int p[2];
-
-        /*
-	 * If we can talk to cman then we're already joined (or joining);
-	 */
-	h = cman_admin_init(NULL);
-	if (h)
-		die("Node is already active");
-
-	/* Set up environment variables for override */
-	if (comline->multicast_addr) {
-		snprintf(scratch, sizeof(scratch), "CMAN_MCAST_ADDR=%s", comline->multicast_addr);
-		envp[envptr++] = strdup(scratch);
-	}
-	if (comline->votes_opt) {
-		snprintf(scratch, sizeof(scratch), "CMAN_VOTES=%d", comline->votes);
-		envp[envptr++] = strdup(scratch);
-	}
-	if (comline->expected_votes_opt) {
-		snprintf(scratch, sizeof(scratch), "CMAN_EXPECTEDVOTES=%d", comline->expected_votes);
-		envp[envptr++] = strdup(scratch);
-	}
-	if (comline->port) {
-		snprintf(scratch, sizeof(scratch), "CMAN_IP_PORT=%d", comline->port);
-		envp[envptr++] = strdup(scratch);
-	}
-	if (comline->nodeid) {
-		snprintf(scratch, sizeof(scratch), "CMAN_NODEID=%d", comline->nodeid);
-		envp[envptr++] = strdup(scratch);
-	}
-	if (comline->clustername_opt) {
-		snprintf(scratch, sizeof(scratch), "CMAN_CLUSTER_NAME=%s", comline->clustername);
-		envp[envptr++] = strdup(scratch);
-	}
-	if (comline->nodenames[0]) {
-		snprintf(scratch, sizeof(scratch), "CMAN_NODENAME=%s", comline->nodenames[0]);
-		envp[envptr++] = strdup(scratch);
-	}
-	if (comline->key_filename) {
-		snprintf(scratch, sizeof(scratch), "CMAN_KEYFILE=%s", comline->key_filename);
-		envp[envptr++] = strdup(scratch);
-	}
-	if (comline->two_node) {
-		snprintf(scratch, sizeof(scratch), "CMAN_2NODE=true");
-		envp[envptr++] = strdup(scratch);
-	}
-	if (comline->verbose ^ DEBUG_STARTUP_ONLY) {
-		snprintf(scratch, sizeof(scratch), "CMAN_DEBUGLOG=%d", comline->verbose);
-		envp[envptr++] = strdup(scratch);
-	}
-	if (comline->noconfig_opt) {
-		envp[envptr++] = strdup("CMAN_NOCONFIG=true");
-		snprintf(scratch, sizeof(scratch), "COROSYNC_DEFAULT_CONFIG_IFACE=cmanpreconfig%s",
-			 comline->noopenais_opt?"":":openaisserviceenable");
-		envp[envptr++] = strdup(scratch);
-	}
-	else {
-		snprintf(scratch, sizeof(scratch), "COROSYNC_DEFAULT_CONFIG_IFACE=%s:cmanpreconfig%s", comline->config_lcrso,
-			 comline->noopenais_opt?"":":openaisserviceenable");
-		envp[envptr++] = strdup(scratch);
-	}
-
-	/* Copy any COROSYNC_* env variables to the new daemon */
-	i=0;
-	while (i < MAX_ARGS && main_envp[i]) {
-		if (strncmp(main_envp[i], "COROSYNC_", 9) == 0)
-			envp[envptr++] = main_envp[i];
-		i++;
-	}
-
-
-	/* Create a pipe to monitor cman startup progress */
-	if (pipe(p) < 0)
-		die("unable to create pipe: %s", strerror(errno));
-	fcntl(p[1], F_SETFD, 0); /* Don't close on exec */
-	snprintf(scratch, sizeof(scratch), "CMAN_PIPE=%d", p[1]);
-	envp[envptr++] = strdup(scratch);
-	envp[envptr++] = NULL;
-
-	/* Always run corosync -f because we have already forked twice anyway, and
-	   we want to return any exit code that might happen */
-	argv[0] = "corosync";
-	argv[++argvptr] = "-f";
-	if (comline->nosetpri_opt)
-		argv[++argvptr] = "-p";
-	argv[++argvptr] = NULL;
-
-	/* Fork/exec cman */
-	switch ( (corosync_pid = fork()) )
-	{
-	case -1:
-		die("fork of corosync daemon failed: %s", strerror(errno));
-
-	case 0: /* child */
-		close(p[0]);
-		if (comline->verbose & DEBUG_STARTUP_ONLY) {
-			fprintf(stderr, "Starting %s", COROSYNCBIN);
-			for (i=0; i< argvptr; i++) {
-				fprintf(stderr, " %s", argv[i]);
-			}
-			fprintf(stderr, "\n");
-			for (i=0; i<envptr-1; i++) {
-				fprintf(stderr, "%s\n", envp[i]);
-			}
-		}
-		be_daemon(!(comline->verbose & ~DEBUG_STARTUP_ONLY));
-
-		sprintf(scratch, "FORKED: %d\n", getpid());
-		err = write(p[1], scratch, strlen(scratch));
-
-		execve(COROSYNCBIN, argv, envp);
-
-		/* exec failed - tell the parent process */
-		sprintf(scratch, "execve of " COROSYNCBIN " failed: %s", strerror(errno));
-		err = write(p[1], scratch, strlen(scratch));
-		exit(1);
-		break;
-
-	default: /* parent */
-		break;
-
-	}
-
-	/* Give the daemon a chance to start up, and monitor the pipe FD for messages */
-	i = 0;
-	close(p[1]);
-
-	/* Wait for the process to start or die */
-	sleep(1);
-	do {
-		fd_set fds;
-		struct timeval tv={1, 0};
-		char message[1024];
-		char *messageptr = message;
-
-		FD_ZERO(&fds);
-		FD_SET(p[0], &fds);
-
-		status = select(p[0]+1, &fds, NULL, NULL, &tv);
-
-		/* Did we get a cman-reported error? */
-		if (status == 1) {
-			int len;
-			if ((len = read(p[0], message, sizeof(message)) > 0)) {
-
-				/* Forked OK - get the real corosync pid */
-				if (sscanf(messageptr, "FORKED: %d", &corosync_pid) == 1) {
-					if (comline->verbose & DEBUG_STARTUP_ONLY)
-						fprintf(stderr, "forked process ID is %d\n", corosync_pid);
-					status = 1;
-
-					/* There might be a SUCCESS message in the pipe too. */
-					messageptr = strchr(messageptr, '\n');
-					if (messageptr)
-						messageptr++;
-					else
-						continue;
-				}
-				/* Success! get the new PID of double-forked corosync */
-				if (sscanf(messageptr, "SUCCESS: %d", &corosync_pid) == 1) {
-					if (comline->verbose & DEBUG_STARTUP_ONLY)
-						fprintf(stderr, "corosync running, process ID is %d\n", corosync_pid);
-					status = 0;
-					break;
-				}
-			}
-			else if (len < 0 && errno == EINTR) {
-				continue;
-			}
-			else { /* Error or EOF - check the child status */
-				status = check_corosync_status(corosync_pid);
-			}
-		}
-
-	} while (status != 0);
-	close(p[0]);
-
-	/* If corosync has started, try to connect to cman ... if it's still there */
-	if (status == 0) {
-		do {
-			if (status == 0) {
-				if (kill(corosync_pid, 0) < 0) {
-					status = check_corosync_status(corosync_pid);
-					die("corosync died during startup\n");
-				}
-
-				h = cman_admin_init(NULL);
-				if (!h && comline->verbose & DEBUG_STARTUP_ONLY)
-				{
-					fprintf(stderr, "waiting for cman to start\n");
-					status = check_corosync_status(corosync_pid);
-				}
-			}
-			sleep (1);
-		} while (!h && ++i < 100);
-	}
-
-	if (!h)
-		die("corosync daemon didn't start");
-
-	if ((comline->verbose & DEBUG_STARTUP_ONLY) && !cman_is_active(h))
-		fprintf(stderr, "corosync started, but not joined the cluster yet.\n");
-
-	cman_finish(h);
-	return 0;
-}
diff --git a/cman/cman_tool/main.c b/cman/cman_tool/main.c
deleted file mode 100644
index a6d35ca..0000000
--- a/cman/cman_tool/main.c
+++ /dev/null
@@ -1,1074 +0,0 @@
-#include <inttypes.h>
-#include <unistd.h>
-#include <signal.h>
-#include <time.h>
-#include <netinet/in.h>
-#include "copyright.cf"
-#include "libcman.h"
-#include "cman_tool.h"
-
-#define DEFAULT_CONFIG_MODULE "xmlconfig"
-
-#define OPTION_STRING		("m:n:v:e:2p:c:r:i:N:t:o:k:F:C:VAPwfqah?Xd::")
-#define OP_JOIN			1
-#define OP_LEAVE		2
-#define OP_EXPECTED		3
-#define OP_VOTES		4
-#define OP_KILL			5
-#define OP_VERSION		6
-#define OP_WAIT			7
-#define OP_STATUS		8
-#define OP_NODES		9
-#define OP_SERVICES		10
-#define OP_DEBUG		11
-#define OP_DUMP_OBJDB		12
-
-
-static void print_usage(int subcmd)
-{
-	printf("Usage:\n");
-	printf("\n");
-	printf("%s <join|leave|kill|expected|votes|version|wait|status|nodes|services|debug> [options]\n",
-	       prog_name);
-	printf("\n");
-	printf("Options:\n");
-	printf("  -h               Print this help, then exit\n");
-	printf("  -V               Print program version information, then exit\n");
-	printf("  -d               Enable debug output\n");
-	printf("\n");
-
-	if (!subcmd || subcmd == OP_JOIN) {
-		printf("join\n");
-		printf("  Cluster & node information is taken from configuration modules.\n");
-		printf("  These switches are provided to allow those values to be overridden.\n");
-		printf("  Use them with extreme care.\n\n");
-
-		printf("  -m <addr>        Multicast address to use\n");
-		printf("  -v <votes>       Number of votes this node has\n");
-		printf("  -e <votes>       Number of expected votes for the cluster\n");
-		printf("  -p <port>        UDP port number for cman communications\n");
-		printf("  -n <nodename>    The name of this node (defaults to hostname)\n");
-		printf("  -c <clustername> The name of the cluster to join\n");
-		printf("  -N <id>          Node id\n");
-		printf("  -C <module>      Config file reader (default: " DEFAULT_CONFIG_MODULE ")\n");
-		printf("  -w               Wait until node has joined a cluster\n");
-		printf("  -q               Wait until the cluster is quorate\n");
-		printf("  -t               Maximum time (in seconds) to wait\n");
-		printf("  -k <file>        Private key file for AIS communications\n");
-		printf("  -P               Don't set aisexec to realtime priority\n");
-		printf("  -X               Use internal cman defaults for configuration\n");
-		printf("  -A               Don't load openais services\n");
-		printf("\n");
-	}
-
-
-	if (!subcmd || subcmd == OP_WAIT) {
-		printf("wait               Wait until the node is a member of a cluster\n");
-		printf("  -q               Wait until the cluster is quorate\n");
-		printf("  -t               Maximum time (in seconds) to wait\n");
-		printf("\n");
-	}
-
-	if (!subcmd || subcmd == OP_LEAVE) {
-		printf("leave\n");
-		printf("  -w               If cluster is in transition, wait and keep trying\n");
-		printf("  -t               Maximum time (in seconds) to wait\n");
-		printf("  remove           Tell other nodes to ajust quorum downwards if necessary\n");
-		printf("  force            Leave even if cluster subsystems are active\n");
-		printf("\n");
-	}
-
-	if (!subcmd || subcmd == OP_KILL) {
-		printf("kill\n");
-		printf("  -n <nodename>    The name of the node to kill (can specify multiple times)\n");
-		printf("\n");
-	}
-
-	if (!subcmd || subcmd == OP_EXPECTED) {
-		printf("expected\n");
-		printf("  -e <votes>       New number of expected votes for the cluster\n");
-		printf("\n");
-	}
-
-	if (!subcmd || subcmd == OP_VOTES) {
-		printf("votes\n");
-		printf("  -v <votes>       New number of votes for this node\n");
-		printf("\n");
-	}
-
-	if (!subcmd || subcmd == OP_STATUS) {
-		printf("status             Show local record of cluster status\n");
-		printf("\n");
-	}
-
-	if (!subcmd || subcmd == OP_NODES) {
-		printf("nodes              Show local record of cluster nodes\n");
-		printf("  -f                 Also show when node was last fenced\n");
-		printf("  -a                 Also show node address(es)\n");
-		printf("  -n <nodename>      Only show information for specific node\n");
-		printf("  -F <format>        Specify output format (see man page)\n");
-		printf("\n");
-	}
-
-	if (!subcmd || subcmd == OP_SERVICES) {
-		printf("services           Show local record of cluster services\n");
-		printf("\n");
-	}
-
-	if (!subcmd || subcmd == OP_VERSION) {
-		printf("version\n");
-		printf("  -r <config>      A new config version to set on all members\n");
-		printf("\n");
-	}
-}
-
-static void sigalarm_handler(int sig)
-{
-	fprintf(stderr, "Timed-out waiting for cluster\n");
-	exit(2);
-}
-
-static cman_handle_t open_cman_handle(int priv)
-{
-	cman_handle_t h;
-
-	if (priv)
-		h = cman_admin_init(NULL);
-	else
-		h = cman_init(NULL);
-	if (!h)
-	{
-		if (errno == EACCES)
-			die("Cannot open connection to cman, permission denied.");
-		else
-			die("Cannot open connection to cman, is it running ?");
-	}
-	return h;
-}
-
-static void print_address(char *addr)
-{
-	char buf[INET6_ADDRSTRLEN];
-	struct sockaddr_storage *ss = (struct sockaddr_storage *)addr;
-	struct sockaddr_in *sin = (struct sockaddr_in *)addr;
-	struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)addr;
-	void *saddr;
-
-	if (ss->ss_family == AF_INET6)
-		saddr = &sin6->sin6_addr;
-	else
-		saddr = &sin->sin_addr;
-
-	inet_ntop(ss->ss_family, saddr, buf, sizeof(buf));
-	printf("%s", buf);
-}
-
-static char *membership_state(char *buf, int buflen, int node_state)
-{
-	switch (node_state) {
-	case 1:
-		strncpy(buf, "Joining", buflen);
-		break;
-	case 2:
-		strncpy(buf, "Cluster-Member", buflen);
-		break;
-	case 3:
-		strncpy(buf, "Not-in-Cluster", buflen);
-		break;
-	case 4:
-		strncpy(buf, "Leaving", buflen);
-		break;
-	default:
-		sprintf(buf, "Unknown: code=%d", node_state);
-		break;
-	}
-
-	return buf;
-}
-
-static void show_status(void)
-{
-	cman_cluster_t info;
-	cman_version_t v;
-	cman_handle_t h;
-	cman_node_t node;
-	char info_buf[PIPE_BUF];
-	char tmpbuf[1024];
-	cman_extra_info_t *einfo = (cman_extra_info_t *)info_buf;
-	cman_qdev_info_t qinfo;
-	int quorate;
-	int i;
-	int j;
-	int portnum;
-	char *addrptr;
-
-	h = open_cman_handle(0);
-
-	if (cman_get_cluster(h, &info) < 0)
-		die("Error getting cluster info: %s\n", cman_error(errno));
-	if (cman_get_version(h, &v) < 0)
-		die("Error getting cluster version: %s\n", cman_error(errno));
-	if (cman_get_extra_info(h, einfo, sizeof(info_buf)) < 0)
-		die("Error getting extra info: %s\n", cman_error(errno));
-
-	quorate = cman_is_quorate(h);
-
-	printf("Version: %d.%d.%d\n", v.cv_major, v.cv_minor, v.cv_patch);
-	printf("Config Version: %d\n", v.cv_config);
-	printf("Cluster Name: %s\n", info.ci_name);
-	printf("Cluster Id: %d\n", info.ci_number);
-	printf("Cluster Member: Yes\n");
-	printf("Cluster Generation: %d\n", info.ci_generation);
-	printf("Membership state: %s\n", membership_state(tmpbuf, sizeof(tmpbuf),
-							  einfo->ei_node_state));
-	printf("Nodes: %d\n", einfo->ei_members);
-	printf("Expected votes: %d\n", einfo->ei_expected_votes);
-	if (cman_get_quorum_device(h, &qinfo) == 0 && qinfo.qi_state == 2)
-		printf("Quorum device votes: %d\n", qinfo.qi_votes);
-	printf("Total votes: %d\n", einfo->ei_total_votes);
-	printf("Node votes: %d\n", einfo->ei_node_votes);
-
-	printf("Quorum: %d %s\n", einfo->ei_quorum, quorate?" ":"Activity blocked");
-	printf("Active subsystems: %d\n", cman_get_subsys_count(h));
-	printf("Flags:");
-	if (einfo->ei_flags & CMAN_EXTRA_FLAG_2NODE)
-		printf(" 2node");
-	if (einfo->ei_flags & CMAN_EXTRA_FLAG_SHUTDOWN)
-		printf(" Shutdown");
-	if (einfo->ei_flags & CMAN_EXTRA_FLAG_ERROR)
-		printf(" Error");
-	if (einfo->ei_flags & CMAN_EXTRA_FLAG_DISALLOWED)
-		printf(" DisallowedNodes");
-	if (einfo->ei_flags & CMAN_EXTRA_FLAG_DIRTY)
-		printf(" Dirty");
-	printf(" \n");
-
-	printf("Ports Bound: ");
-	portnum = 0;
-	for (i=0; i<32; i++) {
-		for (j=0; j<8; j++) {
-			if ((einfo->ei_ports[i] >> j) & 1)
-				printf("%d ", portnum);
-			portnum++;
-		}
-	}
-	printf(" \n");
-
-	node.cn_name[0] = 0;
-	if (cman_get_node(h, CMAN_NODEID_US, &node) == 0) {
-		printf("Node name: %s\n", node.cn_name);
-		printf("Node ID: %d\n", node.cn_nodeid);
-	}
-
-	printf("Multicast addresses: ");
-	addrptr = einfo->ei_addresses;
-	for (i=0; i < einfo->ei_num_addresses; i++) {
-		print_address(addrptr);
-		printf(" ");
-		addrptr += sizeof(struct sockaddr_storage);
-	}
-	printf("\n");
-
-	printf("Node addresses: ");
-	for (i=0; i < einfo->ei_num_addresses; i++) {
-		print_address(addrptr);
-		printf(" ");
-		addrptr += sizeof(struct sockaddr_storage);
-	}
-	printf("\n");
-
-	if (einfo->ei_flags & CMAN_EXTRA_FLAG_DISALLOWED) {
-		int count;
-		int numnodes;
-		cman_node_t *nodes;
-
-		count = cman_get_node_count(h);
-		nodes = malloc(sizeof(cman_node_t) * count);
-
-		if (cman_get_disallowed_nodes(h, count, &numnodes, nodes) == 0) {
-			printf("Disallowed nodes: ");
-			for (i=0; i<numnodes; i++) {
-				printf("%s ", nodes[i].cn_name);
-			}
-			printf("\n");
-		}
-	}
-	cman_finish(h);
-}
-
-static int node_compare(const void *va, const void *vb)
-{
-	const cman_node_t *a = va;
-	const cman_node_t *b = vb;
-	return a->cn_nodeid - b->cn_nodeid;
-}
-
-static int node_filter(commandline_t *comline, const char *node)
-{
-	int i;
-
-	for (i = 0; i < comline->num_nodenames; i++) {
-		if (strcmp(comline->nodenames[i], node) == 0) {
-			return TRUE;
-		}
-	}
-
-	return FALSE;
-}
-
-static int get_format_opt(const char *opt)
-{
-	if (!opt)
-		return FMT_NONE;
-
-	if (!strcmp(opt, "id"))
-		return FMT_ID;
-	if (!strcmp(opt, "name"))
-		return FMT_NAME;
-	if (!strcmp(opt, "type"))
-		return FMT_TYPE;
-	if (!strcmp(opt, "addr"))
-		return FMT_ADDR;
-
-	return FMT_NONE;
-}
-
-
-static void print_node(commandline_t *comline, cman_handle_t h, int *format, struct cman_node *node)
-{
-	char member_type;
-	struct tm *ftime;
-	struct tm *jtime;
-	char jstring[1024];
-	int i,j,k;
-
-	if (comline->num_nodenames > 0) {
-		if (node_filter(comline, node->cn_name) == 0) {
-			return;
-		}
-	}
-
-	switch (node->cn_member) {
-	case 0:
-		member_type = 'X';
-		break;
-	case 1:
-		member_type = 'M';
-		break;
-	case 2:
-		member_type = 'd';
-		break;
-	default:
-		member_type = '?';
-		break;
-	}
-
-	jtime = localtime(&node->cn_jointime.tv_sec);
-	if (node->cn_jointime.tv_sec && node->cn_member)
-		strftime(jstring, sizeof(jstring), "%F %H:%M:%S", jtime);
-	else
-		strcpy(jstring, "                   ");
-
-	if (!comline->format_opts) {
-		printf("%4d   %c  %5d   %s  %s\n",
-		       node->cn_nodeid, member_type,
-		       node->cn_incarnation, jstring, node->cn_name);
-	}
-
-	if (comline->fence_opt && !comline->format_opts) {
-		char agent[255];
-		uint64_t fence_time;
-		int fenced;
-
-		if (!cman_get_fenceinfo(h, node->cn_nodeid, &fence_time, &fenced, agent)) {
-			if (fence_time) {
-				time_t fence_time_t = (time_t)fence_time;
-				ftime = localtime(&fence_time_t);
-				strftime(jstring, sizeof(jstring), "%F %H:%M:%S", ftime);
-				printf("       Last fenced:   %-15s by %s\n", jstring, agent);
-			}
-			if (!node->cn_member && node->cn_incarnation && !fenced) {
-				printf("       Node has not been fenced since it went down\n");
-			}
-		}
-	}
-
-	int numaddrs;
-	struct cman_node_address addrs[MAX_INTERFACES];
-
-	if (comline->addresses_opt || comline->format_opts) {
-		if (!cman_get_node_addrs(h, node->cn_nodeid, MAX_INTERFACES, &numaddrs, addrs) &&
-		    numaddrs)
-		{
-			if (!comline->format_opts) {
-				printf("       Addresses: ");
-				for (i = 0; i < numaddrs; i++)
-				{
-					print_address(addrs[i].cna_address);
-					printf(" ");
-				}
-				printf("\n");
-			}
-		}
-	}
-
-	if (comline->format_opts) {
-		for (j = 0; j < MAX_FORMAT_OPTS; j++) {
-			switch (format[j]) {
-			case FMT_NONE:
-				break;
-			case FMT_ID:
-				printf("%d ", node->cn_nodeid);
-				break;
-			case FMT_NAME:
-				printf("%s ", node->cn_name);
-				break;
-			case FMT_TYPE:
-				printf("%c ", member_type);
-				break;
-			case FMT_ADDR:
-				for (k = 0; k < numaddrs; k++) {
-					print_address(addrs[k].cna_address);
-					if (k != (numaddrs - 1)) {
-						printf(",");
-					}
-				}
-				printf(" ");
-				break;
-			default:
-				break;
-			}
-		}
-		printf("\n");
-	}
-}
-
-static void show_nodes(commandline_t *comline)
-{
-	cman_handle_t h;
-	int count;
-	int i;
-	int j;
-	int numnodes;
-	int dis_count;
-	int format[MAX_FORMAT_OPTS];
-	cman_node_t *dis_nodes;
-	cman_node_t *nodes;
-
-	h = open_cman_handle(0);
-
-	count = cman_get_node_count(h);
-	if (count < 0)
-		die("cman_get_node_count failed: %s", cman_error(errno));
-
-	count += 2; /* Extra space! */
-
-	nodes = malloc(sizeof(cman_node_t) * count);
-	if (!nodes)
-		die("cannot allocate memory for nodes list\n");
-
-	if (comline->format_opts != NULL) {
-		char *format_str = comline->format_opts;
-		char *format_tmp;
-		for (i = 0; i < MAX_FORMAT_OPTS; i++) {
-			format_tmp = strtok(format_str, ",");
-			format_str = NULL;
-			format[i] = get_format_opt(format_tmp);
-		}
-	}
-
-	if (cman_get_nodes(h, count, &numnodes, nodes) < 0)
-		die("cman_get_nodes failed: %s", cman_error(errno));
-
-
-	/* Get Disallowed nodes, so we can show them as such */
-	dis_nodes = malloc(sizeof(cman_node_t) * count);
-
-	if (cman_get_disallowed_nodes(h, count, &dis_count, dis_nodes) == 0) {
-		for (i = 0; i < numnodes; i++) {
-			for (j = 0; j < dis_count; j++) {
-				if (dis_nodes[j].cn_nodeid == nodes[i].cn_nodeid)
-					nodes[i].cn_member = 2;
-			}
-		}
-	}
-
-	/* Sort by nodeid to be friendly */
-	qsort(nodes, numnodes, sizeof(cman_node_t), node_compare);
-
-	if (dis_count) {
-		printf("NOTE: There are %d disallowed nodes,\n", dis_count);
-		printf("      members list may seem inconsistent across the cluster\n");
-	}
-
-	if (!comline->format_opts) {
-		printf("Node  Sts   Inc   Joined               Name\n");
-	}
-
-	/* Print nodes */
-	for (i = 0; i < numnodes; i++) {
-		print_node(comline, h, format, &nodes[i]);
-	}
-
-	free(nodes);
-	free(dis_nodes);
-	cman_finish(h);
-}
-
-static int show_services(void)
-{
-	return system("group_tool ls");
-}
-
-
-char *cman_error(int err)
-{
-	char *die_error;
-
-	switch (errno) {
-	case ENOTCONN:
-		die_error = "Cluster software not started";
-		break;
-	case ENOENT:
-		die_error = "Node is not yet a cluster member";
-		break;
-	default:
-		die_error = strerror(errno);
-		break;
-	}
-	return die_error;
-}
-
-static void leave(commandline_t *comline)
-{
-	cman_handle_t h;
-	int result;
-	int flags = 0;
-
-	h = open_cman_handle(1);
-
-	/* "cman_tool leave remove" adjusts quorum downward */
-
-	if (comline->remove)
-		flags |= CMAN_SHUTDOWN_REMOVED;
-
-	if (comline->force)
-		flags |= CMAN_SHUTDOWN_ANYWAY;
-
-	if (comline->wait_opt && comline->timeout) {
-		signal(SIGALRM, sigalarm_handler);
-		alarm(comline->timeout);
-	}
-
-	result = cman_shutdown(h, flags);
-	if (result && !comline->wait_opt) {
-		die("Error leaving cluster: %s", cman_error(errno));
-	}
-	cman_finish(h);
-
-	/* Wait until cman shuts down */
-	if (comline->wait_opt) {
-		while ( (h = cman_admin_init(NULL)) ) {
-			cman_finish(h);
-			sleep(1);
-		}
-	}
-}
-
-static void set_expected(commandline_t *comline)
-{
-	cman_handle_t h;
-	int result;
-
-	h = open_cman_handle(1);
-
-	if ((result = cman_set_expected_votes(h, comline->expected_votes)))
-		die("can't set expected votes: %s", cman_error(errno));
-
-	cman_finish(h);
-}
-
-static void set_votes(commandline_t *comline)
-{
-	cman_handle_t h;
-	int result;
-	int nodeid;
-	struct cman_node node;
-
-
-	h = open_cman_handle(1);
-
-	if (!comline->num_nodenames) {
-		nodeid = 0; /* This node */
-	}
-	else {
-		/* Resolve node name into a number */
-		node.cn_nodeid = 0;
-		strcpy(node.cn_name, comline->nodenames[0]);
-		if (cman_get_node(h, node.cn_nodeid, &node))
-			die("Can't set votes for node %s : %s\n", node.cn_name, strerror(errno));
-		nodeid = node.cn_nodeid;
-	}
-
-	if ((result = cman_set_votes(h, comline->votes, nodeid)))
-		die("can't set votes: %s", cman_error(errno));
-
-	cman_finish(h);
-}
-
-static void version(commandline_t *comline)
-{
-	struct cman_version ver;
-	cman_handle_t h;
-	int result;
-
-	h = open_cman_handle(1);
-
-	if ((result = cman_get_version(h, &ver)))
-		die("can't get version: %s", cman_error(errno));
-
-	if (!comline->config_version) {
-		printf("%d.%d.%d config %d\n", ver.cv_major, ver.cv_minor, ver.cv_patch,
-		       ver.cv_config);
-		goto out;
-	}
-
-	ver.cv_config = comline->config_version;
-
-	if ((result = cman_set_version(h, &ver)))
-		die("can't set version: %s", cman_error(errno));
- out:
-	cman_finish(h);
-}
-
-static int cluster_wait(commandline_t *comline)
-{
-	cman_handle_t h;
-	int ret = 0;
-
-	h = open_cman_handle(0);
-
-	if (comline->wait_quorate_opt) {
-		while (cman_is_quorate(h) <= 0) {
-			sleep(1);
-		}
-	}
-	else {
-		while (cman_get_node_count(h) < 0) {
-			sleep(1);
-	    }
-	}
-
-	cman_finish(h);
-
-	return ret;
-}
-
-static void kill_node(commandline_t *comline)
-{
-	cman_handle_t h;
-	int i;
-	struct cman_node node;
-
-	if (!comline->num_nodenames) {
-	    die("No node name specified\n");
-	}
-
-	h = open_cman_handle(1);
-
-	for (i=0; i<comline->num_nodenames; i++) {
-
-	    /* Resolve node name into a number */
-	    node.cn_nodeid = 0;
-	    strcpy(node.cn_name, comline->nodenames[i]);
-	    if (cman_get_node(h, node.cn_nodeid, &node)) {
-		fprintf(stderr, "Can't kill node %s : %s\n", node.cn_name, strerror(errno));
-		continue;
-	    }
-
-
-	    if (cman_kill_node(h, node.cn_nodeid))
-		perror("kill node failed");
-	}
-
-	cman_finish(h);
-}
-
-static void set_debuglog(commandline_t *comline)
-{
-	cman_handle_t h;
-
-	h = open_cman_handle(1);
-
-	if (cman_set_debuglog(h, comline->verbose))
-		perror("setting debuglog failed");
-
-	cman_finish(h);
-}
-
-#ifdef DEBUG
-static void dump_objdb(commandline_t *comline)
-{
-	cman_handle_t h;
-
-	h = open_cman_handle(1);
-
-	if (cman_dump_objdb(h, comline->filename))
-		perror("dump objdb failed");
-
-	cman_finish(h);
-}
-#endif
-
-static int get_int_arg(char argopt, char *arg)
-{
-	char *tmp;
-	int val;
-
-	val = strtol(arg, &tmp, 10);
-	if (tmp == arg || tmp != arg + strlen(arg))
-		die("argument to %c (%s) is not an integer", argopt, arg);
-
-	if (val < 0)
-		die("argument to %c cannot be negative", argopt);
-
-	return val;
-}
-
-
-static void decode_arguments(int argc, char *argv[], commandline_t *comline)
-{
-	int cont = TRUE;
-	int optchar, i;
-	int show_help = 0;
-
-	comline->config_lcrso=DEFAULT_CONFIG_MODULE;
-
-	while (cont) {
-		optchar = getopt(argc, argv, OPTION_STRING);
-
-		switch (optchar) {
-
-		case 'm':
-			comline->multicast_addr = strdup(optarg);
-			break;
-
-		case 'f':
-			comline->fence_opt = 1;
-			break;
-
-		case 'a':
-			comline->addresses_opt = 1;
-			break;
-
-		case 'n':
-		        i = comline->num_nodenames;
-			if (i >= MAX_INTERFACES)
-			        die("maximum of %d node names allowed",
-				    MAX_INTERFACES);
-			if (strlen(optarg) > MAX_NODE_NAME_LEN)
-				die("maximum node name length is %d",
-				    MAX_NODE_NAME_LEN);
-			comline->nodenames[i] = strdup(optarg);
-			comline->num_nodenames++;
-			break;
-
-		case 'o':
-			comline->override_nodename = strdup(optarg);
-			break;
-
-		case 'k':
-			comline->key_filename = strdup(optarg);
-			break;
-
-		case 'C':
-			comline->config_lcrso = strdup(optarg);
-			break;
-
-		case 'r':
-			comline->config_version = get_int_arg(optchar, optarg);
-			comline->config_version_opt = TRUE;
-			break;
-
-		case 'v':
-			comline->votes = get_int_arg(optchar, optarg);
-			comline->votes_opt = TRUE;
-			break;
-
-		case 'e':
-			comline->expected_votes = get_int_arg(optchar, optarg);
-			comline->expected_votes_opt = TRUE;
-			break;
-
-		case '2':
-			comline->two_node = TRUE;
-			break;
-
-		case 'p':
-			comline->port = get_int_arg(optchar, optarg);
-			comline->port_opt = TRUE;
-			break;
-
-		case 'N':
-			comline->nodeid = get_int_arg(optchar, optarg);
-			comline->nodeid_opt = TRUE;
-			break;
-
-		case 'c':
-			if (strlen(optarg) > MAX_NODE_NAME_LEN-1)
-				die("maximum cluster name length is %d",
-				    MAX_CLUSTER_NAME_LEN-1);
-			strcpy(comline->clustername, optarg);
-			comline->clustername_opt = TRUE;
-			break;
-
-		case 'F':
-			comline->format_opts = strdup(optarg);
-			break;
-
-		case 'V':
-			printf("cman_tool %s (built %s %s)\n",
-				RELEASE_VERSION, __DATE__, __TIME__);
-			printf("%s\n", REDHAT_COPYRIGHT);
-			exit(EXIT_SUCCESS);
-			break;
-
-		case 'h':
-			show_help = 1;
-			break;
-
-		case ':':
-		case '?':
-			fprintf(stderr, "Please use '-h' for usage.\n");
-			exit(EXIT_FAILURE);
-			break;
-
-		case 'd':
-			if (optarg)
-				comline->verbose = atoi(optarg);
-			else
-				comline->verbose = 255;
-			break;
-
-		case 'w':
-			comline->wait_opt = TRUE;
-			break;
-
-		case 'q':
-			comline->wait_quorate_opt = TRUE;
-			break;
-
-		case 't':
-			comline->timeout = get_int_arg(optchar, optarg);
-			break;
-
-		case EOF:
-			cont = FALSE;
-			break;
-
-		case 'X':
-			comline->noconfig_opt = TRUE;
-			break;
-
-		case 'A':
-			comline->noopenais_opt = TRUE;
-			break;
-
-		case 'P':
-			comline->nosetpri_opt = TRUE;
-			break;
-		default:
-			die("unknown option: %c", optchar);
-			break;
-		};
-	}
-
-	while (optind < argc) {
-		if (strcmp(argv[optind], "join") == 0) {
-			if (comline->operation)
-				die("can't specify two operations");
-			comline->operation = OP_JOIN;
-		} else if (strcmp(argv[optind], "leave") == 0) {
-			if (comline->operation)
-				die("can't specify two operations");
-			comline->operation = OP_LEAVE;
-		} else if (strcmp(argv[optind], "expected") == 0) {
-			if (comline->operation)
-				die("can't specify two operations");
-			comline->operation = OP_EXPECTED;
-		} else if (strcmp(argv[optind], "votes") == 0) {
-			if (comline->operation)
-				die("can't specify two operations");
-			comline->operation = OP_VOTES;
-		} else if (strcmp(argv[optind], "kill") == 0) {
-			if (comline->operation)
-				die("can't specify two operations");
-			comline->operation = OP_KILL;
-		} else if (strcmp(argv[optind], "version") == 0) {
-			if (comline->operation)
-				die("can't specify two operations");
-			comline->operation = OP_VERSION;
-		} else if (strcmp(argv[optind], "wait") == 0) {
-			if (comline->operation)
-				die("can't specify two operations");
-			comline->operation = OP_WAIT;
-		} else if (strcmp(argv[optind], "status") == 0) {
-			if (comline->operation)
-				die("can't specify two operations");
-			comline->operation = OP_STATUS;
-		} else if (strcmp(argv[optind], "nodes") == 0) {
-			if (comline->operation)
-				die("can't specify two operations");
-			comline->operation = OP_NODES;
-		} else if (strcmp(argv[optind], "services") == 0) {
-			if (comline->operation)
-				die("can't specify two operations");
-			comline->operation = OP_SERVICES;
-		} else if (strcmp(argv[optind], "debug") == 0) {
-			if (comline->operation)
-				die("can't specify two operations");
-			comline->operation = OP_DEBUG;
-#ifdef DEBUG
-		} else if (strcmp(argv[optind], "dump-db") == 0) {
-			if (comline->operation)
-				die("can't specify two operations");
-			comline->operation = OP_DUMP_OBJDB;
-			if (!argv[optind+1])
-				die("no filename given");
-			comline->filename = strdup(argv[optind+1]);
-			if (comline->filename[0] != '/')
-				die("dump filename must be an absolute path");
-			optind++;
-#endif
-		} else if (strcmp(argv[optind], "remove") == 0) {
-			comline->remove = TRUE;
-		} else if (strcmp(argv[optind], "force") == 0) {
-			comline->force = TRUE;
-		} else
-			die("unknown option %s", argv[optind]);
-
-		optind++;
-	}
-
-	if (show_help) {
-		print_usage(comline->operation);
-		exit(EXIT_SUCCESS);
-	}
-
-	if (!comline->operation)
-		die("no operation specified");
-}
-
-static void check_arguments(commandline_t *comline)
-{
-	if (comline->two_node && comline->expected_votes != 1)
-		die("expected_votes value (%d) invalid in two node mode",
-		    comline->expected_votes);
-
-	if (comline->port_opt &&
-	    (comline->port <= 0 || comline->port > 65535))
-		die("Port must be a number between 1 and 65535");
-
-	/* This message looks like it contradicts the condition but
-	   a nodeid of zero simply means "assign one for me" and is a
-	   perfectly reasonable override */
-	if (comline->nodeid < 0 || comline->nodeid > 4096)
-	        die("Node id must be between 1 and 4096");
-
-	if (strlen(comline->clustername) > MAX_CLUSTER_NAME_LEN) {
-	        die("Cluster name must be < %d characters long",
-		    MAX_CLUSTER_NAME_LEN);
-	}
-
-	if (comline->timeout && !comline->wait_opt && !comline->wait_quorate_opt)
-		die("timeout is only appropriate with wait");
-}
-
-int main(int argc, char *argv[], char *envp[])
-{
-	commandline_t comline;
-	int ret;
-
-	prog_name = argv[0];
-
-	memset(&comline, 0, sizeof(commandline_t));
-
-	decode_arguments(argc, argv, &comline);
-
-	switch (comline.operation) {
-	case OP_JOIN:
-		check_arguments(&comline);
-
-		if (comline.timeout) {
-			signal(SIGALRM, sigalarm_handler);
-			alarm(comline.timeout);
-		}
-
-		join(&comline, envp);
-		if (comline.wait_opt || comline.wait_quorate_opt) {
-			do {
-				ret = cluster_wait(&comline);
-				if (ret == ENOTCONN)
-					join(&comline, envp);
-
-			} while (ret == ENOTCONN);
-		}
-		break;
-
-	case OP_LEAVE:
-		leave(&comline);
-		break;
-
-	case OP_EXPECTED:
-		set_expected(&comline);
-		break;
-
-	case OP_VOTES:
-		set_votes(&comline);
-		break;
-
-	case OP_KILL:
-		kill_node(&comline);
-		break;
-
-	case OP_VERSION:
-		version(&comline);
-		break;
-
-	case OP_WAIT:
-		if (comline.timeout) {
-			signal(SIGALRM, sigalarm_handler);
-			alarm(comline.timeout);
-		}
-		cluster_wait(&comline);
-		break;
-
-	case OP_STATUS:
-		show_status();
-		break;
-
-	case OP_NODES:
-		show_nodes(&comline);
-		break;
-
-	case OP_SERVICES:
-		if (show_services() < 0) {
-			fprintf(stderr, "Unable to invoke group_tool\n");
-			exit(EXIT_FAILURE);
-		}
-		break;
-
-	case OP_DEBUG:
-		set_debuglog(&comline);
-		break;
-#ifdef DEBUG
-	case OP_DUMP_OBJDB:
-		dump_objdb(&comline);
-		break;
-#endif
-	}
-
-	exit(EXIT_SUCCESS);
-}
-
-char *prog_name;
diff --git a/cman/daemon/Makefile b/cman/daemon/Makefile
deleted file mode 100644
index f97c56f..0000000
--- a/cman/daemon/Makefile
+++ /dev/null
@@ -1,41 +0,0 @@
-TARGET1= service_cman.lcrso
-TARGET2= config_cmanpre.lcrso
-
-LCRSOT=$(TARGET1) $(TARGET2)
-
-all: depends ${TARGET1} ${TARGET2}
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-CFLAGS += -fPIC
-CFLAGS += -I${openaisincdir} -I${corosyncincdir}
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${libdir}
-
-OBJS1=	daemon.o \
-	logging.o \
-	ais.o \
-	commands.o \
-	barrier.o \
-	cmanconfig.o
-
-OBJS2=	cman-preconfig.o
-
-${TARGET1}: ${OBJS1}
-	$(CC) -shared -Wl,-soname,$@ -o $@ $^ $(LDFLAGS)
-
-${TARGET2}: ${OBJS2}
-	$(CC) -shared -Wl,-soname,$@ -o $@ $^ $(LDFLAGS)
-
-depends:
-	$(MAKE) -C ../lib all
-
-clean: generalclean 
-
--include $(OBJS1:.o=.d)
--include $(OBJS2:.o=.d)
diff --git a/cman/daemon/ais.c b/cman/daemon/ais.c
deleted file mode 100644
index 1ebac82..0000000
--- a/cman/daemon/ais.c
+++ /dev/null
@@ -1,343 +0,0 @@
-#include <sys/poll.h>
-#include <sys/types.h>
-#include <sys/errno.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <unistd.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/socket.h>
-#include <sys/utsname.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-
-/* corosync headers */
-#include <corosync/corotypes.h>
-#include <corosync/ipc_gen.h>
-#include <corosync/engine/coroapi.h>
-#include <corosync/engine/logsys.h>
-#include <corosync/engine/quorum.h>
-#include <corosync/lcr/lcr_comp.h>
-
-#include "list.h"
-#include "cnxman-socket.h"
-#include "cnxman-private.h"
-#include "commands.h"
-#include "logging.h"
-
-#include "ais.h"
-#include "cman.h"
-#define OBJDB_API struct corosync_api_v1
-#include "nodelist.h"
-#include "cmanconfig.h"
-#include "daemon.h"
-
-extern int our_nodeid();
-extern char cluster_name[MAX_CLUSTER_NAME_LEN+1];
-extern unsigned int quorumdev_poll;
-extern unsigned int ccsd_poll_interval;
-extern unsigned int shutdown_timeout;
-extern int init_config(struct corosync_api_v1 *api);
-
-struct totem_ip_address mcast_addr[MAX_INTERFACES];
-struct totem_ip_address ifaddrs[MAX_INTERFACES];
-int num_interfaces;
-uint64_t incarnation;
-int num_ais_nodes;
-quorum_set_quorate_fn_t corosync_set_quorum;
-struct memb_ring_id cman_ring_id;
-extern unsigned int config_version;
-static unsigned int cluster_parent_handle;
-
-static int startup_pipe;
-static unsigned int debug_mask;
-static int first_trans = 1;
-struct corosync_api_v1 *corosync;
-
-static cs_tpg_handle group_handle;
-static struct corosync_tpg_group cman_group[1] = {
-        { .group          = "CMAN", .group_len      = 4},
-};
-
-LOGSYS_DECLARE_SUBSYS (CMAN_NAME, LOG_INFO);
-
-/* This structure is tacked onto the start of a cluster message packet for our
- * own nefarious purposes. */
-struct cl_protheader {
-	unsigned char  tgtport; /* Target port number */
-	unsigned char  srcport; /* Source (originating) port number */
-	unsigned short pad;
-	unsigned int   flags;
-	int            srcid;	/* Node ID of the sender */
-	int            tgtid;	/* Node ID of the target */
-};
-
-/* Plugin-specific code */
-/* Need some better way of determining these.... */
-#define CMAN_SERVICE 9
-
-static int cman_exit_fn(void *conn_info);
-static int cman_exec_init_fn(struct corosync_api_v1 *api);
-static void cman_confchg_fn(enum totem_configuration_type configuration_type,
-			    unsigned int *member_list, int member_list_entries,
-			    unsigned int *left_list, int left_list_entries,
-			    unsigned int *joined_list, int joined_list_entries,
-			    struct memb_ring_id *ring_id);
-static void cman_deliver_fn(unsigned int nodeid, struct iovec *iovec, int iov_len,
-			    int endian_conversion_required);
-static void cman_quorum_init(struct corosync_api_v1 *api, quorum_set_quorate_fn_t report);
-
-/*
- * Exports the interface for the service
- */
-static struct corosync_service_engine cman_service_handler = {
-	.name		    		= (char *)"corosync CMAN membership service 2.90",
-	.id			        = CMAN_SERVICE,
-	.flow_control			= COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED,
-	.lib_exit_fn		       	= cman_exit_fn,
-	.exec_init_fn		       	= cman_exec_init_fn,
-	.config_init_fn                 = NULL,
-};
-
-static struct corosync_service_engine *cman_get_handler_ver0(void)
-{
-	return (&cman_service_handler);
-}
-
-static struct corosync_service_engine_iface_ver0 cman_service_handler_iface = {
-	.corosync_get_service_engine_ver0 = cman_get_handler_ver0
-};
-static struct quorum_services_api_ver1 cman_quorum_iface_ver0 = {
-	.init				= cman_quorum_init
-};
-
-static struct lcr_iface ifaces_ver0[2] = {
-	{
-		.name		        = "corosync_cman",
-		.version	        = 0,
-		.versions_replace     	= 0,
-		.versions_replace_count = 0,
-		.dependencies	      	= 0,
-		.dependency_count      	= 0,
-		.constructor	       	= NULL,
-		.destructor		= NULL,
-		.interfaces		= NULL,
-	},
-	{
-		.name			= "quorum_cman",
-		.version		= 0,
-		.versions_replace	= 0,
-		.versions_replace_count	= 0,
-		.dependencies		= 0,
-		.dependency_count	= 0,
-		.constructor		= NULL,
-		.destructor		= NULL,
-		.interfaces		= (void **)(void *)&cman_quorum_iface_ver0,
-	},
-};
-
-static struct lcr_comp cman_comp_ver0 = {
-	.iface_count				= 2,
-	.ifaces					= ifaces_ver0,
-};
-
-
-__attribute__ ((constructor)) static void cman_comp_register(void) {
-	lcr_interfaces_set(&ifaces_ver0[0], &cman_service_handler_iface);
-	lcr_interfaces_set(&ifaces_ver0[1], &cman_quorum_iface_ver0);
-	lcr_component_register(&cman_comp_ver0);
-}
-
-/* ------------------------------- */
-
-static void cman_quorum_init(struct corosync_api_v1 *api, quorum_set_quorate_fn_t report)
-{
-	corosync = api;
-	corosync_set_quorum = report;
-}
-
-static int cman_exec_init_fn(struct corosync_api_v1 *api)
-{
-	unsigned int object_handle;
-	unsigned int find_handle;
-	char pipe_msg[256];
-
-	corosync = api;
-
-	if (getenv("CMAN_PIPE"))
-                startup_pipe = atoi(getenv("CMAN_PIPE"));
-
-        /* Get our config variables */
-	corosync->object_find_create(OBJECT_PARENT_HANDLE, "cluster", strlen("cluster"), &find_handle);
-	corosync->object_find_next(find_handle, &cluster_parent_handle);
-	corosync->object_find_destroy(find_handle);
-
-	corosync->object_find_create(cluster_parent_handle, "cman", strlen("cman"), &find_handle);
-	if (corosync->object_find_next(find_handle, &object_handle) == 0)
-	{
-		objdb_get_int(api, object_handle, "quorum_dev_poll", &quorumdev_poll, DEFAULT_QUORUMDEV_POLL);
-		objdb_get_int(api, object_handle, "shutdown_timeout", &shutdown_timeout, DEFAULT_SHUTDOWN_TIMEOUT);
-		objdb_get_int(api, object_handle, "ccsd_poll", &ccsd_poll_interval, DEFAULT_CCSD_POLL);
-		objdb_get_int(api, object_handle, "debug_mask", &debug_mask, 0);
-
-		/* All other debugging options should already have been set in preconfig */
-		set_debuglog(debug_mask);
-	}
-	corosync->object_find_destroy(find_handle);
-	P_DAEMON(CMAN_NAME " starting");
-
-	/* Open local sockets and initialise I/O queues */
-	if (read_cman_config(api, &config_version)) {
-		/* An error message will have been written to cman_pipe */
-		exit(9);
-	}
-	cman_init();
-
-	/* Let cman_tool know we are running and our PID */
-	sprintf(pipe_msg,"SUCCESS: %d", getpid());
-	write_cman_pipe(pipe_msg);
-	close(startup_pipe);
-	startup_pipe = 0;
-
-	/* Start totem */
-	api->tpg_init(&group_handle, cman_deliver_fn, cman_confchg_fn);
-	api->tpg_join(group_handle, cman_group, 1);
-
-	return 0;
-}
-
-
-int cman_exit_fn(void *conn_info)
-{
-	cman_finish();
-	return 0;
-}
-
-/* END Plugin-specific code */
-
-int comms_send_message(void *buf, int len,
-		       unsigned char toport, unsigned char fromport,
-		       int nodeid,
-		       unsigned int flags)
-{
-	struct iovec iov[2];
-	struct cl_protheader header;
-	int totem_flags = TOTEM_AGREED;
-
-	P_AIS("comms send message %p len = %d\n", buf,len);
-	header.tgtport = toport;
-	header.srcport = fromport;
-	header.flags   = flags;
-	header.srcid   = our_nodeid();
-	header.tgtid   = nodeid;
-
-	iov[0].iov_base = &header;
-	iov[0].iov_len  = sizeof(header);
-	iov[1].iov_base = buf;
-	iov[1].iov_len  = len;
-
-	if (flags & MSG_TOTEM_SAFE)
-		totem_flags = TOTEM_SAFE;
-
-	return corosync->tpg_joined_mcast(group_handle, iov, 2, totem_flags);
-}
-
-// This assumes the iovec has only one element ... is it true ??
-static void cman_deliver_fn(unsigned int nodeid, struct iovec *iovec, int iov_len,
-			    int endian_conversion_required)
-{
-	struct cl_protheader *header = iovec->iov_base;
-	char *buf = iovec->iov_base;
-
-	P_AIS("deliver_fn source nodeid = %d, len=%d, endian_conv=%d\n",
-	      nodeid, (int)iovec->iov_len, endian_conversion_required);
-
-	if (endian_conversion_required) {
-		header->srcid = swab32(header->srcid);
-		header->tgtid = swab32(header->tgtid);
-		header->flags = swab32(header->flags);
-	}
-
-	/* Only pass on messages for us or everyone */
-	if (header->tgtid == our_nodeid() ||
-	    header->tgtid == 0) {
-		send_to_userport(header->srcport, header->tgtport,
-				 header->srcid, header->tgtid,
-				 buf + sizeof(struct cl_protheader), iovec->iov_len - sizeof(struct cl_protheader),
-				 endian_conversion_required);
-	}
-}
-
-static void cman_confchg_fn(enum totem_configuration_type configuration_type,
-			    unsigned int *member_list, int member_list_entries,
-			    unsigned int *left_list, int left_list_entries,
-			    unsigned int *joined_list, int joined_list_entries,
-			    struct memb_ring_id *ring_id)
-{
-	int i;
-	static int last_memb_count = 0;
-	static int saved_left_list_entries;
-	static int saved_left_list_size;
-	static unsigned int *saved_left_list = NULL;
-
-	P_AIS("confchg_fn called type = %d, seq=%lld\n", configuration_type, ring_id->seq);
-
-	memcpy(&cman_ring_id, ring_id, sizeof(*ring_id));
-	incarnation = ring_id->seq;
-	num_ais_nodes = member_list_entries;
-
-	/* Tell the cman membership layer */
-	for (i=0; i<left_list_entries; i++)
-		del_ais_node(left_list[i]);
-
-	/* Joining nodes are only added after a valid TRANSITION message
-	 * is received.
-	 */
-
-	/* Save the left list for later so we can do a consolidated confchg message */
-	if (configuration_type == TOTEM_CONFIGURATION_TRANSITIONAL) {
-		if (saved_left_list == NULL) {
-			saved_left_list_size = left_list_entries*2;
-			saved_left_list = malloc(sizeof(int) * saved_left_list_size);
-			if (!saved_left_list) {
-				log_printf(LOG_LEVEL_CRIT, "cannot allocate memory for confchg message");
-				exit(3);
-			}
-		}
-		if (saved_left_list_size < left_list_entries) {
-			saved_left_list_size = left_list_entries*2;
-			saved_left_list = realloc(saved_left_list, sizeof(int) * saved_left_list_size);
-			if (!saved_left_list) {
-				log_printf(LOG_LEVEL_CRIT, "cannot reallocate memory for confchg message");
-				exit(3);
-			}
-		}
-		saved_left_list_entries = left_list_entries;
-		memcpy(saved_left_list, left_list, left_list_entries * sizeof(int));
-	}
-
-	if (configuration_type == TOTEM_CONFIGURATION_REGULAR) {
-		P_AIS("last memb_count = %d, current = %d\n", last_memb_count, member_list_entries);
-		send_transition_msg(last_memb_count, first_trans);
-		last_memb_count = member_list_entries;
-		if (member_list_entries > 1)
-			first_trans = 0;
-
-		cman_send_confchg(member_list,  member_list_entries,
-				  saved_left_list, saved_left_list_entries,
-				  joined_list, joined_list_entries);
-	}
-}
-
-/* Write an error message down the CMAN startup pipe so
-   that cman_tool can display it */
-int write_cman_pipe(char *message)
-{
-	if (startup_pipe)
-		return write(startup_pipe, message, strlen(message)+1);
-
-	return 0;
-}
diff --git a/cman/daemon/ais.h b/cman/daemon/ais.h
deleted file mode 100644
index 8ee2285..0000000
--- a/cman/daemon/ais.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <corosync/engine/quorum.h>
-/* DLM Currently maxes out at 3 ! */
-#define MAX_INTERFACES 8
-
-extern int ais_add_ifaddr(char *mcast, char *ifaddr, int portnum);
-extern int comms_send_message(void *buf, int len,
-			      unsigned char toport, unsigned char fromport,
-			      int nodeid,
-			      unsigned int flags);
-extern uint64_t incarnation;
-extern int num_ais_nodes;
-extern quorum_set_quorate_fn_t corosync_set_quorum;
-extern struct memb_ring_id cman_ring_id;
diff --git a/cman/daemon/barrier.c b/cman/daemon/barrier.c
deleted file mode 100644
index 54df19a..0000000
--- a/cman/daemon/barrier.c
+++ /dev/null
@@ -1,468 +0,0 @@
-#include <getopt.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/utsname.h>
-#include <sys/un.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
-#include <sys/signal.h>
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <sys/errno.h>
-
-#include <corosync/ipc_gen.h>
-#include <corosync/engine/coroapi.h>
-#include <corosync/engine/logsys.h>
-#include "list.h"
-#include "cnxman-socket.h"
-#include "cnxman-private.h"
-#include "daemon.h"
-#include "commands.h"
-#include "logging.h"
-#include "barrier.h"
-#include "cman.h"
-#include "ais.h"
-
-extern int we_are_a_cluster_member;
-
-LOGSYS_DECLARE_SUBSYS (CMAN_NAME, LOG_INFO);
-
-/* A barrier */
-struct cl_barrier {
-	struct list list;
-
-	char name[MAX_BARRIER_NAME_LEN];
-	unsigned int flags;
-	enum { BARRIER_STATE_WAITING, BARRIER_STATE_INACTIVE,
-	       BARRIER_STATE_COMPLETE } state;
-	unsigned int expected_nodes;
-	unsigned int got_nodes;
-	unsigned int waitsent;
-	unsigned int phase;	/* Completion phase */
-	unsigned int endreason;	/* Reason we were woken, usually 0 */
-	unsigned int client_complete;
-	unsigned long timeout;	/* In seconds */
-
-	struct connection *con;
-	corosync_timer_handle_t timer;
-};
-extern struct corosync_api_v1 *corosync;
-
-/* A list of all current barriers */
-static struct list barrier_list;
-
-static void send_barrier_complete_msg(struct cl_barrier *barrier)
-{
-	if (barrier->timeout) {
-		corosync->timer_delete(barrier->timer);
-		barrier->timeout = 0;
-	}
-
-	if (!barrier->client_complete) {
-		if (barrier->con)
-			send_status_return(barrier->con, CMAN_CMD_BARRIER, barrier->endreason);
-		barrier->client_complete = 1;
-	}
-}
-
-static struct cl_barrier *find_barrier(char *name)
-{
-	struct list *blist;
-	struct cl_barrier *bar;
-
-	list_iterate(blist, &barrier_list) {
-		bar = list_item(blist, struct cl_barrier);
-
-		if (strcmp(name, bar->name) == 0)
-			return bar;
-	}
-	return NULL;
-}
-
-/* Do the stuff we need to do when the barrier has completed phase 1 */
-static void check_barrier_complete_phase1(struct cl_barrier *barrier)
-{
-	if (barrier->got_nodes == ((barrier->expected_nodes != 0)
-				   ? barrier->expected_nodes :
-				   cluster_members)) {
-
-		struct cl_barriermsg bmsg;
-
-		barrier->phase = 2;	/* Wait for complete phase II */
-
-		bmsg.cmd = CLUSTER_MSG_BARRIER;
-		bmsg.subcmd = BARRIER_COMPLETE;
-		strcpy(bmsg.name, barrier->name);
-
-		P_BARRIER("Sending COMPLETE for %s\n", barrier->name);
-		comms_send_message((char *) &bmsg, sizeof (bmsg),
-				   0, 0,
-				   0,
-				   MSG_TOTEM_SAFE);
-	}
-}
-
-/* Do the stuff we need to do when the barrier has been reached */
-/* Return 1 if we deleted the barrier */
-static int barrier_complete_phase2(struct cl_barrier *barrier, int status)
-{
-	P_BARRIER("complete_phase2 for %s\n", barrier->name);
-
-	barrier->endreason = status;
-
-	/* Wake up listener */
-	if (barrier->state == BARRIER_STATE_WAITING) {
-		send_barrier_complete_msg(barrier);
-	}
-	barrier->state = BARRIER_STATE_COMPLETE;
-
-	/* Delete barrier if autodelete */
-	if (barrier->flags & BARRIER_ATTR_AUTODELETE) {
-		list_del(&barrier->list);
-		free(barrier);
-		return 1;
-	}
-
-	return 0;
-}
-
-/* Called if a barrier timeout happens */
-static void barrier_timer_fn(void *arg)
-{
-	struct cl_barrier *barrier = arg;
-
-	P_BARRIER("Barrier timer_fn called for %s\n", barrier->name);
-
-	/* Ignore any futher messages, they are too late. */
-	barrier->phase = 0;
-
-	/* and cause it to timeout */
-	barrier_complete_phase2(barrier, -ETIMEDOUT);
-}
-
-static struct cl_barrier *alloc_barrier(char *name, int nodes)
-{
-	struct cl_barrier *barrier;
-
-	/* Build a new struct and add it to the list */
-	barrier = malloc(sizeof (struct cl_barrier));
-	if (barrier == NULL) {
-		return NULL;
-	}
-	memset(barrier, 0, sizeof (*barrier));
-
-	strcpy(barrier->name, name);
-	barrier->flags = 0;
-	barrier->expected_nodes = nodes;
-	barrier->got_nodes = 0;
-	barrier->endreason = 0;
-	barrier->state = BARRIER_STATE_INACTIVE;
-
-	list_add(&barrier_list, &barrier->list);
-	return barrier;
-}
-
-/* Process BARRIER messages from other nodes */
-void process_barrier_msg(struct cl_barriermsg *msg,
-			 struct cluster_node *node)
-{
-	struct cl_barrier *barrier;
-
-	barrier = find_barrier(msg->name);
-
-	/* Ignore other peoples' messages */
-	if (!we_are_a_cluster_member)
-		return;
-	if (!barrier)
-		return;
-
-	P_BARRIER("Got %d for %s, from node %s\n", msg->subcmd, msg->name,
-		  node ? node->name : "unknown");
-
-	switch (msg->subcmd) {
-	case BARRIER_WAIT:
-		if (barrier->phase == 0)
-			barrier->phase = 1;
-
-		if (barrier->phase == 1) {
-			barrier->got_nodes++;
-			check_barrier_complete_phase1(barrier);
-		}
-		break;
-
-	case BARRIER_COMPLETE:
-		if (!barrier)
-			return;
-		/* Once we receive COMPLETE, we know that everyone has completed.
-		   I love VS */
-		barrier_complete_phase2(barrier, 0);
-		break;
-	}
-}
-
-
-/* Barrier API */
-static int barrier_register(struct connection *con, char *name, unsigned int flags, unsigned int nodes)
-{
-	struct cl_barrier *barrier;
-
-	/* We are not joined to a cluster */
-	if (!we_are_a_cluster_member)
-		return -ENOTCONN;
-
-	/* Must have a valid name */
-	if (name == NULL || strlen(name) > MAX_BARRIER_NAME_LEN - 1)
-		return -EINVAL;
-
-	/* We don't do this yet */
-	if (flags & BARRIER_ATTR_MULTISTEP)
-		return -EINVAL;
-
-	P_BARRIER("barrier_register %s, nodes = %d, flags =%x\n", name, nodes, flags);
-
-	/* See if it already exists */
-	if ((barrier = find_barrier(name))) {
-		if (nodes != barrier->expected_nodes) {
-			log_printf(LOG_ERR, "Barrier registration failed for '%s', expected nodes=%d, requested=%d\n",
-			       name, barrier->expected_nodes, nodes);
-			return -EINVAL;
-		}
-		else {
-			/* Fill this is as it may have been remote registered */
-			barrier->con = con;
-			return 0;
-		}
-	}
-
-	barrier = alloc_barrier(name, nodes);
-	if (!barrier)
-		return -ENOMEM;
-
-	barrier->flags = flags;
-	barrier->con = con;
-	return 0;
-}
-
-static int barrier_setattr_enabled(struct cl_barrier *barrier,
-				   unsigned int attr, unsigned long arg)
-{
-	int status;
-
-	/* Can't disable a barrier */
-	if (!arg) {
-		return -EINVAL;
-	}
-
-	/* We need to send WAIT now because the user may not
-	 * actually call barrier_wait() */
-	if (!barrier->waitsent) {
-		struct cl_barriermsg bmsg;
-
-		/* Send it to the rest of the cluster */
-		bmsg.cmd = CLUSTER_MSG_BARRIER;
-		bmsg.subcmd = BARRIER_WAIT;
-		strcpy(bmsg.name, barrier->name);
-
-		barrier->waitsent = 1;
-		barrier->phase = 1;
-
-		/* Start the timer if one was wanted */
-		if (barrier->timeout) {
-			corosync->timer_add_duration((unsigned long long)barrier->timeout*1000000000ULL, barrier,
-						   barrier_timer_fn, &barrier->timer);
-		}
-
-		P_BARRIER("Sending WAIT for %s\n", barrier->name);
-		status = comms_send_message((char *)&bmsg, sizeof(bmsg), 0,0, 0, MSG_TOTEM_SAFE);
-		if (status < 0) {
-			return status;
-		}
-	}
-	if (barrier && barrier->state == BARRIER_STATE_COMPLETE) {
-		return barrier->endreason;
-	}
-	return 0;	/* Nothing to propogate */
-}
-
-static int barrier_setattr(char *name, unsigned int attr, unsigned long arg)
-{
-	struct cl_barrier *barrier;
-
-	/* See if it already exists */
-	if (!(barrier = find_barrier(name))) {
-		return -ENOENT;
-	}
-
-	if (barrier->state == BARRIER_STATE_COMPLETE) {
-		return 0;
-	}
-
-	switch (attr) {
-	case BARRIER_SETATTR_AUTODELETE:
-		if (arg)
-			barrier->flags |= BARRIER_ATTR_AUTODELETE;
-		else
-			barrier->flags &= ~BARRIER_ATTR_AUTODELETE;
-		return 0;
-		break;
-
-	case BARRIER_SETATTR_TIMEOUT:
-		/* Can only change the timout of an inactive barrier */
-		if (barrier->state == BARRIER_STATE_WAITING
-		    || barrier->waitsent) {
-			return -EINVAL;
-		}
-		barrier->timeout = arg;
-		return 0;
-
-	case BARRIER_SETATTR_MULTISTEP:
-		return -EINVAL;
-
-	case BARRIER_SETATTR_ENABLED:
-		return barrier_setattr_enabled(barrier, attr, arg);
-
-	case BARRIER_SETATTR_NODES:
-		/* Can only change the expected node count of an inactive
-		 * barrier */
-		if (barrier->state == BARRIER_STATE_WAITING
-		    || barrier->waitsent)
-			return -EINVAL;
-		barrier->expected_nodes = arg;
-		break;
-	}
-
-	return 0;
-}
-
-static int barrier_delete(char *name)
-{
-	struct cl_barrier *barrier;
-
-	/* See if it exists */
-	if (!(barrier = find_barrier(name))) {
-		return -ENOENT;
-	}
-
-	/* Delete it */
-	list_del(&barrier->list);
-	free(barrier);
-	return 0;
-}
-
-static int barrier_wait(char *name)
-{
-	struct cl_barrier *barrier;
-
-	/* Enable it */
-	barrier_setattr(name, BARRIER_SETATTR_ENABLED, 1L);
-
-	/* See if it still exists - enable may have deleted it! */
-	if (!(barrier = find_barrier(name))) {
-		return -ENOENT;
-	}
-
-	/* If it has already completed then return the status */
-	if (barrier->state == BARRIER_STATE_COMPLETE) {
-		send_barrier_complete_msg(barrier);
-	}
-	else {
-		barrier->state = BARRIER_STATE_WAITING;
-	}
-
-	/* User will wait */
-	return -EWOULDBLOCK;
-}
-
-/* This is called from membership services when a node has left the cluster -
- * we signal all waiting barriers with ESRCH so they know to do something
- * else, if the number of nodes is left at 0 then we compare the new number of
- * nodes in the cluster with that at the barrier and return 0 (success) in that
- * case */
-void check_barrier_returns()
-{
-	struct list *blist;
-	struct cl_barrier *barrier;
-	int status = 0;
-
-	list_iterate(blist, &barrier_list) {
-		barrier = list_item(blist, struct cl_barrier);
-
-		if (barrier->waitsent) {
-			int wakeit = 0;
-
-			/* Check for a dynamic member barrier */
-			if (barrier->expected_nodes == 0) {
-				status = 0;
-				wakeit = 1;
-			}
-			else {
-				status = ESRCH;
-				wakeit = 1;
-			}
-
-			/* Do we need to tell the barrier? */
-			if (wakeit) {
-				if (barrier->state == BARRIER_STATE_WAITING) {
-					barrier->endreason = status;
-					send_barrier_complete_msg(barrier);
-				}
-			}
-		}
-	}
-}
-
-/* Remote command */
-int do_cmd_barrier(struct connection *con, char *cmdbuf, int *retlen)
-{
-	struct cl_barrier_info info;
-
-	if (!we_are_a_cluster_member)
-		return -ENOENT;
-
-	memcpy(&info, cmdbuf, sizeof(info));
-
-	switch (info.cmd) {
-	case BARRIER_CMD_REGISTER:
-		return barrier_register(con,
-					info.name,
-					info.flags,
-					info.arg);
-	case BARRIER_CMD_CHANGE:
-		return barrier_setattr(info.name,
-				       info.flags,
-				       info.arg);
-	case BARRIER_CMD_WAIT:
-		return barrier_wait(info.name);
-	case BARRIER_CMD_DELETE:
-		return barrier_delete(info.name);
-	default:
-		return -EINVAL;
-	}
-}
-
-/* Remove any barriers associated with this connection */
-void remove_barriers(struct connection *con)
-{
-	struct list *blist, *tmp;
-	struct cl_barrier *bar;
-
-	list_iterate_safe(blist, tmp, &barrier_list) {
-		bar = list_item(blist, struct cl_barrier);
-
-		if (con == bar->con) {
-			list_del(&bar->list);
-			free(bar);
-		}
-	}
-}
-
-void barrier_init()
-{
-	list_init(&barrier_list);
-}
diff --git a/cman/daemon/barrier.h b/cman/daemon/barrier.h
deleted file mode 100644
index 102d8b1..0000000
--- a/cman/daemon/barrier.h
+++ /dev/null
@@ -1,6 +0,0 @@
-void process_barrier_msg(struct cl_barriermsg *msg,
-			 struct cluster_node *node);
-int do_cmd_barrier(struct connection *con, char *cmdbuf, int *retlen);
-void barrier_init(void);
-void check_barrier_returns(void);
-void remove_barriers(struct connection *con);
diff --git a/cman/daemon/cman-preconfig.c b/cman/daemon/cman-preconfig.c
deleted file mode 100644
index 4b721bf..0000000
--- a/cman/daemon/cman-preconfig.c
+++ /dev/null
@@ -1,1172 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <assert.h>
-#include <sys/utsname.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/errno.h>
-#include <netdb.h>
-#define SYSLOG_NAMES
-#include <sys/syslog.h>
-#include <ifaddrs.h>
-#include <arpa/inet.h>
-
-/* corosync headers */
-#include <corosync/engine/logsys.h>
-#include <corosync/lcr/lcr_comp.h>
-#include <corosync/engine/objdb.h>
-#include <corosync/engine/config.h>
-
-#include "cman.h"
-#define OBJDB_API struct objdb_iface_ver0
-#include "cnxman-socket.h"
-#include "nodelist.h"
-#include "logging.h"
-
-#define MAX_PATH_LEN PATH_MAX
-
-static unsigned int debug_mask;
-static int cmanpre_readconfig(struct objdb_iface_ver0 *objdb, char **error_string);
-static int cmanpre_reloadconfig(struct objdb_iface_ver0 *objdb, int flush, char **error_string);
-
-static char *nodename_env;
-static int expected_votes;
-static int votes;
-static int num_interfaces;
-static int startup_pipe;
-static unsigned int cluster_id;
-static char nodename[MAX_CLUSTER_MEMBER_NAME_LEN];
-static int nodeid;
-static int two_node;
-static unsigned int disable_openais;
-static unsigned int portnum;
-static int num_nodenames;
-static char *key_filename=NULL;
-static char *mcast_name;
-static char *cluster_name;
-static char error_reason[1024] = { '\0' };
-static unsigned int cluster_parent_handle;
-
-/*
- * Exports the interface for the service
- */
-static struct config_iface_ver0 cmanpreconfig_iface_ver0 = {
-	.config_readconfig        = cmanpre_readconfig,
-	.config_reloadconfig      = cmanpre_reloadconfig
-};
-
-static struct lcr_iface ifaces_ver0[2] = {
-	{
-		.name		       	= "cmanpreconfig",
-		.version	       	= 0,
-		.versions_replace      	= 0,
-		.versions_replace_count	= 0,
-		.dependencies	       	= 0,
-		.dependency_count      	= 0,
-		.constructor	       	= NULL,
-		.destructor	       	= NULL,
-		.interfaces	       	= NULL,
-	}
-};
-
-static struct lcr_comp cmanpre_comp_ver0 = {
-	.iface_count				= 1,
-	.ifaces					= ifaces_ver0,
-};
-
-
-
-__attribute__ ((constructor)) static void cmanpre_comp_register(void) {
-	lcr_interfaces_set(&ifaces_ver0[0], &cmanpreconfig_iface_ver0);
-	lcr_component_register(&cmanpre_comp_ver0);
-}
-
-static char *facility_name_get (unsigned int facility)
-{
-	unsigned int i;
-
-	for (i = 0; facilitynames[i].c_name != NULL; i++) {
-		if (facility == facilitynames[i].c_val) {
-			return (facilitynames[i].c_name);
-		}
-	}
-	return (NULL);
-}
-
-static char *priority_name_get (unsigned int priority)
-{
-	unsigned int i;
-
-	for (i = 0; prioritynames[i].c_name != NULL; i++) {
-		if (priority == prioritynames[i].c_val) {
-			return (prioritynames[i].c_name);
-		}
-	}
-	return (NULL);
-}
-
-
-#define LOCALHOST_IPV4 "127.0.0.1"
-#define LOCALHOST_IPV6 "::1"
-
-/* Compare two addresses */
-static int ipaddr_equal(struct sockaddr_storage *addr1, struct sockaddr_storage *addr2)
-{
-	int addrlen = 0;
-	struct sockaddr *saddr1 = (struct sockaddr *)addr1;
-	struct sockaddr *saddr2 = (struct sockaddr *)addr2;
-
-	if (saddr1->sa_family != saddr2->sa_family)
-		return 0;
-
-	if (saddr1->sa_family == AF_INET) {
-		addrlen = sizeof(struct sockaddr_in);
-	}
-	if (saddr1->sa_family == AF_INET6) {
-		addrlen = sizeof(struct sockaddr_in6);
-	}
-	assert(addrlen);
-
-	if (memcmp(saddr1, saddr2, addrlen) == 0)
-		return 1;
-	else
-		return 0;
-
-}
-
-/* Build a localhost ip_address */
-static int get_localhost(int family, struct sockaddr_storage *localhost)
-{
-	char *addr_text;
-	struct addrinfo *ainfo;
-	struct addrinfo ahints;
-	int ret;
-
-	if (family == AF_INET) {
-		addr_text = LOCALHOST_IPV4;
-	} else {
-		addr_text = LOCALHOST_IPV6;
-	}
-
-	memset(&ahints, 0, sizeof(ahints));
-	ahints.ai_socktype = SOCK_DGRAM;
-	ahints.ai_protocol = IPPROTO_UDP;
-	ahints.ai_family = family;
-
-	/* Lookup the nodename address */
-	ret = getaddrinfo(addr_text, NULL, &ahints, &ainfo);
-	if (ret)
-		return -1;
-
-	memset(localhost, 0, sizeof(struct sockaddr_storage));
-	memcpy(localhost, ainfo->ai_addr, ainfo->ai_addrlen);
-
-	freeaddrinfo(ainfo);
-	return 0;
-}
-
-/* Return the address family of an IP[46] name */
-static int address_family(char *addr, struct sockaddr_storage *ssaddr)
-{
-	struct addrinfo *ainfo;
-	struct addrinfo ahints;
-	int family;
-	int ret;
-
-	memset(&ahints, 0, sizeof(ahints));
-	ahints.ai_socktype = SOCK_DGRAM;
-	ahints.ai_protocol = IPPROTO_UDP;
-
-	/* Lookup the nodename address */
-	ret = getaddrinfo(addr, NULL, &ahints, &ainfo);
-	if (ret)
-		return -1;
-
-	memset(ssaddr, 0, sizeof(struct sockaddr_storage));
-	memcpy(ssaddr, ainfo->ai_addr, ainfo->ai_addrlen);
-	family = ainfo->ai_family;
-
-	freeaddrinfo(ainfo);
-	return family;
-}
-
-
-/* Find the "CMAN" logger_subsys object. Or create one if it does not
-   exist
-*/
-static unsigned int find_cman_logger(struct objdb_iface_ver0 *objdb, unsigned int object_handle)
-{
-	unsigned int subsys_handle;
-	unsigned int find_handle;
-	char *str;
-
-	objdb->object_find_create(object_handle, "logger_subsys", strlen("logger_subsys"), &find_handle);
-	while (!objdb->object_find_next(object_handle, &subsys_handle)) {
-
-		if (objdb_get_string(objdb, subsys_handle, "subsys", &str)) {
-			continue;
-		}
-		if (strcmp(str, CMAN_NAME) == 0)
-			return subsys_handle;
-	}
-	objdb->object_find_destroy(find_handle);
-
-	/* We can't find it ... create one */
-	if (objdb->object_create(object_handle, &subsys_handle,
-				    "logger_subsys", strlen("logger_subsys")) == 0) {
-
-		objdb->object_key_create(subsys_handle, "subsys", strlen("subsys"),
-					    CMAN_NAME, strlen(CMAN_NAME)+1);
-	}
-
-	return subsys_handle;
-
-}
-
-
-static int add_ifaddr(struct objdb_iface_ver0 *objdb, char *mcast, char *ifaddr, int portnum)
-{
-	unsigned int totem_object_handle;
-	unsigned int find_handle;
-	unsigned int interface_object_handle;
-	struct sockaddr_storage if_addr, localhost, mcast_addr;
-	char tmp[132];
-	int ret = 0;
-
-	/* Check the families match */
-	if (address_family(mcast, &mcast_addr) !=
-	    address_family(ifaddr, &if_addr)) {
-		sprintf(error_reason, "Node address family does not match multicast address family");
-		return -1;
-	}
-
-	/* Check it's not bound to localhost, sigh */
-	get_localhost(if_addr.ss_family, &localhost);
-	if (ipaddr_equal(&localhost, &if_addr)) {
-		sprintf(error_reason, "Node address is localhost, please choose a real host address");
-		return -1;
-	}
-
-	objdb->object_find_create(OBJECT_PARENT_HANDLE, "totem", strlen("totem"), &find_handle);
-	if (objdb->object_find_next(find_handle, &totem_object_handle)) {
-
-		objdb->object_create(OBJECT_PARENT_HANDLE, &totem_object_handle,
-				     "totem", strlen("totem"));
-        }
-	objdb->object_find_destroy(find_handle);
-
-	if (objdb->object_create(totem_object_handle, &interface_object_handle,
-				 "interface", strlen("interface")) == 0) {
-
-		sprintf(tmp, "%d", num_interfaces);
-		objdb->object_key_create(interface_object_handle, "ringnumber", strlen("ringnumber"),
-					 tmp, strlen(tmp)+1);
-
-		objdb->object_key_create(interface_object_handle, "bindnetaddr", strlen("bindnetaddr"),
-					 ifaddr, strlen(ifaddr)+1);
-
-		objdb->object_key_create(interface_object_handle, "mcastaddr", strlen("mcastaddr"),
-					 mcast, strlen(mcast)+1);
-
-		sprintf(tmp, "%d", portnum);
-		objdb->object_key_create(interface_object_handle, "mcastport", strlen("mcastport"),
-					 tmp, strlen(tmp)+1);
-
-		num_interfaces++;
-	}
-	return ret;
-}
-
-static uint16_t generate_cluster_id(char *name)
-{
-	int i;
-	int value = 0;
-
-	for (i=0; i<strlen(name); i++) {
-		value <<= 1;
-		value += name[i];
-	}
-	sprintf(error_reason, "Generated cluster id for '%s' is %d\n", name, value & 0xFFFF);
-	return value & 0xFFFF;
-}
-
-static char *default_mcast(char *nodename, uint16_t cluster_id)
-{
-        struct addrinfo *ainfo;
-        struct addrinfo ahints;
-	int ret;
-	int family;
-	static char addr[132];
-
-        memset(&ahints, 0, sizeof(ahints));
-
-        /* Lookup the the nodename address and use it's IP type to
-	   default a multicast address */
-        ret = getaddrinfo(nodename, NULL, &ahints, &ainfo);
-	if (ret) {
-		sprintf(error_reason, "Can't determine address family of nodename %s\n", nodename);
-		write_cman_pipe("Can't determine address family of nodename");
-		return NULL;
-	}
-
-	family = ainfo->ai_family;
-	freeaddrinfo(ainfo);
-
-	if (family == AF_INET) {
-		snprintf(addr, sizeof(addr), "239.192.%d.%d", cluster_id >> 8, cluster_id % 0xFF);
-		return addr;
-	}
-	if (family == AF_INET6) {
-		snprintf(addr, sizeof(addr), "ff15::%x", cluster_id);
-		return addr;
-	}
-
-	return NULL;
-}
-
-static int verify_nodename(struct objdb_iface_ver0 *objdb, char *nodename)
-{
-	char nodename2[MAX_CLUSTER_MEMBER_NAME_LEN+1];
-	char nodename3[MAX_CLUSTER_MEMBER_NAME_LEN+1];
-	char *str, *dot = NULL;
-	struct ifaddrs *ifa, *ifa_list;
-	struct sockaddr *sa;
-	unsigned int nodes_handle;
-	unsigned int find_handle = 0;
-	int error;
-
-	/* nodename is either from commandline or from uname */
-	if (nodelist_byname(objdb, cluster_parent_handle, nodename))
-		return 0;
-
-	/* If nodename was from uname, try a domain-less version of it */
-	strcpy(nodename2, nodename);
-	dot = strchr(nodename2, '.');
-	if (dot) {
-		*dot = '\0';
-
-		if (nodelist_byname(objdb, cluster_parent_handle, nodename2)) {
-			strcpy(nodename, nodename2);
-			return 0;
-		}
-	}
-
-	/* If nodename (from uname) is domain-less, try to match against
-	   cluster.conf names which may have domainname specified */
-	nodes_handle = nodeslist_init(objdb, cluster_parent_handle, &find_handle);
-	do {
-		int len;
-
-		if (objdb_get_string(objdb, nodes_handle, "name", &str)) {
-			sprintf(error_reason, "Cannot get node name");
-			nodes_handle = nodeslist_next(objdb, find_handle);
-			continue;
-		}
-
-		strcpy(nodename3, str);
-		dot = strchr(nodename3, '.');
-		if (dot)
-			len = dot-nodename3;
-		else
-			len = strlen(nodename3);
-
-		if (strlen(nodename2) == len &&
-		    !strncmp(nodename2, nodename3, len)) {
-			strcpy(nodename, str);
-			return 0;
-		}
-		nodes_handle = nodeslist_next(objdb, find_handle);
-	} while (nodes_handle);
-	objdb->object_find_destroy(find_handle);
-
-
-	/* The cluster.conf names may not be related to uname at all,
-	   they may match a hostname on some network interface.
-	   NOTE: This is IPv4 only */
-	error = getifaddrs(&ifa_list);
-	if (error)
-		return -1;
-
-	for (ifa = ifa_list; ifa; ifa = ifa->ifa_next) {
-		/* Restore this */
-		strcpy(nodename2, nodename);
-		sa = ifa->ifa_addr;
-		if (!sa || sa->sa_family != AF_INET)
-			continue;
-
-		error = getnameinfo(sa, sizeof(*sa), nodename2,
-				    sizeof(nodename2), NULL, 0, 0);
-		if (error)
-			goto out;
-
-		if (nodelist_byname(objdb, cluster_parent_handle, nodename2)) {
-			strcpy(nodename, nodename2);
-			goto out;
-		}
-
-		/* truncate this name and try again */
-
-		dot = strchr(nodename2, '.');
-		if (!dot)
-			continue;
-		*dot = '\0';
-
-		if (nodelist_byname(objdb, cluster_parent_handle, nodename2)) {
-			strcpy(nodename, nodename2);
-			goto out;
-		}
-
-		/* See if it's the IP address that's in cluster.conf */
-		error = getnameinfo(sa, sizeof(*sa), nodename2,
-				    sizeof(nodename2), NULL, 0, NI_NUMERICHOST);
-		if (error)
-			goto out;
-
-		if (nodelist_byname(objdb, cluster_parent_handle, nodename2)) {
-			strcpy(nodename, nodename2);
-			goto out;
-		}
-	}
-
-	error = -1;
- out:
-	freeifaddrs(ifa_list);
-	return error;
-}
-
-/* Get any environment variable overrides */
-static int get_env_overrides()
-{
-	if (getenv("CMAN_CLUSTER_NAME")) {
-		cluster_name = strdup(getenv("CMAN_CLUSTER_NAME"));
-	}
-
-	nodename_env = getenv("CMAN_NODENAME");
-
-	expected_votes = 0;
-	if (getenv("CMAN_EXPECTEDVOTES")) {
-		expected_votes = atoi(getenv("CMAN_EXPECTEDVOTES"));
-		if (expected_votes < 1) {
-			expected_votes = 0;
-		}
-	}
-
-	/* optional port */
-	if (getenv("CMAN_IP_PORT")) {
-		portnum = atoi(getenv("CMAN_IP_PORT"));
-	}
-
-	/* optional security key filename */
-	if (getenv("CMAN_KEYFILE")) {
-		key_filename = strdup(getenv("CMAN_KEYFILE"));
-		if (key_filename == NULL) {
-			write_cman_pipe("Cannot allocate memory for key filename");
-			return -1;
-		}
-	}
-
-	/* find our own number of votes */
-	if (getenv("CMAN_VOTES")) {
-		votes = atoi(getenv("CMAN_VOTES"));
-	}
-
-	/* nodeid */
-	if (getenv("CMAN_NODEID")) {
-		nodeid = atoi(getenv("CMAN_NODEID"));
-	}
-
-	if (getenv("CMAN_MCAST_ADDR")) {
-		mcast_name = getenv("CMAN_MCAST_ADDR");
-	}
-
-	if (getenv("CMAN_2NODE")) {
-		two_node = 1;
-		expected_votes = 1;
-		votes = 1;
-	}
-	if (getenv("CMAN_DEBUGLOG")) {
-		debug_mask = atoi(getenv("CMAN_DEBUGLOG"));
-	}
-
-	return 0;
-}
-
-
-static int get_nodename(struct objdb_iface_ver0 *objdb)
-{
-	char *nodeid_str = NULL;
-	unsigned int object_handle;
-	unsigned int find_handle;
-	unsigned int node_object_handle;
-	unsigned int alt_object;
-	int error;
-
-	if (!getenv("CMAN_NOCONFIG")) {
-		/* our nodename */
-		if (nodename_env != NULL) {
-			if (strlen(nodename_env) >= sizeof(nodename)) {
-				sprintf(error_reason, "Overridden node name %s is too long", nodename);
-				write_cman_pipe("Overridden node name is too long");
-				error = -1;
-				goto out;
-			}
-
-			strcpy(nodename, nodename_env);
-
-			if (!(node_object_handle = nodelist_byname(objdb, cluster_parent_handle, nodename))) {
-				sprintf(error_reason, "Overridden node name %s is not in CCS", nodename);
-				write_cman_pipe("Overridden node name is not in CCS");
-				error = -1;
-				goto out;
-			}
-
-		} else {
-			struct utsname utsname;
-
-			error = uname(&utsname);
-			if (error) {
-				sprintf(error_reason, "cannot get node name, uname failed");
-				write_cman_pipe("Can't determine local node name");
-				error = -1;
-				goto out;
-			}
-
-			if (strlen(utsname.nodename) >= sizeof(nodename)) {
-				sprintf(error_reason, "node name from uname is too long");
-				write_cman_pipe("Can't determine local node name");
-				error = -1;
-				goto out;
-			}
-
-			strcpy(nodename, utsname.nodename);
-		}
-		if (verify_nodename(objdb, nodename))
-			return -1;
-
-	}
-
-	/* Add <cman> bits to pass down to the main module*/
-	if ( (node_object_handle = nodelist_byname(objdb, cluster_parent_handle, nodename))) {
-		if (objdb_get_string(objdb, node_object_handle, "nodeid", &nodeid_str)) {
-			sprintf(error_reason, "This node has no nodeid in cluster.conf");
-			write_cman_pipe("This node has no nodeid in cluster.conf");
-			return -1;
-		}
-	}
-
-	objdb->object_find_create(cluster_parent_handle, "cman", strlen("cman"), &find_handle);
-
-	if (objdb->object_find_next(find_handle, &object_handle) == 0) {
-
-		unsigned int mcast_handle;
-		unsigned int find_handle2;
-
-		if (!mcast_name) {
-
-			objdb->object_find_create(object_handle, "multicast", strlen("multicast"), &find_handle2);
-			if (objdb->object_find_next(find_handle2, &mcast_handle) == 0) {
-
-				objdb_get_string(objdb, mcast_handle, "addr", &mcast_name);
-			}
-			objdb->object_find_destroy(find_handle2);
-		}
-
-		if (!mcast_name) {
-			mcast_name = default_mcast(nodename, cluster_id);
-		}
-
-		/* See if the user wants our default set of openais services (default=yes) */
-		objdb_get_int(objdb, object_handle, "disable_openais", &disable_openais, 0);
-
-		objdb->object_key_create(object_handle, "nodename", strlen("nodename"),
-					    nodename, strlen(nodename)+1);
-	}
-	objdb->object_find_destroy(find_handle);
-
-	nodeid = atoi(nodeid_str);
-	error = 0;
-
-	/* optional port */
-	if (!portnum) {
-		objdb_get_int(objdb, object_handle, "port", &portnum, DEFAULT_PORT);
-	}
-
-	if (add_ifaddr(objdb, mcast_name, nodename, portnum))
-		return -1;
-
-	/* Get all alternative node names */
-	num_nodenames = 1;
-	objdb->object_find_create(node_object_handle,"altname", strlen("altname"), &find_handle);
-	while (objdb->object_find_next(find_handle, &alt_object) == 0) {
-		unsigned int port;
-		char *nodename;
-		char *mcast;
-
-		if (objdb_get_string(objdb, alt_object, "name", &nodename)) {
-			continue;
-		}
-
-		objdb_get_int(objdb, alt_object, "port", &port, portnum);
-
-		if (objdb_get_string(objdb, alt_object, "mcast", &mcast)) {
-			mcast = mcast_name;
-		}
-
-		if (add_ifaddr(objdb, mcast, nodename, portnum))
-			return -1;
-
-		num_nodenames++;
-	}
-	objdb->object_find_destroy(find_handle);
-
-out:
-	return error;
-}
-
-/* These are basically cman overrides to the totem config bits */
-static void add_cman_overrides(struct objdb_iface_ver0 *objdb)
-{
-	unsigned int logger_object_handle;
-	char *logstr;
-	char *logfacility;
-	unsigned int object_handle;
-	unsigned int find_handle;
-	char tmp[256];
-
-	/* "totem" key already exists, because we have added the interfaces by now */
-	objdb->object_find_create(OBJECT_PARENT_HANDLE,"totem", strlen("totem"), &find_handle);
-	if (objdb->object_find_next(find_handle, &object_handle) == 0)
-	{
-		char *value;
-
-		objdb->object_key_create(object_handle, "version", strlen("version"),
-					 "2", 2);
-
-		sprintf(tmp, "%d", nodeid);
-		objdb->object_key_create(object_handle, "nodeid", strlen("nodeid"),
-					 tmp, strlen(tmp)+1);
-
-		objdb->object_key_create(object_handle, "vsftype", strlen("vsftype"),
-					 "none", strlen("none")+1);
-
-		/* Set the token timeout is 10 seconds, but don't overrride anything that
-		   might be in cluster.conf */
-		if (objdb_get_string(objdb, object_handle, "token", &value)) {
-			objdb->object_key_create(object_handle, "token", strlen("token"),
-						 "10000", strlen("10000")+1);
-		}
-		if (objdb_get_string(objdb, object_handle, "token_retransmits_before_loss_const", &value)) {
-			objdb->object_key_create(object_handle, "token_retransmits_before_loss_const",
-						 strlen("token_retransmits_before_loss_const"),
-						 "20", strlen("20")+1);
-		}
-
-		/* Extend consensus & join timeouts per bz#214290 */
-		if (objdb_get_string(objdb, object_handle, "join", &value)) {
-			objdb->object_key_create(object_handle, "join", strlen("join"),
-						 "60", strlen("60")+1);
-		}
-		if (objdb_get_string(objdb, object_handle, "consensus", &value)) {
-			objdb->object_key_create(object_handle, "consensus", strlen("consensus"),
-						 "4800", strlen("4800")+1);
-		}
-
-		/* Set RRP mode appropriately */
-		if (objdb_get_string(objdb, object_handle, "rrp_mode", &value)) {
-			if (num_interfaces > 1) {
-				objdb->object_key_create(object_handle, "rrp_mode", strlen("rrp_mode"),
-							 "active", strlen("active")+1);
-			}
-			else {
-				objdb->object_key_create(object_handle, "rrp_mode", strlen("rrp_mode"),
-							 "none", strlen("none")+1);
-			}
-		}
-
-		if (objdb_get_string(objdb, object_handle, "secauth", &value)) {
-			sprintf(tmp, "%d", 1);
-			objdb->object_key_create(object_handle, "secauth", strlen("secauth"),
-						 tmp, strlen(tmp)+1);
-		}
-
-		/* optional security key filename */
-		if (!key_filename) {
-			objdb_get_string(objdb, object_handle, "keyfile", &key_filename);
-		}
-		else {
-			objdb->object_key_create(object_handle, "keyfile", strlen("keyfile"),
-						 key_filename, strlen(key_filename)+1);
-		}
-		if (!key_filename) {
-			/* Use the cluster name as key,
-			 * This isn't a good isolation strategy but it does make sure that
-			 * clusters on the same port/multicast by mistake don't actually interfere
-			 * and that we have some form of encryption going.
-			 */
-
-			int keylen;
-			memset(tmp, 0, sizeof(tmp));
-
-			strcpy(tmp, cluster_name);
-
-			/* Key length must be a multiple of 4 */
-			keylen = (strlen(cluster_name)+4) & 0xFC;
-			objdb->object_key_create(object_handle, "key", strlen("key"),
-						 tmp, keylen);
-		}
-	}
-	objdb->object_find_destroy(find_handle);
-
-	/* Make sure mainconfig doesn't stomp on our logging options */
-	objdb->object_find_create(OBJECT_PARENT_HANDLE, "logging", strlen("logging"), &find_handle);
-	if (objdb->object_find_next(find_handle, &object_handle)) {
-
-                objdb->object_create(OBJECT_PARENT_HANDLE, &object_handle,
-					    "logging", strlen("logging"));
-        }
-	objdb->object_find_destroy(find_handle);
-
-	logfacility = facility_name_get(SYSLOGFACILITY);
-
-	logger_object_handle = find_cman_logger(objdb, object_handle);
-
-	if (objdb_get_string(objdb, object_handle, "syslog_facility", &logstr)) {
-		objdb->object_key_create(object_handle, "syslog_facility", strlen("syslog_facility"),
-					    logfacility, strlen(logfacility)+1);
-	}
-
-	if (objdb_get_string(objdb, object_handle, "to_file", &logstr)) {
-		objdb->object_key_create(object_handle, "to_file", strlen("to_file"),
-					    "yes", strlen("yes")+1);
-	}
-
-	if (objdb_get_string(objdb, object_handle, "logfile", &logstr)) {
-		objdb->object_key_create(object_handle, "logfile", strlen("logfile"),
-					    LOGDIR "/cman.log", strlen(LOGDIR "/cman.log")+1);
-	}
-
-	if (debug_mask) {
-		objdb->object_key_create(object_handle, "to_stderr", strlen("to_stderr"),
-					    "yes", strlen("yes")+1);
-		objdb->object_key_create(logger_object_handle, "debug", strlen("debug"),
-					    "on", strlen("on")+1);
-		objdb->object_key_create(logger_object_handle, "syslog_level", strlen("syslog_level"),
-					    "debug", strlen("debug")+1);
-
-	}
-	else {
-		char *loglevel;
-		loglevel = priority_name_get(SYSLOGLEVEL);
-		objdb->object_key_create(logger_object_handle, "syslog_level", strlen("syslog_level"),
-					    loglevel, strlen(loglevel)+1);
-	}
-
-
-	/* Don't run under user "ais" */
-	objdb->object_find_create(OBJECT_PARENT_HANDLE, "aisexec", strlen("aisexec"), &find_handle);
-	if (objdb->object_find_next(find_handle, &object_handle) != 0) {
-		objdb->object_create(OBJECT_PARENT_HANDLE, &object_handle,
-					"aisexec", strlen("aisexec"));
-
-	}
-	objdb->object_find_destroy(find_handle);
-	objdb->object_key_create(object_handle, "user", strlen("user"),
-				    "root", strlen("root") + 1);
-	objdb->object_key_create(object_handle, "group", strlen("group"),
-				    "root", strlen("root") + 1);
-
-	objdb->object_find_create(cluster_parent_handle, "cman", strlen("cman"), &find_handle);
-	if (objdb->object_find_next(find_handle, &object_handle) == 0)
-	{
-		char str[255];
-
-		sprintf(str, "%d", cluster_id);
-
-		objdb->object_key_create(object_handle, "cluster_id", strlen("cluster_id"),
-					 str, strlen(str) + 1);
-
-		if (two_node) {
-			sprintf(str, "%d", 1);
-			objdb->object_key_create(object_handle, "two_node", strlen("two_node"),
-						 str, strlen(str) + 1);
-		}
-		if (debug_mask) {
-			sprintf(str, "%d", debug_mask);
-			objdb->object_key_create(object_handle, "debug_mask", strlen("debug_mask"),
-						 str, strlen(str) + 1);
-		}
-	}
-	objdb->object_find_destroy(find_handle);
-
-	/* Make sure we load our alter-ego - the main cman module */
-	objdb->object_create(OBJECT_PARENT_HANDLE, &object_handle,
-			     "service", strlen("service"));
-	objdb->object_key_create(object_handle, "name", strlen("name"),
-				 "corosync_cman", strlen("corosync_cman") + 1);
-	objdb->object_key_create(object_handle, "ver", strlen("ver"),
-				 "0", 2);
-
-	/* Define cman as the quorum provider for corosync */
-	objdb->object_find_create(OBJECT_PARENT_HANDLE, "quorum", strlen("quorum"), &find_handle);
-	if (objdb->object_find_next(find_handle, &object_handle) != 0) {
-		objdb->object_create(OBJECT_PARENT_HANDLE, &object_handle,
-					"quorum", strlen("quorum"));
-	}
-	objdb->object_find_destroy(find_handle);
-
-	objdb->object_key_create(object_handle, "provider", strlen("provider"),
-				 "quorum_cman", strlen("quorum_cman") + 1);
-}
-
-/* If ccs is not available then use some defaults */
-static int set_noccs_defaults(struct objdb_iface_ver0 *objdb)
-{
-	char tmp[255];
-	unsigned int object_handle;
-	unsigned int find_handle;
-
-	/* Enforce key */
-	key_filename = NOCCS_KEY_FILENAME;
-
-	if (!cluster_name)
-		cluster_name = DEFAULT_CLUSTER_NAME;
-
-	if (!cluster_id)
-		cluster_id = generate_cluster_id(cluster_name);
-
-	if (!nodename_env) {
-		int error;
-		struct utsname utsname;
-
-		error = uname(&utsname);
-		if (error) {
-			sprintf(error_reason, "cannot get node name, uname failed");
-			write_cman_pipe("Can't determine local node name");
-			return -1;
-		}
-
-		nodename_env = (char *)&utsname.nodename;
-	}
-	strcpy(nodename, nodename_env);
-	num_nodenames = 1;
-
-	if (!mcast_name) {
-		mcast_name = default_mcast(nodename, cluster_id);
-	}
-
-	/* This will increase as nodes join the cluster */
-	if (!expected_votes)
-		expected_votes = 1;
-	if (!votes)
-		votes = 1;
-
-	if (!portnum)
-		portnum = DEFAULT_PORT;
-
-	/* Invent a node ID */
-	if (!nodeid) {
-		struct addrinfo *ainfo;
-		struct addrinfo ahints;
-		int ret;
-
-		memset(&ahints, 0, sizeof(ahints));
-		ret = getaddrinfo(nodename, NULL, &ahints, &ainfo);
-		if (ret) {
-			sprintf(error_reason, "Can't determine address family of nodename %s\n", nodename);
-			write_cman_pipe("Can't determine address family of nodename");
-			return -1;
-		}
-
-		if (ainfo->ai_family == AF_INET) {
-			struct sockaddr_in *addr = (struct sockaddr_in *)ainfo->ai_addr;
-			memcpy(&nodeid, &addr->sin_addr, sizeof(int));
-		}
-		if (ainfo->ai_family == AF_INET6) {
-			struct sockaddr_in6 *addr = (struct sockaddr_in6 *)ainfo->ai_addr;
-			memcpy(&nodeid, &addr->sin6_addr.s6_addr32[3], sizeof(int));
-		}
-		freeaddrinfo(ainfo);
-	}
-
-	/* Write a local <clusternode> entry to keep the rest of the code happy */
-	objdb->object_create(cluster_parent_handle, &object_handle,
-			     "clusternodes", strlen("clusternodes"));
-	objdb->object_create(object_handle, &object_handle,
-			     "clusternode", strlen("clusternode"));
-	objdb->object_key_create(object_handle, "name", strlen("name"),
-				 nodename, strlen(nodename)+1);
-
-	sprintf(tmp, "%d", votes);
-	objdb->object_key_create(object_handle, "votes", strlen("votes"),
-				 tmp, strlen(tmp)+1);
-
-	sprintf(tmp, "%d", nodeid);
-	objdb->object_key_create(object_handle, "nodeid", strlen("nodeid"),
-				 tmp, strlen(tmp)+1);
-
-	/* Write the default cluster name & ID in here too */
-	objdb->object_key_create(cluster_parent_handle, "name", strlen("name"),
-				 cluster_name, strlen(cluster_name)+1);
-
-
-	objdb->object_find_create(cluster_parent_handle, "cman", strlen("cman"), &find_handle);
-	if (objdb->object_find_next(find_handle, &object_handle) == 0) {
-
-                objdb->object_create(cluster_parent_handle, &object_handle,
-                                            "cman", strlen("cman"));
-        }
-	sprintf(tmp, "%d", cluster_id);
-	objdb->object_key_create(object_handle, "cluster_id", strlen("cluster_id"),
-				    tmp, strlen(tmp)+1);
-
-	sprintf(tmp, "%d", expected_votes);
-	objdb->object_key_create(object_handle, "expected_votes", strlen("expected_votes"),
-				    tmp, strlen(tmp)+1);
-
-	objdb->object_find_destroy(find_handle);
-	return 0;
-}
-
-/* Move an object/key tree */
-static int copy_config_tree(struct objdb_iface_ver0 *objdb, unsigned int source_object, unsigned int target_parent_object, int always_create)
-{
-	unsigned int object_handle;
-	unsigned int new_object;
-	unsigned int find_handle;
-	char object_name[1024];
-	int object_name_len;
-	void *key_name;
-	int key_name_len;
-	void *key_value;
-	int key_value_len;
-	int res;
-
-	/* Create new parent object if necessary */
-	objdb->object_name_get(source_object, object_name, &object_name_len);
-
-	objdb->object_find_create(target_parent_object, object_name, strlen(object_name), &find_handle);
-	if (always_create || objdb->object_find_next(find_handle, &object_handle))
-			objdb->object_create(target_parent_object, &new_object, object_name, object_name_len);
-	objdb->object_find_destroy(find_handle);
-
-	/* Copy the keys */
-	objdb->object_key_iter_reset(new_object);
-
-	while (!objdb->object_key_iter(source_object, &key_name, &key_name_len,
-				       &key_value, &key_value_len)) {
-
-		objdb->object_key_create(new_object, key_name, key_name_len,
-					 key_value, key_value_len);
-	}
-
-	/* Create sub-objects */
-	res = objdb->object_find_create(source_object, NULL, 0, &find_handle);
-	if (res) {
-		sprintf(error_reason, "error resetting object iterator for object %d: %d\n", source_object, res);
-		return -1;
-	}
-
-	while ( (res = objdb->object_find_next(find_handle, &object_handle) == 0)) {
-
-		/* Down we go ... */
-		copy_config_tree(objdb, object_handle, new_object, 0);
-	}
-	objdb->object_find_destroy(find_handle);
-
-	return 0;
-}
-
-/*
- * Copy trees from /cluster where they live in cluster.conf, into the root
- * of the config tree where corosync expects to find them.
- */
-static int copy_tree_to_root(struct objdb_iface_ver0 *objdb, char *name, int always_create)
-{
-	unsigned int find_handle;
-	unsigned int object_handle;
-	int res=0;
-
-	objdb->object_find_create(cluster_parent_handle, name, strlen(name), &find_handle);
-	while (objdb->object_find_next(find_handle, &object_handle) == 0) {
-		res = copy_config_tree(objdb, object_handle, OBJECT_PARENT_HANDLE, always_create);
-	}
-	objdb->object_find_destroy(find_handle);
-
-	return res;
-}
-
-static int get_cman_globals(struct objdb_iface_ver0 *objdb)
-{
-	unsigned int object_handle;
-	unsigned int find_handle;
-
-	objdb_get_string(objdb, cluster_parent_handle, "name", &cluster_name);
-
-	/* Get the <cman> bits that override <totem> bits */
-	objdb->object_find_create(cluster_parent_handle, "cman", strlen("cman"), &find_handle);
-	if (objdb->object_find_next(find_handle, &object_handle) == 0) {
-		if (!portnum)
-			objdb_get_int(objdb, object_handle, "port", &portnum, DEFAULT_PORT);
-
-		if (!key_filename)
-			objdb_get_string(objdb, object_handle, "keyfile", &key_filename);
-
-		if (!cluster_id)
-			objdb_get_int(objdb, object_handle, "cluster_id", &cluster_id, 0);
-
-		if (!cluster_id)
-			cluster_id = generate_cluster_id(cluster_name);
-	}
-	objdb->object_find_destroy(find_handle);
-	return 0;
-}
-
-static int cmanpre_reloadconfig(struct objdb_iface_ver0 *objdb, int flush, char **error_string)
-{
-	int ret = -1;
-	unsigned int object_handle;
-	unsigned int find_handle;
-	unsigned int cluster_parent_handle_new;
-
-	/* don't reload if we've been told to run configless */
-	if (getenv("CMAN_NOCONFIG")) {
-		sprintf(error_reason, "Config not updated because we were run with cman_tool -X");
-		ret = 0;
-		goto err;
-	}
-
-	/* find both /cluster entries */
-	objdb->object_find_create(OBJECT_PARENT_HANDLE, "cluster", strlen("cluster"), &find_handle);
-	objdb->object_find_next(find_handle, &cluster_parent_handle);
-	if (!cluster_parent_handle) {
-		sprintf (error_reason, "%s", "Cannot find old /cluster/ key in configuration\n");
-		goto err;
-	}
-	objdb->object_find_next(find_handle, &cluster_parent_handle_new);
-	if (!cluster_parent_handle_new) {
-		sprintf (error_reason, "%s", "Cannot find new /cluster/ key in configuration\n");
-		goto err;
-	}
-	objdb->object_find_destroy(find_handle);
-
-	/* destroy the old one */
-	objdb->object_destroy(cluster_parent_handle);
-
-	/* update the reference to the new config */
-	cluster_parent_handle = cluster_parent_handle_new;
-
-	/* destroy top level /logging */
-	objdb->object_find_create(OBJECT_PARENT_HANDLE, "logging", strlen("logging"), &find_handle);
-	objdb->object_find_next(find_handle, &object_handle);
-	objdb->object_find_destroy(find_handle);
-	if (object_handle) {
-		objdb->object_destroy(object_handle);
-	}
-
-	/* copy /cluster/logging to /logging */
-	ret = copy_tree_to_root(objdb, "logging", 0);
-
-	/* destroy top level /totem */
-	objdb->object_find_create(OBJECT_PARENT_HANDLE, "totem", strlen("totem"), &find_handle);
-	objdb->object_find_next(find_handle, &object_handle);
-	objdb->object_find_destroy(find_handle);
-	if (object_handle) {
-		objdb->object_destroy(object_handle);
-	}
-
-	/* copy /cluster/totem to /totem */
-	ret = copy_tree_to_root(objdb, "totem", 0);
-
-	return 0;
-
-err:
-	*error_string = error_reason;
-	return ret;
-}
-
-static int cmanpre_readconfig(struct objdb_iface_ver0 *objdb, char **error_string)
-{
-	int ret = 0;
-	unsigned int object_handle;
-	unsigned int find_handle;
-
-	if (getenv("CMAN_PIPE"))
-                startup_pipe = atoi(getenv("CMAN_PIPE"));
-
-	objdb->object_find_create(OBJECT_PARENT_HANDLE, "cluster", strlen("cluster"), &find_handle);
-        objdb->object_find_next(find_handle, &cluster_parent_handle);
-	objdb->object_find_destroy(find_handle);
-	if (!cluster_parent_handle) {
-                objdb->object_create(OBJECT_PARENT_HANDLE, &cluster_parent_handle,
-				     "cluster", strlen("cluster"));
-	}
-	else {
-		/* Move these to a place where corosync expects to find them */
-		ret = copy_tree_to_root(objdb, "totem", 0);
-		ret = copy_tree_to_root(objdb, "logging", 0);
-		ret = copy_tree_to_root(objdb, "event", 0);
-		ret = copy_tree_to_root(objdb, "amf", 0);
-		ret = copy_tree_to_root(objdb, "aisexec", 0);
-		ret = copy_tree_to_root(objdb, "service", 1);
-	}
-
-	objdb->object_find_create(cluster_parent_handle, "cman", strlen("cman"), &find_handle);
-	if (objdb->object_find_next(find_handle, &object_handle)) {
-                objdb->object_create(cluster_parent_handle, &object_handle,
-					"cman", strlen("cman"));
-        }
-	objdb->object_find_destroy(find_handle);
-
-	/* This will create /libccs/@next_handle.
-	 * next_handle will be atomically incremented by corosync to return ccs_handle down the pipe.
-	 * We create it in cman-preconfig to avoid an "init" race in libccs.
-	 */
-
-	objdb->object_find_create(OBJECT_PARENT_HANDLE, "libccs", strlen("libccs"), &find_handle);
-	if (objdb->object_find_next(find_handle, &object_handle)) {
-		int next_handle = 0;
-
-		objdb->object_create(OBJECT_PARENT_HANDLE, &object_handle,
-					"libccs", strlen("libccs"));
-
-		objdb->object_key_create(object_handle, "next_handle", strlen("next_handle"),
-					 &next_handle, sizeof(int));
-	}
-	objdb->object_find_destroy(find_handle);
-
-	get_env_overrides();
-	if (getenv("CMAN_NOCONFIG"))
-		ret = set_noccs_defaults(objdb);
-	else
-		ret = get_cman_globals(objdb);
-
-	if (!ret) {
-		ret = get_nodename(objdb);
-		add_cman_overrides(objdb);
-	}
-
-
-	if (!ret) {
-		sprintf (error_reason, "%s", "Successfully parsed cman config\n");
-	}
-	else {
-		if (error_reason[0] == '\0')
-			sprintf (error_reason, "%s", "Error parsing cman config\n");
-	}
-        *error_string = error_reason;
-
-	return ret;
-}
-
-/* Write an error message down the CMAN startup pipe so
-   that cman_tool can display it */
-int write_cman_pipe(char *message)
-{
-	if (startup_pipe)
-		return write(startup_pipe, message, strlen(message)+1);
-
-	return 0;
-}
diff --git a/cman/daemon/cman.h b/cman/daemon/cman.h
deleted file mode 100644
index bba91aa..0000000
--- a/cman/daemon/cman.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/* General cman bits */
-extern int write_cman_pipe(char *message);
-extern void close_cman_pipe(void);
-
-/* How we announce ourself in syslog */
-#define CMAN_NAME "CMAN"
-
-/* Defaults for configuration variables */
-#define NOCCS_KEY_FILENAME      "/etc/cluster/cman_authkey"
-#define DEFAULT_PORT            5405
-#define DEFAULT_CLUSTER_NAME    "RHCluster"
-#define DEFAULT_MAX_QUEUED       128
-#define DEFAULT_QUORUMDEV_POLL   10000
-#define DEFAULT_SHUTDOWN_TIMEOUT 5000
-#define DEFAULT_CCSD_POLL        1000
diff --git a/cman/daemon/cmanconfig.c b/cman/daemon/cmanconfig.c
deleted file mode 100644
index cf0cfd2..0000000
--- a/cman/daemon/cmanconfig.c
+++ /dev/null
@@ -1,297 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <netinet/in.h>
-#include <syslog.h>
-#include <string.h>
-#include <errno.h>
-#include <netdb.h>
-
-#include <corosync/ipc_gen.h>
-#include <corosync/engine/coroapi.h>
-#include <corosync/engine/logsys.h>
-
-#include "list.h"
-#include "cnxman-socket.h"
-#include "cnxman-private.h"
-#include "logging.h"
-#include "commands.h"
-#include "cman.h"
-#define OBJDB_API struct corosync_api_v1
-#include "cmanconfig.h"
-#include "nodelist.h"
-#include "ais.h"
-
-LOGSYS_DECLARE_SUBSYS (CMAN_NAME, LOG_INFO);
-
-/* Local vars - things we get from ccs */
-       int two_node;
-static int nodeid;
-static unsigned int cluster_id;
-static char cluster_name[MAX_CLUSTER_NAME_LEN + 1];
-static unsigned int expected_votes;
-static char *our_nodename;
-static int our_votes;
-
-/* Get all the cluster node names from objdb and
- * add them to our node list.
- * Called when we start up and on "cman_tool version".
- */
-int read_cman_nodes(struct corosync_api_v1 *corosync, unsigned int *config_version, int check_nodeids)
-{
-    int error;
-    unsigned int expected = 0;
-    unsigned int votes = 0;
-    int nodeid;
-    unsigned int object_handle;
-    unsigned int nodes_handle;
-    unsigned int find_handle;
-    char *nodename;
-    unsigned int cluster_parent_handle;
-
-    corosync->object_find_create(OBJECT_PARENT_HANDLE,
-				 "cluster", strlen("cluster"), &find_handle);
-
-    corosync->object_find_next(find_handle, &cluster_parent_handle);
-    corosync->object_find_destroy(find_handle);
-
-    /* New config version */
-    objdb_get_int(corosync, cluster_parent_handle, "config_version", config_version,0);
-
-    corosync->object_find_create(cluster_parent_handle, "cman", strlen("cman"), &find_handle);
-
-    if (corosync->object_find_next(find_handle, &object_handle) == 0)
-    {
-	    /* This overrides any other expected votes calculation /except/ for
-	       one specified on a join command-line */
-	    objdb_get_int(corosync, object_handle, "expected_votes", &expected, 0);
-	    objdb_get_int(corosync, object_handle, "two_node", (unsigned int *)&two_node, 0);
-	    objdb_get_int(corosync, object_handle, "cluster_id", &cluster_id, 0);
-	    objdb_get_string(corosync, object_handle, "nodename", &our_nodename);
-	    objdb_get_int(corosync, object_handle, "max_queued", &max_outstanding_messages, DEFAULT_MAX_QUEUED);
-    }
-    corosync->object_find_destroy(find_handle);
-
-    clear_reread_flags();
-
-    /* Get the nodes list */
-    nodes_handle = nodeslist_init(corosync, cluster_parent_handle, &find_handle);
-    do {
-	    if (objdb_get_string(corosync, nodes_handle, "name", &nodename)) {
-		    nodes_handle = nodeslist_next(corosync, find_handle);
-		    continue;
-	    }
-
-	    objdb_get_int(corosync, nodes_handle, "votes", (unsigned int *)&votes, 1);
-	    objdb_get_int(corosync, nodes_handle, "nodeid", (unsigned int *)&nodeid, 0);
-	    if (check_nodeids && nodeid == 0) {
-		    char message[132];
-
-		    snprintf(message, sizeof(message),
-			     "No node ID for %s, run 'ccs_tool addnodeids' to fix",
-			     nodename);
-		    log_printf(LOG_ERR, "%s", message);
-		    write_cman_pipe(message);
-		    error = -EINVAL;
-		    goto out_err;
-	    }
-
-	    P_MEMB("Got node %s from ccs (id=%d, votes=%d)\n", nodename, nodeid, votes);
-	    add_ccs_node(nodename, nodeid, votes, expected);
-	    nodes_handle = nodeslist_next(corosync, find_handle);
-    } while (nodes_handle);
-    corosync->object_find_destroy(find_handle);
-
-    if (expected)
-	    override_expected(expected);
-
-    remove_unread_nodes();
-    error = 0;
-
-out_err:
-    return error;
-}
-
-static int join(struct corosync_api_v1 *corosync)
-{
-	int error;
-	error = cman_set_nodename(our_nodename);
-	error = cman_set_nodeid(nodeid);
-
-        /*
-	 * Setup join information
-	 */
-	error = cman_join_cluster(corosync, cluster_name, cluster_id,
-				  two_node, our_votes, expected_votes);
-	if (error == -EINVAL) {
-		write_cman_pipe("Cannot start, cluster name is too long or other CCS error");
-		return error;
-	}
-	if (error) {
-		write_cman_pipe("Cannot start, ais may already be running");
-		return error;
-	}
-
-	return 0;
-}
-
-static int get_cman_join_info(struct corosync_api_v1 *corosync)
-{
-	char *cname = NULL;
-	int  error, vote_sum = 0, node_count = 0;
-	int votes=0;
-	unsigned int object_handle;
-	unsigned int node_object;
-	unsigned int nodes_handle;
-	unsigned int find_handle;
-	unsigned int cluster_parent_handle;
-
-	corosync->object_find_create(OBJECT_PARENT_HANDLE,
-				     "cluster", strlen("cluster"), &find_handle);
-
-	corosync->object_find_next(find_handle, &cluster_parent_handle);
-	corosync->object_find_destroy(find_handle);
-
-	/* Cluster name */
-	if (objdb_get_string(corosync, cluster_parent_handle, "name", &cname)) {
-		log_printf(LOG_ERR, "cannot find cluster name in config file");
-		write_cman_pipe("Can't find cluster name in CCS");
-		error = -ENOENT;
-		goto out;
-	}
-
-	strcpy(cluster_name, cname);
-
-	expected_votes = 0;
-	if (getenv("CMAN_EXPECTEDVOTES")) {
-		expected_votes = atoi(getenv("CMAN_EXPECTEDVOTES"));
-		if (expected_votes < 1) {
-			log_printf(LOG_ERR, "CMAN_EXPECTEDVOTES environment variable is invalid, ignoring");
-			expected_votes = 0;
-		}
-		else {
-			log_printf(LOG_INFO, "Using override expected votes %d\n", expected_votes);
-		}
-	}
-
-	/* Sum node votes for expected. Even if we already know expected_votes, we need vote_sum
-	   later */
-	nodes_handle = nodeslist_init(corosync, cluster_parent_handle, &find_handle);
-	do {
-		int votes;
-
-		node_count++;
-
-		objdb_get_int(corosync, nodes_handle, "votes", (unsigned int *)&votes, 1);
-		if (votes < 0) {
-			log_printf(LOG_ERR, "negative votes not allowed");
-			write_cman_pipe("Found negative votes for this node in CCS");
-			error = -EINVAL;
-			goto out;
-		}
-		vote_sum += votes;
-		nodes_handle = nodeslist_next(corosync, find_handle);
-	} while (nodes_handle);
-	corosync->object_find_destroy(find_handle);
-
-	if (expected_votes == 0) {
-		corosync->object_find_create(cluster_parent_handle, "cman", strlen("cman"), &find_handle);
-		if (corosync->object_find_next(find_handle, &object_handle) == 0)
-		{
-
-			/* optional expected_votes supercedes vote sum */
-			objdb_get_int(corosync, object_handle, "expected_votes", (unsigned int *)&expected_votes, 0);
-			if (!expected_votes)
-				expected_votes = vote_sum;
-		}
-		corosync->object_find_destroy(find_handle);
-	}
-
-	/* find our own number of votes */
-	if (getenv("CMAN_VOTES")) {
-		votes = atoi(getenv("CMAN_VOTES"));
-		log_printf(LOG_INFO, "Using override votes %d\n", votes);
-	}
-
-	node_object = nodelist_byname(corosync, cluster_parent_handle, our_nodename);
-	if (!node_object) {
-		log_printf(LOG_ERR, "unable to find votes for %s", our_nodename);
-		write_cman_pipe("Unable to find votes for node in CCS");
-		return -E2BIG;
-	}
-
-	if (!votes) {
-		unsigned int votestmp=-1;
-		objdb_get_int(corosync, node_object, "votes", &votestmp, 1);
-		if (votestmp < 0 || votestmp > 255) {
-			log_printf(LOG_ERR, "invalid votes value %d", votestmp);
-			write_cman_pipe("Found invalid votes for node in CCS");
-			return -EINVAL;
-		}
-		votes = votestmp;
-	}
-	our_votes = votes;
-
-	/* nodeid */
-	if (getenv("CMAN_NODEID")) {
-		nodeid = atoi(getenv("CMAN_NODEID"));
-		log_printf(LOG_INFO, "Using override nodeid %d\n", nodeid);
-	}
-
-	if (!nodeid) {
-		objdb_get_int(corosync, node_object, "nodeid", (unsigned int *)&nodeid, 0);
-	}
-
-	if (!nodeid) {
-		log_printf(LOG_ERR, "No nodeid specified in cluster.conf");
-		write_cman_pipe("CCS does not have a nodeid for this node, run 'ccs_tool addnodeids' to fix");
-		return -EINVAL;
-	}
-
-	/* two_node mode */
-	if (two_node) {
-		if (node_count != 2 || vote_sum != 2) {
-			log_printf(LOG_ERR, "the two-node option requires exactly two "
-				   "nodes with one vote each and expected "
-				   "votes of 1 (node_count=%d vote_sum=%d)",
-				   node_count, vote_sum);
-			write_cman_pipe("two_node set but there are more than 2 nodes");
-			error = -EINVAL;
-			goto out;
-		}
-
-		if (votes != 1) {
-			log_printf(LOG_ERR, "the two-node option requires exactly two "
-				   "nodes with one vote each and expected "
-				   "votes of 1 (votes=%d)", votes);
-			write_cman_pipe("two_node set but votes not set to 1");
-			error = -EINVAL;
-			goto out;
-		}
-	}
-
-	error = 0;
-
-out:
-	return error;
-}
-
-
-
-/* Read the stuff we need to get started.
-   This does what 'cman_tool join' used to to */
-int read_cman_config(struct corosync_api_v1 *corosync, unsigned int *config_version)
-{
-	int error;
-
-	read_cman_nodes(corosync, config_version, 1);
-	error = get_cman_join_info(corosync);
-	if (error) {
-		log_printf(LOG_ERR, "Error reading configuration, cannot start");
-		return error;
-	}
-
-	error = join(corosync);
-
-	return error;
-}
diff --git a/cman/daemon/cmanconfig.h b/cman/daemon/cmanconfig.h
deleted file mode 100644
index 2d66add..0000000
--- a/cman/daemon/cmanconfig.h
+++ /dev/null
@@ -1,3 +0,0 @@
-int read_cman_nodes(struct corosync_api_v1 *api, unsigned int *config_version, int check_nodeids);
-int read_cman_config(struct corosync_api_v1 *api, unsigned int *config_version);
-
diff --git a/cman/daemon/cnxman-private.h b/cman/daemon/cnxman-private.h
deleted file mode 100644
index 002480d..0000000
--- a/cman/daemon/cnxman-private.h
+++ /dev/null
@@ -1,183 +0,0 @@
-#ifndef __CNXMAN_PRIVATE_H
-#define __CNXMAN_PRIVATE_H
-
-/* Protocol Version triplet */
-#define CNXMAN_MAJOR_VERSION 6
-#define CNXMAN_MINOR_VERSION 2
-#define CNXMAN_PATCH_VERSION 0
-
-struct cman_timer
-{
-	struct list list;
-	struct timeval tv;
-	int active;
-	void (*callback)(void *arg);
-	void *arg;
-};
-
-/* A cluster internal protocol message - port number 0 */
-struct cl_protmsg {
-	unsigned char cmd;
-};
-
-
-/* A Cluster PORT OPENED/CLOSED message */
-struct cl_portmsg {
-	unsigned char cmd;	/* CLUSTER_CMD_PORTOPENED/CLOSED */
-	unsigned char port;
-};
-
-/* Subcommands for BARRIER message */
-#define BARRIER_REGISTER 1
-#define BARRIER_CHANGE   2
-#define BARRIER_WAIT     4
-#define BARRIER_COMPLETE 5
-
-/* A Cluster BARRIER message */
-struct cl_barriermsg {
-	unsigned char  cmd;	/* CLUSTER_CMD_BARRIER */
-	unsigned char  subcmd;	/* BARRIER sub command */
-	unsigned short pad;
-
-	char name[MAX_BARRIER_NAME_LEN];
-};
-
-struct cl_transmsg {
-	unsigned char cmd;
-	unsigned char first_trans;
-	uint16_t cluster_id;
-	int votes;
-	int expected_votes;
-
-	unsigned int   major_version;	/* Not backwards compatible */
-	unsigned int   minor_version;	/* Backwards compatible */
-	unsigned int   patch_version;	/* Backwards/forwards compatible */
-	unsigned int   config_version;
-	unsigned int   flags;
-	uint64_t       fence_time;
-	uint64_t       join_time;
-        char           clustername[16];
-	char           fence_agent[];
-};
-
-struct cl_killmsg {
-	unsigned char cmd;
-	unsigned char pad1;
-	uint16_t reason;
-	int nodeid;
-};
-
-struct cl_leavemsg {
-	unsigned char cmd;
-	unsigned char pad1;
-	uint16_t reason;
-};
-
-
-/* Reconfigure a cluster parameter */
-struct cl_reconfig_msg {
-	unsigned char  cmd;
-	unsigned char  param;
-	unsigned short pad;
-	int            nodeid;
-	unsigned int   value;
-};
-
-struct cl_fencemsg {
-	unsigned char cmd;
-	unsigned char fenced;
-	uint16_t      pad;
-	int           nodeid;
-	uint64_t      timesec;
-	char          agent[0];
-};
-
-typedef enum {CON_COMMS, CON_CLIENT_RENDEZVOUS, CON_ADMIN_RENDEZVOUS,
-	      CON_CLIENT, CON_ADMIN} con_type_t;
-
-/* One of these for every connection we have open
-   and need to select() on */
-struct connection
-{
-	int fd;
-	con_type_t type;
-	uint32_t   port;        /* If bound client */
-	enum {SHUTDOWN_REPLY_UNK=0, SHUTDOWN_REPLY_YES, SHUTDOWN_REPLY_NO} shutdown_reply;
-	uint32_t   events;      /* Registered for events */
-	uint32_t   confchg;     /* Registered for confchg */
-	struct list write_msgs; /* Queued messages to go to data clients */
-	uint32_t    num_write_msgs; /* Count of messages */
-	struct connection *next;
-	struct list list;       /* when on the client_list */
-};
-
-/* Parameters for RECONFIG command */
-#define RECONFIG_PARAM_EXPECTED_VOTES 1
-#define RECONFIG_PARAM_NODE_VOTES     2
-#define RECONFIG_PARAM_CONFIG_VERSION 3
-#define RECONFIG_PARAM_CCS            4
-
-/* NODE_FLAGS_BEENDOWN       - This node has been down.
-   NODE_FLAGS_FENCED         - This node has been fenced since it last went down.
-   NODE_FLAGS_FENCEDWHILEUP  - This node was fenced manually (probably).
-   NODE_FLAGS_SEESDISALLOWED - Only set in a transition message
-   NODE_FLAGS_DIRTY          - This node has internal state and must not join
-                               a cluster that also has state.
-   NODE_FLAGS_REREAD	     - Set when the node is re-read from config, so
-                               we can spot deleted nodes
-*/
-#define NODE_FLAGS_BEENDOWN           1
-#define NODE_FLAGS_FENCED             2
-#define NODE_FLAGS_FENCEDWHILEUP      4
-#define NODE_FLAGS_SEESDISALLOWED     8
-#define NODE_FLAGS_DIRTY             16
-#define NODE_FLAGS_REREAD            32
-
-/* There's one of these for each node in the cluster */
-struct cluster_node {
-	struct list list;
-	char *name;		/* Node/host name of node */
-	struct list addr_list;
-	int us;			/* This node is us */
-	unsigned int node_id;	/* Unique node ID */
-	int flags;
-	nodestate_t state;
-	struct timeval join_time;
-
-	/* When & how this node was last fenced */
-	uint64_t fence_time; /* A time_t */
-	char    *fence_agent;
-
-	uint64_t cman_join_time; /* A time_t */
-
-	struct timeval last_hello; /* Only used for quorum devices */
-
-	unsigned int votes;
-	unsigned int expected_votes;
-	unsigned int leave_reason;
-	uint64_t     incarnation;
-
-	/* 32 bytes gives us enough for 256 bits (8 bit port number) */
-#define PORT_BITS_SIZE 32
- 	unsigned char port_bits[PORT_BITS_SIZE]; /* bitmap of ports open on this node */
-};
-
-/* Cluster protocol commands sent to port 0 */
-#define CLUSTER_MSG_ACK          1
-#define CLUSTER_MSG_PORTOPENED   2
-#define CLUSTER_MSG_PORTCLOSED   3
-#define CLUSTER_MSG_BARRIER      4
-#define CLUSTER_MSG_TRANSITION   5
-#define CLUSTER_MSG_KILLNODE     6
-#define CLUSTER_MSG_LEAVE        7
-#define CLUSTER_MSG_RECONFIGURE  8
-#define CLUSTER_MSG_PORTENQ      9
-#define CLUSTER_MSG_PORTSTATUS  10
-#define CLUSTER_MSG_FENCESTATUS 11
-
-/* Kill reasons */
-#define CLUSTER_KILL_REJECTED   1
-#define CLUSTER_KILL_CMANTOOL   2
-#define CLUSTER_KILL_REJOIN     3
-
-#endif
diff --git a/cman/daemon/cnxman-socket.h b/cman/daemon/cnxman-socket.h
deleted file mode 100644
index 798fa02..0000000
--- a/cman/daemon/cnxman-socket.h
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * CMAN socket interface header
- * Should only be used by libcman - if you want to call CMAN then use the library!
- */
-
-#ifndef __CNXMAN_SOCKET_H
-#define __CNXMAN_SOCKET_H
-
-/*
- * Commands on the socket.
- * if the top bit is set then it is only allowed
- * on the ADMIN socket.
- */
-#define CMAN_CMD_NOTIFY             0x00000001
-#define CMAN_CMD_REMOVENOTIFY       0x00000002
-#define CMAN_CMD_SETEXPECTED_VOTES  0x80000004
-#define CMAN_CMD_ISQUORATE          0x00000005
-#define CMAN_CMD_ISLISTENING        0x00000006
-#define CMAN_CMD_GETALLMEMBERS      0x00000007
-#define CMAN_CMD_SET_VOTES          0x80000008
-#define CMAN_CMD_GET_VERSION        0x00000009
-#define CMAN_CMD_SET_VERSION        0x8000000a
-#define CMAN_CMD_ISACTIVE           0x0000000b
-#define CMAN_CMD_KILLNODE           0x8000000c
-#define CMAN_CMD_GET_JOINCOUNT      0x0000000d
-#define CMAN_CMD_GETNODECOUNT       0x0000000e
-#define CMAN_CMD_GETNODE	    0x00000090
-#define CMAN_CMD_GETCLUSTER	    0x00000091
-#define CMAN_CMD_GETEXTRAINFO	    0x00000092
-#define CMAN_CMD_BARRIER            0x000000a0
-#define CMAN_CMD_LEAVE_CLUSTER      0x800000b4
-#define CMAN_CMD_REG_QUORUMDEV      0x800000b5
-#define CMAN_CMD_UNREG_QUORUMDEV    0x800000b6
-#define CMAN_CMD_POLL_QUORUMDEV     0x800000b7
-#define CMAN_CMD_TRY_SHUTDOWN       0x800000bb
-#define CMAN_CMD_SHUTDOWN_REPLY     0x000000bc
-#define CMAN_CMD_UPDATE_FENCE_INFO  0x800000bd
-#define CMAN_CMD_GET_FENCE_INFO     0x000000be
-#define CMAN_CMD_GET_NODEADDRS      0x000000bf
-#define CMAN_CMD_START_CONFCHG      0x000000c0
-#define CMAN_CMD_STOP_CONFCHG       0x000000c1
-#define CMAN_CMD_SET_DIRTY          0x800000c2
-#define CMAN_CMD_SET_DEBUGLOG       0x800000c3
-#define CMAN_CMD_DUMP_OBJDB         0x800000c4
-
-#define CMAN_CMD_DATA               0x00000100
-#define CMAN_CMD_BIND               0x00000101
-#define CMAN_CMD_EVENT              0x00000102
-#define CMAN_CMD_CONFCHG            0x00000103
-
-#define CMAN_CMDFLAG_PRIV           0x80000000
-#define CMAN_CMDFLAG_REPLY          0x40000000
-#define CMAN_CMDMASK_CMD            0x0000FFFF
-
-
-/* Maximum size of a cluster message */
-#define MAX_CLUSTER_MESSAGE          1500
-#define MAX_CLUSTER_MEMBER_NAME_LEN   255
-#define MAX_BARRIER_NAME_LEN           33
-#define MAX_CLUSTER_NAME_LEN           16
-#define MAX_FENCE_AGENT_NAME_LEN      255
-
-/* Well-known cluster port numbers */
-#define CLUSTER_PORT_MEMBERSHIP  1	/* Mustn't block during cluster
-					 * transitions! */
-#define CLUSTER_PORT_SERVICES    2
-#define CLUSTER_PORT_SYSMAN      10	/* Remote execution daemon */
-#define CLUSTER_PORT_CLVMD       11	/* Cluster LVM daemon */
-
-/* Port numbers above this will be blocked when the cluster is inquorate or in
- * transition */
-#define HIGH_PROTECTED_PORT      9
-
-/* Nodeid passed to CMD_GETNODE to return the quorum device info */
-#define CLUSTER_GETNODE_QUORUMDEV -1
-
-/* Reasons for leaving the cluster */
-#define CLUSTER_LEAVEFLAG_DOWN     0	/* Normal shutdown */
-#define CLUSTER_LEAVEFLAG_KILLED   1
-#define CLUSTER_LEAVEFLAG_PANIC    2
-#define CLUSTER_LEAVEFLAG_REMOVED  3	/* This one can reduce quorum */
-#define CLUSTER_LEAVEFLAG_REJECTED 4	/* Not allowed into the cluster in the
-					 * first place */
-#define CLUSTER_LEAVEFLAG_INCONSISTENT 5	/* Our view of the cluster is
-						 * in a minority */
-#define CLUSTER_LEAVEFLAG_DEAD         6	/* Discovered to be dead */
-#define CLUSTER_LEAVEFLAG_NORESPONSE   7        /* Didn't ACK message */
-#define CLUSTER_LEAVEFLAG_FORCE     0x10	/* Forced by command-line */
-
-/* CMAN_CMD_EVENT reason codes */
-#define EVENT_REASON_PORTCLOSED   0
-#define EVENT_REASON_STATECHANGE  1
-#define EVENT_REASON_PORTOPENED   2
-#define EVENT_REASON_TRY_SHUTDOWN 3
-#define EVENT_REASON_CONFIG_UPDATE 4
-
-/* Shutdown flags */
-#define SHUTDOWN_ANYWAY           1
-#define SHUTDOWN_REMOVE           2
-
-/*
- * Sendmsg flags, these are above the normal sendmsg flags so they don't
- * interfere
- */
-#define MSG_TOTEM_AGREED 0x1000000
-#define MSG_TOTEM_SAFE   0x2000000
-#define MSG_BCASTSELF    0x4000000
-
-typedef enum { NODESTATE_JOINING=1, NODESTATE_MEMBER,
-	       NODESTATE_DEAD, NODESTATE_LEAVING, NODESTATE_AISONLY } nodestate_t;
-
-static const char CLIENT_SOCKNAME[]= "/var/run/cman_client";
-static const char ADMIN_SOCKNAME[]=  "/var/run/cman_admin";
-
-/* This struct should be in front of all messages
- * passed down the client and admin sockets.
- */
-#define CMAN_MAGIC 0x434d414e
-#define CMAN_VERSION 0x10000003
-struct sock_header {
-	uint32_t magic;
-	uint32_t version;
-	uint32_t length;
-	uint32_t command;
-	uint32_t flags;
-};
-
-/* Data message header */
-struct sock_data_header {
-	struct sock_header header;
-	int nodeid;
-	uint32_t port;
-	/* Data follows */
-};
-
-/* Reply message */
-struct sock_reply_header {
-	struct sock_header header;
-	int status;
-	/* Any returned information follows */
-};
-
-/* Event message */
-struct sock_event_message {
-	struct sock_header header;
-	int reason;
-	int arg;
-};
-
-/* confchg message */
-struct sock_confchg_message {
-	struct sock_header header;
-	int member_entries;
-	int left_entries;
-	int joined_entries;
-	unsigned int entries[]; // In above order.
-};
-
-/* Flags */
-#define CMAN_EXTRA_FLAG_2NODE     1
-#define CMAN_EXTRA_FLAG_ERROR     2
-#define CMAN_EXTRA_FLAG_SHUTDOWN  4
-#define CMAN_EXTRA_FLAG_UNCOUNTED 8
-#define CMAN_EXTRA_FLAG_DIRTY    16
-
-struct cl_extra_info {
-	int           node_state;
-	uint32_t      flags;
-	int           node_votes;
-	int           total_votes;
-	int           expected_votes;
-	int           quorum;
-	int           members;
-	char          ports[32];
-	int           num_addresses; /* Number of real addresses, so the array below has
-					<n>*2 addresses in it */
-	char          addresses[1];  /* Array of num_addresses sockaddr_storage
-					1st n are multicast addresses */
-};
-
-/* This is the structure, per node, returned from the membership call */
-struct cl_cluster_node {
-	unsigned int size;
-	unsigned int node_id;
-	unsigned int us;
-	unsigned int leave_reason;
-	unsigned int incarnation;
-	nodestate_t state;
-	char name[MAX_CLUSTER_MEMBER_NAME_LEN];
-	char addr[sizeof(struct sockaddr_storage)];
-	unsigned int addrlen;
-	struct timeval jointime;
-	unsigned char votes;
-};
-
-/* Structure passed to CMAN_CMD_ISLISTENING */
-struct cl_listen_request {
-	unsigned char port;
-        int           nodeid;
-};
-
-/* Get all version numbers or set the config version */
-struct cl_version {
-	unsigned int major;
-	unsigned int minor;
-	unsigned int patch;
-	unsigned int config;
-};
-
-/* structure passed to barrier command */
-struct cl_barrier_info {
-	char cmd;
-	char name[MAX_BARRIER_NAME_LEN];
-	unsigned int flags;
-	unsigned long arg;
-};
-
-struct cl_cluster_info {
-	char name[MAX_CLUSTER_NAME_LEN+1];
-	uint16_t number;
-	uint32_t generation;
-};
-
-struct cl_set_votes {
-	int nodeid;
-	int newvotes;
-};
-
-/* An array of these is returned */
-struct cl_node_addrs {
-	int addrlen;
-	struct sockaddr_storage addr;
-};
-
-struct cl_get_node_addrs {
-	int numaddrs;
-	struct cl_node_addrs addrs[];
-};
-
-#define FENCE_FLAGS_FENCED 2
-struct cl_fence_info {
-	int nodeid;
-	int flags;
-	uint64_t fence_time;
-	char fence_agent[MAX_FENCE_AGENT_NAME_LEN];
-};
-
-struct cl_qdev_info {
-	char name[MAX_CLUSTER_MEMBER_NAME_LEN];
-	int state;
-	int votes;
-};
-
-/* Commands to the barrier cmd */
-#define BARRIER_CMD_REGISTER 1
-#define BARRIER_CMD_CHANGE   2
-#define BARRIER_CMD_DELETE   3
-#define BARRIER_CMD_WAIT     4
-
-/* Attributes of a barrier - bitmask */
-#define BARRIER_ATTR_AUTODELETE 1
-#define BARRIER_ATTR_MULTISTEP  2
-#define BARRIER_ATTR_MANUAL     4
-#define BARRIER_ATTR_ENABLED    8
-#define BARRIER_ATTR_CALLBACK  16
-
-/* Attribute setting commands */
-#define BARRIER_SETATTR_AUTODELETE 1
-#define BARRIER_SETATTR_MULTISTEP  2
-#define BARRIER_SETATTR_ENABLED    3
-#define BARRIER_SETATTR_NODES      4
-#define BARRIER_SETATTR_CALLBACK   5
-#define BARRIER_SETATTR_TIMEOUT    6
-
-#endif
diff --git a/cman/daemon/commands.c b/cman/daemon/commands.c
deleted file mode 100644
index 34af7de..0000000
--- a/cman/daemon/commands.c
+++ /dev/null
@@ -1,2232 +0,0 @@
-#include <getopt.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <inttypes.h>
-#include <syslog.h>
-#include <string.h>
-#include <time.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/utsname.h>
-#include <sys/un.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
-#include <sys/signal.h>
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <sys/errno.h>
-#include <dlfcn.h>
-
-#include <corosync/ipc_gen.h>
-#include <corosync/engine/coroapi.h>
-#include <corosync/engine/logsys.h>
-#include "list.h"
-#include "cman.h"
-#include "cnxman-socket.h"
-#include "cnxman-private.h"
-#include "daemon.h"
-#include "barrier.h"
-#include "logging.h"
-#define OBJDB_API struct corosync_api_v1
-#include "cmanconfig.h"
-#include "nodelist.h"
-#include "commands.h"
-#include "ais.h"
-
-#define max(a,b) (((a) > (b)) ? (a) : (b))
-LOGSYS_DECLARE_SUBSYS (CMAN_NAME, LOG_INFO);
-
-/* Reference counting for cluster applications */
-static int use_count;
-
-/* Array of "ports" allocated. This is just a list of pointers to the connection that
- * has this port bound. Port 0 is reserved for protocol messages */
-static struct connection *port_array[256];
-
-// Stuff that was more global
-static LIST_INIT(cluster_members_list);
-       int cluster_members;
-       int we_are_a_cluster_member;
-       unsigned int config_version;
-static struct cluster_node *us;
-static int quorum;
-extern int two_node;
-       unsigned int quorumdev_poll=DEFAULT_QUORUMDEV_POLL;
-       unsigned int shutdown_timeout=DEFAULT_SHUTDOWN_TIMEOUT;
-       unsigned int ccsd_poll_interval=DEFAULT_CCSD_POLL;
-static int cluster_is_quorate;
-       char cluster_name[MAX_CLUSTER_NAME_LEN+1];
-static char nodename[MAX_CLUSTER_MEMBER_NAME_LEN+1];
-static int wanted_nodeid;
-static struct cluster_node *quorum_device;
-static uint16_t cluster_id;
-static int ais_running;
-static time_t join_time;
-static corosync_timer_handle_t quorum_device_timer;
-static struct corosync_api_v1 *corosync;
-
-/* If CCS gets out of sync, we poll it until it isn't */
-static corosync_timer_handle_t ccsd_timer;
-static unsigned int wanted_config_version;
-static int config_error;
-
-static corosync_timer_handle_t shutdown_timer;
-static struct connection *shutdown_con;
-static uint32_t shutdown_flags;
-static int shutdown_yes;
-static int shutdown_no;
-static int shutdown_expected;
-
-static struct cluster_node *find_node_by_nodeid(int nodeid);
-static struct cluster_node *find_node_by_name(char *name);
-static int get_node_count(void);
-static int get_highest_nodeid(void);
-static int send_port_open_msg(unsigned char port);
-static int send_port_enquire(int nodeid);
-static void process_internal_message(char *data, int nodeid, int byteswap);
-static void recalculate_quorum(int allow_decrease, int by_current_nodes);
-static void send_kill(int nodeid, uint16_t reason);
-static char *killmsg_reason(int reason);
-static void ccsd_timer_fn(void *arg);
-
-
-static void set_port_bit(struct cluster_node *node, uint8_t port)
-{
-	int byte;
-	int bit;
-
-	byte = port/8;
-	bit  = port%8;
-
-	node->port_bits[byte] |= 1<<bit;
-}
-
-static void clear_port_bit(struct cluster_node *node, uint8_t port)
-{
-	int byte;
-	int bit;
-
-	byte = port/8;
-	bit  = port%8;
-
-	node->port_bits[byte] &= ~(1<<bit);
-}
-
-static int get_port_bit(struct cluster_node *node, uint8_t port)
-{
-	int byte;
-	int bit;
-
-	byte = port/8;
-	bit  = port%8;
-
-	return ((node->port_bits[byte] & (1<<bit)) != 0);
-}
-
-static int have_disallowed(void)
-{
-	struct cluster_node *node;
-
-	list_iterate_items(node, &cluster_members_list) {
-		if (node->state == NODESTATE_AISONLY)
-			return 1;
-	}
-
-	return 0;
-}
-
-/* Make a totem_ip_address into a usable sockaddr_storage */
-static int totemip_to_sockaddr(struct totem_ip_address *ip_addr,
-			       uint16_t port, struct sockaddr_storage *saddr, int *addrlen)
-{
-	int ret = -1;
-
-	if (ip_addr->family == AF_INET) {
-		struct sockaddr_in *sin = (struct sockaddr_in *)saddr;
-
-		memset(sin, 0, sizeof(struct sockaddr_in));
-		sin->sin_family = ip_addr->family;
-		sin->sin_port = port;
-		memcpy(&sin->sin_addr, ip_addr->addr, sizeof(struct in_addr));
-		*addrlen = sizeof(struct sockaddr_in);
-		ret = 0;
-	}
-
-	if (ip_addr->family == AF_INET6) {
-		struct sockaddr_in6 *sin = (struct sockaddr_in6 *)saddr;
-
-		memset(sin, 0, sizeof(struct sockaddr_in6));
-		sin->sin6_family = ip_addr->family;
-		sin->sin6_port = port;
-		sin->sin6_scope_id = 2;
-		memcpy(&sin->sin6_addr, ip_addr->addr, sizeof(struct in6_addr));
-
-		*addrlen = sizeof(struct sockaddr_in6);
-		ret = 0;
-	}
-
-	return ret;
-}
-
-/* If "cluster_is_quorate" is 0 then all activity apart from protected ports is
- * blocked. */
-static void set_quorate(int total_votes)
-{
-	int quorate;
-	unsigned int nodelist[PROCESSOR_COUNT_MAX];
-	int nodecount = 0;
-	struct cluster_node *node = NULL;
-	struct list *tmp;
-
-	if (quorum > total_votes || config_error) {
-		quorate = 0;
-	}
-	else {
-		quorate = 1;
-	}
-
-	if (cluster_is_quorate && !quorate)
-		log_printf(LOG_INFO, "quorum lost, blocking activity\n");
-	if (!cluster_is_quorate && quorate)
-		log_printf(LOG_INFO, "quorum regained, resuming activity\n");
-
-	/* If we are newly quorate, then kill any AISONLY nodes */
-	if (!cluster_is_quorate && quorate) {
-
-		list_iterate(tmp, &cluster_members_list) {
-			node = list_item(tmp, struct cluster_node);
-			if (node->state == NODESTATE_AISONLY)
-				send_kill(node->node_id, CLUSTER_KILL_REJOIN);
-		}
-	}
-
-	cluster_is_quorate = quorate;
-
-	/* Inform corosync subsystems */
-	list_iterate(tmp, &cluster_members_list) {
-		node = list_item(tmp, struct cluster_node);
-		if (node->state == NODESTATE_MEMBER) {
-			nodelist[nodecount++] = node->node_id;
-		}
-	}
-
-	corosync_set_quorum(nodelist, nodecount, quorate, &cman_ring_id);
-}
-
-static void node_add_ordered(struct cluster_node *newnode)
-{
-	struct cluster_node *node = NULL;
-	struct list *tmp;
-	struct list *newlist = &newnode->list;
-
-	list_iterate(tmp, &cluster_members_list) {
-		node = list_item(tmp, struct cluster_node);
-
-                if (newnode->node_id < node->node_id)
-                        break;
-        }
-
-        if (!node)
-		list_add(&cluster_members_list, &newnode->list);
-        else {
-                newlist->p = tmp->p;
-                newlist->n = tmp;
-                tmp->p->n = newlist;
-                tmp->p = newlist;
-        }
-}
-
-static struct cluster_node *add_new_node(char *name, int nodeid, int votes, int expected_votes,
-					 nodestate_t state)
-{
-	struct cluster_node *newnode = NULL;
-	int newalloc = 0;
-
-	if (nodeid)
-		newnode = find_node_by_nodeid(nodeid);
-
-	if (!newnode) {
-		newnode = malloc(sizeof(struct cluster_node));
-		if (!newnode) {
-			log_printf(LOG_ERR, "Unable to allocate memory for node %s\n", name);
-			return NULL;
-		}
-		memset(newnode, 0, sizeof(struct cluster_node));
-		newalloc = 1;
-		newnode->state = state;
-		if (state == NODESTATE_MEMBER)
-			newnode->incarnation = incarnation;
-	}
-	if (!newnode->name) {
-		newnode->name = malloc(strlen(name)+1);
-		if (!newnode->name) {
-			if (newalloc)
-				free(newnode);
-			return NULL;
-		}
-		strcpy(newnode->name, name);
-	}
-
-	if (!newnode->node_id) /* Don't clobber existing nodeid */
-		newnode->node_id = nodeid;
-	if (votes >= 0)
-		newnode->votes = votes;
-	if (expected_votes)
-		newnode->expected_votes = expected_votes;
-
-	/* If this node has a name passed in then use that rather than a previous generated one */
-	if (name && newnode->name && strcmp(name, newnode->name)) {
-		char *newname;
-
-		newname = strdup(name);
-		if (newname) {
-			P_MEMB("replacing old node name %s with %s\n", newnode->name, name);
-			free(newnode->name);
-			newnode->name = newname;
-		}
-	}
-
-	if (newalloc)
-		node_add_ordered(newnode);
-
-	newnode->flags |= NODE_FLAGS_REREAD;
-
-	P_MEMB("add_new_node: %s, (id=%d, votes=%d) newalloc=%d\n",
-	       name, nodeid, votes, newalloc);
-
-	return newnode;
-}
-
-static void send_reconfigure(int nodeid, int param, int value)
-{
-	struct cl_reconfig_msg msg;
-
-	msg.cmd = CLUSTER_MSG_RECONFIGURE;
-	msg.param = param;
-	msg.nodeid = nodeid;
-	msg.value = value;
-
-	comms_send_message((char *)&msg, sizeof(msg),
-			   0,0,
-			   0,  /* multicast */
-			   0); /* flags */
-}
-
-static int calculate_quorum(int allow_decrease, int max_expected, unsigned int *ret_total_votes)
-{
-	struct list *nodelist;
-	struct cluster_node *node;
-	unsigned int total_votes = 0;
-	unsigned int highest_expected = 0;
-	unsigned int newquorum, q1, q2;
-	unsigned int total_nodes = 0;
-
-	list_iterate(nodelist, &cluster_members_list) {
-		node = list_item(nodelist, struct cluster_node);
-
-		if (node->state == NODESTATE_MEMBER) {
-			if (max_expected)
-				node->expected_votes = max_expected;
-			else
-				highest_expected = max(highest_expected, node->expected_votes);
-			total_votes += node->votes;
-			total_nodes++;
-		}
-	}
-	if (quorum_device && quorum_device->state == NODESTATE_MEMBER)
-		total_votes += quorum_device->votes;
-
-	if (max_expected > 0)
-		highest_expected = max_expected;
-
-	/* This quorum calculation is taken from the OpenVMS Cluster Systems
-	 * manual, but, then, you guessed that didn't you */
-	q1 = (highest_expected + 2) / 2;
-	q2 = (total_votes + 2) / 2;
-	newquorum = max(q1, q2);
-
-	/* Normally quorum never decreases but the system administrator can
-	 * force it down by setting expected votes to a maximum value */
-	if (!allow_decrease)
-		newquorum = max(quorum, newquorum);
-
-	/* The special two_node mode allows each of the two nodes to retain
-	 * quorum if the other fails.  Only one of the two should live past
-	 * fencing (as both nodes try to fence each other in split-brain.)
-	 * Also: if there are more than two nodes, force us inquorate to avoid
-	 * any damage or confusion.
-	 */
-	if (two_node && total_nodes <= 2)
-		newquorum = 1;
-
-	if (ret_total_votes)
-		*ret_total_votes = total_votes;
-	return newquorum;
-}
-
-/* Recalculate cluster quorum, set quorate and notify changes */
-static void recalculate_quorum(int allow_decrease, int by_current_nodes)
-{
-	unsigned int total_votes;
-
-	quorum = calculate_quorum(allow_decrease, by_current_nodes?cluster_members:0, &total_votes);
-	set_quorate(total_votes);
-	notify_listeners(NULL, EVENT_REASON_STATECHANGE, cluster_is_quorate);
-}
-
-/* Copy internal node format to userland format */
-static void copy_to_usernode(struct cluster_node *node,
-			     struct cl_cluster_node *unode)
-{
-	struct sockaddr_storage ss;
-	int addrlen=0;
-	unsigned int numaddrs=1;
-	char **status;
-	struct totem_ip_address node_ifs[INTERFACE_MAX];
-	/* totempg_ifaces_get always copies INTERFACE_MAX addresses */
-
-	strcpy(unode->name, node->name);
-	unode->jointime = node->join_time;
-	unode->size = sizeof(struct cl_cluster_node);
-	unode->votes = node->votes;
-	unode->state = node->state;
-	unode->us = node->us;
-	unode->node_id = node->node_id;
-	unode->leave_reason = node->leave_reason;
-	unode->incarnation = node->incarnation;
-
-	/* Just send the first address. If the user wants the full set they
-	   must ask for them */
-	corosync->totem_ifaces_get(node->node_id, node_ifs, &status, &numaddrs);
-
-	totemip_to_sockaddr(&node_ifs[0], 0, &ss, &addrlen);
-	memcpy(unode->addr, &ss, addrlen);
-	unode->addrlen = addrlen;
-}
-
-
-int cman_set_nodename(char *name)
-{
-	if (ais_running)
-		return -EALREADY;
-
-	strncpy(nodename, name, MAX_CLUSTER_MEMBER_NAME_LEN);
-	return 0;
-}
-
-int cman_set_nodeid(int nodeid)
-{
-	if (ais_running)
-		return -EALREADY;
-
-	wanted_nodeid = nodeid;
-	return 0;
-}
-
-int cman_join_cluster(struct corosync_api_v1 *api,
-		      char *name, unsigned short cl_id,
-		      int two_node_flag, int votes, int expected_votes)
-{
-	if (ais_running)
-		return -EALREADY;
-
-	if (strlen(name) > MAX_CLUSTER_NAME_LEN)
-		return -EINVAL;
-
-	cluster_id = cl_id;
-	strncpy(cluster_name, name, MAX_CLUSTER_NAME_LEN);
-	two_node = two_node_flag;
-	corosync = api;
-
-	quit_threads = 0;
-	ais_running = 1;
-
-	/* Make sure we have a node name */
-	if (nodename[0] == '\0') {
-		struct utsname un;
-		uname(&un);
-		strcpy(nodename, un.nodename);
-	}
-
-	time(&join_time);
-	us = add_new_node(nodename, wanted_nodeid, votes, expected_votes,
-			  NODESTATE_DEAD);
-	set_port_bit(us, 0);
-	us->us = 1;
-
-	return 0;
-}
-
-/* command processing functions */
-
-static int do_cmd_set_version(char *cmdbuf, int *retlen)
-{
-	struct cl_version *version = (struct cl_version *)cmdbuf;
-
-	if (!we_are_a_cluster_member)
-		return -ENOENT;
-
-	if (version->major != CNXMAN_MAJOR_VERSION ||
-	    version->minor != CNXMAN_MINOR_VERSION ||
-	    version->patch != CNXMAN_PATCH_VERSION)
-		return -EINVAL;
-
-	if (config_version == version->config)
-		return 0;
-
-	/* We will re-read CCS when we get our own message back */
-	send_reconfigure(us->node_id, RECONFIG_PARAM_CONFIG_VERSION, version->config);
-	return 0;
-}
-
-static int do_cmd_get_extrainfo(char *cmdbuf, char **retbuf, int retsize, int *retlen, int offset)
-{
-	char *outbuf = *retbuf + offset;
-	struct cl_extra_info *einfo = (struct cl_extra_info *)outbuf;
-	struct totem_ip_address node_ifs[MAX_INTERFACES];
-	int total_votes = 0;
-	int max_expected = 0;
-	int addrlen;
-	int uncounted = 0;
-	unsigned int num_interfaces;
-	unsigned int totem_object_handle;
-	unsigned int object_handle;
-	unsigned int totem_find_handle;
-	unsigned int iface_find_handle;
-	char **status;
-	struct cluster_node *node;
-	struct sockaddr_storage *ss;
-	char *ptr;
-	int i;
-
-	if (!we_are_a_cluster_member)
-		return -ENOENT;
-
-	corosync->totem_ifaces_get(us->node_id, node_ifs, &status, &num_interfaces);
-
-	list_iterate_items(node, &cluster_members_list) {
-		if (node->state == NODESTATE_MEMBER) {
-			total_votes += node->votes;
-			max_expected = max(max_expected, node->expected_votes);
-		}
-		if (node->state == NODESTATE_AISONLY)
-			uncounted = 1;
-	}
-	if (quorum_device && quorum_device->state == NODESTATE_MEMBER)
-		total_votes += quorum_device->votes;
-
-        /* Enough room for addresses ? */
-	if (retsize < (sizeof(struct cl_extra_info) +
-		       sizeof(struct sockaddr_storage) * (MAX_INTERFACES*2))) {
-
-		*retbuf = malloc(sizeof(struct cl_extra_info) + sizeof(struct sockaddr_storage) * (MAX_INTERFACES*2));
-		outbuf = *retbuf + offset;
-		einfo = (struct cl_extra_info *)outbuf;
-
-		P_MEMB("get_extrainfo: allocated new buffer\n");
-	}
-
-	einfo->node_state = us->state;
-	einfo->node_votes = us->votes;
-	einfo->total_votes = total_votes;
-	einfo->expected_votes = max_expected;
-	einfo->quorum = quorum;
-	einfo->members = cluster_members;
-	einfo->num_addresses = num_interfaces;
-	memcpy(einfo->ports, us->port_bits, 32);
-	einfo->flags = 0;
-	if (two_node)
-		einfo->flags |= CMAN_EXTRA_FLAG_2NODE;
-	if (config_error)
-		einfo->flags |= CMAN_EXTRA_FLAG_ERROR;
-	if (shutdown_con)
-		einfo->flags |= CMAN_EXTRA_FLAG_SHUTDOWN;
-	if (uncounted)
-		einfo->flags |= CMAN_EXTRA_FLAG_UNCOUNTED;
-	if (us->flags & NODE_FLAGS_DIRTY)
-		einfo->flags |= CMAN_EXTRA_FLAG_DIRTY;
-
-	ptr = einfo->addresses;
-
-	corosync->object_find_create(OBJECT_PARENT_HANDLE, "totem", strlen("totem"), &totem_find_handle);
-	if (corosync->object_find_next(totem_find_handle, &totem_object_handle) == 0) {
-
-		corosync->object_find_destroy(totem_find_handle);
-
-		corosync->object_find_create(totem_object_handle, "interface", strlen("interface"), &iface_find_handle);
-		while (corosync->object_find_next(iface_find_handle, &object_handle) == 0) {
-
-			char *mcast;
-			struct sockaddr_in *saddr4;
-			struct sockaddr_in6 *saddr6;
-
-			objdb_get_string(corosync, object_handle, "mcastaddr", &mcast);
-			memset(ptr, 0, sizeof(struct sockaddr_storage));
-
-			saddr4 = (struct sockaddr_in *)ptr;
-			saddr6 = (struct sockaddr_in6 *)ptr;
-			if ( inet_pton(AF_INET, mcast, &saddr4->sin_addr) >0) {
-				saddr4->sin_family = AF_INET;
-			}
-			else {
-				if (inet_pton(AF_INET6, mcast, &saddr6->sin6_addr) > 0)
-					saddr4->sin_family = AF_INET6;
-			}
-			ptr += sizeof(struct sockaddr_storage);
-		}
-	}
-	corosync->object_find_destroy(iface_find_handle);
-
-	for (i=0; i<num_interfaces; i++) {
-		ss = (struct sockaddr_storage *)ptr;
-		totemip_to_sockaddr(&node_ifs[i], 0, ss, &addrlen);
-		ptr += sizeof(struct sockaddr_storage);
-	}
-
-	*retlen = ptr - outbuf;
-	return 0;
-}
-
-static int do_cmd_get_all_members(char *cmdbuf, char **retbuf, int retsize, int *retlen, int offset)
-{
-	struct cluster_node *node;
-	struct cl_cluster_node *user_node;
-	struct list *nodelist;
-	char *outbuf = *retbuf + offset;
-	int num_nodes = 0;
-	int total_nodes = 0;
-	int highest_node;
-
-	if (!we_are_a_cluster_member)
-		return -ENOENT;
-
-	highest_node = get_highest_nodeid();
-
-	/* Count nodes */
-	list_iterate(nodelist, &cluster_members_list) {
-		total_nodes++;
-	}
-	if (quorum_device)
-		total_nodes++;
-
-	/* if retsize == 0 then don't return node information */
-	if (retsize) {
-		/* If there is not enough space in the default buffer, allocate some more. */
-		if ((retsize / sizeof(struct cl_cluster_node)) < total_nodes) {
-			*retbuf = malloc(sizeof(struct cl_cluster_node) * total_nodes + offset);
-			outbuf = *retbuf + offset;
-			P_MEMB("get_all_members: allocated new buffer (retsize=%d)\n", retsize);
-		}
-	}
-	user_node = (struct cl_cluster_node *)outbuf;
-
-	/* This returns the full list */
-	list_iterate_items(node, &cluster_members_list) {
-		if (retsize) {
-			copy_to_usernode(node, user_node);
-
-			user_node++;
-			num_nodes++;
-		}
-	}
-
-	if (quorum_device) {
-		copy_to_usernode(quorum_device, user_node);
-		user_node++;
-		num_nodes++;
-	}
-
-	*retlen = sizeof(struct cl_cluster_node) * num_nodes;
-	P_MEMB("get_all_members: retlen = %d\n", *retlen);
-	return num_nodes;
-}
-
-
-static int do_cmd_get_cluster(char *cmdbuf, char *retbuf, int *retlen)
-{
-	struct cl_cluster_info *info = (struct cl_cluster_info *)retbuf;
-
-	info->number = cluster_id;
-	info->generation = incarnation;
-	memcpy(&info->name, cluster_name, strlen(cluster_name)+1);
-	*retlen = sizeof(struct cl_cluster_info);
-
-	return 0;
-}
-
-static int do_cmd_get_node(char *cmdbuf, char *retbuf, int *retlen)
-{
-	struct cluster_node *node;
-	struct cl_cluster_node *u_node = (struct cl_cluster_node *)cmdbuf;
-	struct cl_cluster_node *r_node = (struct cl_cluster_node *)retbuf;
-
-	if (!we_are_a_cluster_member)
-		return -ENOENT;
-
-	if (u_node->node_id == CLUSTER_GETNODE_QUORUMDEV) {
-		if (quorum_device)
-			node = quorum_device;
-		else
-			return -ENOENT;
-	}
-	else {
-		if (!u_node->name[0]) {
-			if (u_node->node_id == 0)
-				u_node->node_id = us->node_id;
-			node = find_node_by_nodeid(u_node->node_id);
-		}
-		else
-			node = find_node_by_name(u_node->name);
-
-		if (!node) {
-			P_MEMB("cmd_get_node failed: id=%d, name='%s'\n", u_node->node_id, u_node->name);
-			return -ENOENT;
-		}
-	}
-
-	copy_to_usernode(node, r_node);
-	*retlen = sizeof(struct cl_cluster_node);
-
-	return 0;
-}
-
-static int do_cmd_set_expected(char *cmdbuf, int *retlen)
-{
-	unsigned int total_votes;
-	unsigned int newquorum;
-	unsigned int newexp;
-	struct cluster_node *node = NULL;
-	struct list *tmp;
-
-	if (!we_are_a_cluster_member)
-		return -ENOENT;
-
-	/* If there are any AISONLY nodes then we can't allow
-	   the user to set expected votes as it may destroy data */
-	list_iterate(tmp, &cluster_members_list) {
-		node = list_item(tmp, struct cluster_node);
-		if (node->state == NODESTATE_AISONLY) {
-			log_printf(LOG_NOTICE, "Attempt to set expected votes when cluster has AISONLY nodes in it.");
-			return -EINVAL;
-		}
-	}
-
-	memcpy(&newexp, cmdbuf, sizeof(int));
-	newquorum = calculate_quorum(1, newexp, &total_votes);
-
-	if (newquorum < total_votes / 2
-	    || newquorum > total_votes) {
-		return -EINVAL;
-	}
-
-	override_expected(newexp);
-	send_reconfigure(us->node_id, RECONFIG_PARAM_EXPECTED_VOTES, newexp);
-
-	/* We will recalculate quorum when we get our own message back */
-	return 0;
-}
-
-static void send_kill(int nodeid, uint16_t reason)
-{
-	struct cl_killmsg msg;
-
-	P_MEMB("Sending KILL to node %d\n", nodeid);
-
-	msg.cmd = CLUSTER_MSG_KILLNODE;
-	msg.reason = reason;
-	msg.nodeid = nodeid;
-
-	comms_send_message((char *)&msg, sizeof(msg),
-			   0,0,
-			   nodeid,
-			   0); /* flags */
-}
-
-static void send_leave(uint16_t reason)
-{
-	struct cl_leavemsg msg;
-
-	P_MEMB("Sending LEAVE, reason %d\n", reason);
-
-	msg.cmd = CLUSTER_MSG_LEAVE;
-	msg.reason = reason;
-
-	comms_send_message((char *)&msg, sizeof(msg),
-			   0,0,
-			   0,  /* multicast */
-			   0); /* flags */
-}
-
-static int do_cmd_kill_node(char *cmdbuf, int *retlen)
-{
-	struct cluster_node *node;
-	int nodeid;
-
-	if (!we_are_a_cluster_member)
-		return -ENOENT;
-
-	memcpy(&nodeid, cmdbuf, sizeof(int));
-
-	if ((node = find_node_by_nodeid(nodeid)) == NULL)
-		return -EINVAL;
-
-	if (node->state != NODESTATE_MEMBER && node->state != NODESTATE_AISONLY)
-		return -EINVAL;
-
-	node->leave_reason = CLUSTER_LEAVEFLAG_KILLED;
-	node->state = NODESTATE_LEAVING;
-
-	/* Send a KILL message */
-	send_kill(nodeid, CLUSTER_KILL_CMANTOOL);
-
-	return 0;
-}
-
-
-static int do_cmd_islistening(struct connection *con, char *cmdbuf, int *retlen)
-{
-	struct cl_listen_request rq;
-	struct cluster_node *rem_node;
-	int nodeid;
-
-	if (!we_are_a_cluster_member)
-		return -ENOENT;
-
-	memcpy(&rq, cmdbuf, sizeof(rq));
-
-	nodeid = rq.nodeid;
-	if (!nodeid)
-		nodeid = us->node_id;
-
-	rem_node = find_node_by_nodeid(nodeid);
-
-	/* Node not in the cluster */
-	if (!rem_node)
-		return -ENOENT;
-
-	if (rem_node->state != NODESTATE_MEMBER)
-		return -ENOTCONN;
-
-	/* If the request is for us then just look in the ports
-	 * array */
-	if (rem_node->us)
-		return (port_array[rq.port] != 0) ? 1 : 0;
-
-
-	/* If we don't know the node's port status then ask it.
-	   This should only need to be done when we are the new node in
-	   a cluster that has been running for a while
-	*/
-       	if (!get_port_bit(rem_node, 0)) {
-		P_MEMB("islistening, no data for node %d, sending PORTENQ\n", nodeid);
-		send_port_enquire(rem_node->node_id);
-
-		/* Admit our ignorance */
-		return -EBUSY;
-	}
-	else {
-		P_MEMB("islistening, for node %d, low bytes are %x %x\n", nodeid, rem_node->port_bits[0], rem_node->port_bits[1]);
-		return get_port_bit(rem_node, rq.port);
-	}
-}
-
-
-static int do_cmd_set_votes(char *cmdbuf, int *retlen)
-{
-	unsigned int total_votes;
-	unsigned int newquorum;
-	int saved_votes;
-	struct cl_set_votes arg;
-	struct cluster_node *node;
-
-	if (!we_are_a_cluster_member)
-		return -ENOTCONN;
-
-	memcpy(&arg, cmdbuf, sizeof(arg));
-
-	if (!arg.nodeid)
-		arg.nodeid = us->node_id;
-
-	P_MEMB("Setting votes for node %d to %d\n", arg.nodeid, arg.newvotes);
-
-	node = find_node_by_nodeid(arg.nodeid);
-	if (!node)
-		return -ENOENT;
-
-	/* Check votes is valid */
-	saved_votes = node->votes;
-	node->votes = arg.newvotes;
-
-	newquorum = calculate_quorum(1, 0, &total_votes);
-
-	if (newquorum < total_votes / 2 || newquorum > total_votes) {
-		node->votes = saved_votes;
-		return -EINVAL;
-	}
-
-	recalculate_quorum(1, 0);
-
-	send_reconfigure(arg.nodeid, RECONFIG_PARAM_NODE_VOTES, arg.newvotes);
-
-	return 0;
-}
-
-static int do_cmd_bind(struct connection *con, char *cmdbuf)
-{
-	unsigned int port;
-	int ret = -EADDRINUSE;
-
-	memcpy(&port, cmdbuf, sizeof(int));
-
-	P_MEMB("requested bind to port %d, (us=%p)\n", port, con);
-
-	if (port == 0 || port > 255)
-		return -EINVAL;
-
-	if (port_array[port])
-		goto out;
-
-	ret = 0;
-	port_array[port] = con;
-	con->port = port;
-
-	set_port_bit(us, con->port);
-	send_port_open_msg(con->port);
-
- out:
-	return ret;
-}
-
-static int do_cmd_leave_cluster(char *cmdbuf, int *retlen)
-{
-	int leave_flags;
-
-	if (!ais_running)
-		return -ENOTCONN;
-
-	memcpy(&leave_flags, cmdbuf, sizeof(int));
-
-	/* Ignore the use count if FORCE is set */
-	if (!(leave_flags & CLUSTER_LEAVEFLAG_FORCE)) {
-		if (use_count)
-			return -ENOTCONN;
-	}
-
-	us->leave_reason = leave_flags;
-	quit_threads = 1;
-
-	/* No messaging available yet, just die */
-	if (!we_are_a_cluster_member)
-		exit(0);
-
-	send_leave(leave_flags);
-	use_count = 0;
-
-	/* When we get our leave message back, then quit */
-	return 0;
-}
-
-static void check_shutdown_status()
-{
-	int reply;
-	int leaveflags = CLUSTER_LEAVEFLAG_DOWN;
-
-	/* All replies safely gathered in ? */
-	if (shutdown_yes + shutdown_no >= shutdown_expected) {
-
-		corosync->timer_delete(shutdown_timer);
-
-		if (shutdown_yes >= shutdown_expected ||
-		    shutdown_flags & SHUTDOWN_ANYWAY) {
-			quit_threads = 1;
-			if (shutdown_flags & SHUTDOWN_REMOVE)
-				leaveflags |= CLUSTER_LEAVEFLAG_REMOVED;
-			send_leave(leaveflags);
-			reply = 0;
-		}
-		else {
-			reply = -EBUSY;
-
-			/* Tell originator that shutdown was cancelled */
-			send_status_return(shutdown_con, CMAN_CMD_TRY_SHUTDOWN, reply);
-			shutdown_con = NULL;
-		}
-
-		P_MEMB("shutdown decision is: %d (yes=%d, no=%d) flags=%x\n", reply, shutdown_yes, shutdown_no, shutdown_flags);
-	}
-}
-
-/* Not all nodes responded to the shutdown */
-static void shutdown_timer_fn(void *arg)
-{
-	P_MEMB("Shutdown timer fired. flags = %x\n", shutdown_flags);
-
-	/* Mark undecideds as "NO" */
-	shutdown_no = shutdown_expected;
-	check_shutdown_status();
-}
-
-/* A service's response to a TRY_SHUTDOWN event. This NEVER returns a response */
-static int do_cmd_shutdown_reply(struct connection *con, char *cmdbuf)
-{
-	int response = *(int *)cmdbuf;
-
-	/* Not shutting down, but don't respond. */
-	if (!shutdown_con)
-		return -EWOULDBLOCK;
-
-	P_MEMB("Shutdown reply is %d\n", response);
-
-	/* We only need to keep a track of a client's response in
-	   case it pulls the connection before the shutdown process
-	   has completed */
-	if (response) {
-		shutdown_yes++;
-		con->shutdown_reply = SHUTDOWN_REPLY_YES;
-	}
-	else {
-		shutdown_no++;
-		con->shutdown_reply = SHUTDOWN_REPLY_NO;
-	}
-	check_shutdown_status();
-
-	/* No response needed to this message */
-	return -EWOULDBLOCK;
-}
-
-/* User requested shutdown. We poll all listening clients and see if they are
-   willing to shutdown */
-static int do_cmd_try_shutdown(struct connection *con, char *cmdbuf)
-{
-	int flags = *(int *)cmdbuf;
-
-	/* Are we already in shutdown ? */
-	if (shutdown_con || quit_threads)
-		return -EALREADY;
-
-	shutdown_con = con;
-	shutdown_flags = flags;
-	shutdown_yes = 0;
-	shutdown_no = 0;
-	shutdown_expected = num_listeners();
-
-	/* If no-one is listening for events then we can just go down now */
-	if (shutdown_expected == 0) {
-		quit_threads = 1;
-		send_leave(CLUSTER_LEAVEFLAG_DOWN);
-		return 0;
-	}
-	else {
-
-		/* Start the timer. If we don't get a full set of replies before this goes
-		   off we'll cancel the shutdown */
-		corosync->timer_add_duration((unsigned long long)shutdown_timeout*1000000, NULL,
-					   shutdown_timer_fn, &shutdown_timer);
-
-		notify_listeners(NULL, EVENT_REASON_TRY_SHUTDOWN, flags);
-
-		return -EWOULDBLOCK;
-	}
-}
-
-static int do_cmd_register_quorum_device(char *cmdbuf, int *retlen)
-{
-	int votes;
-	char *name = cmdbuf+sizeof(int);
-
-	if (!ais_running)
-		return -ENOTCONN;
-
-	if (!we_are_a_cluster_member)
-		return -ENOENT;
-
-	if (quorum_device)
-                return -EBUSY;
-
-	if (strlen(name) > MAX_CLUSTER_MEMBER_NAME_LEN)
-		return -EINVAL;
-
-	if (find_node_by_name(name))
-                return -EALREADY;
-
-	memcpy(&votes, cmdbuf, sizeof(int));
-
-	quorum_device = malloc(sizeof(struct cluster_node));
-        if (!quorum_device)
-                return -ENOMEM;
-        memset(quorum_device, 0, sizeof(struct cluster_node));
-
-        quorum_device->name = malloc(strlen(name) + 1);
-        if (!quorum_device->name) {
-                free(quorum_device);
-                quorum_device = NULL;
-                return -ENOMEM;
-        }
-
-        strcpy(quorum_device->name, name);
-        quorum_device->votes = votes;
-        quorum_device->state = NODESTATE_DEAD;
-	gettimeofday(&quorum_device->join_time, NULL);
-
-        /* Keep this list valid so it doesn't confuse other code */
-        list_init(&quorum_device->addr_list);
-
-	log_printf(LOG_INFO, "quorum device registered\n");
-        return 0;
-}
-
-static int do_cmd_unregister_quorum_device(char *cmdbuf, int *retlen)
-{
-        if (!quorum_device)
-                return -EINVAL;
-
-        if (quorum_device->state == NODESTATE_MEMBER)
-                return -EBUSY;
-
-	free(quorum_device->name);
-	free(quorum_device);
-
-        quorum_device = NULL;
-
-	log_printf(LOG_INFO, "quorum device unregistered\n");
-        return 0;
-}
-
-static int reread_config(int new_version)
-{
-	int read_err;
-	char *reload_err = NULL;
-
-	wanted_config_version = new_version;
-
-	/* Tell objdb to reload */
-	read_err = corosync->object_reload_config(1, &reload_err);
-
-	/* Now get our bits */
-	if (!read_err)
-		read_err = read_cman_nodes(corosync, &config_version, 0);
-
-	if (read_err) {
-		config_error = 1;
-		log_printf(LOG_ERR, "Can't get updated config version %d: %s. Activity suspended on this node\n",
-			   wanted_config_version, reload_err?reload_err:"version mismatch on this node");
-	}
-
-	/* Still too old?? */
-	if (config_version < wanted_config_version) {
-		log_printf(LOG_ERR, "Can't get updated config version %d, config file is version %d.\n",
-			   wanted_config_version, config_version);
-	}
-
-	/* Keep looking */
-	if (read_err || config_version < wanted_config_version) {
-		corosync->timer_add_duration((unsigned long long)ccsd_poll_interval*1000000, NULL,
-					     ccsd_timer_fn, &ccsd_timer);
-	}
-
-	return read_err;
-}
-
-static void ccsd_timer_fn(void *arg)
-{
-	log_printf(LOG_DEBUG, "Polling configuration for updated information\n");
-	if (!reread_config(wanted_config_version) && config_version >= wanted_config_version) {
-		log_printf(LOG_ERR, "Now got config information version %d, continuing\n", config_version);
-		config_error = 0;
-		recalculate_quorum(0, 0);
-		notify_listeners(NULL, EVENT_REASON_CONFIG_UPDATE, config_version);
-	}
-}
-
-
-static void quorum_device_timer_fn(void *arg)
-{
-	struct timeval now;
-	if (!quorum_device || quorum_device->state == NODESTATE_DEAD)
-		return;
-
-	P_MEMB("quorum_device_timer_fn\n");
-	gettimeofday(&now, NULL);
-	if (quorum_device->last_hello.tv_sec + quorumdev_poll/1000 < now.tv_sec) {
-		quorum_device->state = NODESTATE_DEAD;
-		log_printf(LOG_INFO, "lost contact with quorum device\n");
-		recalculate_quorum(0, 0);
-	}
-	else {
-		corosync->timer_add_duration((unsigned long long)quorumdev_poll*1000000, quorum_device,
-					   quorum_device_timer_fn, &quorum_device_timer);
-	}
-}
-
-static int do_cmd_poll_quorum_device(char *cmdbuf, int *retlen)
-{
-	int yesno;
-
-        if (!quorum_device)
-                return -EINVAL;
-
-	memcpy(&yesno, cmdbuf, sizeof(int));
-
-        if (yesno) {
-		gettimeofday(&quorum_device->last_hello, NULL);
-                if (quorum_device->state == NODESTATE_DEAD) {
-                        quorum_device->state = NODESTATE_MEMBER;
-                        recalculate_quorum(0, 0);
-
-			corosync->timer_add_duration((unsigned long long)quorumdev_poll*1000000, quorum_device,
-						   quorum_device_timer_fn, &quorum_device_timer);
-                }
-        }
-        else {
-                if (quorum_device->state == NODESTATE_MEMBER) {
-                        quorum_device->state = NODESTATE_DEAD;
-                        recalculate_quorum(0, 0);
-			corosync->timer_delete(quorum_device_timer);
-                }
-        }
-
-	return 0;
-}
-
-/* fence_tool tells us it has fenced a node */
-static int do_cmd_update_fence_info(char *cmdbuf)
-{
-	struct cl_fence_info *f = (struct cl_fence_info *)cmdbuf;
-	struct cluster_node *node;
-	char msg[sizeof(struct cl_fencemsg)+strlen(f->fence_agent)+1];
-	struct cl_fencemsg *fence_msg = (struct cl_fencemsg *)msg;
-
-	node = find_node_by_nodeid(f->nodeid);
-	if (!node)
-		return -EINVAL;
-
-	if (strlen(f->fence_agent) >= MAX_FENCE_AGENT_NAME_LEN)
-		return -EINVAL;
-
-	node->flags |= NODE_FLAGS_FENCED;
-	if (node->state == NODESTATE_MEMBER)
-		node->flags |= NODE_FLAGS_FENCEDWHILEUP;
-
-	/* Tell the rest of the cluster (and us!) */
-	fence_msg->cmd = CLUSTER_MSG_FENCESTATUS;
-	fence_msg->nodeid = f->nodeid;
-	fence_msg->timesec = f->fence_time;
-	fence_msg->fenced = 1;
-	strcpy(fence_msg->agent, f->fence_agent);
-	comms_send_message(msg, sizeof(msg), 0,0, 0, 0);
-
-	P_MEMB("node %d fenced by %s\n", f->nodeid, f->fence_agent);
-	return 0;
-}
-
-static int do_cmd_get_fence_info(char *cmdbuf, char **retbuf, int retsize, int *retlen, int offset)
-{
-	int nodeid;
-	char *outbuf = *retbuf + offset;
-	struct cl_fence_info *f = (struct cl_fence_info *)outbuf;
-	struct cluster_node *node;
-
-	if (retsize < sizeof(struct cl_fence_info))
-		return -EINVAL;
-	memcpy(&nodeid, cmdbuf, sizeof(nodeid));
-
-	node = find_node_by_nodeid(nodeid);
-	if (!node)
-		return -EINVAL;
-
-	f->nodeid = nodeid;
-	f->fence_time = node->fence_time;
-	f->flags = node->flags&NODE_FLAGS_FENCED;
-
-	if (node->fence_agent)
-		strcpy(f->fence_agent, node->fence_agent);
-	else
-		f->fence_agent[0] = '\0';
-	*retlen = sizeof(struct cl_fence_info);
-	return 0;
-}
-
-static int do_cmd_get_node_addrs(char *cmdbuf, char **retbuf, int retsize, int *retlen, int offset)
-{
-	int nodeid;
-	int i;
-	char *outbuf = *retbuf + offset;
-	struct cl_get_node_addrs *addrs = (struct cl_get_node_addrs *)outbuf;
-	struct totem_ip_address node_ifs[INTERFACE_MAX]; /* totempg_ifaces_get always copies INTERFACE_MAX addresses */
-	struct cluster_node *node;
-	char **status;
-
-	if (retsize < sizeof(struct cl_node_addrs))
-		return -EINVAL;
-	memcpy(&nodeid, cmdbuf, sizeof(nodeid));
-
-	node = find_node_by_nodeid(nodeid);
-	if (!node)
-		return -EINVAL;
-
-	memset(outbuf, 0, retsize - offset);
-
-	/* AIS doesn't know about nodes that are not members */
-	if (node->state != NODESTATE_MEMBER)  {
-		addrs->numaddrs = 0;
-		*retlen = sizeof(struct cl_get_node_addrs);
-		return 0;
-	}
-
-	if (corosync->totem_ifaces_get(nodeid, node_ifs, &status, (unsigned int *)&addrs->numaddrs))
-		return -errno;
-
-	for (i=0; i<addrs->numaddrs; i++) {
-		totemip_to_sockaddr(&node_ifs[i], 0,
-				    &addrs->addrs[i].addr,
-				    &addrs->addrs[i].addrlen);
-	}
-	*retlen = sizeof(struct cl_get_node_addrs) +
-		addrs->numaddrs * sizeof(struct cl_node_addrs);
-
-	return 0;
-}
-
-int process_command(struct connection *con, int cmd, char *cmdbuf,
-		    char **retbuf, int *retlen, int retsize, int offset)
-{
-	int err = -EINVAL;
-	struct cl_version cnxman_version;
-	char *outbuf = *retbuf;
-	int value;
-#ifdef DEBUG
-	FILE *dumpfile;
-#endif
-
-	P_MEMB("command to process is %x\n", cmd);
-
-	switch (cmd) {
-
-	case CMAN_CMD_NOTIFY:
-		con->events = 1;
-		err = 0;
-		/* If a shutdown is in progress, ask the newcomer what it thinks... */
-		if (shutdown_con) {
-			notify_listeners(con, EVENT_REASON_TRY_SHUTDOWN, shutdown_flags);
-			shutdown_expected++;
-		}
-		break;
-
-	case CMAN_CMD_REMOVENOTIFY:
-		con->events = 0;
-		err = 0;
-		break;
-
-	case CMAN_CMD_SET_DIRTY:
-		us->flags |= NODE_FLAGS_DIRTY;
-		err = 0;
-		break;
-
-	case CMAN_CMD_SET_DEBUGLOG:
-		memcpy(&value, cmdbuf, sizeof(int));
-		set_debuglog(value);
-		err = 0;
-		break;
-#ifdef DEBUG
-	case CMAN_CMD_DUMP_OBJDB:
-		dumpfile = fopen(cmdbuf, "w+");
-		if (dumpfile)  {
-			corosync->object_dump(OBJECT_PARENT_HANDLE, dumpfile);
-			fclose(dumpfile);
-			err = 0;
-		}
-		else {
-			err = -errno;
-		}
-		break;
-#endif
-	case CMAN_CMD_START_CONFCHG:
-		con->confchg = 1;
-		err = 0;
-		break;
-
-	case CMAN_CMD_STOP_CONFCHG:
-		con->confchg = 0;
-		err = 0;
-		break;
-
-		/* Return the cnxman version number */
-	case CMAN_CMD_GET_VERSION:
-		err = 0;
-		cnxman_version.major = CNXMAN_MAJOR_VERSION;
-		cnxman_version.minor = CNXMAN_MINOR_VERSION;
-		cnxman_version.patch = CNXMAN_PATCH_VERSION;
-		cnxman_version.config = config_version;
-		memcpy(outbuf+offset, &cnxman_version, sizeof(struct cl_version));
-		*retlen = sizeof(struct cl_version);
-		break;
-
-		/* Set the cnxman config version number */
-	case CMAN_CMD_SET_VERSION:
-		err = do_cmd_set_version(cmdbuf, retlen);
-		break;
-
-		/* Bind to a "port" */
-	case CMAN_CMD_BIND:
-		err = do_cmd_bind(con, cmdbuf);
-		break;
-
-		/* Return the full membership list including dead nodes */
-	case CMAN_CMD_GETALLMEMBERS:
-		err = do_cmd_get_all_members(cmdbuf, retbuf, retsize, retlen, offset);
-		break;
-
-	case CMAN_CMD_GETNODECOUNT:
-		err = get_node_count();
-		break;
-
-	case CMAN_CMD_GETNODE:
-		err = do_cmd_get_node(cmdbuf, outbuf+offset, retlen);
-		break;
-
-	case CMAN_CMD_GETCLUSTER:
-		err = do_cmd_get_cluster(cmdbuf, outbuf+offset, retlen);
-		break;
-
-	case CMAN_CMD_GETEXTRAINFO:
-		err = do_cmd_get_extrainfo(cmdbuf, retbuf, retsize, retlen, offset);
-		break;
-
-	case CMAN_CMD_ISQUORATE:
-		return cluster_is_quorate;
-
-	case CMAN_CMD_ISACTIVE:
-		return ais_running;
-
-	case CMAN_CMD_SETEXPECTED_VOTES:
-		err = do_cmd_set_expected(cmdbuf, retlen);
-		break;
-
-		/* Change the number of votes for this node */
-	case CMAN_CMD_SET_VOTES:
-		err = do_cmd_set_votes(cmdbuf, retlen);
-		break;
-
-		/* Return 1 if the specified node is listening on a given port */
-	case CMAN_CMD_ISLISTENING:
-		err = do_cmd_islistening(con, cmdbuf, retlen);
-		break;
-
-		/* Forcibly kill a node */
-	case CMAN_CMD_KILLNODE:
-		err = do_cmd_kill_node(cmdbuf, retlen);
-		break;
-
-	case CMAN_CMD_BARRIER:
-		err = do_cmd_barrier(con, cmdbuf, retlen);
-		break;
-
-	case CMAN_CMD_LEAVE_CLUSTER:
-		err = do_cmd_leave_cluster(cmdbuf, retlen);
-		break;
-
-	case CMAN_CMD_GET_JOINCOUNT:
-		err = num_connections;
-		break;
-
-	case CMAN_CMD_TRY_SHUTDOWN:
-		err = do_cmd_try_shutdown(con, cmdbuf);
-		break;
-
-	case CMAN_CMD_SHUTDOWN_REPLY:
-		err = do_cmd_shutdown_reply(con, cmdbuf);
-		break;
-
-	case CMAN_CMD_REG_QUORUMDEV:
-		err = do_cmd_register_quorum_device(cmdbuf, retlen);
-		break;
-
-	case CMAN_CMD_UNREG_QUORUMDEV:
-		err = do_cmd_unregister_quorum_device(cmdbuf, retlen);
-		break;
-
-	case CMAN_CMD_POLL_QUORUMDEV:
-		err = do_cmd_poll_quorum_device(cmdbuf, retlen);
-		break;
-
-	case CMAN_CMD_UPDATE_FENCE_INFO:
-		err = do_cmd_update_fence_info(cmdbuf);
-		break;
-
-	case CMAN_CMD_GET_FENCE_INFO:
-		err = do_cmd_get_fence_info(cmdbuf, retbuf, retsize, retlen, offset);
-		break;
-
-	case CMAN_CMD_GET_NODEADDRS:
-		err = do_cmd_get_node_addrs(cmdbuf, retbuf, retsize, retlen, offset);
-		break;
-	}
-	P_MEMB("command return code is %d\n", err);
-	return err;
-}
-
-
-int send_to_userport(unsigned char fromport, unsigned char toport,
-		     int nodeid, int tgtid,
-		     char *recv_buf, int len,
-		     int endian_conv)
-{
-	int ret = -1;
-
-	if (toport == 0) {
-		process_internal_message(recv_buf, nodeid, endian_conv);
-		ret = 0;
-	}
-	else {
-		/* Send to external listener */
-		if (port_array[toport]) {
-			struct connection *c = port_array[toport];
-
-			P_MEMB("send_to_userport. cmd=%d,  endian_conv=%d\n", recv_buf[0],endian_conv);
-
-			send_data_reply(c, nodeid, fromport, recv_buf, len);
-			ret = 0;
-		}
-	}
-	return ret;
-}
-
-void cman_send_confchg(unsigned int *member_list, int member_list_entries,
-		       unsigned int *left_list, int left_list_entries,
-		       unsigned int *joined_list, int joined_list_entries)
-{
-	char buf[sizeof(struct sock_confchg_message) +
-		 (member_list_entries+left_list_entries+joined_list_entries) * sizeof(int)];
-	struct sock_confchg_message *msg = (struct sock_confchg_message *)buf;
-
-	msg->header.magic = CMAN_MAGIC;
-	msg->header.command = CMAN_CMD_CONFCHG;
-	msg->header.length = sizeof(buf);
-	msg->header.flags = 0;
-
-	msg->member_entries = member_list_entries;
-	msg->joined_entries = joined_list_entries;
-	msg->left_entries = left_list_entries;
-
-	memcpy(msg->entries, member_list, sizeof(int)*member_list_entries);
-	memcpy(msg->entries+member_list_entries, left_list, sizeof(int)*left_list_entries);
-	memcpy(msg->entries+member_list_entries+left_list_entries, joined_list, sizeof(int)*joined_list_entries);
-
-	notify_confchg((struct sock_header *)msg);
-}
-
-
-/* Send a port closedown message to all cluster nodes - this tells them that a
- * port listener has gone away */
-static int send_port_close_msg(unsigned char port)
-{
-	struct cl_portmsg portmsg;
-
-	/* Build the header */
-	portmsg.cmd = CLUSTER_MSG_PORTCLOSED;
-	portmsg.port = port;
-
-	return comms_send_message(&portmsg, sizeof(portmsg), 0,0, 0, 0);
-}
-
-static int send_port_enquire(int nodeid)
-{
-	char msg[1];
-
-	/* Build the header */
-	msg[0] = CLUSTER_MSG_PORTENQ;
-
-	return comms_send_message(msg, 1, 0,0, nodeid, 0);
-}
-
-static int send_port_open_msg(unsigned char port)
-{
-	struct cl_portmsg portmsg;
-
-	/* Build the header */
-	portmsg.cmd = CLUSTER_MSG_PORTOPENED;
-	portmsg.port = port;
-
-	return comms_send_message(&portmsg, sizeof(portmsg), 0,0, 0, 0);
-}
-
-void unbind_con(struct connection *con)
-{
-	if (con->port) {
-		P_MEMB("Unbinding con for port %d\n", con->port);
-		port_array[con->port] = NULL;
-		send_port_close_msg(con->port);
-		clear_port_bit(us, con->port);
-		con->port = 0;
-	}
-
-	/* If we're in shutdown and this client was listening for events
-	   then we take its closedown as a "Yes" to the "can we shutdown"
-	   question. If it previously answered "No", we need to change its vote */
-	if (shutdown_con && con->events) {
-		if (con->shutdown_reply) {
-			if (con->shutdown_reply == SHUTDOWN_REPLY_YES)
-				shutdown_yes--;
-			if (con->shutdown_reply == SHUTDOWN_REPLY_NO)
-				shutdown_no--;
-		}
-		con->shutdown_reply = SHUTDOWN_REPLY_YES; /* I'll take that as a "Yes" then */
-		shutdown_yes++;
-
-		check_shutdown_status();
-	}
-
-	/* If the controlling shutdown process has quit, then cancel the
-	   shutdown session */
-	if (con == shutdown_con)
-		shutdown_con = NULL;
-}
-
-/* Post a PORT OPEN/CLOSE event to anyone listening on this end */
-static void post_port_event(int reason, unsigned char port, int nodeid)
-{
-	struct connection *con = port_array[port];
-
-	if (con)
-		notify_listeners(con, reason, nodeid);
-}
-
-int our_nodeid()
-{
-	if (us)
-		return us->node_id;
-	else
-		return 0;
-}
-
-/* Sanity check TRANSITION message */
-static int valid_transition_msg(int nodeid, struct cl_transmsg *msg)
-{
-	if (strcmp(msg->clustername, cluster_name) != 0) {
-		log_printf(LOG_ERR, "Node %d conflict, remote cluster name='%s', local='%s'\n",
-			nodeid, msg->clustername, cluster_name);
-		return -1;
-	}
-
-	if (msg->cluster_id != cluster_id) {
-		log_printf(LOG_ERR, "Node %d conflict, remote cluster id=%d, local=%d\n",
-			nodeid, msg->cluster_id, cluster_id);
-		return -1;
-	}
-
-	if (msg->major_version != CNXMAN_MAJOR_VERSION) {
-
-		log_printf(LOG_ERR, "Node %d conflict, remote version id=%d, local=%d\n",
-			nodeid, msg->major_version, CNXMAN_MAJOR_VERSION);
-		return -1;
-	}
-
-	/* New config version - try to read new file */
-	if (msg->config_version > config_version) {
-
-		reread_config(msg->config_version);
-
-		if (config_version > msg->config_version) {
-			/* Tell everyone else to update */
-			send_reconfigure(us->node_id, RECONFIG_PARAM_CONFIG_VERSION, config_version);
-		}
-		recalculate_quorum(0, 0);
-		notify_listeners(NULL, EVENT_REASON_CONFIG_UPDATE, config_version);
-	}
-
-
-	if (msg->config_version != config_version) {
-		log_printf(LOG_ERR, "Node %d conflict, remote config version id=%d, local=%d\n",
-			nodeid, msg->config_version, config_version);
-		return -1;
-	}
-
-	return 0;
-}
-
-
-void send_transition_msg(int last_memb_count, int first_trans)
-{
-	char buf[sizeof(struct cl_transmsg)+1024] __attribute__((aligned(8)));
-	struct cl_transmsg *msg = (struct cl_transmsg *)buf;
-	int len = sizeof(struct cl_transmsg);
-
-	we_are_a_cluster_member = 1;
-
-	P_MEMB("sending TRANSITION message. cluster_name = %s\n", cluster_name);
-	msg->cmd = CLUSTER_MSG_TRANSITION;
-	msg->first_trans = first_trans;
-	msg->votes = us->votes;
-	msg->expected_votes = us->expected_votes;
-	msg->cluster_id = cluster_id;
-	msg->major_version = CNXMAN_MAJOR_VERSION;
-	msg->minor_version = CNXMAN_MINOR_VERSION;
-	msg->patch_version = CNXMAN_PATCH_VERSION;
-	msg->config_version = config_version;
-	msg->flags = us->flags;
-	msg->fence_time = us->fence_time;
-	msg->join_time = join_time;
-	strcpy(msg->clustername, cluster_name);
-	if (us->fence_agent)
-	{
-		strcpy(msg->fence_agent, us->fence_agent);
-		len += strlen(us->fence_agent)+1;
-	}
-	else
-	{
-		msg->fence_agent[0] = '\0';
-		len += 1;
-	}
-
-	if (have_disallowed())
-		msg->flags |= NODE_FLAGS_SEESDISALLOWED;
-
-	comms_send_message(msg, len,
-			   0,0,
-			   0,  /* multicast */
-			   0); /* flags */
-}
-
-static void byteswap_internal_message(char *data)
-{
-	struct cl_protmsg *msg = (struct cl_protmsg *)data;
-	struct cl_barriermsg *barriermsg;
-	struct cl_killmsg *killmsg;
-	struct cl_leavemsg *leavemsg;
-	struct cl_transmsg *transmsg;
-	struct cl_fencemsg *fencemsg;
-	struct cl_reconfig_msg *reconfmsg;
-
-	switch (msg->cmd) {
-	case CLUSTER_MSG_PORTOPENED:
-	case CLUSTER_MSG_PORTCLOSED:
-		/* Just a byte */
-		break;
-
-	case CLUSTER_MSG_TRANSITION:
-		transmsg = (struct cl_transmsg *)data;
-		transmsg->cluster_id = swab16(transmsg->cluster_id);
-		transmsg->votes = swab32(transmsg->votes);
-		transmsg->expected_votes = swab32(transmsg->expected_votes);
-		transmsg->major_version = swab32(transmsg->major_version);
-		transmsg->minor_version = swab32(transmsg->minor_version);
-		transmsg->patch_version = swab32(transmsg->patch_version);
-		transmsg->config_version = swab32(transmsg->config_version);
-		transmsg->flags = swab32(transmsg->flags);
-		transmsg->fence_time = swab64(transmsg->fence_time);
-		break;
-
-	case CLUSTER_MSG_KILLNODE:
-		killmsg = (struct cl_killmsg *)data;
-		killmsg->reason = swab16(killmsg->reason);
-		killmsg->nodeid = swab32(killmsg->nodeid);
-		break;
-
-	case CLUSTER_MSG_LEAVE:
-		leavemsg = (struct cl_leavemsg *)data;
-		leavemsg->reason = swab16(leavemsg->reason);
-		break;
-
-	case CLUSTER_MSG_BARRIER:
-		barriermsg = (struct cl_barriermsg *)data;
-		break;
-
-	case CLUSTER_MSG_RECONFIGURE:
-		reconfmsg = (struct cl_reconfig_msg *)data;
-		reconfmsg->nodeid = swab32(reconfmsg->nodeid);
-		reconfmsg->value = swab32(reconfmsg->value);
-		break;
-
-	case CLUSTER_MSG_FENCESTATUS:
-		fencemsg = (struct cl_fencemsg *)data;
-		fencemsg->timesec = swab64(fencemsg->timesec);
-		fencemsg->nodeid = swab32(fencemsg->nodeid);
-		break;
-	}
-}
-
-
-static void do_reconfigure_msg(void *data)
-{
-	struct cl_reconfig_msg *msg = data;
-	struct cluster_node *node;
-	struct list *nodelist;
-
-	node = find_node_by_nodeid(msg->nodeid);
-	if (!node)
-		return;
-
-	switch(msg->param)
-	{
-	case RECONFIG_PARAM_EXPECTED_VOTES:
-		node->expected_votes = msg->value;
-
-		list_iterate(nodelist, &cluster_members_list) {
-			node = list_item(nodelist, struct cluster_node);
-			if (node->state == NODESTATE_MEMBER &&
-			    node->expected_votes > msg->value) {
-				node->expected_votes = msg->value;
-			}
-		}
-		recalculate_quorum(1, 0);  /* Allow decrease */
-		break;
-
-	case RECONFIG_PARAM_NODE_VOTES:
-		node->votes = msg->value;
-		recalculate_quorum(1, 0);  /* Allow decrease */
-		break;
-
-	case RECONFIG_PARAM_CONFIG_VERSION:
-		if (config_version != msg->value) {
-			reread_config(msg->value);
-		}
-		notify_listeners(NULL, EVENT_REASON_CONFIG_UPDATE, config_version);
-		break;
-	}
-}
-
-static void do_fence_msg(void *data)
-{
-	struct cl_fencemsg *msg = data;
-	struct cluster_node *node;
-
-	P_DAEMON("got FENCE message, node %d fenced by %s\n", msg->nodeid, msg->agent);
-
-	node = find_node_by_nodeid(msg->nodeid);
-	if (!node)
-		return;
-
-	node->fence_time = msg->timesec;
-	if (node->fence_agent)
-		free(node->fence_agent);
-	node->fence_agent = strdup(msg->agent);
-	if (msg->fenced) {
-		node->flags |= NODE_FLAGS_FENCED;
-
-		if (node->state == NODESTATE_MEMBER)
-			node->flags |= NODE_FLAGS_FENCEDWHILEUP;
-	}
-
-}
-
-static void do_process_transition(int nodeid, char *data)
-{
-	struct cl_transmsg *msg = (struct cl_transmsg *)data;
-	struct cluster_node *node;
-
-	if (valid_transition_msg(nodeid, msg) != 0) {
-		P_MEMB("Transition message from %d does not match current config - should quit ?\n", nodeid);
-		// Now what ??
-		return;
-	}
-
-	/* If the remote node can see AISONLY nodes then we can't join as we don't
-	   know the full state */
-	if (msg->flags & NODE_FLAGS_SEESDISALLOWED && !have_disallowed()) {
-		/* Must use syslog directly here or the message will never arrive */
-		syslog(LOG_CRIT, "CMAN: Joined a cluster with disallowed nodes. must die");
-		exit(2);
-	}
-	msg->flags &= ~NODE_FLAGS_SEESDISALLOWED;
-
-	node = find_node_by_nodeid(nodeid);
-	if (!node) {
-		add_ais_node(nodeid, incarnation, num_ais_nodes);
-		node = find_node_by_nodeid(nodeid);
-	}
-	assert(node);
-
-	P_MEMB("Got TRANSITION message. msg->flags=%x, node->flags=%x, first_trans=%d\n",
-	       msg->flags, node->flags, msg->first_trans);
-
-	/* Newer nodes 6.1.0 onwards, set the DIRTY flag if they have state. If the new node has been down
-	   and has state then we mark it disallowed because we cannot merge stateful nodes */
-	if ( (msg->flags & NODE_FLAGS_DIRTY && (node->flags & NODE_FLAGS_BEENDOWN)) ||
-	     (msg->flags & NODE_FLAGS_DIRTY && msg->first_trans && !node->us)) {
-		/* Don't duplicate messages */
-		if (node->state != NODESTATE_AISONLY) {
-			if (cluster_is_quorate) {
-				P_MEMB("Killing node %s because it has rejoined the cluster with existing state", node->name);
-				log_printf(LOG_CRIT, "Killing node %s because it has rejoined the cluster with existing state", node->name);
-				node->state = NODESTATE_AISONLY;
-				send_kill(nodeid, CLUSTER_KILL_REJOIN);
-			}
-			else {
-				P_MEMB("Node %s not joined to cman because it has existing state", node->name);
-				log_printf(LOG_CRIT, "Node %s not joined to cman because it has existing state", node->name);
-				node->state = NODESTATE_AISONLY;
-			}
-		}
-		return;
-	}
-
-        /* This is for older nodes. If the join_time of the node matches that already stored AND
-	   the node has been down, then we kill it as this must be a rejoin */
-	if (msg->minor_version == 0 &&
-	    msg->join_time == node->cman_join_time && node->flags & NODE_FLAGS_BEENDOWN) {
-		/* Don't duplicate messages */
-		if (node->state != NODESTATE_AISONLY) {
-			if (cluster_is_quorate) {
-				P_MEMB("Killing node %s because it has rejoined the cluster without cman_tool join", node->name);
-				log_printf(LOG_CRIT, "Killing node %s because it has rejoined the cluster without cman_tool join", node->name);
-				node->state = NODESTATE_AISONLY;
-				send_kill(nodeid, CLUSTER_KILL_REJOIN);
-			}
-			else {
-				P_MEMB("Node %s not joined to cman because it has rejoined an inquorate cluster", node->name);
-				log_printf(LOG_CRIT, "Node %s not joined to cman because it has rejoined an inquorate cluster", node->name);
-				node->state = NODESTATE_AISONLY;
-			}
-		}
-		return;
-	}
-	else {
-		node->cman_join_time = msg->join_time;
-		add_ais_node(nodeid, incarnation, num_ais_nodes);
-	}
-
-	/* If the cluster already has some AISONLY nodes then we can't make
-	   sense of the membership. So the new node has to also be AISONLY
-	   until we are consistent again */
-	if (have_disallowed() && !node->us)
-		node->state = NODESTATE_AISONLY;
-
-	node->flags = msg->flags; /* This will clear the BEENDOWN flag of course */
-
-	/* Take into account any new expected_votes value that the new node has */
-	node->expected_votes = msg->expected_votes;
-	recalculate_quorum(0, 0);
-
-	if (node->fence_agent && msg->fence_agent[0] && strcmp(node->fence_agent, msg->fence_agent))
-	{
-		free(node->fence_agent);
-		node->fence_agent = strdup(msg->fence_agent);
-		node->fence_time = msg->fence_time;
-	}
-
-	/*
-	 * If this is a rejoined node then it won't know about its own fence data, send it
-	 * some
-	 */
-	if (node->fence_time && !msg->fence_time &&
-	    node->fence_agent && !msg->fence_agent[0])
-	{
-		char msg[sizeof(struct cl_fencemsg)+strlen(node->fence_agent)+1];
-		struct cl_fencemsg *fence_msg = (struct cl_fencemsg *)msg;
-
-		fence_msg->cmd = CLUSTER_MSG_FENCESTATUS;
-		fence_msg->nodeid = nodeid;
-		fence_msg->timesec = node->fence_time;
-		fence_msg->fenced = 0;
-		strcpy(fence_msg->agent, node->fence_agent);
-		comms_send_message(msg, sizeof(msg), 0,0, nodeid, 0);
-	}
-}
-
-static void process_internal_message(char *data, int nodeid, int need_byteswap)
-{
-	struct cl_protmsg *msg = (struct cl_protmsg *)data;
-	struct cl_portmsg *portmsg;
-	struct cl_barriermsg *barriermsg;
-	struct cl_killmsg *killmsg;
-	struct cl_leavemsg *leavemsg;
-	struct cluster_node *node = find_node_by_nodeid(nodeid);
-	unsigned char portresult[PORT_BITS_SIZE+1];
-
-	P_MEMB("Message on port 0 is %d\n", msg->cmd);
-
-	/* Byteswap messages if needed */
-	if (need_byteswap)
-		byteswap_internal_message(data);
-
-	switch (msg->cmd) {
-	case CLUSTER_MSG_PORTOPENED:
-		portmsg = (struct cl_portmsg *)data;
-		if (node)
-			set_port_bit(node, portmsg->port);
-		post_port_event(EVENT_REASON_PORTOPENED, portmsg->port, nodeid);
-		break;
-
-	case CLUSTER_MSG_PORTCLOSED:
-		portmsg = (struct cl_portmsg *)data;
-		if (node)
-			clear_port_bit(node, portmsg->port);
-		post_port_event(EVENT_REASON_PORTCLOSED, portmsg->port, nodeid);
-		break;
-
-	case CLUSTER_MSG_PORTENQ:
-		portresult[0] = CLUSTER_MSG_PORTSTATUS;
-		memcpy(portresult+1, us->port_bits, PORT_BITS_SIZE);
-		P_MEMB("Sending PORTRESULT, low bytes = %x %x\n", us->port_bits[0], us->port_bits[1]);
-
-		/* Broadcast reply as other new nodes may be interested */
-		comms_send_message(portresult, PORT_BITS_SIZE+1, 0,0, 0, 0);
-		break;
-
-	case CLUSTER_MSG_PORTSTATUS:
-		if (nodeid != us->node_id) {
-			P_MEMB("got PORTRESULT from %d, low bytes = %x %x\n", nodeid, data[1], data[2]);
-			if (node)
-				memcpy(node->port_bits, data+1, PORT_BITS_SIZE);
-		}
-		break;
-
-	case CLUSTER_MSG_TRANSITION:
-		P_MEMB("got TRANSITION from node %d\n", nodeid);
-		do_process_transition(nodeid, data);
-		break;
-
-	case CLUSTER_MSG_KILLNODE:
-		killmsg = (struct cl_killmsg *)data;
-		P_MEMB("got KILL for node %d\n", killmsg->nodeid);
-		if (killmsg->nodeid == wanted_nodeid) {
-			/* Must use syslog directly here or the message will never arrive */
-			syslog(LOG_CRIT, "cman killed by node %d because %s\n", nodeid,
-			       killmsg_reason(killmsg->reason));
-			exit(1);
-		}
-		break;
-
-	case CLUSTER_MSG_LEAVE:
-		leavemsg = (struct cl_leavemsg *)data;
-		P_MEMB("got LEAVE from node %d, reason = %d\n", nodeid, leavemsg->reason);
-
-		/* We got our own leave message back. now quit */
-		if (node && node->node_id == us->node_id) {
-			/* Tell whomever asked us to leave that we are now going down */
-			if (shutdown_con)
-				send_status_return(shutdown_con, CMAN_CMD_TRY_SHUTDOWN, 0);
-			exit(0);
-		}
-
-		/* Someone else, make a note of the reason for leaving */
-		if (node)
-			node->leave_reason = leavemsg->reason;
-
-		/* Mark it as leaving, and remove it when we get an AIS node down event for it */
-		if (node && (node->state == NODESTATE_MEMBER || node->state == NODESTATE_AISONLY))
-			node->state = NODESTATE_LEAVING;
-		break;
-
-	case CLUSTER_MSG_BARRIER:
-		barriermsg = (struct cl_barriermsg *)data;
-		if (node)
-			process_barrier_msg(barriermsg, node);
-		break;
-
-	case CLUSTER_MSG_RECONFIGURE:
-		do_reconfigure_msg(data);
-		break;
-
-	case CLUSTER_MSG_FENCESTATUS:
-		do_fence_msg(data);
-		break;
-
-	default:
-		log_printf(LOG_WARNING, "Unknown protocol message %d received\n", msg->cmd);
-		break;
-
-	}
-}
-
-void override_expected(int newexp)
-{
-	struct list *nodelist;
-	struct cluster_node *node;
-
-	list_iterate(nodelist, &cluster_members_list) {
-		node = list_item(nodelist, struct cluster_node);
-		if (node->state == NODESTATE_MEMBER
-		    && node->expected_votes > newexp) {
-			node->expected_votes = newexp;
-		}
-	}
-}
-
-void clear_reread_flags()
-{
-	struct list *nodelist;
-	struct cluster_node *node;
-
-	list_iterate(nodelist, &cluster_members_list) {
-		node = list_item(nodelist, struct cluster_node);
-		node->flags &= ~NODE_FLAGS_REREAD;
-	}
-}
-
-void remove_unread_nodes()
-{
-	struct list *nodelist, *tmp;
-	struct cluster_node *node;
-
-	list_iterate_safe(nodelist, tmp, &cluster_members_list) {
-		node = list_item(nodelist, struct cluster_node);
-		if (!(node->flags & NODE_FLAGS_REREAD) &&
-		    node->state == NODESTATE_DEAD) {
-
-			list_del(&node->list);
-			free(node);
-		}
-	}
-}
-
-/* Add a node from CCS, note that it may already exist if user has simply updated the config file */
-void add_ccs_node(char *nodename, int nodeid, int votes, int expected_votes)
-{
-	/* Update node entry */
-	add_new_node(nodename, nodeid, votes, expected_votes, NODESTATE_DEAD);
-}
-
-void add_ais_node(int nodeid, uint64_t incarnation, int total_members)
-{
-	struct cluster_node *node;
-
-	P_MEMB("add_ais_node ID=%d, incarnation = %" PRIu64 "\n",nodeid, incarnation);
-
-	node = find_node_by_nodeid(nodeid);
-	if (!node && total_members == 1) {
-		node = us;
-		P_MEMB("Adding AIS node for 'us'\n");
-	}
-
- 	/* This really should exist!! */
-	if (!node) {
-		char tempname[256];
-		log_printf(LOG_ERR, "Got node from AIS id %d with no config entry\n", nodeid);
-
-		/* Emergency nodename */
-		sprintf(tempname, "Node%d", nodeid);
-		node = add_new_node(tempname, nodeid, 1, total_members, NODESTATE_DEAD);
-	}
-
-	if (node->state == NODESTATE_DEAD || node->state == NODESTATE_LEAVING) {
-		gettimeofday(&node->join_time, NULL);
-		node->incarnation = incarnation;
-		node->state = NODESTATE_MEMBER;
-		cluster_members++;
-		recalculate_quorum(0, 0);
-	}
-}
-
-void del_ais_node(int nodeid)
-{
-	struct cluster_node *node;
-	time_t t;
-	P_MEMB("del_ais_node %d\n", nodeid);
-
-	node = find_node_by_nodeid(nodeid);
-	if (!node)
-		return;
-
-	/* If the node was fenced while up (ie independantly of fenced) then
-	 * don't clear the fenced flag. There is a timeout associated with
-	 * this so if we get the node down more than 2 minutes after the
-	 * fence message then we still clear fenced just to be certain that
-	 * fenced will do the job too.
-	 */
-	time(&t);
-	if (!(node->flags & NODE_FLAGS_FENCEDWHILEUP) || (t - node->fence_time > 120))
-		node->flags &= ~NODE_FLAGS_FENCED;
-
-	node->flags &= ~NODE_FLAGS_FENCEDWHILEUP;
-	node->flags |= NODE_FLAGS_BEENDOWN;
-
-	switch (node->state) {
-	case NODESTATE_MEMBER:
-		node->state = NODESTATE_DEAD;
-		memset(&node->port_bits, 0, sizeof(node->port_bits));
-		cluster_members--;
-		recalculate_quorum(0, 0);
-		break;
-
-	case NODESTATE_AISONLY:
-		node->state = NODESTATE_DEAD;
-		break;
-
-	case NODESTATE_LEAVING:
-		node->state = NODESTATE_DEAD;
-		cluster_members--;
-
-		P_MEMB("del_ais_node %s, leave_reason=%x\n", node->name, node->leave_reason);
-		if ((node->leave_reason & 0xF) == CLUSTER_LEAVEFLAG_REMOVED)
-			recalculate_quorum(1, 1);
-		else
-			recalculate_quorum(0, 0);
-		break;
-
-	case NODESTATE_JOINING:
-	case NODESTATE_DEAD:
-		break;
-	}
-}
-
-static int get_highest_nodeid()
-{
-	int highest = 0;
-	struct cluster_node *node;
-
-	list_iterate_items(node, &cluster_members_list) {
-		if (node->node_id > highest)
-			highest = node->node_id;
-	}
-	return highest;
-}
-
-static int get_node_count()
-{
-	int count = 0;
-
-	struct cluster_node *node;
-
-	list_iterate_items(node, &cluster_members_list) {
-		count++;
-	}
-	return count;
-}
-
-static struct cluster_node *find_node_by_nodeid(int nodeid)
-{
-	struct cluster_node *node;
-
-	list_iterate_items(node, &cluster_members_list) {
-		if (node->node_id == nodeid)
-			return node;
-	}
-	return NULL;
-}
-
-
-static struct cluster_node *find_node_by_name(char *name)
-{
-	struct cluster_node *node;
-
-	list_iterate_items(node, &cluster_members_list) {
-		if (node->name && strcmp(node->name, name) == 0)
-			return node;
-	}
-	return NULL;
-}
-
-static char *killmsg_reason(int reason)
-{
-	static char msg[1024];
-
-	switch (reason)
-	{
-	case CLUSTER_KILL_REJECTED:
-		return "our membership application was rejected";
-
-	case CLUSTER_KILL_CMANTOOL:
-		return "we were killed by cman_tool or other application";
-
-	case CLUSTER_KILL_REJOIN:
-		return "we rejoined the cluster without a full restart";
-
-	default:
-		sprintf(msg, "we got kill message number %d", reason);
-		return msg;
-	}
-}
diff --git a/cman/daemon/commands.h b/cman/daemon/commands.h
deleted file mode 100644
index 5d325ad..0000000
--- a/cman/daemon/commands.h
+++ /dev/null
@@ -1,37 +0,0 @@
-struct cluster_node;
-struct connection;
-extern void process_cnxman_message(char *data, char *addr, int addrlen,
-				  struct cluster_node *rem_node);
-
-extern int send_to_userport(unsigned char fromport, unsigned char toport,
-			    int nodeid, int tgtnodeid,
-			    char *recv_buf, int len,
-			    int endian_conv);
-extern void clean_dead_listeners(void);
-extern void unbind_con(struct connection *con);
-extern void commands_init(void);
-extern int process_command(struct connection *con, int cmd, char *cmdbuf,
-			   char **retbuf, int *retlen, int retsize, int offset);
-extern void send_transition_msg(int last_memb_count, int first_trans);
-
-extern void add_ais_node(int nodeid, uint64_t incarnation, int total_members);
-extern void del_ais_node(int nodeid);
-extern void add_ccs_node(char *name, int nodeid, int votes, int expected_votes);
-extern void override_expected(int expected);
-extern void cman_send_confchg(unsigned int *member_list, int member_list_entries,
-			      unsigned int *left_list, int left_list_entries,
-			      unsigned int *joined_list, int joined_list_entries);
-
-
-extern void clear_reread_flags(void);
-extern void remove_unread_nodes(void);
-
-/* Startup stuff called from cmanccs: */
-extern int cman_set_nodename(char *name);
-extern int cman_set_nodeid(int nodeid);
-extern int cman_join_cluster(struct corosync_api_v1 *api,
-			     char *name, unsigned short cluster_id, int two_node,
-			     int votes, int expected_votes);
-
-extern int cluster_members;
-extern uint32_t max_outstanding_messages;
diff --git a/cman/daemon/daemon.c b/cman/daemon/daemon.c
deleted file mode 100644
index 6cef080..0000000
--- a/cman/daemon/daemon.c
+++ /dev/null
@@ -1,539 +0,0 @@
-#include <getopt.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/un.h>
-#include <sys/stat.h>
-#include <sys/poll.h>
-#include <sys/socket.h>
-#include <sys/signal.h>
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <sys/errno.h>
-
-#include <corosync/ipc_gen.h>
-#include <corosync/engine/coroapi.h>
-#include <corosync/engine/logsys.h>
-#include <corosync/totem/coropoll.h>
-
-#include "list.h"
-#include "cnxman-socket.h"
-#include "cnxman-private.h"
-#include "daemon.h"
-#include "logging.h"
-#include "commands.h"
-#include "barrier.h"
-#include "ais.h"
-#include "cman.h"
-
-LOGSYS_DECLARE_SUBSYS (CMAN_NAME, LOG_INFO);
-
-struct queued_reply
-{
-	struct list list;
-	int offset;
-	char buf[1];
-};
-
-/* We need to keep these in a list so we can notify of
-   cluster events */
-static LIST_INIT(client_list);
-
-/* Things to wake up for */
-volatile sig_atomic_t quit_threads=0;
-
-int num_connections = 0;
-poll_handle ais_poll_handle;
-uint32_t max_outstanding_messages = DEFAULT_MAX_QUEUED;
-
-static int process_client(poll_handle handle, int fd, int revent, void *data);
-static void remove_client(poll_handle handle, struct connection *con);
-
-/* Send it, or queue it for later if the socket is busy */
-static int send_reply_message(struct connection *con, struct sock_header *msg)
-{
-	int ret;
-
-	P_DAEMON("sending reply %x to fd %d\n", msg->command, con->fd);
-
-	/* If there are already queued messages then don't send this one
-	   out of order */
-	if (!list_empty(&con->write_msgs)) {
-		ret = -1;
-		errno = EAGAIN;
-	}
-	else {
-		ret = send(con->fd, (char *)msg, msg->length, MSG_DONTWAIT);
-	}
-
-	if ((ret > 0 && ret != msg->length) ||
-	    (ret == -1 && errno == EAGAIN)) {
-		struct queued_reply *qm;
-
-		/* Have we exceeded the allowed number of queued messages ? */
-		if (con->num_write_msgs > max_outstanding_messages) {
-			P_DAEMON("Disconnecting. client has more that %d replies outstanding (%d)\n", max_outstanding_messages, con->num_write_msgs);
-			remove_client(ais_poll_handle, con);
-			return -1;
-		}
-
-		/* Queue it */
-		qm = malloc(sizeof(struct queued_reply) + msg->length);
-		if (!qm)
-		{
-			perror("Error allocating queued message");
-			return -1;
-		}
-		memcpy(qm->buf, msg, msg->length);
-		if (ret > 0)
-			qm->offset = ret;
-		else
-			qm->offset = 0;
-		list_add(&con->write_msgs, &qm->list);
-		con->num_write_msgs++;
-		P_DAEMON("queued last message, count is %d\n", con->num_write_msgs);
-		poll_dispatch_modify(ais_poll_handle, con->fd, POLLIN | POLLOUT, process_client);
-	}
-	return 0;
-}
-
-static void remove_client(poll_handle handle, struct connection *con)
-{
-	struct list *tmp, *qmh;
-	struct queued_reply *qm;
-	int msgs=0;
-
-	poll_dispatch_delete(handle, con->fd);
-	close(con->fd);
-	if (con->type == CON_CLIENT)
-		list_del(&con->list);
-
-	unbind_con(con);
-	remove_barriers(con);
-
-	list_iterate_safe(qmh, tmp, &con->write_msgs) {
-		qm = list_item(qmh, struct queued_reply);
-
-		list_del(&qm->list);
-		free(qm);
-		msgs++;
-	}
-
-	P_DAEMON("Freed %d queued messages\n", msgs);
-	free(con);
-	num_connections--;
-}
-
-/* Send as many as we can */
-static void send_queued_reply(struct connection *con)
-{
-	struct queued_reply *qm;
-	struct sock_header *msg;
-	struct list *tmp, *qmh;
-	int ret;
-
-	list_iterate_safe(qmh, tmp, &con->write_msgs) {
-		qm = list_item(qmh, struct queued_reply);
-		msg = (struct sock_header *)qm->buf;
-		ret = send(con->fd, qm->buf + qm->offset, msg->length - qm->offset, MSG_DONTWAIT);
-		if (ret == msg->length - qm->offset)
-		{
-			list_del(&qm->list);
-			free(qm);
-			con->num_write_msgs--;
-		}
-		else
-		{
-			if (ret > 0)
-				qm->offset += ret;
-			break;
-		}
-	}
-	if (list_empty(&con->write_msgs)) {
-		/* Remove POLLOUT callback */
-		P_DAEMON("Removing POLLOUT from fd %d\n", con->fd);
-		poll_dispatch_modify(ais_poll_handle, con->fd, POLLIN, process_client);
-	}
-}
-
-/* Dispatch a request from a CLIENT or ADMIN socket */
-static int process_client(poll_handle handle, int fd, int revent, void *data)
-{
-	struct connection *con = data;
-
-	if (revent == POLLOUT) {
-		send_queued_reply(con);
-	} else {
-		char buf[MAX_CLUSTER_MESSAGE + sizeof(struct sock_header)];
-		struct sock_header *msg = (struct sock_header *)buf;
-		int len;
-		int totallen = 0;
-
-		memset(buf, 0, (MAX_CLUSTER_MESSAGE + sizeof(struct sock_header)));
-
-		len = read(fd, buf, sizeof(struct sock_header));
-
-		P_DAEMON("read %d bytes from fd %d\n", len, fd);
-
-		if (len == 0) {
-			remove_client(handle, con);
-			return -1;
-		}
-
-		if (len < 0 &&
-		    (errno == EINTR || errno == EAGAIN))
-			return 0;
-
-		if (len < 0) {
-			remove_client(handle, con);
-			return 0;
-		}
-
-		if (msg->magic != CMAN_MAGIC) {
-			P_DAEMON("bad magic in client command %x\n", msg->magic);
-			send_status_return(con, msg->command, -EINVAL);
-			return 0;
-		}
-		if (msg->version != CMAN_VERSION) {
-			P_DAEMON("bad version in client command. msg = 0x%x, us = 0x%x\n", msg->version, CMAN_VERSION);
-			send_status_return(con, msg->command, -EINVAL);
-			return 0;
-		}
-		if ((msg->length-len) > MAX_CLUSTER_MESSAGE) {
-			P_DAEMON("message on socket is too big\n");
-			send_status_return(con, msg->command, -EINVAL);
-			return 0;
-		}
-
-		totallen = len;
-
-		/* Read the rest */
-		while (totallen != msg->length) {
-			len = read(fd, buf+len, msg->length-len);
-			if (len == 0)
-				return -1;
-
-			if (len < 0 &&
-			    (errno == EINTR || errno == EAGAIN))
-				return 0;
-
-			if (len < 0) {
-				remove_client(handle, con);
-				return -1;
-			}
-			totallen += len;
-		}
-
-		P_DAEMON("client command is %x\n", msg->command);
-
-		/* Privileged functions can only be done on ADMIN sockets */
-		if (msg->command & CMAN_CMDFLAG_PRIV && con->type != CON_ADMIN) {
-			P_DAEMON("command disallowed from non-admin client\n");
-			send_status_return(con, msg->command, -EPERM);
-			return 0;
-		}
-
-		/* Slightly arbitrary this one, don't allow ADMIN sockets to
-		   send/receive data. The main loop doesn't keep a backlog queue
-		   of messages for ADMIN sockets
-		*/
-		if ((msg->command == CMAN_CMD_DATA || msg->command == CMAN_CMD_BIND ||
-		     msg->command == CMAN_CMD_NOTIFY) && con->type == CON_ADMIN) {
-			P_DAEMON("can't send data down an admin socket, sorry\n");
-			send_status_return(con, msg->command, -EINVAL);
-			return 0;
-		}
-
-		if (msg->command == CMAN_CMD_DATA) {
-			char *buf = (char *)msg;
-			int ret;
-			uint8_t port;
-			struct sock_data_header *dmsg = (struct sock_data_header *)msg;
-
-			P_DAEMON("sending %lu bytes of data to node %d, port %d\n",
-				 (unsigned long)(msg->length - sizeof(struct sock_data_header)), dmsg->nodeid, dmsg->port);
-
-			buf += sizeof(struct sock_data_header);
-
-			if (dmsg->port > 255) {
-				send_status_return(con, msg->command, -EINVAL);
-				return 0;
-			}
-
-			if (dmsg->port)
-				port = dmsg->port;
-			else
-				port = con->port;
-
-			ret = comms_send_message(buf, msg->length - sizeof(struct sock_data_header),
-						 port, con->port,
-						 dmsg->nodeid,
-						 msg->flags);
-			if (ret) {
-				send_status_return(con, msg->command, -EIO);
-			}
-		}
-		else {
-			char *cmdbuf = (char *)msg;
-			char small_retbuf[1024]; /* Enough for most needs */
-			char *retbuf = small_retbuf;
-			struct sock_reply_header *reply;
-			int ret;
-			int retlen = 0;
-
-			P_DAEMON("About to process command\n");
-
-			cmdbuf += sizeof(struct sock_header);
-
-			ret = process_command(con, msg->command, cmdbuf,
-					      &retbuf, &retlen, sizeof(small_retbuf),
-					      sizeof(struct sock_reply_header));
-
-			/* Reply message will come later on */
-			if (ret == -EWOULDBLOCK)
-				return 0;
-
-			reply = (struct sock_reply_header *)retbuf;
-
-			reply->header.magic = CMAN_MAGIC;
-			reply->header.flags = 0;
-			reply->header.command = msg->command | CMAN_CMDFLAG_REPLY;
-			reply->header.length = retlen + sizeof(struct sock_reply_header);
-			reply->status = ret;
-
-			P_DAEMON("Returning command data. length = %d\n", retlen);
-			send_reply_message(con, (struct sock_header *)reply);
-
-			if (retbuf != small_retbuf)
-				free(retbuf);
-		}
-	}
-	return 0;
-}
-
-
-/* Both client and admin rendezvous sockets use this */
-static int process_rendezvous(poll_handle handle, int fd, int revent, void *data)
-{
-	struct sockaddr_un socka;
-	struct connection *con = data;
-	socklen_t sl = sizeof(socka);
-	int client_fd;
-
-	client_fd = accept(fd, (struct sockaddr *) &socka, &sl);
-	if (client_fd >= 0) {
-		struct connection *newcon = malloc(sizeof(struct connection));
-		if (!newcon) {
-			close(client_fd);
-			return 0; /* returning -1 will remove us */
-		}
-
-		newcon->fd = client_fd;
-		newcon->type = con->type;
-		newcon->port = 0;
-		newcon->events = 0;
-		newcon->num_write_msgs = 0;
-		list_init(&newcon->write_msgs);
-		fcntl(client_fd, F_SETFL, fcntl(client_fd, F_GETFL, 0) | O_NONBLOCK);
-
-		poll_dispatch_add(handle, client_fd, POLLIN, newcon, process_client);
-		num_connections++;
-		if (newcon->type == CON_CLIENT)
-			list_add(&client_list, &newcon->list);
-	}
-	return 0;
-}
-
-static int open_local_sock(const char *name, int name_len, mode_t mode, poll_handle handle, int type)
-{
-	int local_socket;
-	struct sockaddr_un sockaddr;
-	struct connection *con;
-
-	/* Open local socket */
-	if (name[0] != '\0')
-		unlink(name);
-	local_socket = socket(PF_UNIX, SOCK_STREAM, 0);
-	if (local_socket < 0) {
-		log_printf(LOG_ERR, "Can't create local socket %s: %s\n", name, strerror(errno));
-		write_cman_pipe("Can't create local cman socket");
-		return -1;
-	}
-	/* Set Close-on-exec */
-	fcntl(local_socket, F_SETFD, 1);
-	fcntl(local_socket, F_SETFL, fcntl(local_socket, F_GETFL, 0) | O_NONBLOCK);
-
-	memset(&sockaddr, 0, sizeof(sockaddr));
-	memcpy(sockaddr.sun_path, name, name_len);
-	sockaddr.sun_family = AF_UNIX;
-	if (bind(local_socket, (struct sockaddr *) &sockaddr, sizeof(sockaddr))) {
-		log_printf(LOG_ERR, "can't bind local socket to %s: %s\n", name, strerror(errno));
-		write_cman_pipe("Can't bind to local cman socket");
-		close(local_socket);
-		return -1;
-	}
-	if (listen(local_socket, 1) != 0) {
-		log_printf(LOG_ERR, "listen on %s failed: %s\n", name, strerror(errno));
-		write_cman_pipe("listen failed on local cman socket");
-		close(local_socket);
-		return -1;
-	}
-	if (name[0] != '\0')
-		chmod(name, mode);
-
-
-	con = malloc(sizeof(struct connection));
-	if (!con) {
-		log_printf(LOG_ERR, "Can't allocate space for local connection: %s\n", strerror(errno));
-		write_cman_pipe("malloc failed for connection info");
-		close(local_socket);
-		return -1;
-	}
-	con->type = type;
-	con->fd = local_socket;
-	con->num_write_msgs = 0;
-
-	poll_dispatch_add(handle, con->fd, POLLIN, con, process_rendezvous);
-
-	return 0;
-}
-
-
-
-/* Send a simple return - usually just a failure status */
-int send_status_return(struct connection *con, uint32_t cmd, int status)
-{
-	struct sock_reply_header msg;
-
-	P_DAEMON("send status return: %d\n", status);
-	msg.header.magic = CMAN_MAGIC;
-	msg.header.command = cmd | CMAN_CMDFLAG_REPLY;
-	msg.header.length = sizeof(msg);
-	msg.header.flags = 0;
-	msg.status = status;
-
-	return send_reply_message(con, (struct sock_header *)&msg);
-}
-
-int send_data_reply(struct connection *con, int nodeid, int port, char *data, int len)
-{
-	char buf[len + sizeof(struct sock_data_header)];
-	struct sock_data_header *msg = (struct sock_data_header *)buf;
-
-	msg->header.magic = CMAN_MAGIC;
-	msg->header.command = CMAN_CMD_DATA | CMAN_CMDFLAG_REPLY;
-	msg->header.length = sizeof(*msg)+len;
-	msg->header.flags = 0;
-	msg->nodeid = nodeid;
-	msg->port = port;
-
-	memcpy(buf+sizeof(struct sock_data_header), data, len);
-	return send_reply_message(con, (struct sock_header *)msg);
-}
-
-/* This can be called by the membership thread as well as the daemon thread. */
-void notify_listeners(struct connection *con, int event, int arg)
-{
-	struct sock_event_message msg;
-	struct connection *thiscon;
-
-	msg.header.magic = CMAN_MAGIC;
-	msg.header.command = CMAN_CMD_EVENT;
-	msg.header.length = sizeof(msg);
-	msg.header.flags = 0;
-	msg.reason = event;
-	msg.arg = arg;
-
-	/* Unicast message */
-	if (con) {
-		send_reply_message(con, (struct sock_header *)&msg);
-		return;
-	}
-
-	/* Broadcast message */
-	list_iterate_items(thiscon, &client_list) {
-		if (thiscon->events)
-			send_reply_message(thiscon, (struct sock_header *)&msg);
-	}
-}
-
-void notify_confchg(struct sock_header *message)
-{
-	struct connection *thiscon;
-
-	list_iterate_items(thiscon, &client_list) {
-		if (thiscon->confchg)
-			send_reply_message(thiscon, message);
-	}
-}
-
-void wake_daemon(void)
-{
-	P_DAEMON("Wake daemon called\n");
-}
-
-
-int num_listeners(void)
-{
-	int count = 0;
-	struct connection *thiscon;
-
-	list_iterate_items(thiscon, &client_list) {
-		thiscon->shutdown_reply = SHUTDOWN_REPLY_UNK; /* Clear out for new shutdown request */
-		if (thiscon->events)
-			count++;
-	}
-	return count;
-}
-
-static void sigint_handler(int ignored)
-{
-	quit_threads = 1;
-}
-
-extern poll_handle aisexec_poll_handle;
-int cman_init()
-{
-	int fd;
-	struct sigaction sa;
-
-	ais_poll_handle = aisexec_poll_handle;
-	barrier_init();
-
-	log_printf(LOG_INFO, "CMAN %s (built %s %s) started\n",
-		   RELEASE_VERSION, __DATE__, __TIME__);
-
-	fd = open_local_sock(CLIENT_SOCKNAME, sizeof(CLIENT_SOCKNAME), 0660, ais_poll_handle, CON_CLIENT);
-	if (fd < 0)
-		return -2;
-
-	fd = open_local_sock(ADMIN_SOCKNAME, sizeof(ADMIN_SOCKNAME), 0600, ais_poll_handle, CON_ADMIN);
-	if (fd < 0)
-		return -2;
-
-	/* Shutdown trap */
-	sa.sa_handler = sigint_handler;
-	sigaction(SIGINT, &sa, NULL);
-	sigaction(SIGTERM, &sa, NULL);
-
-	sa.sa_handler = SIG_IGN;
-	sigaction(SIGPIPE, &sa, NULL);
-
-	return 0;
-}
-
-int cman_finish()
-{
-	/* Stop */
-	unlink(CLIENT_SOCKNAME);
- 	unlink(ADMIN_SOCKNAME);
-
-	return 0;
-}
-
diff --git a/cman/daemon/daemon.h b/cman/daemon/daemon.h
deleted file mode 100644
index 6907de3..0000000
--- a/cman/daemon/daemon.h
+++ /dev/null
@@ -1,12 +0,0 @@
-extern int send_status_return(struct connection *con, uint32_t cmd, int status);
-extern int send_data_reply(struct connection *con, int nodeid, int port, char *data, int len);
-extern void set_cman_timeout(int secs);
-extern void notify_listeners(struct connection *con, int reason, int arg);
-extern int num_listeners(void);
-extern void cman_set_realtime(void);
-extern int cman_init(void);
-extern int cman_finish(void);
-extern void notify_confchg(struct sock_header *message);
-
-extern volatile sig_atomic_t quit_threads;
-extern int num_connections;
diff --git a/cman/daemon/list.h b/cman/daemon/list.h
deleted file mode 100644
index aaee167..0000000
--- a/cman/daemon/list.h
+++ /dev/null
@@ -1,97 +0,0 @@
-#ifndef _LVM_LIST_H
-#define _LVM_LIST_H
-
-#include <assert.h>
-
-struct list {
-	struct list *n, *p;
-};
-
-#define LIST_INIT(name)	struct list name = { &(name), &(name) }
-
-static inline void list_init(struct list *head)
-{
-	head->n = head->p = head;
-}
-
-static inline void list_add(struct list *head, struct list *elem)
-{
-	assert(head->n);
-
-	elem->n = head;
-	elem->p = head->p;
-
-	head->p->n = elem;
-	head->p = elem;
-}
-
-static inline void list_add_h(struct list *head, struct list *elem)
-{
-	assert(head->n);
-
-	elem->n = head->n;
-	elem->p = head;
-
-	head->n->p = elem;
-	head->n = elem;
-}
-
-static inline void list_del(struct list *elem)
-{
-	elem->n->p = elem->p;
-	elem->p->n = elem->n;
-}
-
-static inline int list_empty(struct list *head)
-{
-	return head->n == head;
-}
-
-static inline int list_end(struct list *head, struct list *elem)
-{
-	return elem->n == head;
-}
-
-static inline struct list *list_next(struct list *head, struct list *elem)
-{
-	return (list_end(head, elem) ? NULL : elem->n);
-}
-
-#define list_item(v, t) \
-    ((t *)((uintptr_t)(v) - (uintptr_t)&((t *) 0)->list))
-
-#define list_struct_base(v, t, h) \
-    ((t *)((uintptr_t)(v) - (uintptr_t)&((t *) 0)->h))
-
-/* Given a known element in a known structure, locate another */
-#define struct_field(v, t, e, f) \
-    (((t *)((uintptr_t)(v) - (uintptr_t)&((t *) 0)->e))->f)
-
-/* Given a known element in a known structure, locate the list head */
-#define list_head(v, t, e) struct_field(v, t, e, list)
-
-#define list_iterate(v, head) \
-	for (v = (head)->n; v != head; v = v->n)
-
-#define list_uniterate(v, head, start) \
-	for (v = (start)->p; v != head; v = v->p)
-
-#define list_iterate_safe(v, t, head) \
-	for (v = (head)->n, t = v->n; v != head; v = t, t = v->n)
-
-#define list_iterate_items(v, head) \
-	for (v = list_item((head)->n, typeof(*v)); &v->list != (head); \
-	     v = list_item(v->list.n, typeof(*v)))
-
-static inline unsigned int list_size(const struct list *head)
-{
-	unsigned int s = 0;
-	const struct list *v;
-
-	list_iterate(v, head)
-	    s++;
-
-	return s;
-}
-
-#endif
diff --git a/cman/daemon/logging.c b/cman/daemon/logging.c
deleted file mode 100644
index ad3359f..0000000
--- a/cman/daemon/logging.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <stdarg.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdint.h>
-#include <signal.h>
-#include <time.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-
-#include <corosync/engine/logsys.h>
-#include "list.h"
-#include "cman.h"
-#include "cnxman-socket.h"
-#include "cnxman-private.h"
-#include "logging.h"
-
-LOGSYS_DECLARE_SUBSYS (CMAN_NAME, LOG_INFO);
-
-int subsys_mask = 0;
-
-void set_debuglog(int subsystems)
-{
-	subsys_mask = subsystems;
-}
diff --git a/cman/daemon/logging.h b/cman/daemon/logging.h
deleted file mode 100644
index 23ecb90..0000000
--- a/cman/daemon/logging.h
+++ /dev/null
@@ -1,17 +0,0 @@
-//#include <corosync/service/logsys.h>
-
-extern void set_debuglog(int subsystems);
-
-/* Debug macros */
-#define CMAN_DEBUG_NONE    1
-#define CMAN_DEBUG_BARRIER 2
-#define CMAN_DEBUG_MEMB    4
-#define CMAN_DEBUG_DAEMON  8
-#define CMAN_DEBUG_AIS    16
-
-extern int subsys_mask;
-
-#define P_BARRIER(fmt, args...) if (subsys_mask & CMAN_DEBUG_BARRIER) log_printf(LOG_LEVEL_DEBUG, "barrier: " fmt, ## args)
-#define P_MEMB(fmt, args...)    if (subsys_mask & CMAN_DEBUG_MEMB) log_printf(LOG_LEVEL_DEBUG, "memb: " fmt, ## args)
-#define P_DAEMON(fmt, args...)  if (subsys_mask & CMAN_DEBUG_DAEMON) log_printf(LOG_LEVEL_DEBUG , "daemon: " fmt, ## args)
-#define P_AIS(fmt, args...)     if (subsys_mask & CMAN_DEBUG_AIS) log_printf(LOG_LEVEL_DEBUG, "ais " fmt, ## args)
diff --git a/cman/daemon/nodelist.h b/cman/daemon/nodelist.h
deleted file mode 100644
index 02dfe17..0000000
--- a/cman/daemon/nodelist.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* These just make the access a little neater */
-static inline int objdb_get_string(OBJDB_API *corosync, unsigned int object_service_handle,
-				   char *key, char **value)
-{
-	int res;
-
-	*value = NULL;
-	if ( !(res = corosync->object_key_get(object_service_handle,
-					      key,
-					      strlen(key),
-					      (void *)value,
-					      NULL))) {
-		if (*value)
-			return 0;
-	}
-	return -1;
-}
-
-static inline void objdb_get_int(OBJDB_API *corosync, unsigned int object_service_handle,
-				 char *key, unsigned int *intvalue, unsigned int default_value)
-{
-	char *value = NULL;
-
-	*intvalue = default_value;
-
-	if (!corosync->object_key_get(object_service_handle, key, strlen(key),
-				 (void *)&value, NULL)) {
-		if (value) {
-			*intvalue = atoi(value);
-		}
-	}
-}
-
-
-/* Helper functions for navigating the nodes list */
-static inline unsigned int nodeslist_init(OBJDB_API *corosync,
-					  unsigned int cluster_parent_handle,
-					  unsigned int *find_handle)
-{
-	unsigned int object_handle;
-	unsigned int find_handle1;
-	unsigned int find_handle2;
-
-	corosync->object_find_create(cluster_parent_handle,"clusternodes", strlen("clusternodes"), &find_handle1);
-	if (corosync->object_find_next(find_handle1, &object_handle) == 0)
-	{
-		unsigned int nodes_handle;
-		corosync->object_find_destroy(find_handle1);
-
-		corosync->object_find_create(object_handle,"clusternode", strlen("clusternode"), &find_handle2);
-
-		if (corosync->object_find_next(find_handle2, &nodes_handle) == 0)
-		{
-			*find_handle = find_handle2;
-			return nodes_handle;
-		}
-	}
-	return 0;
-}
-
-static inline unsigned int nodeslist_next(OBJDB_API *corosync, unsigned int find_handle)
-{
-	unsigned int nodes_handle;
-
-	if (corosync->object_find_next(find_handle, &nodes_handle) == 0)
-		return nodes_handle;
-	else
-		return 0;
-}
-
-static inline unsigned int nodelist_byname(OBJDB_API *corosync,
-					   unsigned int cluster_parent_handle,
-					   char *name)
-{
-	char *nodename;
-	unsigned int nodes_handle;
-	unsigned int find_handle = 0;
-
-	nodes_handle = nodeslist_init(corosync, cluster_parent_handle, &find_handle);
-	while (nodes_handle) {
-		if (objdb_get_string(corosync, nodes_handle, "name", &nodename)) {
-			nodes_handle = nodeslist_next(corosync, find_handle);
-			continue;
-		}
-		if (strcmp(nodename, name) == 0)
-			return nodes_handle;
-
-		nodes_handle = nodeslist_next(corosync, find_handle);
-	}
-	corosync->object_find_destroy(find_handle);
-
-	return 0;
-}
diff --git a/cman/init.d/Makefile b/cman/init.d/Makefile
deleted file mode 100644
index 8683c81..0000000
--- a/cman/init.d/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-TARGET1=cman
-TARGET2=qdiskd
-
-INITDT=$(TARGET1) $(TARGET2)
-
-all: $(TARGET1) $(TARGET2)
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-$(TARGET1): $(S)/$(TARGET1).in
-	cat $(S)/$(TARGET1).in | sed \
-		-e 's#@SBINDIR@#${sbindir}#g' \
-		-e 's#@INITDDIR@#${initddir}#g' \
-	> $(TARGET1)
-
-$(TARGET2): $(S)/$(TARGET2).in
-	cat $(S)/$(TARGET2).in | sed \
-		-e 's#@SBINDIR@#${sbindir}#g' \
-		-e 's#@INITDDIR@#${initddir}#g' \
-	> $(TARGET2)
-
-clean: generalclean
diff --git a/cman/init.d/cman.in b/cman/init.d/cman.in
deleted file mode 100644
index 7d366fb..0000000
--- a/cman/init.d/cman.in
+++ /dev/null
@@ -1,712 +0,0 @@
-#!/bin/bash
-#
-# cman - Cluster Manager init script
-#
-# chkconfig: - 21 79
-# description: Starts and stops cman
-#
-#
-### BEGIN INIT INFO
-# Provides:		cman
-# Required-Start:	$network $time
-# Required-Stop:	$network $time
-# Default-Start:
-# Default-Stop:
-# Short-Description:	Starts and stops cman
-# Description:		Starts and stops the Cluster Manager set of daemons
-### END INIT INFO
-
-# rpm based distros
-if [ -d /etc/sysconfig ]; then
-	[ -f @INITDDIR@/functions ] && . @INITDDIR@/functions
-	[ -f /etc/sysconfig/cluster ] && . /etc/sysconfig/cluster
-	[ -f /etc/sysconfig/cman ] && . /etc/sysconfig/cman
-	[ -z "$LOCK_FILE" ] && LOCK_FILE="/var/lock/subsys/cman"
-	chkconfig=/sbin/chkconfig
-	success=success
-	failure=failure
-	status=status
-fi
-
-# deb based distros
-if [ -d /etc/default ]; then
-	[ -f /etc/default/cluster ] && . /etc/default/cluster
-	[ -f /etc/default/cman ] && . /etc/default/cman
-	[ -z "$LOCK_FILE" ] && LOCK_FILE="/var/lock/cman"
-	# deb based distros can have chkconfig installed. Use it if installed
-	# otherwire use our local wrapper.
-	[ -n "$(which chkconfig)" ] && chkconfig="$(which chkconfig)"
-	[ -z "$chkconfig" ] && chkconfig=local_chkconfig
-	success=local_success
-	failure=local_failure
-	# functions in rpm based distro implements a very complete version
-	# of pidof. For now we can live with this.
-	status=local_status
-fi
-
-[ -z "$CCSD_OPTS" ] && CCSD_OPTS=
-
-# CMAN_CLUSTER_TIMEOUT -- amount of time to wait for joinging a cluster
-#     before giving up.  If CMAN_CLUSTER_TIMEOUT is positive, then we will
-#     wait CMAN_CLUSTER_TIMEOUT seconds before giving up and failing when
-#     a cluster is not joined.  If CMAN_CLUSTER_TIMEOUT is zero, then
-#     wait indefinately for a cluster join.  If CMAN_CLUSTER_TIMEOUT is
-#     negative, do not check to see that the cluster has been joined
-[ -z "$CMAN_CLUSTER_TIMEOUT" ] && CMAN_CLUSTER_TIMEOUT=120
-
-# CMAN_QUORUM_TIMEOUT -- amount of time to wait for a quorate cluster on 
-#     startup quorum is needed by many other applications, so we may as 
-#     well wait here.  If CMAN_QUORUM_TIMEOUT is less than 1, quorum will 
-#     be ignored.
-[ -z "$CMAN_QUORUM_TIMEOUT" ] && CMAN_QUORUM_TIMEOUT=0
-
-# CMAN_SHUTDOWN_TIMEOUT -- amount of time to wait for cman to become a 
-#     cluster member before calling cman_tool leave during shutdown.  
-#     The default is 60 seconds
-[ -z "$CMAN_SHUTDOWN_TIMEOUT" ] && CMAN_SHUTDOWN_TIMEOUT=60
-
-# FENCED_START_TIMEOUT -- amount of time to wait for starting fenced
-#     before giving up.  If FENCED_START_TIMEOUT is positive, then we will
-#     wait FENCED_START_TIMEOUT seconds before giving up and failing when
-#     fenced does not start.  If FENCED_START_TIMEOUT is zero, then
-#     wait indefinately for fenced to start.
-[ -z "$FENCED_START_TIMEOUT" ] && FENCED_START_TIMEOUT=300
-
-# NET_RMEM_DEFAULT -- minimum value for rmem_default. If this is set
-# higher elsewhere it will not be reduced here.
-# These two values are only really needed for the DLM when using sctp
-# but do no harm.
-[ -z "$NET_RMEM_DEFAULT" ] && NET_RMEM_DEFAULT=4194304
-
-# NET_RMEM_MAX -- minimum value for rmem_max. If this is set
-# higher elsewhere it will not be reduced here.
-[ -z "$NET_RMEM_MAX" ] && NET_RMEM_MAX=4194304
-
-# FENCED_MEMBER_DELAY -- amount of time to delay fence_tool join to allow
-#     all nodes in cluster.conf to become cluster members.  In seconds.
-[ -z "$FENCED_MEMBER_DELAY" ] && FENCED_MEMBER_DELAY=45
-
-# FENCE_JOIN -- boolean value used to control whether or not this node
-#     should join the fence domain. If FENCE_JOIN is set to "no", then
-#     the script will not attempt to the fence domain. If FENCE_JOIN is
-#     set to "yes", then the script will attempt to join the fence domain.
-#     If FENCE_JOIN is set to any other value, the default behavior is
-#     to join the fence domain (equivalent to "yes").
-[ -z "$FENCE_JOIN" ] && FENCE_JOIN="yes"
-
-# NETWORK_BRIDGE_SCRIPT -- script to use for xen network bridging.
-#     This script must exist in the /etc/xen/scripts directory.
-#     The default script is "network-bridge".
-[ -z "$NETWORK_BRIDGE_SCRIPT" ] && NETWORK_BRIDGE_SCRIPT="network-bridge"
-
-[ -n "$CLUSTERNAME" ] && cman_join_opts="-c $CLUSTERNAME"
-
-[ -n "$NODENAME" ] && cman_join_opts+=" -n $NODENAME"
-
-# CONFIG_LOADER -- select default config parser.
-# This can be:
-# xmlconfig       - read directly from cluster.conf and use ricci as default config
-#                   propagation method. (default)
-# ldapconfig      - read configuration from an ldap server.
-#                   Requires: LDAP_URL or/and LDAP_BASEDN envvar to be set.
-#                   LDAP_BINDDN and LDAP_BINDPWD have to be either both set or both unset.
-# corosync_parser - use internal corosync config file parser.
-# openaisparser   - use internal openais config file parser.
-[ -n "$CONFIG_LOADER" ] && cman_join_opts+=" -C $CONFIG_LOADER"
-
-local_chkconfig()
-{
-    ls /etc/rc${2}.d/S*${3} > /dev/null 2>/dev/null
-    return $?
-}
-
-local_success()
-{
-    echo -ne "[  OK  ]\r"
-}
-
-local_failure()
-{
-    echo -ne "[FAILED]\r"
-}
-
-local_status()
-{
-    pid=$(pidof $1 2>/dev/null)
-    rtrn=$?
-    if [ $rtrn -ne 0 ]; then
-	echo "$1 is stopped"
-    else
-	echo "$1 (pid $pid) is running..."
-    fi
-    return $rtrn
-}
-
-load_modules()
-{
-    errmsg=$( /sbin/modprobe configfs 2>&1 ) || return 1
-    errmsg=$( /sbin/modprobe dlm 2>&1 ) || return 1
-    errmsg=$( /sbin/modprobe lock_dlm 2>&1 ) || true
-    return 0
-}
-
-start_configfs()
-{
-    # configfs
-    awk '{ print $2 }' /etc/mtab | grep "/sys/kernel/config" > /dev/null 2>&1 \
-    && awk '{ print $3 }' /etc/mtab | grep "configfs" > /dev/null 2>&1
-    if [ $? -ne 0 ]
-    then
-	errmsg=$( /bin/mount -t configfs none /sys/kernel/config 2>&1 )
-	return $?
-    fi
-    return 0
-}
-
-start_cman()
-{
-    # cman
-    @SBINDIR@/cman_tool status > /dev/null 2>&1
-    if [ $? -ne 0 ]
-    then
-	case "$CONFIG_LOADER" in
-	    ldapconfig)
-		if [ -n "$LDAP_URL" ] || [ -n "$LDAP_BASEDN" ]; then
-		    if [ -n "$LDAP_BINDDN" ]; then
-			if [ -z "$LDAP_BINDPWD" ]; then
-			    errmsg="ldadconfig has been select but LDAP_BINDPWD is not set"
-			    return 1
-			fi
-		    fi
-		    if [ -n "$LDAP_BINDPWD" ]; then
-			if [ -z "$LDAP_BINDDN" ]; then
-			    errmsg="ldadconfig has been select but LDAP_BINDDN is not set"
-			    return 1
-			fi
-		    fi
-		else
-		    errmsg="ldadconfig has been select but neither LDAP_URL or LDAP_BASEDN have been set"
-		    return 1
-		fi
-		;;
-	    *)
-		# nothing to do for now
-		;;
-	esac
-	errmsg=$( @SBINDIR@/cman_tool -t $CMAN_CLUSTER_TIMEOUT -w join \
-	    $cman_join_opts 2>&1 ) || return 1
-
-	if [ $CMAN_QUORUM_TIMEOUT -gt 0 ]
-	then
-	    errmsg=$( @SBINDIR@/cman_tool -t $CMAN_QUORUM_TIMEOUT \
-		    -q wait 2>&1 ) || return 1
-	fi
-    fi
-    return 0
-}
-
-
-start_qdiskd()
-{
-    declare current_runlevel
-
-    current_runlevel=$(/sbin/runlevel 2>/dev/null | awk '{ print $2 }' 2>/dev/null)
-    #
-    # Start qdiskd before fenced to resolve bug #436381.  This only
-    # happens if qdiskd is configured to run in the runlevel we are in
-    #
-    $chkconfig --levels "$current_runlevel" qdiskd 2>/dev/null
-    if [ $? -ne 0 ]; then
-        # qdiskd doesn't start at this runlevel.
-        return 0
-    fi
-
-    echo -n "   Starting qdiskd... "
-    service qdiskd start > /dev/null 2>&1
-    if [ $? -eq 0 ] 
-    then
-	echo "done"
-    else
-	echo "failed"
-	return 1
-    fi
-    return 0
-}
-
-
-start_daemons()
-{
-    $status groupd > /dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	errmsg=$( @SBINDIR@/groupd 2>&1 ) || return 1
-    fi
-    $status fenced > /dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	errmsg=$( @SBINDIR@/fenced 2>&1 ) || return 1
-    fi
-    $status dlm_controld > /dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	errmsg=$( @SBINDIR@/dlm_controld 2>&1 ) || return 1
-    fi
-    $status gfs_controld > /dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	errmsg=$( @SBINDIR@/gfs_controld 2>&1 ) || return 1
-    fi
-    $status cmannotifyd > /dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	errmsg=$( @SBINDIR@/cmannotifyd 2>&1 ) || return 1
-    fi
-    return 0
-}
-
-start_fence()
-{
-    @SBINDIR@/cman_tool status | grep Flags | grep 2node > /dev/null 2>&1
-    if [ $? -ne 0 ]
-    then
-        errmsg=$( @SBINDIR@/fence_tool -w -t $FENCED_START_TIMEOUT join \
-                 > /dev/null 2>&1 ) || return 1
-    else
-        errmsg=$( @SBINDIR@/fence_tool -w -t $FENCED_START_TIMEOUT \
-                 -m $FENCED_MEMBER_DELAY join \
-                 > /dev/null 2>&1 ) || return 1
-    fi
-    return 0
-}
-
-start_fence_xvmd()
-{
-    $status fence_xvmd > /dev/null 2>&1
-    if [ $? -ne 0 ]; then
-	errmsg=$( @SBINDIR@/fence_xvmd $FENCE_XVMD_OPTS 2>&1 ) || return 1
-    fi
-    return 0
-}
-
-xend_bridged_net_enabled() {
-    # Not a xen kernel
-    test -d /proc/xen || return 1
-
-    current_runlevel=$(/sbin/runlevel 2>/dev/null | awk '{ print $2 }' 2>/dev/null)
-    if [ -z "$current_runlevel" ]; then
-        errmsg='Unable to determine the current runlevel'
-        return 1
-    fi
-
-    $chkconfig --levels "$current_runlevel" xend 2>/dev/null
-    if [ $? -ne 0 ]; then
-        # xend doesn't start at this runlevel.
-        return 1
-    fi
-
-    if [ ! -f /etc/xen/xend-config.sxp ]; then
-        # xend isn't configured to use bridged networking.
-        return 1
-    fi
-
-    egrep "^[[:blank:]]*\([[:blank:]]*network-script[[:blank:]]+(')?[[:blank:]]*${NETWORK_BRIDGE_SCRIPT}([[:blank:]]*\)|[[:blank:]]+)" /etc/xen/xend-config.sxp >&/dev/null
-    if [ $? -ne 0 ]; then
-        # xend isn't configured to use bridged networking.
-        return 1
-    fi
-    return 0
-}
-
-xend_bridged_net_start() {
-    if [ ! -x /etc/xen/scripts/${NETWORK_BRIDGE_SCRIPT} ]; then
-        if [ -f /etc/xen/scripts/${NETWORK_BRIDGE_SCRIPT} ]; then
-            errmsg='The xend bridged network script cannot be run'
-        else
-            errmsg='The xend bridged network script is missing'
-        fi
-        return 1
-    fi
-
-    /sbin/modprobe netbk >& /dev/null
-    /sbin/modprobe netloop >& /dev/null
-    bridge_parms=`egrep -m 1 "^[[:blank:]]*\([[:blank:]]*network-script[[:blank:]]+(')?[[:blank:]]*${NETWORK_BRIDGE_SCRIPT}([[:blank:]]*\)|[[:blank:]]+)" /etc/xen/xend-config.sxp| sed -r "s/^[[:blank:]]*\([[:blank:]]*network-script[[:blank:]]+'?[[:blank:]]*${NETWORK_BRIDGE_SCRIPT}[[:blank:]]*//; s/'?[[:blank:]]*\).*//"`
-    errmsg=$(/etc/xen/scripts/${NETWORK_BRIDGE_SCRIPT} start $bridge_parms 2>&1) || return 1
-    return 0
-}
-
-fence_xvmd_enabled()
-{
-    #
-    # Check the value of FENCE_JOIN.
-    # If FENCE_JOIN is set to "no", then we should disable fence_xvm.
-    #
-    if [ "$FENCE_JOIN" = "no" ]; then
-	return 1
-    fi
-
-    #
-    # Check for the 'xm' binary.  If it's not here, we are not
-    # running on a machine capable of running xvmd.
-    #
-    which xm > /dev/null 2>&1 || return 1
-
-    #
-    # Check for presence of /cluster/fence_xvmd in cluster.conf
-    # (If -X is specified, it doesn't matter if it's in cluster.conf;
-    #  we'll start it anyway since ccsd is not required)
-    #
-    @SBINDIR@/cman_tool status > /dev/null 2>&1
-    if [ $? -eq 0 ]
-    then
-	if [ "$FENCE_XVMD_OPTS" = "${FENCE_XVMD_OPTS/-X/}" ]; then
-		@SBINDIR@/ccs_tool query /cluster/fence_xvmd || return 1
-	fi
-    fi
-
-    return 0
-}
-
-set_networking_params()
-{
-    if [ ! -f  /proc/sys/net/core/rmem_default ]
-    then
-	return 0;
-    fi
-   
-    value="$(cat /proc/sys/net/core/rmem_default)"
-    if [ $value -le $NET_RMEM_DEFAULT ]
-    then
-	echo $NET_RMEM_DEFAULT > /proc/sys/net/core/rmem_default
-    fi
-    
-    value="$(cat /proc/sys/net/core/rmem_max)"
-    if [ $value -le $NET_RMEM_MAX ]
-        then
-        echo $NET_RMEM_MAX > /proc/sys/net/core/rmem_max
-    fi
-}
-
-fence_join_enabled()
-{
-    #
-    # Check the value of FENCE_JOIN.
-    # If FENCE_JOIN is set to "no", we will not attempt to join
-    # the fence domain. If FENCE_JOIN is set to any other value,
-    # we will attempt to join the fence domain (default).
-    #
-    if [ "$FENCE_JOIN" = "no" ]; then
-	return 1
-    else
-	return 0
-    fi
-}
-
-start()
-{
-    echo "Starting cluster: "
-
-    xend_bridged_net_enabled
-    if [ $? -eq 0 ]
-    then
-        echo -n "   Enabling workaround for Xend bridged networking... "
-        xend_bridged_net_start
-        if [ $? -eq 0 ] 
-        then
-            echo "done"
-        else
-            echo "failed: $errmsg"
-			return 1
-        fi
-    fi
-
-    echo -n "   Loading modules... "
-    ulimit -c unlimited
-    load_modules
-    if [ $? -eq 0 ] 
-    then
-	echo "done"
-    else
-	echo "failed"
-	return 1
-    fi
-
-    echo -n "   Mounting configfs... "
-    start_configfs
-    if [ $? -eq 0 ] 
-    then
-	echo "done"
-    else
-	echo "failed"
-	return 1
-    fi	
-
-    echo -n "   Setting network parameters... "
-    set_networking_params
-    if [ $? -eq 0 ] 
-    then
-	echo "done"
-    else
-	echo "failed"
-	return 1
-    fi
-
-    echo -n "   Starting cman... "
-    start_cman
-    if [ $? -eq 0 ] 
-    then
-	echo "done"
-    else
-	echo "failed"
-	return 1
-    fi
-
-    start_qdiskd
-
-    echo -n "   Starting daemons... "
-    start_daemons
-    if [ $? -eq 0 ] 
-    then
-	echo "done"
-    else
-	echo "failed"
-	return 1
-    fi
-
-    if fence_join_enabled; then
-	echo -n "   Starting fencing... "
-	start_fence
-	if [ $? -eq 0 ] 
-	    then
-	    echo "done"
-	else
-	    echo "failed"
-	    return 1
-	fi
-    fi
-
-    if fence_xvmd_enabled; then
-	echo -n "   Starting virtual machine fencing host... "
-	start_fence_xvmd
-	if [ $? -eq 0 ]
-	then
-	    echo "done"
-	else
-	    echo "failed"
-	return 1
-	fi
-    fi
-    
-    return 0
-}
-
-stop_configfs()
-{
-    awk '{ print $2 }' /etc/mtab | grep "/sys/kernel/config" > /dev/null 2>&1 \
-    && awk '{ print $3 }' /etc/mtab | grep "configfs" > /dev/null 2>&1
-    if [ $? -eq 0 ] && [ -z "$(ls -1 /sys/kernel/config)" ]
-    then
-	errmsg=$( /bin/umount /sys/kernel/config 2>&1 )
-	if [ $? -ne 0 ]
-	then
-	    echo -n $errmsg " "
-	fi
-    fi
-    return 0
-}
-
-stop_cman()
-{
-    @SBINDIR@/cman_tool status > /dev/null 2>&1
-    if [ $? -eq 0 ]
-    then
-    errmsg=$( @SBINDIR@/cman_tool -t $CMAN_SHUTDOWN_TIMEOUT \
-	    -w leave $1 2>&1 ) || return 1
-    fi
-    return 0 # all ok
-}
-
-stop_daemons()
-{
-    if pid=$(pidof gfs_controld 2>&1); then
-	errmsg=$(kill $pid 2>&1) || return 1
-    fi
-    if pid=$(pidof dlm_controld 2>&1); then
-	errmsg=$(kill $pid 2>&1) || return 1
-    fi
-    if pid=$(pidof fenced 2>&1); then
-	errmsg=$(kill $pid 2>&1) || return 1
-    fi
-    if pid=$(pidof groupd 2>&1); then
-	errmsg=$(kill $pid 2>&1) || return 1
-    fi
-    return 0 # all ok
-}
-
-stop_cmannotifyd()
-{
-    if pid=$(pidof cmannotifyd 2>&1); then
-	errmsg=$(kill $pid 2>&1) || return 1
-    fi
-    return 0
-}
-
-stop_fence()
-{
-    if pidof fenced > /dev/null 2>&1
-    then
-	@SBINDIR@/fence_tool -w leave > /dev/null 2>&1
-	rtrn=$?
-	sleep 1 # A bit of time for fenced to exit
-	return $rtrn
-    fi
-    return 0 # all ok
-}
-
-stop_fence_xvmd()
-{
-    if pidof fence_xvmd > /dev/null 2>&1
-    then
-    	pkill -TERM fence_xvmd
-	sleep 1 # A bit of time for fenced to exit
-    fi
-    
-    [ -z "$(pidof fence_xvmd)" ]
-    return $?
-}
-
-stop()
-{
-    echo "Stopping cluster: "
-
-    if fence_xvmd_enabled; then
-	echo -n "   Stopping virtual machine fencing host... "
-	stop_fence_xvmd
-	if [ $? -eq 0 ]
-	then
-	    echo "done"
-	else
-	    echo "failed"
-	    return 1
-	fi
-    fi
-
-    if fence_join_enabled; then
-	echo -n "   Stopping fencing... "
-	stop_fence
-	if [ $? -eq 0 ]
-	    then
-	    echo "done"
-	else
-	    echo "failed"
-	    return 1
-	fi
-    fi
-
-    echo -n "   Stopping cman... "
-    if [ $1 ]; then
-	stop_cman $1
-    else
-	stop_cman
-    fi
-    if [ $? -eq 0 ]
-    then
-	echo "done"
-    else
-	echo "failed"
-	return 1
-    fi
-
-    echo -n "   Stopping cmannotifyd... "
-    stop_cmannotifyd
-    if [ $? -eq 0 ]
-    then
-	echo "done"
-    else
-	echo "failed"
-	return 1
-    fi
-
-#   stop_daemons
-#   [ $? -ne 0 ] && return 1
-
-    echo -n "   Unmounting configfs... "
-    stop_configfs
-    if [ $? -eq 0 ]
-    then
-	echo "done"
-    else
-	echo "failed"
-	return 1
-    fi
-
-    return 0
-}
-
-cmanstatus()
-{
-	errmsg=$( $status groupd 2>&1) || return 1
-	errmsg=$( $status fenced 2>&1) || return 1
-	errmsg=$( $status dlm_controld 2>&1) || return 1
-	errmsg=$( $status gfs_controld 2>&1) || return 1
-	errmsg=$( $status cmannotifyd 2>&1) || return 1
-
-	fence_xvmd_enabled || return 0
-	errmsg=$( $status fence_xvmd 2>&1) || return 1
-
-	return 0
-}
-
-rtrn=1
-
-# See how we were called.
-case "$1" in
-    start)
-	start
-	rtrn=$?
-	[ $rtrn = 0 ] && touch $LOCK_FILE
-	if [ $rtrn -ne 0 ] 
-	then
-	    echo $errmsg
-	    $failure "failed to start cman"
-	    echo
-	else
-	    $success "start"
-	    echo
-	fi
-	;;
-    stop)
-	if [ $2 ]; then
-	    stop
-	else
-	    stop remove
-	fi
-	rtrn=$?
-	[ $rtrn = 0 ] && rm -f $LOCK_FILE
-	if [ $rtrn -ne 0 ] 
-	then
-	    echo $errmsg
-	    $failure "failed to stop cman"
-	    echo
-	else
-	    $success "shutdown"
-	    echo
-	fi
-	;;
-
-    restart|reload)
-	$0 stop restart
-	$0 start
-	rtrn=$?
-	;;
-
-    status)
-	cmanstatus
-	rtrn=$?
-	if [ $rtrn -ne 0 ] ; then
-	    echo $errmsg
-	else
-	    echo "cman is running."
-	fi
-	;;
-
-    *)
-	    echo $"Usage: $0 {start|stop|reload|restart|status}"
-	    ;;
-esac
-
-exit $rtrn
diff --git a/cman/init.d/qdiskd.in b/cman/init.d/qdiskd.in
deleted file mode 100644
index 3efdfe4..0000000
--- a/cman/init.d/qdiskd.in
+++ /dev/null
@@ -1,128 +0,0 @@
-#!/bin/bash
-#
-# qdiskd quorum disk daemon
-#
-# chkconfig: - 22 78
-# description: Starts and stops the quorum disk daemon
-
-### BEGIN INIT INFO
-# Provides: 		qdiskd
-# Required-Start:	cman
-# Required-Stop:	cman
-# Default-Start:
-# Default-Stop:
-# Short-Description:	start/stop quorum disk daemon
-# Description:		start/stop quorum disk daemon
-### END INIT INFO
-
-# rpm based distros
-if [ -d /etc/sysconfig ]; then
-	[ -f @INITDDIR@/functions ] && . @INITDDIR@/functions
-	[ -f /etc/sysconfig/cluster ] && . /etc/sysconfig/cluster
-	[ -f /etc/sysconfig/qdiskd ] && . /etc/sysconfig/qdiskd
-	[ -z "$LOCK_FILE" ] && LOCK_FILE="/var/lock/subsys/qdiskd"
-	success=success
-	failure=failure
-	status=status
-fi
-
-# deb based distros
-if [ -d /etc/default ]; then
-	[ -f /etc/default/cluster ] && . /etc/default/cluster
-	[ -f /etc/default/qdiskd ] && . /etc/default/qdiskd
-	[ -z "$LOCK_FILE" ] && LOCK_FILE="/var/lock/qdiskd"
-	success=local_success
-	failure=local_failure
-	# functions in rpm based distro implements a very complete version
-	# of pidof. For now we can live with this.
-	status=local_status
-fi
-
-local_success()
-{
-    echo -ne "[  OK  ]\r"
-}
-
-local_failure()
-{
-    echo -ne "[FAILED]\r"
-}
-
-local_status()
-{
-    pid=$(pidof $1 2>/dev/null)
-    rtrn=$?
-    if [ $rtrn -ne 0 ]; then
-        echo "$1 is stopped"
-    else
-        echo "$1 (pid $pid) is running..."
-    fi
-    return $rtrn
-}
-
-rtrn=1
-retries=0
-
-# See how we were called.
-case "$1" in
-  start)
-	echo -n "Starting the Quorum Disk Daemon: "
-
-	$0 status >/dev/null
-	if [ $? -eq 0 ]; then
-		$success
-		echo
-		exit 0
-	fi
-
-	@SBINDIR@/qdiskd -Q
-	rtrn=$?
-	if [ $rtrn = 0 ]; then
-		touch $LOCK_FILE
-		$success
-		echo
-	else
-		$failure
-		echo
-	fi
-		
-	;;
-
-  stop)
-	echo -n "Stopping the Quorum Disk Daemon: "
-	pid="$(pidof qdiskd)"
-	while [ -n "$pid" ] && [ $retries -lt 5 ]; do
-		kill $pid 2>&1
-		pid="$(pidof qdiskd)"
-		sleep 1
-		((retries++))
-	done
-	if [ -z "$(pidof qdiskd)" ]; then
-		$success
-		echo
-		rtrn=0
-		rm -f $LOCK_FILE
-	else
-		$failure
-		echo
-		rtrn=1
-	fi
-	;;
-
-  restart|reload)
-	$0 stop || exit $?
-	$0 start 
-	rtrn=$?
-	;;
-
-  status)
-	$status qdiskd
-	rtrn=$?
-	;;
-
-  *)
-	echo $"Usage: $0 {start|stop|reload|restart|status}"
-	;;
-esac
-
-exit $rtrn
diff --git a/cman/lib/Makefile b/cman/lib/Makefile
deleted file mode 100644
index da32992..0000000
--- a/cman/lib/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-TARGET= libcman
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/libs.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-CFLAGS += -fPIC
-CFLAGS += -I${cmanincdir} -I$(S)/../daemon
-CFLAGS += -I${incdir}
diff --git a/cman/lib/libcman.c b/cman/lib/libcman.c
deleted file mode 100644
index b05011c..0000000
--- a/cman/lib/libcman.c
+++ /dev/null
@@ -1,1108 +0,0 @@
-#include <sys/types.h>
-#include <sys/un.h>
-#include <inttypes.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <netinet/in.h>
-#include <string.h>
-#include <errno.h>
-#include <limits.h>
-#include "cnxman-socket.h"
-#include "libcman.h"
-
-/* List of saved messages */
-struct saved_message
-{
-	struct sock_header *msg;
-	struct saved_message *next;
-};
-
-struct cman_handle
-{
-	int magic;
-	int fd;
-	int zero_fd;
-	void *privdata;
-	int want_reply;
-	cman_callback_t event_callback;
-	cman_datacallback_t data_callback;
-	cman_confchgcallback_t confchg_callback;
-
-	void *reply_buffer;
-	int reply_buflen;
-	int reply_status;
-
-	struct saved_message *saved_data_msg;
-	struct saved_message *saved_event_msg;
-	struct saved_message *saved_reply_msg;
-};
-
-#define VALIDATE_HANDLE(h) do {if (!(h) || (h)->magic != CMAN_MAGIC) {errno = EINVAL; return -1;}} while (0)
-
-/*
- * Wait for an command/request reply.
- * Data/event messages will be queued.
- *
- */
-static int wait_for_reply(struct cman_handle *h, void *msg, int max_len)
-{
-	int ret;
-
-	h->want_reply = 1;
-	h->reply_buffer = msg;
-	h->reply_buflen = max_len;
-
-	do
-	{
-		ret = cman_dispatch(h, CMAN_DISPATCH_BLOCKING | CMAN_DISPATCH_IGNORE_EVENT | CMAN_DISPATCH_IGNORE_DATA);
-
-	} while (h->want_reply == 1 && ret >= 0);
-
-	h->reply_buffer = NULL;
-	h->reply_buflen = 0;
-
-	/* Error in local comms */
-	if (ret < 0) {
-		return -1;
-	}
-	/* cnxman daemon returns -ve errno values on error */
-	if (h->reply_status < 0) {
-		errno = -h->reply_status;
-		return -1;
-	}
-	else {
-		return h->reply_status;
-	}
-}
-
-
-static void copy_node(cman_node_t *unode, struct cl_cluster_node *knode)
-{
-	unode->cn_nodeid = knode->node_id;
-	unode->cn_member = knode->state == NODESTATE_MEMBER?1:0;
-	strcpy(unode->cn_name, knode->name);
-	unode->cn_incarnation = knode->incarnation;
-	unode->cn_jointime = knode->jointime;
-
-	memset(&unode->cn_address, 0, sizeof(unode->cn_address));
-	memcpy(&unode->cn_address.cna_address, knode->addr, knode->addrlen);
-	unode->cn_address.cna_addrlen = knode->addrlen;
-}
-
-/* Add to a list. saved_message *m is the head of the list in the cman_handle */
-static void add_to_waitlist(struct saved_message **m, struct sock_header *msg)
-{
-	struct saved_message *next = *m;
-	struct saved_message *last = *m;
-	struct saved_message *this;
-
-	this = malloc(sizeof(struct saved_message));
-	if (!this)
-		return;
-
-	this->msg = malloc(msg->length);
-	if (!this->msg)
-	{
-		free(this);
-		return;
-	}
-
-	memcpy(this->msg, msg, msg->length);
-	this->next = NULL;
-
-	if (!next)
-	{
-		*m = this;
-		return;
-	}
-
-	for (; next; next = next->next)
-	{
-		last = next;
-	}
-	last->next = this;
-}
-
-static int process_cman_message(struct cman_handle *h, int flags, struct sock_header *msg)
-{
-	/* Data for us */
-	if ((msg->command & CMAN_CMDMASK_CMD) == CMAN_CMD_DATA)
-	{
-		struct sock_data_header *dmsg = (struct sock_data_header *)msg;
-		char *buf = (char *)msg;
-
-		if (flags & CMAN_DISPATCH_IGNORE_DATA)
-		{
-			add_to_waitlist(&h->saved_data_msg, msg);
-		}
-		else
-		{
-			if (h->data_callback)
-				h->data_callback(h, h->privdata,
-						 buf+sizeof(*dmsg), msg->length-sizeof(*dmsg),
-						 dmsg->port, dmsg->nodeid);
-		}
-		return 0;
-	}
-
-	/* Got a reply to a previous information request */
-	if ((msg->command & CMAN_CMDFLAG_REPLY) && h->want_reply)
-	{
-		char *replybuf = (char *)msg;
-		int replylen = msg->length - sizeof(struct sock_reply_header);
-		struct sock_reply_header *reply = (struct sock_reply_header *)msg;
-
-		if (flags & CMAN_DISPATCH_IGNORE_REPLY)
-		{
-			add_to_waitlist(&h->saved_reply_msg, msg);
-			return 0;
-		}
-
-		replybuf += sizeof(struct sock_reply_header);
-		if (replylen <= h->reply_buflen)
-		{
-			memcpy(h->reply_buffer, replybuf, replylen);
-		}
-		h->want_reply = 0;
-		h->reply_status = reply->status;
-
-		return 1;
-	}
-
-	/* OOB event */
-	if (msg->command == CMAN_CMD_EVENT || msg->command == CMAN_CMD_CONFCHG)
-	{
-		if (flags & CMAN_DISPATCH_IGNORE_EVENT)
-		{
-			add_to_waitlist(&h->saved_event_msg, msg);
-		}
-		else
-		{
-			if (msg->command == CMAN_CMD_EVENT && h->event_callback) {
-				struct sock_event_message *emsg = (struct sock_event_message *)msg;
-				h->event_callback(h, h->privdata, emsg->reason, emsg->arg);
-			}
-
-			if (msg->command == CMAN_CMD_CONFCHG && h->confchg_callback)
-			{
-				struct sock_confchg_message *cmsg = (struct sock_confchg_message *)msg;
-
-				h->confchg_callback(h, h->privdata,
-						    cmsg->entries,cmsg->member_entries, 
-						    &cmsg->entries[cmsg->member_entries], cmsg->left_entries, 
-						    &cmsg->entries[cmsg->member_entries+cmsg->left_entries], cmsg->joined_entries);
-			}
-		}
-	}
-
-	return 0;
-}
-
-static int loopy_writev(int fd, struct iovec *iovptr, size_t iovlen)
-{
-	size_t byte_cnt=0;
-	int len;
-
-	while (iovlen > 0)
-	{
-		len = writev(fd, iovptr, iovlen);
-		if (len <= 0)
-			return len;
-
-		byte_cnt += len;
-		while (len >= iovptr->iov_len)
-		{
-			len -= iovptr->iov_len;
-			iovptr++;
-			iovlen--;
-		}
-
-		if ((ssize_t)iovlen <=0 )
-			break;
-
-		iovptr->iov_base += len;
-		iovptr->iov_len -= len;
-	}
-	return byte_cnt;
-}
-
-
-static int send_message(struct cman_handle *h, int msgtype, const void *inbuf, int inlen)
-{
-	struct sock_header header;
-	size_t len;
-	struct iovec iov[2];
-	size_t iovlen = 1;
-
-	header.magic = CMAN_MAGIC;
-	header.version = CMAN_VERSION;
-	header.command = msgtype;
-	header.flags = 0;
-	header.length = sizeof(header) + inlen;
-
-	iov[0].iov_len = sizeof(header);
-	iov[0].iov_base = &header;
-	if (inbuf)
-	{
-		iov[1].iov_len = inlen;
-		iov[1].iov_base = (void *) inbuf;
-		iovlen++;
-	}
-
-	len = loopy_writev(h->fd, iov, iovlen);
-	if (len < 0)
-		return len;
-	return 0;
-}
-
-/* Does something similar to the ioctl calls */
-static int info_call(struct cman_handle *h, int msgtype, const void *inbuf, int inlen, void *outbuf, int outlen)
-{
-	if (send_message(h, msgtype, inbuf, inlen))
-		return -1;
-
-	return wait_for_reply(h, outbuf, outlen);
-}
-
-static cman_handle_t open_socket(const char *name, int namelen, void *privdata)
-{
-	struct cman_handle *h;
-	struct sockaddr_un sockaddr;
-
-	h = malloc(sizeof(struct cman_handle));
-	if (!h)
-		return NULL;
-
-	h->magic = CMAN_MAGIC;
-	h->privdata = privdata;
-	h->event_callback = NULL;
-	h->data_callback = NULL;
-	h->confchg_callback = NULL;
-	h->want_reply = 0;
-	h->saved_data_msg = NULL;
-	h->saved_event_msg = NULL;
-	h->saved_reply_msg = NULL;
-
-	h->fd = socket(PF_UNIX, SOCK_STREAM, 0);
-	if (h->fd == -1)
-	{
-		int saved_errno = errno;
-		free(h);
-		errno = saved_errno;
-		return NULL;
-	}
-
-	fcntl(h->fd, F_SETFD, 1); /* Set close-on-exec */
-	memset(&sockaddr, 0, sizeof(sockaddr));
-	memcpy(sockaddr.sun_path, name, namelen);
-	sockaddr.sun_family = AF_UNIX;
-
-	if (connect(h->fd, (struct sockaddr *) &sockaddr, sizeof(sockaddr)) < 0)
-	{
-		int saved_errno = errno;
-		close(h->fd);
-		free(h);
-		errno = saved_errno;
-		return NULL;
-	}
-
-	/* Get a handle on /dev/zero too. This is always active so we
-	   can return it from cman_get_fd() if we have cached messages */
-	h->zero_fd = open("/dev/zero", O_RDONLY);
-	if (h->zero_fd < 0)
-	{
-		int saved_errno = errno;
-		close(h->fd);
-		free(h);
-		h = NULL;
-		errno = saved_errno;
-	}
-
-	return (cman_handle_t)h;
-}
-
-cman_handle_t cman_admin_init(void *privdata)
-{
-	return open_socket(ADMIN_SOCKNAME, sizeof(ADMIN_SOCKNAME), privdata);
-}
-
-cman_handle_t cman_init(void *privdata)
-{
-	return open_socket(CLIENT_SOCKNAME, sizeof(CLIENT_SOCKNAME), privdata);
-}
-
-int cman_finish(cman_handle_t handle)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	VALIDATE_HANDLE(h);
-
-	h->magic = 0;
-	close(h->fd);
-	close(h->zero_fd);
-	free(h);
-
-	return 0;
-}
-
-int cman_setprivdata(cman_handle_t handle, void *privdata)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	VALIDATE_HANDLE(h);
-
-	h->privdata = privdata;
-	return 0;
-}
-
-int cman_getprivdata(cman_handle_t handle, void **privdata)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	VALIDATE_HANDLE(h);
-
-	*privdata = h->privdata;
-
-	return 0;
-}
-
-
-int cman_start_notification(cman_handle_t handle, cman_callback_t callback)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	VALIDATE_HANDLE(h);
-
-	if (!callback)
-	{
-		errno = EINVAL;
-		return -1;
-	}
-	if (info_call(h, CMAN_CMD_NOTIFY, NULL, 0, NULL, 0))
-		return -1;
-	h->event_callback = callback;
-
-	return 0;
-}
-
-int cman_stop_notification(cman_handle_t handle)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	VALIDATE_HANDLE(h);
-
-	if (info_call(h, CMAN_CMD_REMOVENOTIFY, NULL, 0, NULL, 0))
-		return -1;
-	h->event_callback = NULL;
-
-	return 0;
-}
-
-int cman_start_confchg(cman_handle_t handle, cman_confchgcallback_t callback)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	VALIDATE_HANDLE(h);
-
-	if (!callback)
-	{
-		errno = EINVAL;
-		return -1;
-	}
-	if (info_call(h, CMAN_CMD_START_CONFCHG, NULL, 0, NULL, 0))
-		return -1;
-	h->confchg_callback = callback;
-
-	return 0;
-}
-
-int cman_stop_confchg(cman_handle_t handle)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	VALIDATE_HANDLE(h);
-
-	if (info_call(h, CMAN_CMD_STOP_CONFCHG, NULL, 0, NULL, 0))
-		return -1;
-	h->confchg_callback = NULL;
-
-	return 0;
-}
-
-
-int cman_get_fd(cman_handle_t handle)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	VALIDATE_HANDLE(h);
-
-	/* If we have saved messages then return an FD to /dev/zero which
-	   will always be readable */
-	if (h->saved_data_msg || h->saved_event_msg || h->saved_reply_msg)
-		return h->zero_fd;
-	else
-		return h->fd;
-}
-
-int cman_dispatch(cman_handle_t handle, int flags)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	int len;
-	int offset;
-	int recv_flags = 0;
-	char buf[PIPE_BUF];
-	VALIDATE_HANDLE(h);
-
-	if (!(flags & CMAN_DISPATCH_BLOCKING))
-		recv_flags |= MSG_DONTWAIT;
-
-	do
-	{
-		int res;
-		char *bufptr = buf;
-		struct sock_header *header = (struct sock_header *)buf;
-
-		/* First, drain any waiting queues */
-		if (h->saved_reply_msg && !(flags & CMAN_DISPATCH_IGNORE_REPLY))
-		{
-			struct saved_message *smsg = h->saved_reply_msg;
-
-			res = process_cman_message(h, flags, smsg->msg);
-			h->saved_reply_msg = smsg->next;
-			len = smsg->msg->length;
-			free(smsg->msg);
-			free(smsg);
-			if (res || (flags & CMAN_DISPATCH_ONE))
-				break;
-			else
-				continue;
-		}
-		if (h->saved_data_msg && !(flags & CMAN_DISPATCH_IGNORE_DATA))
-		{
-			struct saved_message *smsg = h->saved_data_msg;
-
-			res = process_cman_message(h, flags, smsg->msg);
-			h->saved_data_msg = smsg->next;
-			len = smsg->msg->length;
-			free(smsg->msg);
-			free(smsg);
-			if (res || (flags & CMAN_DISPATCH_ONE))
-				break;
-			else
-				continue;
-		}
-		if (h->saved_event_msg && !(flags & CMAN_DISPATCH_IGNORE_EVENT))
-		{
-			struct saved_message *smsg = h->saved_event_msg;
-
-			res = process_cman_message(h, flags, smsg->msg);
-			h->saved_event_msg = smsg->next;
-			len = smsg->msg->length;
-			free(smsg->msg);
-			free(smsg);
-			if (res || (flags & CMAN_DISPATCH_ONE))
-				break;
-			else
-				continue;
-		}
-
-		/* Now look for new messages */
-		len = recv(h->fd, buf, sizeof(struct sock_header), recv_flags);
-
-		if (len == 0) {
-			errno = EHOSTDOWN;
-			return -1;
-		}
-
-		if (len < 0 &&
-		    (errno == EINTR || errno == EAGAIN))
-			return 0;
-
-		if (len < 0)
-			return -1;
-
-		offset = len;
-
-		/* It's too big! */
-		if (header->length > sizeof(buf))
-		{
-			bufptr = malloc(header->length);
-			if (!bufptr)
-				return -1;
-			memcpy(bufptr, buf, sizeof(*header));
-			header = (struct sock_header *)bufptr;
-		}
-
-		/* Read the rest */
-		while (offset < header->length)
-		{
-			len = read(h->fd, bufptr+offset, header->length-offset);
-			if (len == 0) {
-				errno = EHOSTDOWN;
-				return -1;
-			}
-
-			if (len < 0 &&
-			    (errno == EINTR || errno == EAGAIN))
-				return 0;
-
-			if (len < 0)
-				return -1;
-			offset += len;
-		}
-
-		res = process_cman_message(h, flags, header);
-		if (bufptr != buf)
-			free(bufptr);
-
-		if (res)
-			break;
-
-	} while ( flags & CMAN_DISPATCH_ALL &&
-		  !(len < 0 && errno == EAGAIN) );
-
-	return len;
-}
-
-/* GET_ALLMEMBERS returns the number of nodes as status */
-int cman_get_node_count(cman_handle_t handle)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	VALIDATE_HANDLE(h);
-
-	return info_call(h, CMAN_CMD_GETALLMEMBERS, NULL, 0, NULL, 0);
-}
-
-int cman_get_nodes(cman_handle_t handle, int maxnodes, int *retnodes, cman_node_t *nodes)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	struct cl_cluster_node *cman_nodes;
-	int status;
-	int buflen;
-	int count = 0;
-	VALIDATE_HANDLE(h);
-
-	if (!retnodes || !nodes || maxnodes < 1)
-	{
-		errno = EINVAL;
-		return -1;
-	}
-
-	buflen = sizeof(struct cl_cluster_node) * maxnodes;
-	cman_nodes = malloc(buflen);
-	if (!cman_nodes)
-		return -1;
-
-	status = info_call(h, CMAN_CMD_GETALLMEMBERS, NULL, 0, cman_nodes, buflen);
-	if (status < 0)
-	{
-		int saved_errno = errno;
-		free(cman_nodes);
-		errno = saved_errno;
-		return -1;
-	}
-
-	if (cman_nodes[0].size != sizeof(struct cl_cluster_node))
-	{
-		free(cman_nodes);
-		errno = EINVAL;
-		return -1;
-	}
-
-	if (status > maxnodes)
-		status = maxnodes;
-
-	for (count = 0; count < status; count++)
-	{
-		copy_node(&nodes[count], &cman_nodes[count]);
-	}
-	free(cman_nodes);
-	*retnodes = status;
-	return 0;
-}
-
-int cman_get_disallowed_nodes(cman_handle_t handle, int maxnodes, int *retnodes, cman_node_t *nodes)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	struct cl_cluster_node *cman_nodes;
-	int status;
-	int buflen;
-	int count = 0;
-	int out_count = 0;
-	VALIDATE_HANDLE(h);
-
-	if (!retnodes || !nodes || maxnodes < 1)
-	{
-		errno = EINVAL;
-		return -1;
-	}
-
-	buflen = sizeof(struct cl_cluster_node) * maxnodes;
-	cman_nodes = malloc(buflen);
-	if (!cman_nodes)
-		return -1;
-
-	status = info_call(h, CMAN_CMD_GETALLMEMBERS, NULL, 0, cman_nodes, buflen);
-	if (status < 0)
-	{
-		int saved_errno = errno;
-		free(cman_nodes);
-		errno = saved_errno;
-		return -1;
-	}
-
-	if (cman_nodes[0].size != sizeof(struct cl_cluster_node))
-	{
-		free(cman_nodes);
-		errno = EINVAL;
-		return -1;
-	}
-
-	for (count = 0; count < status; count++)
-	{
-		if (cman_nodes[count].state == NODESTATE_AISONLY && out_count < maxnodes)
-			copy_node(&nodes[out_count++], &cman_nodes[count]);
-	}
-	free(cman_nodes);
-	*retnodes = out_count;
-	return 0;
-}
-
-int cman_get_node(cman_handle_t handle, int nodeid, cman_node_t *node)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	struct cl_cluster_node cman_node;
-	int status;
-	VALIDATE_HANDLE(h);
-
-	if (!node || strlen(node->cn_name) > sizeof(cman_node.name))
-	{
-		errno = EINVAL;
-		return -1;
-	}
-
-	cman_node.node_id = nodeid;
-	strcpy(cman_node.name, node->cn_name);
-	status = info_call(h, CMAN_CMD_GETNODE, &cman_node, sizeof(struct cl_cluster_node),
-			   &cman_node, sizeof(struct cl_cluster_node));
-	if (status < 0)
-		return -1;
-
-	copy_node(node, &cman_node);
-
-	return 0;
-}
-
-int cman_get_subsys_count(cman_handle_t handle)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	VALIDATE_HANDLE(h);
-
-	return info_call(h, CMAN_CMD_GET_JOINCOUNT, NULL,0, NULL, 0);
-}
-
-int cman_is_active(cman_handle_t handle)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	VALIDATE_HANDLE(h);
-
-	return info_call(h, CMAN_CMD_ISACTIVE, NULL, 0, NULL, 0);
-}
-
-int cman_is_listening(cman_handle_t handle, int nodeid, uint8_t port)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	struct cl_listen_request req;
-	VALIDATE_HANDLE(h);
-
-	req.port = port;
-	req.nodeid = nodeid;
-	return info_call(h, CMAN_CMD_ISLISTENING, &req, sizeof(struct cl_listen_request), NULL, 0);
-}
-
-int cman_is_quorate(cman_handle_t handle)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	VALIDATE_HANDLE(h);
-
-	return info_call(h, CMAN_CMD_ISQUORATE, NULL, 0, NULL, 0);
-}
-
-
-int cman_get_version(cman_handle_t handle, cman_version_t *version)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	VALIDATE_HANDLE(h);
-
-	if (!version)
-	{
-		errno = EINVAL;
-		return -1;
-	}
-	return info_call(h, CMAN_CMD_GET_VERSION, NULL, 0, version, sizeof(cman_version_t));
-}
-
-int cman_set_version(cman_handle_t handle, const cman_version_t *version)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	VALIDATE_HANDLE(h);
-
-	if (!version)
-	{
-		errno = EINVAL;
-		return -1;
-	}
-	return info_call(h, CMAN_CMD_SET_VERSION, version, sizeof(cman_version_t), NULL, 0);
-}
-
-int cman_kill_node(cman_handle_t handle, int nodeid)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	VALIDATE_HANDLE(h);
-
-	if (!nodeid)
-	{
-		errno = EINVAL;
-		return -1;
-	}
-	return info_call(h, CMAN_CMD_KILLNODE, &nodeid, sizeof(nodeid), NULL, 0);
-}
-
-int cman_set_votes(cman_handle_t handle, int votes, int nodeid)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	struct cl_set_votes newv;
-	VALIDATE_HANDLE(h);
-
-	if (!votes)
-	{
-		errno = EINVAL;
-		return -1;
-	}
-	newv.nodeid = nodeid;
-	newv.newvotes  = votes;
-	return info_call(h, CMAN_CMD_SET_VOTES, &newv, sizeof(newv), NULL, 0);
-}
-
-int cman_set_expected_votes(cman_handle_t handle, int evotes)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	VALIDATE_HANDLE(h);
-
-	if (!evotes)
-	{
-		errno = EINVAL;
-		return -1;
-	}
-	return info_call(h, CMAN_CMD_SETEXPECTED_VOTES, &evotes, sizeof(evotes), NULL, 0);
-}
-
-int cman_leave_cluster(cman_handle_t handle, int reason)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	VALIDATE_HANDLE(h);
-
-	return info_call(h, CMAN_CMD_LEAVE_CLUSTER, &reason, sizeof(reason), NULL, 0);
-}
-
-int cman_get_cluster(cman_handle_t handle, cman_cluster_t *clinfo)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	VALIDATE_HANDLE(h);
-
-	if (!clinfo)
-	{
-		errno = EINVAL;
-		return -1;
-	}
-	return info_call(h, CMAN_CMD_GETCLUSTER, NULL, 0, clinfo, sizeof(cman_cluster_t));
-}
-
-int cman_get_extra_info(cman_handle_t handle, cman_extra_info_t *info, int maxlen)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	VALIDATE_HANDLE(h);
-
-	if (!info || maxlen < sizeof(cman_extra_info_t))
-	{
-		errno = EINVAL;
-		return -1;
-	}
-	return info_call(h, CMAN_CMD_GETEXTRAINFO, NULL, 0, info, maxlen);
-}
-
-int cman_send_data(cman_handle_t handle, const void *buf, int len, int flags, uint8_t port, int nodeid)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	struct iovec iov[2];
-	struct sock_data_header header;
-	VALIDATE_HANDLE(h);
-
-	header.header.magic = CMAN_MAGIC;
-	header.header.version = CMAN_VERSION;
-	header.header.command = CMAN_CMD_DATA;
-	header.header.flags = flags;
-	header.header.length = len + sizeof(header);
-	header.nodeid = nodeid;
-	header.port = port;
-
-	iov[0].iov_len = sizeof(header);
-	iov[0].iov_base = &header;
-	iov[1].iov_len = len;
-	iov[1].iov_base = (void *) buf;
-
-	return loopy_writev(h->fd, iov, 2);
-}
-
-
-int cman_start_recv_data(cman_handle_t handle, cman_datacallback_t callback, uint8_t port)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	int portparam;
-	int status;
-	VALIDATE_HANDLE(h);
-
-/* Do a "bind" */
-	portparam = port;
-	status = info_call(h, CMAN_CMD_BIND, &portparam, sizeof(portparam), NULL, 0);
-
-	if (status == 0)
-		h->data_callback = callback;
-
-	return status;
-}
-
-int cman_end_recv_data(cman_handle_t handle)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	VALIDATE_HANDLE(h);
-
-	h->data_callback = NULL;
-	return 0;
-}
-
-
-int cman_barrier_register(cman_handle_t handle, const char *name, int flags, int nodes)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	struct cl_barrier_info binfo;
-	VALIDATE_HANDLE(h);
-
-	if (strlen(name) > MAX_BARRIER_NAME_LEN)
-	{
-		errno = EINVAL;
-		return -1;
-	}
-
-	binfo.cmd = BARRIER_CMD_REGISTER;
-	strcpy(binfo.name, name);
-	binfo.arg = nodes;
-	binfo.flags = flags;
-
-	return info_call(h, CMAN_CMD_BARRIER, &binfo, sizeof(binfo), NULL, 0);
-}
-
-
-int cman_barrier_change(cman_handle_t handle, const char *name, int flags, int arg)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	struct cl_barrier_info binfo;
-	VALIDATE_HANDLE(h);
-
-	if (strlen(name) > MAX_BARRIER_NAME_LEN)
-	{
-		errno = EINVAL;
-		return -1;
-	}
-
-	binfo.cmd = BARRIER_CMD_CHANGE;
-	strcpy(binfo.name, name);
-	binfo.arg = arg;
-	binfo.flags = flags;
-
-	return info_call(h, CMAN_CMD_BARRIER, &binfo, sizeof(binfo), NULL, 0);
-
-}
-
-int cman_barrier_wait(cman_handle_t handle, const char *name)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	struct cl_barrier_info binfo;
-	VALIDATE_HANDLE(h);
-
-	if (strlen(name) > MAX_BARRIER_NAME_LEN)
-	{
-		errno = EINVAL;
-		return -1;
-	}
-
-	binfo.cmd = BARRIER_CMD_WAIT;
-	strcpy(binfo.name, name);
-
-	return info_call(h, CMAN_CMD_BARRIER, &binfo, sizeof(binfo), NULL, 0);
-}
-
-int cman_barrier_delete(cman_handle_t handle, const char *name)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	struct cl_barrier_info binfo;
-	VALIDATE_HANDLE(h);
-
-	if (strlen(name) > MAX_BARRIER_NAME_LEN)
-	{
-		errno = EINVAL;
-		return -1;
-	}
-
-	binfo.cmd = BARRIER_CMD_DELETE;
-	strcpy(binfo.name, name);
-
-	return info_call(h, CMAN_CMD_BARRIER, &binfo, sizeof(binfo), NULL, 0);
-}
-
-int cman_shutdown(cman_handle_t handle, int flags)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	VALIDATE_HANDLE(h);
-
-	return info_call(h, CMAN_CMD_TRY_SHUTDOWN, &flags, sizeof(int), NULL, 0);
-}
-
-int cman_set_dirty(cman_handle_t handle)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	VALIDATE_HANDLE(h);
-
-	return info_call(h, CMAN_CMD_SET_DIRTY, NULL, 0, NULL, 0);
-}
-
-int cman_set_debuglog(cman_handle_t handle, int subsystems)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	VALIDATE_HANDLE(h);
-
-	return info_call(h, CMAN_CMD_SET_DEBUGLOG, &subsystems, sizeof(int), NULL, 0);
-}
-
-int cman_replyto_shutdown(cman_handle_t handle, int yesno)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	VALIDATE_HANDLE(h);
-
-	send_message(h, CMAN_CMD_SHUTDOWN_REPLY, &yesno, sizeof(int));
-	return 0;
-}
-
-
-int cman_register_quorum_device(cman_handle_t handle, char *name, int votes)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	char buf[strlen(name)+1 + sizeof(int)];
-	VALIDATE_HANDLE(h);
-
-	if (strlen(name) > MAX_CLUSTER_MEMBER_NAME_LEN)
-	{
-		errno = EINVAL;
-		return -1;
-	}
-
-	memcpy(buf, &votes, sizeof(int));
-	strcpy(buf+sizeof(int), name);
-	return info_call(h, CMAN_CMD_REG_QUORUMDEV, buf, strlen(name)+1+sizeof(int), NULL, 0);
-}
-
-int cman_unregister_quorum_device(cman_handle_t handle)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	VALIDATE_HANDLE(h);
-
-	return info_call(h, CMAN_CMD_UNREG_QUORUMDEV, NULL, 0, NULL, 0);
-}
-
-int cman_poll_quorum_device(cman_handle_t handle, int isavailable)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	VALIDATE_HANDLE(h);
-
-	return info_call(h, CMAN_CMD_POLL_QUORUMDEV, &isavailable, sizeof(int), NULL, 0);
-}
-
-int cman_get_quorum_device(cman_handle_t handle, struct cman_qdev_info *info)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	int ret;
-	struct cl_cluster_node cman_node;
-	VALIDATE_HANDLE(h);
-
-	cman_node.node_id = CLUSTER_GETNODE_QUORUMDEV;
-	ret = info_call(h, CMAN_CMD_GETNODE, &cman_node, sizeof(cman_node), &cman_node, sizeof(cman_node));
-	if (!ret) {
-		strcpy(info->qi_name, cman_node.name);
-		info->qi_state = cman_node.state;
-		info->qi_votes = cman_node.votes;
-	}
-	return ret;
-}
-
-int cman_get_fenceinfo(cman_handle_t handle, int nodeid, uint64_t *time, int *fenced, char *agent)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	int ret;
-	struct cl_fence_info f;
-	VALIDATE_HANDLE(h);
-
-	ret = info_call(h, CMAN_CMD_GET_FENCE_INFO, &nodeid, sizeof(int), &f, sizeof(f));
-	if (!ret) {
-		*time = f.fence_time;
-		if (agent)
-			strcpy(agent, f.fence_agent);
-		*fenced = ((f.flags & FENCE_FLAGS_FENCED) != 0);
-	}
-	return ret;
-}
-
-int cman_get_node_addrs(cman_handle_t handle, int nodeid, int max_addrs, int *num_addrs, struct cman_node_address *addrs)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	int ret;
-	char buf[sizeof(struct cl_get_node_addrs) + sizeof(struct cl_node_addrs)*max_addrs];
-	struct cl_get_node_addrs *outbuf = (struct cl_get_node_addrs *)buf;
-	VALIDATE_HANDLE(h);
-
-	ret = info_call(h, CMAN_CMD_GET_NODEADDRS, &nodeid, sizeof(int), buf, sizeof(buf));
-	if (!ret) {
-		int i;
-
-		*num_addrs = outbuf->numaddrs;
-
-		if (outbuf->numaddrs > max_addrs)
-			outbuf->numaddrs = max_addrs;
-
-		for (i=0; i < outbuf->numaddrs; i++) {
-			memcpy(&addrs[i].cna_address, &outbuf->addrs[i].addr, outbuf->addrs[i].addrlen);
-			addrs[i].cna_addrlen = outbuf->addrs[i].addrlen;
-		}
-	}
-	return ret;
-}
-
-int cman_node_fenced(cman_handle_t handle, int nodeid, uint64_t time, char *agent)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	struct cl_fence_info f;
-	VALIDATE_HANDLE(h);
-
-	if (strlen(agent) >= MAX_FENCE_AGENT_NAME_LEN) {
-		errno = EINVAL;
-		return -1;
-	}
-
-	f.nodeid = nodeid;
-	f.fence_time = time;
-	strcpy(f.fence_agent, agent);
-	return info_call(h, CMAN_CMD_UPDATE_FENCE_INFO, &f, sizeof(f), NULL, 0);
-}
-
-#ifdef DEBUG
-int cman_dump_objdb(cman_handle_t handle, char *filename)
-{
-	struct cman_handle *h = (struct cman_handle *)handle;
-	VALIDATE_HANDLE(h);
-
-	return info_call(h, CMAN_CMD_DUMP_OBJDB, filename, strlen(filename)+1, NULL, 0);
-}
-#endif
diff --git a/cman/lib/libcman.h b/cman/lib/libcman.h
deleted file mode 100644
index 37058df..0000000
--- a/cman/lib/libcman.h
+++ /dev/null
@@ -1,423 +0,0 @@
-#ifndef _LIBCMAN_H_
-#define _LIBCMAN_H_
-
-#include <netinet/in.h>
-
-#define LIBCMAN_VERSION 3
-
-/*
- * Some maxima
- */
-#define CMAN_MAX_ADDR_LEN             sizeof(struct sockaddr_in6)
-#define CMAN_MAX_NODENAME_LEN         255
-#define MAX_CLUSTER_NAME_LEN           16
-#define CMAN_MAX_FENCE_AGENT_NAME_LEN 255
-
-/*
- * Pass this into cman_get_node() as the nodeid to get local node information
- */
-#define CMAN_NODEID_US     0
-
-/*
- * Pass this into cman_get_node() as the nodeid to get quorum device information
- */
-#define CMAN_NODEID_QDISK -1
-
-
-/* Pass this into cman_send_data to send a message to all nodes */
-#define CMAN_NODEID_ALL 0
-
-/*
- * Hang onto this, it's your key into the library. get one from cman_init() or
- * cman_admin_init()
- */
-typedef void *cman_handle_t;
-
-/*
- * Reasons we get an event callback.
- * PORTOPENED & TRY_SHUTDOWN only exist when LIBCMAN_VERSION >= 2
- *
- * The 'arg' parameter varies depending on the callback type.
- * for PORTCLOSED/PORTOPENED  arg == the port opened/closed
- * for STATECHANGE            arg is quorum state (1=quorate, 0=not)
- * for TRY_SHUTDOWN           arg == 1 for ANYWAY, otherwise 0 (ie if arg == 1 
- * 			      then cman WILL shutdown regardless
- *                            of your response, think of this as advance warning)
- * for CONFIG_UPDATE          arg will be the new config version
- */
-typedef enum {CMAN_REASON_PORTCLOSED,
-	      CMAN_REASON_STATECHANGE,
-              CMAN_REASON_PORTOPENED,
-              CMAN_REASON_TRY_SHUTDOWN,
-              CMAN_REASON_CONFIG_UPDATE} cman_call_reason_t;
-
-/*
- * Reason flags for cman_leave
- */
-#define CMAN_LEAVEFLAG_DOWN    0
-#define CMAN_LEAVEFLAG_REMOVED 3
-#define CMAN_LEAVEFLAG_FORCE   0x10
-
-/*
- * Flags for cman_shutdown
- *    ANYWAY   -  cman will shutdown regardless of clients' responses (but they
- *    		   will still get told)
- *    REMOVED  -  the rest of the cluster will adjust quorum to stay quorate
- */
-#define CMAN_SHUTDOWN_ANYWAY   1
-#define CMAN_SHUTDOWN_REMOVED  2
-
-/*
- * Flags passed to cman_dispatch():
- * CMAN_DISPATCH_ONE dispatches a single message then returns,
- * CMAN_DISPATCH_ALL dispatches all outstanding messages (ie till EAGAIN) then 
- *                   returns,
- * CMAN_DISPATCH_BLOCKING forces it to wait for a message (clears MSG_DONTWAIT 
- * 			  in recvmsg)
- * CMAN_DISPATCH_IGNORE_* allows the caller to select which messages to process.
- */
-#define CMAN_DISPATCH_ONE           0
-#define CMAN_DISPATCH_ALL           1
-#define CMAN_DISPATCH_BLOCKING      2
-#define CMAN_DISPATCH_IGNORE_REPLY  4
-#define CMAN_DISPATCH_IGNORE_DATA   8
-#define CMAN_DISPATCH_IGNORE_EVENT 16
-#define CMAN_DISPATCH_TYPE_MASK     3
-#define CMAN_DISPATCH_IGNORE_MASK  46
-
-/*
- * A node address. This is a complete sockaddr_in[6]
- * To explain:
- *  If you cast cna_address to a 'struct sockaddr', the sa_family field
- *  will be AF_INET or AF_INET6. Armed with that knowledge you can then
- *  cast it to a sockaddr_in or sockaddr_in6 and pull out the address.
- *  No other sockaddr fields are valid.
- *  Also, you must ignore any part of the sockaddr beyond the length supplied
- */
-typedef struct cman_node_address
-{
-	int  cna_addrlen;
-	char cna_address[CMAN_MAX_ADDR_LEN];
-} cman_node_address_t;
-
-/*
- * Return from cman_get_node()
- */
-typedef struct cman_node
-{
-	int cn_nodeid;
-	cman_node_address_t cn_address;
-	char cn_name[CMAN_MAX_NODENAME_LEN+1];
-	int cn_member;
-	int cn_incarnation;
-	struct timeval cn_jointime;
-} cman_node_t;
-
-/*
- * Returned from cman_get_version(),
- * input to cman_set_version(), though only cv_config can be changed
- */
-typedef struct cman_version
-{
-	unsigned int cv_major;
-	unsigned int cv_minor;
-	unsigned int cv_patch;
-	unsigned int cv_config;
-} cman_version_t;
-
-/*
- * Return from cman_get_cluster()
- */
-typedef struct cman_cluster
-{
-	char     ci_name[MAX_CLUSTER_NAME_LEN+1];
-	uint16_t ci_number;
-	uint32_t ci_generation;
-} cman_cluster_t;
-
-/*
- * This is returned from cman_get_extra_info - it's really
- * only for use by cman_tool, don't depend on this not changing
- */
-
-/* Flags in ei_flags */
-#define CMAN_EXTRA_FLAG_2NODE      1
-#define CMAN_EXTRA_FLAG_ERROR      2
-#define CMAN_EXTRA_FLAG_SHUTDOWN   4
-#define CMAN_EXTRA_FLAG_DISALLOWED 8
-#define CMAN_EXTRA_FLAG_DIRTY     16
-
-typedef struct cman_extra_info {
-	int           ei_node_state;
-	int           ei_flags;
-	int           ei_node_votes;
-	int           ei_total_votes;
-	int           ei_expected_votes;
-	int           ei_quorum;
-	int           ei_members;
-	char          ei_ports[32];
-	int           ei_num_addresses;
-	char          ei_addresses[1]; /* Array of num_addresses*sockaddr_storage*2
-					  First batch is the multicast address list */
-} cman_extra_info_t;
-
-/* Quorum device info, returned from cman_get_quorum_device() */
-typedef struct cman_qdev_info {
-	char qi_name[CMAN_MAX_NODENAME_LEN+1];
-	int  qi_state;
-	int  qi_votes;
-} cman_qdev_info_t;
-
-/*
- * NOTE: Apart from cman_replyto_shutdown(), you must not
- * call other cman_* functions while in these two callbacks:
- */
-
-/* Callback routine for a membership or other event */
-typedef void (*cman_callback_t)(cman_handle_t handle, void *privdata, int reason, int arg);
-
-/* Callback routine for data received */
-typedef void (*cman_datacallback_t)(cman_handle_t handle, void *privdata,
-				    char *buf, int len, uint8_t port, int nodeid);
-
-/* Callback for nodes joining/leaving */
-typedef void (*cman_confchgcallback_t)(cman_handle_t handle, void *privdata,
-				       unsigned int *member_list, int member_list_entries,
-				       unsigned int *left_list, int left_list_entries,
-				       unsigned int *joined_list, int joined_list_entries);
-
-/*
- * cman_init        returns the handle you need to pass to the other API calls.
- * cman_admin_init  opens admin socket for privileged operations.
- * cman_finish      destroys that handle.
- *
- * Note that admin sockets can't send data messages or receive callbacks.
- */
-cman_handle_t cman_init(void *privdata);
-cman_handle_t cman_admin_init(void *privdata);
-int cman_finish(cman_handle_t handle);
-
-/* Update/retrieve the private data */
-int cman_setprivdata(cman_handle_t h, void *privdata);
-int cman_getprivdata(cman_handle_t h, void **privdata);
-
-/*
- * Notification of membership change events. Note that these are sent after
- * a transition, so multiple nodes may have left or joined the cluster.
- */
-int cman_start_notification(cman_handle_t handle, cman_callback_t callback);
-int cman_stop_notification(cman_handle_t handle);
-
-/*
- * Start/stop AIS-style confchg callbacks. These are less racy than the
- * old cman callbacks in that the caller will get one for each AIS
- * confchg message and it will contain all of the nodes that joined &
- * left in that transition.
- */
-int cman_start_confchg(cman_handle_t handle, cman_confchgcallback_t callback);
-int cman_stop_confchg(cman_handle_t handle);
-
-/* Call this if you get a TRY_SHUTDOWN event to signal whether you
- * will let cman shutdown or not.
- * Note that getting this callback does not mean that cman WILL shutdown,
- * only that it might. To detect a cman shutdown see cman_dispatch() below.
- */
-int cman_replyto_shutdown(cman_handle_t, int yesno);
-
-
-/*
- * Get the internal CMAN fd so you can pass it into poll() or select().
- * When it's active then call cman_dispatch() on the handle to process the event
- * NOTE: This fd can change between calls to cman_dispatch() so always call this
- * routine to get the latest one. (This is mainly due to message caching).
- * One upshot of this is that you must never read or write this FD (it may on 
- * occasion point to /dev/zero if you have messages cached!)
- */
-int cman_get_fd(cman_handle_t handle);
-
-/*
- * cman_dispatch() will return -1 with errno == EHOSTDOWN if the cluster is
- * shut down, 0 if nothing was read, or a positive number if something was 
- * dispatched.
- */
-
-int cman_dispatch(cman_handle_t handle, int flags);
-
-
-/*
- * -----------------------------------------------------------------------------
- * Get info calls.
- */
-
-/* Return the number of nodes we know about. This will normally
- *  be the number of nodes in CCS 
- */
-int cman_get_node_count(cman_handle_t handle);
-
-/* Returns the number of connected clients. This isn't as useful as a it used to
- * be as a count >1 does not automatically mean cman won't shut down. Subsystems
- * can decide for themselves whether a clean shutdown is possible. 
- */
-int cman_get_subsys_count(cman_handle_t handle);
-
-/* Returns an array of node info structures. Call cman_get_node_count() first
- * to determine how big your array needs to be 
- */
-int cman_get_nodes(cman_handle_t handle, int maxnodes, int *retnodes, cman_node_t *nodes);
-
-/* Returns a list of nodes that are known to AIS but blocked from joining the
- * CMAN cluster because they rejoined with cluster without a cman_tool join 
- */
-int cman_get_disallowed_nodes(cman_handle_t handle, int maxnodes, int *retnodes, cman_node_t *nodes);
-
-/*
- * cman_get_node() can get node info by nodeid OR by name. If the first
- * char of node->cn_name is zero then the nodeid will be used, otherwise
- * the name will be used. I'll say this differently: If you want to look
- * up a node by nodeid, you MUST clear out the cman_node_t structure passed
- * into cman_get_node(). nodeid can be CMAN_NODEID_US.
- */
-int cman_get_node(cman_handle_t handle, int nodeid, cman_node_t *node);
-
-/* cman_get_node() only returns the first address of a node (whatever /that/
- * may mean). If you want to know all of them you need to call this.
- * max_addrs is the size of the 'addrs' array. num_addrs will be filled in by 
- * the number of addresses the node has, regardless of the size of max_addrs. 
- * So if you don't allocate enough space for the first call, you should know how
- * much is needed for a second!
- */
-int cman_get_node_addrs(cman_handle_t handle, int nodeid, int max_addrs, int *num_addrs, struct cman_node_address *addrs);
-
-/* Returns 1 if cman has completed initialisation and aisexec is running */
-int cman_is_active(cman_handle_t handle);
-
-/*
- * Returns 1 if a client is registered for data callbacks on a particular
- * port on a particular node. if cman returns -1 (errno==EBUSY) then it
- * doesn't currently know the status but has requested it, so try again
- * later or wait for a PORTOPENED notification.
- * nodeid can be CMAN_NODEID_US
- */
-int cman_is_listening(cman_handle_t handle, int nodeid, uint8_t port);
-
-/* Do we have quorum? */
-int cman_is_quorate(cman_handle_t handle);
-
-/* Return software & config (cluster.conf file) version */
-int cman_get_version(cman_handle_t handle, cman_version_t *version);
-
-/* Get cluster name and number */
-int cman_get_cluster(cman_handle_t handle, cman_cluster_t *clinfo);
-
-/* Get fence information for a node.
- * 'int *fenced' is only valid if the node is down, it is set to
- * 1 if the node has been fenced since it left the cluster.
- * agent should be CMAN_MAX_FENCE_AGENT_NAME_LEN
- */
-int cman_get_fenceinfo(cman_handle_t handle, int nodeid, uint64_t *fence_time, int *fenced, char *agent);
-
-/* Get stuff for cman_tool. Nobody else should use this */
-int cman_get_extra_info(cman_handle_t handle, cman_extra_info_t *info, int maxlen);
-
-/* Dump the objdb contents (only works if compiled with DEBUG enabled) */
-int cman_dump_objdb(cman_handle_t handle, char *filename);
-
-/*
- * -----------------------------------------------------------------------------
- * Admin functions. You will need privileges and have a handle created by 
- * cman_admin_init() to use them.
- */
-
-/* Change the config file version. This should be needed much less now, as 
- * cman will re-read the config file if a new node joins with a new config 
- * version */
-int cman_set_version(cman_handle_t handle, const cman_version_t *version);
-
-/* Deprecated in favour of cman_shutdown(). Use cman_tool anyway please. */
-int cman_leave_cluster(cman_handle_t handle, int reason);
-
-/* Change the number of votes for this node. NOTE: a CCS update will
-   overwrite this, so make sure you change both. Or, better, change CCS
-   and call set_version() */
-int cman_set_votes(cman_handle_t handle, int votes, int nodeid);
-
-/* As above, for expected_votes */
-int cman_set_expected_votes(cman_handle_t handle, int expected_votes);
-
-/* Tell a particular node to leave the cluster NOW */
-int cman_kill_node(cman_handle_t handle, int nodeid);
-
-/* Tell CMAN a node has been fenced, when and by what means. */
-int cman_node_fenced(cman_handle_t handle, int nodeid, uint64_t fence_time, char *agent);
-
-/*
- * cman_shutdown() will send a REASON_TRY_SHUTDOWN event to all
- * clients registered for notifications. They should respond by calling
- * cman_replyto_shutdown() to indicate whether they will allow
- * cman to close down or not. If cman gets >=1 "no" (0) replies or the
- * request times out (default 5 seconds) then shutdown will be
- * cancelled and cman_shutdown() will return -1 with errno == EBUSY.
- *
- * Set flags to CMAN_SHUTDOWN_ANYWAY to force shutdown. Clients will still
- * be notified /and/ they will know you want a forced shutdown.
- *
- * Setting flags to CMAN_SHUTDOWN_REMOVED will tell the rest of the
- * cluster to adjust quorum to keep running with this node has left
- */
-int cman_shutdown(cman_handle_t, int flags);
-
-/* -----------------------------------------------------------------------------
- * Data transmission API. Uses the same FD as the rest of the calls.
- * If the nodeid passed to cman_send_data() is zero then it will be
- * broadcast to all nodes in the cluster.
- * cman_start_recv_data() is like a bind(), and marks the port
- * as "listening". See cman_is_listening() above.
- */
-int cman_send_data(cman_handle_t handle, const void *buf, int len, int flags, uint8_t port, int nodeid);
-int cman_start_recv_data(cman_handle_t handle, cman_datacallback_t, uint8_t port);
-int cman_end_recv_data(cman_handle_t handle);
-
-/*
- * Barrier API.
- * Here for backwards compatibility. Most of the things you would achieve
- * with this can now be better done using openAIS services or just messaging.
- */
-int cman_barrier_register(cman_handle_t handle, const char *name, int flags, int nodes);
-int cman_barrier_change(cman_handle_t handle, const char *name, int flags, int arg);
-int cman_barrier_wait(cman_handle_t handle, const char *name);
-int cman_barrier_delete(cman_handle_t handle, const char *name);
-
-/*
- * Add your own quorum device here, needs an admin socket
- *
- * After creating a quorum device you will need to call 'poll_quorum_device'
- * at least once every (default) 10 seconds (this can be changed in CCS)
- * otherwise it will time-out and the cluster will lose its vote.
- */
-int cman_register_quorum_device(cman_handle_t handle, char *name, int votes);
-int cman_unregister_quorum_device(cman_handle_t handle);
-int cman_poll_quorum_device(cman_handle_t handle, int isavailable);
-int cman_get_quorum_device(cman_handle_t handle, struct cman_qdev_info *info);
-
-/*
- * Sets the dirty bit inside cman. This indicates that the node has
- * some internal 'state' (eg in a daemon, filesystem or lock manager)
- * and cannot merge with another cluster that already has state.
- * This needs an admin socket. It cannot be reset. 
- */
-int cman_set_dirty(cman_handle_t handle);
-
-
-/*
- * Changes the debug logging level inside cman.
- * subsystems is a bitmask of:
- */
-#define CMAN_DEBUGLOG_NONE       0
-#define CMAN_DEBUGLOG_BARRIER    2
-#define CMAN_DEBUGLOG_MEMBERSHIP 4
-#define CMAN_DEBUGLOG_DAEMON     8
-#define CMAN_DEBUGLOG_AIS       16
-
-int cman_set_debuglog(cman_handle_t handle, int subsystems);
-
-#endif
diff --git a/cman/man/Makefile b/cman/man/Makefile
deleted file mode 100644
index 54d7c9a..0000000
--- a/cman/man/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-TARGET= cman.5 \
-	qdisk.5 \
-	cman_tool.8 \
-	qdiskd.8 \
-	mkqdisk.8 \
-	cmannotifyd.8
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/man.mk
diff --git a/cman/man/cman.5 b/cman/man/cman.5
deleted file mode 100644
index d36f484..0000000
--- a/cman/man/cman.5
+++ /dev/null
@@ -1,222 +0,0 @@
-.\" groff -t -e -mandoc -Tlatin1 cman.5 | less
-
-.TH "cman" "5" "" "" "cluster.conf cman configuration section"
-
-.SH "NAME"
-cman \- cluster.conf cman configuration section
-
-.SH "DESCRIPTION"
-
-.in +7
-Cman configuration values are placed in the <cman> </cman> section of
-\fBcluster.conf\fP.  Per-node configuration related to cman is placed
-in the standard <clusternode> </clusternode> sections.  All cman
-configuration settings are optional; usually none are used.  The <cman>
-section is placed under the <cluster> section in cluster.conf.
-
-  <cluster>
-    <cman>
-    </cman>
-    ...
-  </cluster>
-.in -7
-
-
-\fIUDP port\fR
-.in +7
-By default, cman will use UDP port 5405/5404 for internode communication.  This can
-be changed by setting a port number as follows:
-
-  <cman port="6809">
-  </cman>
-
-This will cause cman to use ports 6809 and 6808 for cluster communications.
-
-.in -7
-
-
-\fIExpected votes\fR
-.in +7
-The expected votes value is used by cman to determine quorum.  The cluster is
-quorate if the sum of votes of existing members is over half of the expected
-votes value.  By default, cman sets the expected votes value to be the sum
-of votes of all nodes listed in cluster.conf.  This can be overridden by setting
-an explicit expected_votes value as follows:
-
-  <cman expected_votes="3">
-  </cman>
-
-If the cluster becomes partitioned, improper use of this option can result
-in more than one partition gaining quorum.  In that event, nodes in each
-partition will enable cluster services.
-.in -7
-
-
-\fITwo node clusters\fR
-.in +7
-Ordinarily, the loss of quorum after one out of two nodes fails will prevent
-the remaining node from continuing (if both nodes have one vote.)  Special
-configuration options can be set to allow the one remaining node to continue
-operating if the other fails.  To do this only two nodes, each with one vote,
-can be defined in cluster.conf.  The two_node and expected_votes values must
-then be set to 1 in the cman section as follows.
-
-  <cman two_node="1" expected_votes="1">
-  </cman>
-.in -7
-
-
-\fINode votes\fR
-.in +7
-By default, a node is given one vote toward the calculation of quorum.
-This can be changed by giving a node a specific number of votes as
-follows:
-
-  <clusternode name="nd1" votes="2">
-  </clusternode>
-.in -7
-
-
-\fINode ID\fR
-.in +7
-
-All nodes must have a unique node ID. This is a single integer that identifies
-it to the cluster.
-A node's application to join the cluster may be rejected if you try to set
-the nodeid to one that is already used.
-
-  <clusternode name="nd1" nodeid="1">
-  </clusternode>
-
-.in -7
-\fIMulti-home configuration\fR
-.in +7
-It is quite common to use multiple ethernet adapters for cluster nodes, so
-they will tolerate the failure of one link. A common way to do this is to use
-ethernet bonding. Alternatively you can get openais to run in redundant ring
-mode by specifying an 'altname' for the node. This is an alternative name by
-which the node is known, that resolves to another IP address used on the 
-other ethernet adapter(s). You can optionally specify a different port and/or 
-multicast address for each altname in use. Up to 9 altnames (10 interfaces 
-in total) can be used.
-
-Note that if you are using the DLM with cman/openais then you MUST tell it 
-to use SCTP as it's communications protocol as TCP does not support multihoming.
-
-  <clusternode name="nd1" nodeid="1"> 
-     <altname name="nd1a" port="6809" mcast="229.192.0.2"/>
-  </clusternode>
-
-  <dlm protocol="sctp"/>
-.in -7
-
-
-\fIMulticast network configuration\fR
-.in +7
-cman uses multicast UDP packets to communicate with other nodes in the cluster.
-By default it will generate a multicast address using 239.192.x.x where x.x is
-the 16bit cluster ID number split into bytes. This, in turn is generated from a 
-hash of the cluster name though it can be specified explicitly. The purpose 
-of this is to allow multiple clusters to share the same subnet - they will each 
-use a different multicast address. You might also/instead want to isolate 
-clusters using the port number as shown above.
-
-It is possible to override the multicast address by specifying it in cluster.conf
-as shown:
-
-  <cman>
-      <multicast addr="229.192.0.1"/>
-  </cman>
-
-.in -7
-
-\fICluster ID\fR
-.in +7
-The cluster ID number is used to isolate clusters in the same subnet. Usually it
-is generated from a hash of the cluster name, but it can be overridden here if
-you feel the need. Sometimes cluster names can hash to the same ID.
-
-  <cman cluster_id="669">
-  </cman>
-
-.in -7
-
-\fIopenais security key\fR
-.in +7
-All traffic sent out by cman/openais is encrypted. By default the security key 
-used is simply the cluster name. If you need more security you can specify a
-key file that contains the key used to encrypt cluster communications.
-Of course, the contents of the key file must be the same on all nodes in the
-cluster. It is up to you to securely copy the file to the nodes.
-
-  <cman keyfile="/etc/openais.key">
-  </cman>
-
-Note that this only applies to cluster communication. The DLM does not encrypt 
-traffic.
-.in -7
-
-
-\fIOther openais parameters\fR
-.in +7
-When openais is started by cman (cman_tool runs aisexec), the openais.conf
-file is not used.  Many of the configuration parameters listed in
-openais.conf can be set in cluster.conf (CCS) instead.  Cman will read
-openais parameters from the following sections in cluster.conf and load
-them into openais:
-
-  <cluster>
-    <totem />
-    <logging />
-    <event />
-    <aisexec />
-    <group />
-  </cluster>
-
-See the 
-.B openais.conf(5)
-man page for more information on keys that are valid for these sections.
-Note that settings in the <clusternodes> section will override settings in
-the sections above, and options on the cman_tool command line will
-override both.  In particular, settings like bindnetaddr, mcastaddr,
-mcastport and nodeid will always be replaced by values in <clusternodes>.
-
-Cman uses different defaults for some of the openais parameters listed in
-openais.conf(5).  If you wish to use a non-default setting, they can be
-configured in cluster.conf as shown above.  Cman uses the following
-default values:
-
-  <totem
-    vsftype="none"
-    token="10000"
-    token_retransmits_before_loss_const="20"
-    join="60"
-    consensus="4800"
-    rrp_mode="none"
-    <!-- or rrp_mode="active" if altnames are present >
-  />
-  <logging syslog_facility="local4" />
-  <aisexec user="root" group="root" />
-
-Here's how to set the token timeout to five seconds:
-
-  <totem token="5000"/>
-
-And this is how to add extra openais logging options to CMAN and CPG:
-
-  <logging to_stderr="yes">
-    <logger ident="CPG" debug="on" to_stderr="yes">
-    </logger>
-    <logger ident="CMAN" debug="on" to_stderr="yes">
-    </logger>
-  </logging>
-
-.in -7
-
-
-.sp
-
-.SH "SEE ALSO"
-
-cluster.conf(5), openais.conf(5), ccs(7), cman_tool(8)
-
diff --git a/cman/man/cman_tool.8 b/cman/man/cman_tool.8
deleted file mode 100644
index 4cd60a5..0000000
--- a/cman/man/cman_tool.8
+++ /dev/null
@@ -1,411 +0,0 @@
-.TH CMAN_TOOL 8 "Nov 8 2007" "Cluster utilities"
-
-.SH NAME
-cman_tool \- Cluster Management Tool
-.SH SYNOPSIS
-.B cman_tool join | leave | kill | expected | votes | version | wait | status | nodes | services | debug [options]
-.br
-.SH DESCRIPTION
-.PP
-.B cman_tool
-is a program that manages the cluster management subsystem CMAN. cman_tool
-can be used to join the node to a cluster, leave the cluster, kill another
-cluster node or change the value of expected votes of a cluster.
-.br
-Be careful that you understand the consequences of the commands issued via cman_tool
-as they can affect all nodes in your cluster. Most of the time the cman_tool
-will only be invoked from your startup and shutdown scripts.
-.br
-.SH SUBCOMMANDS
-.TP
-.I join
-This is the main use of cman_tool. It instructs the cluster manager to attempt
-to join an existing cluster or (if no existing cluster exists) then to form
-a new one on its own.
-.br
-If no options are given to this command then it will take the cluster 
-configuration information from cluster.conf. However, it is possible to provide 
-all the information on the command-line or to override cluster.conf values by using
-the command line.
-
-.TP
-.I leave
-Tells CMAN to leave the cluster. You cannot do this if there are subsystems
-(eg DLM, GFS) active. You should dismount all GFS filesystems,
-shutdown CLVM, fenced and anything else using the cluster manager before
-using 
-.B cman_tool leave.
-Look at 'cman_tool status' and group_tool to see how many (and which)
-subsystems are active.
-.br
-When a node leaves the cluster, the remaining nodes recalculate quorum and this
-may block cluster activity if the required number of votes is not present.
-If this node is to be down for an extended period of time and you need to
-keep the cluster running, add the
-.B remove
-option, and the remaining nodes will recalculate quorum such that activity 
-can continue.
-
-.TP
-.I kill
-Tells CMAN to kill another node in the cluster. This will cause the local
-node to send a "KILL" message to that node and it will shut down.  Recovery
-will occur for the killed node as if it had failed.  This is a sort of remote
-version of "leave force" so only use if if you really know what you are doing.
-
-.TP
-.I expected
-Tells CMAN a new value of expected votes and instructs it to recalculate
-quorum based on this value. 
-.br
-Use this option if your cluster has lost quorum due to nodes failing and
-you need to get it running again in a hurry.
-
-.TP
-.I version
-Used alone this will report the major, minor, patch and config versions
-used by CMAN (also displayed in 'cman_tool status'). It can also be used
-with -r to tell cluster members to update.
-
-.TP
-.I wait 
-Waits until the node is a member of the cluster and then returns.
-
-.TP
-.I status
-Displays the local view of the cluster status.
-
-.TP
-.I nodes
-Displays the local view of the cluster nodes.
-
-.TP
-.I services
-Displays the local view of subsystems using cman (deprecated, group_tool
-should be used instead).
-
-.TP
-.I debug
-Sets the debug level of the running cman daemon. Debug output will be
-sent to syslog level LOG_DEBUG. the
-.B -d
-switch specifies the new logging level. This is the same bitmask used
-for cman_tool join -d
-.br
-.SH "LEAVE" OPTIONS
-.TP
-.I -w
-Normally, "cman_tool leave" will fail if the cluster is in transition (ie
-another node is joining or leaving the cluster). By adding the -w flag,
-cman_tool will wait and retry the leave operation repeatedly until it succeeds
-or a more serious error occurs.
-.TP
-.I -t <seconds>
-If -w is also specified then -t dictates the maximum amount of time cman_tool
-is prepared to wait. If the operation times out then a status of 2 is returned.
-.TP
-.I force
-Shuts down the cluster manager without first telling any of the subsystems
-to close down. Use this option with extreme care as it could easily cause data
-loss.
-.TP
-.I remove
-Tells the rest of the cluster to recalculate quorum such that activity can
-continue without this node.
-
-.SH "EXPECTED" OPTIONS
-.TP
-.I -e <expected-votes>
-The new value of expected votes to use. This will usually be enough
-to bring the cluster back to life. Values that would cause incorrect
-quorum will be rejected.
-
-.SH "KILL" OPTIONS
-.TP
-.I -n <nodename>
-The node name of the node to be killed. This should be the unqualified node
-name as it appears in 'cman_tool nodes'.
-
-.SH "VERSION" OPTIONS
-.TP
-.I -r <config_version>
-Update config version. You don't need to use this when adding a new node,
-the new cman node will tell the rest of the cluster to read the latest
-version of the config file automatically. 
-.br
-In fact the argument to -r might look as though it is ignored. 
-Its presence simply tells cman to re-read the configuration file and look 
-for that version in the file. cman will keep re-reading the file
-until a version number >= the passed version is found.
-.br
-cman_tool version on its own will always show the current version
-and not the one being looked for. So be aware that the display
-will possible not update immediately after you have run
-cman_tool version -r.
-.SH "WAIT" OPTIONS
-.TP
-.I -q
-Waits until the cluster is quorate before returning.
-.I -t <seconds>
-Dictates the maximum amount of time cman_tool is prepared to wait. 
-If the operation times out then a status of 2 is returned.
-
-.br
-.SH "JOIN" OPTIONS
-.TP
-.I -c <clustername>
-Provides a text name for the cluster. You can have several clusters on one
-LAN and they are distinguished by this name. Note that the name is hashed to 
-provide a unique number which is what actually distinguishes the cluster, so
-it is possible that two different names can clash. If this happens, the node
-will not be allowed into the existing cluster and you will have to pick 
-another name or use different port number for cluster communication.
-.TP
-.I -p <port>
-UDP port number used for cluster communication. This defaults to 5405.
-.TP
-.I -v <votes>
-Number of votes this node has in the cluster. Defaults to 1.
-.TP
-.I -e <expected votes>
-Number of expected votes for the whole cluster. If different nodes 
-provide different values then the highest is used. The cluster will
-only operate when quorum is reached - that is more than half the
-available votes are available to the cluster. The default for
-this value is the total number of votes for all nodes in the configuration file.
-.TP
-.I -2
-Sets the cluster up for a special "two node only" mode. Because of the
-quorum requirements mentioned above, a two-node cluster cannot be valid.
-This option tells the cluster manager that there will only ever be two
-nodes in the cluster and relies on fencing to ensure cluster integrity.
-If you specify this you cannot add more nodes without taking down the 
-existing cluster and reconfiguring it. Expected votes should be set to
-1 for a two-node cluster.
-.TP
-.I -n <nodename>
-Overrides the node name. By default the unqualified hostname is used. This
-option is also used to specify which interface is used for cluster
-communication. 
-.TP
-.I -N <nodeid>
-Overrides the node ID for this node. Normally, nodes are assigned a 
-node id in cluster.conf. If you specify an incorrect node ID here, the
-node might not be allowed to join the cluster. Setting node IDs in the
-configuration is a far better way to do this.
-.BR
-Note that the node's application to join the cluster may be rejected if you
-try to set the nodeid to one that has already been used, or if the node 
-was previously a member of the cluster but with a different nodeid.
-.TP
-.I -o <nodename>
-Override the name this node will have in the cluster. This will
-normally be the hostname or the first name specified by -n.
-Note how this differs from -n: -n tells cman_tool how to find
-the host address and/or the entry in the configuration file. -o simply
-changes the name the node will have in the cluster and has no
-bearing on the actual name of the machine. Use this option
-will extreme caution.
-.BR
-.TP
-.I -m <multicast-address>
-Specifies a multicast address to use for cluster communication. This
-is required for IPv6 operation. You should also specify an ethernet 
-interface to bind to this multicast address using the -i option.
-.TP
-.I -w
-Join and wait until the node is a cluster member.
-.TP
-.I -q
-Join and wait until the cluster is quorate.
-If the cluster join fails and -w (or -q) is specified, then it will be retried. Note that
-cman_tool cannot tell whether the cluster join was rejected by another node for a good reason
-or that it timed out for some benign reason; so it is strongly recommended that a timeout
-is also given with the wait options to join. If you don't want join to retry on failure but
-do want to wait, use the 
-.B cman_tool join 
-command without -w followed by
-.B cman_tool wait.
-.TP
-.I -k <keyfile>
-All traffic sent out by cman/openais is encrypted. By default the security key 
-used is simply the cluster name. If you need more security you can specify a
-key file that contains the key used to encrypt cluster communications.
-Of course, the contents of the key file must be the same on all nodes in the
-cluster. It is up to you to securely copy the file to the nodes.
-.TP
-.I -t <seconds>
-If -w or -q is also specified then -t dictates the maximum amount of time cman_tool
-is prepared to wait. If the operation times out then a status of 2 is returned.
-Note that just because cman_tool has given up, does not mean that cman itself
-has stopped trying to join a cluster.
-.TP
-.I -X
-Tells cman not to use the configuration file to get cluster information. If you use this option then cman will
-apply several defaults to the cluster to get it going. The cluster name will be 
-"RHCluster", node IDs will default to the IP address of the node and remote node 
-names will show up as Node<nodeid>. All of these, apart from the node names can
-be overridden on the cman_tool command-line if required.
-.br
-If you have to set up fence devices, services or anything else in cluster.conf then
-this option is probably not worthwhile to you - the extra readability of sensible node
-names and numbers will make it worth using cluster.conf for the cluster too. But for a simple
-failover cluster this might save you some effort.
-.br
-On each node using this configuration you will need to have the same authorization key
-installed. To create this key run
-.br
-mkdir /etc/ais
-.br
-ais-keygen
-.br
-mv /etc/ais/authkey /etc/cluster/cman_authkey
-.br
-then copy that file to all nodes you want to join the cluster.
-.br
-.TP
-.I -C
-Overrides the default configuration module. Usually cman uses ccsd to load its
-configuration. If you have your configuration database held elsewhere (eg LDAP) and 
-have a configuration plugin for it, then you should specify the name of the module
-(see the documentation for the module for the name of it - it's not necessarily the 
-same as the filename) here.
-.br
-It is possible to chain configuration modules by separating them with colons. So to
-add two modules (eg) 'ldapconfig' and 'ldappreproc' to the chain start cman with
--C ldapconfig:ldappreproc
-.br
-The default value for this is 'ccsconfig'. Note that if the -X is on the command-line
-then -C will be ignored.
-.TP
-.I -A
-Don't load openais services. Normally cman_tool join will load the configuration
-module 'openaisserviceenable' which will load the services installed by openais.
-If you don't want to use these services or have not installed openais then
-this switch will disable them.
-.SH "NODES" OPTIONS
-.TP
-.I -f
-Shows the date/time the node was last fenced (if it has bee fenced), and also
-the fence system that was used.
-.br
-.TP
-.I -a
-Shows the IP address(es) the nodes are communicating on.
-.br
-.TP
-.I -n <nodename>
-Shows node information for a specific node. This should be the unqualified node
-name as it appears in 'cman_tool nodes'.
-.br
-.TP
-.I -F <format>
-Specify the format of the output. The format string may contain one or
-more format options, each separated by a comma. Valid format options
-include: id, name, type, and addr.
-.br
-.SH "DEBUG" OPTIONS
-.TP
-.I -d <value>
-The value is a bitmask of
-.br 
-2 Barriers
-.br
-4 Membership messages
-.br
-8 Daemon operation, including command-line interaction
-.br
-16 Interaction with OpenAIS
-.br
-32 Startup debugging (cman_tool join operations only)
-.br
-.SH NOTES
-.br
-the 
-.B nodes
-subcommand shows a list of nodes known to cman. the state is one of the following:
-.br
-M	The node is a member of the cluster
-.br
-X	The node is not a member of the cluster
-.br
-d	The node is known to the cluster but disallowed access to it.
-.br
-.SH ENVIRONMENT VARIABLES
-cman_tool removes most environment variables before forking and running OpenAIS, as well as adding some of its own for setting up
-configuration parameters that were overridden on the command-line, the exception to this is that variable with names starting
-COROSYNC_ will be passed down intact as they are assumed to be used for configuring the daemon. 
-
-.SH DISALLOWED NODES
-Occasionally (but very infrequently I hope) you may see nodes marked as "Disallowed" in cman_tool status or "d" in cman_tool nodes.  This is a bit of a nasty hack to get around mismatch between what the upper layers expect of the cluster manager and OpenAIS.
-.TP
-If a node experiences a momentary lack of connectivity, but one that is long enough to trigger the token timeouts, then it will be removed from the cluster. When connectivity is restored OpenAIS will happily let it rejoin the cluster with no fuss. Sadly the upper layers don't like this very much. They may (indeed probably will have) have changed their internal state while the other node was away and there is no straightforward way to bring the rejoined node up-to-date with that state. When this happens the node is marked "Disallowed" and is not permitted to take part in cman operations.  
-.P
-If the remainder of the cluster is quorate the the node will be sent a kill message and it will be forced to leave the cluster that way. Note that fencing should kick in to remove the node permanently anyway, but it may take longer than the network outage for this to complete.
-
-If the remainder of the cluster is inquorate then we have a problem. The likelihood is that we will have two (or more) partitioned clusters and we cannot decide which is the "right" one. In this case we need to defer to the system administrator to kill an appropriate selection of nodes to restore the cluster to sensible operation.
-
-The latter scenario should be very rare and may indicate a bug somewhere in the code. If the local network is very flaky or busy it may be necessary to increase some of the protocol timeouts for OpenAIS. We are trying to think of better solutions to this problem.
-
-Recovering from this state can, unfortunately, be complicated. Fortunately, in the majority of cases, fencing will do the job for you, and the disallowed state will only be temporary. If it persists, the recommended approach it is to do a cman tool nodes on all systems in the cluster and determine the largest common subset of nodes that are valid members to each other. Then reboot the others and let them rejoin correctly. In the case of a single-node disconnection this should be straightforward, with a large cluster that has experienced a network partition it could get very complicated!
-
-Example:
-
-In this example we have a five node cluster that has experienced a network partition. Here is the output of cman_tool nodes from all systems:
-.nf
-Node  Sts   Inc   Joined               Name
-   1   M   2372   2007-11-05 02:58:55  node-01.example.com
-   2   d   2376   2007-11-05 02:58:56  node-02.example.com
-   3   d   2376   2007-11-05 02:58:56  node-03.example.com
-   4   M   2376   2007-11-05 02:58:56  node-04.example.com
-   5   M   2376   2007-11-05 02:58:56  node-05.example.com
-
-Node  Sts   Inc   Joined               Name
-   1   d   2372   2007-11-05 02:58:55  node-01.example.com
-   2   M   2376   2007-11-05 02:58:56  node-02.example.com
-   3   M   2376   2007-11-05 02:58:56  node-03.example.com
-   4   d   2376   2007-11-05 02:58:56  node-04.example.com
-   5   d   2376   2007-11-05 02:58:56  node-05.example.com
-
-Node  Sts   Inc   Joined               Name
-   1   d   2372   2007-11-05 02:58:55  node-01.example.com
-   2   M   2376   2007-11-05 02:58:56  node-02.example.com
-   3   M   2376   2007-11-05 02:58:56  node-03.example.com
-   4   d   2376   2007-11-05 02:58:56  node-04.example.com
-   5   d   2376   2007-11-05 02:58:56  node-05.example.com
-
-Node  Sts   Inc   Joined               Name
-   1   M   2372   2007-11-05 02:58:55  node-01.example.com
-   2   d   2376   2007-11-05 02:58:56  node-02.example.com
-   3   d   2376   2007-11-05 02:58:56  node-03.example.com
-   4   M   2376   2007-11-05 02:58:56  node-04.example.com
-   5   M   2376   2007-11-05 02:58:56  node-05.example.com
-
-Node  Sts   Inc   Joined               Name
-   1   M   2372   2007-11-05 02:58:55  node-01.example.com
-   2   d   2376   2007-11-05 02:58:56  node-02.example.com
-   3   d   2376   2007-11-05 02:58:56  node-03.example.com
-   4   M   2376   2007-11-05 02:58:56  node-04.example.com
-   5   M   2376   2007-11-05 02:58:56  node-05.example.com
-.fi
-In this scenario we should kill the node node-02 and node-03. Of course, the 3 node cluster of node-01, node-04 & node-05 should remain quorate and be able to fenced the two rejoined nodes anyway, but it is possible that the cluster has a qdisk setup that precludes this.
-
-.SH CONFIGURATION SYSTEMS
-This section details how the configuration systems work in cman. You might need to know this if you are using the -C option
-to cman_tool, or writing your own configuration subsystem.
-.br
-By default cman uses two configuration plugins to OpenAIS. The first, 'ccsconfig', reads the configuration information
-stored in cluster.conf and stores it in an internal database, in the same schema as it finds in cluster.conf. 
-The second plugin, 'cmanpreconfig', takes the information in that the database, adds several cman defaults, determines 
-the OpenAIS node name and nodeID
-and formats the information in a similar manner to openais.conf(5). OpenAIS then reads those keys to start the cluster protocol.
-cmanpreconfig also reads several environment variables that might be set by cman_tool which can override information in the 
-configuration.
-.br
-In the absence of ccsconfig, ie when 'cman_tool join' is run with -X switch (this removes ccsconfig from the module list), 
-cmanpreconfig also generates several defaults so that the cluster can be got running without any configuration information - see above
-for the details.
-.br
-Note that cmanpreconfig will not overwrite OpenAIS keys that are explicitly set in the configuration file, allowing you to provide
-custom values for token timeouts etc, even though cman has its own defaults for some of those values. The exception to this is the node
-name/address and multicast values, which are always taken from the cman configuration keys.
diff --git a/cman/man/cmannotifyd.8 b/cman/man/cmannotifyd.8
deleted file mode 100644
index 56ad353..0000000
--- a/cman/man/cmannotifyd.8
+++ /dev/null
@@ -1,66 +0,0 @@
-.TH "cmannotifyd" "8" "November 2008" "" "CMAN Notification Daemon"
-.SH "NAME"
-cmannotifyd \- CMAN Notification Daemon
-.SH "SYNOPSIS"
-\fBcmannotifyd [\-f] [\-d]
-.SH "DESCRIPTION"
-.PP 
-The \fBcmannotifyd\fP daemon talks to CMAN and provides a mechanism to notify
-external entities about cluster changes.
-
-CMAN dispatches 3 kind of notifications:
-
-\- CMAN_REASON_TRY_SHUTDOWN when cman requests to all clients if it is allowed
-to shutdown.
-
-\- CMAN_REASON_STATECHANGE when cman detects a node joining or leaving the
-cluster.
-
-\- CMAN_REASON_CONFIG_UPDATE when a configuration change event has been
-detected/requested.
-
-These notifications are then dispatched to the shell script 
-.B cman_notify 
-in the environment variable CMAN_NOTIFICATION.
-
-.B cman_notify
-will then execute all the scripts in the configured notification
-directory (default: /etc/cluster/cman-notify.d) passing a very minimal set of
-envvars including, of course, the CMAN_NOTIFICATION= type.
-The execution order is set by the filename as shown by "LC_ALL=C ls -las".
-
-.B cmannotifyd 
-logs are stored in the default log file
-(/var/log/cluster/cmannotifyd.log).
-
-.B cman_notify 
-logs are stored in the default log file
-(/var/log/cluster/cman_notify.log). By default the output from the scripts
-executed by 
-.B cman_notify
-is redirected to /dev/null.
-Users can either set CMAN_NOTIFICATION_DEBUG=1 in their environment or
-set proper debug configuration in cluster.conf to redirect scripts output
-to the cman_notify log file.
-
-.SH "NOTES"
-cmannotifyd does not block on cman_notify nor check the exit
-status of the script. 
-
-Notifications are dispatched in the same order as they
-arrive, one by one.
-
-CMAN_REASON_TRY_SHUTDOWN is passed to scripts for information only, they
-can not influence cman's decsion about whether or not to shut down.
-
-CMAN_REASON_STATECHANGE also implies CMAN_NOTIFICATION_QUORUM exported
-in the environment. CMAN_NOTIFICATION_QUORUM will be set to 1 (when the node
-is part of a quorate cluster) or 0 (otherwise).
-
-A template for cman_notify scripts can be found in the doc/ directory.
-
-.SH "OPTIONS"
-.IP "\-f"
-Run in the foreground (do not fork / daemonize).
-.IP "\-d"
-Enable debug output.
diff --git a/cman/man/mkqdisk.8 b/cman/man/mkqdisk.8
deleted file mode 100644
index a097680..0000000
--- a/cman/man/mkqdisk.8
+++ /dev/null
@@ -1,31 +0,0 @@
-.TH "mkqdisk" "8" "July 2006" "" "Quorum Disk Management"
-.SH "NAME"
-mkqdisk \- Cluster Quorum Disk Utility
-.SH "WARNING"
-Use of this command can cause the cluster to malfunction.
-.SH "SYNOPSIS"
-\fBmkqdisk [\-?|\-h] | [\-L] | [\-f \fPlabel\fB] [\-c \fPdevice \fB -l \fPlabel\fB] [-d [-d ...]]
-.SH "DESCRIPTION"
-.PP 
-The \fBmkqdisk\fP command is used to create a new quorum disk or display
-existing quorum disks accessible from a given cluster node.
-.SH "OPTIONS"
-.IP "\-c device \-l label"
-Initialize a new cluster quorum disk.  This will destroy all data on the given
-device.  If a cluster is currently using that device as a quorum disk, the
-entire cluster will malfunction.  Do not run this on an active cluster when
-qdiskd is running.  Only one device on the SAN should ever have the given
-label; using multiple different devices is currently not supported (it is
-expected a RAID array is used for quorum disk redundancy).  The label can be
-any textual string up to 127 characters - and is therefore enough space to hold
-a UUID created with uuidgen(1).
-.IP "\-f label"
-Find the cluster quorum disk with the given label and display information about it.
-.IP "\-L"
-Display information on all accessible cluster quorum disks.
-.IP "\-d"
-Increase debugging level.  Specify multiple times for more information.
-Currently, specifying more than twice has no effect.
-
-.SH "SEE ALSO"
-qdisk(5), qdiskd(8), uuidgen(1)
diff --git a/cman/man/qdisk.5 b/cman/man/qdisk.5
deleted file mode 100644
index 8ac9ad5..0000000
--- a/cman/man/qdisk.5
+++ /dev/null
@@ -1,470 +0,0 @@
-.TH "QDisk" "5" "20 Feb 2007" "" "Cluster Quorum Disk"
-.SH "NAME"
-qdisk \- a disk-based quorum daemon for CMAN / Linux-Cluster
-.SH "1. Overview"
-.SH "1.1 Problem"
-In some situations, it may be necessary or desirable to sustain
-a majority node failure of a cluster without introducing the need for
-asymmetric cluster configurations (e.g. client-server, or heavily-weighted
-voting nodes).
-
-.SH "1.2. Design Requirements"
-* Ability to sustain 1..(n-1)/n simultaneous node failures, without the
-danger of a simple network partition causing a split brain.  That is, we
-need to be able to ensure that the majority failure case is not merely
-the result of a network partition.
-
-* Ability to use external reasons for deciding which partition is the 
-the quorate partition in a partitioned cluster.  For example, a user may
-have a service running on one node, and that node must always be the master
-in the event of a network partition.  Or, a node might lose all network
-connectivity except the cluster communication path - in which case, a
-user may wish that node to be evicted from the cluster.
-
-* Integration with CMAN.  We must not require CMAN to run with us (or
-without us).  Linux-Cluster does not require a quorum disk normally -
-introducing new requirements on the base of how Linux-Cluster operates
-is not allowed.
-
-* Data integrity.  In order to recover from a majority failure, fencing
-is required.  The fencing subsystem is already provided by Linux-Cluster.
-
-* Non-reliance on hardware or protocol specific methods (i.e. SCSI
-reservations).  This ensures the quorum disk algorithm can be used on the
-widest range of hardware configurations possible.
-
-* Little or no memory allocation after initialization.  In critical paths
-during failover, we do not want to have to worry about being killed during
-a memory pressure situation because we request a page fault, and the Linux
-OOM killer responds...
-
-.SH "1.3. Hardware Considerations and Requirements"
-.SH "1.3.1. Concurrent, Synchronous, Read/Write Access"
-This quorum daemon requires a shared block device with concurrent read/write
-access from all nodes in the cluster.  The shared block device can be
-a multi-port SCSI RAID array, a Fiber-Channel RAID SAN, a RAIDed iSCSI
-target, or even GNBD.  The quorum daemon uses O_DIRECT to write to the
-device.
-
-.SH "1.3.2. Bargain-basement JBODs need not apply"
-There is a minimum performance requirement inherent when using disk-based
-cluster quorum algorithms, so design your cluster accordingly.  Using a
-cheap JBOD with old SCSI2 disks on a multi-initiator bus will cause 
-problems at the first load spike.  Plan your loads accordingly; a node's
-inability to write to the quorum disk in a timely manner will cause the
-cluster to evict the node.  Using host-RAID or multi-initiator parallel
-SCSI configurations with the qdisk daemon is unlikely to work, and will
-probably cause administrators a lot of frustration.  That having been
-said, because the timeouts are configurable, most hardware should work
-if the timeouts are set high enough.
-
-.SH "1.3.3. Fencing is Required"
-In order to maintain data integrity under all failure scenarios, use of
-this quorum daemon requires adequate fencing, preferably power-based
-fencing.  Watchdog timers and software-based solutions to reboot the node
-internally, while possibly sufficient, are not considered 'fencing' for 
-the purposes of using the quorum disk.
-
-.SH "1.4. Limitations"
-* At this time, this daemon supports a maximum of 16 nodes.  This is
-primarily a scalability issue: As we increase the node count, we increase
-the amount of synchronous I/O contention on the shared quorum disk.
-
-* Cluster node IDs must be statically configured in cluster.conf and
-must be numbered from 1..16 (there can be gaps, of course).
-
-* Cluster node votes should be more or less equal.
-
-* CMAN must be running before the qdisk program can operate in full
-capacity.  If CMAN is not running, qdisk will wait for it.
-
-* CMAN's eviction timeout should be at least 2x the quorum daemon's
-to give the quorum daemon adequate time to converge on a master during a
-failure + load spike situation.
-
-* For 'all-but-one' failure operation, the total number of votes assigned
-to the quorum device should be equal to or greater than the total number
-of node-votes in the cluster.  While it is possible to assign only one
-(or a few) votes to the quorum device, the effects of doing so have not
-been explored.
-
-* For 'tiebreaker' operation in a two-node cluster, unset CMAN's two_node
-flag (or set it to 0), set CMAN's expected votes to '3', set each node's
-vote to '1', and set qdisk's vote count to '1' as well.  This will allow
-the cluster to operate if either both nodes are online, or a single node &
-the heuristics.
-
-* Currently, the quorum disk daemon is difficult to use with CLVM if
-the quorum disk resides on a CLVM logical volume.  CLVM requires a
-quorate cluster to correctly operate, which introduces a chicken-and-egg
-problem for starting the cluster: CLVM needs quorum, but the quorum daemon
-needs CLVM (if and only if the quorum device lies on CLVM-managed storage).
-One way to work around this is to *not* set the cluster's expected votes
-to include the quorum daemon's votes.  Bring all nodes online, and start
-the quorum daemon *after* the whole cluster is running.  This will allow
-the expected votes to increase naturally.
-
-.SH "2. Algorithms"
-.SH "2.1. Heartbeating & Liveliness Determination"
-Nodes update individual status blocks on the quorum disk at a user-
-defined rate.  Each write of a status block alters the timestamp, which
-is what other nodes use to decide whether a node has hung or not.  If,
-after a user-defined number of 'misses' (that is, failure to update a
-timestamp), a node is declared offline.  After a certain number of 'hits'
-(changed timestamp + "i am alive" state), the node is declared online.
-
-The status block contains additional information, such as a bitmask of
-the nodes that node believes are online.  Some of this information is
-used by the master - while some is just for performance recording, and
-may be used at a later time.  The most important pieces of information
-a node writes to its status block are:
-
-.in 12
-- Timestamp
-.br
-- Internal state (available / not available)
-.br
-- Score
-.br
-- Known max score (may be used in the future to detect invalid configurations)
-.br
-- Vote/bid messages
-.br
-- Other nodes it thinks are online
-.in 0
-
-.SH "2.2. Scoring & Heuristics"
-The administrator can configure up to 10 purely arbitrary heuristics, and
-must exercise caution in doing so.  At least one administrator-
-defined heuristic is required for operation, but it is generally a good
-idea to have more than one heuristic.  By default, only nodes scoring over
-1/2 of the total maximum score will claim they are available via the
-quorum disk, and a node (master or otherwise) whose score drops too low
-will remove itself (usually, by rebooting).
-
-The heuristics themselves can be any command executable by 'sh -c'.  For
-example, in early testing the following was used:
-
-.ti 12
-<\fBheuristic \fP\fIprogram\fP\fB="\fP[ -f /quorum ]\fB" \fP\fIscore\fP\fB="\fP10\fB" \fP\fIinterval\fP\fB="\fP2\fB"/>\fP
-
-This is a literal sh-ism which tests for the existence of a file called
-"/quorum".  Without that file, the node would claim it was unavailable.
-This is an awful example, and should never, ever be used in production,
-but is provided as an example as to what one could do...
-
-Typically, the heuristics should be snippets of shell code or commands which
-help determine a node's usefulness to the cluster or clients.  Ideally, you
-want to add traces for all of your network paths (e.g. check links, or
-ping routers), and methods to detect availability of shared storage.
-
-.SH "2.3. Master Election"
-Only one master is present at any one time in the cluster, regardless of
-how many partitions exist within the cluster itself.  The master is
-elected by a simple voting scheme in which the lowest node which believes
-it is capable of running (i.e. scores high enough) bids for master status.
-If the other nodes agree, it becomes the master.  This algorithm is 
-run whenever no master is present.
-
-If another node comes online with a lower node ID while a node is still
-bidding for master status, it will rescind its bid and vote for the lower
-node ID.  If a master dies or a bidding node dies, the voting algorithm
-is started over.  The voting algorithm typically takes two passes to
-complete.
-
-Master deaths take marginally longer to recover from than non-master
-deaths, because a new master must be elected before the old master can
-be evicted & fenced.
-
-.SH "2.4. Master Duties"
-The master node decides who is or is not in the master partition, as
-well as handles eviction of dead nodes (both via the quorum disk and via
-the linux-cluster fencing system by using the cman_kill_node() API).
-
-.SH "2.5. How it All Ties Together"
-When a master is present, and if the master believes a node to be online,
-that node will advertise to CMAN that the quorum disk is available.  The
-master will only grant a node membership if:
-
-.in 12
-(a) CMAN believes the node to be online, and
-.br
-(b) that node has made enough consecutive, timely writes
-.in 16
-to the quorum disk, and
-.in 12
-(c) the node has a high enough score to consider itself online.
-.in 0
-
-.SH "3. Configuration"
-.SH "3.1. The <quorumd> tag"
-This tag is a child of the top-level <cluster> tag.
-
-.in 8
-\fB<quorumd\fP
-.in 9
-\fIinterval\fP\fB="\fP1\fB"\fP
-.in 12 
-This is the frequency of read/write cycles, in seconds.
-
-.in 9
-\fItko\fP\fB="\fP10\fB"\fP
-.in 12
-This is the number of cycles a node must miss in order to be declared dead.
-
-.in 9
-\fItko_up\fP\fB="\fPX\fB"\fP
-.in 12
-This is the number of cycles a node must be seen in order to be declared
-online.  Default is \fBfloor(tko/3)\fP.
-
-.in 9
-\fIupgrade_wait\fP\fB="\fP2\fB"\fP
-.in 12
-This is the number of cycles a node must wait before initiating a bid
-for master status after heuristic scoring becomes sufficient.  The
-default is 2.  This can not be set to 0, and should not exceed \fBtko\fP.
-
-.in 9
-\fImaster_wait\fP\fB="\fPX\fB"\fP
-.in 12
-This is the number of cycles a node must wait for votes before declaring
-itself master after making a bid.  Default is \fBfloor(tko/2)\fP. 
-This can not be less than 2, must be greater than tko_up, and should not
-exceed \fBtko\fP.
-
-.in 9
-\fIvotes\fP\fB="\fP3\fB"\fP
-.in 12
-This is the number of votes the quorum daemon advertises to CMAN when it
-has a high enough score.
-
-.in 9
-\fIlog_level\fP\fB="\fP4\fB"\fP
-.in 12
-This controls the verbosity of the quorum daemon in the system logs.
-0 = emergencies; 7 = debug.  This option is deprecated.
-
-.in 9
-\fIlog_facility\fP\fB="\fPdaemon\fB"\fP
-.in 12
-This controls the syslog facility used by the quorum daemon when logging.
-For a complete list of available facilities, see \fBsyslog.conf(5)\fP.
-The default value for this is 'daemon'.  This option is deprecated.
-
-.in 9
-\fIstatus_file\fP\fB="\fP/foo\fB"\fP
-.in 12
-Write internal states out to this file periodically ("-" = use stdout).
-This is primarily used for debugging.  The default value for this 
-attribute is undefined.  This option can be changed while qdiskd is
-running.
-
-.in 9
-\fImin_score\fP\fB="\fP3\fB"\fP
-.in 12
-Absolute minimum score to be consider one's self "alive".  If omitted,
-or set to 0, the default function "floor((n+1)/2)" is used, where \fIn\fP
-is the total of all of defined heuristics' \fIscore\fP attribute.  This
-must never exceed the sum of the heuristic scores, or else the quorum
-disk will never be available.
-
-.in 9
-\fIreboot\fP\fB="\fP1\fB"\fP
-.in 12
-If set to 0 (off), qdiskd will *not* reboot after a negative transition
-as a result in a change in score (see section 2.2).  The default for
-this value is 1 (on).  This option can be changed while qdiskd is
-running.
-
-.in 9
-\fIallow_kill\fP\fB="\fP1\fB"\fP
-.in 12
-If set to 0 (off), qdiskd will *not* instruct to kill nodes it thinks
-are dead (as a result of not writing to the quorum disk).  The default
-for this value is 1 (on).  This option can be changed while qdiskd 
-is running.
-
-.in 9
-\fIparanoid\fP\fB="\fP0\fB"\fP
-.in 12
-If set to 1 (on), qdiskd will watch internal timers and reboot the node
-if it takes more than (interval * tko) seconds to complete a quorum disk
-pass.  The default for this value is 0 (off).  This option can be changed
-while qdiskd is running.
-
-.in 9
-\fIscheduler\fP\fB="\fPrr\fB"\fP
-.in 12
-Valid values are 'rr', 'fifo', and 'other'.  Selects the scheduling queue
-in the Linux kernel for operation of the main & score threads (does not
-affect the heuristics; they are always run in the 'other' queue).  Default
-is 'rr'.  See sched_setscheduler(2) for more details.
-
-.in 9
-\fIpriority\fP\fB="\fP1\fB"\fP
-.in 12
-Valid values for 'rr' and 'fifo' are 1..100 inclusive.  Valid values
-for 'other' are -20..20 inclusive.  Sets the priority of the main & score
-threads.  The default value is 1 (in the RR and FIFO queues, higher numbers
-denote higher priority; in OTHER, lower values denote higher priority).
-This option can be changed while qdiskd is running.
-
-.in 9
-\fIstop_cman\fP\fB="\fP0\fB"\fP
-.in 12
-Ordinarily, cluster membership is left up to CMAN, not qdisk.
-If this parameter is set to 1 (on), qdiskd will tell CMAN to leave the
-cluster if it is unable to initialize the quorum disk during startup.  This
-can be used to prevent cluster participation by a node which has been 
-disconnected from the SAN.  The default for this value is 0 (off).
-This option can be changed while qdiskd is running.
-
-.in 9
-\fIuse_uptime\fP\fB="\fP1\fB"\fP
-.in 12
-If this parameter is set to 1 (on), qdiskd will use values from
-/proc/uptime for internal timings.  This is a bit less precise
-than \fBgettimeofday(2)\fP, but the benefit is that changing the 
-system clock will not affect qdiskd's behavior - even if \fBparanoid\fP
-is enabled.  If set to 0, qdiskd will use \fBgettimeofday(2)\fP, which
-is more precise.  The default for this value is 1 (on / use uptime).
-
-.in 9
-\fIdevice\fP\fB="\fP/dev/sda1\fB"\fP
-.in 12
-This is the device the quorum daemon will use.  This device must be the
-same on all nodes.
-
-.in 9
-\fIlabel\fP\fB="\fPmylabel\fB"\fP
-.in 12
-This overrides the device field if present.  If specified, the quorum
-daemon will read /proc/partitions and check for qdisk signatures
-on every block device found, comparing the label against the specified
-label.  This is useful in configurations where the block device name
-differs on a per-node basis.
-
-.in 9
-\fIcman_label\fP\fB="\fPmylabel\fB"/>\fP
-.in 12
-This overrides the label advertised to CMAN if present.  If specified,
-the quorum daemon will register with this name instead of the actual
-device name.
-
-.in 9
-\fImax_error_cycles\fP\fB="\fP0\fB"/>\fP
-.in 12
-If we receive an I/O error during a cycle, we do not poll CMAN and tell
-it we are alive.  If specified, this value will cause qdiskd to exit
-after the specified number of consecutive cycles during which I/O errors
-occur.  The default is 0 (no maximum).  This option can be changed while
-qdiskd is running.
-
-.in 8
-\fB/>\fP
-.in 0
-
-.SH "3.2.  The <heuristic> tag"
-This tag is a child of the <quorumd> tag.  Heuristics may not be changed
-while qdiskd is running.
-
-.in 8
-\fB<heuristic\fP
-.in 9
-\fIprogram\fP\fB="\fP/test.sh\fB"\fP
-.in 12
-This is the program used to determine if this heuristic is alive.  This
-can be anything which may be executed by \fI/bin/sh -c\fP.  A return
-value of zero indicates success; anything else indicates failure.  This
-is required.
-
-.in 9
-\fIscore\fP\fB="\fP1\fB"\fP
-.in 12
-This is the weight of this heuristic.  Be careful when determining scores
-for heuristics.  The default score for each heuristic is 1.
-
-.in 9
-\fIinterval\fP\fB="\fP2\fB"\fP
-.in 12
-This is the frequency (in seconds) at which we poll the heuristic.  The
-default interval for every heuristic is 2 seconds.
-.in 0
-
-.in 9
-\fItko\fP\fB="\fP1\fB"\fP
-.in 12
-After this many failed attempts to run the heuristic, it is considered DOWN,
-and its score is removed.  The default tko for each heuristic is 1, which 
-may be inadequate for things such as 'ping'.
-.in 8
-\fB/>\fP
-.in 0
-
-
-.SH "3.3. Examples"
-.SH "3.3.1. 3 cluster nodes & 3 routers"
-.in 8
-<cman expected_votes="6" .../>
-.br
-<clusternodes>
-.in 12
-<clusternode name="node1" votes="1" ... />
-.br
-<clusternode name="node2" votes="1" ... />
-.br
-<clusternode name="node3" votes="1" ... />
-.in 8
-</clusternodes>
-.br
-<quorumd interval="1" tko="10" votes="3" label="testing">
-.in 12
-<heuristic program="ping A -c1 -t1" score="1" interval="2" tko="3"/>
-.br
-<heuristic program="ping B -c1 -t1" score="1" interval="2" tko="3"/>
-.br
-<heuristic program="ping C -c1 -t1" score="1" interval="2" tko="3"/>
-.br
-.in 8
-</quorumd>
-
-.SH "3.3.2. 2 cluster nodes & 1 IP tiebreaker"
-.in 8
-<cman two_node="0" expected_votes="3" .../>
-.br
-<clusternodes>
-.in 12
-<clusternode name="node1" votes="1" ... />
-.br
-<clusternode name="node2" votes="1" ... />
-.in 8
-</clusternodes>
-.br
-<quorumd interval="1" tko="10" votes="1" label="testing">
-.in 12
-<heuristic program="ping A -c1 -t1" score="1" interval="2" tko="3"/>
-.br
-.in 8
-</quorumd>
-.in 0
-
-
-.SH "3.4. Heuristic score considerations"
-* Heuristic timeouts should be set high enough to allow the previous run
-of a given heuristic to complete.
-
-* Heuristic scripts returning anything except 0 as their return code 
-are considered failed.
-
-* The worst-case for improperly configured quorum heuristics is a race
-to fence where two partitions simultaneously try to kill each other.
-
-.SH "3.5. Creating a quorum disk partition"
-The mkqdisk utility can create and list currently configured quorum disks
-visible to the local node; see
-.B mkqdisk(8)
-for more details.
-
-.SH "SEE ALSO"
-mkqdisk(8), qdiskd(8), cman(5), syslog.conf(5), gettimeofday(2)
diff --git a/cman/man/qdiskd.8 b/cman/man/qdiskd.8
deleted file mode 100644
index 21bccbf..0000000
--- a/cman/man/qdiskd.8
+++ /dev/null
@@ -1,25 +0,0 @@
-.TH "qdiskd" "8" "July 2006" "" "Quorum Disk Management"
-.SH "NAME"
-qdiskd \- Cluster Quorum Disk Daemon
-.SH "SYNOPSIS"
-\fBqdiskd [\-f] [\-d]
-.SH "DESCRIPTION"
-.PP 
-The \fBqdiskd\fP daemon talks to CMAN and provides a mechanism for determining
-node-fitness in a cluster environment.  See
-.B
-qdisk(5)
-for configuration information.
-.SH "OPTIONS"
-.IP "\-f"
-Run in the foreground (do not fork / daemonize).
-.IP "\-d"
-Enable debug output.
-.IP "\-Q"
-Close stdin/out/err immediately before doing validations.  This
-is primarily for use when being called from an init script.  Using
-this option will stop all output, and can not be used with the -d 
-option.
-
-.SH "SEE ALSO"
-mkqdisk(8), qdisk(5), cman(5)
diff --git a/cman/notifyd/Makefile b/cman/notifyd/Makefile
deleted file mode 100644
index b2e5114..0000000
--- a/cman/notifyd/Makefile
+++ /dev/null
@@ -1,37 +0,0 @@
-TARGET1= cmannotifyd
-TARGET2= cman_notify
-
-SBINDIRT=${TARGET1} ${TARGET2}
-
-all: depends ${TARGET1} ${TARGET2}
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-CFLAGS += -D_GNU_SOURCE -DSBINDIR=\"${sbindir}\"
-CFLAGS += -I${ccsincdir} -I${cmanincdir} -I${logtincdir}
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${cmanlibdir} -L${ccslibdir} -L${logtlibdir} -lcman -lccs -llogthread
-LDFLAGS += -L${libdir}
-
-OBJS1=	main.o
-
-${TARGET1}: ${OBJS1}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-${TARGET2}: $(S)/${TARGET2}.in
-	cat $(S)/${TARGET2}.in | sed \
-		-e 's#@NOTIFYDDIR@#${notifyddir}#g' \
-		-e 's#@LOGDIR@#${logdir}#g' \
-	> ${TARGET2}
-
-depends:
-	$(MAKE) -C ../lib all
-
-clean: generalclean
-
--include $(OBJS1:.o=.d)
diff --git a/cman/notifyd/cman_notify.in b/cman/notifyd/cman_notify.in
deleted file mode 100644
index 9e05bc0..0000000
--- a/cman/notifyd/cman_notify.in
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/bash
-
-# concept from Debian run-parts and similar from fedora crontabs
-
-# keep going when something fails
-set +e
-
-if [ ! -d "@NOTIFYDDIR@" ]; then
-	exit 0
-fi
-
-LOGFILE="@LOGDIR@/cman_notify.log"
-
-if [ "$CMAN_NOTIFICATION_DEBUG" = "1" ]; then
-	OUT="$LOGFILE"
-fi
-
-# Ignore *~ and *, scripts
-for i in $(LC_ALL=C; echo @NOTIFYDDIR@/*[^~,]); do
-	[ -d $i ] && continue
-	# skip know scripts
-	[ "${i%.cfsaved}" != "${i}" ] && continue
-	[ "${i%.rpmsave}" != "${i}" ] && continue
-        [ "${i%.rpmorig}" != "${i}" ] && continue
-        [ "${i%.rpmnew}" != "${i}" ] && continue
-        [ "${i%.swp}" != "${i}" ] && continue
-	[ "${i%,v}" != "${i}" ] && continue
-	[ "${i%.dpkg-old}" != "${i}" ] && continue
-	[ "${i%.dpkg-dist}" != "${i}" ] && continue
-	[ "${i%.dpkg-new}" != "${i}" ] && continue
-
-	if [ -x $i ]; then
-		echo "starting $(basename $i)" >> $LOGFILE
-		[ -n "$OUT" ] && $i >> $OUT
-		[ -z "$OUT" ] && $i > /dev/null 2>&1
-		echo "finished $(basename $i)" >> $LOGFILE
-	fi
-done
-
-exit 0
diff --git a/cman/notifyd/main.c b/cman/notifyd/main.c
deleted file mode 100644
index 6aae796..0000000
--- a/cman/notifyd/main.c
+++ /dev/null
@@ -1,381 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <signal.h>
-#include <errno.h>
-#include <limits.h>
-#include <sched.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include <libcman.h>
-#include <ccs.h>
-#include <liblogthread.h>
-
-#include "copyright.cf"
-
-int debug = 0;
-int daemonize = 1;
-int daemon_quit = 0;
-cman_handle_t cman_handle;
-int rr = 0;
-
-#define LOCKFILE_NAME	"/var/run/cmannotifyd.pid"
-
-#define OPTION_STRING "hdfVr"
-
-#ifndef MAX_ARGS
-#define MAX_ARGS	128
-#endif
-
-static void print_usage()
-{
-	printf("Usage:\n\n");
-	printf("cmannotifyd [options]\n\n");
-	printf("Options:\n\n");
-	printf("  -f        Do not fork in background\n");
-	printf("  -d        Enable debugging output\n");
-	printf("  -r        Run Real Time priority\n");
-	printf("  -h        This help\n");
-	printf("  -V        Print program version information\n");
-	return;
-}
-
-static void read_arguments(int argc, char **argv)
-{
-	int cont = 1;
-	int optchar;
-
-	while (cont) {
-		optchar = getopt(argc, argv, OPTION_STRING);
-
-		switch (optchar) {
-
-		case 'd':
-			debug = 1;
-			break;
-
-		case 'f':
-			daemonize = 0;
-			break;
-
-		case 'r':
-			rr = 1;
-			break;
-
-		case 'h':
-			print_usage();
-			exit(EXIT_SUCCESS);
-			break;
-
-		case 'V':
-			printf("cmannotifyd %s (built %s %s)\n%s\n",
-			       RELEASE_VERSION, __DATE__, __TIME__,
-			       REDHAT_COPYRIGHT);
-			exit(EXIT_SUCCESS);
-			break;
-
-		case EOF:
-			cont = 0;
-			break;
-
-		default:
-			fprintf(stderr, "unknown option: %c\n", optchar);
-			print_usage();
-			exit(EXIT_FAILURE);
-			break;
-
-		}
-
-	}
-}
-
-static void lockfile(void)
-{
-	int fd, error;
-	struct flock lock;
-	char buf[128];
-
-	memset(buf, 0, 128);
-
-	fd = open(LOCKFILE_NAME, O_CREAT | O_WRONLY,
-		  S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
-	if (fd < 0) {
-		fprintf(stderr, "cannot open/create lock file %s\n",
-			LOCKFILE_NAME);
-		exit(EXIT_FAILURE);
-	}
-
-	lock.l_type = F_WRLCK;
-	lock.l_start = 0;
-	lock.l_whence = SEEK_SET;
-	lock.l_len = 0;
-
-	error = fcntl(fd, F_SETLK, &lock);
-	if (error) {
-		fprintf(stderr, "cmannotifyd is already running\n");
-		exit(EXIT_FAILURE);
-	}
-
-	error = ftruncate(fd, 0);
-	if (error) {
-		fprintf(stderr, "cannot clear lock file %s\n", LOCKFILE_NAME);
-		exit(EXIT_FAILURE);
-	}
-
-	sprintf(buf, "%d\n", getpid());
-
-	error = write(fd, buf, strlen(buf));
-	if (error <= 0) {
-		fprintf(stderr, "cannot write lock file %s\n", LOCKFILE_NAME);
-		exit(EXIT_FAILURE);
-	}
-}
-
-static void sigterm_handler(int sig)
-{
-	daemon_quit = 1;
-}
-
-static void set_oom_adj(int val)
-{
-	FILE *fp;
-
-	fp = fopen("/proc/self/oom_adj", "w");
-	if (!fp)
-		return;
-
-	fprintf(fp, "%i", val);
-	fclose(fp);
-}
-
-static void set_scheduler(void)
-{
-	struct sched_param sched_param;
-	int rv;
-
-	rv = sched_get_priority_max(SCHED_RR);
-	if (rv != -1) {
-		sched_param.sched_priority = rv;
-		rv = sched_setscheduler(0, SCHED_RR, &sched_param);
-		if (rv == -1)
-			logt_print(LOG_WARNING,
-				   "could not set SCHED_RR priority %d err %d",
-				   sched_param.sched_priority, errno);
-	} else {
-		logt_print(LOG_WARNING,
-			   "could not get maximum scheduler priority err %d",
-			   errno);
-	}
-}
-
-static void init_logging(int reconf)
-{
-	int ccs_handle;
-	int mode = LOG_MODE_OUTPUT_FILE | LOG_MODE_OUTPUT_SYSLOG;
-	int syslog_facility = SYSLOGFACILITY;
-	int syslog_priority = SYSLOGLEVEL;
-	char logfile[PATH_MAX];
-	int logfile_priority = SYSLOGLEVEL;
-
-	memset(logfile, 0, PATH_MAX);
-	sprintf(logfile, LOGDIR "/cmannotifyd.log");
-
-	ccs_handle = ccs_connect();
-	if (ccs_handle > 0) {
-		ccs_read_logging(ccs_handle, "cmannotifyd", &debug, &mode,
-				 &syslog_facility, &syslog_priority, &logfile_priority, logfile);
-		ccs_disconnect(ccs_handle);
-	}
-
-	if (!daemonize)
-		mode |= LOG_MODE_OUTPUT_STDERR;
-
-	if (!reconf)
-		logt_init("cmannotifyd", mode, syslog_facility, syslog_priority, logfile_priority, logfile);
-	else
-		logt_conf("cmannotifyd", mode, syslog_facility, syslog_priority, logfile_priority, logfile);
-}
-
-static void dispatch_notification(char *str, int *quorum)
-{
-	char *envp[MAX_ARGS];
-	char *argv[MAX_ARGS];
-	int envptr = 0;
-	int argvptr = 0;
-	char scratch[PATH_MAX];
-	pid_t notify_pid;
-	int pidstatus;
-
-	if (!str)
-		return;
-
-	/* pass notification type */
-	snprintf(scratch, sizeof(scratch), "CMAN_NOTIFICATION=%s", str);
-	envp[envptr++] = strdup(scratch);
-
-	if (quorum) {
-		snprintf(scratch, sizeof(scratch), "CMAN_NOTIFICATION_QUORUM=%d", *quorum);
-		envp[envptr++] = strdup(scratch);
-	}
-
-	if (debug)
-		envp[envptr++] = strdup("CMAN_NOTIFICATION_DEBUG=1");
-
-	envp[envptr++] = NULL;
-
-	argv[argvptr++] = "cman_notify";
-
-	argv[argvptr++] = NULL;
-
-	switch ( (notify_pid = fork()) )
-	{
-		case -1:
-			/* unable to fork */
-			exit(EXIT_FAILURE);
-			break;
-
-		case 0: /* child */
-			execve(SBINDIR "/cman_notify", argv, envp);
-			/* unable to execute cman_notify */
-			exit(EXIT_FAILURE);
-			break;
-
-		default: /* parent */
-			waitpid(notify_pid, &pidstatus, 0);
-			break;
-	}
-
-}
-
-static void cman_callback(cman_handle_t ch, void *private, int reason, int arg)
-{
-	char *str = NULL;
-
-	switch (reason) {
-	case CMAN_REASON_TRY_SHUTDOWN:
-		logt_print(LOG_DEBUG, "Received a cman shutdown request\n");
-		cman_replyto_shutdown(ch, 1);	/* allow cman to shutdown */
-		str = "CMAN_REASON_TRY_SHUTDOWN";
-		dispatch_notification(str, 0);
-		break;
-	case CMAN_REASON_STATECHANGE:
-		logt_print(LOG_DEBUG,
-			   "Received a cman statechange notification\n");
-		str = "CMAN_REASON_STATECHANGE";
-		dispatch_notification(str, &arg);
-		break;
-	case CMAN_REASON_CONFIG_UPDATE:
-		logt_print(LOG_DEBUG,
-			   "Received a cman config update notification\n");
-		init_logging(1);
-		str = "CMAN_REASON_CONFIG_UPDATE";
-		dispatch_notification(str, 0);
-		break;
-	}
-}
-
-static void byebye_cman()
-{
-	if (!cman_handle)
-		return;
-
-	cman_finish(cman_handle);
-	cman_handle = NULL;
-}
-
-static void setup_cman(int forever)
-{
-	int init = 0, active = 0;
-
-retry_init:
-	cman_handle = cman_init(NULL);
-	if (!cman_handle) {
-		if ((init++ < 5) || (forever)) {
-			if (daemon_quit)
-				goto out;
-
-			sleep(1);
-			goto retry_init;
-		}
-		logt_print(LOG_CRIT, "cman_init error %d\n", errno);
-		exit(EXIT_FAILURE);
-	}
-
-retry_active:
-	if (!cman_is_active(cman_handle)) {
-		if ((active++ < 5) || (forever)) {
-			if (daemon_quit)
-				goto out;
-
-			sleep(1);
-			goto retry_active;
-		}
-		logt_print(LOG_CRIT, "cman_is_active error %d\n", errno);
-		cman_finish(cman_handle);
-		exit(EXIT_FAILURE);
-	}
-
-	if (cman_start_notification(cman_handle, cman_callback) < 0) {
-		logt_print(LOG_CRIT, "cman_start_notification error %d\n", errno);
-		cman_finish(cman_handle);
-		exit(EXIT_FAILURE);
-	}
-
-	return;
-
-out:
-	byebye_cman();
-	exit(EXIT_SUCCESS);
-}
-
-static void loop()
-{
-	int rv;
-
-	for (;;) {
-		rv = cman_dispatch(cman_handle, CMAN_DISPATCH_ONE);
-		if (rv == -1 && errno == EHOSTDOWN) {
-			byebye_cman();
-			logt_print(LOG_DEBUG, "waiting for cman to reappear..\n");
-			setup_cman(1);
-			logt_print(LOG_DEBUG, "cman is back..\n");
-		}
-
-		if (daemon_quit) {
-			logt_print(LOG_DEBUG, "shutting down...\n");
-			byebye_cman();
-			exit(EXIT_SUCCESS);
-		}
-
-		sleep(1);
-	}
-}
-
-int main(int argc, char **argv)
-{
-
-	read_arguments(argc, argv);
-	lockfile();
-
-	if (daemonize) {
-		if (daemon(0, 0) < 0) {
-			perror("Unable to daemonize");
-			exit(EXIT_FAILURE);
-		}
-	}
-
-	init_logging(0);
-	signal(SIGTERM, sigterm_handler);
-	set_oom_adj(-16);
-	if (rr)
-		set_scheduler();
-
-	setup_cman(0);
-	loop();
-
-	return 0;
-}
diff --git a/cman/qdisk/Makefile b/cman/qdisk/Makefile
deleted file mode 100644
index d050ead..0000000
--- a/cman/qdisk/Makefile
+++ /dev/null
@@ -1,52 +0,0 @@
-TARGET1= qdiskd
-TARGET2= mkqdisk
-
-SBINDIRT=${TARGET1} ${TARGET2}
-
-all: depends ${TARGET1} ${TARGET2}
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-CFLAGS += -D_GNU_SOURCE
-CFLAGS += -Werror -Wstrict-prototypes -Wshadow
-CFLAGS += -I${ccsincdir} -I${cmanincdir} -I${logtincdir}
-CFLAGS += -I${zlibincdir} 
-CFLAGS += -I$(S)
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${logtlibdir} -llogthread -lpthread
-LDFLAGS += -L${zliblibdir} -lz
-LDFLAGS += -L${libdir}
-
-EXTRA_LDFLAGS += -L${cmanlibdir} -L${ccslibdir} -lcman -lccs
-
-OBJS1=	main.o \
-	score.o \
-	bitmap.o \
-	daemon_init.o
-
-OBJS2=	mkqdisk.o
-
-SHAREDOBJS= disk.o \
-	    disk_util.o \
-	    proc.o \
-	    scandisk.o
-
-${TARGET1}: ${SHAREDOBJS} ${OBJS1}
-	$(CC) -o $@ $^ $(EXTRA_LDFLAGS) $(LDFLAGS)
-
-${TARGET2}: ${SHAREDOBJS} ${OBJS2}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-depends:
-	$(MAKE) -C ../lib all
-
-clean: generalclean
-
--include $(OBJS1:.o=.d)
--include $(OBJS2:.o=.d)
--include $(SHAREDOBJS:.o=.d)
diff --git a/cman/qdisk/bitmap.c b/cman/qdisk/bitmap.c
deleted file mode 100644
index 37ff969..0000000
--- a/cman/qdisk/bitmap.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/** @file
- * Bitmap and membership mask handling routines.
- */
-#include <stdint.h>
-
-
-/**
- * Clear a bit in a bitmap / bitmask.
- *
- * @param mask		Bitmask to modify.
- * @param bitidx	Bit to modify.
- * @param masklen	Bitmask length (in uint8_t units)
- * @return		-1 if the index exceeds the number of bits in the
- *			bitmap, otherwise 0.
- */
-int
-clear_bit(uint8_t *mask, uint32_t bitidx, uint32_t masklen)
-{
-	uint32_t idx;
-	uint32_t bit;
-
-	/* Index into array */
-	idx = bitidx >> 3;
-	bit = 1 << (bitidx & 0x7);
-
-	if (idx >= masklen)
-		return -1;
-
-	mask[idx] &= ~bit;
-
-	return 0;
-}
-
-
-/**
- * Set a bit in a bitmap / bitmask.
- *
- * @param mask		Bitmask to modify.
- * @param bitidx	Bit to modify.
- * @param masklen	Bitmask length (in uint8_t units).
- * @return		-1 if the index exceeds the number of bits in the
- *			bitmap, otherwise 0.
- */
-int
-set_bit(uint8_t *mask, uint32_t bitidx, uint32_t masklen)
-{
-	uint32_t idx;
-	uint32_t bit;
-
-	/* Index into array */
-	idx = bitidx >> 3;
-	bit = 1 << (bitidx & 0x7);
-
-	if (idx >= masklen)
-		return -1;
-
-	mask[idx] |= bit;
-
-	return 0;
-}
-
-
-/**
- * Check the status of a bit in a bitmap / bitmask.
- *
- * @param mask		Bitmask to check.
- * @param bitidx	Bit to to check.
- * @param masklen	Bitmask length (in uint8_t units).
- * @return		-1 if the index exceeds the number of bits in the
- *			bitmap, 0 if not set, or 1 if set.
- */
-int
-is_bit_set(uint8_t *mask, uint32_t bitidx, uint32_t masklen)
-{
-	uint32_t idx;
-	uint32_t bit;
-
-	/* Index into array */
-	idx = bitidx >> 3;
-	bit = 1 << (bitidx & 0x7);
-
-	if (idx >= masklen)
-		return -1;
-
-	return !!(mask[idx]&bit);
-}
-
-
diff --git a/cman/qdisk/daemon_init.c b/cman/qdisk/daemon_init.c
deleted file mode 100644
index 7a24733..0000000
--- a/cman/qdisk/daemon_init.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/** @file
- * daemon_init function, does sanity checks and calls daemon().
- *
- * Author: Jeff Moyer <jmoyer@redhat.com>
- */
-/*
- * TODO: Clean this up so that only one function constructs the 
- *       pidfile /var/run/loggerd.PID, and perhaps only one function
- *       forms the /proc/PID/ path.
- *
- *       Also need to add file locking for the pid file.
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/param.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <sys/mman.h>
-#include <sys/errno.h>
-#include <libgen.h>
-#include <signal.h>
-#include <liblogthread.h>
-
-/*
- * This should ultimately go in a header file.
- */
-void daemon_init(char *prog);
-int check_process_running(char *prog, pid_t * pid);
-
-/*
- * Local prototypes.
- */
-static void update_pidfile(char *prog);
-static int setup_sigmask(void);
-
-static int
-check_pid_valid(pid_t pid, char *prog)
-{
-	FILE *fp;
-	DIR *dir;
-	char filename[PATH_MAX];
-	char dirpath[PATH_MAX];
-	char proc_cmdline[64];	/* yank this from kernel somewhere */
-	char *s = NULL;
-
-	memset(filename, 0, PATH_MAX);
-	memset(dirpath, 0, PATH_MAX);
-
-	snprintf(dirpath, sizeof (dirpath), "/proc/%d", pid);
-	if ((dir = opendir(dirpath)) == NULL) {
-		closedir(dir);
-		return 0;	/* Pid has gone away. */
-	}
-	closedir(dir);
-
-	/*
-	 * proc-pid directory exists.  Now check to see if this
-	 * PID corresponds to the daemon we want to start.
-	 */
-	snprintf(filename, sizeof (filename), "/proc/%d/cmdline", pid);
-	fp = fopen(filename, "r");
-	if (fp == NULL) {
-		perror("check_pid_valid");
-		return 0;	/* Who cares.... Let's boogy on. */
-	}
-
-	if (!fgets(proc_cmdline, sizeof (proc_cmdline) - 1, fp)) {
-		/*
-		 * Okay, we've seen processes keep a reference to a
-		 * /proc/PID/stat file and not let go.  Then when
-		 * you try to read /proc/PID/cmline, you get either
-		 * \000 or -1.  In either case, we can safely assume
-		 * the process has gone away.
-		 */
-		fclose(fp);
-		return 0;
-	}
-	fclose(fp);
-
-	s = &(proc_cmdline[strlen(proc_cmdline)]);
-	if (*s == '\n')
-		*s = 0;
-
-	/*
-	 * Check to see if this is the same executable.
-	 */
-	if ((s = strstr(proc_cmdline, prog)) == NULL) {
-		return 0;
-	} else {
-		return 1;
-	}
-}
-
-
-int
-check_process_running(char *prog, pid_t * pid)
-{
-	pid_t oldpid;
-	FILE *fp;
-	char filename[PATH_MAX];
-	char *cmd;
-	int ret;
-	struct stat st;
-
-	*pid = -1;
-
-	/*
-	 * Now see if there is a pidfile associated with this cmd in /var/run
-	 */
-	fp = NULL;
-	memset(filename, 0, PATH_MAX);
-
-	cmd = basename(prog);
-	snprintf(filename, sizeof (filename), "/var/run/%s.pid", cmd);
-
-	ret = stat(filename, &st);
-	if ((ret < 0) || (!st.st_size))
-		return 0;
-
-	/*
-	 * Read the pid from the file.
-	 */
-	fp = fopen(filename, "r");
-	if (fp == NULL) {	/* error */
-		return 0;
-	}
-
-	ret = fscanf(fp, "%d\n", &oldpid);
-	fclose(fp);
-
-	if ((ret == EOF) || (ret != 1))
-		return 0;
-
-	if (check_pid_valid(oldpid, cmd)) {
-		*pid = oldpid;
-		return 1;
-	}
-	return 0;
-}
-
-
-static void
-update_pidfile(char *prog)
-{
-	FILE *fp = NULL;
-	char *cmd;
-	char filename[PATH_MAX];
-
-	memset(filename, 0, PATH_MAX);
-
-	cmd = basename(prog);
-	snprintf(filename, sizeof (filename), "/var/run/%s.pid", cmd);
-
-	fp = fopen(filename, "w");
-	if (fp == NULL) {
-		exit(1);
-	}
-
-	fprintf(fp, "%d", getpid());
-	fclose(fp);
-}
-
-
-static int
-setup_sigmask(void)
-{
-	sigset_t set;
-
-	sigfillset(&set);
-
-	/*
-	 * Dont't block signals which would cause us to dump core.
-	 */
-	sigdelset(&set, SIGQUIT);
-	sigdelset(&set, SIGILL);
-	sigdelset(&set, SIGTRAP);
-	sigdelset(&set, SIGABRT);
-	sigdelset(&set, SIGFPE);
-	sigdelset(&set, SIGSEGV);
-	sigdelset(&set, SIGBUS);
-
-	/*
-	 * Don't block SIGTERM or SIGCHLD
-	 */
-	sigdelset(&set, SIGTERM);
-	sigdelset(&set, SIGCHLD);
-
-	return (sigprocmask(SIG_BLOCK, &set, NULL));
-}
-
-
-void
-daemon_init(char *prog)
-{
-	uid_t uid;
-	pid_t pid;
-
-	uid = getuid();
-	if (uid) {
-		logt_print(LOG_ERR,
-			"daemon_init: Sorry, only root wants to run this.\n");
-		exit(1);
-	}
-
-	if (check_process_running(prog, &pid) && (pid != getpid())) {
-		logt_print(LOG_ERR,
-			"daemon_init: Process \"%s\" already running.\n",
-			prog);
-		exit(1);
-	}
-	if (setup_sigmask() < 0) {
-		logt_print(LOG_ERR, "daemon_init: Unable to set signal mask.\n");
-		exit(1);
-	}
-
-	if(daemon(0, 0)) {
-		logt_print(LOG_ERR, "daemon_init: Unable to daemonize.\n");
-		exit(1);
-	}
-
-
-	update_pidfile(prog);
-}
diff --git a/cman/qdisk/disk.c b/cman/qdisk/disk.c
deleted file mode 100644
index 9a8d8ee..0000000
--- a/cman/qdisk/disk.c
+++ /dev/null
@@ -1,774 +0,0 @@
-/** @file
- * Single-block Raw/Direct I/O Functions
- */
-/*
- *  author: Tim Burke <tburke at redhat.com>
- *  description: Raw IO Interfaces.
- *
- * The RAW IO code we are using from 2.2.13 requires user buffers and
- * disk offsets to be 512 byte aligned.  So this code consists of a 
- * read and write routine which check to see if the user buffer is 
- * aligned.  If it isn't a temporary aligned buffer is allocated, a data
- * copy is performed along with the IO operation itself.
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <string.h>
-#include <errno.h>
-#include <disk.h>
-#include <platform.h>
-#include <unistd.h>
-#include <time.h>
-#include <linux/fs.h>
-#include <liblogthread.h>
-#include <zlib.h>
-
-static int diskRawRead(target_info_t *disk, char *buf, int len);
-
-/**
- * Calculate CRC32 of a data set.
- *
- * @param data		Data set for building CRC32
- * @param count		Size of data set, in bytes.
- * @return 		CRC32 of data set.
- */
-uint32_t clu_crc32(const char *data, size_t count)
-{
-	return (uint32_t)crc32(0L, (const Bytef *)data, (uInt)count);
-}
-
-
-/**
- * Swap the bytes of a shared header so that it's always in big-endian form
- * when stored on disk.
- *
- * @param hdr		Header to encode.
- */
-static void
-header_encode(shared_header_t *hdr)
-{
-	/* sanity check - LE machine -> already encoded. */
-	if (hdr->h_magic == be_swap32(SHARED_HEADER_MAGIC))
-		return;
-
-	swab32(hdr->h_magic);
-	swab32(hdr->h_hcrc);
-	swab32(hdr->h_dcrc);
-	swab32(hdr->h_length);
-	swab64(hdr->h_view);
-	swab64(hdr->h_timestamp);
-}
-
-
-/**
- * Swap the bytes of a shared header so that it's always in host-byte order
- * after we read it.  This should be a macro calling header_encode.
- *
- * @param hdr		Header to decode.
- */
-static void
-header_decode(shared_header_t *hdr)
-{
-	/* sanity check - LE machine -> already decoded. */
-	if (hdr->h_magic == SHARED_HEADER_MAGIC)
-		return;
-
-	swab32(hdr->h_magic);
-	swab32(hdr->h_hcrc);
-	swab32(hdr->h_dcrc);
-	swab32(hdr->h_length);
-	swab64(hdr->h_view);
-	swab64(hdr->h_timestamp);
-}
-
-
-/**
- * Generate a shared header suitable for storing data.  This includes:
- * header magic, header crc, data crc, header length, timestamp.
- * The header CRC is generated *after* the data CRC; so the header,
- * in effect, ensures that the data CRC is valid before we even look
- * at the data.  Thus, if the header CRC decodes properly, then we
- * assume that there's a very very high chance that the data CRC is valid.
- * If the data CRC doesn't match the data, it's indicative of a problem.
- *
- * @param hdr		Preallocated pointer to shared_header_t structure.
- * @param data		Data to be stored with hdr.
- * @param count		Size of data.
- * @return		-1 if CRC32 generation fails, or 0 on success.
- */
-static int
-header_generate(shared_header_t *hdr, const char *data, size_t count)
-{
-	memset(hdr,0,sizeof(*hdr));
-
-	hdr->h_magic = SHARED_HEADER_MAGIC;
-
-	if (data && count) {
-		hdr->h_dcrc = clu_crc32(data, count);
-		hdr->h_length = (uint32_t)count;
-
-		if (hdr->h_dcrc == 0) {
-			logt_print(LOG_ERR, "Invalid CRC32 generated on data!\n");
-			return -1;
-		}
-	}
-
-	hdr->h_timestamp = (uint64_t)time(NULL);
-
-	hdr->h_hcrc = clu_crc32((char *)hdr, sizeof(*hdr));
-	if (hdr->h_hcrc == 0) {
-		logt_print(LOG_ERR, "Invalid CRC32 generated on header!\n");
-		return -1;
-	}
-
-	header_encode(hdr);
-
-	return 0;
-}
-
-
-/**
- * Verify the integrity of a shared header.  Basically, check the CRC32
- * information against the data and header.  A better name for this would
- * be "shared_block_verify".
- *
- * @param hdr		Preallocated pointer to shared_header_t structure.
- * @param data		Data to be stored with hdr.
- * @param count		Size of data.
- * @return		-1 if CRC32 generation fails, or 0 on success.
- */
-static int
-header_verify(shared_header_t *hdr, const char *data, size_t count)
-{
-	uint32_t crc;
-	uint32_t bkupcrc;
-
-	header_decode(hdr);
-	/*
-	 * verify the header's CRC32.  Ok, we know it's overkill taking
-	 * the CRC32 of a friggin' 16-byte (12 bytes, really) structure,
-	 * but why not?
-	 */
-	bkupcrc = hdr->h_hcrc;
-	hdr->h_hcrc = 0;
-	crc = clu_crc32((char *)hdr, sizeof(*hdr));
-	hdr->h_hcrc = bkupcrc;
-	if (bkupcrc != crc) {
-#ifdef DEBUG
-		logt_print(LOG_DEBUG, "Header CRC32 mismatch; Exp: 0x%08x "
-			"Got: 0x%08x\n", bkupcrc, crc);
-#endif
-		return -1;
-	}
-
-	/*
-	 * Verify the magic number.
-	 */
-	if (hdr->h_magic != SHARED_HEADER_MAGIC) {
-		logt_print(LOG_DEBUG, "Magic mismatch; Exp: 0x%08x "
-			"Got: 0x%08x\n", SHARED_HEADER_MAGIC, hdr->h_magic);
-		return -1;
-	}
-
-	/* 
-	 * If there's no data or no count, or perhaps the length fed in is less
-	 * then the expected length, bail.
-	 */
-	if (!data || !count || (count < hdr->h_length))
-		return 0;
-
-	crc = clu_crc32(data, (count > hdr->h_length) ?
-			hdr->h_length : count);
-
-	if (hdr->h_dcrc != crc) {
-		logt_print(LOG_DEBUG, "Data CRC32 mismatch; Exp: 0x%08x "
-			"Got: 0x%08x\n", hdr->h_dcrc, crc);
-		return -1;
-	}
-
-	return 0;
-}
-
-
-
-/*
- * qdisk_open
- * Called to open the shared state partition with appropriate mode.
- * Returns - (the file descriptor), a value >= 0 on success.
- */
-int
-qdisk_open(char *name, target_info_t *disk)
-{
-	int ret;
-	int ssz;
-
-	/*
-	 * Open for synchronous writes to insure all writes go directly
-	 * to disk.
-	 */
-	disk->d_fd = open(name, O_RDWR | O_SYNC | O_DIRECT);
-	if (disk->d_fd < 0)
-		return disk->d_fd;
-
-	ret = ioctl(disk->d_fd, BLKSSZGET, &ssz);
-	if (ret < 0) {
-		logt_print(LOG_ERR, "qdisk_open: ioctl(BLKSSZGET)");
-		close(disk->d_fd);
-		return -1;
-	}
-
-	disk->d_blksz = ssz;
-	disk->d_pagesz = sysconf(_SC_PAGESIZE);
-
-	/* Check to verify that the partition is large enough.*/
-	ret = lseek(disk->d_fd, END_OF_DISK(disk->d_blksz), SEEK_SET);
-	if (ret < 0) {
-		logt_print(LOG_DEBUG, "open_partition: seek");
-		close(disk->d_fd);
-		return -1;
-	}
-
-	if (ret < END_OF_DISK(disk->d_blksz)) {
-		logt_print(LOG_ERR, "Partition %s too small\n", name);
-		errno = EINVAL;
-		close(disk->d_fd);
-		return -1;
-	}
-
-	/* Set close-on-exec bit */
-        ret = fcntl(disk->d_fd, F_GETFD, 0);
-        if (ret < 0) {
-		logt_print(LOG_ERR, "open_partition: fcntl(F_GETFD)");
-                close(disk->d_fd);
-                return -1;
-        }
-
-        ret |= FD_CLOEXEC;
-        if (fcntl(disk->d_fd, F_SETFD, ret) < 0) {
-		logt_print(LOG_ERR, "open_partition: fcntl(F_SETFD)");
-                close(disk->d_fd);
-                return -1;
-        }
-
-	return 0;
-}
-
-
-/*
- * qdisk_close
- * Closes the shared state disk partition.
- * Returns - value from close syscall.
- */
-int
-qdisk_close(target_info_t *disk)
-{
-	int retval;
-
-	if (!disk || disk->d_fd < 0) {
-		errno = EINVAL;
-		return -1;
-	}
-
-	retval = close(disk->d_fd);
-	disk->d_fd = -1;
-
-	return retval;
-}
-
-/*
- * qdisk_validate
- * Called to verify that the specified device special file representing
- * the partition appears to be a valid device.
- * Returns: 0 - success, 1 - failure
- */
-int
-qdisk_validate(char *name)
-{
-	struct stat stat_st, *stat_ptr;
-	target_info_t disk;
-	stat_ptr = &stat_st;
-
-	if (stat(name, stat_ptr) < 0) {
-		logt_print(LOG_ERR, "stat");
-		return -1;
-	}
-	/*
-	 * Verify that its a block or character special file.
-	 */
-	if (S_ISCHR(stat_st.st_mode) == 0 && S_ISBLK(stat_st.st_mode) == 0) {
-/*
-		errno = EINVAL;
-		return -1;
-*/
-		logt_print(LOG_WARNING, "Warning: %s is not a block device\n",
-		        name);
-	}
-
-	/*
-	 * Verify read/write permission.
-	 */
-	if (qdisk_open(name, &disk) < 0) {
-		logt_print(LOG_DEBUG, "%s: open of %s for RDWR failed: %s\n",
-			__FUNCTION__, name, strerror(errno));
-		return -1;
-	}
-	qdisk_close(&disk);
-	return 0;
-}
-
-
-static int
-diskRawReadShadow(target_info_t *disk, off_t readOffset, char *buf, int len)
-{
-	int ret;
-	shared_header_t *hdrp;
-	char *data;
-	int datalen;
-
-	ret = lseek(disk->d_fd, readOffset, SEEK_SET);
-	if (ret != readOffset) {
-		logt_print(LOG_DEBUG,
-		       "diskRawReadShadow: can't seek to offset %d.\n",
-		       (int) readOffset);
-		errno = ENODATA;
-		return -1;
-	}
-
-	ret = diskRawRead(disk, buf, len);
-	if (ret != len) {
-		logt_print(LOG_DEBUG, "diskRawReadShadow: aligned read "
-		       "returned %d, not %d.\n", ret, len);
-		errno = ENODATA;
-		return -1;
-	}
-
-	/* Decode the header portion so we can run a checksum on it. */
-	hdrp = (shared_header_t *)buf;
-	data = (char *)buf + sizeof(*hdrp);
-	swab_shared_header_t(hdrp);
-	datalen = hdrp->h_length;
-
-	if (header_verify(hdrp, data, len)) {
-#ifdef DEBUG
-		logt_print(LOG_DEBUG, "diskRawReadShadow: bad CRC32, "
-		       "offset = %d len = %d\n",
-		       (int) readOffset, len);
-#endif
-		errno = EPROTO;
-		return -1;
-	}
-
-	return 0;
-}
-
-
-/*
- * The RAW IO implementation requires buffers to be 512 byte aligned.
- * Here we check for alignment and do a bounceio if necessary.
- */
-static int
-diskRawRead(target_info_t *disk, char *buf, int len)
-{
-	void *alignedBuf;
-	int readret;
-	int extraLength;
-	int readlen;
-	int bounceNeeded = 1;
-
-	
-	/* was 3ff, which is (512<<1-1) */
-	if ((((unsigned long) buf &
-	      (unsigned long) ((disk->d_blksz << 1) -1)) == 0) &&
-	    ((len % (disk->d_blksz)) == 0)) {
-		bounceNeeded = 0;
-	}
-
-	if (bounceNeeded == 0) {
-		/* Already aligned and even multiple of 512, no bounceio
-		 * required. */
-		return (read(disk->d_fd, buf, len));
-	}
-
-	if (len > disk->d_blksz) {
-		logt_print(LOG_ERR,
-			"diskRawRead: not setup for reads larger than %d.\n",
-		       (int)disk->d_blksz);
-		return (-1);
-	}
-	/*
-	 * All IOs must be of size which is a multiple of 512.  Here we
-	 * just add in enough extra to accommodate.
-	 * XXX - if the on-disk offsets don't provide enough room we're cooked!
-	 */
-	extraLength = 0;
-	if (len % disk->d_blksz) {
-		extraLength = disk->d_blksz - (len % disk->d_blksz);
-	}
-
-	readlen = len;
-	if (extraLength) {
-		readlen += extraLength;
-	}
-
-	readret = posix_memalign((void **)&alignedBuf, disk->d_pagesz, disk->d_blksz);
-	if (readret < 0) {
-		return -1;
-	}
-
-	readret = read(disk->d_fd, alignedBuf, readlen);
-	if (readret > 0) {
-		if (readret > len) {
-			memcpy(alignedBuf, buf, len);
-			readret = len;
-		} else {
-			memcpy(alignedBuf, buf, readret);
-		}
-	}
-
-	free(alignedBuf);
-	if (readret != len) {
-		logt_print(LOG_ERR, "diskRawRead: read err, len=%d, readret=%d\n",
-			len, readret);
-	}
-
-	return (readret);
-}
-
-
-/*
- * The RAW IO implementation requires buffers to be 512 byte aligned.
- * Here we check for alignment and do a bounceio if necessary.
- */
-static int
-diskRawWrite(target_info_t *disk, char *buf, int len)
-{
-	void *alignedBuf;
-	int ret;
-	int extraLength;
-	int writelen;
-	int bounceNeeded = 1;
-
-	/* was 3ff, which is (512<<1-1) */
-	if ((((unsigned long) buf &
-	      (unsigned long) ((disk->d_blksz << 1) -1)) == 0) &&
-	    ((len % (disk->d_blksz)) == 0)) {
-		bounceNeeded = 0;
-	}
-
-	if (bounceNeeded == 0) {
-		/* Already aligned and even multiple of 512, no bounceio
-		 * required. */
-		return (write(disk->d_fd, buf, len));
-	}
-
-	if (len > disk->d_blksz) {
-		logt_print(LOG_ERR,
-			"diskRawRead: not setup for reads larger than %d.\n",
-		       (int)disk->d_blksz);
-		return (-1);
-	}
-	/*
-	 * All IOs must be of size which is a multiple of 512.  Here we
-	 * just add in enough extra to accommodate.
-	 * XXX - if the on-disk offsets don't provide enough room we're cooked!
-	 */
-	extraLength = 0;
-	if (len % disk->d_blksz) {
-		extraLength = disk->d_blksz - (len % disk->d_blksz);
-	}
-
-	writelen = len;
-	if (extraLength) {
-		writelen += extraLength;
-	}
-
-	ret = posix_memalign((void **)&alignedBuf, disk->d_pagesz, disk->d_blksz);
-	if (ret < 0) {
-		return -1;
-	}
-
-	if (len > disk->d_blksz) {
-		logt_print(LOG_ERR,
-		       "diskRawWrite: not setup for larger than %d.\n",
-		       (int)disk->d_blksz);
-		return (-1);
-	}
-
-	memcpy(buf, alignedBuf, len);
-	ret = write(disk->d_fd, alignedBuf, writelen);
-	if (ret > len) {
-		ret = len;
-	}
-
-	free(alignedBuf);
-	if (ret != len) {
-		logt_print(LOG_ERR, "diskRawWrite: write err, len=%d, ret=%dn",
-		       len, ret);
-	}
-
-	return (ret);
-}
-
-
-static int
-diskRawWriteShadow(target_info_t *disk, __off64_t writeOffset, char *buf, int len)
-{
-	off_t retval_seek;
-	ssize_t retval_write;
-
-	if ((writeOffset < 0) || (len < 0)) {
-		logt_print(LOG_ERR,
-		       "diskRawWriteShadow: writeOffset=%08x, "
-		       "len=%08x.\n", (int)writeOffset, len);
-		return (-1);
-	}
-
-	retval_seek = lseek(disk->d_fd, writeOffset, SEEK_SET);
-	if (retval_seek != writeOffset) {
-		logt_print(LOG_ERR,
-		       "diskRawWriteShadow: can't seek to offset %d\n",
-		       (int) writeOffset);
-		return (-1);
-	}
-
-	retval_write = diskRawWrite(disk, buf, len);
-	if (retval_write != len) {
-		if (retval_write == -1) {
-			logt_print(LOG_ERR, "%s: %s\n", __FUNCTION__,
-			       strerror(errno));
-		}
-		logt_print(LOG_ERR,
-		       "diskRawWriteShadow: aligned write returned %d"
-		       ", not %d\n", (int)retval_write, (int)len);
-		return (-1);
-	}
-
-	return 0;
-}
-
-
-int
-qdisk_read(target_info_t *disk, __off64_t offset, void *buf, int count)
-{
-	shared_header_t *hdrp;
-	void *ptr;
-	char *data;
-	size_t total;
-	int rv;
-
-	/*
-	 * Calculate the total length of the buffer, including the header.
-	 * Raw blocks are 512 byte aligned.
-	 */
-	total = count + sizeof(shared_header_t);
-	if (total < disk->d_blksz)
-		total = disk->d_blksz;
-
-	/* Round it up */
-	if (total % disk->d_blksz) 
-		total = total + (disk->d_blksz * !!(total % disk->d_blksz)) - (total % disk->d_blksz);
-
-	ptr = NULL;
-	rv = posix_memalign((void **)&ptr, disk->d_pagesz, disk->d_blksz);
-	if (rv < 0)
-		return -1;
-
-	if (ptr == NULL) 
-		return -1;
-
-	hdrp = (shared_header_t *)ptr;
-	data = (char *)hdrp + sizeof(shared_header_t);
-
-	rv = diskRawReadShadow(disk, offset, (char *)hdrp, disk->d_blksz);
-	
-	if (rv == -1) {
-		return -1;
-	}
-	
-	/* Copy out the data */
-	memcpy(buf, data, hdrp->h_length);
-
-	/* Zero out the remainder. */
-	if (hdrp->h_length < count) {
-		memset(buf + hdrp->h_length, 0,
-		       count - hdrp->h_length);
-	}
-
-	free(hdrp);
-	return count;
-}
-
-
-int
-qdisk_write(target_info_t *disk, __off64_t offset, const void *buf, int count)
-{
-	size_t maxsize;
-	shared_header_t *hdrp;
-	void *ptr;
-	char *data;
-	size_t total = 0, rv = -1, psz = disk->d_blksz; //sysconf(_SC_PAGESIZE);
-
-	maxsize = psz - (sizeof(shared_header_t));
-	if (count >= (maxsize + sizeof(shared_header_t))) {
-		logt_print(LOG_ERR, "error: count %d >= (%d + %d)\n", (int)count,
-		       (int)maxsize, (int)sizeof(shared_header_t));
-		errno = ENOSPC;
-		return -1;
-	}
-
-	/*
-	 * Calculate the total length of the buffer, including the header.
-	 */
-	total = count + sizeof(shared_header_t);
-	if (total < psz)
-		total = psz;
-
-	/* Round it up */
-	if (total % psz) 
-		total = total + (psz * !!(total % psz)) - (total % psz);
-
-	ptr = NULL;
-	rv = posix_memalign((void **)&ptr, disk->d_pagesz, total);
-	if (rv < 0) {
-		logt_print(LOG_ERR, "posix_memalign");
-		return -1;
-	}
-
-	/* 
-	 * Copy the data into our new buffer
-	 */
-	hdrp = (shared_header_t *)ptr;
-	data = (char *)hdrp + sizeof(shared_header_t);
-	memcpy(data, buf, count);
-
-	if (header_generate(hdrp, buf, count) == -1) {
-		free((char *)hdrp);
-		return -1;
-	}
-	swab_shared_header_t(hdrp);
-
-	/* 
-	 * Locking must be performed elsewhere.  We make no assumptions
-	 * about locking here.
-	 */
-	if (total == psz)
-		rv = diskRawWriteShadow(disk, offset, (char *)hdrp, psz);
-
-	if (rv == -1)
-		logt_print(LOG_ERR, "diskRawWriteShadow");
-	
-	free((char *)hdrp);
-	if (rv == -1)
-		return -1;
-	return count;
-}
-
-
-static int
-header_init(target_info_t *disk, char *label)
-{
-	quorum_header_t qh;
-
-	if (qdisk_read(disk, OFFSET_HEADER, &qh, sizeof(qh)) == sizeof(qh)) {
-		swab_quorum_header_t(&qh);
-		if (qh.qh_magic == HEADER_MAGIC_OLD) {
-			printf("Warning: Red Hat Cluster Manager 1.2.x "
-			       "header found\n");
-		} else if (qh.qh_magic == HEADER_MAGIC_NUMBER) {
-			printf("Warning: Initializing previously "
-			       "initialized partition\n");
-		}
-	}
-
-	if (gethostname(qh.qh_updatehost, sizeof(qh.qh_updatehost)) < 0) {
-		logt_print(LOG_ERR, "gethostname");
-		return -1;
-	}
-
-	/* Copy in the cluster/label name */
-	snprintf(qh.qh_cluster, sizeof(qh.qh_cluster)-1, "%s", label);
-
-	qh.qh_version = VERSION_MAGIC_V2;
-	if ((qh.qh_timestamp = (uint64_t)time(NULL)) <= 0) {
-		logt_print(LOG_ERR, "time");
-		return -1;
-	}
-
-	qh.qh_magic = HEADER_MAGIC_NUMBER;
-	qh.qh_blksz = disk->d_blksz;
-	qh.qh_kernsz = 0;
-
-	swab_quorum_header_t(&qh);
-	if (qdisk_write(disk, OFFSET_HEADER, &qh, sizeof(qh)) != sizeof(qh)) {
-		return -1;
-	}
-
-	return 0;
-}
-
-
-int
-qdisk_init(char *partname, char *label)
-{
-	target_info_t disk;
-	status_block_t ps, wps;
-	int nid, ret;
-	time_t t;
-
-	ret = qdisk_validate(partname);
-	if (ret < 0) {
-		logt_print(LOG_DEBUG, "qdisk_verify");
-		return -1;
-	}
-
-	ret = qdisk_open(partname, &disk);
-	if (ret < 0) {
-		logt_print(LOG_ERR, "qdisk_open");
-		return -1;
-	}
-
-	if (header_init(&disk, label) < 0) {
-		return -1;
-	}
-
-	time(&t);
-
-	ps.ps_magic = STATE_MAGIC_NUMBER;
-	ps.ps_updatenode = 0;
-	ps.pad0 = 0;
-	ps.ps_timestamp = (uint64_t)t;
-	ps.ps_state = (uint8_t)S_NONE;
-	ps.pad1[0] = 0;
-	ps.ps_flags = 0;
-	ps.ps_score = 0;
-	ps.ps_scoremax = 0;
-	ps.ps_ca_sec = 0;
-	ps.ps_ca_usec = 0;
-	ps.ps_lc_sec = 0;
-	ps.ps_ca_usec = 0;
-
-	/* Node IDs 1..N */
-	for (nid = 1; nid <= MAX_NODES_DISK; nid++) {
-		ps.ps_nodeid = nid;
-
-		printf("Initializing status block for node %d...\n", nid);
-		wps = ps;
-		swab_status_block_t(&wps);
-
-		if (qdisk_write(&disk, qdisk_nodeid_offset(nid, disk.d_blksz), &wps, sizeof(wps)) < 0) {
-			printf("Error writing node ID block %d\n", nid);
-			qdisk_close(&disk);
-			return -1;
-		}
-	}
-
-	qdisk_close(&disk);
-
-	return 0;
-}
-
diff --git a/cman/qdisk/disk.h b/cman/qdisk/disk.h
deleted file mode 100644
index 9704b8e..0000000
--- a/cman/qdisk/disk.h
+++ /dev/null
@@ -1,284 +0,0 @@
-/**
-  @file Main quorum daemon include file
- */
-#ifndef _QUORUM_DISK_H
-#define _QUORUM_DISK_H
-
-#include <stdint.h>
-#include <pthread.h>
-#include <arpa/inet.h>
-#include <libcman.h>
-
-#define MAX_NODES_DISK		16	
-#define MEMB_MASK_LEN           ((MAX_NODES_DISK / 8) + \
-				 (!!(MAX_NODES_DISK % 8)))
-#define DISK_MEMB_MASK_LEN	((MEMB_MASK_LEN + 7) & ~7)
-
-/** The membership bitmask type */
-typedef uint8_t memb_mask_t [DISK_MEMB_MASK_LEN];
-
-typedef enum {
-	S_NONE  = 0x0,		// Shutdown / not quorate / not running
-	S_EVICT	= 0x1,		// Voted out / about to be fenced.
-	/* ^^^ Fencing OK */
-	S_INIT	= 0x2,		// Initializing.  Hold your fire.
-        /* vvv Fencing will kill a node */
-	S_RUN	= 0x5,		// I think I'm running.
-	S_MASTER= 0x6		// I know I'm running, and have advertised to
-				// CMAN the availability of the disk vote for my
-				// partition.
-} disk_node_state_t;
-
-
-typedef enum {
-	M_NONE  = 0x0,
-	M_BID	= 0x1,
-	M_ACK	= 0x2,
-	M_NACK	= 0x3,
-	M_MASK	= 0x4
-} disk_msg_id_t;
-
-
-typedef enum {
-	FL_MSG	= 0x1,
-	FL_BID	= 0x2,
-	FL_VOTE = 0x4
-} disk_state_flag_t;
-
-
-typedef enum {
-	RF_REBOOT = 0x1,		/* Reboot if we go from master->none */
-	RF_STOP_CMAN = 0x2,
-	RF_DEBUG = 0x4,
-	RF_PARANOID = 0x8,
-	RF_ALLOW_KILL = 0x10,
-	RF_UPTIME = 0x20,
-	RF_CMAN_LABEL = 0x40
-} run_flag_t;
-
-
-/* RHEL 2.1 / RHCS3 old magic numbers */
-#define HEADER_MAGIC_OLD	0x39119FCD	/* partition header */
-#define STATE_MAGIC_OLD		0xF1840DCE	/* Status block */
-#define SHARED_HEADER_MAGIC_OLD	0x00DEBB1E	/* Per-block header */
-
-/* Conversion */
-#define HEADER_MAGIC_NUMBER	0xeb7a62c2	/* Partition header */
-#define STATE_MAGIC_NUMBER	0x47bacef8	/* Status block */
-#define SHARED_HEADER_MAGIC	0x00DEBB1E	/* Per-block headeer */
-
-/* Version magic. */
-#define VERSION_MAGIC_V2	0x389fabc4
-
-
-typedef struct __attribute__ ((packed)) {
-	uint32_t	ps_magic;
-	/* 4 */
-	uint32_t	ps_updatenode;		// Last writer
-	/* 8 */
-	uint64_t	ps_timestamp;		// time of last update
-	/* 16 */
-	uint32_t	ps_nodeid;
-	uint32_t	pad0;
-	/* 24 */
-	uint8_t		ps_state;		// running or stopped
-	uint8_t		pad1[1];
-	uint16_t	ps_flags;
-	/* 26 */
-	uint16_t	ps_score;		// Local points
-	uint16_t	ps_scoremax;		// What we think is our max
-						// points, if other nodes
-						// disagree, we may be voted
-						// out
-	/* 28 */
-	uint32_t	ps_ca_sec;		// Cycle speed (average)
-	uint32_t	ps_ca_usec;
-	/* 36 */
-	uint32_t	ps_lc_sec;		// Cycle speed (last)
-	uint32_t	ps_lc_usec;
-	uint64_t	ps_incarnation;		// Token to detect hung +
-						// restored node
-	/* 44 */
-	uint16_t	ps_msg;			// Vote/bid mechanism 
-	uint16_t	ps_seq;
-	uint32_t	ps_arg;
-	/* 52 */
-	memb_mask_t	ps_mask;		// Bitmap
-	memb_mask_t	ps_master_mask;		// Bitmap
-	/* 60 */
-} status_block_t;
-
-#define swab_status_block_t(ptr) \
-{\
-	swab32((ptr)->ps_magic);\
-	swab32((ptr)->ps_updatenode);\
-	swab64((ptr)->ps_timestamp);\
-	swab32((ptr)->ps_nodeid);\
-	swab32((ptr)->pad0);\
-	/* state + pad */ \
-	swab16((ptr)->ps_flags);\
-	swab16((ptr)->ps_score);\
-	swab16((ptr)->ps_scoremax);\
-	/* Cycle speeds */ \
-	swab32((ptr)->ps_ca_sec);\
-	swab32((ptr)->ps_ca_usec);\
-	swab32((ptr)->ps_lc_sec);\
-	swab32((ptr)->ps_lc_usec);\
-	/* Message */ \
-	swab16((ptr)->ps_msg); \
-	swab16((ptr)->ps_seq); \
-	swab32((ptr)->ps_arg); \
- }
-
-
-/*
- * Shared state disk header.  Describes cluster global information.
- */
-typedef struct __attribute__ ((packed)) {
-	uint32_t	qh_magic;
-	uint32_t	qh_version;	   // 
-	uint64_t	qh_timestamp;	   // time of last update
-	char 		qh_updatehost[128];// Hostname who put this here...
-	char		qh_cluster[120];   // Cluster name; CMAN only 
-					   // supports 16 chars.
-	uint32_t	qh_blksz;          // Known block size @ creation
-	uint32_t	qh_kernsz;	   // Ingored
-} quorum_header_t;
-
-#define swab_quorum_header_t(ptr) \
-{\
-	swab32((ptr)->qh_magic); \
-	swab32((ptr)->qh_version); \
-	swab32((ptr)->qh_blksz); \
-	swab32((ptr)->qh_kernsz); \
-	swab64((ptr)->qh_timestamp); \
-}
-
-
-
-/*
- * The user data is stored with this header prepended.
- * The header ONLY contains CRC information and the length of the data.
- * The data blocks themselves contain their own respective magic numbers.
- */
-typedef struct __attribute__ ((packed)) {
-	uint32_t h_magic;		/* Header magic	       */
-	uint32_t h_hcrc;		/* Header CRC          */
-	uint32_t h_dcrc;		/* CRC32 of data       */
-	uint32_t h_length;		/* Length of real data */
-	uint64_t h_view;		/* View # of real data */
-	uint64_t h_timestamp;		/* Timestamp           */
-} shared_header_t;
-
-#define SHARED_HEADER_INITIALIZER = {0, 0, 0, 0, 0, 0}
-
-#define swab_shared_header_t(ptr) \
-{\
-	swab32((ptr)->h_magic);\
-	swab32((ptr)->h_hcrc);\
-	swab32((ptr)->h_dcrc);\
-	swab32((ptr)->h_length);\
-	swab64((ptr)->h_view);\
-	swab64((ptr)->h_timestamp);\
-}
-
-
-/* Offsets from RHCM 1.2.x */
-#define OFFSET_HEADER	0
-#define HEADER_SIZE(ssz)		(ssz<4096?4096:ssz)
-
-#define OFFSET_FIRST_STATUS_BLOCK(ssz)	(OFFSET_HEADER + HEADER_SIZE(ssz))
-#define SPACE_PER_STATUS_BLOCK(ssz)	(ssz<4096?4096:ssz)
-#define STATUS_BLOCK_COUNT		MAX_NODES_DISK
-
-#define END_OF_DISK(ssz)		(OFFSET_FIRST_STATUS_BLOCK(ssz) + \
-					 (MAX_NODES_DISK + 1) * \
-					 SPACE_PER_STATUS_BLOCK(ssz)) \
-
-
-typedef struct {
-	int d_fd;
-	int _pad_;
-	size_t d_blksz;
-	size_t d_pagesz;
-} target_info_t;
-
-
-/* From disk.c */
-int qdisk_open(char *name, target_info_t *disk);
-int qdisk_close(target_info_t *disk);
-int qdisk_init(char *name, char *clustername);
-int qdisk_validate(char *name);
-int qdisk_read(target_info_t *disk, __off64_t ofs, void *buf, int len);
-int qdisk_write(target_info_t *disk, __off64_t ofs, const void *buf, int len);
-
-#define qdisk_nodeid_offset(nodeid, ssz) \
-	(OFFSET_FIRST_STATUS_BLOCK(ssz) + (SPACE_PER_STATUS_BLOCK(ssz) * (nodeid - 1)))
-
-/* From disk_utils.c */
-#define HISTORY_LENGTH 60
-typedef struct {
-	disk_msg_id_t m_msg;	 /* this is an int, but will be stored as 16bit*/
-	uint32_t m_arg;
-	uint16_t m_seq;
-	uint16_t pad0;
-} disk_msg_t;
-
-
-typedef struct {
-	uint64_t qc_incarnation;
-	struct timeval qc_average;
-	struct timeval qc_last[HISTORY_LENGTH];
-	target_info_t qc_disk;
-	int qc_my_id;
-	int qc_writes;
-	int qc_interval;
-	int qc_tko;
-	int qc_tko_up;
-	int qc_upgrade_wait;
-	int qc_master_wait;
-	int qc_votes;
-	int qc_scoremin;
-	int qc_sched;
-	int qc_sched_prio;
-	int qc_max_error_cycles;
-	int qc_master;		/* Master?! */
-	int qc_config;
-	int qc_pad;
-	disk_node_state_t qc_disk_status;
-	disk_node_state_t qc_status;
-	run_flag_t qc_flags;
-	cman_handle_t qc_cman_admin;
-	cman_handle_t qc_cman_user;
-	char *qc_device;
-	char *qc_label;
-	char *qc_status_file;
-	char *qc_cman_label;
-	char *qc_status_sockname;
-} qd_ctx;
-
-typedef struct {
-	uint64_t ni_incarnation;
-	uint64_t ni_evil_incarnation;
-	time_t	ni_last_seen;
-	int	ni_misses;
-	int	ni_seen;
-	disk_msg_t ni_msg;
-	disk_msg_t ni_last_msg;
-	disk_node_state_t ni_state;
-	status_block_t ni_status;
-} node_info_t;
-
-int qd_write_status(qd_ctx *ctx, int nid, disk_node_state_t state,
-		    disk_msg_t *msg, memb_mask_t mask, memb_mask_t master);
-int qd_init(qd_ctx *ctx, cman_handle_t ch_admin,
-	    cman_handle_t ch_user, int me);
-void qd_destroy(qd_ctx *ctx);
-
-/* proc.c */
-int find_partitions(const char *label,
-		    char *devname, size_t devlen, int print);
-int check_device(char *device, char *label, quorum_header_t *qh, int flags);
-
-
-#endif
diff --git a/cman/qdisk/disk_util.c b/cman/qdisk/disk_util.c
deleted file mode 100644
index 3743618..0000000
--- a/cman/qdisk/disk_util.c
+++ /dev/null
@@ -1,261 +0,0 @@
-/**
-  @file Misc. Quorum daemon context utilities / high-level functions
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <string.h>
-#include <errno.h>
-#include <disk.h>
-#include <platform.h>
-#include <unistd.h>
-#include <sys/time.h>
-#include <time.h>
-#include <liblogthread.h>
-
-inline void
-_diff_tv(struct timeval *dest, struct timeval *start, struct timeval *end)
-{
-	dest->tv_sec = end->tv_sec - start->tv_sec;
-	dest->tv_usec = end->tv_usec - start->tv_usec;
-
-	if (dest->tv_usec < 0) {
-		dest->tv_usec += 1000000;
-		dest->tv_sec--;
-	}
-}
-
-
-/**
- *
- * Grab the uptime from /proc/uptime.
- * 
- * @param tv		Timeval struct to store time in.  The sec
- * 			field contains seconds, the usec field 
- * 			contains the hundredths-of-seconds (converted
- * 			to micro-seconds)
- * @return		-1 on failure, 0 on success.
- */
-static inline int
-getuptime(struct timeval *tv)
-{
-	FILE *fp;
-	struct timeval junk;
-	int rv;
-	
-	fp = fopen("/proc/uptime","r");
-	if (!fp)
-		return -1;
-
-#if defined(__sparc__)
-	rv = fscanf(fp,"%ld.%d %ld.%d\n", &tv->tv_sec, &tv->tv_usec,
-		    &junk.tv_sec, &junk.tv_usec);
-#else
-	rv = fscanf(fp,"%ld.%ld %ld.%ld\n", &tv->tv_sec, &tv->tv_usec,
-		    &junk.tv_sec, &junk.tv_usec);
-#endif
-	fclose(fp);
-	
-	if (rv != 4) {
-		return -1;
-	}
-	
-	tv->tv_usec *= 10000;
-	
-	return 0;
-}
-
-
-inline int
-get_time(struct timeval *tv, int use_uptime)
-{
-	if (use_uptime) {
-		return getuptime(tv);
-	} else {
-		return gettimeofday(tv, NULL);
-	}
-}
-
- 
-/**
-  Update write times and calculate a new average time
- */
-static void
-qd_update_wtime(qd_ctx *ctx, struct timeval *newtime)
-{
-	int x;
-	int max = HISTORY_LENGTH;
-	uint64_t sum = 0;
-
-	/* Store the thing */
-	ctx->qc_writes++;
-	ctx->qc_last[ctx->qc_writes % HISTORY_LENGTH].tv_sec = newtime->tv_sec;
-	ctx->qc_last[ctx->qc_writes % HISTORY_LENGTH].tv_usec = newtime->tv_usec;
-
-	if (ctx->qc_writes < HISTORY_LENGTH)
-		max = ctx->qc_writes;
-
-	for (x = 0; x < max; x++) {
-		sum += (ctx->qc_last[x].tv_sec * 1000000);
-		sum += ctx->qc_last[x].tv_usec;
-	}
-
-	sum /= max;
-
-	ctx->qc_average.tv_sec = (sum / 1000000);
-	ctx->qc_average.tv_usec = (sum % 1000000);
-}
-
-
-/**
-  Write a status block to disk, given state, nodeid, message, and the
-  membership mask.
- */
-int
-qd_write_status(qd_ctx *ctx, int nid, disk_node_state_t state,
-		disk_msg_t *msg, memb_mask_t mask, memb_mask_t master)
-{
-	status_block_t ps;
-	struct timeval start, end;
-	int utime_ok = 1;
-
-	if (!ctx) {
-		errno = EINVAL;
-		return -1;
-	}
-
-	if (nid <= 0) {
-		errno = EINVAL;
-		return -1;
-	}
-
-	ps.ps_magic = STATE_MAGIC_NUMBER;
-	ps.ps_nodeid = nid;
-	ps.ps_updatenode = ctx->qc_my_id;
-	ps.pad0 = 0;
-	ps.ps_timestamp = (uint64_t)time(NULL);
-	ps.ps_state = (uint8_t)state;
-	ps.pad1[0] = 0;
-	ps.ps_flags = 0;
-	ps.ps_score = 0;
-	ps.ps_scoremax = 0;
-	ps.ps_ca_sec = ctx->qc_average.tv_sec;
-	ps.ps_ca_usec = ctx->qc_average.tv_usec;
-	ps.ps_incarnation = ctx->qc_incarnation;
-	if (mask) {
-		memcpy(ps.ps_mask, mask, sizeof(memb_mask_t));
-	} else {
-		memset(ps.ps_mask, 0, sizeof(memb_mask_t));
-	}
-	if (master) {
-		memcpy(ps.ps_master_mask, master, sizeof(memb_mask_t));
-	} else {
-		memset(ps.ps_master_mask, 0, sizeof(memb_mask_t));
-	}
-
-	if (ctx->qc_writes) {
-		ps.ps_lc_sec =
-		   ctx->qc_last[(ctx->qc_writes - 1) % HISTORY_LENGTH].tv_sec;
-		ps.ps_lc_usec =
-		   ctx->qc_last[(ctx->qc_writes - 1) % HISTORY_LENGTH].tv_usec;
-	} else {
-		ps.ps_lc_sec = ps.ps_lc_usec = 0;
-	}
-	ps.ps_nodeid = nid;
-
-	/* Argh! */
-	if (msg) {
-		ps.ps_msg = msg->m_msg;
-		ps.ps_seq = msg->m_seq;
-		ps.ps_arg = msg->m_arg;
-	} else {
-		ps.ps_msg = 0;
-		ps.ps_seq = 0;
-		ps.ps_arg = 0;
-	}
-
-	if (get_time(&start, ctx->qc_flags&RF_UPTIME) < 0)
-		utime_ok = 0;
-	swab_status_block_t(&ps);
-	if (qdisk_write(&ctx->qc_disk,
-			qdisk_nodeid_offset(nid, ctx->qc_disk.d_blksz),
-			&ps, sizeof(ps)) < 0) {
-		logt_print(LOG_ERR, "Error writing node ID block %d\n", nid);
-		return -1;
-	}
-	if (utime_ok && (get_time(&end, ctx->qc_flags&RF_UPTIME) < 0))
-		utime_ok = 0;
-
-	if (utime_ok) {
-		_diff_tv(&start,&start,&end);
-	} else {
-		/* Use heuristic */
-		start.tv_sec = ctx->qc_average.tv_sec;
-		start.tv_usec = ctx->qc_average.tv_usec;
-	}
-	qd_update_wtime(ctx, &start);
-
-	return 0;
-}
-
-
-/**
-  Generate a token based on the current system time.
- */
-static uint64_t
-generate_token(void)
-{
-	uint64_t my_token = 0;
-	struct timeval tv;
-
-        while(my_token == 0) {
-                gettimeofday(&tv, NULL);
-
-                my_token = ((uint64_t) (tv.tv_sec) << 32) |
-                        (uint64_t) (tv.tv_sec & 0x00000000ffffffff);
-        }
-
-	return my_token;
-}
-
-
-/**
-  Initialize a quorum disk context, given a CMAN handle and a nodeid.
- */
-int
-qd_init(qd_ctx *ctx, cman_handle_t ch_admin, cman_handle_t ch, int me)
-{
-	if (!ctx || !ch || !me) {
-		errno = EINVAL;
-		return -1;
-	}	
-
-	memset(ctx, 0, sizeof(*ctx));
-	ctx->qc_incarnation = generate_token();
-	ctx->qc_cman_admin = ch_admin;
-	ctx->qc_cman_user = ch;
-	ctx->qc_my_id = me;
-	ctx->qc_config = 0;
-
-	return 0;
-}
-
-
-/**
-  Destroy a quorum disk context
- */
-void
-qd_destroy(qd_ctx *ctx)
-{
-	if (ctx->qc_my_id == 0)
-		return;
-	if (ctx->qc_device) {
-		free(ctx->qc_device);
-		ctx->qc_device = NULL;
-	}
-	qdisk_close(&ctx->qc_disk);
-}
diff --git a/cman/qdisk/main.c b/cman/qdisk/main.c
deleted file mode 100644
index 6a64f0a..0000000
--- a/cman/qdisk/main.c
+++ /dev/null
@@ -1,1755 +0,0 @@
-/**
-  @file Main loop / functions for disk-based quorum daemon.
- */
-#define SYSLOG_NAMES
-#include <stdio.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <string.h>
-#include <errno.h>
-#include <disk.h>
-#include <platform.h>
-#include <unistd.h>
-#include <time.h>
-#include <sys/reboot.h>
-#include <sys/time.h>
-#include <sys/un.h>
-#include <linux/reboot.h>
-#include <sched.h>
-#include <signal.h>
-#include <ccs.h>
-#include <liblogthread.h>
-#include "score.h"
-#include <sys/syslog.h>
-
-#define LOG_DAEMON_NAME  "qdiskd"
-#define LOG_MODE_DEFAULT LOG_MODE_OUTPUT_SYSLOG|LOG_MODE_OUTPUT_FILE
-
-/* from daemon_init.c */
-int daemon_init(char *);
-int check_process_running(char *, pid_t *);
-
-/* from proc.c */
-char *state_str(disk_node_state_t s);
-
-/*
-  TODO:
-  1) Take into account timings to gracefully extend node timeouts during 
-     node spikes (that's why they are there!).
-  2) Poll ccsd for configuration changes.
-  3) Logging.
- */
-
-/* From bitmap.c */
-int clear_bit(uint8_t *mask, uint32_t bitidx, uint32_t masklen);
-int set_bit(uint8_t *mask, uint32_t bitidx, uint32_t masklen);
-int is_bit_set(uint8_t *mask, uint32_t bitidx, uint32_t masklen);
-inline int get_time(struct timeval *tv, int use_uptime);
-inline void _diff_tv(struct timeval *dest, struct timeval *start,
-		     struct timeval *end);
-
-static int _running = 1, _reconfig = 0;
-static int _debug = 0, _foreground = 0;
-
-/* */
-#define DEBUG_CONF 0x1
-#define DEBUG_CMDLINE 0x2
-
-static void update_local_status(qd_ctx *ctx, node_info_t *ni, int max, int score,
-		    	 int score_req, int score_max);
-static int get_config_data(qd_ctx *ctx, struct h_data *h, int maxh, int *cfh);
-
-
-static void
-int_handler(int sig)
-{
-	_running = 0;
-}
-
-
-static void
-hup_handler(int sig)
-{
-	_reconfig = 1;
-}
-
-
-static void
-usr1_handler(int sig)
-{
-	if (_debug)
-		/* Shut up debug mode */
-		_debug = 0;
-	else
-		_debug = DEBUG_CMDLINE;
-}
-
-
-/**
-  Simple thing to see if a node is running.
- */
-static inline int
-state_run(disk_node_state_t state)
-{
-	return (state >= S_INIT ? state : 0);
-}
-
-
-/**
-  Clear out / initialize node info block.
- */
-static void
-node_info_init(node_info_t *ni, int max)
-{
-	int x;
-	time_t t = time(NULL);
-
-	memset(ni, 0, sizeof(*ni) * max);
-	for (x = 0; x < max; x++) {
-		ni[x].ni_status.ps_nodeid = (x + 1); /* node ids are 1-based */
-		ni[x].ni_status.ps_timestamp = t;
-		ni[x].ni_misses = 0;
-		ni[x].ni_last_seen = t;
-	}
-}
-
-
-/**
-  Check to see if someone tried to evict us but we were out to lunch.
-  Rare case; usually other nodes would put up the 'Undead' message and
-  re-evict us.
- */
-static void
-check_self(qd_ctx *ctx, status_block_t *sb)
-{
-	if (!sb->ps_updatenode ||
-	    (sb->ps_updatenode == ctx->qc_my_id)) {
-		return;
-	}
-
-	/* I did not update this??! */
-	switch(sb->ps_state) {
-	case S_EVICT:
-		/* Someone told us to die. */
-		reboot(RB_AUTOBOOT);
-	default:
-		logt_print(LOG_EMERG, "Unhandled state: %d\n", sb->ps_state);
-		raise(SIGSTOP);
-	}
-}
-
-
-/**
-  Read in the node blocks off of the quorum disk and see if anyone has
-  or has not updated their timestamp recently.  See check_transitions as
-  well.
- */
-int
-read_node_blocks(qd_ctx *ctx, node_info_t *ni, int max)
-{
-	int x, errors = 0;
-	status_block_t *sb;
-
-	for (x = 0; x < max; x++) {
-
-		sb = &ni[x].ni_status;
-
-		if (qdisk_read(&ctx->qc_disk,
-			       qdisk_nodeid_offset(x+1, ctx->qc_disk.d_blksz),
-			       sb, sizeof(*sb)) < 0) {
-			logt_print(LOG_WARNING,"Error reading node ID block %d\n",
-			       x+1);
-			++errors;
-			continue;
-		}
-		swab_status_block_t(sb);
-
-		if (sb->ps_nodeid == ctx->qc_my_id) {
-			check_self(ctx, sb);
-			continue;
-		} 
-		/* message. */
-		memcpy(&(ni[x].ni_last_msg), &(ni[x].ni_msg),
-		       sizeof(ni[x].ni_last_msg));
-		ni[x].ni_msg.m_arg = sb->ps_arg;
-		ni[x].ni_msg.m_msg = sb->ps_msg;
-		ni[x].ni_msg.m_seq = sb->ps_seq;
-
-		if (!state_run(sb->ps_state))
-			continue;
-
-		/* Unchanged timestamp: miss */
-		if (sb->ps_timestamp == ni[x].ni_last_seen) {
-			/* XXX check for average + allow grace */
-			ni[x].ni_misses++;
-			if (ni[x].ni_misses > 1) {
-				logt_print(LOG_DEBUG,
-					"Node %d missed an update (%d/%d)\n",
-					x+1, ni[x].ni_misses, ctx->qc_tko);
-			}
-			continue;
-		}
-
-		/* Got through?  The node is good. */
-		ni[x].ni_misses = 0;
-		ni[x].ni_seen++;
-		ni[x].ni_last_seen = sb->ps_timestamp;
-	}
-
-	return errors;
-}
-
-
-/**
-  Check for node transitions.
- */
-static void
-check_transitions(qd_ctx *ctx, node_info_t *ni, int max, memb_mask_t mask)
-{
-	int x;
-
-	if (mask)
-		memset(mask, 0, sizeof(memb_mask_t));
-
-	for (x = 0; x < max; x++) {
-
-		/*
-		   Case 1: check to see if the node is still up
-		   according to our internal state, but has been
-		   evicted by the master or cleanly shut down
-		   (or restarted).
-
-		   Transition from Evicted/Shutdown -> Offline
-		 */
-		if ((ni[x].ni_state >= S_EVICT &&
-		     ni[x].ni_status.ps_state <= S_EVICT) ||
-		     (ni[x].ni_incarnation &&
-		      (ni[x].ni_incarnation !=
-		       ni[x].ni_status.ps_incarnation))) {
-
-			if (ni[x].ni_status.ps_state == S_EVICT) {
-				logt_print(LOG_NOTICE, "Node %d evicted\n",
-				       ni[x].ni_status.ps_nodeid);
-			} else {
-				/* State == S_NONE or incarnation change */
-				logt_print(LOG_INFO, "Node %d shutdown\n",
-				       ni[x].ni_status.ps_nodeid);
-				ni[x].ni_evil_incarnation = 0;
-			}
-
-			ni[x].ni_incarnation = 0;
-			ni[x].ni_seen = 0;
-			ni[x].ni_misses = 0;
-			ni[x].ni_state = S_NONE;
-
-			/* Clear our master mask for the node after eviction
-			 * or shutdown */
-			if (mask)
-				clear_bit(mask, (ni[x].ni_status.ps_nodeid-1),
-					  sizeof(memb_mask_t));
-			continue;
-		}
-
-		/*
-		   Case 2: Check for a heartbeat timeout.  Write an eviction
-		   notice if we're the master.  If this is our first notice
-		   of the heartbeat timeout, update our internal state
-		   accordingly.  When the master evicts this node, we will
-		   hit case 1 above.
-
-		   Transition from Online -> Evicted
-		 */
-		if (ni[x].ni_misses > ctx->qc_tko &&
-		     state_run(ni[x].ni_status.ps_state)) {
-
-			/*
-			   Mark our internal views as dead if nodes miss too
-			   many heartbeats...  This will cause a master
-			   transition if no live master exists.
-			 */
-			if (ni[x].ni_status.ps_state >= S_RUN &&
-			    ni[x].ni_seen) {
-				logt_print(LOG_DEBUG, "Node %d DOWN\n",
-				       ni[x].ni_status.ps_nodeid);
-				ni[x].ni_seen = 0;	
-			}
-
-			ni[x].ni_state = S_EVICT;
-			ni[x].ni_status.ps_state = S_EVICT;
-			ni[x].ni_evil_incarnation = 
-				ni[x].ni_status.ps_incarnation;
-			
-			/*
-			   Write eviction notice if we're the master.
-			 */
-			if (ctx->qc_status == S_MASTER) {
-				logt_print(LOG_NOTICE,
-				       "Writing eviction notice for node %d\n",
-				       ni[x].ni_status.ps_nodeid);
-				qd_write_status(ctx, ni[x].ni_status.ps_nodeid,
-						S_EVICT, NULL, NULL, NULL);
-				if (ctx->qc_flags & RF_ALLOW_KILL) {
-					logt_print(LOG_DEBUG, "Telling CMAN to "
-						"kill the node\n");
-					cman_kill_node(ctx->qc_cman_admin,
-						ni[x].ni_status.ps_nodeid);
-				}
-			}
-
-			/* Clear our master mask for the node after eviction */
-			if (mask)
-				clear_bit(mask, (ni[x].ni_status.ps_nodeid-1),
-					  sizeof(memb_mask_t));
-			continue;
-		}
-
-		/*
-		   Case 3:  Check for node who is supposed to be dead, but
-		   has started writing to the disk again with the same
-		   incarnation.  
-
-		   Transition from Offline -> Undead (BAD!!!)
-		 */
-		if (ni[x].ni_evil_incarnation &&
-                    (ni[x].ni_evil_incarnation == 
-		     ni[x].ni_status.ps_incarnation)) {
-			logt_print(LOG_CRIT, "Node %d is undead.\n",
-			       ni[x].ni_status.ps_nodeid);
-
-			logt_print(LOG_ALERT,
-			       "Writing eviction notice for node %d\n",
-			       ni[x].ni_status.ps_nodeid);
-			qd_write_status(ctx, ni[x].ni_status.ps_nodeid,
-					S_EVICT, NULL, NULL, NULL);
-			ni[x].ni_status.ps_state = S_EVICT;
-
-			/* XXX Need to fence it again */
-			if (ctx->qc_flags & RF_ALLOW_KILL) {
-				logt_print(LOG_DEBUG, "Telling CMAN to "
-					"kill the node\n");
-				cman_kill_node(ctx->qc_cman_admin,
-					ni[x].ni_status.ps_nodeid);
-			}
-			continue;
-		}
-
-
-		/*
-		   Case 4:  Check for a node who has met our minimum # of
-		   'seen' requests.
-
-		   Transition from Offline -> Online
-		 */
-		if (ni[x].ni_seen > ctx->qc_tko_up &&
-		    !state_run(ni[x].ni_state)) {
-			/*
-			   Node-join - everyone just kind of "agrees"
-			   there's no consensus to just have a node join
-			   right now.
-			 */
-			ni[x].ni_state = S_RUN;
-			logt_print(LOG_DEBUG, "Node %d is UP\n",
-			       ni[x].ni_status.ps_nodeid);
-			ni[x].ni_incarnation =
-			    ni[x].ni_status.ps_incarnation;
-			if (mask)
-				set_bit(mask, (ni[x].ni_status.ps_nodeid-1),
-					sizeof(memb_mask_t));
-
-			continue;
-		}
-
-		/*
-		   Case 5: Check for a node becoming master.  Not really a
-		   transition.
-		 */
-		if (ni[x].ni_state == S_RUN &&
-		    ni[x].ni_status.ps_state == S_MASTER) {
-			logt_print(LOG_INFO, "Node %d is the master\n",
-			       ni[x].ni_status.ps_nodeid);
-			ni[x].ni_state = S_MASTER;
-			if (mask)
-				set_bit(mask, (ni[x].ni_status.ps_nodeid-1),
-					sizeof(memb_mask_t));
-			continue;
-		}
-
-		/*
-		   All other cases: Believe the node's reported state
-		 */
-		if (state_run(ni[x].ni_state)) {
-			ni[x].ni_state = ni[x].ni_status.ps_state;
-			if (mask)
-				set_bit(mask, (ni[x].ni_status.ps_nodeid-1),
-					sizeof(memb_mask_t));
-		}
-	}
-}
-
-
-/**
-  Checks for presence of an online master.  If there is no
-  Returns
- */
-static int
-master_exists(qd_ctx *ctx, node_info_t *ni, int max, int *low_id, int *count)
-{
-	int x;
-	int masters = 0;
-	int ret = 0;
-
-	if (count)
-		*count = 0;
-	*low_id = ctx->qc_my_id;
-
-	for (x = 0; x < max; x++) {
-
-		/* See if this one's a master */
-		if (ni[x].ni_state >= S_RUN &&
-		    ni[x].ni_status.ps_state == S_MASTER &&
-		    ni[x].ni_status.ps_nodeid != ctx->qc_my_id) {
-			if (!ret)
-				ret = ni[x].ni_status.ps_nodeid;
-			++masters;
-			continue;
-		}
-
-		/* See if it's us... */
-		if (ni[x].ni_status.ps_nodeid == ctx->qc_my_id &&
-		    ni[x].ni_status.ps_state == S_MASTER) {
-			if (!ret)
-				ret = ctx->qc_my_id;
-			++masters;
-			continue;
-		}
-
-		/* Look for dead master */
-		if (ni[x].ni_state < S_RUN &&
-		    ni[x].ni_status.ps_state == S_MASTER) {
-			logt_print(LOG_DEBUG,
-			       "Node %d is marked master, but is dead.\n",
-			       ni[x].ni_status.ps_nodeid);
-			continue;
-		}
-
-		if (ni[x].ni_state < S_RUN)
-			continue;
-		
-		if (ni[x].ni_status.ps_nodeid < *low_id)
-			*low_id = ni[x].ni_status.ps_nodeid;
-	}
-
-	if (count)
-		*count = masters;
-	/*
- 	else if (masters == 1) {
-		printf("Node %d is the master\n", ret);
-	} else {
-		printf("No master found; node %d should be the master\n",
-		       *low_id);
-	}
-	*/
-
-	return ret;
-}
-
-
-/**
-  initialize node information blocks and wait to see if there is already
-  a cluster running using this QD.  Note that this will delay master
-  election if multiple nodes start with a second or two of each other.
- */
-static int
-quorum_init(qd_ctx *ctx, node_info_t *ni, int max, struct h_data *h, int maxh)
-{
-	int x = 0, score, maxscore, score_req = 0;
-
-	logt_print(LOG_INFO, "Quorum Daemon Initializing\n");
-	
-	if (mlockall(MCL_CURRENT|MCL_FUTURE) != 0) {
-		logt_print(LOG_ERR, "Unable to mlockall()\n");
-	}
-
-	if (qdisk_validate(ctx->qc_device) < 0)
-		return -1;
-
-	if (qdisk_open(ctx->qc_device, &ctx->qc_disk) < 0) {
-		logt_print(LOG_CRIT, "Failed to open %s: %s\n", ctx->qc_device,
-		       strerror(errno));
-		return -1;
-	}
-
-	logt_print(LOG_DEBUG, "I/O Size: %lu  Page Size: %lu\n",
-	       (unsigned long)ctx->qc_disk.d_blksz, (unsigned long)ctx->qc_disk.d_pagesz);
-	
-	if (h && maxh) {
-		start_score_thread(ctx, h, maxh);
-	} else {
-		logt_print(LOG_DEBUG, "Permanently setting score to 1/1\n");
-		fudge_scoring();
-	}
-
-	node_info_init(ni, max);
-	ctx->qc_status = S_INIT;
-	if (qd_write_status(ctx, ctx->qc_my_id,
-			    S_INIT, NULL, NULL, NULL) != 0) {
-		logt_print(LOG_CRIT, "Could not initialize status block!\n");
-		return -1;
-	}
-
-	while (++x <= ctx->qc_tko && _running) {
-		read_node_blocks(ctx, ni, max);
-		check_transitions(ctx, ni, max, NULL);
-
-		if (qd_write_status(ctx, ctx->qc_my_id,
-				    S_INIT, NULL, NULL, NULL) != 0) {
-			logt_print(LOG_CRIT, "Initialization failed\n");
-			return -1;
-		}
-
-		get_my_score(&score, &maxscore);
-		score_req = ctx->qc_scoremin;
-		if (score_req <= 0)
-			score_req = (maxscore/2 + 1);
-		update_local_status(ctx, ni, max, score, score_req, maxscore);
-
-		sleep(ctx->qc_interval);
-	}
-
-	get_my_score(&score, &maxscore);
-	logt_print(LOG_INFO, "Initial score %d/%d\n", score, maxscore);
-	if ((ctx->qc_flags & RF_STOP_CMAN) && (score < score_req))
-		return -1;
-	logt_print(LOG_INFO, "Initialization complete\n");
-
-	return 0;
-}
-
-
-/**
-  Vote for a master if it puts a bid in.
- */
-static void
-do_vote(qd_ctx *ctx, node_info_t *ni, int max, disk_msg_t *msg)
-{
-	int x;
-
-	for (x = 0; x < max; x++) {
-		if (ni[x].ni_state != S_RUN)
-			continue;
-
-		if (ni[x].ni_status.ps_msg == M_BID &&
-		    ni[x].ni_status.ps_nodeid < ctx->qc_my_id) {
-
-			/* Vote for lowest bidding ID that is lower
-			   than us */
-			msg->m_msg = M_ACK;
-			msg->m_arg = ni[x].ni_status.ps_nodeid;
-			msg->m_seq = ni[x].ni_status.ps_seq;
-
-			return;
-		}
-	}
-}
-
-
-/*
-  Check to match nodes in mask with nodes online according to CMAN.
-  Only the master needs to do this.
- */
-static void
-check_cman(qd_ctx *ctx, memb_mask_t mask, memb_mask_t master_mask)
-{
-	cman_node_t nodes[MAX_NODES_DISK];
-	int retnodes, x;
-
-	if (cman_get_nodes(ctx->qc_cman_admin, MAX_NODES_DISK,
-			   &retnodes, nodes) <0 )
-		return;
-
-	memset(master_mask, 0, sizeof(master_mask));
-	for (x = 0; x < retnodes; x++) {
-		if (is_bit_set(mask, nodes[x].cn_nodeid-1, sizeof(mask)) &&
-		    nodes[x].cn_member) {
-			set_bit(master_mask, nodes[x].cn_nodeid-1,
-				sizeof(master_mask));
-		} else {
-			/* Not in CMAN output = not allowed */
-			clear_bit(master_mask, (nodes[x].cn_nodeid-1),
-				  sizeof(memb_mask_t));
-		}
-	}
-}
-
-
-/* 
-   returns:
-	3: all acks received - you are the master.
-	2: nacked (not highest score?) might not happen
-	1: other node with lower ID is bidding and we should rescind our
-	   bid.
-	0: still waiting; don't clear bid; just wait another round.
-   Modifies:
-	*msg - it will store the vote for the lowest bid if we should
-	clear our bid.
- */ 
-static int
-check_votes(qd_ctx *ctx, node_info_t *ni, int max, disk_msg_t *msg)
-{
-	int x, running = 0, acks = 0, nacks = 0, low_id = ctx->qc_my_id;
-
-	for (x = 0; x < max; x++) {
-		if (state_run(ni[x].ni_state))
-			++running;
-		else
-			continue;
-
-		if (ni[x].ni_status.ps_msg == M_ACK &&
-		    ni[x].ni_status.ps_arg == ctx->qc_my_id) {
-			++acks;
-		}
-
-		if (ni[x].ni_status.ps_msg == M_NACK &&
-		    ni[x].ni_status.ps_arg == ctx->qc_my_id) {
-			++nacks;
-		}
-		
-		/* If there's someone with a lower ID who is also
-		   bidding for master, change our message to vote
-		   for the lowest bidding node ID */
-		if (ni[x].ni_status.ps_msg == M_BID && 
-		    ni[x].ni_status.ps_nodeid < low_id) {
-			low_id = ni[x].ni_status.ps_nodeid;
-			msg->m_msg = M_ACK;
-			msg->m_arg = ni[x].ni_status.ps_nodeid;
-			msg->m_seq = ni[x].ni_status.ps_seq;
-		}
-	}
-
-	if (acks == running)
-		return 3;
-	if (nacks)
-		return 2;
-	if (low_id != ctx->qc_my_id)
-		return 1;
-	return 0;
-}
-
-static void
-print_node_info(FILE *fp, node_info_t *ni)
-{
-	fprintf(fp, "node_info_t [node %d] {\n", ni->ni_status.ps_nodeid);
-	fprintf(fp, "    ni_incarnation = 0x%08x%08x\n",
-		((int)(ni->ni_incarnation>>32))&0xffffffff,
-		((int)(ni->ni_incarnation)&0xffffffff));
-	fprintf(fp, "    ni_evil_incarnation = 0x%08x%08x\n",
-		((int)(ni->ni_evil_incarnation>>32))&0xffffffff,
-		((int)(ni->ni_evil_incarnation)&0xffffffff));
-	fprintf(fp, "    ni_last_seen = %s", ctime(&ni->ni_last_seen));
-	fprintf(fp, "    ni_misses = %d\n", ni->ni_misses);
-	fprintf(fp, "    ni_seen = %d\n", ni->ni_seen);
-	fprintf(fp, "    ni_msg = {\n");
-	fprintf(fp, "        m_msg = 0x%08x\n", ni->ni_msg.m_msg);
-	fprintf(fp, "        m_arg = %d\n", ni->ni_msg.m_arg);
-	fprintf(fp, "        m_seq = %d\n", ni->ni_msg.m_seq);
-	fprintf(fp, "    }\n");
-	fprintf(fp, "    ni_last_msg = {\n");
-	fprintf(fp, "        m_msg = 0x%08x\n", ni->ni_last_msg.m_msg);
-	fprintf(fp, "        m_arg = %d\n", ni->ni_last_msg.m_arg);
-	fprintf(fp, "        m_seq = %d\n", ni->ni_last_msg.m_seq);
-	fprintf(fp, "    }\n");
-	fprintf(fp, "    ni_state = 0x%08x (%s)\n", ni->ni_state,
-		state_str(ni->ni_state));
-	fprintf(fp, "}\n\n");
-}
-
-
-static void
-update_local_status(qd_ctx *ctx, node_info_t *ni, int max, int score,
-		    int score_req, int score_max)
-{
-	FILE *fp;
-	int x, need_close = 0;
-	time_t now;
-	long flags;
-	int fd;
-
-	if (!ctx->qc_status_file)
-		return;
-
-	if (strcmp(ctx->qc_status_file, "-") == 0) {
-		fp = stdout;
-	} else {
-		fp = fopen(ctx->qc_status_file, "w+");
-		if (fp == NULL)
-			return;
-		need_close = 1;
-	}
-
-	/* Don't block while writing to this file 
-	 * XXX Not set O_NONBLOCK twice on stdout?
-	 */
-	fd = fileno(fp);
-	flags = fcntl(fd, F_GETFD, 0);
-	if (fcntl(fd, F_SETFD, flags | O_NONBLOCK) != 0) {
-		if (need_close)
-			fclose(fp);
-		return;
-	}
-
-	now = time(NULL);
-	fprintf(fp, "Time Stamp: %s", ctime(&now));
-	fprintf(fp, "Node ID: %d\n", ctx->qc_my_id);
-	
-	fprintf(fp, "Score: %d/%d (Minimum required = %d)\n",
-		score, score_max, score_req);
-	fprintf(fp, "Current state: %s\n", state_str(ctx->qc_status));
-
-	/*
-	fprintf(fp, "Current disk state: %s\n",
-		state_str(ctx->qc_disk_status));
-	 */
-	fprintf(fp, "Initializing Set: {");
-	for (x=0; x<max; x++) {
-		if (ni[x].ni_status.ps_state == S_INIT && ni[x].ni_seen)
-			fprintf(fp," %d", ni[x].ni_status.ps_nodeid);
-	}
-	fprintf(fp, " }\n");
-
-	fprintf(fp, "Visible Set: {");
-	for (x=0; x<max; x++) {
-		if (ni[x].ni_state >= S_RUN || ni[x].ni_status.ps_nodeid == 
-		    ctx->qc_my_id)
-			fprintf(fp," %d", ni[x].ni_status.ps_nodeid);
-	}
-	fprintf(fp, " }\n");
-	
-	if (ctx->qc_status == S_INIT)
-		goto out;
-	
-	if (ctx->qc_master)
-		fprintf(fp, "Master Node ID: %d\n", ctx->qc_master);
-	else 
-		fprintf(fp, "Master Node ID: (none)\n");
-
-	if (!ctx->qc_master)
-		goto out;
-
-	fprintf(fp, "Quorate Set: {");
-	for (x=0; x<max; x++) {
-		if (is_bit_set(ni[ctx->qc_master-1].ni_status.ps_master_mask,
-			       ni[x].ni_status.ps_nodeid-1,
-			       sizeof(memb_mask_t))) {
-			fprintf(fp," %d", ni[x].ni_status.ps_nodeid);
-		}
-	}
-
-	fprintf(fp, " }\n");
-
-out:
-	if (ctx->qc_flags & RF_DEBUG) {
-		for (x = 0; x < max; x++)
-			print_node_info(fp, &ni[x]);
-	}
-
-	fprintf(fp, "\n");
-	if (need_close)
-		fclose(fp);
-}
-
-static inline int
-_cmp_tv(struct timeval *left, struct timeval *right)
-{
-	if (left->tv_sec > right->tv_sec)
-		return -1;
-
-	if (left->tv_sec < right->tv_sec)
-		return 1;
-
-	if (left->tv_usec > right->tv_usec)
-		return -1;
-	
-	if (left->tv_usec < right->tv_usec)
-		return 1;
-
-	return 0;
-}
-
-
-void
-set_priority(int queue, int prio)
-{
-	struct sched_param s;
-	int ret;
-	char *func = "nice";
-	
-	if (queue == SCHED_OTHER) {
-		s.sched_priority = 0;
-		ret = sched_setscheduler(0, queue, &s);
-		errno = 0;
-		ret = nice(prio);
-	} else {
-		memset(&s,0,sizeof(s));
-		s.sched_priority = prio;
-		ret = sched_setscheduler(0, queue, &s);
-		func = "sched_setscheduler";
-	}
-	
-	if (ret < 0 && errno) {
-		logt_print(LOG_WARNING, "set_priority [%s] failed: %s\n", func,
-		       strerror(errno));
-	}
-}
-
-
-static int
-cman_wait(cman_handle_t ch, struct timeval *_tv)
-{
-	fd_set rfds;
-	int fd = cman_get_fd(ch);
-	struct timeval tv_local = {0, 0};
-	struct timeval *tv = _tv;
-
-	if (!_tv)
-		tv = &tv_local;
-	
-	FD_ZERO(&rfds);
-	FD_SET(fd, &rfds);
-	if (select(fd + 1, &rfds, NULL, NULL, tv) == 1) {
-		if (cman_dispatch(ch, CMAN_DISPATCH_ALL) < 0) {
-			if (errno == EAGAIN)
-				return 0;
-			return -1;
-		}
-	}
-	return 0;
-}
-
-
-/*
-   Listen for cman events
- */
-static void
-process_cman_event(cman_handle_t handle, void *private, int reason, int arg)
-{
-	qd_ctx *ctx = (qd_ctx *)private;
-
-	switch(reason) {
-	case CMAN_REASON_PORTOPENED:
-		break;
-	case CMAN_REASON_TRY_SHUTDOWN:
-		_running = 0;
-		break;
-	case CMAN_REASON_CONFIG_UPDATE:
-		get_config_data(ctx, NULL, 0, NULL);
-		break;
-	case CMAN_REASON_PORTCLOSED:
-		break;
-	case CMAN_REASON_STATECHANGE:
-		/* Not used */
-		break;
-	}
-}
-
-
-static int
-quorum_loop(qd_ctx *ctx, node_info_t *ni, int max)
-{
-	disk_msg_t msg = {0, 0, 0};
-	int low_id, bid_pending = 0, score, score_max, score_req,
-	    upgrade = 0, count, errors, error_cycles = 0;
-	memb_mask_t mask, master_mask;
-	struct timeval maxtime, oldtime, newtime, diff, sleeptime, interval;
-
-	ctx->qc_status = S_NONE;
-	
-	maxtime.tv_usec = 0;
-	maxtime.tv_sec = ctx->qc_interval * ctx->qc_tko;
-	
-	interval.tv_usec = 0;
-	interval.tv_sec = ctx->qc_interval;
-	
-	get_my_score(&score, &score_max);
-	if (score_max < ctx->qc_scoremin) {
-		logt_print(LOG_WARNING, "Minimum score (%d) is impossible to "
-		       "achieve (heuristic total = %d)\n",
-		       ctx->qc_scoremin, score_max);
-	}
-	
-	_running = 1;
-	while (_running) {
-		if (_reconfig) {
-			get_config_data(ctx, NULL, 0, NULL);
-			_reconfig = 0;
-		}
-
-		/* XXX this was getuptime() in clumanager */
-		get_time(&oldtime, (ctx->qc_flags&RF_UPTIME));
-		
-		/* Read everyone else's status */
-		errors = read_node_blocks(ctx, ni, max);
-
-		/* Check for node transitions */
-		check_transitions(ctx, ni, max, mask);
-
-		/* Check heuristics and remove ourself if necessary */
-		get_my_score(&score, &score_max);
-
-		/* If we recently upgraded, decrement our wait time */
-		if (upgrade > 0)
-			--upgrade;
-
-		score_req = ctx->qc_scoremin;
-		if (score_req <= 0)
-			score_req = (score_max/2 + 1);
-
-		if (score < score_req) {
-			clear_bit(mask, (ctx->qc_my_id-1), sizeof(mask));
-			if (ctx->qc_status > S_NONE) {
-				logt_print(LOG_NOTICE,
-				       "Score insufficient for master "
-				       "operation (%d/%d; required=%d); "
-				       "downgrading\n",
-				       score, score_max, score_req);
-				ctx->qc_status = S_NONE;
-				msg.m_msg = M_NONE;
-				++msg.m_seq;
-				bid_pending = 0;
-				if (cman_wait(ctx->qc_cman_user, NULL) < 0) {
-					logt_print(LOG_ERR, "cman: %s\n",
-					       strerror(errno));
-				} else {
-					cman_poll_quorum_device(ctx->qc_cman_admin, 0);
-				}
-				if (ctx->qc_flags & RF_REBOOT)
-					reboot(RB_AUTOBOOT);
-			}
-		} else {
-			set_bit(mask, (ctx->qc_my_id-1), sizeof(mask));
-			if (ctx->qc_status == S_NONE) {
-				logt_print(LOG_NOTICE,
-				       "Score sufficient for master "
-				       "operation (%d/%d; required=%d); "
-				       "upgrading\n",
-				       score, score_max, score_req);
-				ctx->qc_status = S_RUN;
-				upgrade = ctx->qc_upgrade_wait;
-				bid_pending = 0;
-				msg.m_msg = M_NONE;
-				++msg.m_seq;
-			}
-		}
-
-		/* Find master */
-		ctx->qc_master = master_exists(ctx, ni, max, &low_id, &count);
-
-		/* Resolve master conflict, if one exists */
-		if (count >= 1 && ctx->qc_status == S_MASTER &&
-		    ctx->qc_master != ctx->qc_my_id) {
-			logt_print(LOG_WARNING, "Master conflict: abdicating\n");
-
-			/* Handle just like a recent upgrade */
-			ctx->qc_status = S_RUN;
-			upgrade = ctx->qc_upgrade_wait;
-			bid_pending = 0;
-			msg.m_msg = M_NONE;
-			++msg.m_seq;
-		}
-
-		/* Figure out what to do based on what we know */
-		if (!ctx->qc_master &&
-		    low_id == ctx->qc_my_id &&
-		    ctx->qc_status == S_RUN &&
-		    !bid_pending &&
-		    !upgrade) {
-			/*
-			   If there's no master, and we are the lowest node
-			   ID, make a bid to become master if we're not 
-			   already bidding.  We can't do this if we've just
-			   upgraded.
-			 */
-
-			logt_print(LOG_DEBUG,"Making bid for master\n");
-			msg.m_msg = M_BID;
-			++msg.m_seq;
-			bid_pending = 1;
-
-		} else if (!ctx->qc_master && !bid_pending) {
-
-			/* We're not the master, and we do not have a bid
-			   pending.  Check for voting on other nodes. */
-			do_vote(ctx, ni, max, &msg);
-		} else if (!ctx->qc_master && bid_pending) {
-
-			/* We're currently bidding for master.
-			   See if anyone's voted, or if we should
-			   rescind our bid */
-			++bid_pending;
-
-			/* Yes, those are all deliberate fallthroughs */
-			switch (check_votes(ctx, ni, max, &msg)) {
-			case 3:
-				/* 
-				 * Give ample time to become aware of other
-				 * nodes
-				 */
-				if (bid_pending < (ctx->qc_master_wait))
-					break;
-				
-				logt_print(LOG_INFO,
-				       "Assuming master role\n");
-				ctx->qc_status = S_MASTER;
-			case 2:
-				msg.m_msg = M_NONE;
-			case 1:
-				bid_pending = 0;
-			default:
-				break;
-			}
-		} else if (ctx->qc_status == S_MASTER &&
-			   ctx->qc_master != ctx->qc_my_id) {
-			
-			/* We think we're master, but someone else claims
-			   that they are master. */
-
-			logt_print(LOG_CRIT,
-			       "A master exists, but it's not me?!\n");
-			/* XXX Handle this how? Should not happen*/
-			/* reboot(RB_AUTOBOOT); */
-
-		} else if (ctx->qc_status == S_MASTER &&
-			   ctx->qc_master == ctx->qc_my_id) {
-
-			/* We are the master.  Poll the quorum device.
-			   We can't be the master unless we score high
-			   enough on our heuristics. */
-			if (cman_wait(ctx->qc_cman_user, NULL) < 0) {
-				logt_print(LOG_ERR, "cman_dispatch: %s\n",
-				       strerror(errno));
-				logt_print(LOG_ERR,
-				       "Halting qdisk operations\n");
-				return -1;
-			}
-			check_cman(ctx, mask, master_mask);
-			if (!errors)
-				cman_poll_quorum_device(ctx->qc_cman_admin, 1);
-
-		} else if (ctx->qc_status == S_RUN && ctx->qc_master &&
-			   ctx->qc_master != ctx->qc_my_id) {
-
-			/* We're not the master, but a master exists
-			   Check to see if the master thinks we are 
-			   online.  If we are, tell CMAN so. */
-			if (is_bit_set(
-			      ni[ctx->qc_master-1].ni_status.ps_master_mask,
-				       ctx->qc_my_id-1,
-				       sizeof(memb_mask_t))) {
-				if (cman_wait(ctx->qc_cman_user, NULL) < 0) {
-					logt_print(LOG_ERR, "cman_dispatch: %s\n",
-						strerror(errno));
-					logt_print(LOG_ERR,
-						"Halting qdisk operations\n");
-					return -1;
-				}
-				if (!errors)
-					cman_poll_quorum_device(ctx->qc_cman_admin, 1);
-			}
-		}
-		
-		/* Write out our status */
-		if (qd_write_status(ctx, ctx->qc_my_id, ctx->qc_status,
-				    &msg, mask, master_mask) != 0) {
-			logt_print(LOG_ERR, "Error writing to quorum disk\n");
-			errors++; /* this value isn't really used 
-				     at this point */
-		}
-
-		/* write out our local status */
-		update_local_status(ctx, ni, max, score, score_req, score_max);
-
-		/* Cycle. We could time the loop and sleep
-		   (interval-looptime), but this is fine for now.*/
-		get_time(&newtime, ctx->qc_flags&RF_UPTIME);
-		_diff_tv(&diff, &oldtime, &newtime);
-		
-		/*
-		 * Reboot if we didn't send a heartbeat in interval*TKO_COUNT
-		 */
-		if (_cmp_tv(&maxtime, &diff) == 1 &&
-		    ctx->qc_flags & RF_PARANOID) {
-			logt_print(LOG_EMERG, "Failed to complete a cycle within "
-			       "%d second%s (%d.%06d) - REBOOTING\n",
-			       (int)maxtime.tv_sec,
-			       maxtime.tv_sec==1?"":"s",
-			       (int)diff.tv_sec,
-			       (int)diff.tv_usec);
-			if (!(ctx->qc_flags & RF_DEBUG)) 
-				reboot(RB_AUTOBOOT);
-		}
-
-		/*
-		 * If the amount we took to complete a loop is greater or less
-		 * than our interval, we adjust by the difference each round.
-		 *
-		 * It's not really "realtime", but it helps!
-		 */
-		if (_cmp_tv(&diff, &interval) == 1) {
-			_diff_tv(&sleeptime, &diff, &interval);
-		} else {
-			logt_print(LOG_WARNING, "qdisk cycle took more "
-			       "than %d second%s to complete (%d.%06d)\n",
-			       ctx->qc_interval, ctx->qc_interval==1?"":"s",
-			       (int)diff.tv_sec, (int)diff.tv_usec);
-			memcpy(&sleeptime, &interval, sizeof(sleeptime));
-		}
-
-		if (errors && ctx->qc_max_error_cycles) {
-			++error_cycles;
-			if (error_cycles >= ctx->qc_max_error_cycles) {
-				logt_print(LOG_ALERT,
-				       "Too many I/O errors; giving up.\n");
-				_running = 0;
-			}
-		} else {
-			error_cycles = 0;
-		}
-		
-		/* Could hit a watchdog timer here if we wanted to */
-		if (_running) {
-			cman_wait(ctx->qc_cman_user, &sleeptime);
-		}
-	}
-
-	return !!errors;
-}
-
-
-/**
-  Tell the other nodes we're done (safely!).
- */
-static int
-quorum_logout(qd_ctx *ctx)
-{
-	/* Write out our status */
-	if (qd_write_status(ctx, ctx->qc_my_id, S_NONE,
-			    NULL, NULL, NULL) != 0) {
-		logt_print(LOG_WARNING,
-		       "Error writing to quorum disk during logout\n");
-	}
-	return 0;
-}
-
-
-void
-conf_logging(int debug, int logmode, int facility, int loglevel,
-	     int filelevel, char *fname)
-{
-	static int _log_config = 0;
-
-	if (debug)
-		_debug |= DEBUG_CONF;
-	else
-		_debug &= ~DEBUG_CONF;
-	if (_debug)
-		loglevel = LOG_DEBUG;
-	if (_foreground)
-		logmode |= LOG_MODE_OUTPUT_STDERR;
-
-	if (!_log_config) {
-		logt_init(LOG_DAEMON_NAME, logmode, facility, loglevel,
-			  filelevel, fname);
-		_log_config = 1;
-		return;
-
-	}
-
-	logt_conf(LOG_DAEMON_NAME, logmode, facility, loglevel,
-		  filelevel, fname);
-}
-
-
-int
-ccs_read_old_logging(int ccsfd, int *facility, int *priority)
-{
-	char query[256];
-	char *val;
-	int x, ret = 0;
-
-	/* Get log log_facility */
-	snprintf(query, sizeof(query), "/cluster/quorumd/@log_facility");
-	if (ccs_get(ccsfd, query, &val) == 0) {
-		logt_print(LOG_WARNING,
-			   "Use of quorumd/@log_facility is deprecated!\n");
-		for (x = 0; facilitynames[x].c_name; x++) {
-			if (strcasecmp(val, facilitynames[x].c_name))
-				continue;
-			*facility = facilitynames[x].c_val;
-			ret = 1;
-			break;
-		}
-		free(val);
-	}
-
-	/* Get log level */
-	snprintf(query, sizeof(query), "/cluster/quorumd/@log_level");
-	if (ccs_get(ccsfd, query, &val) == 0) {
-		logt_print(LOG_WARNING,
-			   "Use of quorumd/@log_level is deprecated!\n");
-		*priority = atoi(val);
-		free(val);
-		if (*priority < 0)
-			*priority = SYSLOGLEVEL;
-		else
-			ret = 1;
-	}
-
-	return ret;
-}
-
-
-/**
-  Grab logsys configuration data from libccs
- */
-static int
-get_log_config_data(int ccsfd)
-{
-	char fname[PATH_MAX];
-	int debug = 0, logmode = LOG_MODE_OUTPUT_FILE | LOG_MODE_OUTPUT_SYSLOG;
-	int facility = SYSLOGFACILITY;
-	int loglevel = SYSLOGLEVEL, filelevel = SYSLOGLEVEL;
-	int need_close = 0;
-
-	logt_print(LOG_DEBUG, "Loading logging configuration\n");
-
-	if (ccsfd < 0) {
-		ccsfd = ccs_connect();
-		if (ccsfd < 0) {
-			logt_print(LOG_ERR, "Logging configuration "
-				   "unavailable; using defaults\n");
-			return -1;
-		}
-		need_close = 1;
-	}
-
-	snprintf(fname, sizeof(fname)-1, LOGDIR "/qdisk.log");
-	if (ccs_read_old_logging(ccsfd, &facility, &loglevel))
-		filelevel = loglevel;
-
-	ccs_read_logging(ccsfd, (char *)"QDISKD", &debug, &logmode,
-        		 &facility, &loglevel, &filelevel, (char *)fname);
-	conf_logging(debug, logmode, facility, loglevel, filelevel, fname);
-
-	if (need_close)
-		ccs_disconnect(ccsfd);
-
-	return 0;
-}
-
-
-static int
-get_dynamic_config_data(qd_ctx *ctx, int ccsfd)
-{
-	char *val = NULL;
-	char query[256];
-
-	if (ccsfd < 0)
-		return -1;
-
-	logt_print(LOG_DEBUG, "Loading dynamic configuration\n");
-
-	/* Get status file */
-	snprintf(query, sizeof(query), "/cluster/quorumd/@status_file");
-	if (ccs_get(ccsfd, query, &val) == 0) {
-		ctx->qc_status_file = val;
-	}
-	
-	/* Get scheduling queue */
-	snprintf(query, sizeof(query), "/cluster/quorumd/@scheduler");
-	if (ccs_get(ccsfd, query, &val) == 0) {
-		switch(val[0]) {
-		case 'r':
-		case 'R':
-			ctx->qc_sched = SCHED_RR;
-			break;
-		case 'f':
-		case 'F':
-			ctx->qc_sched = SCHED_FIFO;
-			break;
-		case 'o':
-		case 'O':
-			ctx->qc_sched = SCHED_OTHER;
-			break;
-		default:
-			logt_print(LOG_WARNING,
-				   "Invalid scheduling queue '%s'\n", val);
-			break;
-		}
-		free(val);
-	}
-	
-	/* Get priority */
-	snprintf(query, sizeof(query), "/cluster/quorumd/@priority");
-	if (ccs_get(ccsfd, query, &val) == 0) {
-		ctx->qc_sched_prio = atoi(val);
-		free(val);
-	}	
-	set_priority(ctx->qc_sched, ctx->qc_sched_prio);
-
-	/* Get reboot flag for when we transition -> offline */
-	/* default = on, so, 0 to turn off */
-	snprintf(query, sizeof(query), "/cluster/quorumd/@reboot");
-	if (ccs_get(ccsfd, query, &val) == 0) {
-		if (!atoi(val))
-			ctx->qc_flags &= ~RF_REBOOT;
-		free(val);
-	}
-
-	/*
-	 * Get flag to see if we're supposed to kill cman if qdisk is not 
-	 * available.
-	 */
-	/* default = off, so, 1 to turn on */
-	snprintf(query, sizeof(query), "/cluster/quorumd/@stop_cman");
-	if (ccs_get(ccsfd, query, &val) == 0) {
-		if (!atoi(val))
-			ctx->qc_flags &= ~RF_STOP_CMAN;
-		else
-			ctx->qc_flags |= RF_STOP_CMAN;
-		free(val);
-	}
-	
-	/*
-	 * Get flag to see if we're supposed to reboot if we can't complete
-	 * a pass in failure time
-	 */
-	/* default = off, so, 1 to turn on */
-	snprintf(query, sizeof(query), "/cluster/quorumd/@paranoid");
-	if (ccs_get(ccsfd, query, &val) == 0) {
-		if (!atoi(val))
-			ctx->qc_flags &= ~RF_PARANOID;
-		else
-			ctx->qc_flags |= RF_PARANOID;
-		free(val);
-	}
-	
-	/*
-	 * Get flag to see if we're supposed to reboot if we can't complete
-	 * a pass in failure time
-	 */
-	/* default = off, so, 1 to turn on */
-	snprintf(query, sizeof(query), "/cluster/quorumd/@allow_kill");
-	if (ccs_get(ccsfd, query, &val) == 0) {
-		if (!atoi(val))
-			ctx->qc_flags &= ~RF_ALLOW_KILL;
-		else
-			ctx->qc_flags |= RF_ALLOW_KILL;
-		free(val);
-	}
-
-	/*
-	 * How many consecutive error cycles do we allow before
-	 * giving up?
-	 */
-	/* default = no max */
-	snprintf(query, sizeof(query), "/cluster/quorumd/@max_error_cycles");
-	if (ccs_get(ccsfd, query, &val) == 0) {
-		ctx->qc_max_error_cycles = atoi(val);
-		if (ctx->qc_max_error_cycles <= 0)
-			ctx->qc_max_error_cycles = 0;
-		free(val);
-	}
-
-	return 0;
-}
-
-
-static int
-get_static_config_data(qd_ctx *ctx, int ccsfd) 
-{
-	char *val = NULL;
-	char query[256];
-
-	if (ccsfd < 0)
-		return -1;
-
-	logt_print(LOG_DEBUG, "Loading static configuration\n");
-
-	/* Get interval */
-	snprintf(query, sizeof(query), "/cluster/quorumd/@interval");
-	if (ccs_get(ccsfd, query, &val) == 0) {
-		ctx->qc_interval = atoi(val);
-		free(val);
-		if (ctx->qc_interval < 1)
-			ctx->qc_interval = 1;
-	}
-		
-	/* Get tko */
-	snprintf(query, sizeof(query), "/cluster/quorumd/@tko");
-	if (ccs_get(ccsfd, query, &val) == 0) {
-		ctx->qc_tko = atoi(val);
-		free(val);
-		if (ctx->qc_tko < 3)
-			ctx->qc_tko = 3;
-	}
-
-	/* Get up-tko (transition off->online) */
-	ctx->qc_tko_up = (ctx->qc_tko / 3);
-	snprintf(query, sizeof(query), "/cluster/quorumd/@tko_up");
-	if (ccs_get(ccsfd, query, &val) == 0) {
-		ctx->qc_tko_up = atoi(val);
-		free(val);
-	}
-	if (ctx->qc_tko_up < 2)
-		ctx->qc_tko_up = 2;
-
-	/* After coming online, wait this many intervals before
-	   being allowed to bid for master. */
-	ctx->qc_upgrade_wait = 2; /* (ctx->qc_tko / 3); */
-	snprintf(query, sizeof(query), "/cluster/quorumd/@upgrade_wait");
-	if (ccs_get(ccsfd, query, &val) == 0) {
-		ctx->qc_upgrade_wait = atoi(val);
-		free(val);
-	}
-	if (ctx->qc_upgrade_wait < 1)
-		ctx->qc_upgrade_wait = 1;
-
-	/* wait this many intervals after bidding for master before
-	   becoming Caesar  */
-	ctx->qc_master_wait = (ctx->qc_tko / 2);
-	snprintf(query, sizeof(query), "/cluster/quorumd/@master_wait");
-	if (ccs_get(ccsfd, query, &val) == 0) {
-		ctx->qc_master_wait = atoi(val);
-		free(val);
-	}
-	if (ctx->qc_master_wait <= ctx->qc_tko_up)
-		ctx->qc_master_wait = ctx->qc_tko_up + 1;
-		
-	/* Get votes */
-	snprintf(query, sizeof(query), "/cluster/quorumd/@votes");
-	if (ccs_get(ccsfd, query, &val) == 0) {
-		ctx->qc_votes = atoi(val);
-		free(val);
-		if (ctx->qc_votes < 0)
-			ctx->qc_votes = 0;
-	}
-
-	/* Get device */
-	snprintf(query, sizeof(query), "/cluster/quorumd/@device");
-	if (ccs_get(ccsfd, query, &val) == 0) {
-		ctx->qc_device = val;
-	}
-
-	/* Get label (overrides device) */
-	snprintf(query, sizeof(query), "/cluster/quorumd/@label");
-	if (ccs_get(ccsfd, query, &val) == 0) {
-		ctx->qc_label = val;
-	}
-
-	/* Get min score */
-	snprintf(query, sizeof(query), "/cluster/quorumd/@min_score");
-	if (ccs_get(ccsfd, query, &val) == 0) {
-		ctx->qc_scoremin = atoi(val);
-		free(val);
-		if (ctx->qc_scoremin < 0)
-			ctx->qc_scoremin = 0;
-	}
-
-	/* Get cman_label */
-	snprintf(query, sizeof(query), "/cluster/quorumd/@cman_label");
-	if (ccs_get(ccsfd, query, &val) == 0) {
-		if (strlen(val) > 0) {
-			ctx->qc_flags |= RF_CMAN_LABEL;
-			ctx->qc_cman_label = val;
-		}
-	}
-	
-	/*
-	 * Get flag to see if we're supposed to use /proc/uptime instead of
-	 * gettimeofday(2)
-	 */
-	/* default = off, so, 1 to turn on */
-	snprintf(query, sizeof(query), "/cluster/quorumd/@use_uptime");
-	if (ccs_get(ccsfd, query, &val) == 0) {
-		if (!atoi(val))
-			ctx->qc_flags &= ~RF_UPTIME;
-		else
-			ctx->qc_flags |= RF_UPTIME;
-		free(val);
-	}
-
-
-	return 0;
-}
-
-
-/**
-  Grab all our configuration data from libccs
- */
-static int
-get_config_data(qd_ctx *ctx, struct h_data *h, int maxh, int *cfh)
-{
-	int ccsfd = -1;
-
-	ccsfd = ccs_connect();
-	if (ccsfd < 0) {
-		logt_print(LOG_CRIT, "Configuration unavailable; "
-			   "cannot start\n");
-		return -1;
-	}
-
-	get_log_config_data(ccsfd);
-
-	/* Initialize defaults if we are not reconfiguring */
-	if (ctx->qc_config == 0) {
-		ctx->qc_interval = 1;
-		ctx->qc_tko = 10;
-		ctx->qc_scoremin = 0;
-		ctx->qc_flags = RF_REBOOT | RF_ALLOW_KILL | RF_UPTIME;
-			/* | RF_STOP_CMAN;*/
-
-		ctx->qc_sched = SCHED_RR;
-		ctx->qc_sched_prio = 1;
-		ctx->qc_max_error_cycles = 0;
-	}
-	
-	if (ctx->qc_config ||
-	    get_dynamic_config_data(ctx, ccsfd) < 0)
-		goto out;
-
-	ctx->qc_config = 1;
-
-	if (get_static_config_data(ctx, ccsfd) < 0)
-		goto out;
-
-	*cfh = configure_heuristics(ccsfd, h, maxh);
-
-	logt_print(LOG_DEBUG, "Quorum Daemon: %d heuristics, "
-		   "%d interval, %d tko, %d votes\n",
-		   *cfh, ctx->qc_interval, ctx->qc_tko, ctx->qc_votes);
-	logt_print(LOG_DEBUG, "%d tko_up, %d master_wait, "
-		   "%d upgrade_wait\n",
-		   ctx->qc_tko_up, ctx->qc_master_wait, ctx->qc_upgrade_wait);
-out:
-	logt_print(LOG_DEBUG, "Run Flags: %08x\n", ctx->qc_flags);
-
-	ccs_disconnect(ccsfd);
-
-	return 0;
-}
-
-
-static void
-check_stop_cman(qd_ctx *ctx)
-{
-	if (!(ctx->qc_flags & RF_STOP_CMAN))
-		return;
-	
-	logt_print(LOG_WARNING, "Telling CMAN to leave the cluster; "
-		   "qdisk is not available\n");
-	if (cman_shutdown(ctx->qc_cman_admin, 0) < 0) {
-		logt_print(LOG_CRIT,
-			   "Could not leave the cluster - rebooting\n");
-		sleep(5);
-		if (ctx->qc_flags & RF_DEBUG) {
-			logt_print(LOG_CRIT, "Debug mode specified! "
-				   "Reboot averted.\n");
-			return;
-		}
-		reboot(RB_AUTOBOOT);
-	}
-}
-
-
-#define logt_print_once(level, fmt, args...) \
-do { static int _logged=0; if (!_logged) { _logged=1; logt_print(level, fmt, ##args); } } while(0)
-
-
-int
-main(int argc, char **argv)
-{
-	cman_node_t me;
-	int cfh = 0, rv, nfd = -1, ret = -1, active;
-	qd_ctx ctx;
-	cman_handle_t ch_admin = NULL;
-	cman_handle_t ch_user = NULL;
-	node_info_t ni[MAX_NODES_DISK];
-	struct h_data h[10];
-	char device[128];
-	pid_t pid;
-	quorum_header_t qh;
-
-	if (check_process_running(argv[0], &pid) && pid !=getpid()) {
-		printf("QDisk services already running\n");
-		return 0;
-	}
-
-	while ((rv = getopt(argc, argv, "fdQs")) != EOF) {
-		switch (rv) {
-		case 'd':
-			_debug = DEBUG_CMDLINE;
-			break;
-		case 'f':
-			_foreground = 1;
-			break;
-		case 'Q':
-			/* Make qdisk very quiet */
-			nfd = open("/dev/null", O_RDWR);
-			close(0);
-			close(1);
-			close(2);
-			dup2(nfd, 0);
-			dup2(nfd, 1);
-			dup2(nfd, 2);
-			close(nfd);
-			break;
-		default:
-			break;
-		}
-	}
-
-	if(getenv("QDISK_DEBUGLOG"))
-		_debug = 1;
-
-	if (!_foreground && daemon_init(argv[0]) < 0) {
-		fprintf(stderr, "Could not fork: %s\n", strerror(errno));
-		goto out;
-	}
-
-	conf_logging(0, LOG_MODE_OUTPUT_SYSLOG, SYSLOGFACILITY,
-		     SYSLOGLEVEL, 0, NULL);
-
-	while (_running && (ch_admin = cman_admin_init(NULL)) == NULL) {
-		logt_print_once(LOG_INFO, "Waiting for CMAN to start\n");
-		sleep(1);
-	}
-
-	while (_running && (active = cman_is_active(ch_admin)) <= 0) {
-		logt_print_once(LOG_INFO,
-				"Waiting for CMAN to become active\n");
-		if (active < 0) {
-			logt_print(LOG_CRIT, "cman_is_active: %s\n",
-				   strerror(errno));
-			goto out;
-		}
-		sleep(1);
-	}
-
-	if (!_running)
-		goto out;
-
-	/* For cman notifications we need two sockets - one for events,
-	   one for config change callbacks */
-	ch_user = cman_init(&ctx);
-        if (cman_start_notification(ch_user, process_cman_event) != 0) {
-		logt_print(LOG_CRIT, "Could not register with CMAN: %s\n",
-			   strerror(errno));
-		goto out;
-	}
-
-	memset(&me, 0, sizeof(me));
-	if (cman_get_node(ch_admin, CMAN_NODEID_US, &me) < 0) {
-		logt_print(LOG_CRIT, "Could not determine local node ID: %s\n",
-			   strerror(errno));
-		goto out;
-	}
-
-	qd_init(&ctx, ch_admin, ch_user, me.cn_nodeid);
-
-	signal(SIGINT, int_handler);
-	signal(SIGTERM, int_handler);
-	signal(SIGHUP, hup_handler);
-	signal(SIGUSR1, usr1_handler);
-
-	/* RF_DEBUG can only be set from the command line */
-	if (_debug)
-		ctx.qc_flags |= RF_DEBUG;
-
-	if (get_config_data(&ctx, h, 10, &cfh) < 0) {
-		logt_print(LOG_CRIT, "Configuration failed\n");
-		check_stop_cman(&ctx);
-		goto out;
-	}
-
-	if (ctx.qc_label) {
-		ret = find_partitions(ctx.qc_label, device, sizeof(device), 0);
-		if (ret < 0) {
-			logt_print(LOG_CRIT, "Unable to match label"
-					 " '%s' to any device\n",
-					 ctx.qc_label);
-			check_stop_cman(&ctx);
-			goto out;
-		}
-
-		if (ctx.qc_device)
-			free(ctx.qc_device);
-		ctx.qc_device = strdup(device);
-
-		logt_print(LOG_INFO, "Quorum Partition: %s Label: %s\n",
-		       ctx.qc_device, ctx.qc_label);
-	} else if (ctx.qc_device) {
-		if (check_device(ctx.qc_device, NULL, &qh, 0) != 0) {
-			logt_print(LOG_CRIT,
-			       "Specified partition %s does not have a "
-			       "qdisk label\n", ctx.qc_device);
-			check_stop_cman(&ctx);
-			goto out;
-		}
-
-		if (qh.qh_version == VERSION_MAGIC_V2 &&
-		    qh.qh_blksz != qh.qh_kernsz) {
-			logt_print(LOG_CRIT,
-			       "Specified device %s does not match kernel's "
-			       "reported sector size (%lu != %lu)\n",
-			       ctx.qc_device,
-			       (unsigned long)qh.qh_blksz,
-			       (unsigned long)qh.qh_kernsz);
-			check_stop_cman(&ctx);
-			goto out;
-		}
-	}
-
-	if (quorum_init(&ctx, ni, MAX_NODES_DISK, h, cfh) < 0) {
-		logt_print(LOG_CRIT, "Initialization failed\n");
-		check_stop_cman(&ctx);
-		goto out;
-	}
-
-	ret = 0;
-
-	if (!_running)
-		goto out;
-	
-	cman_register_quorum_device(ctx.qc_cman_admin,
-				    (ctx.qc_flags&RF_CMAN_LABEL)? 
-				        ctx.qc_cman_label:
-                                        ctx.qc_device,
-				    ctx.qc_votes);
-	/*
-		XXX this always returns -1 / EBUSY even when it works?!!!
-		
-	if ((rv = cman_register_quorum_device(ctx.qc_cman_admin, ctx.qc_device,
-					      ctx.qc_votes)) < 0) {
-		logt_print(LOG_CRIT,
-				 "Could not register %s with CMAN; "
-				 "return = %d; error = %s\n",
-				 ctx.qc_device, rv, strerror(errno));
-		goto out;
-	}
-	*/
-	if (quorum_loop(&ctx, ni, MAX_NODES_DISK) == 0)
-		cman_unregister_quorum_device(ctx.qc_cman_admin);
-
-	quorum_logout(&ctx);
-	/* free cman handle to avoid leak in cman */
-out:
-	cman_finish(ch_admin);
-	cman_finish(ch_user);
-	qd_destroy(&ctx);
-	logt_exit();
-	return ret;
-}
-
diff --git a/cman/qdisk/mkqdisk.c b/cman/qdisk/mkqdisk.c
deleted file mode 100644
index 6efa630..0000000
--- a/cman/qdisk/mkqdisk.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
-  @file Quorum disk utility
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <disk.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <platform.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <liblogthread.h>
-
-#define PROGRAM_NAME "mkqdisk"
-
-int
-main(int argc, char **argv)
-{
-	char device[128];
-	char *newdev = NULL, *newlabel = NULL;
-	int rv, verbose_level = 1;
-
-	logt_init(PROGRAM_NAME, LOG_MODE_OUTPUT_STDERR, 0, 0, 0, NULL);
-
-	printf(PROGRAM_NAME " v" RELEASE_VERSION "\n\n");
-
-	/* XXX this is horrible but we need to prioritize options as long as
-	 * we can't queue messages properly
-	 */
-	while ((rv = getopt(argc, argv, "Ldf:c:l:h")) != EOF) {
-		switch (rv) {
-		case 'd':
-			++verbose_level;
-			break;
-		}
-	}
-
-	/* reset the option index to reparse */
-	optind = 0;
-
-	while ((rv = getopt(argc, argv, "Ldf:c:l:h")) != EOF) {
-		switch (rv) {
-		case 'd':
-			/* processed above, needs to be here for compat */
-			break;
-		case 'L':
-			/* List */
-			return find_partitions(NULL, NULL, 0, verbose_level);
-		case 'f':
-			return find_partitions( optarg, device,
-					       sizeof(device), verbose_level);
-		case 'c':
-			newdev = optarg;
-			break;
-		case 'l':
-			newlabel = optarg;
-			break;
-		case 'h':
-			printf("usage: mkqdisk -L | -f <label> | -c "
-			       "<device> -l <label> [-d]\n");
-			return 0;
-		default:
-			break;
-		}
-	}
-
-	if (!newdev && !newlabel) {
-		printf("usage: mkqdisk -L | -f <label> | -c "
-		       "<device> -l <label>\n");
-		return 1;
-	}
-
-	if (!newdev || !newlabel) {
-		printf("Both a device and a label are required\n");
-		return 1;
-	}
-
-	printf("Writing new quorum disk label '%s' to %s.\n",
-	       newlabel, newdev);
-	printf("WARNING: About to destroy all data on %s; proceed [N/y] ? ",
-	       newdev);
-	if (getc(stdin) != 'y') {
-		printf("Good thinking.\n");
-		return 0;
-	}
-
-	return qdisk_init(newdev, newlabel);
-}
diff --git a/cman/qdisk/platform.h b/cman/qdisk/platform.h
deleted file mode 100644
index b1dfc64..0000000
--- a/cman/qdisk/platform.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/** @file
- * Defines for byte-swapping
- */
-#ifndef __PLATFORM_H
-#define __PLATFORM_H
-
-#include <endian.h>
-#include <sys/param.h>
-#include <byteswap.h>
-#include <bits/wordsize.h>
-
-/* No swapping on little-endian machines */
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define le_swap16(x) (x)
-#define le_swap32(x) (x)
-#define le_swap64(x) (x)
-#else
-#define le_swap16(x) bswap_16(x)
-#define le_swap32(x) bswap_32(x)
-#define le_swap64(x) bswap_64(x)
-#endif
-
-/* No swapping on big-endian machines */
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define be_swap16(x) bswap_16(x)
-#define be_swap32(x) bswap_32(x)
-#define be_swap64(x) bswap_64(x)
-#else
-#define be_swap16(x) (x)
-#define be_swap32(x) (x)
-#define be_swap64(x) (x)
-#endif
-
-
-#define swab16(x) x=be_swap16(x)
-#define swab32(x) x=be_swap32(x)
-#define swab64(x) x=be_swap64(x)
-
-
-#endif /* __PLATFORM_H */
diff --git a/cman/qdisk/proc.c b/cman/qdisk/proc.c
deleted file mode 100644
index b4f60dd..0000000
--- a/cman/qdisk/proc.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/**
-  @file Quorum disk /proc/partition scanning functions
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <disk.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <platform.h>
-#include <stdlib.h>
-#include <string.h>
-#include <liblogthread.h>
-#include "scandisk.h"
-
-struct device_args {
-	char *label;
-	struct devnode *devnode;
-	int sector_size;
-	int flags;
-	int count;
-	int pad;
-};
-
-int
-check_device(char *device, char *label, quorum_header_t *qh,
-	     int flags)
-{
-	int ret = -1;
-	quorum_header_t qh_local;
-	target_info_t disk;
-
-	if (!qh)
-		qh = &qh_local;
-
-	ret = qdisk_validate(device);
-	if (ret < 0) {
-		logt_print(LOG_DEBUG, "qdisk_verify");
-		return -1;
-	}
-
-	ret = qdisk_open(device, &disk);
-	if (ret < 0) {
-		logt_print(LOG_ERR, "qdisk_open");
-		return -1;
-	}
-
-	ret = -1;
-	if (qdisk_read(&disk, OFFSET_HEADER, qh, sizeof(*qh)) == sizeof(*qh)) {
-		swab_quorum_header_t(qh);
-                if (qh->qh_magic == HEADER_MAGIC_NUMBER) {
-			if (!label || !strcmp(qh->qh_cluster, label)) {
-				ret = 0;
-			}
-                }
-        }
-
-	qh->qh_kernsz = disk.d_blksz;
-
-	/* only flag now is 'strict device check'; i.e.,
-	  "block size recorded must match kernel's reported size" */
-	if (flags && qh->qh_version == VERSION_MAGIC_V2 &&
-            disk.d_blksz != qh->qh_blksz) {
-		ret = -1;
-	}
-
-	qdisk_close(&disk);
-
-	return ret;
-}
-
-
-static void
-filter_devs(struct devnode *node, void *v_args)
-{
-	struct device_args *args = (struct device_args *)v_args;
-	quorum_header_t qh;
-	quorum_header_t *ret_qh = NULL;
-	int ret;
-
-	if (!node->sysfsattrs.sysfs)
-		return;
-	if (!node->devpath)
-		return;
-	if (node->sysfsattrs.holders)
-		return;
-	/* Qdiskd doesn't work on soft-raid */
-	if (node->md > 0)
-		return;
-
-	ret = check_device(node->devpath->path, args->label, &qh, args->flags);
-	if (ret == 0) {
-		ret_qh = malloc(sizeof(qh));
-		if (!ret_qh)
-			return;
-		memcpy(ret_qh, &qh, sizeof(qh));
-
-		node->filter = (void *)ret_qh;
-		if (!args->count) {
-			args->devnode = node;
-		}
-		++args->count;
-	}
-}
-
-
-char *
-state_str(disk_node_state_t s)
-{
-	switch (s) {
-	case S_NONE:
-		return "None";
-	case S_EVICT:
-		return "Evicted";
-	case S_INIT:
-		return "Initializing";
-	case S_RUN:
-		return "Running";
-	case S_MASTER:
-		return "Master";
-	default:
-		return "ILLEGAL";
-	}
-}
-
-
-static void
-print_status_block(status_block_t *sb)
-{
-	time_t timestamp = (time_t)sb->ps_timestamp;
-
-	if (sb->ps_state == S_NONE)
-		return;
-	logt_print(LOG_INFO, "Status block for node %d\n", sb->ps_nodeid);
-	logt_print(LOG_INFO, "\tLast updated by node %d\n", sb->ps_updatenode);
-	logt_print(LOG_INFO, "\tLast updated on %s", ctime((time_t *)&timestamp));
-	logt_print(LOG_INFO, "\tState: %s\n", state_str(sb->ps_state));
-	logt_print(LOG_INFO, "\tFlags: %04x\n", sb->ps_flags);
-	logt_print(LOG_INFO, "\tScore: %d/%d\n", sb->ps_score, sb->ps_scoremax);
-	logt_print(LOG_INFO, "\tAverage Cycle speed: %d.%06d seconds\n", 
-		sb->ps_ca_sec, sb->ps_ca_usec);
-	logt_print(LOG_INFO, "\tLast Cycle speed: %d.%06d seconds\n", 
-		sb->ps_lc_sec, sb->ps_lc_usec);
-	logt_print(LOG_INFO, "\tIncarnation: %08x%08x\n",
-		(int)(sb->ps_incarnation>>32&0xffffffff),
-		(int)(sb->ps_incarnation&0xffffffff));
-
-}
-
-
-static void
-read_info(char *dev)
-{
-	target_info_t ti;
-	int x;
-	status_block_t sb;
-
-	if (qdisk_open(dev, &ti) < 0) {
-		logt_print(LOG_ERR, "Could not read from %s: %s\n",
-		       dev, strerror(errno));
-		return;
-	}
-
-	for (x = 0; x < MAX_NODES_DISK; x++) {
-
-		if (qdisk_read(&ti,
-			       qdisk_nodeid_offset(x+1, ti.d_blksz),
-			       &sb, sizeof(sb)) < 0) {
-			logt_print(LOG_ERR, "Error reading node ID block %d\n",
-			       x+1);
-			continue;
-		}
-		swab_status_block_t(&sb);
-		print_status_block(&sb);
-	}
-
-	qdisk_close(&ti);
-}
-
-
-static void
-print_qdisk_info(struct devnode *dn)
-{
-	quorum_header_t *qh = (quorum_header_t *)dn->filter;
-	struct devpath *dp;
-	time_t timestamp = (time_t)qh->qh_timestamp;
-
-	for (dp = dn->devpath; dp; dp = dp->next)
-		printf("%s:\n", dp->path);
-	printf("\tMagic:                %08x\n", qh->qh_magic);
-	printf("\tLabel:                %s\n", qh->qh_cluster);
-	printf("\tCreated:              %s", ctime(&timestamp));
-	printf("\tHost:                 %s\n", qh->qh_updatehost);
-	printf("\tKernel Sector Size:   %d\n", qh->qh_kernsz);
-	if (qh->qh_version == VERSION_MAGIC_V2) {
-		printf("\tRecorded Sector Size: %d\n\n", (int)qh->qh_blksz);
-	}
-}
-
-int
-find_partitions(const char *label, char *devname, size_t devlen, int print)
-{
-	struct devlisthead *dh = NULL;
-	struct devnode *dn = NULL;
-	struct device_args dargs;
-
-	memset(&dargs, 0, sizeof(dargs));
-	dargs.label = (char *)label;
-	dargs.flags = 1;	/* strict device check */
-	dargs.devnode = NULL;	/* First matching device */
-
-	dh = scan_for_dev(NULL, 5, filter_devs, (void *)(&dargs));
-	if (!dh)
-		goto not_found;
-	if (!dargs.devnode)
-		goto not_found;
-
-	if (dargs.count > 0 && print) {
-		for (dn = dh->devnode; dn; dn = dn->next) {
-			if (dn->filter == NULL) {
-				continue;
-			}
-
-			print_qdisk_info(dn);
-			if (print >= 2) {
-				/* Print node stuff */
-				read_info(dn->devpath->path);
-			}
-		}
-	}
-
-	if (dargs.count == 1 && label) {
-		snprintf(devname, devlen, "%s", dargs.devnode->devpath->path);
-	}
-
-	for (dn = dh->devnode; dn; dn = dn->next)
-		if (dn->filter)
-			free(dn->filter);
-        free_dev_list(dh);
-
-	if (print)
-		/* No errors if we're just printing stuff */
-		return 0;
-
-	if (dargs.count == 1 || !label)
-		return 0;
-
-	/* more than one match */
-	return 1;
-
-   not_found:
-        if (dh) {
-		for (dn = dh->devnode; dn; dn = dn->next)
-			if (dn->filter)
-				free(dn->filter);
-		free_dev_list(dh);
-	}
-	errno = ENOENT;
-	return -1;
-}
diff --git a/cman/qdisk/scandisk.c b/cman/qdisk/scandisk.c
deleted file mode 100644
index 4456e53..0000000
--- a/cman/qdisk/scandisk.c
+++ /dev/null
@@ -1,761 +0,0 @@
-#include <stdio.h>
-#include <time.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/param.h>
-#include <dirent.h>
-#include <sys/sysmacros.h>
-#include <sys/stat.h>
-
-#include "scandisk.h"
-
-/** search in cache helpers **/
-
-/*
- * match is 0 for exact match
- *          1 to see if the string is contained and return the first match
- */
-
-static struct devnode *find_dev_by_path(struct devnode *startnode, char *path,
-					int match)
-{
-	struct devnode *nextnode;
-	struct devpath *nextpath;
-
-	while (startnode) {
-		nextnode = startnode->next;
-		nextpath = startnode->devpath;
-		while (nextpath) {
-			if (match) {
-				if (strstr(nextpath->path, path))
-					return startnode;
-			} else {
-				if (!strcmp(nextpath->path, path))
-					return startnode;
-			}
-			nextpath = nextpath->next;
-		}
-		startnode = nextnode;
-	}
-
-	return 0;
-}
-
-static struct devnode *find_dev_by_majmin(struct devnode *startnode, int maj,
-					  int min)
-{
-	struct devnode *nextnode;
-
-	while (startnode) {
-		nextnode = startnode->next;
-		if ((startnode->maj == maj) && (startnode->min == min))
-			return startnode;
-		startnode = nextnode;
-	}
-
-	return 0;
-}
-
-/** free the cache.. this one is easy ;) **/
-
-/* free all the path associated to one node */
-static void flush_dev_list(struct devpath *startpath)
-{
-	struct devpath *nextpath;
-
-	while (startpath) {
-		nextpath = startpath->next;
-		free(startpath);
-		startpath = nextpath;
-	}
-
-	return;
-}
-
-/* free all nodes associated with one devlist */
-static void flush_dev_cache(struct devlisthead *devlisthead)
-{
-	struct devnode *nextnode, *startnode = devlisthead->devnode;
-
-	while (startnode) {
-		nextnode = startnode->next;
-		flush_dev_list(startnode->devpath);
-		free(startnode);
-		startnode = nextnode;
-	}
-
-	return;
-}
-
-/** list object allocation helpers **/
-
-/* our only certain keys in the list are maj and min
- * this function append a devnode obj to devlisthead
- * and set maj and min
- */
-
-static struct devnode *alloc_list_obj(struct devlisthead *devlisthead, int maj,
-				      int min)
-{
-	struct devnode *nextnode, *startnode;
-
-	nextnode = malloc(sizeof(struct devnode));
-	if (!nextnode)
-		return 0;
-
-	memset(nextnode, 0, sizeof(struct devnode));
-
-	if (!devlisthead->devnode) {
-		devlisthead->devnode = startnode = nextnode;
-	} else {
-		startnode = devlisthead->devnode;
-		while (startnode->next)
-			startnode = startnode->next;
-
-		/* always append what we find */
-		startnode->next = nextnode;
-		startnode = nextnode;
-	}
-
-	startnode->maj = maj;
-	startnode->min = min;
-
-	return startnode;
-}
-
-/* really annoying but we have no way to know upfront how
- * many paths are linked to a certain maj/min combo.
- * Once we find a device, we know maj/min and this new path.
- * add_path_obj will add the given path to the devnode
- */
-static int add_path_obj(struct devnode *startnode, char *path)
-{
-	struct devpath *nextpath, *startpath;
-
-	nextpath = malloc(sizeof(struct devpath));
-	if (!nextpath)
-		return 0;
-
-	memset(nextpath, 0, sizeof(struct devpath));
-
-	if (!startnode->devpath) {
-		startnode->devpath = startpath = nextpath;
-	} else {
-		startpath = startnode->devpath;
-		while (startpath->next)
-			startpath = startpath->next;
-
-		/* always append what we find */
-		startpath->next = nextpath;
-		startpath = nextpath;
-	}
-
-	strncpy(startpath->path, path, MAXPATHLEN - 1);
-
-	return 1;
-}
-
-/* lsdev needs to add blocks in 2 conditions: if we have a real block device
- * or if have a symlink to a block device.
- * this function simply avoid duplicate code around.
- */
-static int add_lsdev_block(struct devlisthead *devlisthead, struct stat *sb,
-			   char *path)
-{
-	int maj, min;
-	struct devnode *startnode;
-
-	maj = major(sb->st_rdev);
-	min = minor(sb->st_rdev);
-
-	startnode = find_dev_by_majmin(devlisthead->devnode, maj, min);
-	if (!startnode) {
-		startnode = alloc_list_obj(devlisthead, maj, min);
-		if (!startnode)
-			return 0;
-	}
-
-	if (!add_path_obj(startnode, path))
-		return 0;
-
-	return 1;
-}
-
-/* check if it is a device or a symlink to a device */
-static int dev_is_block(struct stat *sb, char *path)
-{
-	if (S_ISBLK(sb->st_mode))
-		return 1;
-
-	if (S_ISLNK(sb->st_mode))
-		if (!stat(path, sb))
-			if (S_ISBLK(sb->st_mode))
-				return 1;
-
-	return 0;
-}
-
-/* lsdev does nothing more than ls -lR /dev
- * dives into dirs (skips hidden directories)
- * add block devices
- * parse symlinks
- *
- * ret:
- * 1 on success
- * -1 for generic errors
- * -2 -ENOMEM
- */
-static int lsdev(struct devlisthead *devlisthead, char *path)
-{
-	int i, n, err = 0;
-	struct dirent **namelist;
-	struct stat sb;
-	char newpath[MAXPATHLEN];
-
-	i = scandir(path, &namelist, 0, alphasort);
-	if (i < 0)
-		return -1;
-
-	for (n = 0; n < i; n++) {
-		if (namelist[n]->d_name[0] != '.') {
-			snprintf(newpath, sizeof(newpath), "%s/%s", path,
-				 namelist[n]->d_name);
-
-			if (!lstat(newpath, &sb)) {
-				if (S_ISDIR(sb.st_mode))
-					err = lsdev(devlisthead, newpath);
-				if (err < 0)
-					return err;
-
-				if (dev_is_block(&sb, newpath))
-					if (!add_lsdev_block
-					    (devlisthead, &sb, newpath) < 0)
-						return -2;
-			}
-		}
-		free(namelist[n]);
-	}
-	free(namelist);
-	return 1;
-}
-
-/*
- * scan /proc/partitions and adds info into the list.
- * It's able to add nodes if those are not found in sysfs.
- *
- * ret:
- *  0 if we can't scan
- *  -2 -ENOMEM
- *  1 if everything is ok
- */
-
-static int scanprocpart(struct devlisthead *devlisthead)
-{
-	char line[4096];
-	FILE *fp;
-	int minor, major;
-	unsigned long long blkcnt;
-	char device[128];
-	struct devnode *startnode;
-	fp = fopen("/proc/partitions", "r");
-	if (!fp)
-		return 0;
-	while (fgets(line, sizeof(line), fp)
-	       != NULL) {
-
-		if (strlen(line) > 128 + (22))
-			continue;
-		sscanf(line, "%4d %4d %10llu %s",
-		       &major, &minor, &blkcnt, device);
-
-		/* careful here.. if there is no device, we are scanning the
-		 * first two lines that are not useful to us
-		 */
-		if (!strlen(device))
-			continue;
-		startnode =
-		    find_dev_by_majmin(devlisthead->devnode, major, minor);
-		if (!startnode) {
-			startnode = alloc_list_obj(devlisthead, major, minor);
-			if (!startnode)
-				return -2;
-		}
-
-		startnode->procpart = 1;
-		strcpy(startnode->procname, device);
-	}
-
-	fclose(fp);
-	return 1;
-}
-
-/* scan /proc/mdstat and adds info to the list. At this point
- * all the devices _must_ be already in the list. We don't add anymore
- * since raids can only be assembled out of existing devices
- *
- * ret:
- * 1 if we could scan
- * 0 otherwise
- */
-static int scanmdstat(struct devlisthead *devlisthead)
-{
-	char line[4096];
-	FILE *fp;
-	char device[16];
-	char separator[4];
-	char status[16];
-	char personality[16];
-	char firstdevice[16];
-	char devices[4096];
-	char *tmp, *next;
-	struct devnode *startnode = NULL;
-
-	fp = fopen("/proc/mdstat", "r");
-	if (!fp)
-		return 0;
-
-	while (fgets(line, sizeof(line), fp) != NULL) {
-
-		/* i like things to be absolutely clean */
-		memset(device, 0, 16);
-		memset(separator, 0, 4);
-		memset(status, 0, 16);
-		memset(personality, 0, 16);
-		memset(firstdevice, 0, 16);
-		memset(devices, 0, 4096);
-
-		if (strlen(line) > 4096)
-			continue;
-
-		/* we only parse stuff that starts with ^md
-		 * that's supposed to point to raid */
-		if (!(line[0] == 'm' && line[1] == 'd'))
-			continue;
-
-		sscanf(line, "%s %s %s %s %s",
-		       device, separator, status, personality, firstdevice);
-
-		/* scan only raids that are active */
-		if (strcmp(status, "active"))
-			continue;
-
-		/* try to find *mdX and set the device as real raid.
-		 * if we don't find the device we don't try to set the slaves */
-		startnode = find_dev_by_path(devlisthead->devnode, device, 1);
-		if (!startnode)
-			continue;
-
-		startnode->md = 1;
-
-		/* trunkate the string from sdaX[Y] to sdaX and
-		 * copy the whole device string over */
-		memset(strstr(firstdevice, "["), 0, 1);
-		strcpy(devices, strstr(line, firstdevice));
-
-		/* if we don't find any slave (for whatever reason)
-		 * keep going */
-		if (!strlen(devices))
-			continue;
-
-		tmp = devices;
-		while ((tmp) && ((next = strstr(tmp, " ")) || strlen(tmp))) {
-
-			memset(strstr(tmp, "["), 0, 1);
-
-			startnode =
-			    find_dev_by_path(devlisthead->devnode, tmp, 1);
-			if (startnode)
-				startnode->md = 2;
-
-			tmp = next;
-
-			if (tmp)
-				tmp++;
-
-		}
-	}
-
-	fclose(fp);
-	return 1;
-}
-
-/* scanmapper parses /proc/devices to identify what maj are associated
- * with device-mapper
- *
- * ret:
- * can't fail for now
- */
-static int scanmapper(struct devlisthead *devlisthead)
-{
-	struct devnode *startnode;
-	FILE *fp;
-	char line[4096];
-	char major[4];
-	char device[64];
-	int maj, start = 0;
-
-	fp = fopen("/proc/devices", "r");
-	if (!fp)
-		return 0;
-
-	while (fgets(line, sizeof(line), fp) != NULL) {
-		memset(major, 0, 4);
-		memset(device, 0, 64);
-
-		if (strlen(line) > 4096)
-			continue;
-
-		if (!strncmp(line, "Block devices:", 13)) {
-			start = 1;
-			continue;
-		}
-
-		if (!start)
-			continue;
-
-		sscanf(line, "%s %s", major, device);
-
-		if (!strncmp(device, "device-mapper", 13)) {
-			maj = atoi(major);
-			startnode = devlisthead->devnode;
-
-			while (startnode) {
-				if (startnode->maj == maj)
-					startnode->mapper = 1;
-
-				startnode = startnode->next;
-			}
-
-		}
-
-	}
-
-	fclose(fp);
-	return 1;
-}
-
-/* scan through the list and execute the custom filter for each entry */
-static void run_filter(struct devlisthead *devlisthead,
-		       devfilter filter, void *filter_args)
-{
-	struct devnode *startnode = devlisthead->devnode;
-
-	while (startnode) {
-		filter(startnode, filter_args);
-		startnode = startnode->next;
-	}
-	return;
-}
-
-/** sysfs helper functions **/
-
-/* /sys/block/sda/dev or /sys/block/sda1/dev exists
- * the device is real and dev contains maj/min info.
- *
- * ret:
- * 1 on success and set maj/min
- * 0 if no file is found
- * -1 if we could not open the file
- */
-static int sysfs_is_dev(char *path, int *maj, int *min)
-{
-	char newpath[MAXPATHLEN];
-	struct stat sb;
-	FILE *f;
-	snprintf(newpath, sizeof(newpath), "%s/dev", path);
-	if (!lstat(newpath, &sb)) {
-		f = fopen(newpath, "r");
-		if (f) {
-			int err;
-
-			err = fscanf(f, "%d:%d", maj, min);
-			fclose(f);
-			if ((err == EOF) || (err != 2))
-				return -1;
-
-			return 1;
-		} else
-			return -1;
-	}
-	return 0;
-}
-
-/* /sys/block/sda/removable tells us if a device can be ejected
- * from the system or not. This is useful for USB pendrive that are
- * both removable and disks.
- *
- * ret:
- * 1 if is removable
- * 0 if not
- * -1 if we couldn't find the file.
- */
-static int sysfs_is_removable(char *path)
-{
-	char newpath[MAXPATHLEN];
-	struct stat sb;
-	int i = -1;
-	FILE *f;
-	snprintf(newpath, sizeof(newpath), "%s/removable", path);
-	if (!lstat(newpath, &sb)) {
-		f = fopen(newpath, "r");
-		if (f) {
-			int err;
-
-			err = fscanf(f, "%d\n", &i);
-			fclose(f);
-			if ((err == EOF) || (err != 1))
-				i = -1;
-		}
-	}
-	return i;
-}
-
-/* we use this function to scan /sys/block/sda{,1}/{holders,slaves}
- * to know in what position of the foodchain this device is.
- * NOTE: a device can have both holders and slaves at the same time!
- * (for example an lvm volume on top of a raid device made of N real disks
- *
- * ret:
- * always return the amount of entries in the dir if successful
- * or any return value from scandir.
- */
-static int sysfs_has_subdirs_entries(char *path, char *subdir)
-{
-	char newpath[MAXPATHLEN];
-	struct dirent **namelist;
-	struct stat sb;
-	int n, i, count = 0;
-
-	snprintf(newpath, sizeof(newpath), "%s/%s", path, subdir);
-	if (!lstat(newpath, &sb)) {
-		if (S_ISDIR(sb.st_mode)) {
-			i = scandir(newpath, &namelist, 0, alphasort);
-			if (i < 0)
-				return i;
-			for (n = 0; n < i; n++) {
-				if (namelist[n]->d_name[0] != '.')
-					count++;
-				free(namelist[n]);
-			}
-			free(namelist);
-		}
-	}
-	return count;
-}
-
-/* this is the best approach so far to make sure a block device
- * is a disk and distinguish it from a cdrom or tape or etc.
- * What we know for sure is that a type 0 is a disk.
- * From an old piece code 0xe is an IDE disk and comes from media.
- * NOTE: we scan also for ../ that while it seems stupid, it will
- * allow to easily mark partitions as real disks.
- * (see for example /sys/block/sda/device/type and
- * /sys/block/sda1/../device/type)
- * TODO: there might be more cases to evaluate.
- *
- * ret:
- * -2 we were not able to open the file
- * -1 no path found
- *  0 we found the path but we have 0 clue on what it is
- *  1 is a disk
- */
-static int sysfs_is_disk(char *path)
-{
-	char newpath[MAXPATHLEN];
-	struct stat sb;
-	int i = -1;
-	FILE *f;
-
-	snprintf(newpath, sizeof(newpath), "%s/device/type", path);
-	if (!lstat(newpath, &sb))
-		goto found;
-
-	snprintf(newpath, sizeof(newpath), "%s/../device/type", path);
-	if (!lstat(newpath, &sb))
-		goto found;
-
-	snprintf(newpath, sizeof(newpath), "%s/device/media", path);
-	if (!lstat(newpath, &sb))
-		goto found;
-
-	snprintf(newpath, sizeof(newpath), "%s/../device/media", path);
-	if (lstat(newpath, &sb))
-		goto found;
-
-	snprintf(newpath, sizeof(newpath), "%s/device/devtype", path);
-	if (lstat(newpath, &sb))
-		return 1;
-
-	snprintf(newpath, sizeof(newpath), "%s/../device/devtype", path);
-	if (lstat(newpath, &sb))
-		return 1;
-
-	return -1;
-
-      found:
-	f = fopen(newpath, "r");
-	if (f) {
-		int err;
-
-		err = fscanf(f, "%d\n", &i);
-		fclose(f);
-
-		if ((err == EOF) || (err != 1))
-			return 0;
-
-		switch (i) {
-		case 0x0:	/* scsi type_disk */
-		case 0xe:	/* found on ide disks from old kernels.. */
-			i = 1;
-			break;
-		default:
-			i = 0;	/* by default we have no clue */
-			break;
-		}
-	} else
-		i = -2;
-
-	return i;
-}
-
-/* recursive function that will scan and dive into /sys/block
- * looking for devices and scanning for attributes.
- *
- * ret:
- * 1 on success
- * -1 on generic error
- * -2 -ENOMEM
- */
-static int scansysfs(struct devlisthead *devlisthead, char *path, int level)
-{
-	struct devnode *startnode;
-	int i, n, maj, min;
-	struct dirent **namelist;
-	struct stat sb;
-	char newpath[MAXPATHLEN];
-
-	i = scandir(path, &namelist, 0, alphasort);
-	if (i < 0)
-		return -1;
-
-	for (n = 0; n < i; n++) {
-		if (namelist[n]->d_name[0] != '.') {
-			snprintf(newpath, sizeof(newpath),
-				 "%s/%s", path, namelist[n]->d_name);
-
-			if (!stat(newpath, &sb) && !level)
-				if (S_ISDIR(sb.st_mode))
-					if (scansysfs(devlisthead, newpath, 1) < 0)
-						return -1;
-
-			if (!lstat(newpath, &sb)) {
-				if (S_ISDIR(sb.st_mode))
-					if (scansysfs(devlisthead, newpath, 1) < 0)
-						return -1;
-
-				if (S_ISLNK(sb.st_mode))
-					continue;
-
-				if (sysfs_is_dev(newpath, &maj, &min) > 0) {
-					startnode =
-					    alloc_list_obj(devlisthead, maj,
-							   min);
-					if (!startnode)
-						return -2;
-
-					startnode->sysfsattrs.sysfs = 1;
-					startnode->sysfsattrs.removable =
-					    sysfs_is_removable(newpath);
-					startnode->sysfsattrs.holders =
-					    sysfs_has_subdirs_entries(newpath,
-								      "holders");
-					startnode->sysfsattrs.slaves =
-					    sysfs_has_subdirs_entries(newpath,
-								      "slaves");
-					startnode->sysfsattrs.disk =
-					    sysfs_is_disk(newpath);
-				}
-			}
-		}
-		free(namelist[n]);
-	}
-
-	free(namelist);
-	return 1;
-}
-
-/*
- * devlisthead can be null if you are at init time. pass the old one if you are
- * updating or scanning..
- *
- * timeout is used only at init time to set the cache timeout value if default
- * value is not good enough. We might extend its meaning at somepoint.
- * Anything <= 0 means that the cache does not expire.
- */
-
-struct devlisthead *scan_for_dev(struct devlisthead *devlisthead,
-				 time_t timeout,
-				 devfilter filter, void *filter_args)
-{
-	int res;
-	time_t current;
-
-	time(&current);
-
-	if (devlisthead) {
-		if ((current - devlisthead->cache_timestamp) <
-		    devlisthead->cache_timeout) {
-			return devlisthead;
-		}
-	} else {
-		devlisthead = malloc(sizeof(struct devlisthead));
-		if (!devlisthead)
-			return NULL;
-		memset(devlisthead, 0, sizeof(struct devlisthead));
-		if (timeout)
-			devlisthead->cache_timeout = timeout;
-		else
-			devlisthead->cache_timeout = DEVCACHETIMEOUT;
-	}
-
-	flush_dev_cache(devlisthead);
-	devlisthead->cache_timestamp = current;
-
-	/* it's important we check those 3 errors and abort in case
-	 * as it means that we are running out of mem,
-	 */
-	devlisthead->sysfs = res = scansysfs(devlisthead, SYSBLOCKPATH, 0);
-	if (res < -1)
-		goto emergencyout;
-
-	devlisthead->procpart = res = scanprocpart(devlisthead);
-	if (res < -1)
-		goto emergencyout;
-
-	devlisthead->lsdev = res = lsdev(devlisthead, DEVPATH);
-	if (res < -1)
-		goto emergencyout;
-
-	/* from now on we don't alloc mem ourselves but only add info */
-	devlisthead->mdstat = scanmdstat(devlisthead);
-	devlisthead->mapper = scanmapper(devlisthead);
-	if (filter)
-		run_filter(devlisthead, filter, filter_args);
-
-	return devlisthead;
-
-      emergencyout:
-	free_dev_list(devlisthead);
-	return 0;
-}
-
-/* free everything we used so far */
-
-void free_dev_list(struct devlisthead *devlisthead)
-{
-	if (devlisthead) {
-		flush_dev_cache(devlisthead);
-		free(devlisthead);
-	}
-	return;
-}
diff --git a/cman/qdisk/scandisk.h b/cman/qdisk/scandisk.h
deleted file mode 100644
index 6a8aa32..0000000
--- a/cman/qdisk/scandisk.h
+++ /dev/null
@@ -1,87 +0,0 @@
-#ifndef __SCANDISK_H__
-#define __SCANDISK_H__
-
-#ifndef DEVPATH
-#define	DEVPATH		"/dev"
-#endif
-
-#ifndef SYSFSPATH
-#define SYSFSPATH	"/sys"
-#endif
-
-#ifndef SYSBLOCKPATH
-#define SYSBLOCKPATH	SYSFSPATH "/block"
-#endif
-
-#ifdef DEBUG
-#define	DEVCACHETIMEOUT	5	/* expressed in seconds */
-#else
-#define	DEVCACHETIMEOUT	30
-#endif
-
-/* each entry can be (generally):
- * > 0 on success or good hit
- * 0 on success with no hit
- * < 0 on error
- */
-
-struct sysfsattrs {		/* usual 0 | 1 game */
-	int sysfs;		/* did we find an entry in sysfs at all? */
-	int slaves;		/* device has slaves */
-	int holders;		/* device has holders */
-	int removable;		/* device is removable */
-	int disk;		/* device is a disk */
-};
-
-/* this structure is required because we don't know upfront how many
- * entries for a certain maj/min will be found in /dev, and so we need
- * to alloc them dynamically.
- */
-struct devpath {
-	struct devpath *next;
-	char path[MAXPATHLEN];
-};
-
-/* this structure holds all the data for each maj/min found in the system
- * that is a block device
- */
-struct devnode {
-	struct devnode *next;
-	struct devpath *devpath;	/* point to the first path entry */
-	int maj;		/* device major */
-	int min;		/* device minor */
-	struct sysfsattrs sysfsattrs;	/* like the others.. scanning /sys */
-	int procpart;		/* 0 if the device is not in proc/part or 1 on success. <0 on error */
-	char procname[MAXPATHLEN];	/* non-NULL if we find a maj/min match */
-	int md;			/* 0 nothing to do with raid, 1 is raid,
-				 * 2 is raid slave - data from /proc/mdstat */
-	int mapper;		/* 0 nothing, 1 we believe it's a devmap dev */
-	void *filter;		/* your filter output.. whatever it is */
-};
-
-/* this is what you get after a scan... if you are lucky */
-/* each entry can be 0 if we can't scan or < 0 if there are errors */
-
-struct devlisthead {
-	time_t cache_timestamp;	/* this cache timestamp */
-	int cache_timeout;	/* for how long this cache is valid */
-	int sysfs;		/* set to 1 if we were able to scan
-				 * /sys */
-	int procpart;		/* set to 1 if we were able to scan
-				 * /proc/partitions */
-	int lsdev;		/* set to 1 if we were able to ls /dev */
-	int mdstat;		/* set to 1 if we were able to scan
-				 * /proc/mdstat */
-	int mapper;		/* set to 1 if we were able to run
-				 * something against mapper */
-	struct devnode *devnode;	/* points to the first entry */
-};
-
-typedef void (*devfilter) (struct devnode * cur, void *arg);
-
-struct devlisthead *scan_for_dev(struct devlisthead *devlisthead,
-				 time_t timeout,
-				 devfilter filter, void *filter_args);
-void free_dev_list(struct devlisthead *devlisthead);
-
-#endif /* __SCANDISK_H__ */
diff --git a/cman/qdisk/score.c b/cman/qdisk/score.c
deleted file mode 100644
index 1ba1506..0000000
--- a/cman/qdisk/score.c
+++ /dev/null
@@ -1,419 +0,0 @@
-/**
-  @file Quorum daemon scoring functions + thread.
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <fcntl.h>
-#include <pthread.h>
-#include <string.h>
-#include <ccs.h>
-#include <liblogthread.h>
-#include <sched.h>
-#include <sys/mman.h>
-#include "disk.h"
-#include "score.h"
-
-static pthread_mutex_t sc_lock = PTHREAD_MUTEX_INITIALIZER;
-static int _score = 0, _maxscore = 0, _score_thread_running = 0;
-static pthread_t score_thread = (pthread_t)0;
-void set_priority(int, int);
-
-struct h_arg {
-	struct h_data *h;
-	int sched_queue;
-	int sched_prio;
-	int count;
-};
-
-/*
-  XXX Messy, but works for now... 
- */
-static void
-nullify(void)
-{
-	int fd[3];
-
-	close(0);
-	close(1);
-	close(2);
-
-	fd[0] = open("/dev/null", O_RDONLY);
-	if (fd[0] != 0)
-		dup2(fd[0], 0);
-	fd[1] = open("/dev/null", O_WRONLY);
-	if (fd[1] != 1)
-		dup2(fd[1], 1);
-	fd[2] = open("/dev/null", O_WRONLY);
-	if (fd[2] != 2)
-		dup2(fd[2], 2);
-}
-
-
-/**
-  Set all signal handlers to default for exec of a script.
-  ONLY do this after a fork().
- */
-static void
-restore_signals(void)
-{
-	sigset_t set;
-	int x;
-
-	for (x = 1; x < _NSIG; x++)
-		signal(x, SIG_DFL);
-
-	sigfillset(&set);
-	sigprocmask(SIG_UNBLOCK, &set, NULL);
-}
-
-
-/**
-  Spin off a user-defined heuristic
- */
-static int
-fork_heuristic(struct h_data *h)
-{
-	int pid;
-	char *argv[4];
-	time_t now;
-
-	if (h->childpid) {	
-		errno = EINPROGRESS;
-		return -1;
-	}
-
-	now = time(NULL);
-	if (now < h->nextrun)
-		return 0;
-
-	h->nextrun = now + h->interval;
-
-	pid = fork();
-	if (pid < 0)
-		return -1;
-
-	if (pid) {
-		h->childpid = pid;
-		return 0;
-	}
-	
-	/*
-	 * always use SCHED_OTHER for the child processes 
-	 * nice -1 is fine; but we don't know what the child process
-	 * might do, so leaving it (potentially) in SCHED_RR or SCHED_FIFO
-	 * is out of the question
-	 * 
-	 * XXX if you set SCHED_OTHER in the conf file and nice 20, the below
-	 * will make the heuristics a higher prio than qdiskd.  This should be
-	 * fine in practice, because running qdiskd at nice 20 will cause all
-	 * sorts of problems on a busy system.
-	 */
-	set_priority(SCHED_OTHER, -1);
-	munlockall();
-	restore_signals();
-
-	argv[0] = "/bin/sh";
-	argv[1] = "-c";
-	argv[2] = h->program;
-	argv[3] = NULL;
-
-	nullify();
-
-	execv("/bin/sh", argv);
-
-	logt_print(LOG_ERR, "Execv failed\n");
-	return 0;
-}
-
-
-/**
-  Total our current score
- */
-static void
-total_score(struct h_data *h, int max, int *score, int *maxscore)
-{
-	int x;
-
-	*score = 0;
-	*maxscore = 0;
-	
-	logt_print(LOG_DEBUG, "max = %d\n", max);
-	/* Allow operation w/o any heuristics */
-	if (!max) {
-		*score = *maxscore = 1;
-		return;
-	}
-
-	for (x = 0; x < max; x++) {
-		*maxscore += h[x].score;
-		if (h[x].available)
-			*score += h[x].score;
-	}
-}
-
-
-/**
-  Check for response from a user-defined heuristic / script
- */
-static int
-check_heuristic(struct h_data *h, int block)
-{
-	int ret;
-	int status;
-
-	if (h->childpid == 0)
-		/* No child to check */
-		return 0;
-
-	ret = waitpid(h->childpid, &status, block?0:WNOHANG);
-	if (!block && ret == 0)
-		/* No children exited */
-		return 0;
-
-	h->childpid = 0;
-	if (ret < 0 && errno == ECHILD)
-		/* wrong child? */
-		goto miss;
-	if (!WIFEXITED(status)) {
-		ret = 0;
-		goto miss;
-	}
-	if (WEXITSTATUS(status) != 0) {
-		ret = 0;
-		goto miss;
-	}
-	
-	/* Returned 0 and was not killed */
-	if (!h->available) {
-		h->available = 1;
-		logt_print(LOG_INFO, "Heuristic: '%s' UP\n", h->program);
-	}
-	h->misses = 0;
-	return 0;
-	
-miss:
-	if (h->available) {
-		h->misses++;
-		if (h->misses >= h->tko) {
-			logt_print(LOG_INFO,
-				"Heuristic: '%s' DOWN (%d/%d)\n",
-				h->program, h->misses, h->tko);
-			h->available = 0;
-		} else {
-			logt_print(LOG_DEBUG,
-				"Heuristic: '%s' missed (%d/%d)\n",
-				h->program, h->misses, h->tko);
-		}
-	}
-	
-	return ret;
-}
-
-
-/**
-  Kick off all available heuristics
- */
-static int
-fork_heuristics(struct h_data *h, int max)
-{
-	int x;
-
-	for (x = 0; x < max; x++)
-		fork_heuristic(&h[x]);
-	return 0;
-}
-
-
-/**
-  Check all available heuristics
- */
-static int
-check_heuristics(struct h_data *h, int max, int block)
-{
-	int x;
-
-	for (x = 0; x < max; x++)
-		check_heuristic(&h[x], block);
-	return 0;
-}
-
-
-/**
-  Read configuration data from CCS into the array provided
- */
-int
-configure_heuristics(int ccsfd, struct h_data *h, int max)
-{
-	int x = 0;
-	char *val;
-	char query[128];
-
-	if (!h || !max)
-		return -1;
-
-	do {
-		h[x].program = NULL;
-		h[x].available = 0;
-		h[x].misses = 0;
-		h[x].interval = 2;
-		h[x].tko = 1;
-		h[x].score = 1;
-		h[x].childpid = 0;
-		h[x].nextrun = 0;
-
-		/* Get program */
-		snprintf(query, sizeof(query),
-			 "/cluster/quorumd/heuristic[%d]/@program", x+1);
-		if (ccs_get(ccsfd, query, &val) != 0)
-			/* No more */
-			break;
-		h[x].program = val;
-
-		/* Get score */
-		snprintf(query, sizeof(query),
-			 "/cluster/quorumd/heuristic[%d]/@score", x+1);
-		if (ccs_get(ccsfd, query, &val) == 0) {
-			h[x].score = atoi(val);
-			free(val);
-			if (h[x].score <= 0)
-				h[x].score = 1;
-		}
-		
-		/* Get query interval */
-		snprintf(query, sizeof(query),
-			 "/cluster/quorumd/heuristic[%d]/@interval", x+1);
-		if (ccs_get(ccsfd, query, &val) == 0) {
-			h[x].interval = atoi(val);
-			free(val);
-			if (h[x].interval <= 0)
-				h[x].interval = 2;
-		}
-		
-		/* Get tko for this heuristic */
-		snprintf(query, sizeof(query),
-			 "/cluster/quorumd/heuristic[%d]/@tko", x+1);
-		if (ccs_get(ccsfd, query, &val) == 0) {
-			h[x].tko= atoi(val);
-			free(val);
-			if (h[x].tko <= 0)
-				h[x].tko = 1;
-		}
-
-		logt_print(LOG_DEBUG,
-		       "Heuristic: '%s' score=%d interval=%d tko=%d\n",
-		       h[x].program, h[x].score, h[x].interval, h[x].tko);
-
-	} while (++x < max);
-
-	logt_print(LOG_DEBUG, "%d heuristics loaded\n", x);
-		
-	return x;
-}
-
-
-/**
-  Return the current score + maxscore to the caller
- */
-int
-get_my_score(int *score, int *maxscore)
-{
-	pthread_mutex_lock(&sc_lock);
-	*score = _score;
-	*maxscore = _maxscore;
-	pthread_mutex_unlock(&sc_lock);
-
-	return 0;
-}
-
-
-/**
-  Call this if no heuristics are set to run in master-wins mode
- */
-int
-fudge_scoring(void)
-{
-	pthread_mutex_lock(&sc_lock);
-	_score = _maxscore = 1;
-	pthread_mutex_unlock(&sc_lock);
-
-	return 0;
-}
-
-
-/**
-  Loop for the scoring thread.
- */
-static void *
-score_thread_main(void *arg)
-{
-	struct h_arg *args = (struct h_arg *)arg;
-	int score, maxscore;
-	
-	set_priority(args->sched_queue, args->sched_prio);
-
-	while (_score_thread_running) {
-		fork_heuristics(args->h, args->count);
-		check_heuristics(args->h, args->count, 0);
-		total_score(args->h, args->count, &score, &maxscore);
-
-		pthread_mutex_lock(&sc_lock);
-		_score = score;
-		_maxscore = maxscore;
-		pthread_mutex_unlock(&sc_lock);
-
-		if (_score_thread_running)
-			sleep(1);
-	}
-
-	free(args->h);
-	free(args);
-	logt_print(LOG_INFO, "Score thread going away\n");
-	return (NULL);
-}
-
-
-/**
-  Start the score thread.  h is copied into an argument which is
-  passed in as the arg parameter in the score thread, so it is safe
-  to pass in h if it was allocated on the stack.
- */
-int
-start_score_thread(qd_ctx *ctx, struct h_data *h, int count)
-{
-	pthread_attr_t attrs;
-	struct h_arg *args;
-
-	if (!h || !count)
-		return -1;
-
-	args = malloc(sizeof(struct h_arg));
-	if (!args)
-		return -1;
-
-	args->h = malloc(sizeof(struct h_data) * count);
-	if (!args->h) {
-		free(args);
-		return -1;
-	}
-
-	memcpy(args->h, h, (sizeof(struct h_data) * count));
-	args->count = count;
-	args->sched_queue = ctx->qc_sched;
-	args->sched_prio = ctx->qc_sched_prio;
-
-	_score_thread_running = 1;
-	
-        pthread_attr_init(&attrs);
-        pthread_attr_setinheritsched(&attrs, PTHREAD_INHERIT_SCHED);
-        pthread_create(&score_thread, &attrs, score_thread_main, args);
-        pthread_attr_destroy(&attrs);
-
-	if (score_thread)
-		return 0;
-	_score_thread_running = 0;
-	return -1;	
-}
diff --git a/cman/qdisk/score.h b/cman/qdisk/score.h
deleted file mode 100644
index 77e155b..0000000
--- a/cman/qdisk/score.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
-  @file Quorum daemon scoring functions + thread header file
- */
-#ifndef _SCORE_H
-#define _SCORE_H
-
-#include <time.h>
-#include <sys/time.h>
-#include <sys/types.h>
-
-struct h_data {
-	char *	program;
-	int	score;
-	int	available;
-	int	tko;
-	int	interval;
-	int	misses;
-	pid_t	childpid;
-	time_t	nextrun;
-};
-
-/*
-   Grab score data from CCSD
- */
-int configure_heuristics(int ccsfd, struct h_data *hp, int max);
-
-/*
-   Start the thread which runs the scoring applets
- */
-int start_score_thread(qd_ctx *ctx, struct h_data *h, int count);
-
-/* 
-   Get our score + maxscore
- */
-int get_my_score(int *score, int *maxscore);
-
-/* 
-   Set score + maxscore to 1.  Call if no heuristics are present
-   to enable master-wins mode
- */
-int fudge_scoring(void);
-
-
-#endif
diff --git a/cman/services/Makefile b/cman/services/Makefile
deleted file mode 100644
index a74b599..0000000
--- a/cman/services/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../../make/defines.mk
-include $(OBJDIR)/make/passthrough.mk
-
-SUBDIRS=quorum cman
diff --git a/cman/services/cman/Makefile b/cman/services/cman/Makefile
deleted file mode 100644
index 263f013..0000000
--- a/cman/services/cman/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../../../make/defines.mk
-include $(OBJDIR)/make/passthrough.mk
-
-SUBDIRS=services lib
diff --git a/cman/services/cman/include/corosync/cman.h b/cman/services/cman/include/corosync/cman.h
deleted file mode 100644
index baedf35..0000000
--- a/cman/services/cman/include/corosync/cman.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef CMAN_H_DEFINED
-#define CMAN_H_DEFINED
-
-// Actually -- we return proper errnos
-typedef enum {
-        CMAN_OK = 1,
-        CMAN_ERR_LIBRARY = 2,
-        CMAN_ERR_TIMEOUT = 5,
-        CMAN_ERR_TRY_AGAIN = 6,
-        CMAN_ERR_INVALID_PARAM = 7,
-        CMAN_ERR_NO_MEMORY = 8,
-        CMAN_ERR_BAD_HANDLE = 9,
-        CMAN_ERR_ACCESS = 11,
-        CMAN_ERR_NOT_EXIST = 12,
-        CMAN_ERR_EXIST = 14,
-        CMAN_ERR_NOT_SUPPORTED = 20,
-        CMAN_ERR_SECURITY = 29
-} cman_error_t;
-
-typedef unsigned int cman_handle_t;
-typedef void (*cman_callback_t)(cman_handle_t handle, void *privdata, int reason, int arg);
-typedef void (*cman_datacallback_t)(cman_handle_t handle, void *privdata,
-				    char *buf, int len, uint8_t port, int nodeid);
-
-/* Shutdown flags */
-#define SHUTDOWN_ANYWAY           1
-#define SHUTDOWN_REMOVE           2
-
-typedef enum {CMAN_REASON_PORTCLOSED,
-	      CMAN_REASON_STATECHANGE,
-              CMAN_REASON_PORTOPENED,
-              CMAN_REASON_TRY_SHUTDOWN,
-              CMAN_REASON_CONFIG_UPDATE} cman_call_reason_t;
-
-
-
-
-
-#endif
diff --git a/cman/services/cman/include/corosync/ipc_cman.h b/cman/services/cman/include/corosync/ipc_cman.h
deleted file mode 100644
index 52ad84a..0000000
--- a/cman/services/cman/include/corosync/ipc_cman.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef IPC_CMAN_H_DEFINED
-#define IPC_CMAN_H_DEFINED
-
-#include <netinet/in.h>
-#include "corosync/ipc_gen.h"
-
-#define CMAN_SERVICE 9
-
-// These don't
-enum req_cman_types {
-	MESSAGE_REQ_CMAN_SENDMSG = 0,
-	MESSAGE_REQ_CMAN_IS_LISTENING,
-	MESSAGE_REQ_CMAN_BIND,
-	MESSAGE_REQ_CMAN_UNBIND,
-};
-
-enum res_cman_types {
-	MESSAGE_RES_CMAN_SENDMSG = 0,
-	MESSAGE_RES_CMAN_IS_LISTENING,
-	MESSAGE_RES_CMAN_BIND,
-	MESSAGE_RES_CMAN_UNBIND,
-};
-
-struct req_lib_cman_bind {
-        mar_req_header_t header __attribute__((aligned(8)));
-	unsigned int port;
-};
-
-struct req_lib_cman_sendmsg {
-        mar_req_header_t header __attribute__((aligned(8)));
-	unsigned int to_port;
-	unsigned int to_node;
-	unsigned int msglen;
-	char message[];
-};
-
-struct res_lib_cman_sendmsg {
-        mar_req_header_t header __attribute__((aligned(8)));
-	unsigned int from_port;
-	unsigned int from_node;
-	unsigned int msglen;
-	char message[];
-};
-
-struct req_lib_cman_is_listening {
-        mar_req_header_t header __attribute__((aligned(8)));
-	unsigned int port;
-	unsigned int nodeid;
-};
-
-struct res_lib_cman_is_listening {
-        mar_res_header_t header __attribute__((aligned(8)));
-	unsigned int status;
-};
-
-
-#endif
diff --git a/cman/services/cman/lib/Makefile b/cman/services/cman/lib/Makefile
deleted file mode 100644
index f8d9441..0000000
--- a/cman/services/cman/lib/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-TARGET= libcman
-
-include ../../../../make/defines.mk
-include $(OBJDIR)/make/libs.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-CFLAGS += -fPIC
-CFLAGS += -I${incdir}
-CFLAGS += -I../include -I../../quorum/include
-
diff --git a/cman/services/cman/lib/libcman.c b/cman/services/cman/lib/libcman.c
deleted file mode 100644
index ca79729..0000000
--- a/cman/services/cman/lib/libcman.c
+++ /dev/null
@@ -1,812 +0,0 @@
-/*
- * Provides a cman API using the corosync executive
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <pthread.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <errno.h>
-
-#include <corosync/corotypes.h>
-#include <corosync/mar_gen.h>
-#include <corosync/ipc_gen.h>
-#include <corosync/ais_util.h>
-#include <corosync/cfg.h>
-#include <corosync/confdb.h>
-#include <corosync/cmanquorum.h>
-#include <corosync/ipc_cman.h>
-
-#include "libcman.h"
-
-#define CMAN_MAGIC 0x434d414e
-
-#define CMAN_SHUTDOWN_ANYWAY   1
-#define CMAN_SHUTDOWN_REMOVED  2
-
-struct cman_inst {
-	int magic;
-	int response_fd;
-	int dispatch_fd;
-	int finalize;
-	void *privdata;
-	cman_datacallback_t data_callback;
-	cman_callback_t notify_callback;
-	pthread_mutex_t response_mutex;
-	pthread_mutex_t dispatch_mutex;
-
-	corosync_cfg_handle_t cfg_handle;
-	cmanquorum_handle_t cmq_handle;
-	confdb_handle_t confdb_handle;
-};
-
-static void cfg_shutdown_callback(
-	corosync_cfg_handle_t handle,
-	CorosyncCfgShutdownFlagsT flags);
-
-static void cmanquorum_notification_callback(
-        cmanquorum_handle_t handle,
-        uint32_t quorate,
-        uint32_t node_list_entries,
-        cmanquorum_node_t node_list[]);
-
-static cmanquorum_callbacks_t cmq_callbacks =
-{
-	.cmanquorum_notify_fn = cmanquorum_notification_callback,
-};
-
-static CorosyncCfgCallbacksT cfg_callbacks =
-{
-	.corosyncCfgStateTrackCallback = NULL,
-	.corosyncCfgShutdownCallback = cfg_shutdown_callback,
-};
-
-static void cman_instance_destructor (void *instance);
-
-
-#define VALIDATE_HANDLE(h) do {if (!(h) || (h)->magic != CMAN_MAGIC) {errno = EINVAL; return -1;}} while (0)
-
-static struct cman_inst *admin_inst;
-
-static void cfg_shutdown_callback(
-	corosync_cfg_handle_t handle,
-	CorosyncCfgShutdownFlagsT flags)
-{
-	int cman_flags = 0;
-
-	if (!admin_inst)
-		return;
-
-	if (flags == COROSYNC_CFG_SHUTDOWN_FLAG_REGARDLESS)
-		cman_flags = CMAN_SHUTDOWN_ANYWAY;
-
-	if (admin_inst->notify_callback)
-		admin_inst->notify_callback((void *)admin_inst, admin_inst->privdata, CMAN_REASON_TRY_SHUTDOWN, cman_flags);
-
-}
-
-static void cmanquorum_notification_callback(
-        cmanquorum_handle_t handle,
-        uint32_t quorate,
-        uint32_t node_list_entries,
-        cmanquorum_node_t node_list[])
-{
-	struct cman_inst *cman_inst;
-
-	cmanquorum_context_get(handle, (void **)&cman_inst);
-
-	if (cman_inst->notify_callback)
-		cman_inst->notify_callback((void*)cman_inst, cman_inst->privdata, CMAN_REASON_STATECHANGE, quorate);
-}
-
-
-/*
- * Clean up function for a cman instance (cman_init) handle
- */
-static void cman_instance_destructor (void *instance)
-{
-	struct cman_inst *cman_inst = instance;
-
-	pthread_mutex_destroy (&cman_inst->response_mutex);
-}
-
-static int cmanquorum_check_and_start(struct cman_inst *cman_inst)
-{
-	if (!cman_inst->cmq_handle) {
-		if (cmanquorum_initialize(&cman_inst->cmq_handle, &cmq_callbacks) != CS_OK) {
-			errno = ENOMEM;
-			return -1;
-		}
-		cmanquorum_context_set(cman_inst->cmq_handle, (void*)cman_inst);
-	}
-	return 0;
-}
-
-cman_handle_t cman_init (
-	void *privdata)
-{
-	cs_error_t error;
-	struct cman_inst *cman_inst;
-
-	cman_inst = malloc(sizeof(struct cman_inst));
-	if (!cman_inst)
-		return NULL;
-
-	error = saServiceConnect (&cman_inst->dispatch_fd,
-				  &cman_inst->response_fd,
-				  CMAN_SERVICE);
-	if (error != CS_OK) {
-		goto error;
-	}
-
-	cman_inst->privdata = privdata;
-	pthread_mutex_init (&cman_inst->response_mutex, NULL);
-	pthread_mutex_init (&cman_inst->dispatch_mutex, NULL);
-
-	return (void *)cman_inst;
-
-error:
-	free(cman_inst);
-	errno = ENOMEM;
-	return NULL;
-}
-
-cman_handle_t cman_admin_init (
-	void *privdata)
-{
-	if (admin_inst) {
-		errno = EBUSY;
-		return -1;
-	}
-
-	admin_inst = cman_init(NULL);
-}
-
-
-int cman_finish (
-	cman_handle_t handle)
-{
-	struct cman_inst *cman_inst;
-	cs_error_t error;
-
-	cman_inst = (struct cman_inst *)handle;
-	VALIDATE_HANDLE(cman_inst);
-
-	if (cman_inst->cmq_handle) {
-		quorum_finalize(cman_inst->cmq_handle);
-		cman_inst->cmq_handle = 0;
-	}
-	if (cman_inst->cfg_handle) {
-		corosync_cfg_finalize(cman_inst->cfg_handle);
-		cman_inst->cfg_handle = 0;
-	}
-
-	if (handle == admin_inst)
-		admin_inst = NULL;
-
-	pthread_mutex_lock (&cman_inst->response_mutex);
-
-	/*
-	 * Another thread has already started finalizing
-	 */
-	if (cman_inst->finalize) {
-		pthread_mutex_unlock (&cman_inst->response_mutex);
-		errno = EINVAL;
-		return -1;
-	}
-
-	cman_inst->finalize = 1;
-
-	pthread_mutex_unlock (&cman_inst->response_mutex);
-
-	/*
-	 * Disconnect from the server
-	 */
-	if (cman_inst->response_fd != -1) {
-		shutdown(cman_inst->response_fd, 0);
-		close(cman_inst->response_fd);
-	}
-
-	return 0;
-}
-
-
-int cman_start_recv_data (
-	cman_handle_t handle,
-	cman_datacallback_t callback,
-	uint8_t port)
-{
-	int error;
-	struct cman_inst *cman_inst;
-	struct iovec iov[2];
-	struct req_lib_cman_bind req_lib_cman_bind;
-	mar_res_header_t res;
-
-	cman_inst = (struct cman_inst *)handle;
-	VALIDATE_HANDLE(cman_inst);
-
-	pthread_mutex_lock (&cman_inst->response_mutex);
-
-	req_lib_cman_bind.header.size = sizeof (struct req_lib_cman_bind);
-	req_lib_cman_bind.header.id = MESSAGE_REQ_CMAN_BIND;
-	req_lib_cman_bind.port = port;
-
-	iov[0].iov_base = (char *)&req_lib_cman_bind;
-	iov[0].iov_len = sizeof (struct req_lib_cman_bind);
-
-	error = saSendMsgReceiveReply (cman_inst->response_fd, iov, 1,
-		&res, sizeof (mar_res_header_t));
-
-	pthread_mutex_unlock (&cman_inst->response_mutex);
-
-	if (error != CS_OK) {
-		goto error_exit;
-	}
-
-	errno = error = res.error;
-
-error_exit:
-	return (error?-1:0);
-}
-
-int cman_end_recv_data (
-	cman_handle_t handle)
-{
-	int error;
-	struct cman_inst *cman_inst;
-	struct iovec iov[2];
-	mar_req_header_t req;
-	mar_res_header_t res;
-
-	cman_inst = (struct cman_inst *)handle;
-	VALIDATE_HANDLE(cman_inst);
-
-	pthread_mutex_lock (&cman_inst->response_mutex);
-
-	req.size = sizeof (mar_req_header_t);
-	req.id = MESSAGE_REQ_CMAN_UNBIND;
-
-	iov[0].iov_base = (char *)&req;
-	iov[0].iov_len = sizeof (mar_req_header_t);
-
-	error = saSendMsgReceiveReply (cman_inst->response_fd, iov, 1,
-		&res, sizeof (mar_res_header_t));
-
-	pthread_mutex_unlock (&cman_inst->response_mutex);
-
-	if (error != CS_OK) {
-		goto error_exit;
-	}
-
-	errno = error = res.error;
-
-error_exit:
-
-	return (error?-1:0);
-}
-
-int cman_send_data(cman_handle_t handle, const void *message, int len, int flags, uint8_t port, int nodeid)
-{
-	int error;
-	struct cman_inst *cman_inst;
-	struct iovec iov[2];
-	char buf[len+sizeof(struct req_lib_cman_sendmsg)];
-	struct req_lib_cman_sendmsg *req_lib_cman_sendmsg = (struct req_lib_cman_sendmsg *)buf;
-	mar_res_header_t res;
-
-	cman_inst = (struct cman_inst *)handle;
-	VALIDATE_HANDLE(cman_inst);
-
-	pthread_mutex_lock (&cman_inst->response_mutex);
-
-	req_lib_cman_sendmsg->header.size = sizeof (mar_req_header_t);
-	req_lib_cman_sendmsg->header.id = MESSAGE_REQ_CMAN_SENDMSG;
-	req_lib_cman_sendmsg->to_port = port;
-	req_lib_cman_sendmsg->to_node = nodeid;
-	req_lib_cman_sendmsg->msglen = len;
-	memcpy(req_lib_cman_sendmsg->message, message, len);
-
-	iov[0].iov_base = buf;
-	iov[0].iov_len = len+sizeof(struct req_lib_cman_sendmsg);
-
-	error = saSendMsgReceiveReply (cman_inst->response_fd, iov, 1,
-		&res, sizeof (mar_res_header_t));
-
-	pthread_mutex_unlock (&cman_inst->response_mutex);
-
-	if (error != CS_OK) {
-		goto error_exit;
-	}
-
-	errno = error = res.error;
-
-error_exit:
-
-	return (error?-1:0);
-}
-
-int cman_is_listening (
-	cman_handle_t handle,
-	int nodeid,
-	uint8_t port)
-{
-	int error;
-	struct cman_inst *cman_inst;
-	struct iovec iov[2];
-	struct res_lib_cman_is_listening res_lib_cman_is_listening;
-	struct req_lib_cman_is_listening req_lib_cman_is_listening;
-
-	cman_inst = (struct cman_inst *)handle;
-	VALIDATE_HANDLE(cman_inst);
-
-	pthread_mutex_lock (&cman_inst->response_mutex);
-
-	req_lib_cman_is_listening.header.size = sizeof (struct req_lib_cman_is_listening);
-	req_lib_cman_is_listening.header.id = MESSAGE_REQ_CMAN_IS_LISTENING;
-	req_lib_cman_is_listening.nodeid = nodeid;
-	req_lib_cman_is_listening.port = port;
-
-	iov[0].iov_base = (char *)&req_lib_cman_is_listening;
-	iov[0].iov_len = sizeof (struct req_lib_cman_is_listening);
-
-	error = saSendMsgReceiveReply (cman_inst->response_fd, iov, 1,
-		&res_lib_cman_is_listening, sizeof (struct res_lib_cman_is_listening));
-
-	pthread_mutex_unlock (&cman_inst->response_mutex);
-
-	if (error != CS_OK) {
-		goto error_exit;
-	}
-
-	errno = error = res_lib_cman_is_listening.header.error;
-
-error_exit:
-
-	return (error?-1:0);
-}
-
-/* an example of how we would query the quorum service */
-int cman_is_quorate(cman_handle_t handle)
-{
-	struct cman_inst *cman_inst;
-	int quorate = -1;
-	int error;
-	struct cmanquorum_info info;
-
-	cman_inst = (struct cman_inst *)handle;
-	VALIDATE_HANDLE(cman_inst);
-
-	if (!cmanquorum_check_and_start(cman_inst))
-		return -1;
-
-	if (cmanquorum_getinfo(cman_inst->cmq_handle, 0, &info) != CS_OK)
-		errno = EINVAL;
-	else
-		quorate = ((info.flags & CMANQUORUM_INFO_FLAG_QUORATE) != 0);
-
-	return quorate;
-}
-
-
-int cman_shutdown(cman_handle_t handle, int flags)
-{
-	struct cman_inst *cman_inst;
-	int error;
-	CorosyncCfgShutdownFlagsT cfg_flags = 0;
-
-	cman_inst = (struct cman_inst *)handle;
-	VALIDATE_HANDLE(cman_inst);
-
-	if (!cman_inst->cfg_handle) {
-		if (corosync_cfg_initialize(&cman_inst->cfg_handle, &cfg_callbacks) != CS_OK) {
-			errno = ENOMEM;
-			return -1;
-		}
-	}
-
-	if (flags == CMAN_SHUTDOWN_ANYWAY)
-		cfg_flags = COROSYNC_CFG_SHUTDOWN_FLAG_REGARDLESS;
-
-	error = corosync_cfg_try_shutdown(cman_inst->cfg_handle, cfg_flags);
-
-	return error;
-}
-
-int cman_leave_cluster(cman_handle_t handle, int flags)
-{
-	struct cman_inst *cman_inst;
-	int error;
-	CorosyncCfgShutdownFlagsT cfg_flags = 0;
-
-	cman_inst = (struct cman_inst *)handle;
-	VALIDATE_HANDLE(cman_inst);
-
-	if (!cman_inst->cfg_handle) {
-		if (corosync_cfg_initialize(&cman_inst->cfg_handle, &cfg_callbacks) != CS_OK) {
-			errno = ENOMEM;
-			return -1;
-		}
-	}
-
-	cfg_flags = COROSYNC_CFG_SHUTDOWN_FLAG_IMMEDIATE;
-
-	error = corosync_cfg_try_shutdown(cman_inst->cfg_handle, cfg_flags);
-
-	return error;
-}
-
-int cman_replyto_shutdown(cman_handle_t handle, int flags)
-{
-	struct cman_inst *cman_inst;
-	int error;
-
-	cman_inst = (struct cman_inst *)handle;
-	VALIDATE_HANDLE(cman_inst);
-
-	if (!cman_inst->cfg_handle) {
-		if (corosync_cfg_initialize(&cman_inst->cfg_handle, &cfg_callbacks) != CS_OK) {
-			errno = ENOMEM;
-			return -1;
-		}
-	}
-
-	error = corosync_cfg_replyto_shutdown(cman_inst->cfg_handle, flags);
-
-	return error;
-}
-
-int cman_killnode(cman_handle_t handle, unsigned int nodeid)
-{
-	struct cman_inst *cman_inst;
-	int error;
-
-	cman_inst = (struct cman_inst *)handle;
-	VALIDATE_HANDLE(cman_inst);
-
-	if (!cman_inst->cfg_handle) {
-		if (corosync_cfg_initialize(&cman_inst->cfg_handle, &cfg_callbacks) != CS_OK) {
-			errno = ENOMEM;
-			return -1;
-		}
-	}
-
-	error = corosync_cfg_kill_node(cman_inst->cfg_handle, nodeid, "Killed by cman_tool");
-
-	return error;
-}
-
-int cman_set_votes(cman_handle_t handle, int votes, int nodeid)
-{
-	struct cman_inst *cman_inst;
-	int error;
-
-	cman_inst = (struct cman_inst *)handle;
-	VALIDATE_HANDLE(cman_inst);
-
-	if (!cmanquorum_check_and_start(cman_inst))
-		return -1;
-
-	error = cmanquorum_setvotes(cman_inst->cmq_handle, nodeid, votes);
-
-	return error;
-}
-
-int cman_set_expected_votes(cman_handle_t handle, int expected)
-{
-	struct cman_inst *cman_inst;
-	int error;
-
-	cman_inst = (struct cman_inst *)handle;
-	VALIDATE_HANDLE(cman_inst);
-
-	if (!cmanquorum_check_and_start(cman_inst))
-		return -1;
-
-	error = cmanquorum_setexpected(cman_inst->cmq_handle, expected);
-
-	return error;
-}
-
-int cman_get_fd (
-	cman_handle_t handle)
-{
-	struct cman_inst *cman_inst;
-	int fd;
-	int error;
-
-	cman_inst = (struct cman_inst *)handle;
-	VALIDATE_HANDLE(cman_inst);
-
-	fd = cman_inst->dispatch_fd;
-
-	return fd;
-}
-
-int cman_getprivdata(
-	cman_handle_t handle,
-	void **context)
-{
-	cs_error_t error;
-	struct cman_inst *cman_inst;
-
-	cman_inst = (struct cman_inst *)handle;
-	VALIDATE_HANDLE(cman_inst);
-
-	*context = cman_inst->privdata;
-
-	return (CS_OK);
-}
-
-int cman_setprivdata(
-	cman_handle_t handle,
-	void *context)
-{
-	cs_error_t error;
-	struct cman_inst *cman_inst;
-
-	cman_inst = (struct cman_inst *)handle;
-	VALIDATE_HANDLE(cman_inst);
-
-	cman_inst->privdata = context;
-
-	return (CS_OK);
-}
-
-
-int cman_register_quorum_device(cman_handle_t handle, char *name, int votes)
-{
-	struct cman_inst *cman_inst;
-	int error;
-
-	cman_inst = (struct cman_inst *)handle;
-	VALIDATE_HANDLE(cman_inst);
-
-	if (!cmanquorum_check_and_start(cman_inst))
-		return -1;
-
-	error = cmanquorum_qdisk_register(cman_inst->cmq_handle, name, votes);
-
-	return error;
-}
-
-int cman_unregister_quorum_device(cman_handle_t handle)
-{
-	struct cman_inst *cman_inst;
-	int error;
-
-	cman_inst = (struct cman_inst *)handle;
-	VALIDATE_HANDLE(cman_inst);
-
-	if (!cmanquorum_check_and_start(cman_inst))
-		return -1;
-
-	error = cmanquorum_qdisk_unregister(cman_inst->cmq_handle);
-
-	return error;
-}
-int cman_poll_quorum_device(cman_handle_t handle, int isavailable)
-{
-	struct cman_inst *cman_inst;
-	int error;
-
-	cman_inst = (struct cman_inst *)handle;
-	VALIDATE_HANDLE(cman_inst);
-
-	if (!cmanquorum_check_and_start(cman_inst))
-		return -1;
-
-	error = cmanquorum_qdisk_poll(cman_inst->cmq_handle, 1);
-
-	return error;
-}
-
-int cman_get_quorum_device(cman_handle_t handle, struct cman_qdev_info *info)
-{
-	struct cman_inst *cman_inst;
-	int error;
-	struct cmanquorum_qdisk_info qinfo;
-
-	cman_inst = (struct cman_inst *)handle;
-	VALIDATE_HANDLE(cman_inst);
-
-	if (!cmanquorum_check_and_start(cman_inst))
-		return -1;
-
-	error = cmanquorum_qdisk_getinfo(cman_inst->cmq_handle, &qinfo);
-
-	if (!error) {
-		info->qi_state = qinfo.state;
-		info->qi_votes = qinfo.votes;
-		strcpy(info->qi_name, qinfo.name);
-	}
-
-	return error;
-}
-
-int cman_set_dirty(cman_handle_t handle)
-{
-	struct cman_inst *cman_inst;
-	int error;
-
-	cman_inst = (struct cman_inst *)handle;
-	VALIDATE_HANDLE(cman_inst);
-
-	if (!cmanquorum_check_and_start(cman_inst))
-		return -1;
-
-	error = cmanquorum_setdirty(cman_inst->cmq_handle);
-
-	return error;
-}
-
-
-struct res_overlay {
-	mar_res_header_t header __attribute__((aligned(8)));
-	char data[512000];
-};
-
-
-int cman_dispatch (
-	cman_handle_t handle,
-	int dispatch_types)
-{
-	struct pollfd ufds;
-	int timeout = -1;
-	cs_error_t error;
-	int cont = 1; /* always continue do loop except when set to 0 */
-	int dispatch_avail;
-	struct cman_inst *cman_inst;
-	struct res_overlay dispatch_data;
-	struct res_lib_cman_sendmsg *res_lib_cman_sendmsg;
-
-	if (dispatch_types != CS_DISPATCH_ONE &&
-		dispatch_types != CS_DISPATCH_ALL &&
-		dispatch_types != CS_DISPATCH_BLOCKING) {
-
-		return (CS_ERR_INVALID_PARAM);
-	}
-
-	cman_inst = (struct cman_inst *)handle;
-	VALIDATE_HANDLE(cman_inst);
-
-	/*
-	 * Timeout instantly for SA_DISPATCH_ONE or CS_DISPATCH_ALL and
-	 * wait indefinately for CS_DISPATCH_BLOCKING
-	 */
-	if (dispatch_types == CS_DISPATCH_ALL) {
-		timeout = 0;
-	}
-
-	do {
-		ufds.fd = cman_inst->dispatch_fd;
-		ufds.events = POLLIN;
-		ufds.revents = 0;
-
-		pthread_mutex_lock (&cman_inst->dispatch_mutex);
-
-		error = saPollRetry (&ufds, 1, timeout);
-		if (error != CS_OK) {
-			goto error_unlock;
-		}
-
-		/*
-		 * Handle has been finalized in another thread
-		 */
-		if (cman_inst->finalize == 1) {
-			error = CS_OK;
-			goto error_unlock;
-		}
-
-		if ((ufds.revents & (POLLERR|POLLHUP|POLLNVAL)) != 0) {
-			error = CS_ERR_BAD_HANDLE;
-			goto error_unlock;
-		}
-
-		dispatch_avail = ufds.revents & POLLIN;
-		if (dispatch_avail == 0 && dispatch_types == CS_DISPATCH_ALL) {
-			pthread_mutex_unlock (&cman_inst->dispatch_mutex);
-			break; /* exit do while cont is 1 loop */
-		} else
-		if (dispatch_avail == 0) {
-			pthread_mutex_unlock (&cman_inst->dispatch_mutex);
-			continue; /* next poll */
-		}
-
-		if (ufds.revents & POLLIN) {
-			error = saRecvRetry (cman_inst->dispatch_fd, &dispatch_data.header,
-				sizeof (mar_res_header_t));
-			if (error != CS_OK) {
-				goto error_unlock;
-			}
-			if (dispatch_data.header.size > sizeof (mar_res_header_t)) {
-				error = saRecvRetry (cman_inst->dispatch_fd, &dispatch_data.data,
-					dispatch_data.header.size - sizeof (mar_res_header_t));
-				if (error != CS_OK) {
-					goto error_unlock;
-				}
-			}
-		} else {
-			pthread_mutex_unlock (&cman_inst->dispatch_mutex);
-			continue;
-		}
-
-		/*
-		 * Make copy of callbacks, message data, unlock instance, and call callback
-		 * A risk of this dispatch method is that the callback routines may
-		 * operate at the same time that cman_finalize has been called in another thread.
-		 */
-		pthread_mutex_unlock (&cman_inst->dispatch_mutex);
-
-		/*
-		 * Dispatch incoming message
-		 */
-		switch (dispatch_data.header.id) {
-
-		case MESSAGE_RES_CMAN_SENDMSG:
-			if (cman_inst->data_callback == NULL) {
-				continue;
-			}
-			res_lib_cman_sendmsg = (struct res_lib_cman_sendmsg *)&dispatch_data;
-
-			cman_inst->data_callback ( handle,
-						   cman_inst->privdata,
-						   res_lib_cman_sendmsg->message,
-						   res_lib_cman_sendmsg->msglen,
-						   res_lib_cman_sendmsg->from_port,
-						   res_lib_cman_sendmsg->from_node);
-			break;
-
-		default:
-			error = CS_ERR_LIBRARY;
-			goto error_put;
-			break;
-		}
-
-		/*
-		 * Determine if more messages should be processed
-		 * */
-		switch (dispatch_types) {
-		case CS_DISPATCH_ONE:
-			cont = 0;
-			break;
-		case CS_DISPATCH_ALL:
-			break;
-		case CS_DISPATCH_BLOCKING:
-			break;
-		}
-	} while (cont);
-
-	goto error_put;
-
-error_unlock:
-	pthread_mutex_unlock (&cman_inst->dispatch_mutex);
-
-error_put:
-	return (error);
-}
-
-
-int cman_get_node_count(cman_handle_t handle)
-{
-	struct cman_inst *cman_inst;
-	int error;
-
-	cman_inst = (struct cman_inst *)handle;
-	VALIDATE_HANDLE(cman_inst);
-
-	if (!cmanquorum_check_and_start(cman_inst))
-		return -1;
-
-	cmanquorum_trackstart(cman_inst->cmq_handle, CS_TRACK_CURRENT);
-
-	return error;
-}
-
-int cman_get_nodes(cman_handle_t handle, int maxnodes, int *retnodes, cman_node_t *nodes)
-{}
-int cman_get_disallowed_nodes(cman_handle_t handle, int maxnodes, int *retnodes, cman_node_t *nodes)
-{}
-int cman_get_node(cman_handle_t handle, int nodeid, cman_node_t *node)
-{}
diff --git a/cman/services/cman/services/Makefile b/cman/services/cman/services/Makefile
deleted file mode 100644
index ad96c88..0000000
--- a/cman/services/cman/services/Makefile
+++ /dev/null
@@ -1,26 +0,0 @@
-TARGET= service_cmanbits.lcrso
-
-LCRSOT=$(TARGET)
-
-all: ${TARGET} 
-
-include ../../../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-CFLAGS += -fPIC
-CFLAGS += -I${openaisincdir} -I${corosyncincdir}
-CFLAGS += -I${incdir}
-CFLAGS += -I ../include
-
-LDFLAGS += -L${libdir}
-
-${TARGET}: cman.o
-	$(CC) -shared -Wl,-soname,$@ -o $@ $^ $(LDFLAGS)
-
-clean: generalclean 
-
--include $(OBJS1:.o=.d)
--include $(OBJS2:.o=.d)
diff --git a/cman/services/cman/services/cman.c b/cman/services/cman/services/cman.c
deleted file mode 100644
index 8083ace..0000000
--- a/cman/services/cman/services/cman.c
+++ /dev/null
@@ -1,571 +0,0 @@
-#ifndef COROSYNC_BSD
-#include <alloca.h>
-#endif
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#include <netinet/in.h>
-#include <sys/uio.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include <signal.h>
-#include <time.h>
-#include <unistd.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include <corosync/corotypes.h>
-#include <corosync/cfg.h>
-#include <corosync/list.h>
-#include <corosync/lcr/lcr_comp.h>
-#include <corosync/engine/logsys.h>
-#include <corosync/ipc_gen.h>
-#include <corosync/engine/coroapi.h>
-#include <corosync/ipc_cman.h>
-#include <corosync/cman.h>
-
-#define CMAN_MAJOR_VERSION 6
-#define CMAN_MINOR_VERSION 3
-#define CMAN_PATCH_VERSION 0
-
-LOGSYS_DECLARE_SUBSYS ("CMAN", LOG_INFO);
-
-/* Messages we send on port 0 */
-#define CLUSTER_MSG_PORTOPENED   2
-#define CLUSTER_MSG_PORTCLOSED   3
-#define CLUSTER_MSG_PORTENQ      9
-#define CLUSTER_MSG_PORTSTATUS  10
-
-/* This structure is tacked onto the start of a cluster message packet for our
- * own nefarious purposes. */
-struct cman_protheader {
-	unsigned char  tgtport; /* Target port number */
-	unsigned char  srcport; /* Source (originating) port number */
-	unsigned short pad;
-	unsigned int   flags;
-	int            srcid;	/* Node ID of the sender */
-	int            tgtid;	/* Node ID of the target */
-};
-
-static cs_tpg_handle group_handle;
-static struct corosync_tpg_group cman_group[1] = {
-        { .group          = "CMAN", .group_len      = 4},
-};
-
-struct cman_pd {
-	void *conn;
-	unsigned char port; /* Bound port number */
-	struct list_head list;
-};
-
-struct cluster_node {
-	int nodeid;
-#define NODE_FLAG_PORTS_VALID 1
-	int flags;
-#define PORT_BITS_SIZE 32
- 	unsigned char port_bits[PORT_BITS_SIZE]; /* bitmap of ports open on this node */
-	struct list_head list;
-};
-
-/* An array of open 'ports' containing the connection to send
-   responses to */
-static void *ports[256];
-static struct cluster_node our_node;
-static struct corosync_api_v1 *corosync_api;
-static struct list_head conn_list;
-static struct list_head node_list;
-
-#define list_iterate(v, head) \
-        for (v = (head)->next; v != head; v = v->next)
-
-
-/*
- * Service Interfaces required by service_message_handler struct
- */
-
-static void cman_deliver_fn(unsigned int nodeid, struct iovec *iovec, int iov_len,
-			      int endian_conversion_required);
-
-static void cman_confchg_fn(enum totem_configuration_type configuration_type,
-			    unsigned int *member_list, int member_list_entries,
-			    unsigned int *left_list, int left_list_entries,
-			    unsigned int *joined_list, int joined_list_entries,
-			    struct memb_ring_id *ring_id);
-
-static int cman_exec_init_fn (struct corosync_api_v1 *corosync_api);
-
-static int cman_lib_init_fn (void *conn);
-
-static int cman_lib_exit_fn (void *conn);
-
-static void message_handler_req_lib_cman_is_listening (void *conn, void *msg);
-static void message_handler_req_lib_cman_sendmsg (void *conn, void *msg);
-static void message_handler_req_lib_cman_unbind (void *conn, void *msg);
-static void message_handler_req_lib_cman_bind (void *conn, void *msg);
-
-
-/*
- * Library Handler Definition
- */
-static struct corosync_lib_handler cman_lib_service[] =
-{
-	{ /* 0 */
-		.lib_handler_fn				= message_handler_req_lib_cman_sendmsg,
-		.response_size				= sizeof (mar_res_header_t),
-		.response_id				= MESSAGE_RES_CMAN_SENDMSG,
-		.flow_control				= COROSYNC_LIB_FLOW_CONTROL_REQUIRED
-	},
-	{ /* 1 */
-		.lib_handler_fn				= message_handler_req_lib_cman_is_listening,
-		.response_size				= sizeof (struct res_lib_cman_is_listening),
-		.response_id				= MESSAGE_RES_CMAN_IS_LISTENING,
-		.flow_control				= COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
-	},
-	{ /* 2 */
-		.lib_handler_fn				= message_handler_req_lib_cman_bind,
-		.response_size				= sizeof (mar_res_header_t),
-		.response_id				= MESSAGE_RES_CMAN_BIND,
-		.flow_control				= COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
-	},
-
-	{ /* 3 */
-		.lib_handler_fn				= message_handler_req_lib_cman_unbind,
-		.response_size				= sizeof (mar_res_header_t),
-		.response_id				= MESSAGE_RES_CMAN_UNBIND,
-		.flow_control				= COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
-	}
-};
-
-static struct corosync_service_engine cman_service_handler = {
-	.name				        = "corosync cluster cman service v3.01",
-	.id					= CMAN_SERVICE,
-	.private_data_size			= sizeof (struct cman_pd),
-	.allow_inquorate			= CS_LIB_ALLOW_INQUORATE,
-	.flow_control				= COROSYNC_LIB_FLOW_CONTROL_REQUIRED,
-	.lib_init_fn				= cman_lib_init_fn,
-	.lib_exit_fn				= cman_lib_exit_fn,
-	.lib_engine				= cman_lib_service,
-	.lib_engine_count			= sizeof (cman_lib_service) / sizeof (struct corosync_lib_handler),
-	.exec_init_fn				= cman_exec_init_fn,
-	.exec_engine				= NULL,
-	.exec_engine_count		        = 0,
-};
-
-/*
- * Dynamic loader definition
- */
-static struct corosync_service_engine *cman_get_service_handler_ver0 (void);
-
-static struct corosync_service_engine_iface_ver0 cman_service_handler_iface = {
-	.corosync_get_service_engine_ver0 = cman_get_service_handler_ver0
-};
-
-static struct lcr_iface corosync_cman_ver0[1] = {
-	{
-		.name				= "corosync_cman",
-		.version			= 0,
-		.versions_replace		= 0,
-		.versions_replace_count         = 0,
-		.dependencies			= 0,
-		.dependency_count		= 0,
-		.constructor			= NULL,
-		.destructor			= NULL,
-		.interfaces			= NULL
-	}
-};
-
-static struct lcr_comp cman_comp_ver0 = {
-	.iface_count			= 1,
-	.ifaces			        = corosync_cman_ver0
-};
-
-
-static struct corosync_service_engine *cman_get_service_handler_ver0 (void)
-{
-	return (&cman_service_handler);
-}
-
-__attribute__ ((constructor)) static void cman_comp_register (void) {
-        lcr_interfaces_set (&corosync_cman_ver0[0], &cman_service_handler_iface);
-
-	lcr_component_register (&cman_comp_ver0);
-}
-
-
-
-/* These just make the access a little neater */
-static inline int objdb_get_string(struct corosync_api_v1 *corosync, unsigned int object_service_handle,
-				   char *key, char **value)
-{
-	int res;
-
-	*value = NULL;
-	if ( !(res = corosync->object_key_get(object_service_handle,
-					      key,
-					      strlen(key),
-					      (void *)value,
-					      NULL))) {
-		if (*value)
-			return 0;
-	}
-	return -1;
-}
-
-static inline void objdb_get_int(struct corosync_api_v1 *corosync, unsigned int object_service_handle,
-				 char *key, unsigned int *intvalue, unsigned int default_value)
-{
-	char *value = NULL;
-
-	*intvalue = default_value;
-
-	if (!corosync->object_key_get(object_service_handle, key, strlen(key),
-				 (void *)&value, NULL)) {
-		if (value) {
-			*intvalue = atoi(value);
-		}
-	}
-}
-
-static void set_port_bit(struct cluster_node *node, uint8_t port)
-{
-	int byte;
-	int bit;
-
-	byte = port/8;
-	bit  = port%8;
-
-	node->port_bits[byte] |= 1<<bit;
-}
-
-static void clear_port_bit(struct cluster_node *node, uint8_t port)
-{
-	int byte;
-	int bit;
-
-	byte = port/8;
-	bit  = port%8;
-
-	node->port_bits[byte] &= ~(1<<bit);
-}
-
-static int get_port_bit(struct cluster_node *node, uint8_t port)
-{
-	int byte;
-	int bit;
-
-	byte = port/8;
-	bit  = port%8;
-
-	return ((node->port_bits[byte] & (1<<bit)) != 0);
-}
-
-static struct cluster_node *find_node(int nodeid, int allocate)
-{
-	struct list_head *tmp;
-	struct cluster_node *node;
-
-	list_iterate(tmp, &node_list) {
-		node = list_entry(tmp, struct cluster_node, list);
-		if (node->nodeid == nodeid)
-			return node;
-	}
-	if (allocate) {
-		node = malloc(sizeof(struct cluster_node));
-		if (node) {
-			memset(node, 0, sizeof(*node));
-			node->nodeid = nodeid;
-			list_add(&node->list, &node_list);
-		}
-	}
-	else {
-		node = NULL;
-	}
-
-	return node;
-}
-
-
-static int cman_send_message(int fromport, int toport, int tonode, void *message, int len)
-{
-	struct iovec iov[2];
-	struct cman_protheader header;
-
-	header.tgtport = toport;
-	header.srcport = fromport;
-	header.flags   = 0;
-	header.srcid   = our_node.nodeid;
-	header.tgtid   = tonode;
-
-	iov[0].iov_base = &header;
-	iov[0].iov_len  = sizeof(header);
-	iov[1].iov_base = message;
-	iov[1].iov_len  = len;
-
-	return corosync_api->tpg_joined_mcast(group_handle, iov, 2, TOTEM_AGREED);
-}
-
-static int cman_exec_init_fn (struct corosync_api_v1 *api)
-{
-//	unsigned int object_handle;
-	unsigned int find_handle;
-
-	log_printf(LOG_LEVEL_NOTICE, "cman_exec_init_fn \n");
-
-	corosync_api = api;
-
-	memset(ports, 0, sizeof(ports));
-	memset(&our_node, 0, sizeof(our_node));
-	list_init(&conn_list);
-	list_init(&node_list);
-
-	our_node.nodeid = corosync_api->totem_nodeid_get();
-	list_add(&our_node.list, &node_list);
-	set_port_bit(&our_node, 1);
-	our_node.flags |= NODE_FLAG_PORTS_VALID;
-
-	/* Get configuration variables */
-	corosync_api->object_find_create(OBJECT_PARENT_HANDLE, "cman", strlen("cman"), &find_handle);
-	// TODO ??
-	corosync_api->object_find_destroy(find_handle);
-
-	api->tpg_init(&group_handle, cman_deliver_fn, cman_confchg_fn);
-	api->tpg_join(group_handle, cman_group, 1);
-	return (0);
-}
-
-static int cman_lib_init_fn (void *conn)
-{
-	struct cman_pd *cman_pd = (struct cman_pd *)corosync_api->ipc_private_data_get (conn);
-
-	list_add(&cman_pd->list, &conn_list);
-	return 0;
-}
-
-static int cman_lib_exit_fn (void *conn)
-{
-	struct cman_pd *cman_pd = (struct cman_pd *)corosync_api->ipc_private_data_get (conn);
-
-	if (cman_pd->port) {
-		char portmsg[2];
-
-		ports[cman_pd->port] = NULL;
-
-		/* Tell the cluster */
-		portmsg[0] = CLUSTER_MSG_PORTCLOSED;
-		portmsg[1] = cman_pd->port;
-		cman_send_message(0,0, 0, portmsg, 2);
-	}
-
-	list_del(&cman_pd->list);
-	return (0);
-}
-
-static void cman_confchg_fn(enum totem_configuration_type configuration_type,
-			    unsigned int *member_list, int member_list_entries,
-			    unsigned int *left_list, int left_list_entries,
-			    unsigned int *joined_list, int joined_list_entries,
-			    struct memb_ring_id *ring_id)
-{
-	int i;
-	struct cluster_node *node;
-
-	/* Clear out removed nodes */
-	for (i=0; i<left_list_entries; i++) {
-		node = find_node(left_list[i], 0);
-		if (node)
-			node->flags &= ~NODE_FLAG_PORTS_VALID;
-	}
-}
-
-
-static void cman_deliver_fn(unsigned int nodeid, struct iovec *iovec, int iov_len,
-			    int endian_conversion_required)
-{
-	struct cman_protheader *header = iovec->iov_base;
-	char *buf;
-
-	if (endian_conversion_required) {
-		header->srcid = swab32(header->srcid);
-		header->tgtid = swab32(header->tgtid);
-		header->flags = swab32(header->flags);
-	}
-
-	/* Messages to be sent to clients */
-	if (header->tgtport != 0 &&
-	    (header->tgtid == our_node.nodeid ||
-	     header->tgtid == 0)) {
-		buf = iovec->iov_base + sizeof(struct cman_protheader);
-
-		if (ports[header->tgtport]) {
-			corosync_api->ipc_conn_send_response(ports[header->tgtport], buf,  iovec->iov_len - sizeof(struct cman_protheader));
-		}
-	}
-
-	/* Our messages. Careful here, messages for the quorum module on port 0 also
-	   arrive here and must be ignored */
-	if (header->tgtport == 0 &&
-	    (header->tgtid == our_node.nodeid ||
-	     header->tgtid == 0)) {
-		struct cluster_node *node;
-
-		buf = iovec->iov_base + sizeof(struct cman_protheader);
-		node = find_node(header->tgtid, 1);
-
-		switch (*buf) {
-		case CLUSTER_MSG_PORTOPENED:
-			if (node) {
-				if (!(node->flags & NODE_FLAG_PORTS_VALID)) {
-					char reqmsg = CLUSTER_MSG_PORTENQ;
-					cman_send_message(0,0, nodeid, &reqmsg, 1);
-				}
-				set_port_bit(node, buf[2]);
-			}
-			break;
-		case CLUSTER_MSG_PORTCLOSED:
-			if (node) {
-				if (!(node->flags & NODE_FLAG_PORTS_VALID)) {
-					char reqmsg = CLUSTER_MSG_PORTENQ;
-					cman_send_message(0,0, nodeid, &reqmsg, 1);
-				}
-				clear_port_bit(node, buf[2]);
-			}
-			break;
-		case CLUSTER_MSG_PORTENQ:
-			if (node) {
-				char portresult[PORT_BITS_SIZE+1];
-
-				portresult[0] = CLUSTER_MSG_PORTSTATUS;
-				memcpy(portresult+1, our_node.port_bits, PORT_BITS_SIZE);
-				cman_send_message(0,0, 0, portresult, PORT_BITS_SIZE+1);
-			}
-			break;
-		case CLUSTER_MSG_PORTSTATUS:
-			if (node && node != &our_node) {
-				memcpy(node->port_bits, buf+1, PORT_BITS_SIZE);
-				node->flags |= NODE_FLAG_PORTS_VALID;
-			}
-			break;
-		}
-	}
-}
-
-static void message_handler_req_lib_cman_bind (void *conn, void *msg)
-{
-        mar_res_header_t res;
-	struct req_lib_cman_bind *req_lib_cman_bind = (struct req_lib_cman_bind *)msg;
-	struct cman_pd *cman_pd = (struct cman_pd *)corosync_api->ipc_private_data_get (conn);
-	int error = 0;
-	char portmsg[2];
-
-	if (req_lib_cman_bind->port  < 0 ||
-	    req_lib_cman_bind->port > 255)
-		error = EINVAL;
-
-	if (cman_pd->port || ports[req_lib_cman_bind->port]) {
-		error = EADDRINUSE;
-	}
-	if (error == CS_OK) {
-		cman_pd->port = req_lib_cman_bind->port;
-		ports[cman_pd->port] = corosync_api->ipc_conn_partner_get(conn);
-
-		/* Tell the cluster */
-		portmsg[0] = CLUSTER_MSG_PORTOPENED;
-		portmsg[1] = cman_pd->port;
-		cman_send_message(0,0, 0, portmsg, 2);
-	}
-
-	res.size = sizeof(res);
-	res.id = MESSAGE_RES_CMAN_BIND;
-	res.error = error;
-	corosync_api->ipc_conn_send_response(conn, &res, sizeof(res));
-}
-
-static void message_handler_req_lib_cman_unbind (void *conn, void *msg)
-{
-	mar_res_header_t res;
-	struct cman_pd *cman_pd = (struct cman_pd *)corosync_api->ipc_private_data_get (conn);
-	int error = 0;
-	char portmsg[2];
-
-	if (cman_pd->port) {
-		ports[cman_pd->port] = NULL;
-		cman_pd->port = 0;
-
-		/* Tell the cluster */
-		portmsg[0] = CLUSTER_MSG_PORTCLOSED;
-		portmsg[1] = cman_pd->port;
-		cman_send_message(0,0, 0, portmsg, 2);
-	}
-
-	res.size = sizeof(res);
-	res.id = MESSAGE_RES_CMAN_UNBIND;
-	res.error = error;
-	corosync_api->ipc_conn_send_response(conn, &res, sizeof(res));
-}
-
-static void message_handler_req_lib_cman_sendmsg (void *conn, void *msg)
-{
-	struct req_lib_cman_sendmsg *req_lib_cman_sendmsg = (struct req_lib_cman_sendmsg *)msg;
-	mar_res_header_t res;
-	struct cman_pd *cman_pd = (struct cman_pd *)corosync_api->ipc_private_data_get (conn);
-	int error = CS_OK;
-
-
-	if (!cman_pd->port) {
-		error = EINVAL;
-	}
-	else {
-		error = cman_send_message(cman_pd->port,
-					  req_lib_cman_sendmsg->to_port,
-					  req_lib_cman_sendmsg->to_node,
-					  req_lib_cman_sendmsg->message,
-					  req_lib_cman_sendmsg->msglen);
-	}
-
-	res.size = sizeof(res);
-	res.id = MESSAGE_RES_CMAN_SENDMSG;
-	res.error = error;
-	corosync_api->ipc_conn_send_response(conn, &res, sizeof(res));
-}
-
-static void message_handler_req_lib_cman_is_listening (void *conn, void *msg)
-{
-	struct req_lib_cman_is_listening *req_lib_cman_is_listening = (struct req_lib_cman_is_listening *)msg;
-	struct res_lib_cman_is_listening res_lib_cman_is_listening;;
-	int error = CS_OK;
-	struct cluster_node *node;
-
-// How I think this should work:
-//	There's a flag on the node that says whether we have complete port info or not.
-//	If we do, then we can just return it.
-//	If not then we do a port_enquire to get it (and return EBUSY).
-//	If we get a PORTOPEN or PORTCLOSE and we don't have complete info then request it,
-//	otherwise just update the record.
-//      Remember - this needs to be backwards compatible
-
-	node = find_node(req_lib_cman_is_listening->nodeid, 0);
-	if (!node)
-		error = ENOENT;
-	if (node && !(node->flags & NODE_FLAG_PORTS_VALID))
-		error = EBUSY;
-
-	if (error == EBUSY) {
-		char reqmsg = CLUSTER_MSG_PORTENQ;
-		cman_send_message(0,0, req_lib_cman_is_listening->nodeid, &reqmsg, 1);
-	}
-	else {
-		res_lib_cman_is_listening.status = get_port_bit(node, req_lib_cman_is_listening->port);
-		error = 0;
-	}
-
-	res_lib_cman_is_listening.header.size = sizeof(res_lib_cman_is_listening);
-	res_lib_cman_is_listening.header.id = MESSAGE_RES_CMAN_SENDMSG;
-	res_lib_cman_is_listening.header.error = error;
-	corosync_api->ipc_conn_send_response(conn, &res_lib_cman_is_listening, sizeof(res_lib_cman_is_listening));
-}
-
diff --git a/cman/services/quorum/Makefile b/cman/services/quorum/Makefile
deleted file mode 100644
index d65439f..0000000
--- a/cman/services/quorum/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../../../make/defines.mk
-include $(OBJDIR)/make/passthrough.mk
-
-SUBDIRS=services lib test
diff --git a/cman/services/quorum/include/corosync/cmanquorum.h b/cman/services/quorum/include/corosync/cmanquorum.h
deleted file mode 100644
index 98953dc..0000000
--- a/cman/services/quorum/include/corosync/cmanquorum.h
+++ /dev/null
@@ -1,170 +0,0 @@
-#ifndef COROSYNC_CMANQUORUM_H_DEFINED
-#define COROSYNC_CMANQUORUM_H_DEFINED
-
-typedef uint64_t cmanquorum_handle_t;
-
-
-#define CMANQUORUM_MAX_QDISK_NAME_LEN 255
-
-#define CMANQUORUM_INFO_FLAG_DIRTY      1
-#define CMANQUORUM_INFO_FLAG_DISALLOWED 2
-#define CMANQUORUM_INFO_FLAG_TWONODE    4
-#define CMANQUORUM_INFO_FLAG_QUORATE    8
-
-#define NODESTATE_JOINING    1
-#define NODESTATE_MEMBER     2
-#define NODESTATE_DEAD       3
-#define NODESTATE_LEAVING    4
-#define NODESTATE_DISALLOWED 5
-
-
-/** @} */
-
-struct cmanquorum_info {
-	int node_id;
-	unsigned int node_votes;
-	unsigned int node_expected_votes;
-	unsigned int highest_expected;
-	unsigned int total_votes;
-	unsigned int quorum;
-	unsigned int flags;
-};
-
-struct cmanquorum_qdisk_info {
-	int votes;
-	int state;
-	char name[CMANQUORUM_MAX_QDISK_NAME_LEN];
-};
-
-typedef struct {
-	uint32_t nodeid;
-	uint32_t state;
-} cmanquorum_node_t;
-
-
-typedef void (*cmanquorum_notification_fn_t) (
-	cmanquorum_handle_t handle,
-	uint32_t quorate,
-	uint32_t node_list_entries,
-	cmanquorum_node_t node_list[]
-	);
-
-typedef struct {
-	cmanquorum_notification_fn_t cmanquorum_notify_fn;
-} cmanquorum_callbacks_t;
-
-
-/*
- * Create a new quorum connection
- */
-cs_error_t cmanquorum_initialize (
-	cmanquorum_handle_t *handle,
-	cmanquorum_callbacks_t *callbacks);
-
-/*
- * Close the quorum handle
- */
-cs_error_t cmanquorum_finalize (
-	cmanquorum_handle_t handle);
-
-
-/*
- * Dispatch messages and configuration changes
- */
-cs_error_t cmanquorum_dispatch (
-	cmanquorum_handle_t handle,
-	cs_dispatch_flags_t dispatch_types);
-
-
-/*
- * Get quorum information.
- */
-cs_error_t cmanquorum_getinfo (
-	cmanquorum_handle_t handle,
-	int nodeid,
-	struct cmanquorum_info *info);
-
-/*
- * set expected_votes
- */
-cs_error_t cmanquorum_setexpected (
-	cmanquorum_handle_t handle,
-	unsigned int expected_votes);
-
-/*
- * set votes for a node
- */
-cs_error_t cmanquorum_setvotes (
-	cmanquorum_handle_t handle,
-	int nodeid,
-	unsigned int votes);
-
-/*
- * Register a quorum device
- * it will be DEAD until polled
- */
-cs_error_t cmanquorum_qdisk_register (
-	cmanquorum_handle_t handle,
-	char *name,
-	unsigned int votes);
-
-/*
- * Unregister a quorum device
- */
-cs_error_t cmanquorum_qdisk_unregister (
-	cmanquorum_handle_t handle);
-
-/*
- * Poll a quorum device
- */
-cs_error_t cmanquorum_qdisk_poll (
-	cmanquorum_handle_t handle,
-	int state);
-
-/*
- * Get quorum device information
- */
-cs_error_t cmanquorum_qdisk_getinfo (
-	cmanquorum_handle_t handle,
-	struct cmanquorum_qdisk_info *info);
-
-/*
- * Set the dirty bit for this node
- */
-cs_error_t cmanquorum_setdirty (
-	cmanquorum_handle_t handle);
-
-/*
- * Force a node to exit
- */
-cs_error_t cmanquorum_killnode (
-	cmanquorum_handle_t handle,
-	int nodeid,
-	unsigned int reason);
-
-/* Track node and quorum changes */
-cs_error_t cmanquorum_trackstart (
-	cmanquorum_handle_t handle,
-	unsigned int flags );
-
-cs_error_t cmanquorum_trackstop (
-	cmanquorum_handle_t handle);
-
-/*
- * Set our LEAVING flag. we should exit soon after this
- */
-cs_error_t cmanquorum_leaving (
-	cmanquorum_handle_t handle);
-
-/*
- * Save and retrieve private data/context
- */
-cs_error_t cmanquorum_context_get (
-	cmanquorum_handle_t handle,
-	void **context);
-
-cs_error_t cmanquorum_context_set (
-	cmanquorum_handle_t handle,
-	void *context);
-
-#endif /* COROSYNC_CMANQUORUM_H_DEFINED */
diff --git a/cman/services/quorum/include/corosync/ipc_cmanquorum.h b/cman/services/quorum/include/corosync/ipc_cmanquorum.h
deleted file mode 100644
index b86faac..0000000
--- a/cman/services/quorum/include/corosync/ipc_cmanquorum.h
+++ /dev/null
@@ -1,122 +0,0 @@
-#ifndef IPC_CMANQUORUM_H_DEFINED
-#define IPC_CMANQUORUM_H_DEFINED
-
-//#include <netinet/in.h>
-#include "corosync/corotypes.h"
-#include "corosync/ipc_gen.h"
-
-// ILLEGAL value!!
-#define CMANQUORUM_SERVICE 15
-
-#define CMANQUORUM_MAX_QDISK_NAME_LEN 255
-
-
-enum req_cmanquorum_types {
-	MESSAGE_REQ_CMANQUORUM_GETINFO = 0,
-	MESSAGE_REQ_CMANQUORUM_SETEXPECTED,
-	MESSAGE_REQ_CMANQUORUM_SETVOTES,
-	MESSAGE_REQ_CMANQUORUM_QDISK_REGISTER,
-	MESSAGE_REQ_CMANQUORUM_QDISK_UNREGISTER,
-	MESSAGE_REQ_CMANQUORUM_QDISK_POLL,
-	MESSAGE_REQ_CMANQUORUM_QDISK_GETINFO,
-	MESSAGE_REQ_CMANQUORUM_SETDIRTY,
-	MESSAGE_REQ_CMANQUORUM_KILLNODE,
-	MESSAGE_REQ_CMANQUORUM_LEAVING,
-	MESSAGE_REQ_CMANQUORUM_TRACKSTART,
-	MESSAGE_REQ_CMANQUORUM_TRACKSTOP
-};
-
-enum res_cmanquorum_types {
-	MESSAGE_RES_CMANQUORUM_STATUS = 0,
-	MESSAGE_RES_CMANQUORUM_GETINFO,
-	MESSAGE_RES_CMANQUORUM_QDISK_GETINFO,
-	MESSAGE_RES_CMANQUORUM_TRACKSTART,
-	MESSAGE_RES_CMANQUORUM_NOTIFICATION
-};
-
-struct req_lib_cmanquorum_setvotes {
-        mar_req_header_t header __attribute__((aligned(8)));
-	unsigned int votes;
-	int nodeid;
-};
-
-struct req_lib_cmanquorum_qdisk_register {
-        mar_req_header_t header __attribute__((aligned(8)));
-	int votes;
-	char name[CMANQUORUM_MAX_QDISK_NAME_LEN];
-};
-
-struct req_lib_cmanquorum_qdisk_poll {
-        mar_req_header_t header __attribute__((aligned(8)));
-	int state;
-};
-
-struct req_lib_cmanquorum_setexpected {
-        mar_req_header_t header __attribute__((aligned(8)));
-	int expected_votes;
-};
-
-struct req_lib_cmanquorum_trackstart {
-        mar_req_header_t header __attribute__((aligned(8)));
-	unsigned int track_flags;
-};
-
-struct req_lib_cmanquorum_general {
-        mar_req_header_t header __attribute__((aligned(8)));
-};
-
-#define CMANQUORUM_REASON_KILL_REJECTED    1
-#define CMANQUORUM_REASON_KILL_APPLICATION 2
-#define CMANQUORUM_REASON_KILL_REJOIN      3
-
-struct req_lib_cmanquorum_killnode {
-        mar_req_header_t header __attribute__((aligned(8)));
-	int nodeid;
-	unsigned int reason;
-};
-
-struct req_lib_cmanquorum_getinfo {
-        mar_req_header_t header __attribute__((aligned(8)));
-	int nodeid;
-};
-
-struct res_lib_cmanquorum_status {
-        mar_res_header_t header __attribute__((aligned(8)));
-};
-
-#define CMANQUORUM_INFO_FLAG_DIRTY      1
-#define CMANQUORUM_INFO_FLAG_DISALLOWED 2
-#define CMANQUORUM_INFO_FLAG_TWONODE    4
-#define CMANQUORUM_INFO_FLAG_QUORATE    8
-
-struct res_lib_cmanquorum_getinfo {
-        mar_res_header_t header __attribute__((aligned(8)));
-	int nodeid;
-	unsigned int votes;
-	unsigned int expected_votes;
-	unsigned int highest_expected;
-	unsigned int total_votes;
-	unsigned int quorum;
-	unsigned int flags;
-};
-
-struct res_lib_cmanquorum_qdisk_getinfo {
-        mar_res_header_t header __attribute__((aligned(8)));
-	int votes;
-	int state;
-	char name[CMANQUORUM_MAX_QDISK_NAME_LEN];
-};
-
-struct cmanquorum_node {
-	mar_uint32_t nodeid;
-	mar_uint32_t state;
-};
-
-struct res_lib_cmanquorum_notification {
-	mar_res_header_t header __attribute__((aligned(8)));
-	mar_uint32_t quorate __attribute__((aligned(8)));
-	mar_uint32_t node_list_entries __attribute__((aligned(8)));
-	struct cmanquorum_node node_list[] __attribute__((aligned(8)));
-};
-
-#endif
diff --git a/cman/services/quorum/lib/Makefile b/cman/services/quorum/lib/Makefile
deleted file mode 100644
index 0049b86..0000000
--- a/cman/services/quorum/lib/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-TARGET= libcmanquorum
-
-include ../../../../make/defines.mk
-include $(OBJDIR)/make/libs.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-CFLAGS += -fPIC
-CFLAGS += -I${incdir}
-CFLAGS += -I../include
diff --git a/cman/services/quorum/lib/libcmanquorum.c b/cman/services/quorum/lib/libcmanquorum.c
deleted file mode 100644
index 07f5413..0000000
--- a/cman/services/quorum/lib/libcmanquorum.c
+++ /dev/null
@@ -1,827 +0,0 @@
-/*
- * Provides a quorum API using the corosync executive
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <pthread.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <errno.h>
-
-#include <corosync/mar_gen.h>
-#include <corosync/ipc_gen.h>
-#include <corosync/ais_util.h>
-#include "corosync/cmanquorum.h"
-#include "corosync/ipc_cmanquorum.h"
-
-struct cmanquorum_inst {
-	int response_fd;
-	int dispatch_fd;
-	int finalize;
-	void *context;
-	cmanquorum_callbacks_t callbacks;
-	pthread_mutex_t response_mutex;
-	pthread_mutex_t dispatch_mutex;
-};
-
-static void cmanquorum_instance_destructor (void *instance);
-
-static struct saHandleDatabase cmanquorum_handle_t_db = {
-	.handleCount		        = 0,
-	.handles			= 0,
-	.mutex				= PTHREAD_MUTEX_INITIALIZER,
-	.handleInstanceDestructor	= cmanquorum_instance_destructor
-};
-
-/*
- * Clean up function for a quorum instance (cmanquorum_initialize) handle
- */
-static void cmanquorum_instance_destructor (void *instance)
-{
-	struct cmanquorum_inst *cmanquorum_inst = instance;
-
-	pthread_mutex_destroy (&cmanquorum_inst->response_mutex);
-}
-
-cs_error_t cmanquorum_initialize (
-	cmanquorum_handle_t *handle,
-	cmanquorum_callbacks_t *callbacks)
-{
-	cs_error_t error;
-	struct cmanquorum_inst *cmanquorum_inst;
-
-	error = saHandleCreate (&cmanquorum_handle_t_db, sizeof (struct cmanquorum_inst), handle);
-	if (error != CS_OK) {
-		goto error_no_destroy;
-	}
-
-	error = saHandleInstanceGet (&cmanquorum_handle_t_db, *handle, (void *)&cmanquorum_inst);
-	if (error != CS_OK) {
-		goto error_destroy;
-	}
-
-	error = saServiceConnect (&cmanquorum_inst->dispatch_fd,
-				  &cmanquorum_inst->response_fd,
-				  CMANQUORUM_SERVICE);
-	if (error != CS_OK) {
-		goto error_put_destroy;
-	}
-
-	pthread_mutex_init (&cmanquorum_inst->response_mutex, NULL);
-	pthread_mutex_init (&cmanquorum_inst->dispatch_mutex, NULL);
-	if (callbacks)
-		memcpy(&cmanquorum_inst->callbacks, callbacks, sizeof (callbacks));
-	else
-		memset(&cmanquorum_inst->callbacks, 0, sizeof (callbacks));
-
-	saHandleInstancePut (&cmanquorum_handle_t_db, *handle);
-
-	return (CS_OK);
-
-error_put_destroy:
-	saHandleInstancePut (&cmanquorum_handle_t_db, *handle);
-error_destroy:
-	saHandleDestroy (&cmanquorum_handle_t_db, *handle);
-error_no_destroy:
-	return (error);
-}
-
-cs_error_t cmanquorum_finalize (
-	cmanquorum_handle_t handle)
-{
-	struct cmanquorum_inst *cmanquorum_inst;
-	cs_error_t error;
-
-	error = saHandleInstanceGet (&cmanquorum_handle_t_db, handle, (void *)&cmanquorum_inst);
-	if (error != CS_OK) {
-		return (error);
-	}
-
-	pthread_mutex_lock (&cmanquorum_inst->response_mutex);
-
-	/*
-	 * Another thread has already started finalizing
-	 */
-	if (cmanquorum_inst->finalize) {
-		pthread_mutex_unlock (&cmanquorum_inst->response_mutex);
-		saHandleInstancePut (&cmanquorum_handle_t_db, handle);
-		return (CS_ERR_BAD_HANDLE);
-	}
-
-	cmanquorum_inst->finalize = 1;
-
-	pthread_mutex_unlock (&cmanquorum_inst->response_mutex);
-
-	saHandleDestroy (&cmanquorum_handle_t_db, handle);
-
-	/*
-	 * Disconnect from the server
-	 */
-	if (cmanquorum_inst->response_fd != -1) {
-		shutdown(cmanquorum_inst->response_fd, 0);
-		close(cmanquorum_inst->response_fd);
-	}
-	saHandleInstancePut (&cmanquorum_handle_t_db, handle);
-
-	return (CS_OK);
-}
-
-
-cs_error_t cmanquorum_getinfo (
-	cmanquorum_handle_t handle,
-	int nodeid,
-	struct cmanquorum_info *info)
-{
-	cs_error_t error;
-	struct cmanquorum_inst *cmanquorum_inst;
-	struct iovec iov[2];
-	struct req_lib_cmanquorum_getinfo req_lib_cmanquorum_getinfo;
-	struct res_lib_cmanquorum_getinfo res_lib_cmanquorum_getinfo;
-
-	error = saHandleInstanceGet (&cmanquorum_handle_t_db, handle, (void *)&cmanquorum_inst);
-	if (error != CS_OK) {
-		return (error);
-	}
-
-	pthread_mutex_lock (&cmanquorum_inst->response_mutex);
-
-	req_lib_cmanquorum_getinfo.header.size = sizeof (struct req_lib_cmanquorum_getinfo);
-	req_lib_cmanquorum_getinfo.header.id = MESSAGE_REQ_CMANQUORUM_GETINFO;
-	req_lib_cmanquorum_getinfo.nodeid = nodeid;
-
-	iov[0].iov_base = (char *)&req_lib_cmanquorum_getinfo;
-	iov[0].iov_len = sizeof (struct req_lib_cmanquorum_getinfo);
-
-	error = saSendMsgReceiveReply (cmanquorum_inst->response_fd, iov, 1,
-		&res_lib_cmanquorum_getinfo, sizeof (struct res_lib_cmanquorum_getinfo));
-
-	pthread_mutex_unlock (&cmanquorum_inst->response_mutex);
-
-	if (error != CS_OK) {
-		goto error_exit;
-	}
-
-	error = res_lib_cmanquorum_getinfo.header.error;
-
-	info->node_id = res_lib_cmanquorum_getinfo.nodeid;
-	info->node_votes = res_lib_cmanquorum_getinfo.votes;
-	info->node_expected_votes = res_lib_cmanquorum_getinfo.expected_votes;
-	info->highest_expected = res_lib_cmanquorum_getinfo.highest_expected;
-	info->total_votes = res_lib_cmanquorum_getinfo.total_votes;
-	info->quorum = res_lib_cmanquorum_getinfo.quorum;
-	info->flags = res_lib_cmanquorum_getinfo.flags;
-
-error_exit:
-	saHandleInstancePut (&cmanquorum_handle_t_db, handle);
-
-	return (error);
-}
-
-cs_error_t cmanquorum_setexpected (
-	cmanquorum_handle_t handle,
-	unsigned int expected_votes)
-{
-	cs_error_t error;
-	struct cmanquorum_inst *cmanquorum_inst;
-	struct iovec iov[2];
-	struct req_lib_cmanquorum_setexpected req_lib_cmanquorum_setexpected;
-	struct res_lib_cmanquorum_status res_lib_cmanquorum_status;
-
-	error = saHandleInstanceGet (&cmanquorum_handle_t_db, handle, (void *)&cmanquorum_inst);
-	if (error != CS_OK) {
-		return (error);
-	}
-
-	pthread_mutex_lock (&cmanquorum_inst->response_mutex);
-
-	req_lib_cmanquorum_setexpected.header.size = sizeof (struct req_lib_cmanquorum_setexpected);
-	req_lib_cmanquorum_setexpected.header.id = MESSAGE_REQ_CMANQUORUM_SETEXPECTED;
-	req_lib_cmanquorum_setexpected.expected_votes = expected_votes;
-
-	iov[0].iov_base = (char *)&req_lib_cmanquorum_setexpected;
-	iov[0].iov_len = sizeof (struct req_lib_cmanquorum_setexpected);
-
-	error = saSendMsgReceiveReply (cmanquorum_inst->response_fd, iov, 1,
-		&res_lib_cmanquorum_status, sizeof (struct res_lib_cmanquorum_status));
-
-	pthread_mutex_unlock (&cmanquorum_inst->response_mutex);
-
-	if (error != CS_OK) {
-		goto error_exit;
-	}
-
-	error = res_lib_cmanquorum_status.header.error;
-
-error_exit:
-	saHandleInstancePut (&cmanquorum_handle_t_db, handle);
-
-	return (error);
-}
-
-cs_error_t cmanquorum_setvotes (
-	cmanquorum_handle_t handle,
-	int nodeid,
-	unsigned int votes)
-{
-	cs_error_t error;
-	struct cmanquorum_inst *cmanquorum_inst;
-	struct iovec iov[2];
-	struct req_lib_cmanquorum_setvotes req_lib_cmanquorum_setvotes;
-	struct res_lib_cmanquorum_status res_lib_cmanquorum_status;
-
-	error = saHandleInstanceGet (&cmanquorum_handle_t_db, handle, (void *)&cmanquorum_inst);
-	if (error != CS_OK) {
-		return (error);
-	}
-
-	pthread_mutex_lock (&cmanquorum_inst->response_mutex);
-
-	req_lib_cmanquorum_setvotes.header.size = sizeof (struct req_lib_cmanquorum_setvotes);
-	req_lib_cmanquorum_setvotes.header.id = MESSAGE_REQ_CMANQUORUM_SETVOTES;
-	req_lib_cmanquorum_setvotes.nodeid = nodeid;
-	req_lib_cmanquorum_setvotes.votes = votes;
-
-	iov[0].iov_base = (char *)&req_lib_cmanquorum_setvotes;
-	iov[0].iov_len = sizeof (struct req_lib_cmanquorum_setvotes);
-
-	error = saSendMsgReceiveReply (cmanquorum_inst->response_fd, iov, 1,
-		&res_lib_cmanquorum_status, sizeof (struct res_lib_cmanquorum_status));
-
-	pthread_mutex_unlock (&cmanquorum_inst->response_mutex);
-
-	if (error != CS_OK) {
-		goto error_exit;
-	}
-
-	error = res_lib_cmanquorum_status.header.error;
-
-error_exit:
-	saHandleInstancePut (&cmanquorum_handle_t_db, handle);
-
-	return (error);
-}
-
-cs_error_t cmanquorum_qdisk_register (
-	cmanquorum_handle_t handle,
-	char *name,
-	unsigned int votes)
-{
-	cs_error_t error;
-	struct cmanquorum_inst *cmanquorum_inst;
-	struct iovec iov[2];
-	struct req_lib_cmanquorum_qdisk_register req_lib_cmanquorum_qdisk_register;
-	struct res_lib_cmanquorum_status res_lib_cmanquorum_status;
-
-	if (strlen(name) > CMANQUORUM_MAX_QDISK_NAME_LEN)
-		return CS_ERR_INVALID_PARAM;
-
-	error = saHandleInstanceGet (&cmanquorum_handle_t_db, handle, (void *)&cmanquorum_inst);
-	if (error != CS_OK) {
-		return (error);
-	}
-
-	pthread_mutex_lock (&cmanquorum_inst->response_mutex);
-
-	req_lib_cmanquorum_qdisk_register.header.size = sizeof (struct req_lib_cmanquorum_qdisk_register);
-	req_lib_cmanquorum_qdisk_register.header.id = MESSAGE_REQ_CMANQUORUM_QDISK_REGISTER;
-	strcpy(req_lib_cmanquorum_qdisk_register.name, name);
-	req_lib_cmanquorum_qdisk_register.votes = votes;
-
-	iov[0].iov_base = (char *)&req_lib_cmanquorum_qdisk_register;
-	iov[0].iov_len = sizeof (struct req_lib_cmanquorum_qdisk_register);
-
-	error = saSendMsgReceiveReply (cmanquorum_inst->response_fd, iov, 1,
-		&res_lib_cmanquorum_status, sizeof (struct res_lib_cmanquorum_status));
-
-	pthread_mutex_unlock (&cmanquorum_inst->response_mutex);
-
-	if (error != CS_OK) {
-		goto error_exit;
-	}
-
-	error = res_lib_cmanquorum_status.header.error;
-
-error_exit:
-	saHandleInstancePut (&cmanquorum_handle_t_db, handle);
-
-	return (error);
-}
-
-cs_error_t cmanquorum_qdisk_poll (
-	cmanquorum_handle_t handle,
-	int state)
-{
-	cs_error_t error;
-	struct cmanquorum_inst *cmanquorum_inst;
-	struct iovec iov[2];
-	struct req_lib_cmanquorum_qdisk_poll req_lib_cmanquorum_qdisk_poll;
-	struct res_lib_cmanquorum_status res_lib_cmanquorum_status;
-
-	error = saHandleInstanceGet (&cmanquorum_handle_t_db, handle, (void *)&cmanquorum_inst);
-	if (error != CS_OK) {
-		return (error);
-	}
-
-	pthread_mutex_lock (&cmanquorum_inst->response_mutex);
-
-	req_lib_cmanquorum_qdisk_poll.header.size = sizeof (struct req_lib_cmanquorum_qdisk_poll);
-	req_lib_cmanquorum_qdisk_poll.header.id = MESSAGE_REQ_CMANQUORUM_QDISK_POLL;
-	req_lib_cmanquorum_qdisk_poll.state = state;
-
-	iov[0].iov_base = (char *)&req_lib_cmanquorum_qdisk_poll;
-	iov[0].iov_len = sizeof (struct req_lib_cmanquorum_qdisk_poll);
-
-	error = saSendMsgReceiveReply (cmanquorum_inst->response_fd, iov, 1,
-		&res_lib_cmanquorum_status, sizeof (struct res_lib_cmanquorum_status));
-
-	pthread_mutex_unlock (&cmanquorum_inst->response_mutex);
-
-	if (error != CS_OK) {
-		goto error_exit;
-	}
-
-	error = res_lib_cmanquorum_status.header.error;
-
-error_exit:
-	saHandleInstancePut (&cmanquorum_handle_t_db, handle);
-
-	return (error);
-}
-
-cs_error_t cmanquorum_qdisk_unregister (
-	cmanquorum_handle_t handle)
-{
-	cs_error_t error;
-	struct cmanquorum_inst *cmanquorum_inst;
-	struct iovec iov[2];
-	struct req_lib_cmanquorum_general req_lib_cmanquorum_general;
-	struct res_lib_cmanquorum_status res_lib_cmanquorum_status;
-
-	error = saHandleInstanceGet (&cmanquorum_handle_t_db, handle, (void *)&cmanquorum_inst);
-	if (error != CS_OK) {
-		return (error);
-	}
-
-	pthread_mutex_lock (&cmanquorum_inst->response_mutex);
-
-	req_lib_cmanquorum_general.header.size = sizeof (struct req_lib_cmanquorum_general);
-	req_lib_cmanquorum_general.header.id = MESSAGE_REQ_CMANQUORUM_QDISK_UNREGISTER;
-
-	iov[0].iov_base = (char *)&req_lib_cmanquorum_general;
-	iov[0].iov_len = sizeof (struct req_lib_cmanquorum_general);
-
-	error = saSendMsgReceiveReply (cmanquorum_inst->response_fd, iov, 1,
-		&res_lib_cmanquorum_status, sizeof (struct res_lib_cmanquorum_status));
-
-	pthread_mutex_unlock (&cmanquorum_inst->response_mutex);
-
-	if (error != CS_OK) {
-		goto error_exit;
-	}
-
-	error = res_lib_cmanquorum_status.header.error;
-
-error_exit:
-	saHandleInstancePut (&cmanquorum_handle_t_db, handle);
-
-	return (error);
-}
-
-
-
-cs_error_t cmanquorum_qdisk_getinfo (
-	cmanquorum_handle_t handle,
-	struct cmanquorum_qdisk_info *qinfo)
-{
-	cs_error_t error;
-	struct cmanquorum_inst *cmanquorum_inst;
-	struct iovec iov[2];
-	struct req_lib_cmanquorum_general req_lib_cmanquorum_general;
-	struct res_lib_cmanquorum_qdisk_getinfo res_lib_cmanquorum_qdisk_getinfo;
-
-	error = saHandleInstanceGet (&cmanquorum_handle_t_db, handle, (void *)&cmanquorum_inst);
-	if (error != CS_OK) {
-		return (error);
-	}
-
-	pthread_mutex_lock (&cmanquorum_inst->response_mutex);
-
-	req_lib_cmanquorum_general.header.size = sizeof (struct req_lib_cmanquorum_general);
-	req_lib_cmanquorum_general.header.id = MESSAGE_REQ_CMANQUORUM_QDISK_GETINFO;
-
-	iov[0].iov_base = (char *)&req_lib_cmanquorum_general;
-	iov[0].iov_len = sizeof (struct req_lib_cmanquorum_general);
-
-	error = saSendMsgReceiveReply (cmanquorum_inst->response_fd, iov, 1,
-		&res_lib_cmanquorum_qdisk_getinfo, sizeof (struct res_lib_cmanquorum_qdisk_getinfo));
-
-	pthread_mutex_unlock (&cmanquorum_inst->response_mutex);
-
-	if (error != CS_OK) {
-		goto error_exit;
-	}
-
-	error = res_lib_cmanquorum_qdisk_getinfo.header.error;
-
-	qinfo->votes = res_lib_cmanquorum_qdisk_getinfo.votes;
-	qinfo->state = res_lib_cmanquorum_qdisk_getinfo.state;
-	strcpy(qinfo->name, res_lib_cmanquorum_qdisk_getinfo.name);
-
-
-error_exit:
-	saHandleInstancePut (&cmanquorum_handle_t_db, handle);
-
-	return (error);
-}
-
-cs_error_t cmanquorum_setdirty (
-	cmanquorum_handle_t handle)
-{
-	cs_error_t error;
-	struct cmanquorum_inst *cmanquorum_inst;
-	struct iovec iov[2];
-	struct req_lib_cmanquorum_general req_lib_cmanquorum_general;
-	struct res_lib_cmanquorum_status res_lib_cmanquorum_status;
-
-	error = saHandleInstanceGet (&cmanquorum_handle_t_db, handle, (void *)&cmanquorum_inst);
-	if (error != CS_OK) {
-		return (error);
-	}
-
-	pthread_mutex_lock (&cmanquorum_inst->response_mutex);
-
-	req_lib_cmanquorum_general.header.size = sizeof (struct req_lib_cmanquorum_general);
-	req_lib_cmanquorum_general.header.id = MESSAGE_REQ_CMANQUORUM_SETDIRTY;
-
-	iov[0].iov_base = (char *)&req_lib_cmanquorum_general;
-	iov[0].iov_len = sizeof (struct req_lib_cmanquorum_general);
-
-	error = saSendMsgReceiveReply (cmanquorum_inst->response_fd, iov, 1,
-		&res_lib_cmanquorum_status, sizeof (struct res_lib_cmanquorum_status));
-
-	pthread_mutex_unlock (&cmanquorum_inst->response_mutex);
-
-	if (error != CS_OK) {
-		goto error_exit;
-	}
-
-	error = res_lib_cmanquorum_status.header.error;
-
-error_exit:
-	saHandleInstancePut (&cmanquorum_handle_t_db, handle);
-
-	return (error);
-}
-
-cs_error_t cmanquorum_leaving (
-	cmanquorum_handle_t handle)
-{
-	cs_error_t error;
-	struct cmanquorum_inst *cmanquorum_inst;
-	struct iovec iov[2];
-	struct req_lib_cmanquorum_general req_lib_cmanquorum_general;
-	struct res_lib_cmanquorum_status res_lib_cmanquorum_status;
-
-	error = saHandleInstanceGet (&cmanquorum_handle_t_db, handle, (void *)&cmanquorum_inst);
-	if (error != CS_OK) {
-		return (error);
-	}
-
-	pthread_mutex_lock (&cmanquorum_inst->response_mutex);
-
-	req_lib_cmanquorum_general.header.size = sizeof (struct req_lib_cmanquorum_general);
-	req_lib_cmanquorum_general.header.id = MESSAGE_REQ_CMANQUORUM_LEAVING;
-
-	iov[0].iov_base = (char *)&req_lib_cmanquorum_general;
-	iov[0].iov_len = sizeof (struct req_lib_cmanquorum_general);
-
-	error = saSendMsgReceiveReply (cmanquorum_inst->response_fd, iov, 1,
-		&res_lib_cmanquorum_status, sizeof (struct res_lib_cmanquorum_status));
-
-	pthread_mutex_unlock (&cmanquorum_inst->response_mutex);
-
-	if (error != CS_OK) {
-		goto error_exit;
-	}
-
-	error = res_lib_cmanquorum_status.header.error;
-
-error_exit:
-	saHandleInstancePut (&cmanquorum_handle_t_db, handle);
-
-	return (error);
-}
-
-cs_error_t cmanquorum_killnode (
-	cmanquorum_handle_t handle,
-	int nodeid,
-	unsigned int reason)
-{
-	cs_error_t error;
-	struct cmanquorum_inst *cmanquorum_inst;
-	struct iovec iov[2];
-	struct req_lib_cmanquorum_killnode req_lib_cmanquorum_killnode;
-	struct res_lib_cmanquorum_status res_lib_cmanquorum_status;
-
-	error = saHandleInstanceGet (&cmanquorum_handle_t_db, handle, (void *)&cmanquorum_inst);
-	if (error != CS_OK) {
-		return (error);
-	}
-
-	pthread_mutex_lock (&cmanquorum_inst->response_mutex);
-
-	req_lib_cmanquorum_killnode.header.size = sizeof (struct req_lib_cmanquorum_killnode);
-	req_lib_cmanquorum_killnode.header.id = MESSAGE_REQ_CMANQUORUM_KILLNODE;
-	req_lib_cmanquorum_killnode.nodeid = nodeid;
-	req_lib_cmanquorum_killnode.reason = reason;
-
-	iov[0].iov_base = (char *)&req_lib_cmanquorum_killnode;
-	iov[0].iov_len = sizeof (struct req_lib_cmanquorum_killnode);
-
-	error = saSendMsgReceiveReply (cmanquorum_inst->response_fd, iov, 1,
-		&res_lib_cmanquorum_status, sizeof (struct res_lib_cmanquorum_status));
-
-	pthread_mutex_unlock (&cmanquorum_inst->response_mutex);
-
-	if (error != CS_OK) {
-		goto error_exit;
-	}
-
-	error = res_lib_cmanquorum_status.header.error;
-
-error_exit:
-	saHandleInstancePut (&cmanquorum_handle_t_db, handle);
-
-	return (error);
-}
-
-cs_error_t cmanquorum_trackstart (
-	cmanquorum_handle_t handle,
-	unsigned int flags )
-{
-	cs_error_t error;
-	struct cmanquorum_inst *cmanquorum_inst;
-	struct iovec iov[2];
-	struct req_lib_cmanquorum_trackstart req_lib_cmanquorum_trackstart;
-	struct res_lib_cmanquorum_status res_lib_cmanquorum_status;
-
-	error = saHandleInstanceGet (&cmanquorum_handle_t_db, handle, (void *)&cmanquorum_inst);
-	if (error != CS_OK) {
-		return (error);
-	}
-
-	pthread_mutex_lock (&cmanquorum_inst->response_mutex);
-
-	req_lib_cmanquorum_trackstart.header.size = sizeof (struct req_lib_cmanquorum_trackstart);
-	req_lib_cmanquorum_trackstart.header.id = MESSAGE_REQ_CMANQUORUM_TRACKSTART;
-	req_lib_cmanquorum_trackstart.track_flags = flags;
-
-	iov[0].iov_base = (char *)&req_lib_cmanquorum_trackstart;
-	iov[0].iov_len = sizeof (struct req_lib_cmanquorum_trackstart);
-
-	error = saSendMsgReceiveReply (cmanquorum_inst->response_fd, iov, 1,
-		&res_lib_cmanquorum_status, sizeof (struct res_lib_cmanquorum_status));
-
-	pthread_mutex_unlock (&cmanquorum_inst->response_mutex);
-
-	if (error != CS_OK) {
-		goto error_exit;
-	}
-
-	error = res_lib_cmanquorum_status.header.error;
-
-error_exit:
-	saHandleInstancePut (&cmanquorum_handle_t_db, handle);
-
-	return (error);
-}
-
-cs_error_t cmanquorum_trackstop (
-	cmanquorum_handle_t handle)
-{
-	cs_error_t error;
-	struct cmanquorum_inst *cmanquorum_inst;
-	struct iovec iov[2];
-	struct req_lib_cmanquorum_general req_lib_cmanquorum_general;
-	struct res_lib_cmanquorum_status res_lib_cmanquorum_status;
-
-	error = saHandleInstanceGet (&cmanquorum_handle_t_db, handle, (void *)&cmanquorum_inst);
-	if (error != CS_OK) {
-		return (error);
-	}
-
-	pthread_mutex_lock (&cmanquorum_inst->response_mutex);
-
-	req_lib_cmanquorum_general.header.size = sizeof (struct req_lib_cmanquorum_general);
-	req_lib_cmanquorum_general.header.id = MESSAGE_REQ_CMANQUORUM_TRACKSTOP;
-
-	iov[0].iov_base = (char *)&req_lib_cmanquorum_general;
-	iov[0].iov_len = sizeof (struct req_lib_cmanquorum_general);
-
-	error = saSendMsgReceiveReply (cmanquorum_inst->response_fd, iov, 1,
-		&res_lib_cmanquorum_status, sizeof (struct res_lib_cmanquorum_status));
-
-	pthread_mutex_unlock (&cmanquorum_inst->response_mutex);
-
-	if (error != CS_OK) {
-		goto error_exit;
-	}
-
-	error = res_lib_cmanquorum_status.header.error;
-
-error_exit:
-	saHandleInstancePut (&cmanquorum_handle_t_db, handle);
-
-	return (error);
-}
-
-
-cs_error_t cmanquorum_context_get (
-	cmanquorum_handle_t handle,
-	void **context)
-{
-	cs_error_t error;
-	struct cmanquorum_inst *cmanquorum_inst;
-
-	error = saHandleInstanceGet (&cmanquorum_handle_t_db, handle, (void *)&cmanquorum_inst);
-	if (error != CS_OK) {
-		return (error);
-	}
-
-	*context = cmanquorum_inst->context;
-
-	saHandleInstancePut (&cmanquorum_handle_t_db, handle);
-
-	return (CS_OK);
-}
-
-cs_error_t cmanquorum_context_set (
-	cmanquorum_handle_t handle,
-	void *context)
-{
-	cs_error_t error;
-	struct cmanquorum_inst *cmanquorum_inst;
-
-	error = saHandleInstanceGet (&cmanquorum_handle_t_db, handle, (void *)&cmanquorum_inst);
-	if (error != CS_OK) {
-		return (error);
-	}
-
-	cmanquorum_inst->context = context;
-
-	saHandleInstancePut (&cmanquorum_handle_t_db, handle);
-
-	return (CS_OK);
-}
-
-
-struct res_overlay {
-	mar_res_header_t header __attribute__((aligned(8)));
-	char data[512000];
-};
-
-cs_error_t cmanquorum_dispatch (
-	cmanquorum_handle_t handle,
-	cs_dispatch_flags_t dispatch_types)
-{
-	struct pollfd ufds;
-	int timeout = -1;
-	cs_error_t error;
-	int cont = 1; /* always continue do loop except when set to 0 */
-	int dispatch_avail;
-	struct cmanquorum_inst *cmanquorum_inst;
-	cmanquorum_callbacks_t callbacks;
-	struct res_overlay dispatch_data;
-	struct res_lib_cmanquorum_notification *res_lib_cmanquorum_notification;
-
-	if (dispatch_types != CS_DISPATCH_ONE &&
-		dispatch_types != CS_DISPATCH_ALL &&
-		dispatch_types != CS_DISPATCH_BLOCKING) {
-
-		return (CS_ERR_INVALID_PARAM);
-	}
-
-	error = saHandleInstanceGet (&cmanquorum_handle_t_db, handle,
-		(void *)&cmanquorum_inst);
-	if (error != CS_OK) {
-		return (error);
-	}
-
-	/*
-	 * Timeout instantly for CS_DISPATCH_ONE or CS_DISPATCH_ALL and
-	 * wait indefinately for CS_DISPATCH_BLOCKING
-	 */
-	if (dispatch_types == CS_DISPATCH_ALL) {
-		timeout = 0;
-	}
-
-	do {
-		ufds.fd = cmanquorum_inst->dispatch_fd;
-		ufds.events = POLLIN;
-		ufds.revents = 0;
-
-		pthread_mutex_lock (&cmanquorum_inst->dispatch_mutex);
-
-		error = saPollRetry (&ufds, 1, timeout);
-		if (error != CS_OK) {
-			goto error_unlock;
-		}
-
-		/*
-		 * Handle has been finalized in another thread
-		 */
-		if (cmanquorum_inst->finalize == 1) {
-			error = CS_OK;
-			goto error_unlock;
-		}
-
-		if ((ufds.revents & (POLLERR|POLLHUP|POLLNVAL)) != 0) {
-			error = CS_ERR_BAD_HANDLE;
-			goto error_unlock;
-		}
-
-		dispatch_avail = ufds.revents & POLLIN;
-		if (dispatch_avail == 0 && dispatch_types == CS_DISPATCH_ALL) {
-			pthread_mutex_unlock (&cmanquorum_inst->dispatch_mutex);
-			break; /* exit do while cont is 1 loop */
-		} else
-		if (dispatch_avail == 0) {
-			pthread_mutex_unlock (&cmanquorum_inst->dispatch_mutex);
-			continue; /* next poll */
-		}
-
-		if (ufds.revents & POLLIN) {
-			error = saRecvRetry (cmanquorum_inst->dispatch_fd, &dispatch_data.header,
-				sizeof (mar_res_header_t));
-			if (error != CS_OK) {
-				goto error_unlock;
-			}
-			if (dispatch_data.header.size > sizeof (mar_res_header_t)) {
-				error = saRecvRetry (cmanquorum_inst->dispatch_fd, &dispatch_data.data,
-					dispatch_data.header.size - sizeof (mar_res_header_t));
-				if (error != CS_OK) {
-					goto error_unlock;
-				}
-			}
-		} else {
-			pthread_mutex_unlock (&cmanquorum_inst->dispatch_mutex);
-			continue;
-		}
-
-		/*
-		 * Make copy of callbacks, message data, unlock instance, and call callback
-		 * A risk of this dispatch method is that the callback routines may
-		 * operate at the same time that cmanquorum_finalize has been called in another thread.
-		 */
-		memcpy (&callbacks, &cmanquorum_inst->callbacks, sizeof (cmanquorum_callbacks_t));
-		pthread_mutex_unlock (&cmanquorum_inst->dispatch_mutex);
-
-		/*
-		 * Dispatch incoming message
-		 */
-		switch (dispatch_data.header.id) {
-
-		case MESSAGE_RES_CMANQUORUM_NOTIFICATION:
-			if (callbacks.cmanquorum_notify_fn == NULL) {
-				continue;
-			}
-			res_lib_cmanquorum_notification = (struct res_lib_cmanquorum_notification *)&dispatch_data;
-
-			callbacks.cmanquorum_notify_fn ( handle,
-						     res_lib_cmanquorum_notification->quorate,
-						     res_lib_cmanquorum_notification->node_list_entries,
-						     (cmanquorum_node_t *)res_lib_cmanquorum_notification->node_list );
-				;
-			break;
-
-		default:
-			error = CS_ERR_LIBRARY;
-			goto error_put;
-			break;
-		}
-
-		/*
-		 * Determine if more messages should be processed
-		 * */
-		switch (dispatch_types) {
-		case CS_DISPATCH_ONE:
-			cont = 0;
-			break;
-		case CS_DISPATCH_ALL:
-			break;
-		case CS_DISPATCH_BLOCKING:
-			break;
-		}
-	} while (cont);
-
-	goto error_put;
-
-error_unlock:
-	pthread_mutex_unlock (&cmanquorum_inst->dispatch_mutex);
-
-error_put:
-	saHandleInstancePut (&cmanquorum_handle_t_db, handle);
-	return (error);
-}
diff --git a/cman/services/quorum/services/Makefile b/cman/services/quorum/services/Makefile
deleted file mode 100644
index 92e5445..0000000
--- a/cman/services/quorum/services/Makefile
+++ /dev/null
@@ -1,26 +0,0 @@
-TARGET= service_cmanquorum.lcrso
-
-LCRSOT=$(TARGET)
-
-all: ${TARGET} 
-
-include ../../../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-CFLAGS += -fPIC
-CFLAGS += -I${openaisincdir} -I${corosyncincdir}
-CFLAGS += -I${incdir}
-CFLAGS += -I ../include
-
-LDFLAGS += -L${libdir}
-
-${TARGET}: cmanquorum.o
-	$(CC) -shared -Wl,-soname,$@ -o $@ $^ $(LDFLAGS)
-
-clean: generalclean 
-
--include $(OBJS1:.o=.d)
--include $(OBJS2:.o=.d)
diff --git a/cman/services/quorum/services/cmanquorum.c b/cman/services/quorum/services/cmanquorum.c
deleted file mode 100644
index 4a58f6b..0000000
--- a/cman/services/quorum/services/cmanquorum.c
+++ /dev/null
@@ -1,1488 +0,0 @@
-#include <sys/types.h>
-#ifndef COROSYNC_BSD
-#include <alloca.h>
-#endif
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#include <netinet/in.h>
-#include <sys/uio.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-#include <signal.h>
-#include <time.h>
-#include <unistd.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#include <corosync/corotypes.h>
-#include <corosync/cfg.h>
-#include <corosync/list.h>
-#include <corosync/lcr/lcr_comp.h>
-#include <corosync/engine/logsys.h>
-#include <corosync/ipc_gen.h>
-#include <corosync/engine/coroapi.h>
-#include <corosync/engine/quorum.h>
-#include <corosync/ipc_cmanquorum.h>
-#include <corosync/list.h>
-
-#define CMANQUORUM_MAJOR_VERSION 6
-#define CMANQUORUM_MINOR_VERSION 3
-#define CMANQUORUM_PATCH_VERSION 0
-
- /* Silly default to prevent accidents! */
-#define DEFAULT_EXPECTED   1024
-#define DEFAULT_QDEV_POLL 10000
-
-LOGSYS_DECLARE_SUBSYS ("CMANQUORUM", LOG_INFO);
-
-enum quorum_message_req_types {
-	MESSAGE_REQ_EXEC_CMANQUORUM_NODEINFO  = 0,
-	MESSAGE_REQ_EXEC_CMANQUORUM_RECONFIGURE = 1,
-	MESSAGE_REQ_EXEC_CMANQUORUM_KILLNODE = 2,
-};
-
-#define NODE_FLAGS_BEENDOWN         1
-#define NODE_FLAGS_SEESDISALLOWED   8
-#define NODE_FLAGS_DIRTY           16
-#define NODE_FLAGS_QDISK           32
-#define NODE_FLAGS_REMOVED         64
-#define NODE_FLAGS_US             128
-
-
-typedef enum { NODESTATE_JOINING=1, NODESTATE_MEMBER,
-	       NODESTATE_DEAD, NODESTATE_LEAVING, NODESTATE_AISONLY } nodestate_t;
-
-
-/* This structure is tacked onto the start of a cluster message packet for our
- * own nefarious purposes. */
-struct q_protheader {
-	unsigned char  tgtport; /* Target port number */
-	unsigned char  srcport; /* Source (originating) port number */
-	unsigned short pad;
-	unsigned int   flags;
-	int            srcid;	/* Node ID of the sender */
-	int            tgtid;	/* Node ID of the target */
-} __attribute__((packed));
-
-struct cluster_node {
-	int flags;
-	int node_id;
-	unsigned int expected_votes;
-	unsigned int votes;
-	time_t join_time;
-
-	nodestate_t state;
-
-	struct timeval last_hello; /* Only used for quorum devices */
-
-	struct list_head list;
-};
-
-#define CMANQUORUM_FLAG_FEATURE_DISALLOWED 1
-
-static int quorum_flags;
-static int quorum;
-static int cluster_is_quorate;
-static int first_trans = 1;
-static unsigned int two_node;
-static unsigned int quorumdev_poll = DEFAULT_QDEV_POLL;
-
-static struct cluster_node *us;
-static struct cluster_node *quorum_device = NULL;
-static char quorum_device_name[CMANQUORUM_MAX_QDISK_NAME_LEN];
-static corosync_timer_handle_t quorum_device_timer;
-static struct list_head cluster_members_list;
-static struct corosync_api_v1 *corosync_api;
-static struct list_head trackers_list;
-static unsigned int cman_members[PROCESSOR_COUNT_MAX+1];
-static int cman_members_entries = 0;
-static struct memb_ring_id cman_ringid;
-
-#define max(a,b) (((a) > (b)) ? (a) : (b))
-static struct cluster_node *find_node_by_nodeid(int nodeid);
-static struct cluster_node *allocate_node(int nodeid);
-static char *kill_reason(int reason);
-
-static cs_tpg_handle group_handle;
-
-#define CMAN_COMPATIBILITY
-#ifdef CMAN_COMPATIBILITY
-static struct corosync_tpg_group quorum_group[1] = {
-        { .group          = "CMAN", .group_len      = 4},
-};
-static char clustername[16];
-static uint32_t cluster_id;
-static uint32_t config_version;
-#else
-static struct corosync_tpg_group quorum_group[1] = {
-        { .group          = "CMANQUORUM", .group_len      = 6},
-};
-#endif
-
-#define list_iterate(v, head) \
-        for (v = (head)->next; v != head; v = v->next)
-
-struct quorum_pd {
-	unsigned char track_flags;
-	int tracking_enabled;
-	struct list_head list;
-	void *conn;
-};
-
-/*
- * Service Interfaces required by service_message_handler struct
- */
-
-static void cmanquorum_init(struct corosync_api_v1 *api,
-			    quorum_set_quorate_fn_t report);
-
-static void quorum_confchg_fn (
-	enum totem_configuration_type configuration_type,
-	unsigned int *member_list, int member_list_entries,
-	unsigned int *left_list, int left_list_entries,
-	unsigned int *joined_list, int joined_list_entries,
-	struct memb_ring_id *ring_id);
-
-static void quorum_deliver_fn(unsigned int nodeid, struct iovec *iovec, int iov_len,
-			      int endian_conversion_required);
-
-static int cmanquorum_exec_init_fn (struct corosync_api_v1 *corosync_api);
-
-static int quorum_lib_init_fn (void *conn);
-
-static int quorum_lib_exit_fn (void *conn);
-
-static void message_handler_req_exec_quorum_nodeinfo (
-	void *message,
-	unsigned int nodeid);
-
-static void message_handler_req_exec_quorum_reconfigure (
-	void *message,
-	unsigned int nodeid);
-
-static void message_handler_req_exec_quorum_killnode (
-	void *message,
-	unsigned int nodeid);
-
-
-static void message_handler_req_lib_cmanquorum_getinfo (void *conn, void *message);
-
-static void message_handler_req_lib_cmanquorum_setexpected (void *conn, void *message);
-
-static void message_handler_req_lib_cmanquorum_setvotes (void *conn, void *message);
-
-static void message_handler_req_lib_cmanquorum_qdisk_register (void *conn, void *message);
-
-static void message_handler_req_lib_cmanquorum_qdisk_unregister (void *conn, void *message);
-
-static void message_handler_req_lib_cmanquorum_qdisk_poll (void *conn, void *message);
-
-static void message_handler_req_lib_cmanquorum_qdisk_getinfo (void *conn, void *message);
-
-static void message_handler_req_lib_cmanquorum_setdirty (void *conn, void *message);
-
-static void message_handler_req_lib_cmanquorum_killnode (void *conn, void *message);
-
-static void message_handler_req_lib_cmanquorum_leaving (void *conn, void *message);
-static void message_handler_req_lib_cmanquorum_trackstart (void *conn, void *msg);
-static void message_handler_req_lib_cmanquorum_trackstop (void *conn, void *msg);
-
-static int quorum_exec_send_nodeinfo(void);
-static int quorum_exec_send_reconfigure(int param, int nodeid, int value);
-static int quorum_exec_send_killnode(int nodeid, unsigned int reason);
-
-/*
- * Library Handler Definition
- */
-static struct corosync_lib_handler quorum_lib_service[] =
-{
-	{ /* 0 */
-		.lib_handler_fn				= message_handler_req_lib_cmanquorum_getinfo,
-		.response_size				= sizeof (struct res_lib_cmanquorum_getinfo),
-		.response_id				= MESSAGE_RES_CMANQUORUM_GETINFO,
-		.flow_control				= COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
-	},
-	{ /* 1 */
-		.lib_handler_fn				= message_handler_req_lib_cmanquorum_setexpected,
-		.response_size				= sizeof (struct res_lib_cmanquorum_status),
-		.response_id				= MESSAGE_RES_CMANQUORUM_STATUS,
-		.flow_control				= COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
-	},
-	{ /* 2 */
-		.lib_handler_fn				= message_handler_req_lib_cmanquorum_setvotes,
-		.response_size				= sizeof (struct res_lib_cmanquorum_status),
-		.response_id				= MESSAGE_RES_CMANQUORUM_STATUS,
-		.flow_control				= COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
-	},
-	{ /* 3 */
-		.lib_handler_fn				= message_handler_req_lib_cmanquorum_qdisk_register,
-		.response_size				= sizeof (struct res_lib_cmanquorum_status),
-		.response_id				= MESSAGE_RES_CMANQUORUM_STATUS,
-		.flow_control				= COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
-	},
-	{ /* 4 */
-		.lib_handler_fn				= message_handler_req_lib_cmanquorum_qdisk_unregister,
-		.response_size				= sizeof (struct res_lib_cmanquorum_status),
-		.response_id				= MESSAGE_RES_CMANQUORUM_STATUS,
-		.flow_control				= COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
-	},
-	{ /* 5 */
-		.lib_handler_fn				= message_handler_req_lib_cmanquorum_qdisk_poll,
-		.response_size				= sizeof (struct res_lib_cmanquorum_status),
-		.response_id				= MESSAGE_RES_CMANQUORUM_STATUS,
-		.flow_control				= COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
-	},
-	{ /* 6 */
-		.lib_handler_fn				= message_handler_req_lib_cmanquorum_qdisk_getinfo,
-		.response_size				= sizeof (struct res_lib_cmanquorum_qdisk_getinfo),
-		.response_id				= MESSAGE_RES_CMANQUORUM_QDISK_GETINFO,
-		.flow_control				= COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
-	},
-	{ /* 7 */
-		.lib_handler_fn				= message_handler_req_lib_cmanquorum_setdirty,
-		.response_size				= sizeof (struct res_lib_cmanquorum_status),
-		.response_id				= MESSAGE_RES_CMANQUORUM_STATUS,
-		.flow_control				= COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
-	},
-	{ /* 8 */
-		.lib_handler_fn				= message_handler_req_lib_cmanquorum_killnode,
-		.response_size				= sizeof (struct res_lib_cmanquorum_status),
-		.response_id				= MESSAGE_RES_CMANQUORUM_STATUS,
-		.flow_control				= COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
-	},
-	{ /* 9 */
-		.lib_handler_fn				= message_handler_req_lib_cmanquorum_leaving,
-		.response_size				= sizeof (struct res_lib_cmanquorum_status),
-		.response_id				= MESSAGE_RES_CMANQUORUM_STATUS,
-		.flow_control				= COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
-	},
-	{ /* 10 */
-		.lib_handler_fn				= message_handler_req_lib_cmanquorum_trackstart,
-		.response_size				= sizeof (struct res_lib_cmanquorum_status),
-		.response_id				= MESSAGE_RES_CMANQUORUM_STATUS,
-		.flow_control				= COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
-	},
-	{ /* 11 */
-		.lib_handler_fn				= message_handler_req_lib_cmanquorum_trackstop,
-		.response_size				= sizeof (struct res_lib_cmanquorum_status),
-		.response_id				= MESSAGE_RES_CMANQUORUM_STATUS,
-		.flow_control				= COROSYNC_LIB_FLOW_CONTROL_NOT_REQUIRED
-	}
-};
-
-static quorum_set_quorate_fn_t set_quorum;
-/*
- * lcrso object definition
- */
-static struct quorum_services_api_ver1 cmanquorum_iface_ver0 = {
-	.init				= cmanquorum_init
-};
-
-static struct corosync_service_engine quorum_service_handler = {
-	.name				        = "corosync cman quorum service v0.90",
-	.id					= CMANQUORUM_SERVICE,
-	.private_data_size			= sizeof (struct quorum_pd),
-	.allow_inquorate			= CS_LIB_ALLOW_INQUORATE,
-	.flow_control				= COROSYNC_LIB_FLOW_CONTROL_REQUIRED,
-	.lib_init_fn				= quorum_lib_init_fn,
-	.lib_exit_fn				= quorum_lib_exit_fn,
-	.lib_engine				= quorum_lib_service,
-	.lib_engine_count			= sizeof (quorum_lib_service) / sizeof (struct corosync_lib_handler),
-	.exec_init_fn				= cmanquorum_exec_init_fn,
-	.exec_engine				= NULL,
-	.exec_engine_count		        = 0,
-	.confchg_fn                             = NULL, /* Invoked by tpg */
-};
-
-/*
- * Dynamic loader definition
- */
-static struct corosync_service_engine *quorum_get_service_handler_ver0 (void);
-
-static struct corosync_service_engine_iface_ver0 quorum_service_handler_iface = {
-	.corosync_get_service_engine_ver0 = quorum_get_service_handler_ver0
-};
-
-static struct lcr_iface corosync_quorum_ver0[2] = {
-	{
-		.name				= "corosync_cmanquorum",
-		.version			= 0,
-		.versions_replace		= 0,
-		.versions_replace_count         = 0,
-		.dependencies			= 0,
-		.dependency_count		= 0,
-		.constructor			= NULL,
-		.destructor			= NULL,
-		.interfaces			= (void **)(void *)&cmanquorum_iface_ver0
-	},
-	{
-		.name				= "corosync_cmanquorum_iface",
-		.version			= 0,
-		.versions_replace		= 0,
-		.versions_replace_count         = 0,
-		.dependencies			= 0,
-		.dependency_count		= 0,
-		.constructor			= NULL,
-		.destructor			= NULL,
-		.interfaces			= NULL
-	}
-};
-
-static struct lcr_comp quorum_comp_ver0 = {
-	.iface_count			= 2,
-	.ifaces			        = corosync_quorum_ver0
-};
-
-
-static struct corosync_service_engine *quorum_get_service_handler_ver0 (void)
-{
-	return (&quorum_service_handler);
-}
-
-__attribute__ ((constructor)) static void quorum_comp_register (void) {
-        lcr_interfaces_set (&corosync_quorum_ver0[0], &cmanquorum_iface_ver0);
-	lcr_interfaces_set (&corosync_quorum_ver0[1], &quorum_service_handler_iface);
-	lcr_component_register (&quorum_comp_ver0);
-}
-
-static void cmanquorum_init(struct corosync_api_v1 *api,
-			    quorum_set_quorate_fn_t report)
-{
-	ENTER();
-	set_quorum = report;
-
-	/* Load the library-servicing part of this module */
-	api->service_link_and_init(api, "corosync_cmanquorum_iface", 0);
-
-	LEAVE();
-}
-
-#define CMANQUORUM_MSG_ACK          1
-#define CMANQUORUM_MSG_PORTOPENED   2
-#define CMANQUORUM_MSG_PORTCLOSED   3
-#define CMANQUORUM_MSG_BARRIER      4
-#define CMANQUORUM_MSG_NODEINFO     5
-#define CMANQUORUM_MSG_KILLNODE     6
-#define CMANQUORUM_MSG_LEAVE        7
-#define CMANQUORUM_MSG_RECONFIGURE  8
-#define CMANQUORUM_MSG_PORTENQ      9
-#define CMANQUORUM_MSG_PORTSTATUS  10
-#define CMANQUORUM_MSG_FENCESTATUS 11
-
-struct req_exec_quorum_nodeinfo {
-	unsigned char cmd;
-	unsigned char first_trans;
-	uint16_t cluster_id;
-	int votes;
-	int expected_votes;
-
-	unsigned int   major_version;	/* Not backwards compatible */
-	unsigned int   minor_version;	/* Backwards compatible */
-	unsigned int   patch_version;	/* Backwards/forwards compatible */
-	unsigned int   config_version;
-	unsigned int   flags;
-#ifdef CMAN_COMPATIBILITY
-	uint64_t       fence_time;      /* not used */
-	uint64_t       join_time;
-        char           clustername[16]; /* not used */
-	char           fence_agent[];   /* not used */
-#endif
-} __attribute__((packed));
-
-/* Parameters for RECONFIG command */
-#define RECONFIG_PARAM_EXPECTED_VOTES 1
-#define RECONFIG_PARAM_NODE_VOTES     2
-#define RECONFIG_PARAM_LEAVING        3
-
-struct req_exec_quorum_reconfigure {
-	unsigned char  cmd;
-	unsigned char  param;
-	unsigned short pad;
-	int            nodeid;
-	unsigned int   value;
-};
-
-struct req_exec_quorum_killnode {
-	unsigned char cmd;
-	unsigned char pad1;
-	uint16_t reason;
-	int nodeid;
-};
-
-#ifdef CMAN_COMPATIBILITY
-static uint16_t generate_cluster_id(char *name)
-{
-	int i;
-	int value = 0;
-
-	for (i=0; i<strlen(name); i++) {
-		value <<= 1;
-		value += name[i];
-	}
-	return value & 0xFFFF;
-}
-#endif
-
-/* These just make the access a little neater */
-static inline int objdb_get_string(struct corosync_api_v1 *corosync, unsigned int object_service_handle,
-				   char *key, char **value)
-{
-	int res;
-
-	*value = NULL;
-	if ( !(res = corosync->object_key_get(object_service_handle,
-					      key,
-					      strlen(key),
-					      (void *)value,
-					      NULL))) {
-		if (*value)
-			return 0;
-	}
-	return -1;
-}
-
-static inline void objdb_get_int(struct corosync_api_v1 *corosync, unsigned int object_service_handle,
-				 char *key, unsigned int *intvalue, unsigned int default_value)
-{
-	char *value = NULL;
-
-	*intvalue = default_value;
-
-	if (!corosync->object_key_get(object_service_handle, key, strlen(key),
-				 (void *)&value, NULL)) {
-		if (value) {
-			*intvalue = atoi(value);
-		}
-	}
-}
-
-static int quorum_send_message(void *message, int len)
-{
-	struct iovec iov[2];
-	struct q_protheader header;
-
-	header.tgtport = 0;
-	header.srcport = 0;
-	header.flags   = 0;
-	header.srcid   = us->node_id;
-	header.tgtid   = 0;
-
-	iov[0].iov_base = &header;
-	iov[0].iov_len  = sizeof(header);
-	iov[1].iov_base = message;
-	iov[1].iov_len  = len;
-
-	return corosync_api->tpg_joined_mcast(group_handle, iov, 2, TOTEM_AGREED);
-}
-
-static int cmanquorum_exec_init_fn (struct corosync_api_v1 *api)
-{
-	unsigned int object_handle;
-	unsigned int find_handle;
-
-	ENTER();
-
-	corosync_api = api;
-
-	list_init(&cluster_members_list);
-	list_init(&trackers_list);
-
-	/* Allocate a cluster_node for us */
-	us = allocate_node(corosync_api->totem_nodeid_get());
-	if (!us)
-		return (1);
-
-	us->flags |= NODE_FLAGS_US;
-	us->state = NODESTATE_MEMBER;
-	us->expected_votes = DEFAULT_EXPECTED;
-	us->votes = 1;
-	time(&us->join_time);
-
-	/* Get configuration variables */
-	corosync_api->object_find_create(OBJECT_PARENT_HANDLE, "quorum", strlen("quorum"), &find_handle);
-
-	if (corosync_api->object_find_next(find_handle, &object_handle) == 0) {
-		unsigned int value = 0;
-		objdb_get_int(corosync_api, object_handle, "expected_votes", &us->expected_votes, DEFAULT_EXPECTED);
-		objdb_get_int(corosync_api, object_handle, "votes", &us->votes, 1);
-		objdb_get_int(corosync_api, object_handle, "two_node", &two_node, 0);
-		objdb_get_int(corosync_api, object_handle, "quorumdev_poll", &quorumdev_poll, DEFAULT_QDEV_POLL);
-		objdb_get_int(corosync_api, object_handle, "disallowed", &value, 0);
-		if (value)
-			quorum_flags |= CMANQUORUM_FLAG_FEATURE_DISALLOWED;
-	}
-	corosync_api->object_find_destroy(find_handle);
-
-#ifdef CMAN_COMPATIBILITY
-	corosync_api->object_find_create(OBJECT_PARENT_HANDLE, "cluster", strlen("cluster"), &find_handle);
-
-	if (corosync_api->object_find_next(find_handle, &object_handle) == 0) {
-		char *name;
-		objdb_get_string(corosync_api, object_handle, "name", &name);
-		if (strlen(name) < 16)
-			strcpy(clustername, name);
-
-		objdb_get_int(corosync_api, object_handle, "cluster_id", &cluster_id, 0);
-		if (cluster_id == 0)
-			cluster_id = generate_cluster_id(clustername);
-		objdb_get_int(corosync_api, object_handle, "config_version", &config_version, 0);
-	}
-	corosync_api->object_find_destroy(find_handle);
-#endif
-
-
-	api->tpg_init(&group_handle, quorum_deliver_fn, quorum_confchg_fn);
-	api->tpg_join(group_handle, quorum_group, 1);
-
-	LEAVE();
-	return (0);
-}
-
-static int quorum_lib_exit_fn (void *conn)
-{
-	struct quorum_pd *quorum_pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn);
-
-	ENTER();
-	if (quorum_pd->tracking_enabled) {
-		list_del (&quorum_pd->list);
-		list_init (&quorum_pd->list);
-	}
-	LEAVE();
-	return (0);
-}
-
-
-static int send_quorum_notification(void *conn)
-{
-	struct res_lib_cmanquorum_notification *res_lib_cmanquorum_notification;
-	struct list_head *tmp;
-	struct cluster_node *node;
-	int cluster_members = 0;
-	int i = 0;
-	int size;
-	char *buf;
-
-	ENTER();
-	list_iterate(tmp, &cluster_members_list) {
-		node = list_entry(tmp, struct cluster_node, list);
-		cluster_members++;
-        }
-	if (quorum_device)
-		cluster_members++;
-
-	size = sizeof(struct res_lib_cmanquorum_notification) + sizeof(struct cmanquorum_node) * cluster_members;
-	buf = alloca(size);
-	if (!buf) {
-		LEAVE();
-		return -1;
-	}
-
-	res_lib_cmanquorum_notification = (struct res_lib_cmanquorum_notification *)buf;
-	res_lib_cmanquorum_notification->quorate = cluster_is_quorate;
-	res_lib_cmanquorum_notification->node_list_entries = cluster_members;
-	list_iterate(tmp, &cluster_members_list) {
-		node = list_entry(tmp, struct cluster_node, list);
-		res_lib_cmanquorum_notification->node_list[i].nodeid = node->node_id;
-		res_lib_cmanquorum_notification->node_list[i++].state = node->state;
-        }
-	if (quorum_device) {
-		res_lib_cmanquorum_notification->node_list[i].nodeid = 0;
-		res_lib_cmanquorum_notification->node_list[i++].state = quorum_device->state | 0x80;
-	}
-	res_lib_cmanquorum_notification->header.id = MESSAGE_RES_CMANQUORUM_NOTIFICATION;
-	res_lib_cmanquorum_notification->header.size = size;
-	res_lib_cmanquorum_notification->header.error = CS_OK;
-
-	/* Send it to all interested parties */
-	if (conn) {
-		int ret = corosync_api->ipc_conn_send_response(conn, buf, size);
-		LEAVE();
-		return ret;
-	}
-	else {
-		struct quorum_pd *qpd;
-
-		list_iterate(tmp, &trackers_list) {
-			qpd = list_entry(tmp, struct quorum_pd, list);
-
-			corosync_api->ipc_conn_send_response(corosync_api->ipc_conn_partner_get(qpd->conn), buf, size);
-		}
-	}
-	LEAVE();
-	return 0;
-}
-
-static void set_quorate(int total_votes)
-{
-	int quorate;
-
-	ENTER();
-	if (quorum > total_votes) {
-		quorate = 0;
-	}
-	else {
-		quorate = 1;
-	}
-
-	if (cluster_is_quorate && !quorate)
-		log_printf(LOG_INFO, "quorum lost, blocking activity\n");
-	if (!cluster_is_quorate && quorate)
-		log_printf(LOG_INFO, "quorum regained, resuming activity\n");
-
-	/* If we are newly quorate, then kill any AISONLY nodes */
-	if (!cluster_is_quorate && quorate) {
-		struct cluster_node *node = NULL;
-		struct list_head *tmp;
-
-		list_iterate(tmp, &cluster_members_list) {
-			node = list_entry(tmp, struct cluster_node, list);
-			if (node->state == NODESTATE_AISONLY)
-				quorum_exec_send_killnode(node->node_id, CMANQUORUM_REASON_KILL_REJOIN);
-		}
-	}
-
-	cluster_is_quorate = quorate;
-	set_quorum(cman_members, cman_members_entries, quorate, &cman_ringid);
-	ENTER();
-}
-
-static int calculate_quorum(int allow_decrease, unsigned int *ret_total_votes)
-{
-	struct list_head *nodelist;
-	struct cluster_node *node;
-	unsigned int total_votes = 0;
-	unsigned int highest_expected = 0;
-	unsigned int newquorum, q1, q2;
-	unsigned int total_nodes = 0;
-	unsigned int max_expected = 0;
-	unsigned int leaving = 0;
-
-	ENTER();
-	list_iterate(nodelist, &cluster_members_list) {
-		node = list_entry(nodelist, struct cluster_node, list);
-
-		log_printf(LOG_DEBUG, "node %x state=%d, votes=%d, expected=%d\n",
-			   node->node_id, node->state, node->votes, node->expected_votes);
-
-		if (node->state == NODESTATE_MEMBER) {
-			highest_expected =
-				max(highest_expected, node->expected_votes);
-			total_votes += node->votes;
-			total_nodes++;
-		}
-		if (node->state == NODESTATE_LEAVING) {
-			leaving = 1;
-		}
-	}
-
-	if (quorum_device && quorum_device->state == NODESTATE_MEMBER)
-		total_votes += quorum_device->votes;
-
-	if (max_expected > 0)
-		highest_expected = max_expected;
-
-	/* This quorum calculation is taken from the OpenVMS Cluster Systems
-	 * manual, but, then, you guessed that didn't you */
-	q1 = (highest_expected + 2) / 2;
-	q2 = (total_votes + 2) / 2;
-	newquorum = max(q1, q2);
-
-	/* Normally quorum never decreases but the system administrator can
-	 * force it down by setting expected votes to a maximum value */
-	if (!allow_decrease)
-		newquorum = max(quorum, newquorum);
-
-	/* The special two_node mode allows each of the two nodes to retain
-	 * quorum if the other fails.  Only one of the two should live past
-	 * fencing (as both nodes try to fence each other in split-brain.)
-	 * Also: if there are more than two nodes, force us inquorate to avoid
-	 * any damage or confusion.
-	 */
-	if (two_node && total_nodes <= 2)
-		newquorum = 1;
-
-	if (ret_total_votes)
-		*ret_total_votes = total_votes;
-
-	LEAVE();
-	return newquorum;
-}
-
-/* Recalculate cluster quorum, set quorate and notify changes */
-static void recalculate_quorum(int allow_decrease)
-{
-	unsigned int total_votes;
-
-	ENTER();
-	quorum = calculate_quorum(allow_decrease, &total_votes);
-	set_quorate(total_votes);
-	send_quorum_notification(NULL);
-	LEAVE();
-}
-
-static int have_disallowed(void)
-{
-	struct cluster_node *node;
-	struct list_head *tmp;
-
-	list_iterate(tmp, &cluster_members_list) {
-		node = list_entry(tmp, struct cluster_node, list);
-		if (node->state == NODESTATE_AISONLY)
-			return 1;
-	}
-
-	return 0;
-}
-
-static void node_add_ordered(struct cluster_node *newnode)
-{
-	struct cluster_node *node = NULL;
-	struct list_head *tmp;
-	struct list_head *newlist = &newnode->list;
-
-	list_iterate(tmp, &cluster_members_list) {
-		node = list_entry(tmp, struct cluster_node, list);
-
-                if (newnode->node_id < node->node_id)
-                        break;
-        }
-
-        if (!node)
-		list_add(&newnode->list, &cluster_members_list);
-        else {
-                newlist->prev = tmp->prev;
-                newlist->next = tmp;
-                tmp->prev->next = newlist;
-                tmp->prev = newlist;
-        }
-}
-
-static struct cluster_node *allocate_node(int nodeid)
-{
-	struct cluster_node *cl;
-
-	cl = malloc(sizeof(struct cluster_node));
-	if (cl) {
-		memset(cl, 0, sizeof(struct cluster_node));
-		cl->node_id = nodeid;
-		if (nodeid)
-			node_add_ordered(cl);
-	}
-	return cl;
-}
-
-static struct cluster_node *find_node_by_nodeid(int nodeid)
-{
-	struct cluster_node *node;
-	struct list_head *tmp;
-
-	list_iterate(tmp, &cluster_members_list) {
-		node = list_entry(tmp, struct cluster_node, list);
-		if (node->node_id == nodeid)
-			return node;
-	}
-	return NULL;
-}
-
-
-static int quorum_exec_send_nodeinfo()
-{
-	struct req_exec_quorum_nodeinfo req_exec_quorum_nodeinfo;
-	int ret;
-
-	ENTER();
-
-	req_exec_quorum_nodeinfo.cmd = CMANQUORUM_MSG_NODEINFO;
-	req_exec_quorum_nodeinfo.config_version = config_version;
-	req_exec_quorum_nodeinfo.expected_votes = us->expected_votes;
-	req_exec_quorum_nodeinfo.votes = us->votes;
-	req_exec_quorum_nodeinfo.major_version = CMANQUORUM_MAJOR_VERSION;
-	req_exec_quorum_nodeinfo.minor_version = CMANQUORUM_MINOR_VERSION;
-	req_exec_quorum_nodeinfo.patch_version = CMANQUORUM_PATCH_VERSION;
-	req_exec_quorum_nodeinfo.flags = us->flags;
-	req_exec_quorum_nodeinfo.join_time = us->join_time;
-	req_exec_quorum_nodeinfo.first_trans = first_trans;
-	if (have_disallowed())
-		req_exec_quorum_nodeinfo.flags |= NODE_FLAGS_SEESDISALLOWED;
-
-#ifdef CMAN_COMPATIBILITY
-	strcpy(	req_exec_quorum_nodeinfo.clustername, clustername);
-	req_exec_quorum_nodeinfo.cluster_id = cluster_id;
-#endif
-
-	ret = quorum_send_message(&req_exec_quorum_nodeinfo, sizeof(req_exec_quorum_nodeinfo));
-	LEAVE();
-	return ret;
-}
-
-
-static int quorum_exec_send_reconfigure(int param, int nodeid, int value)
-{
-	struct req_exec_quorum_reconfigure req_exec_quorum_reconfigure;
-	int ret;
-
-	ENTER();
-
-	req_exec_quorum_reconfigure.cmd = CMANQUORUM_MSG_RECONFIGURE;
-	req_exec_quorum_reconfigure.param = param;
-	req_exec_quorum_reconfigure.nodeid = nodeid;
-	req_exec_quorum_reconfigure.value = value;
-
-	ret = quorum_send_message(&req_exec_quorum_reconfigure, sizeof(req_exec_quorum_reconfigure));
-	LEAVE();
-	return ret;
-}
-
-static int quorum_exec_send_killnode(int nodeid, unsigned int reason)
-{
-	struct req_exec_quorum_killnode req_exec_quorum_killnode;
-	int ret;
-
-	ENTER();
-
-	req_exec_quorum_killnode.cmd = CMANQUORUM_MSG_KILLNODE;
-	req_exec_quorum_killnode.nodeid = nodeid;
-	req_exec_quorum_killnode.reason = reason;
-
-	ret = quorum_send_message(&req_exec_quorum_killnode, sizeof(req_exec_quorum_killnode));
-	LEAVE();
-	return ret;
-}
-
-static void quorum_confchg_fn (
-	enum totem_configuration_type configuration_type,
-	unsigned int *member_list, int member_list_entries,
-	unsigned int *left_list, int left_list_entries,
-	unsigned int *joined_list, int joined_list_entries,
-	struct memb_ring_id *ring_id)
-{
-	int i;
-	int leaving = 0;
-	struct cluster_node *node;
-
-	ENTER();
-	if (member_list_entries > 1)
-		first_trans = 0;
-
-	if (left_list_entries) {
-		for (i = 0; i< left_list_entries; i++) {
-			node = find_node_by_nodeid(left_list[i]);
-			if (node) {
-				if (node->state == NODESTATE_LEAVING)
-					leaving = 1;
-				node->state = NODESTATE_DEAD;
-				node->flags |= NODE_FLAGS_BEENDOWN;
-			}
-		}
-		recalculate_quorum(leaving);
-	}
-
-	if (member_list_entries) {
-		memcpy(cman_members, member_list, sizeof(unsigned int) * member_list_entries);
-		cman_members_entries = member_list_entries;
-		if (quorum_device) {
-			cman_members[cman_members_entries++] = 0;
-		}
-		quorum_exec_send_nodeinfo();
-	}
-
-	memcpy(&cman_ringid, ring_id, sizeof(*ring_id));
-	LEAVE();
-}
-
-static void exec_quorum_nodeinfo_endian_convert (void *msg)
-{
-	struct req_exec_quorum_nodeinfo *nodeinfo = (struct req_exec_quorum_nodeinfo *)msg;
-
-	nodeinfo->cluster_id = swab16(nodeinfo->cluster_id);
-	nodeinfo->votes = swab32(nodeinfo->votes);
-	nodeinfo->expected_votes = swab32(nodeinfo->expected_votes);
-	nodeinfo->major_version = swab32(nodeinfo->major_version);
-	nodeinfo->minor_version = swab32(nodeinfo->minor_version);
-	nodeinfo->patch_version = swab32(nodeinfo->patch_version);
-	nodeinfo->config_version = swab32(nodeinfo->config_version);
-	nodeinfo->flags = swab32(nodeinfo->flags);
-#ifdef CMAN_COMPATIBILITY
-	nodeinfo->fence_time = swab64(nodeinfo->fence_time);
-#endif
-}
-
-static void exec_quorum_reconfigure_endian_convert (void *msg)
-{
-	struct req_exec_quorum_reconfigure *reconfigure = (struct req_exec_quorum_reconfigure *)msg;
-	reconfigure->nodeid = swab32(reconfigure->nodeid);
-	reconfigure->value = swab32(reconfigure->value);
-}
-
-static void exec_quorum_killnode_endian_convert (void *msg)
-{
-	struct req_exec_quorum_killnode *killnode = (struct req_exec_quorum_killnode *)msg;
-	killnode->reason = swab16(killnode->reason);
-	killnode->nodeid = swab32(killnode->nodeid);
-}
-
-static void quorum_deliver_fn(unsigned int nodeid, struct iovec *iovec, int iov_len,
-			      int endian_conversion_required)
-{
-	struct q_protheader *header = iovec->iov_base;
-	char *buf;
-
-	ENTER();
-
-	if (endian_conversion_required) {
-		header->srcid = swab32(header->srcid);
-		header->tgtid = swab32(header->tgtid);
-		header->flags = swab32(header->flags);
-	}
-
-	/* Only pass on messages for us or everyone */
-	if (header->tgtport == 0 &&
-	    (header->tgtid == us->node_id ||
-	     header->tgtid == 0)) {
-		buf = iovec->iov_base + sizeof(struct q_protheader);
-		switch (*buf) {
-
-		case CMANQUORUM_MSG_NODEINFO:
-			if (endian_conversion_required)
-				exec_quorum_nodeinfo_endian_convert(buf);
-			message_handler_req_exec_quorum_nodeinfo (buf, header->srcid);
-			break;
-		case CMANQUORUM_MSG_RECONFIGURE:
-			if (endian_conversion_required)
-				exec_quorum_reconfigure_endian_convert(buf);
-			message_handler_req_exec_quorum_reconfigure (buf, header->srcid);
-			break;
-		case CMANQUORUM_MSG_KILLNODE:
-			if (endian_conversion_required)
-				exec_quorum_killnode_endian_convert(buf);
-			message_handler_req_exec_quorum_killnode (buf, header->srcid);
-			break;
-
-			/* Just ignore other messages */
-		}
-	}
-	LEAVE();
-}
-
-static void message_handler_req_exec_quorum_nodeinfo (
-	void *message,
-	unsigned int nodeid)
-{
-	struct req_exec_quorum_nodeinfo *req_exec_quorum_nodeinfo = (struct req_exec_quorum_nodeinfo *)message;
-	struct cluster_node *node;
-
-	ENTER();
-	log_printf(LOG_LEVEL_DEBUG, "got nodeinfo message from cluster node %d\n", nodeid);
-
-	node = find_node_by_nodeid(nodeid);
-	if (!node) {
-		node = allocate_node(nodeid);
-	}
-	if (!node) {
-		// TODO enomem error
-		return;
-	}
-
-	if (req_exec_quorum_nodeinfo->flags & NODE_FLAGS_SEESDISALLOWED && !have_disallowed()) {
-		/* Must use syslog directly here or the message will never arrive */
-		syslog(LOG_CRIT, "[CMANQUORUM]: Joined a cluster with disallowed nodes. must die");
-		corosync_api->fatal_error(2, __FILE__, __LINE__); // CC:
-		exit(2);
-	}
-
-	/* Update node state */
-	if (req_exec_quorum_nodeinfo->minor_version >= 2)
-		node->votes = req_exec_quorum_nodeinfo->votes;
-	node->expected_votes = req_exec_quorum_nodeinfo->expected_votes;
-	node->state = NODESTATE_MEMBER;
-
-	/* Check flags for disallowed (if enabled) */
-	if (quorum_flags & CMANQUORUM_FLAG_FEATURE_DISALLOWED) {
-		if ((req_exec_quorum_nodeinfo->flags & NODE_FLAGS_DIRTY && node->flags & NODE_FLAGS_BEENDOWN) ||
-		    (req_exec_quorum_nodeinfo->flags & NODE_FLAGS_DIRTY && req_exec_quorum_nodeinfo->first_trans && !(node->flags & NODE_FLAGS_US))) {
-			if (node->state != NODESTATE_AISONLY) {
-				if (cluster_is_quorate) {
-					log_printf(LOG_CRIT, "Killing node %d because it has rejoined the cluster with existing state", node->node_id);
-					node->state = NODESTATE_AISONLY;
-					quorum_exec_send_killnode(nodeid, CMANQUORUM_REASON_KILL_REJOIN);
-				}
-				else {
-					log_printf(LOG_CRIT, "Node %d not joined to quorum because it has existing state", node->node_id);
-					node->state = NODESTATE_AISONLY;
-				}
-			}
-		}
-	}
-	node->flags &= ~NODE_FLAGS_BEENDOWN;
-
-	// TODO do we need this as well as in confchg ?
-	recalculate_quorum(0);
-	LEAVE();
-}
-
-static void message_handler_req_exec_quorum_killnode (
-	void *message,
-	unsigned int nodeid)
-{
-	struct req_exec_quorum_killnode *req_exec_quorum_killnode = (struct req_exec_quorum_killnode *)message;
-
-	if (req_exec_quorum_killnode->nodeid == corosync_api->totem_nodeid_get()) {
-		log_printf(LOG_CRIT, "Killed by node %d: %s\n", nodeid, kill_reason(req_exec_quorum_killnode->reason));
-
-		// Is there a better way!! ????
-		exit(1);
-	}
-}
-
-static void message_handler_req_exec_quorum_reconfigure (
-	void *message,
-	unsigned int nodeid)
-{
-	struct req_exec_quorum_reconfigure *req_exec_quorum_reconfigure = (struct req_exec_quorum_reconfigure *)message;
-	struct cluster_node *node;
-	struct list_head *nodelist;
-
-	log_printf(LOG_LEVEL_DEBUG, "got reconfigure message from cluster node %d\n", nodeid);
-
-	node = find_node_by_nodeid(req_exec_quorum_reconfigure->nodeid);
-	if (!node)
-		return;
-
-	switch(req_exec_quorum_reconfigure->param)
-	{
-	case RECONFIG_PARAM_EXPECTED_VOTES:
-		node->expected_votes = req_exec_quorum_reconfigure->value;
-
-		list_iterate(nodelist, &cluster_members_list) {
-			node = list_entry(nodelist, struct cluster_node, list);
-			if (node->state == NODESTATE_MEMBER &&
-			    node->expected_votes > req_exec_quorum_reconfigure->value) {
-				node->expected_votes = req_exec_quorum_reconfigure->value;
-			}
-		}
-		recalculate_quorum(1);  /* Allow decrease */
-		break;
-
-	case RECONFIG_PARAM_NODE_VOTES:
-		node->votes = req_exec_quorum_reconfigure->value;
-		recalculate_quorum(1);  /* Allow decrease */
-		break;
-
-	case RECONFIG_PARAM_LEAVING:
-		node->state = NODESTATE_LEAVING;
-		break;
-	}
-}
-
-static int quorum_lib_init_fn (void *conn)
-{
-	struct quorum_pd *pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn);
-
-	ENTER();
-
-	list_init (&pd->list);
-	pd->conn = conn;
-
-	LEAVE();
-	return (0);
-}
-
-/* Message from the library */
-static void message_handler_req_lib_cmanquorum_getinfo (void *conn, void *message)
-{
-	struct req_lib_cmanquorum_getinfo *req_lib_cmanquorum_getinfo = (struct req_lib_cmanquorum_getinfo *)message;
-	struct res_lib_cmanquorum_getinfo res_lib_cmanquorum_getinfo;
-	struct cluster_node *node;
-	int highest_expected = 0;
-	int total_votes = 0;
-	cs_error_t error = CS_OK;
-
-	log_printf(LOG_LEVEL_DEBUG, "got getinfo request on %p for node %d\n", conn, req_lib_cmanquorum_getinfo->nodeid);
-
-	if (req_lib_cmanquorum_getinfo->nodeid) {
-		node = find_node_by_nodeid(req_lib_cmanquorum_getinfo->nodeid);
-	}
-	else {
-		node = us;
-	}
-
-	if (node) {
-		struct cluster_node *iternode;
-		struct list_head *nodelist;
-
-		list_iterate(nodelist, &cluster_members_list) {
-			iternode = list_entry(nodelist, struct cluster_node, list);
-
-			if (node->state == NODESTATE_MEMBER) {
-				highest_expected =
-					max(highest_expected, node->expected_votes);
-				total_votes += node->votes;
-			}
-		}
-
-		if (quorum_device && quorum_device->state == NODESTATE_MEMBER) {
-			total_votes += quorum_device->votes;
-		}
-
-		res_lib_cmanquorum_getinfo.votes = us->votes;
-		res_lib_cmanquorum_getinfo.expected_votes = us->expected_votes;
-		res_lib_cmanquorum_getinfo.highest_expected = highest_expected;
-
-		res_lib_cmanquorum_getinfo.quorum = quorum;
-		res_lib_cmanquorum_getinfo.total_votes = total_votes;
-		res_lib_cmanquorum_getinfo.flags = 0;
-
-		if (us->flags & NODE_FLAGS_DIRTY)
-			res_lib_cmanquorum_getinfo.flags |= CMANQUORUM_INFO_FLAG_DIRTY;
-		if (two_node)
-			res_lib_cmanquorum_getinfo.flags |= CMANQUORUM_INFO_FLAG_TWONODE;
-		if (cluster_is_quorate)
-			res_lib_cmanquorum_getinfo.flags |= CMANQUORUM_INFO_FLAG_QUORATE;
-		if (us->flags & NODE_FLAGS_SEESDISALLOWED)
-			res_lib_cmanquorum_getinfo.flags |= CMANQUORUM_INFO_FLAG_DISALLOWED;
-	}
-	else {
-		error = CS_ERR_NOT_EXIST;
-	}
-
-	res_lib_cmanquorum_getinfo.header.size = sizeof(res_lib_cmanquorum_getinfo);
-	res_lib_cmanquorum_getinfo.header.id = MESSAGE_RES_CMANQUORUM_GETINFO;
-	res_lib_cmanquorum_getinfo.header.error = error;
-	corosync_api->ipc_conn_send_response(conn, &res_lib_cmanquorum_getinfo, sizeof(res_lib_cmanquorum_getinfo));
-	log_printf(LOG_LEVEL_DEBUG, "getinfo response error: %d\n", error);
-}
-
-/* Message from the library */
-static void message_handler_req_lib_cmanquorum_killnode (void *conn, void *message)
-{
-	struct req_lib_cmanquorum_killnode *req_lib_cmanquorum_killnode = (struct req_lib_cmanquorum_killnode *)message;
-	struct res_lib_cmanquorum_status res_lib_cmanquorum_status;
-	cs_error_t error = CS_OK;
-
-	ENTER();
-
-	quorum_exec_send_killnode(req_lib_cmanquorum_killnode->nodeid, req_lib_cmanquorum_killnode->reason);
-
-	/* send status */
-	res_lib_cmanquorum_status.header.size = sizeof(res_lib_cmanquorum_status);
-	res_lib_cmanquorum_status.header.id = MESSAGE_RES_CMANQUORUM_STATUS;
-	res_lib_cmanquorum_status.header.error = error;
-	corosync_api->ipc_conn_send_response(conn, &res_lib_cmanquorum_status, sizeof(res_lib_cmanquorum_status));
-	LEAVE();
-}
-
-/* Message from the library */
-static void message_handler_req_lib_cmanquorum_setexpected (void *conn, void *message)
-{
-	struct req_lib_cmanquorum_setexpected *req_lib_cmanquorum_setexpected = (struct req_lib_cmanquorum_setexpected *)message;
-	struct res_lib_cmanquorum_status res_lib_cmanquorum_status;
-	cs_error_t error = CS_OK;
-
-	ENTER();
-
-	// TODO validate as cman does
-
-	quorum_exec_send_reconfigure(RECONFIG_PARAM_EXPECTED_VOTES, us->node_id, req_lib_cmanquorum_setexpected->expected_votes);
-
-	/* send status */
-	res_lib_cmanquorum_status.header.size = sizeof(res_lib_cmanquorum_status);
-	res_lib_cmanquorum_status.header.id = MESSAGE_RES_CMANQUORUM_STATUS;
-	res_lib_cmanquorum_status.header.error = error;
-	corosync_api->ipc_conn_send_response(conn, &res_lib_cmanquorum_status, sizeof(res_lib_cmanquorum_status));
-	LEAVE();
-}
-
-/* Message from the library */
-static void message_handler_req_lib_cmanquorum_setvotes (void *conn, void *message)
-{
-	struct req_lib_cmanquorum_setvotes *req_lib_cmanquorum_setvotes = (struct req_lib_cmanquorum_setvotes *)message;
-	struct res_lib_cmanquorum_status res_lib_cmanquorum_status;
-	cs_error_t error = CS_OK;
-
-	ENTER();
-
-	// TODO validate as cman does
-
-	if (!req_lib_cmanquorum_setvotes->nodeid)
-		req_lib_cmanquorum_setvotes->nodeid = corosync_api->totem_nodeid_get();
-
-	quorum_exec_send_reconfigure(RECONFIG_PARAM_NODE_VOTES, req_lib_cmanquorum_setvotes->nodeid, req_lib_cmanquorum_setvotes->votes);
-
-	/* send status */
-	res_lib_cmanquorum_status.header.size = sizeof(res_lib_cmanquorum_status);
-	res_lib_cmanquorum_status.header.id = MESSAGE_RES_CMANQUORUM_STATUS;
-	res_lib_cmanquorum_status.header.error = error;
-	corosync_api->ipc_conn_send_response(conn, &res_lib_cmanquorum_status, sizeof(res_lib_cmanquorum_status));
-	LEAVE();
-}
-
-static void message_handler_req_lib_cmanquorum_leaving (void *conn, void *message)
-{
-	struct res_lib_cmanquorum_status res_lib_cmanquorum_status;
-	cs_error_t error = CS_OK;
-
-	ENTER();
-
-	quorum_exec_send_reconfigure(RECONFIG_PARAM_LEAVING, us->node_id, 0);
-
-	/* send status */
-	res_lib_cmanquorum_status.header.size = sizeof(res_lib_cmanquorum_status);
-	res_lib_cmanquorum_status.header.id = MESSAGE_RES_CMANQUORUM_STATUS;
-	res_lib_cmanquorum_status.header.error = error;
-	corosync_api->ipc_conn_send_response(conn, &res_lib_cmanquorum_status, sizeof(res_lib_cmanquorum_status));
-	LEAVE();
-}
-
-static void quorum_device_timer_fn(void *arg)
-{
-	struct timeval now;
-
-	ENTER();
-	if (!quorum_device || quorum_device->state == NODESTATE_DEAD)
-		return;
-	gettimeofday(&now, NULL);
-	if (quorum_device->last_hello.tv_sec + quorumdev_poll/1000 < now.tv_sec) {
-		quorum_device->state = NODESTATE_DEAD;
-		log_printf(LOG_INFO, "lost contact with quorum device\n");
-		recalculate_quorum(0);
-	}
-	else {
-		corosync_api->timer_add_duration((unsigned long long)quorumdev_poll*1000000, quorum_device,
-						 quorum_device_timer_fn, &quorum_device_timer);
-	}
-	LEAVE();
-}
-
-
-static void message_handler_req_lib_cmanquorum_qdisk_register (void *conn, void *message)
-{
-	struct req_lib_cmanquorum_qdisk_register *req_lib_cmanquorum_qdisk_register = (struct req_lib_cmanquorum_qdisk_register *)message;
-	struct res_lib_cmanquorum_status res_lib_cmanquorum_status;
-	cs_error_t error = CS_OK;
-
-	ENTER();
-
-	if (quorum_device) {
-		error = CS_ERR_EXIST;
-	}
-	else {
-		quorum_device = allocate_node(0);
-		quorum_device->state = NODESTATE_DEAD;
-		quorum_device->votes = req_lib_cmanquorum_qdisk_register->votes;
-		strcpy(quorum_device_name, req_lib_cmanquorum_qdisk_register->name);
-		list_add(&quorum_device->list, &cluster_members_list);
-	}
-
-	/* send status */
-	res_lib_cmanquorum_status.header.size = sizeof(res_lib_cmanquorum_status);
-	res_lib_cmanquorum_status.header.id = MESSAGE_RES_CMANQUORUM_STATUS;
-	res_lib_cmanquorum_status.header.error = error;
-	corosync_api->ipc_conn_send_response(conn, &res_lib_cmanquorum_status, sizeof(res_lib_cmanquorum_status));
-	LEAVE();
-}
-
-static void message_handler_req_lib_cmanquorum_qdisk_unregister (void *conn, void *message)
-{
-	struct res_lib_cmanquorum_status res_lib_cmanquorum_status;
-	cs_error_t error = CS_OK;
-
-	ENTER();
-
-	if (quorum_device) {
-		struct cluster_node *node = quorum_device;
-
-		quorum_device = NULL;
-		list_del(&node->list);
-		free(node);
-		recalculate_quorum(0);
-	}
-	else {
-		error = CS_ERR_NOT_EXIST;
-	}
-
-	/* send status */
-	res_lib_cmanquorum_status.header.size = sizeof(res_lib_cmanquorum_status);
-	res_lib_cmanquorum_status.header.id = MESSAGE_RES_CMANQUORUM_STATUS;
-	res_lib_cmanquorum_status.header.error = error;
-	corosync_api->ipc_conn_send_response(conn, &res_lib_cmanquorum_status, sizeof(res_lib_cmanquorum_status));
-	LEAVE();
-}
-
-static void message_handler_req_lib_cmanquorum_qdisk_poll (void *conn, void *message)
-{
-	struct req_lib_cmanquorum_qdisk_poll *req_lib_cmanquorum_qdisk_poll = (struct req_lib_cmanquorum_qdisk_poll *)message;
-	struct res_lib_cmanquorum_status res_lib_cmanquorum_status;
-	cs_error_t error = CS_OK;
-
-	ENTER();
-
-	if (quorum_device) {
-		if (req_lib_cmanquorum_qdisk_poll->state) {
-			gettimeofday(&quorum_device->last_hello, NULL);
-			if (quorum_device->state == NODESTATE_DEAD) {
-				quorum_device->state = NODESTATE_MEMBER;
-				recalculate_quorum(0);
-
-				corosync_api->timer_add_duration((unsigned long long)quorumdev_poll*1000000, quorum_device,
-								 quorum_device_timer_fn, &quorum_device_timer);
-			}
-		}
-		else {
-			if (quorum_device->state == NODESTATE_MEMBER) {
-				quorum_device->state = NODESTATE_DEAD;
-				recalculate_quorum(0);
-				corosync_api->timer_delete(quorum_device_timer);
-			}
-		}
-	}
-	else {
-		error = CS_ERR_NOT_EXIST;
-	}
-
-	/* send status */
-	res_lib_cmanquorum_status.header.size = sizeof(res_lib_cmanquorum_status);
-	res_lib_cmanquorum_status.header.id = MESSAGE_RES_CMANQUORUM_STATUS;
-	res_lib_cmanquorum_status.header.error = error;
-	corosync_api->ipc_conn_send_response(conn, &res_lib_cmanquorum_status, sizeof(res_lib_cmanquorum_status));
-
-	LEAVE();
-}
-
-static void message_handler_req_lib_cmanquorum_qdisk_getinfo (void *conn, void *message)
-{
-	struct res_lib_cmanquorum_qdisk_getinfo res_lib_cmanquorum_qdisk_getinfo;
-	cs_error_t error = CS_OK;
-
-	ENTER();
-
-	if (quorum_device) {
-		log_printf(LOG_LEVEL_DEBUG, "got qdisk_getinfo state %d\n", quorum_device->state);
-		res_lib_cmanquorum_qdisk_getinfo.votes = quorum_device->votes;
-		if (quorum_device->state == NODESTATE_MEMBER)
-			res_lib_cmanquorum_qdisk_getinfo.state = 1;
-		else
-			res_lib_cmanquorum_qdisk_getinfo.state = 0;
-		strcpy(res_lib_cmanquorum_qdisk_getinfo.name, quorum_device_name);
-	}
-	else {
-		error = CS_ERR_NOT_EXIST;
-	}
-
-	/* send status */
-	res_lib_cmanquorum_qdisk_getinfo.header.size = sizeof(res_lib_cmanquorum_qdisk_getinfo);
-	res_lib_cmanquorum_qdisk_getinfo.header.id = MESSAGE_RES_CMANQUORUM_GETINFO;
-	res_lib_cmanquorum_qdisk_getinfo.header.error = error;
-	corosync_api->ipc_conn_send_response(conn, &res_lib_cmanquorum_qdisk_getinfo, sizeof(res_lib_cmanquorum_qdisk_getinfo));
-
-	LEAVE();
-}
-
-static void message_handler_req_lib_cmanquorum_setdirty (void *conn, void *message)
-{
-	struct res_lib_cmanquorum_status res_lib_cmanquorum_status;
-	cs_error_t error = CS_OK;
-
-	ENTER();
-
-	us->flags |= NODE_FLAGS_DIRTY;
-
-	/* send status */
-	res_lib_cmanquorum_status.header.size = sizeof(res_lib_cmanquorum_status);
-	res_lib_cmanquorum_status.header.id = MESSAGE_RES_CMANQUORUM_STATUS;
-	res_lib_cmanquorum_status.header.error = error;
-	corosync_api->ipc_conn_send_response(conn, &res_lib_cmanquorum_status, sizeof(res_lib_cmanquorum_status));
-
-	LEAVE();
-}
-
-static void message_handler_req_lib_cmanquorum_trackstart (void *conn, void *msg)
-{
-	struct req_lib_cmanquorum_trackstart *req_lib_cmanquorum_trackstart = (struct req_lib_cmanquorum_trackstart *)msg;
-	struct res_lib_cmanquorum_status res_lib_cmanquorum_status;
-	struct quorum_pd *quorum_pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn);
-
-	ENTER();
-	/*
-	 * If an immediate listing of the current cluster membership
-	 * is requested, generate membership list
-	 */
-	if (req_lib_cmanquorum_trackstart->track_flags & CS_TRACK_CURRENT ||
-	    req_lib_cmanquorum_trackstart->track_flags & CS_TRACK_CHANGES) {
-		log_printf(LOG_LEVEL_DEBUG, "sending initial status to %p\n", conn);
-		send_quorum_notification(corosync_api->ipc_conn_partner_get (conn));
-	}
-
-	/*
-	 * Record requests for tracking
-	 */
-	if (req_lib_cmanquorum_trackstart->track_flags & CS_TRACK_CHANGES ||
-	    req_lib_cmanquorum_trackstart->track_flags & CS_TRACK_CHANGES_ONLY) {
-
-		quorum_pd->track_flags = req_lib_cmanquorum_trackstart->track_flags;
-		quorum_pd->tracking_enabled = 1;
-
-		list_add (&quorum_pd->list, &trackers_list);
-	}
-
-	/* send status */
-	res_lib_cmanquorum_status.header.size = sizeof(res_lib_cmanquorum_status);
-	res_lib_cmanquorum_status.header.id = MESSAGE_RES_CMANQUORUM_STATUS;
-	res_lib_cmanquorum_status.header.error = CS_OK;
-	corosync_api->ipc_conn_send_response(conn, &res_lib_cmanquorum_status, sizeof(res_lib_cmanquorum_status));
-
-	LEAVE();
-}
-
-static void message_handler_req_lib_cmanquorum_trackstop (void *conn, void *msg)
-{
-	struct res_lib_cmanquorum_status res_lib_cmanquorum_status;
-	struct quorum_pd *quorum_pd = (struct quorum_pd *)corosync_api->ipc_private_data_get (conn);
-
-	ENTER();
-
-	if (quorum_pd->tracking_enabled) {
-		res_lib_cmanquorum_status.header.error = CS_OK;
-		quorum_pd->tracking_enabled = 0;
-		list_del (&quorum_pd->list);
-		list_init (&quorum_pd->list);
-	} else {
-		res_lib_cmanquorum_status.header.error = CS_ERR_NOT_EXIST;
-	}
-
-	/* send status */
-	res_lib_cmanquorum_status.header.size = sizeof(res_lib_cmanquorum_status);
-	res_lib_cmanquorum_status.header.id = MESSAGE_RES_CMANQUORUM_STATUS;
-	res_lib_cmanquorum_status.header.error = CS_OK;
-	corosync_api->ipc_conn_send_response(conn, &res_lib_cmanquorum_status, sizeof(res_lib_cmanquorum_status));
-
-	LEAVE();
-}
-
-
-static char *kill_reason(int reason)
-{
-	static char msg[1024];
-
-	switch (reason)
-	{
-	case CMANQUORUM_REASON_KILL_REJECTED:
-		return "our membership application was rejected";
-
-	case CMANQUORUM_REASON_KILL_APPLICATION:
-		return "we were killed by an application request";
-
-	case CMANQUORUM_REASON_KILL_REJOIN:
-		return "we rejoined the cluster without a full restart";
-
-	default:
-		sprintf(msg, "we got kill message number %d", reason);
-		return msg;
-	}
-}
-
diff --git a/cman/services/quorum/test/Makefile b/cman/services/quorum/test/Makefile
deleted file mode 100644
index 4279c0b..0000000
--- a/cman/services/quorum/test/Makefile
+++ /dev/null
@@ -1,26 +0,0 @@
-TARGETS= testcmanquorum1 testcmanquorum2
-
-all: depends ${TARGETS}
-
-include ../../../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-CFLAGS += -I../include
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L../lib -lcmanquorum
-LDFLAGS += -L${libdir} 
-LDFLAGS += -L${corosynclibdir} -lcoroutil
-
-${TARGET}: ${OBJS}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-depends:
-	$(MAKE) -C ../lib all
-
-clean: generalclean
-
--include $(OBJS:.o=.d)
diff --git a/cman/services/quorum/test/testcmanquorum1.c b/cman/services/quorum/test/testcmanquorum1.c
deleted file mode 100644
index a6c9923..0000000
--- a/cman/services/quorum/test/testcmanquorum1.c
+++ /dev/null
@@ -1,125 +0,0 @@
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <corosync/corotypes.h>
-#include <corosync/cmanquorum.h>
-
-static cmanquorum_handle_t handle;
-
-static char *node_state(int state)
-{
-	switch (state) {
-	case NODESTATE_JOINING:
-		return "Joining";
-		break;
-	case NODESTATE_MEMBER:
-		return "Member";
-		break;
-	case NODESTATE_DEAD:
-		return "Dead";
-		break;
-	case NODESTATE_LEAVING:
-		return "Leaving";
-		break;
-	case NODESTATE_DISALLOWED:
-		return "Disallowed";
-		break;
-	default:
-		return "UNKNOWN";
-		break;
-	}
-}
-
-static void cmanquorum_notification_fn(
-	cmanquorum_handle_t handle,
-	uint32_t quorate,
-	uint32_t node_list_entries,
-	cmanquorum_node_t node_list[]
-	)
-{
-	int i;
-
-	printf("cmanquorum notification called \n");
-	printf("  quorate         = %d\n", quorate);
-	printf("  number of nodes = %d\n", node_list_entries);
-
-	for (i = 0; i< node_list_entries; i++) {
-		printf("      %d: %s\n", node_list[i].nodeid, node_state(node_list[i].state));
-	}
-	printf("\n");
-}
-
-
-int main(int argc, char *argv[])
-{
-	struct cmanquorum_info info;
-	cmanquorum_callbacks_t callbacks;
-	int err;
-
-	if (argc > 1 && strcmp(argv[1], "-h")==0) {
-		fprintf(stderr, "usage: %s [new-expected] [new-votes]\n", argv[0]);
-		return 0;
-	}
-
-	callbacks.cmanquorum_notify_fn = cmanquorum_notification_fn;
-	if ( (err=cmanquorum_initialize(&handle, &callbacks)) != CS_OK)
-		fprintf(stderr, "cmanquorum_initialize FAILED: %d\n", err);
-
-	if ( (err = cmanquorum_trackstart(handle, CS_TRACK_CHANGES)) != CS_OK)
-		fprintf(stderr, "cmanquorum_trackstart FAILED: %d\n", err);
-
-	if ( (err=cmanquorum_getinfo(handle, 0, &info)) != CS_OK)
-		fprintf(stderr, "cmanquorum_getinfo FAILED: %d\n", err);
-	else {
-		printf("node votes       %d\n", info.node_votes);
-		printf("expected votes   %d\n", info.node_expected_votes);
-		printf("highest expected %d\n", info.highest_expected);
-		printf("total votes      %d\n", info.total_votes);
-		printf("quorum           %d\n", info.quorum);
-		printf("flags            ");
-		if (info.flags & CMANQUORUM_INFO_FLAG_DIRTY) printf("Dirty ");
-		if (info.flags & CMANQUORUM_INFO_FLAG_DISALLOWED) printf("Disallowed ");
-		if (info.flags & CMANQUORUM_INFO_FLAG_TWONODE) printf("2Node ");
-		if (info.flags & CMANQUORUM_INFO_FLAG_QUORATE) printf("Quorate ");
-		printf("\n");
-	}
-
-	if (argc >= 2 && atoi(argv[1])) {
-		if ( (err=cmanquorum_setexpected(handle, atoi(argv[1]))) != CS_OK)
-			fprintf(stderr, "set expected votes FAILED: %d\n", err);
-	}
-	if (argc >= 3 && atoi(argv[2])) {
-		if ( (err=cmanquorum_setvotes(handle, 0, atoi(argv[2]))) != CS_OK)
-			fprintf(stderr, "set votes FAILED: %d\n", err);
-	}
-
-	if (argc >= 2) {
-		if ( (err=cmanquorum_getinfo(handle, 0, &info)) != CS_OK)
-			fprintf(stderr, "cmanquorum_getinfo2 FAILED: %d\n", err);
-		else {
-			printf("-------------------\n");
-			printf("node votes       %d\n", info.node_votes);
-			printf("expected votes   %d\n", info.node_expected_votes);
-			printf("highest expected %d\n", info.highest_expected);
-			printf("total votes      %d\n", info.total_votes);
-			printf("cmanquorum           %d\n", info.quorum);
-			printf("flags            ");
-			if (info.flags & CMANQUORUM_INFO_FLAG_DIRTY) printf("Dirty ");
-			if (info.flags & CMANQUORUM_INFO_FLAG_DISALLOWED) printf("Disallowed ");
-			if (info.flags & CMANQUORUM_INFO_FLAG_TWONODE) printf("2Node ");
-			if (info.flags & CMANQUORUM_INFO_FLAG_QUORATE) printf("Quorate ");
-			printf("\n");
-		}
-	}
-
-	printf("Waiting for cmanquorum events, press ^C to finish\n");
-	printf("-------------------\n");
-
-	while (1)
-		cmanquorum_dispatch(handle, CS_DISPATCH_ALL);
-
-	return 0;
-}
diff --git a/cman/services/quorum/test/testcmanquorum2.c b/cman/services/quorum/test/testcmanquorum2.c
deleted file mode 100644
index 7bb54e2..0000000
--- a/cman/services/quorum/test/testcmanquorum2.c
+++ /dev/null
@@ -1,63 +0,0 @@
-#include <sys/types.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <corosync/corotypes.h>
-#include <corosync/cmanquorum.h>
-
-static cmanquorum_handle_t handle;
-
-
-static void print_info(int ok_to_fail)
-{
-	struct cmanquorum_qdisk_info qinfo;
-	int err;
-
-	if ( (err=cmanquorum_qdisk_getinfo(handle, &qinfo)) != CS_OK)
-		fprintf(stderr, "cmanquorum_qdisk_getinfo error %d: %s\n", err, ok_to_fail?"OK":"FAILED");
-	else {
-		printf("qdisk votes  %d\n", qinfo.votes);
-		printf("state        %d\n", qinfo.state);
-		printf("name         %s\n", qinfo.name);
-		printf("\n");
-	}
-}
-
-int main(int argc, char *argv[])
-{
-	int pollcount=0, polltime=1;
-	int err;
-
-	if ( (err=cmanquorum_initialize(&handle, NULL)) != CS_OK) {
-		fprintf(stderr, "cmanquorum_initialize FAILED: %d\n", err);
-		return -1;
-	}
-
-	print_info(1);
-
-	if (argc >= 2 && atoi(argv[1])) {
-		pollcount = atoi(argv[1]);
-	}
-	if (argc >= 3 && atoi(argv[2])) {
-		polltime = atoi(argv[2]);
-	}
-
-	if (argc >= 2) {
-		if ( (err=cmanquorum_qdisk_register(handle, "QDISK", 4)) != CS_OK)
-			fprintf(stderr, "qdisk_register FAILED: %d\n", err);
-
-		while (pollcount--) {
-			print_info(0);
-			if ((err=cmanquorum_qdisk_poll(handle, 1)) != CS_OK)
-				fprintf(stderr, "qdisk poll FAILED: %d\n", err);
-			print_info(0);
-			sleep(polltime);
-		}
-		if ((err= cmanquorum_qdisk_unregister(handle)) != CS_OK)
-			fprintf(stderr, "qdisk unregister FAILED: %d\n", err);
-	}
-	print_info(1);
-
-	return 0;
-}
diff --git a/cman/tests/Makefile b/cman/tests/Makefile
deleted file mode 100644
index eb800c1..0000000
--- a/cman/tests/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-TARGETS= client libtest sysman sysmand
-
-all: depends ${TARGETS}
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-
-CFLAGS += -I${cmanincdir}
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${cmanlibdir} -lcman
-LDFLAGS += -L${libdir}
-
-depends:
-	$(MAKE) -C ../lib all
-
-%: %.o
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-install:
-
-clean: generalclean
diff --git a/cman/tests/client.c b/cman/tests/client.c
deleted file mode 100644
index ff74816..0000000
--- a/cman/tests/client.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* test client */
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/uio.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#include <sys/utsname.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-#include "libcman.h"
-
-static cman_handle_t handle;
-static void get_members(void);
-
-static void event_callback(cman_handle_t handle, void *private, int reason, int arg)
-{
-	get_members();
-}
-
-
-static void data_callback(cman_handle_t handle, void *private,
-			  char *buf, int len, uint8_t port, int nodeid)
-{
-	printf("Received from node %d port %d: '%s'\n", nodeid, port, buf);
-}
-
-
-int main(int argc, char *argv[])
-{
-
-    unsigned char port = 100;
-    char message[256];
-    struct utsname ubuf;
-
-    if (argc >= 2)
-	port = atoi(argv[1]);
-
-    if (argc >= 3)
-	strcpy(message, argv[2]);
-
-    printf("Cluster port number is %d\n", port);
-    uname(&ubuf);
-    sprintf(message, "Hello from %s", ubuf.nodename);
-
-    handle = cman_init(NULL);
-    if (!handle)
-    {
-        perror("Can't connect to cman");
-        return -1;
-    }
-
-
-    if (cman_start_recv_data(handle, data_callback, port))
-    {
-	perror("Can't bind cluster socket");
-	return -1;
-    }
-    cman_start_notification(handle, event_callback);
-
-    while (1)
-    {
-
-	if (cman_send_data(handle, message, strlen(message)+1,0, port, 0) < 0)
-	{
-	    perror("write");
-	    cman_finish(handle);
-	    exit(-1);
-	}
-
-	while (1)
-	{
-		if (cman_dispatch(handle, CMAN_DISPATCH_ALL|CMAN_DISPATCH_BLOCKING) == -1)
-			break;
-	}
-    }
-    fprintf(stderr, "EOF: finished\n");
-}
-
-
-void get_members(void)
-{
-    cman_node_t *nodes;
-    int i;
-    int num_nodes = cman_get_node_count(handle);
-
-    if (num_nodes == -1)
-    {
-	perror("get nodes");
-    }
-    else
-    {
-	printf("There are %d nodes: \n", num_nodes);
-
-	nodes = malloc(num_nodes * sizeof(cman_node_t));
-	if ( (cman_get_nodes(handle, num_nodes, &num_nodes, nodes)))
-	{
-	    for (i=0; i<num_nodes; i++)
-	    {
-		printf("%s %d\n", nodes[i].cn_name, nodes[i].cn_nodeid);
-	    }
-	}
-	else
-	{
-	    perror("get node details");
-	}
-    }
-}
diff --git a/cman/tests/libtest.c b/cman/tests/libtest.c
deleted file mode 100644
index 85c1ea8..0000000
--- a/cman/tests/libtest.c
+++ /dev/null
@@ -1,132 +0,0 @@
-#include <netinet/in.h>
-#include <inttypes.h>
-#include "libcman.h"
-
-#include <stdlib.h>
-#include <stdio.h>
-
-static void cman_callback(cman_handle_t handle, void *private, int reason, int arg)
-{
-	printf("callback called reason = %d, arg=%d\n", reason, arg);
-}
-
-static void confchg_callback(cman_handle_t handle, void *private,
-			     unsigned int *member_list, int member_list_entries,
-			     unsigned int *left_list, int left_list_entries,
-			     unsigned int *joined_list, int joined_list_entries)
-{
-	int i;
-	printf("Confchg callback\n");
-	printf("member_list: %d entries:\n", member_list_entries);
-	for (i=0; i<member_list_entries; i++)
-		printf("  %d\n", member_list[i]);
-	printf("left_list: %d entries:\n", left_list_entries);
-	for (i=0; i<left_list_entries; i++)
-		printf("  %d\n", left_list[i]);
-	printf("joined_list: %d entries:\n", joined_list_entries);
-	for (i=0; i<joined_list_entries; i++)
-		printf("  %d\n", joined_list[i]);
-}
-
-static void print_node(cman_node_t *node)
-{
-	printf("  node id     %d\n", node->cn_nodeid);
-	printf("  node member %d\n", node->cn_member);
-	printf("  node name   %s\n", node->cn_name);
-	printf("  node incarn %d\n", node->cn_incarnation);
-	printf("\n");
-}
-
-int main()
-{
-	cman_handle_t h;
-	int num;
-	int retnodes;
-	cman_node_t *nodes;
-	cman_version_t ver;
-	cman_cluster_t clinfo;
-
-	h = cman_init(0);
-	if (!h)
-	{
-		perror("cman_init failed");
-		exit(1);
-	}
-
-	num = cman_get_node_count(h);
-	if (num > 0)
-		printf("cluster has %d nodes\n", num);
-	else
-		perror("node count");
-
-	printf("cman is active:    %d\n", cman_is_active(h));
-	printf("cman is quorate:   %d\n", cman_is_quorate(h));
-	printf("cman is listening: %d\n", cman_is_listening(h, CMAN_NODEID_US, 1)); /* membership! */
-	cman_get_version(h, &ver);
-	printf("cman version %d.%d.%d (config %d)\n",
-	       ver.cv_minor,
-	       ver.cv_major,
-	       ver.cv_patch,
-	       ver.cv_config);
-
-	if (!cman_get_cluster(h, &clinfo))
-	{
-		printf("Cluster '%s',  number %d\n", clinfo.ci_name, clinfo.ci_number);
-	}
-	else
-		perror("cluster info failed");
-
-	nodes = malloc(num * sizeof(cman_node_t));
-	if (!nodes)
-	{
-		perror("malloc");
-		exit(1);
-	}
-
-	if (!cman_get_nodes(h, num, &retnodes, nodes))
-	{
-		int i;
-		printf("Getting all nodes:\n");
-		for (i=0; i<retnodes; i++)
-			print_node(&nodes[i]);
-	}
-	else
-	{
-		perror("get_nodes failed");
-	}
-
-	// Need to clear this.
-	// Who wrote this rubbish? oh, I did.
-	nodes[0].cn_name[0] = '\0';
-	if (!cman_get_node(h, CMAN_NODEID_US, &nodes[0]))
-	{
-		printf("Getting our info:\n");
-		print_node(&nodes[0]);
-	}
-	else
-	{
-		perror("get_node failed");
-	}
-
-	if (cman_start_notification(h, cman_callback))
-	{
-		perror("start_notification");
-	}
-
-	if (cman_start_confchg(h, confchg_callback))
-	{
-		perror("start_confchg");
-	}
-
-
-	while (1) {
-	  int ret = cman_dispatch(h, CMAN_DISPATCH_BLOCKING | CMAN_DISPATCH_ALL);
-	  if (ret == -1) {
-		perror("cman_dispatch");
-		break;
-	  }
-	}
-	cman_finish(h);
-
-	return 0;
-}
diff --git a/cman/tests/qwait.c b/cman/tests/qwait.c
deleted file mode 100644
index 5d6a3f7..0000000
--- a/cman/tests/qwait.c
+++ /dev/null
@@ -1,58 +0,0 @@
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
-#include <sys/uio.h>
-#include <sys/un.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#include <sys/utsname.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-#include "cnxman-socket.h"
-
-static int cluster_sock;
-
-static void signal_handler(int sig)
-{
-
-    return;
-}
-
-
-int main(int argc, char *argv[])
-{
-    struct sigaction sa;
-    sigset_t ss;
-
-    cluster_sock = socket(AF_CLUSTER, SOCK_DGRAM, CLPROTO_CLIENT);
-    if (cluster_sock == -1)
-    {
-        perror("Can't open cluster socket");
-        return -1;
-    }
-    sa.sa_handler = signal_handler;
-    sa.sa_mask = ss;
-    sa.sa_flags = 0;
-    sigaction(SIGUSR1, &sa, NULL);
-
-    if (ioctl(cluster_sock, SIOCCLUSTER_NOTIFY, SIGUSR1) == -1)
-    {
-	perror("Can't set up cluster notification");
-	close(cluster_sock);
-	return -1;
-    }
-
-    while (!ioctl(cluster_sock, SIOCCLUSTER_ISQUORATE, 0))
-    {
-	pause();
-    }
-
-    close(cluster_sock);
-
-    return 0;
-}
diff --git a/cman/tests/sysman.c b/cman/tests/sysman.c
deleted file mode 100644
index 99ba562..0000000
--- a/cman/tests/sysman.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/* "sysman" client */
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
-#include <sys/uio.h>
-#include <sys/un.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#include <sys/utsname.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-#define LOCAL_SOCKNAME "/var/run/sysman"
-static int open_local_sock(void);
-
-int main(int argc, char *argv[])
-{
-    char message[PIPE_BUF];
-    int local_sock;
-    int len;
-
-    if (argc < 2)
-    {
-	printf("usage: sysman \"command\"\n");
-	return 0;
-    }
-
-    local_sock = open_local_sock();
-    if (local_sock < 0)
-	exit(2);
-
-    /* Send the command */
-    write(local_sock, argv[1], strlen(argv[1])+1);
-
-    /* Print the replies */
-    while ( (len = read(local_sock, message, sizeof(message))) )
-    {
-	write(STDOUT_FILENO, message, len);
-    }
-    printf("\n");
-    return 0;
-}
-
-
-static int open_local_sock(void)
-{
-    int local_socket;
-    struct sockaddr_un sockaddr;
-
-    // Open local socket
-    local_socket = socket(PF_UNIX, SOCK_STREAM, 0);
-    if (local_socket < 0)
-    {
-	perror("Can't create local socket");
-	return -1;
-    }
-
-    strcpy(sockaddr.sun_path, LOCAL_SOCKNAME);
-    sockaddr.sun_family = AF_UNIX;
-    if (connect(local_socket, (struct sockaddr *)&sockaddr, sizeof(sockaddr)))
-    {
-	fprintf(stderr, "sysmand is not running\n");
-	close(local_socket);
-        return -1;
-    }
-    return local_socket;
-}
-
diff --git a/cman/tests/sysmand.c b/cman/tests/sysmand.c
deleted file mode 100644
index 8391c06..0000000
--- a/cman/tests/sysmand.c
+++ /dev/null
@@ -1,469 +0,0 @@
-/* "sysman" server
-
-   Listens on a cluster port and executes commands.
-
-   This is just a demonstration piece of code, not for production use
-
-   *************************************
-   *** IT IS A MASSIVE SECURITY HOLE ***
-   *************************************
-
-   Any command passed to it will be run as root!
-
-*/
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
-#include <sys/uio.h>
-#include <sys/un.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#include <sys/utsname.h>
-#include <sys/errno.h>
-#include <syslog.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <time.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-#include "libcman.h"
-#define LOCAL_SOCKNAME "/var/run/sysman"
-#define CLUSTER_PORT_SYSMAN 12
-
-static cman_node_t *nodes = NULL;
-static int num_nodes;
-static cman_handle_t ch;
-static int expected_responses;
-
-/* Header for all commands sent to other sysmand servers */
-struct sysman_header
-{
-    int  fd;  /* local FD to return output to. in network byte order */
-    int  ret; /* Return code of command */
-    char cmd;
-#define SYSMAN_CMD_REQUEST 1
-#define SYSMAN_CMD_REPLY   2
-};
-
-/* One of these for each fd we are listening on
-   some fields are specific to particular types.
-*/
-struct read_fd
-{
-    int fd;
-    enum {CLUSTER_SOCK, LOCAL_RENDEZVOUS, LOCAL_SOCK} type;
-    int nodes_done;
-    time_t start_time;
-    struct read_fd *next;
-};
-/* Head of the fd list. Also contains
-   the cluster_socket details */
-static struct read_fd read_fd_head;
-
-
-static void get_members(void);
-static int open_local_sock(void);
-static int exec_command(char *cmd, char *reply, int *len);
-static int name_from_nodeid(int nodeid, char *name);
-static void remove_sock(struct read_fd *deadfd);
-static struct read_fd *find_by_fd(int fd);
-static int nodes_listening(int);
-
-static void event_callback(cman_handle_t handle, void *private, int reason, int arg)
-{
-	get_members();
-}
-
-static void data_callback(cman_handle_t handle, void *private,
-			  char *buf, int len, uint8_t port, int nodeid)
-{
-	struct read_fd *replyfd = NULL;
-	char reply[PIPE_BUF];
-	char title[PIPE_BUF];
-	char nodename[CMAN_MAX_NODENAME_LEN];
-	struct sysman_header *header;
-	int    status;
-	int    title_len;
-	struct sysman_header *inheader = (struct sysman_header *)buf;
-
-	switch (inheader->cmd)
-	{
-	case SYSMAN_CMD_REQUEST:
-
-		/* Execute command and capture stdout/stderr into 'reply'*/
-		status = exec_command(buf+sizeof(struct sysman_header), reply+sizeof(struct sysman_header), &len);
-
-		header = (struct sysman_header *)reply;
-
-		/* Send reply */
-		header->fd  = inheader->fd; /* Already in the right format */
-		header->cmd = SYSMAN_CMD_REPLY;
-		header->ret = htonl(status);
-
-		cman_send_data(ch, reply, len, 0, port, nodeid);
-		break;
-
-	case SYSMAN_CMD_REPLY:
-		name_from_nodeid(nodeid, nodename);
-		title_len = sprintf(title, "\nReply from %s:", nodename);
-		if (inheader->ret != 0)
-			title_len += sprintf(title+title_len, " (ret=%d)", ntohl(inheader->ret));
-		strcat(title, "\n"); title_len++;
-		write(ntohl(inheader->fd), title, title_len);
-		write(ntohl(inheader->fd), buf+sizeof(struct sysman_header),
-		      len - sizeof(struct sysman_header));
-
-		replyfd = find_by_fd(ntohl(inheader->fd));
-		if (replyfd)
-		{
-			/* If we've done all nodes then close the client down */
-			if (++replyfd->nodes_done == expected_responses)
-			{
-				close(replyfd->fd);
-				remove_sock(replyfd);
-			}
-		}
-		break;
-
-	default:
-		name_from_nodeid(nodeid, nodename);
-		syslog(LOG_ERR, "Unknown sysman command received from %s: %d\n",
-		       nodename, inheader->cmd);
-		break;
-	}
-}
-
-int main(int argc, char *argv[])
-{
-    unsigned char port = CLUSTER_PORT_SYSMAN;
-    int local_sock;
-    struct read_fd *newfd;
-    struct utsname nodeinfo;
-
-    ch = cman_init(NULL);
-    if (!ch)
-    {
-        perror("Can't connect to cman");
-        return -1;
-    }
-
-    uname(&nodeinfo);
-
-    if (cman_start_recv_data(ch, data_callback, port))
-    {
-	perror("Can't bind cluster socket");
-	return -1;
-    }
-
-    cman_start_notification(ch, event_callback);
-
-    read_fd_head.fd   = cman_get_fd(ch);
-    read_fd_head.type = CLUSTER_SOCK;
-
-    /* Preload cluster members list */
-    get_members();
-
-    /* Just a sensible default, we work out just how many
-       responses we expect properly later */
-    expected_responses = num_nodes;
-
-    /* Open the Unix socket we listen for commands on */
-    local_sock = open_local_sock();
-    if (local_sock < 0)
-	exit(2);
-
-    newfd = malloc(sizeof(struct read_fd));
-    if (!newfd)
-	exit(2);
-
-    newfd->fd   = local_sock;
-    newfd->type = LOCAL_RENDEZVOUS;
-    newfd->next = NULL;
-    read_fd_head.next = newfd;
-
-    while (1)
-    {
-	fd_set in;
-	struct read_fd *thisfd;
-	struct timeval tv = {10,0};
-
-	read_fd_head.fd   = cman_get_fd(ch);
-	FD_ZERO(&in);
-	for (thisfd = &read_fd_head; thisfd != NULL; thisfd = thisfd->next)
-	{
-	    FD_SET(thisfd->fd, &in);
-	}
-
-	if (select(FD_SETSIZE, &in, NULL, NULL, &tv) > 0)
-	{
-	    struct read_fd *lastfd = NULL;
-
-	    for (thisfd = &read_fd_head; thisfd != NULL; thisfd = thisfd->next)
-	    {
-		if (FD_ISSET(thisfd->fd, &in))
-		{
-		    switch(thisfd->type)
-		    {
-		    /* Request or response from another cluster node */
-		    case CLUSTER_SOCK:
-			    if (cman_dispatch(ch, CMAN_DISPATCH_ONE) == -1)
-				    goto closedown;
-			    break;
-
-		    /* Someone connected to our local socket */
-		    case LOCAL_RENDEZVOUS:
-		    {
-			struct sockaddr_un socka;
-			struct read_fd *newfd;
-			socklen_t sl = sizeof(socka);
-			int client_fd = accept(local_sock, (struct sockaddr *)&socka, &sl);
-
-			if (client_fd >= 0)
-			{
-			    newfd = malloc(sizeof(struct read_fd));
-			    if (!newfd)
-			    {
-				close(client_fd);
-				break;
-			    }
-			    newfd->fd    = client_fd;
-			    newfd->type  = LOCAL_SOCK;
-			    newfd->next  = thisfd->next;
-			    newfd->nodes_done = 0;
-			    newfd->start_time = time(NULL);
-			    thisfd->next = newfd;
-			}
-		    }
-		    break;
-
-		    /* Data on a connected socket */
-		    case LOCAL_SOCK:
-		    {
-			int len;
-			char buffer[PIPE_BUF];
-			len = read(thisfd->fd, buffer, sizeof(buffer));
-
-			/* EOF on socket */
-			if (len <= 0)
-			{
-			    struct read_fd *free_fd;
-
-			    close(thisfd->fd);
-			    /* Remove it from the list safely */
-			    lastfd->next = thisfd->next;
-			    free_fd = thisfd;
-			    thisfd = lastfd;
-			    free(free_fd);
-			}
-			else
-			{
-			    char cman_buffer[PIPE_BUF];
-			    struct sysman_header *header = (struct sysman_header *)cman_buffer;
-
-			    expected_responses = nodes_listening(thisfd->fd);
-
-			    header->fd  = htonl(thisfd->fd);
-			    header->cmd = SYSMAN_CMD_REQUEST;
-			    memcpy(cman_buffer+sizeof(*header), buffer, len);
-
-			    if (!cman_send_data(ch, cman_buffer, sizeof(*header)+len, 0, port, 0))
-			    {
-				perror("write");
-				goto closedown;
-			    }
-			}
-		    }
-		    break;
-
-		    } /* switch */
-
-		}
-		lastfd = thisfd;
-	    }
-	}
-	/* Check for timed-out connections */
-	for (thisfd = &read_fd_head; thisfd != NULL; thisfd = thisfd->next)
-	{
-	    if (thisfd->type == LOCAL_SOCK && (thisfd->start_time <= time(NULL)-10))
-	    {
-		write(thisfd->fd,"Timed-out\n", 10);
-		close(thisfd->fd);
-		remove_sock(thisfd);
-
-		/* Refresh members list in case a node has gone down
-		   or a remote sysmand has crashed */
-		get_members();
-	    }
-	}
-    }
- closedown:
-    cman_finish(ch);
-    close(local_sock);
-
-    return 0;
-}
-
-/* Get a list of members */
-static void get_members()
-{
-    num_nodes = cman_get_node_count(ch);
-    if (num_nodes == -1)
-    {
-	perror("get nodes");
-    }
-    else
-    {
-	if (nodes) free(nodes);
-
-	nodes = malloc(num_nodes * sizeof(cman_node_t));
-
-	if (cman_get_nodes(ch, num_nodes, &num_nodes, nodes))
-	    perror("Error getting node list");
-    }
-}
-
-/* Convert a nodeid to a node name */
-static int name_from_nodeid(int nodeid, char *name)
-{
-    int i;
-
-    for (i=0; i<num_nodes; i++)
-    {
-	if (nodeid == nodes[i].cn_nodeid)
-	{
-	    strcpy(name, nodes[i].cn_name);
-	    return 0;
-	}
-    }
-    /* Who?? */
-    strcpy(name, "Unknown");
-    return -1;
-}
-
-/* Check which nodes are listening on the SYSMAN port */
-static int nodes_listening(int errfd)
-{
-    int i;
-    int num_listening = 0;
-
-    for (i=0; i<num_nodes; i++)
-    {
-	int listening;
-
-	listening = cman_is_listening(ch, nodes[i].cn_nodeid, CLUSTER_PORT_SYSMAN);
-
-	if (listening > 0)
-	{
-	    num_listening++;
-	}
-	else
-	{
-		if (listening == 0)
-		{
-			char errstring[1024];
-			int len;
-			len = snprintf(errstring, sizeof(errstring),
-				       "WARNING: node %s is not listening for SYSMAN requests\n",
-				       nodes[i].cn_name);
-			write(errfd, errstring, len);
-		}
-	}
-    }
-    return num_listening;
-}
-
-static int open_local_sock()
-{
-    int local_socket;
-    struct sockaddr_un sockaddr;
-
-    // Open local socket
-    unlink(LOCAL_SOCKNAME);
-    local_socket = socket(PF_UNIX, SOCK_STREAM, 0);
-    if (local_socket < 0)
-    {
-	syslog(LOG_ERR, "Can't create local socket: %m");
-	return -1;
-    }
-
-    strcpy(sockaddr.sun_path, LOCAL_SOCKNAME);
-    sockaddr.sun_family = AF_UNIX;
-    if (bind(local_socket, (struct sockaddr *)&sockaddr, sizeof(sockaddr)))
-    {
-	syslog(LOG_ERR, "can't bind local socket: %m");
-	close(local_socket);
-        return -1;
-    }
-    if (listen(local_socket, 1) != 0)
-    {
-	syslog(LOG_ERR, "listen local: %m");
-	close(local_socket);
-	return -1;
-    }
-    // Make sure only root can talk to us via the local socket.
-    // Considering the rest of the security implications of
-    // this code, this is simply pathetic!
-    chmod(LOCAL_SOCKNAME, 0600);
-
-    return local_socket;
-}
-
-static struct read_fd *find_by_fd(int fd)
-{
-    struct read_fd *thisfd;
-
-    for (thisfd = &read_fd_head; thisfd != NULL; thisfd = thisfd->next)
-	if (fd == thisfd->fd) return thisfd;
-
-    return NULL;
-}
-
-static void remove_sock(struct read_fd *deadfd)
-{
-    struct read_fd *thisfd;
-    struct read_fd *lastfd=NULL;
-
-    for (thisfd = &read_fd_head; thisfd != NULL; thisfd = thisfd->next)
-    {
-	if (thisfd == deadfd)
-	{
-	    lastfd->next = deadfd->next;
-	    free(deadfd);
-	}
-	lastfd = thisfd;
-    }
-}
-
-static int exec_command(char *cmd, char *reply, int *len)
-{
-    FILE *pipe;
-    int readlen;
-    int avail = PIPE_BUF-sizeof(struct sysman_header)-1;
-    char realcmd[strlen(cmd)+25];
-
-    /* Send stderr back to the caller, and make stdin /dev/null */
-    snprintf(realcmd, sizeof(realcmd), "%s </dev/null 2>&1", cmd);
-
-    *len = 0;
-    pipe = popen(realcmd, "r");
-
-    /* Fill the buffer as full as possible */
-    do
-    {
-	readlen = fread(reply + *len, 1, avail, pipe);
-	if (readlen > 0)
-	{
-	    *len += readlen;
-	    avail -= readlen;
-	}
-    }
-    while (avail>0 && readlen > 0);
-
-    reply[*len] ='\0';
-
-    /* Return completion status of command */
-    return pclose(pipe);
-}
diff --git a/cman/tests/user_service.c b/cman/tests/user_service.c
deleted file mode 100644
index f47987b..0000000
--- a/cman/tests/user_service.c
+++ /dev/null
@@ -1,285 +0,0 @@
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <signal.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <inttypes.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-
-#include "cnxman-socket.h"
-
-static pthread_t recv_thread;
-static int cl_sock;
-static int quit = 0;
-static int leave_finished = 0;
-static pid_t our_pid;
-
-
-/* SIGUSR1 will cause this program to look for a new service event from SM
-   using the GETEVENT ioctl.
- 
-   SIGTERM will cause this program to leave the service group cleanly; it will
-   do a LEAVE ioctl, get a stop event and then exit.
-   
-   SIGKILL will cause the program to exit without first leaving the service
-   group.  In that case the kernel will clean up and leave the service group
-   (as a part of cl_release on the cluster socket). */
-
-
-static void sigusr1_handler(int sig)
-{
-}
-
-static void sigterm_handler(int sig)
-{
-	quit = 1;
-}
-
-/* This thread receives messages on the cluster socket and prints them. */
-
-static void *recv_thread_fn(void *arg)
-{
-	struct iovec iov[2];
-	struct msghdr msg;
-	struct sockaddr_cl saddr;
-	char buf[256];
-	int len;
-	int nodeid;
-
-	for (;;) {
-		memset(buf, 0, 256);
-
-		msg.msg_control    = NULL;
-		msg.msg_controllen = 0;
-		msg.msg_iovlen     = 1;
-		msg.msg_iov        = iov;
-		msg.msg_name       = &saddr;
-		msg.msg_flags      = 0;
-		msg.msg_namelen    = sizeof(saddr);
-		iov[0].iov_len     = sizeof(buf);
-		iov[0].iov_base    = buf;
-
-		len = recvmsg(cl_sock, &msg, MSG_OOB);
-
-		if (len < 0 && errno == EAGAIN)
-			continue;
-
-		if (!len || len < 0)
-			continue;
-
-		nodeid = saddr.scl_nodeid;
-
-		if (buf[0] == CLUSTER_OOB_MSG_PORTCLOSED)
-			printf("message: oob port-closed from nodeid %d\n",
-				nodeid);
-
-		else if (buf[0] == CLUSTER_OOB_MSG_SERVICEEVENT)
-			printf("message: oob service-event\n");
-
-		else if (!strcmp(buf, "hello"))
-			printf("message: \"%s\" from nodeid %d\n", buf, nodeid);
-
-		else
-			printf("message: unknown len %d byte0 %x nodeid %d\n",
-				len, buf[0], nodeid);
-	}
-}
-
-static void send_group_message(void)
-{
-	struct iovec iov[2];
-	struct msghdr msg;
-	char buf[256];
-	int len;
-
-	strcpy(buf, "hello");
-
-	iov[0].iov_len     = strlen(buf);
-	iov[0].iov_base    = buf;
-	msg.msg_control    = NULL;
-	msg.msg_controllen = 0;
-	msg.msg_iovlen     = 1;
-	msg.msg_iov        = iov;
-	msg.msg_name       = NULL;
-	msg.msg_flags      = O_NONBLOCK;
-	msg.msg_namelen    = 0;
-
-	len = sendmsg(cl_sock, &msg, 0);
-}
-
-static void print_ev(struct cl_service_event *ev)
-{
-	switch (ev->type) {
-	case SERVICE_EVENT_STOP:
-		printf("stop:\n");
-		break;
-	case SERVICE_EVENT_START:
-		printf("start:\n");
-		break;
-	case SERVICE_EVENT_FINISH:
-		printf("finish:\n");
-		break;
-	case SERVICE_EVENT_LEAVEDONE:
-		printf("leavedone:\n");
-		break;
-	}
-	printf("  event_id    = %u\n", ev->event_id);
-	printf("  last_stop   = %u\n", ev->last_stop);
-	printf("  last_start  = %u\n", ev->last_start);
-	printf("  last_finish = %u\n", ev->last_finish);
-	printf("  node_count  = %u\n", ev->node_count);
-}
-
-static void print_members(int count, struct cl_cluster_node *nodes)
-{
-	int i;
-
-	printf("members:\n");
-	for (i = 0; i < count; i++) {
-		printf("  nodeid = %u \"%s\"\n", nodes->node_id, nodes->name);
-		nodes++;
-	}
-}
-
-static int process_event(struct cl_service_event *ev)
-{
-	struct cl_cluster_node *nodes;
-	int error = 0;
-
-	print_ev(ev);
-
-	if (ev->type == SERVICE_EVENT_START) {
-
-		nodes = malloc(ev->node_count * sizeof(struct cl_cluster_node));
-		if (!nodes) {
-			perror("process_event: malloc failed");
-			return -ENOMEM;
-		}
-
-		memset(nodes, 0, ev->node_count*sizeof(struct cl_cluster_node));
-
-		error = ioctl(cl_sock, SIOCCLUSTER_SERVICE_GETMEMBERS, nodes);
-		if (error < 0)
-			perror("process_event: service get members failed");
-
-		print_members(ev->node_count, nodes);
-
-		error = ioctl(cl_sock, SIOCCLUSTER_SERVICE_STARTDONE,
-			      ev->event_id);
-		if (error < 0)
-			perror("process_event: start done error");
-
-		/* send_group_message(); */
-
-		free(nodes);
-	}
-
-	if (ev->type == SERVICE_EVENT_LEAVEDONE)
-		leave_finished = 1;
-
-	return error;
-}
-
-int main(int argc, char **argv)
-{
-	struct cl_service_event event;
-	struct sockaddr_cl saddr;
-	char *name;
-	int error;
-
-	our_pid = getpid();
-
-	if (argc > 1)
-		name = argv[1];
-	else
-		name = "example";
-
-
-	cl_sock = socket(AF_CLUSTER, SOCK_DGRAM, CLPROTO_CLIENT);
-	if (cl_sock < 0) {
-		perror("main: can't create cluster socket");
-		return -1;
-	}
-
-
-	error = ioctl(cl_sock, SIOCCLUSTER_SERVICE_REGISTER, name);
-	if (error < 0) {
-		perror("main: service register failed");
-		return -1;
-	}
-
-
-	/* binding to an address is only needed if we want to send/recv
-	   messages to other nodes on the cluster socket. */
-
-#if 0
-	saddr.scl_family = AF_CLUSTER;
-	saddr.scl_port = 13; /* CLUSTER_PORT_USER_SERVICE */
-
-	error = bind(cl_sock, (struct sockaddr *) &saddr,
-		     sizeof(struct sockaddr_cl));
-	if (error < 0) {
-		perror("main: can't bind to cluster socket");
-		return -1;
-	}
-	pthread_create(&recv_thread, NULL, recv_thread_fn, 0);
-#endif
-
-	signal(SIGUSR1, sigusr1_handler);
-	signal(SIGTERM, sigterm_handler);
-
-	error = ioctl(cl_sock, SIOCCLUSTER_SERVICE_SETSIGNAL, SIGUSR1);
-	if (error < 0) {
-		perror("main: service set signal failed");
-		return -1;
-	}
-
-	error = ioctl(cl_sock, SIOCCLUSTER_SERVICE_JOIN, NULL);
-	if (error < 0) {
-		perror("main: service join failed");
-		return -1;
-	}
-
-
-	for (;;) {
-		memset(&event, 0, sizeof(struct cl_service_event));
-
-		error = ioctl(cl_sock, SIOCCLUSTER_SERVICE_GETEVENT, &event);
-		if (error < 0) {
-			perror("main: service get event failed");
-			return -1;
-		}
-
-		if (!error)
-			pause();
-		else
-			process_event(&event);
-
-
-		if (quit) {
-			quit = 0;
-			leave_finished = 0;
-
-			error = ioctl(cl_sock, SIOCCLUSTER_SERVICE_LEAVE, NULL);
-			if (error < 0) {
-				perror("main: service leave failed");
-				return -1;
-			}
-		}
-
-		if (leave_finished)
-			break;
-	}
-
-	error = ioctl(cl_sock, SIOCCLUSTER_SERVICE_UNREGISTER, NULL);
-	if (error < 0)
-		perror("main: unregister failed");
-
-	return 0;
-}
diff --git a/common/Makefile b/common/Makefile
deleted file mode 100644
index 31fdfdb..0000000
--- a/common/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../make/defines.mk
-include $(OBJDIR)/make/passthrough.mk
-
-SUBDIRS=liblogthread
diff --git a/common/liblogthread/Makefile b/common/liblogthread/Makefile
deleted file mode 100644
index be072bf..0000000
--- a/common/liblogthread/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-TARGET= liblogthread
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/libs.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-CFLAGS += -fPIC
-CFLAGS += -I${incdir}
-
-LDFLAGS += -lpthread
diff --git a/common/liblogthread/liblogthread.c b/common/liblogthread/liblogthread.c
deleted file mode 100644
index d0b28ad..0000000
--- a/common/liblogthread/liblogthread.c
+++ /dev/null
@@ -1,326 +0,0 @@
-#include <stdlib.h>
-#include <stdarg.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <time.h>
-#include <syslog.h>
-#include <pthread.h>
-#include <sys/param.h>
-
-#include "liblogthread.h"
-
-#define DEFAULT_ENTRIES 4096
-#define ENTRY_STR_LEN 128
-
-struct entry {
-	int level;
-	char str[ENTRY_STR_LEN];
-	time_t time;
-};
-
-static struct entry *ents;
-static unsigned int num_ents = DEFAULT_ENTRIES;
-static unsigned int head_ent, tail_ent; /* add at head, remove from tail */
-static unsigned int dropped;
-static unsigned int pending_ents;
-static unsigned int init;
-static unsigned int done;
-static pthread_t thread_handle;
-static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
-
-static int logt_mode; /* LOG_MODE_ */
-static int logt_syslog_facility;
-static int logt_syslog_priority;
-static int logt_logfile_priority;
-static char logt_name[PATH_MAX];
-static char logt_logfile[PATH_MAX];
-static FILE *logt_logfile_fp;
-
-static char *_time(time_t *t)
-{
-	static char buf[64];
-
-	strftime(buf, sizeof(buf), "%b %d %T", localtime(t));
-	return buf;
-}
-
-static void write_entry(int level, time_t *t, char *str)
-{
-	if ((logt_mode & LOG_MODE_OUTPUT_FILE) &&
-	    (level <= logt_logfile_priority) && logt_logfile_fp) {
-		fprintf(logt_logfile_fp, "%s %s %s", _time(t), logt_name, str);
-		fflush(logt_logfile_fp);
-	}
-	if ((logt_mode & LOG_MODE_OUTPUT_SYSLOG) &&
-	    (level <= logt_syslog_priority))
-		syslog(level, "%s", str);
-}
-
-static void write_dropped(int level, time_t *t, int num)
-{
-	char str[ENTRY_STR_LEN];
-	sprintf(str, "dropped %d entries", num);
-	write_entry(level, t, str);
-}
-
-static void *thread_fn(void *arg)
-{
-	char str[ENTRY_STR_LEN];
-	struct entry *e;
-	time_t time;
-	int level, prev_dropped = 0;
-
-	while (1) {
-		pthread_mutex_lock(&mutex);
-		while (head_ent == tail_ent) {
-			if (done) {
-				pthread_mutex_unlock(&mutex);
-				goto out;
-			}
-			pthread_cond_wait(&cond, &mutex);
-		}
-
-		e = &ents[tail_ent++];
-		tail_ent = tail_ent % num_ents;
-		pending_ents--;
-
-		memcpy(str, e->str, ENTRY_STR_LEN);
-		level = e->level;
-		time = e->time;
-
-		prev_dropped = dropped;
-		dropped = 0;
-		pthread_mutex_unlock(&mutex);
-
-		if (prev_dropped) {
-			write_dropped(level, &time, prev_dropped);
-			prev_dropped = 0;
-		}
-
-		write_entry(level, &time, str);
-	}
- out:
-	pthread_exit(NULL);
-}
-
-static void _logt_print(int level, char *buf)
-{
-	struct entry *e;
-
-	pthread_mutex_lock(&mutex);
-
-	if (pending_ents == num_ents) {
-		dropped++;
-		goto out;
-	}
-
-	e = &ents[head_ent++];
-	head_ent = head_ent % num_ents;
-	pending_ents++;
-
-	strncpy(e->str, buf, ENTRY_STR_LEN);
-	e->level = level;
-	e->time = time(NULL);
- out:
-	pthread_cond_signal(&cond);
-	pthread_mutex_unlock(&mutex);
-}
-
-void logt_print(int level, char *fmt, ...)
-{
-	va_list ap;
-	char buf[ENTRY_STR_LEN];
-
-	if (!init)
-		return;
-
-	buf[sizeof(buf) - 1] = 0;
-
-	va_start(ap, fmt);
-	vsnprintf(buf, sizeof(buf) - 1, fmt, ap);
-	va_end(ap);
-
-	if (level > logt_syslog_priority && level > logt_logfile_priority)
-		return;
-
-	/* this stderr crap really doesn't belong in this lib, please
-	   feel free to not use it */
-	if (logt_mode & LOG_MODE_OUTPUT_STDERR)
-		fputs(buf, stderr);
-
-	_logt_print(level, buf);
-}
-
-static void _conf(char *name, int mode, int syslog_facility,
-		  int syslog_priority, int logfile_priority, char *logfile)
-{
-	int fd;
-
-	pthread_mutex_lock(&mutex);
-	logt_mode = mode;
-	logt_syslog_facility = syslog_facility;
-	logt_syslog_priority = syslog_priority;
-	logt_logfile_priority = logfile_priority;
-	if (name)
-		strncpy(logt_name, name, PATH_MAX);
-	if (logfile)
-		strncpy(logt_logfile, logfile, PATH_MAX);
-
-	if (logt_mode & LOG_MODE_OUTPUT_FILE && logt_logfile[0]) {
-		if (logt_logfile_fp)
-			fclose(logt_logfile_fp);
-		logt_logfile_fp = fopen(logt_logfile, "a+");
-		if (logt_logfile_fp != NULL) {
-			fd = fileno(logt_logfile_fp);
-			fcntl(fd, F_SETFD, fcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
-		}
-	}
-
-	if (logt_mode & LOG_MODE_OUTPUT_SYSLOG) {
-		closelog();
-		openlog(logt_name, LOG_CONS | LOG_PID, logt_syslog_facility);
-	}
-	pthread_mutex_unlock(&mutex);
-}
-
-void logt_conf(char *name, int mode, int syslog_facility, int syslog_priority,
-	       int logfile_priority, char *logfile)
-{
-	if (!init)
-		return;
-
-	_conf(name, mode, syslog_facility, syslog_priority, logfile_priority,
-	      logfile);
-}
-
-int logt_init(char *name, int mode, int syslog_facility, int syslog_priority,
-	      int logfile_priority, char *logfile)
-{
-	int rv;
-
-	if (init)
-		return -1;
-
-	_conf(name, mode, syslog_facility, syslog_priority, logfile_priority,
-	      logfile);
-
-	ents = malloc(num_ents * sizeof(struct entry));
-	if (!ents)
-		return -1;
-	memset(ents, 0, num_ents * sizeof(struct entry));
-
-	rv = pthread_create(&thread_handle, NULL, thread_fn, NULL);
-	if (rv) {
-		free(ents);
-		return -1;
-	}
-	done = 0;
-	init = 1;
-	return 0;
-}
-
-
-/*
- * Reinitialize logt w/ previous values (e.g. use after
- * a call to fork())
- *
- * Only works after you call logt_init and logt_exit
- */
-int logt_reinit(void)
-{
-	char name_tmp[PATH_MAX];
-	char file_tmp[PATH_MAX];
-
-	if (!done || init)
-		return -1;
-
-	/* Use copies on the stack for these */
-	memset(name_tmp, 0, sizeof(name_tmp));
-	memset(file_tmp, 0, sizeof(file_tmp));
-
-	strncpy(name_tmp, logt_name, sizeof(name_tmp));
-	if (!strlen(name_tmp))
-		return -1;
-	if (strlen(logt_logfile))
-		strncpy(file_tmp, logt_logfile, sizeof(file_tmp));
-
-	return logt_init(name_tmp, logt_mode, logt_syslog_facility,
-			 logt_syslog_priority, logt_logfile_priority,
-			 file_tmp);
-}
-
-
-void logt_exit(void)
-{
-	pthread_mutex_lock(&mutex);
-	done = 1;
-	init = 0;
-	pthread_cond_signal(&cond);
-	pthread_mutex_unlock(&mutex);
-	pthread_join(thread_handle, NULL);
-
-	pthread_mutex_lock(&mutex);
-	/* close syslog + log file */
-	closelog();
-	if (logt_logfile_fp)
-		fclose(logt_logfile_fp);
-	logt_logfile_fp = NULL;
-
-	/* clean up any pending log messages */
-	dropped = 0;
-	pending_ents = 0;
-	head_ent = tail_ent = 0;
-	free(ents);
-	ents = NULL;
-
-	pthread_mutex_unlock(&mutex);
-}
-
-#ifdef TEST
-int main(int argc, char **argv)
-{
-	int pid;
-
-	logt_init("test", LOG_MODE_OUTPUT_FILE|LOG_MODE_OUTPUT_SYSLOG,
-		  LOG_DAEMON, LOG_DEBUG, LOG_DEBUG, "/tmp/logthread");
-	logt_print(LOG_DEBUG, "debugging message %d\n", argc);
-	logt_print(LOG_ERR, "error message %d\n", argc);
-	sleep(1);
-	logt_print(LOG_DEBUG, "second debug message\n");
-	logt_exit();
-
-	logt_print(LOG_ERR, "If you see this, it's a bug\n");
-
-	logt_init("test2", LOG_MODE_OUTPUT_FILE|LOG_MODE_OUTPUT_SYSLOG,
-		  LOG_DAEMON, LOG_DEBUG, LOG_DEBUG, "/tmp/logthread");
-	logt_print(LOG_DEBUG, "after 2nd init %d\n", argc);
-	logt_print(LOG_ERR, "error message %d\n", argc);
-	logt_print(LOG_DEBUG, "third debug message\n");
-	logt_exit();
-
-	logt_print(LOG_ERR, "If you see this, it's a bug\n");
-
-	logt_reinit();
-	logt_print(LOG_DEBUG, "after reinit\n");
-	logt_print(LOG_DEBUG, "<-- should say test2\n");
-
-	logt_exit();
-
-	if ((pid = fork()) < 0)
-		return -1;
-
-	if (pid) 
-		exit(0);
-
-	/* child process */
-	logt_reinit();
-	logt_print(LOG_DEBUG, "HELLO from child process\n");
-	logt_exit();
-
-	return 0;
-}
-#endif
-
diff --git a/common/liblogthread/liblogthread.h b/common/liblogthread/liblogthread.h
deleted file mode 100644
index ace7abb..0000000
--- a/common/liblogthread/liblogthread.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef LOGTHREAD_DOT_H
-#define LOGTHREAD_DOT_H
-
-#include <syslog.h>
-
-#define LOG_MODE_OUTPUT_FILE	1
-#define LOG_MODE_OUTPUT_SYSLOG	2
-#define LOG_MODE_OUTPUT_STDERR	4
-
-int logt_init(char *name, int mode, int syslog_facility, int syslog_priority,
-	      int logfile_priority, char *logfile);
-void logt_conf(char *name, int mode, int syslog_facility, int syslog_priority,
-	       int logfile_priority, char *logfile);
-void logt_exit(void);
-int logt_reinit(void);
-void logt_print(int level, char *fmt, ...)
-	__attribute__((format(printf, 2, 3)));;
-
-#endif
diff --git a/config/Makefile b/config/Makefile
deleted file mode 100644
index 50468ed..0000000
--- a/config/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../make/defines.mk
-include $(OBJDIR)/make/passthrough.mk
-
-SUBDIRS=libs plugins tools man
diff --git a/config/libs/Makefile b/config/libs/Makefile
deleted file mode 100644
index 8fd2879..0000000
--- a/config/libs/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../../make/defines.mk
-include $(OBJDIR)/make/passthrough.mk
-
-SUBDIRS = libccsconfdb
diff --git a/config/libs/libccsconfdb/Makefile b/config/libs/libccsconfdb/Makefile
deleted file mode 100644
index 2b233f3..0000000
--- a/config/libs/libccsconfdb/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
-TARGET= libccs
-
-INCDIRT=ccs.h
-
-OBJS=	$(TARGET).o \
-	xpathlite.o \
-	fullxpath.o \
-	extras.o
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/libs.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-CFLAGS += -fPIC
-CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
-CFLAGS += -I${corosyncincdir} -I${logtincdir} `xml2-config --cflags`
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${corosynclibdir} -lconfdb
-LDFLAGS += `xml2-config --libs`
-LDFLAGS += -L${libdir}
diff --git a/config/libs/libccsconfdb/ccs.h b/config/libs/libccsconfdb/ccs.h
deleted file mode 100644
index b85a69b..0000000
--- a/config/libs/libccsconfdb/ccs.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#ifdef __CCS_COMPAT_DOT_H__
-#error DO NOT INCLUDE libccscompat.h and ccs.h at the same time. it is BAD!
-#endif
-
-#ifndef __CCS_DOT_H__
-#define __CCS_DOT_H__
-
-int ccs_connect(void);
-int ccs_force_connect(const char *cluster_name, int blocking);
-int ccs_disconnect(int desc);
-int ccs_get(int desc, const char *query, char **rtn);
-int ccs_get_list(int desc, const char *query, char **rtn);
-int ccs_set(int desc, const char *path, char *val);
-int ccs_lookup_nodename(int desc, const char *nodename, char **rtn);
-void ccs_read_logging(int fd, char *name, int *debug, int *mode,
-                      int *syslog_facility, int *syslog_priority,
-                      int *logfile_priority, char *logfile);
-extern int fullxpath;
-
-#ifdef EXPERIMENTAL_BUILD
-extern int ccs_persistent_conn;
-#endif
-
-#endif /*  __CCS_DOT_H__ */
diff --git a/config/libs/libccsconfdb/ccs_internal.h b/config/libs/libccsconfdb/ccs_internal.h
deleted file mode 100644
index d61e521..0000000
--- a/config/libs/libccsconfdb/ccs_internal.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef __CCS_INTERNAL_DOT_H__
-#define __CCS_INTERNAL_DOT_H__
-
-/* NOTE: use __attribute__ to hide the internal API */
-
-/* from libccs.c */
-void reset_iterator(confdb_handle_t handle, unsigned int connection_handle)
-    __attribute__ ((visibility("hidden")));
-int get_previous_query(confdb_handle_t handle, unsigned int connection_handle,
-		       char *previous_query, unsigned int *query_handle)
-    __attribute__ ((visibility("hidden")));
-int set_previous_query(confdb_handle_t handle, unsigned int connection_handle,
-		       char *previous_query, unsigned int query_handle)
-    __attribute__ ((visibility("hidden")));
-
-/* from xpathlite.c */
-char *_ccs_get_xpathlite(confdb_handle_t handle, unsigned int connection_handle,
-			 const char *query, int list)
-    __attribute__ ((visibility("hidden")));
-
-/* from fullxpath.c */
-char *_ccs_get_fullxpath(confdb_handle_t handle, unsigned int connection_handle,
-			 const char *query, int list)
-    __attribute__ ((visibility("hidden")));
-int xpathfull_init(confdb_handle_t handle)
-    __attribute__ ((visibility("hidden")));
-void xpathfull_finish() __attribute__ ((visibility("hidden")));
-
-#endif /*  __CCS_INTERNAL_DOT_H__ */
diff --git a/config/libs/libccsconfdb/extras.c b/config/libs/libccsconfdb/extras.c
deleted file mode 100644
index 2e5e694..0000000
--- a/config/libs/libccsconfdb/extras.c
+++ /dev/null
@@ -1,447 +0,0 @@
-#include <ctype.h>
-#include <errno.h>
-#include <string.h>
-#include <netdb.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <limits.h>
-
-#define SYSLOG_NAMES
-#include <syslog.h>
-#include <liblogthread.h>
-
-#include "ccs.h"
-
-/**
- * ccs_lookup_nodename
- * @cd: ccs descriptor
- * @nodename: node name string
- * @retval: pointer to location to assign the result, if found
- *
- * This function takes any valid representation (FQDN, non-qualified
- * hostname, IP address, IPv6 address) of a node's name and finds its
- * canonical name (per cluster.conf). This function will find the primary
- * node name if passed a node's "altname" or any valid representation
- * of it.
- *
- * Returns: 0 on success, < 0 on failure
- */
-int ccs_lookup_nodename(int cd, const char *nodename, char **retval)
-{
-	char path[256];
-	char host_only[128];
-	char *str;
-	char *p;
-	int error;
-	int ret;
-	unsigned int i;
-	size_t nodename_len;
-	struct addrinfo hints;
-
-	if (nodename == NULL)
-		return (-1);
-
-	nodename_len = strlen(nodename);
-	ret = snprintf(path, sizeof(path),
-		       "/cluster/clusternodes/clusternode[@name=\"%s\"]/@name",
-		       nodename);
-	if (ret < 0 || (size_t) ret >= sizeof(path)) {
-		errno = E2BIG;
-		return (-E2BIG);
-	}
-
-	str = NULL;
-	error = ccs_get(cd, path, &str);
-	if (!error) {
-		*retval = str;
-		return (0);
-	}
-
-	if (nodename_len >= sizeof(host_only)) {
-		errno = E2BIG;
-		return (-E2BIG);
-	}
-
-	/* Try just the hostname */
-	strcpy(host_only, nodename);
-	p = strchr(host_only, '.');
-	if (p != NULL) {
-		*p = '\0';
-
-		ret = snprintf(path, sizeof(path),
-			       "/cluster/clusternodes/clusternode[@name=\"%s\"]/@name",
-			       host_only);
-		if (ret < 0 || (size_t) ret >= sizeof(path))
-			return (-E2BIG);
-
-		str = NULL;
-		error = ccs_get(cd, path, &str);
-		if (!error) {
-			*retval = str;
-			return (0);
-		}
-	}
-
-	memset(&hints, 0, sizeof(hints));
-	if (strchr(nodename, ':') != NULL)
-		hints.ai_family = AF_INET6;
-	else if (isdigit(nodename[nodename_len - 1]))
-		hints.ai_family = AF_INET;
-	else
-		hints.ai_family = AF_UNSPEC;
-
-	/*
-	 ** Try to match against each clusternode in cluster.conf.
-	 */
-	for (i = 1;; i++) {
-		char canonical_name[128];
-		unsigned int altcnt;
-
-		ret = snprintf(path, sizeof(path),
-			       "/cluster/clusternodes/clusternode[%u]/@name",
-			       i);
-		if (ret < 0 || (size_t) ret >= sizeof(path))
-			continue;
-
-		for (altcnt = 0;; altcnt++) {
-			size_t len;
-			struct addrinfo *ai = NULL;
-			char cur_node[128];
-
-			if (altcnt != 0) {
-				ret = snprintf(path, sizeof(path),
-					       "/cluster/clusternodes/clusternode[%u]/altname[%u]/@name",
-					       i, altcnt);
-				if (ret < 0 || (size_t) ret >= sizeof(path))
-					continue;
-			}
-
-			str = NULL;
-			error = ccs_get(cd, path, &str);
-			if (error || !str) {
-				if (altcnt == 0)
-					goto out_fail;
-				break;
-			}
-
-			if (altcnt == 0) {
-				if (strlen(str) >= sizeof(canonical_name)) {
-					free(str);
-					errno = E2BIG;
-					return (-E2BIG);
-				}
-				strcpy(canonical_name, str);
-			}
-
-			if (strlen(str) >= sizeof(cur_node)) {
-				free(str);
-				errno = E2BIG;
-				return (-E2BIG);
-			}
-
-			strcpy(cur_node, str);
-
-			p = strchr(cur_node, '.');
-			if (p != NULL)
-				len = p - cur_node;
-			else
-				len = strlen(cur_node);
-
-			if (strlen(host_only) == len &&
-			    !strncasecmp(host_only, cur_node, len)) {
-				free(str);
-				*retval = strdup(canonical_name);
-				if (*retval == NULL) {
-					errno = ENOMEM;
-					return (-ENOMEM);
-				}
-				return (0);
-			}
-
-			if (getaddrinfo(str, NULL, &hints, &ai) == 0) {
-				struct addrinfo *cur;
-
-				for (cur = ai; cur != NULL; cur = cur->ai_next) {
-					char hostbuf[512];
-					if (getnameinfo
-					    (cur->ai_addr, cur->ai_addrlen,
-					     hostbuf, sizeof(hostbuf), NULL, 0,
-					     hints.ai_family !=
-					     AF_UNSPEC ? NI_NUMERICHOST : 0)) {
-						continue;
-					}
-
-					if (!strcasecmp(hostbuf, nodename)) {
-						freeaddrinfo(ai);
-						free(str);
-						*retval =
-						    strdup(canonical_name);
-						if (*retval == NULL) {
-							errno = ENOMEM;
-							return (-ENOMEM);
-						}
-						return (0);
-					}
-				}
-				freeaddrinfo(ai);
-			}
-
-			free(str);
-
-			/* Now try any altnames */
-		}
-	}
-
-out_fail:
-	errno = EINVAL;
-	*retval = NULL;
-	return (-1);
-}
-
-static int facility_id_get(char *name)
-{
-	unsigned int i;
-
-	for (i = 0; facilitynames[i].c_name != NULL; i++) {
-		if (strcasecmp(name, facilitynames[i].c_name) == 0) {
-			return (facilitynames[i].c_val);
-		}
-	}
-	return (-1);
-}
-
-static int priority_id_get(char *name)
-{
-	unsigned int i;
-
-	for (i = 0; prioritynames[i].c_name != NULL; i++) {
-		if (strcasecmp(name, prioritynames[i].c_name) == 0) {
-			return (prioritynames[i].c_val);
-		}
-	}
-	return (-1);
-}
-
-/* requires string buffer to be PATH_MAX */
-static void read_string(int fd, char *path, char *string)
-{
-	char *str;
-	int error;
-
-	memset(string, 0, PATH_MAX);
-
-	error = ccs_get(fd, path, &str);
-	if (error || !str)
-		return;
-
-	strcpy(string, str);
-
-	free(str);
-}
-
-static void read_yesno(int fd, char *path, int *yes, int *no)
-{
-	char *str;
-	int error;
-
-	*yes = 0;
-	*no = 0;
-
-	error = ccs_get(fd, path, &str);
-	if (error || !str)
-		return;
-
-	if (!strcmp(str, "yes"))
-		*yes = 1;
-	else if (!strcmp(str, "no"))
-		*no = 1;
-
-	free(str);
-}
-
-static void read_onoff(int fd, char *path, int *on, int *off)
-{
-	char *str;
-	int error;
-
-	*on = 0;
-	*off = 0;
-
-	error = ccs_get(fd, path, &str);
-	if (error || !str)
-		return;
-
-	if (!strcmp(str, "on"))
-		*on = 1;
-	else if (!strcmp(str, "off"))
-		*off = 1;
-
-	free(str);
-}
-
-/* requires path buffer to be PATH_MAX */
-static void create_subsys_path(char *name, char *field, char *path)
-{
-	memset(path, 0, PATH_MAX);
-	snprintf(path, PATH_MAX,
-		 "/cluster/logging/logging_subsys[@subsys=\"%s\"]/%s",
-		 name, field);
-}
-
-/* Values should be initialized to default values before calling
-   this function; they are not changed if cluster.conf has nothing
-   to say about them.  If *debug is already set , then *logfile_priority
-   is set to LOG_DEBUG; all debug and logfile_priority values from
-   cluster.conf are ignored. */
-
-void ccs_read_logging(int fd, char *name, int *debug, int *mode,
-		      int *syslog_facility, int *syslog_priority,
-		      int *logfile_priority, char *logfile)
-{
-	char string[PATH_MAX];
-	char path[PATH_MAX];
-	int val, y, n, on, off;
-
-	/*
-	 * to_syslog 
-	 */
-	create_subsys_path(name, "to_syslog", path);
-
-	read_yesno(fd, "/cluster/logging/@to_syslog", &y, &n);
-	if (y)
-		*mode |= LOG_MODE_OUTPUT_SYSLOG;
-	if (n)
-		*mode &= ~LOG_MODE_OUTPUT_SYSLOG;
-
-	read_yesno(fd, path, &y, &n);
-	if (y)
-		*mode |= LOG_MODE_OUTPUT_SYSLOG;
-	if (n)
-		*mode &= ~LOG_MODE_OUTPUT_SYSLOG;
-
-	/*
-	 * to_logfile
-	 */
-	create_subsys_path(name, "to_logfile", path);
-
-	read_yesno(fd, "/cluster/logging/@to_logfile", &y, &n);
-	if (y)
-		*mode |= LOG_MODE_OUTPUT_FILE;
-	if (n)
-		*mode &= ~LOG_MODE_OUTPUT_FILE;
-
-	read_yesno(fd, path, &y, &n);
-	if (y)
-		*mode |= LOG_MODE_OUTPUT_FILE;
-	if (n)
-		*mode &= ~LOG_MODE_OUTPUT_FILE;
-
-	/*
-	 * syslog_facility
-	 */
-	create_subsys_path(name, "syslog_facility", path);
-
-	read_string(fd, "/cluster/logging/@syslog_facility", string);
-
-	if (string[0]) {
-		val = facility_id_get(string);
-		if (val >= 0)
-			*syslog_facility = val;
-	}
-
-	read_string(fd, path, string);
-
-	if (string[0]) {
-		val = facility_id_get(string);
-		if (val >= 0)
-			*syslog_facility = val;
-	}
-
-	/*
-	 * syslog_priority
-	 */
-	create_subsys_path(name, "syslog_priority", path);
-
-	read_string(fd, "/cluster/logging/@syslog_priority", string);
-
-	if (string[0]) {
-		val = priority_id_get(string);
-		if (val >= 0)
-			*syslog_priority = val;
-	}
-
-	read_string(fd, path, string);
-
-	if (string[0]) {
-		val = priority_id_get(string);
-		if (val >= 0)
-			*syslog_priority = val;
-	}
-
-	/*
-	 * logfile
-	 */
-	create_subsys_path(name, "logfile", path);
-
-	read_string(fd, "/cluster/logging/@logfile", string);
-
-	if (string[0])
-		strcpy(logfile, string);
-
-	read_string(fd, path, string);
-
-	if (string[0])
-		strcpy(logfile, string);
-
-	/*
-	 * debug is only ever turned on, not off, so if it's already on
-	 * (from the daemon), then just skip the debug lookups.
-	 */
-	if (*debug) {
-		*logfile_priority = LOG_DEBUG;
-		return;
-	}
-
-	/*
-	 * debug
-	 * debug=on is a shortcut for logfile_priority=LOG_DEBUG
-	 */
-	create_subsys_path(name, "debug", path);
-
-	read_onoff(fd, "/cluster/logging/@debug", &on, &off);
-	if (on)
-		*debug = 1;
-
-	read_onoff(fd, path, &on, &off);
-	if (on)
-		*debug = 1;
-	else if (off)
-		*debug = 0;
-
-	if (*debug) {
-		*logfile_priority = LOG_DEBUG;
-		return;
-        }
-
-	/*
-	 * logfile_priority
-	 */
-	create_subsys_path(name, "logfile_priority", path);
-
-	read_string(fd, "/cluster/logging/@logfile_priority", string);
-
-	if (string[0]) {
-		val = priority_id_get(string);
-		if (val >= 0)
-			*logfile_priority = val;
-	}
-
-	read_string(fd, path, string);
-
-	if (string[0]) {
-		val = priority_id_get(string);
-		if (val >= 0)
-			*logfile_priority = val;
-	}
-}
-
diff --git a/config/libs/libccsconfdb/fullxpath.c b/config/libs/libccsconfdb/fullxpath.c
deleted file mode 100644
index 38f56c2..0000000
--- a/config/libs/libccsconfdb/fullxpath.c
+++ /dev/null
@@ -1,334 +0,0 @@
-#include <string.h>
-#include <errno.h>
-#include <limits.h>
-#include <corosync/corotypes.h>
-#include <corosync/confdb.h>
-#include <libxml/parser.h>
-#include <libxml/xpath.h>
-
-#include "ccs.h"
-#include "ccs_internal.h"
-
-#ifndef XMLBUFSIZE
-#define XMLBUFSIZE 64000
-#endif
-
-int fullxpath = 0;
-
-static xmlDocPtr doc = NULL;
-static xmlXPathContextPtr ctx = NULL;
-
-static int add_to_buffer(char *data, char **buffer, int *bufsize)
-{
-	int datalen = 0, bufferlen = 0;
-	char *newbuf = NULL;
-
-	datalen = strlen(data);
-	bufferlen = strlen(*buffer);
-
-	if (datalen) {
-		if ((bufferlen + datalen) >= *bufsize) {
-			newbuf = malloc((*bufsize * 2));
-			if (!newbuf) {
-				errno = ENOMEM;
-				return -1;
-			}
-			*bufsize = *bufsize * 2;
-			memset(newbuf, 0, *bufsize);
-			memcpy(newbuf, *buffer, bufferlen);
-			free(*buffer);
-			*buffer = newbuf;
-		}
-		strncpy(*buffer + bufferlen, data, datalen);
-	}
-	return 0;
-}
-
-static int dump_objdb_buff(confdb_handle_t dump_handle,
-			   unsigned int parent_object_handle, char **buffer,
-			   int *bufsize)
-{
-	unsigned int object_handle;
-	char temp[PATH_MAX];
-	char object_name[PATH_MAX];
-	int object_name_len;
-	char key_name[PATH_MAX];
-	int key_name_len;
-	char key_value[PATH_MAX];
-	int key_value_len;
-	int res;
-
-	res = confdb_key_iter_start(dump_handle, parent_object_handle);
-	if (res != CS_OK) {
-		errno = ENOMEM;
-		return -1;
-	}
-
-	if (!*buffer || ((*buffer) && !strlen(*buffer))) {
-		snprintf(temp, PATH_MAX - 1,
-			 "<?xml version=\"1.0\"?>\n<objdbmaindoc>\n");
-		if (add_to_buffer(temp, buffer, bufsize))
-			return -1;
-	}
-
-	while ((res =
-		confdb_key_iter(dump_handle, parent_object_handle, key_name,
-				&key_name_len, key_value,
-				&key_value_len)) == CS_OK) {
-		key_name[key_name_len] = '\0';
-		key_value[key_value_len] = '\0';
-
-		if (!strncmp(key_name, "service_id", key_name_len))
-			continue;
-		if (!strncmp(key_name, "handle", key_name_len))
-			continue;
-		if (!strncmp(key_name, "next_handle", key_name_len))
-			continue;
-
-		snprintf(temp, PATH_MAX - 1, " %s=\"%s\"", key_name, key_value);
-		if (add_to_buffer(temp, buffer, bufsize))
-			return -1;
-	}
-
-	if (parent_object_handle > 0) {
-		snprintf(temp, PATH_MAX - 1, ">\n");
-		if (add_to_buffer(temp, buffer, bufsize))
-			return -1;
-	}
-
-	res = confdb_object_iter_start(dump_handle, parent_object_handle);
-	if (res != CS_OK) {
-		errno = ENOMEM;
-		return -1;
-	}
-
-	while ((res =
-		confdb_object_iter(dump_handle, parent_object_handle,
-				   &object_handle, object_name,
-				   &object_name_len)) == CS_OK) {
-		unsigned int parent;
-
-		res =
-		    confdb_object_parent_get(dump_handle, object_handle,
-					     &parent);
-		if (res != CS_OK) {
-			errno = EINVAL;
-			return -1;
-		}
-
-		object_name[object_name_len] = '\0';
-
-		/* we need to skip the top level services because they have invalid
-		 * xml chars */
-
-		snprintf(temp, PATH_MAX - 1, "<%s", object_name);
-		if (add_to_buffer(temp, buffer, bufsize))
-			return -1;
-
-		res =
-		    dump_objdb_buff(dump_handle, object_handle, buffer,
-				    bufsize);
-		if (res) {
-			errno = res;
-			return res;
-		}
-
-		if (object_handle != parent_object_handle) {
-			snprintf(temp, PATH_MAX - 1, "</%s>\n", object_name);
-			if (add_to_buffer(temp, buffer, bufsize))
-				return -1;
-		} else {
-			snprintf(temp, PATH_MAX - 1, ">\n");
-			if (add_to_buffer(temp, buffer, bufsize))
-				return -1;
-		}
-	}
-
-	if (parent_object_handle == OBJECT_PARENT_HANDLE) {
-		snprintf(temp, PATH_MAX - 1, "</objdbmaindoc>\n");
-		if (add_to_buffer(temp, buffer, bufsize))
-			return -1;
-	}
-
-	return 0;
-}
-
-int xpathfull_init(confdb_handle_t handle)
-{
-	int size = XMLBUFSIZE;
-	char *buffer, *newbuf;
-
-	newbuf = buffer = malloc(XMLBUFSIZE);
-	if (!buffer) {
-		errno = ENOMEM;
-		goto fail;
-	}
-
-	memset(buffer, 0, XMLBUFSIZE);
-
-	if (dump_objdb_buff(handle, OBJECT_PARENT_HANDLE, &newbuf, &size))
-		goto fail;
-
-	if (newbuf != buffer) {
-		buffer = newbuf;
-		newbuf = NULL;
-	}
-
-	doc = xmlParseMemory(buffer, strlen(buffer));
-	if (!doc)
-		goto fail;
-
-	free(buffer);
-
-	ctx = xmlXPathNewContext(doc);
-	if (!ctx) {
-		xmlFreeDoc(doc);
-		goto fail;
-	}
-
-	return 0;
-
-fail:
-	return -1;
-}
-
-void xpathfull_finish()
-{
-	if (ctx) {
-		xmlXPathFreeContext(ctx);
-		ctx = NULL;
-	}
-	if (doc) {
-		xmlFreeDoc(doc);
-		doc = NULL;
-	}
-	return;
-}
-
-/**
- * _ccs_get_fullxpath
- * @desc:
- * @query:
- * @rtn: value returned
- * @list: 1 to operate in list fashion
- *
- * This function will allocate space for the value that is the result
- * of the given query.  It is the user's responsibility to ensure that
- * the data returned is freed.
- *
- * Returns: char * to result or NULL in case of failure.
- */
-char *_ccs_get_fullxpath(confdb_handle_t handle, unsigned int connection_handle,
-			 const char *query, int list)
-{
-	xmlXPathObjectPtr obj = NULL;
-	char realquery[PATH_MAX + 16];
-	char previous_query[PATH_MAX];
-	unsigned int list_handle = 0;
-	unsigned int xmllistindex = 0;
-	int prev = 0;
-	char *rtn = NULL;
-
-	errno = 0;
-
-	if (strncmp(query, "/", 1)) {
-		errno = EINVAL;
-		goto fail;
-	}
-
-	memset(previous_query, 0, PATH_MAX);
-
-	prev =
-	    get_previous_query(handle, connection_handle, previous_query,
-			       &list_handle);
-
-	if (list && !prev && !strcmp(query, previous_query)) {
-		if (confdb_key_increment
-		    (handle, connection_handle, "iterator_tracker",
-		     strlen("iterator_tracker"), &xmllistindex) != CS_OK) {
-			xmllistindex = 0;
-		} else {
-			xmllistindex--;
-		}
-	} else {
-		reset_iterator(handle, connection_handle);
-		xmllistindex = 0;
-	}
-
-	memset(realquery, 0, PATH_MAX + 16);
-	snprintf(realquery, PATH_MAX + 16 - 1, "/objdbmaindoc%s", query);
-
-	obj = xmlXPathEvalExpression((xmlChar *) realquery, ctx);
-
-	if (!obj) {
-		errno = EINVAL;
-		goto fail;
-	}
-
-	if (obj->nodesetval && (obj->nodesetval->nodeNr > 0)) {
-		xmlNodePtr node;
-		int size = 0, nnv = 0;
-
-		if (xmllistindex >= obj->nodesetval->nodeNr) {
-			reset_iterator(handle, connection_handle);
-			errno = ENODATA;
-			goto fail;
-		}
-
-		node = obj->nodesetval->nodeTab[xmllistindex];
-
-		if (!node) {
-			errno = ENODATA;
-			goto fail;
-		}
-
-		if (((node->type == XML_ATTRIBUTE_NODE) && strstr(query, "@*"))
-		    || ((node->type == XML_ELEMENT_NODE)
-			&& strstr(query, "child::*"))) {
-			if (node->children && node->children->content)
-				size = strlen((char *)node->children->content) +
-				    strlen((char *)node->name) + 2;
-			else
-				size = strlen((char *)node->name) + 2;
-
-			nnv = 1;
-		} else {
-			if (node->children && node->children->content)
-				size =
-				    strlen((char *)node->children->content) + 1;
-
-			else {
-				errno = ENODATA;
-				goto fail;
-			}
-		}
-
-		rtn = malloc(size);
-
-		if (!rtn) {
-			errno = ENOMEM;
-			goto fail;
-		}
-
-		if (nnv)
-			sprintf(rtn, "%s=%s", node->name,
-				node->children ? (char *)node->children->
-				content : "");
-		else
-			sprintf(rtn, "%s",
-				node->children ? node->children->
-				content : node->name);
-
-		if (list)
-			set_previous_query(handle, connection_handle,
-					   (char *)query, OBJECT_PARENT_HANDLE);
-
-	} else
-		errno = EINVAL;
-
-fail:
-	if (obj)
-		xmlXPathFreeObject(obj);
-
-	return rtn;
-}
diff --git a/config/libs/libccsconfdb/libccs.c b/config/libs/libccsconfdb/libccs.c
deleted file mode 100644
index 1f60946..0000000
--- a/config/libs/libccsconfdb/libccs.c
+++ /dev/null
@@ -1,710 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <limits.h>
-#include <corosync/corotypes.h>
-#include <corosync/confdb.h>
-#ifdef EXPERIMENTAL_BUILD
-#include <time.h>
-#endif
-
-#include "ccs.h"
-#include "ccs_internal.h"
-
-#ifdef EXPERIMENTAL_BUILD
-#ifndef CCS_HANDLE_TIMEOUT
-#define CCS_HANDLE_TIMEOUT 60	/* 60 seconds */
-#endif
-#endif
-
-#ifdef EXPERIMENTAL_BUILD
-int ccs_persistent_conn = 0;
-#endif
-
-/* Callbacks are not supported - we will use them to update fullxml doc/ctx */
-static confdb_callbacks_t callbacks = {
-};
-
-/* helper functions */
-
-static confdb_handle_t confdb_connect(void)
-{
-	confdb_handle_t handle = 0;
-
-	if (confdb_initialize(&handle, &callbacks) != CS_OK) {
-		errno = ENOMEM;
-		return -1;
-	}
-
-	return handle;
-}
-
-static int confdb_disconnect(confdb_handle_t handle)
-{
-	if (confdb_finalize(handle) != CONFDB_OK) {
-		errno = EINVAL;
-		return -1;
-	}
-	return 0;
-}
-
-static unsigned int find_libccs_handle(confdb_handle_t handle)
-{
-	unsigned int libccs_handle = 0;
-
-	if (confdb_object_find_start(handle, OBJECT_PARENT_HANDLE) != CS_OK) {
-		errno = ENOMEM;
-		return -1;
-	}
-
-	if (confdb_object_find
-	    (handle, OBJECT_PARENT_HANDLE, "libccs", strlen("libccs"),
-	     &libccs_handle) != CS_OK) {
-		errno = ENOENT;
-		return -1;
-	}
-
-	confdb_object_find_destroy(handle, OBJECT_PARENT_HANDLE);
-
-	return libccs_handle;
-}
-
-static unsigned int find_ccs_handle(confdb_handle_t handle, int ccs_handle)
-{
-	int res, datalen = 0, found = 0;
-	unsigned int libccs_handle = 0, connection_handle = 0;
-	char data[128];
-
-	libccs_handle = find_libccs_handle(handle);
-	if (libccs_handle == -1)
-		return -1;
-
-	if (confdb_object_find_start(handle, libccs_handle) != CS_OK) {
-		errno = ENOMEM;
-		return -1;
-	}
-
-	while (confdb_object_find
-	       (handle, libccs_handle, "connection", strlen("connection"),
-		&connection_handle) == CS_OK) {
-		memset(data, 0, sizeof(data));
-		if (confdb_key_get
-		    (handle, connection_handle, "ccs_handle",
-		     strlen("ccs_handle"), data, &datalen) == CS_OK) {
-			res = atoi(data);
-			if (res == ccs_handle) {
-				found = 1;
-				break;
-			}
-		}
-	}
-
-	confdb_object_find_destroy(handle, libccs_handle);
-
-	if (found) {
-		return connection_handle;
-	} else {
-		errno = ENOENT;
-		return -1;
-	}
-}
-
-static int destroy_ccs_handle(confdb_handle_t handle,
-			      unsigned int connection_handle)
-{
-	if (confdb_object_destroy(handle, connection_handle) != CS_OK) {
-		errno = EINVAL;
-		return -1;
-	}
-
-	return 0;
-}
-
-static int get_running_config_version(confdb_handle_t handle)
-{
-	unsigned int cluster_handle;
-	char data[128];
-	int datalen = 0;
-	int ret = -1;
-
-	if (confdb_object_find_start(handle, OBJECT_PARENT_HANDLE) != CS_OK) {
-		errno = ENOMEM;
-		return -1;
-	}
-
-	if (confdb_object_find
-	    (handle, OBJECT_PARENT_HANDLE, "cluster", strlen("cluster"),
-	     &cluster_handle) == CS_OK) {
-		memset(data, 0, sizeof(data));
-		if (confdb_key_get
-		    (handle, cluster_handle, "config_version",
-		     strlen("config_version"), data, &datalen) == CS_OK) {
-			ret = atoi(data);
-		}
-	}
-
-	confdb_object_find_destroy(handle, OBJECT_PARENT_HANDLE);
-
-	if (ret < 0)
-		errno = ENODATA;
-
-	return ret;
-}
-
-static int get_stored_config_version(confdb_handle_t handle,
-				     unsigned int connection_handle)
-{
-	char data[128];
-	int datalen = 0;
-	int ret = -1;
-
-	if (confdb_key_get
-	    (handle, connection_handle, "config_version",
-	     strlen("config_version"), data, &datalen) == CS_OK) {
-		ret = atoi(data);
-	}
-
-	if (ret < 0)
-		errno = ENODATA;
-
-	return ret;
-}
-
-static int set_stored_config_version(confdb_handle_t handle,
-			      unsigned int connection_handle, int new_version)
-{
-	char temp[PATH_MAX];
-	int templen = 0;
-	char data[128];
-
-	memset(data, 0, sizeof(data));
-	snprintf(data, sizeof(data), "%d", new_version);
-
-	if (confdb_key_get
-	    (handle, connection_handle, "config_version",
-	     strlen("config_version"), temp, &templen) == CS_OK) {
-		if (confdb_key_replace
-		    (handle, connection_handle, "config_version",
-		     strlen("config_version"), temp, templen, data,
-		     strlen(data) + 1) == CS_OK) {
-			return 0;
-		}
-	}
-
-	return -1;
-}
-
-static int config_reload(confdb_handle_t handle,
-				   unsigned int connection_handle, int fullxpathint)
-{
-	int running_version;
-	int stored_version;
-
-	running_version = get_running_config_version(handle);
-	if (running_version < 0)
-		return -1;
-
-	stored_version = get_stored_config_version(handle, connection_handle);
-	if (stored_version < 0)
-		return -1;
-
-	if (running_version == stored_version)
-		return 0;
-
-	if (fullxpathint) {
-		xpathfull_finish();
-		if (xpathfull_init(handle))
-			return -1;
-	}
-
-	reset_iterator(handle, connection_handle);
-
-	if (set_previous_query(handle, connection_handle, "", 0))
-		return -1;
-
-	if (set_stored_config_version(handle, connection_handle, running_version))
-		return -1;
-
-	return 0;
-}
-
-static unsigned int create_ccs_handle(confdb_handle_t handle, int ccs_handle,
-				      int fullxpath)
-{
-	unsigned int libccs_handle = 0, connection_handle = 0;
-	char buf[128];
-	int config_version = 0;
-#ifdef EXPERIMENTAL_BUILD
-	time_t current_time;
-#endif
-
-	libccs_handle = find_libccs_handle(handle);
-	if (libccs_handle == -1)
-		return -1;
-
-	config_version = get_running_config_version(handle);
-	if (config_version < 0)
-		return -1;
-
-	if (confdb_object_create
-	    (handle, libccs_handle, "connection", strlen("connection"),
-	     &connection_handle) != CS_OK) {
-		errno = ENOMEM;
-		return -1;
-	}
-
-	memset(buf, 0, sizeof(buf));
-	snprintf(buf, sizeof(buf), "%d", ccs_handle);
-	if (confdb_key_create
-	    (handle, connection_handle, "ccs_handle", strlen("ccs_handle"), buf,
-	     strlen(buf) + 1) != CS_OK) {
-		destroy_ccs_handle(handle, connection_handle);
-		errno = ENOMEM;
-		return -1;
-	}
-
-	memset(buf, 0, sizeof(buf));
-	snprintf(buf, sizeof(buf), "%d", config_version);
-	if (confdb_key_create
-	    (handle, connection_handle, "config_version",
-	     strlen("config_version"), buf, strlen(buf) + 1) != CS_OK) {
-		destroy_ccs_handle(handle, connection_handle);
-		errno = ENOMEM;
-		return -1;
-	}
-
-	memset(buf, 0, sizeof(buf));
-	snprintf(buf, sizeof(buf), "%d", fullxpath);
-	if (confdb_key_create
-	    (handle, connection_handle, "fullxpath", strlen("fullxpath"), buf,
-	     strlen(buf) + 1) != CS_OK) {
-		destroy_ccs_handle(handle, connection_handle);
-		errno = ENOMEM;
-		return -1;
-	}
-#ifdef EXPERIMENTAL_BUILD
-	if (ccs_persistent_conn)
-		return connection_handle;
-
-	memset(buf, 0, sizeof(buf));
-	time(&current_time);
-	memcpy(buf, &current_time, sizeof(time_t));
-	if (confdb_key_create
-	    (handle, connection_handle, "last_access", strlen("last_access"),
-	     buf, sizeof(time_t)) != CS_OK) {
-		destroy_ccs_handle(handle, connection_handle);
-		errno = ENOMEM;
-		return -1;
-	}
-#endif
-
-	return connection_handle;
-}
-
-static unsigned int get_ccs_handle(confdb_handle_t handle, int *ccs_handle,
-				   int fullxpath)
-{
-	unsigned int next_handle;
-	unsigned int libccs_handle = 0;
-	unsigned int ret = 0;
-
-	libccs_handle = find_libccs_handle(handle);
-	if (libccs_handle == -1)
-		return -1;
-
-	if (confdb_key_increment
-	    (handle, libccs_handle, "next_handle", strlen("next_handle"),
-	     &next_handle) == CS_OK) {
-		ret = create_ccs_handle(handle, (int)next_handle, fullxpath);
-		if (ret == -1) {
-			*ccs_handle = -1;
-			return ret;
-		}
-
-		*ccs_handle = (int)next_handle;
-		return ret;
-	}
-
-	*ccs_handle = -1;
-	errno = ENOMEM;
-	return -1;
-}
-
-int get_previous_query(confdb_handle_t handle, unsigned int connection_handle,
-		       char *previous_query, unsigned int *query_handle)
-{
-	int datalen;
-
-	if (confdb_key_get
-	    (handle, connection_handle, "previous_query",
-	     strlen("previous_query"), previous_query, &datalen) == CS_OK) {
-		if (confdb_key_get
-		    (handle, connection_handle, "query_handle",
-		     strlen("query_handle"), query_handle,
-		     &datalen) == CS_OK) {
-			return 0;
-		}
-	}
-	errno = ENOENT;
-	return -1;
-}
-
-int set_previous_query(confdb_handle_t handle, unsigned int connection_handle,
-		       char *previous_query, unsigned int query_handle)
-{
-	char temp[PATH_MAX];
-	int templen;
-	unsigned int temphandle;
-
-	if (confdb_key_get
-	    (handle, connection_handle, "previous_query",
-	     strlen("previous_query"), temp, &templen) == CS_OK) {
-		if (strcmp(previous_query, temp)) {
-			if (confdb_key_replace
-			    (handle, connection_handle, "previous_query",
-			     strlen("previous_query"), temp, templen,
-			     previous_query,
-			     strlen(previous_query) + 1) != CS_OK) {
-				errno = ENOMEM;
-				return -1;
-			}
-		}
-	} else {
-		if (confdb_key_create
-		    (handle, connection_handle, "previous_query",
-		     strlen("previous_query"), previous_query,
-		     strlen(previous_query) + 1) != CS_OK) {
-			errno = ENOMEM;
-			return -1;
-		}
-	}
-
-	if (confdb_key_get
-	    (handle, connection_handle, "query_handle", strlen("query_handle"),
-	     &temphandle, &templen) == CS_OK) {
-		if (temphandle != query_handle) {
-			if (confdb_key_replace
-			    (handle, connection_handle, "query_handle",
-			     strlen("query_handle"), &temphandle,
-			     sizeof(unsigned int), &query_handle,
-			     sizeof(unsigned int)) != CS_OK) {
-				errno = ENOMEM;
-				return -1;
-			}
-		}
-	} else {
-		if (confdb_key_create
-		    (handle, connection_handle, "query_handle",
-		     strlen("query_handle"), &query_handle,
-		     sizeof(unsigned int)) != CS_OK) {
-			errno = ENOMEM;
-			return -1;
-		}
-	}
-
-	if (confdb_key_get
-	    (handle, connection_handle, "iterator_tracker",
-	     strlen("iterator_tracker"), &temphandle, &templen) != CS_OK) {
-		temphandle = 1;
-		if (confdb_key_create
-		    (handle, connection_handle, "iterator_tracker",
-		     strlen("iterator_tracker"), &temphandle,
-		     sizeof(unsigned int)) != CS_OK) {
-			errno = ENOMEM;
-			return -1;
-		}
-	}
-
-	return 0;
-}
-
-void reset_iterator(confdb_handle_t handle, unsigned int connection_handle)
-{
-	unsigned int value = 0;
-
-	if (confdb_key_increment
-	    (handle, connection_handle, "iterator_tracker",
-	     strlen("iterator_tracker"), &value) != CS_OK)
-		return;
-
-	confdb_key_delete(handle, connection_handle, "iterator_tracker",
-			  strlen("iterator_tracker"), &value,
-			  sizeof(unsigned int));
-
-	return;
-}
-
-#ifdef EXPERIMENTAL_BUILD
-static int clean_stalled_ccs_handles(confdb_handle_t handle)
-{
-	int datalen = 0;
-	unsigned int libccs_handle = 0, connection_handle = 0;
-	time_t current_time, stored_time;
-
-	libccs_handle = find_libccs_handle(handle);
-	if (libccs_handle == -1)
-		return -1;
-
-	if (confdb_object_find_start(handle, libccs_handle) != CS_OK) {
-		errno = ENOMEM;
-		return -1;
-	}
-
-	time(&current_time);
-
-	while (confdb_object_find
-	       (handle, libccs_handle, "connection", strlen("connection"),
-		&connection_handle) == CS_OK) {
-		if (confdb_key_get
-		    (handle, connection_handle, "last_access",
-		     strlen("last_access"), &stored_time,
-		     &datalen) == CS_OK) {
-			if ((current_time - stored_time) > CCS_HANDLE_TIMEOUT)
-				destroy_ccs_handle(handle, connection_handle);
-		}
-	}
-
-	confdb_object_find_destroy(handle, libccs_handle);
-
-	return 0;
-}
-#endif
-
-static int check_cluster_name(int ccs_handle, const char *cluster_name)
-{
-	confdb_handle_t handle = 0;
-	unsigned int cluster_handle;
-	char data[128];
-	int found = 0, datalen = 0;
-
-	handle = confdb_connect();
-	if (handle < 0)
-		return -1;
-
-	if (confdb_object_find_start(handle, OBJECT_PARENT_HANDLE) != CS_OK) {
-		errno = ENOMEM;
-		return -1;
-	}
-
-	while (confdb_object_find
-	       (handle, OBJECT_PARENT_HANDLE, "cluster", strlen("cluster"),
-		&cluster_handle) == CS_OK) {
-		memset(data, 0, sizeof(data));
-		if (confdb_key_get
-		    (handle, cluster_handle, "name", strlen("name"), data,
-		     &datalen) == CS_OK) {
-			if (!strncmp(data, cluster_name, datalen)) {
-				found = 1;
-				break;
-			}
-		}
-	}
-
-	confdb_object_find_destroy(handle, OBJECT_PARENT_HANDLE);
-
-	confdb_disconnect(handle);
-
-	if (found) {
-		return ccs_handle;
-	} else {
-		errno = ENOENT;
-		return -1;
-	}
-}
-
-/**
- * _ccs_get
- * @desc:
- * @query:
- * @rtn: value returned
- * @list: 1 to operate in list fashion
- *
- * This function will allocate space for the value that is the result
- * of the given query.  It is the user's responsibility to ensure that
- * the data returned is freed.
- *
- * Returns: 0 on success, < 0 on failure
- */
-static int _ccs_get(int desc, const char *query, char **rtn, int list)
-{
-	confdb_handle_t handle = 0;
-	unsigned int connection_handle = 0;
-	char data[128];
-	int datalen = 0;
-	int fullxpathint = 0;
-
-	handle = confdb_connect();
-	if (handle < 0)
-		return -1;
-
-	connection_handle = find_ccs_handle(handle, desc);
-	if (connection_handle == -1)
-		return -1;
-
-	memset(data, 0, sizeof(data));
-	if (confdb_key_get
-	    (handle, connection_handle, "fullxpath", strlen("fullxpath"), &data,
-	     &datalen) != CS_OK) {
-		errno = EINVAL;
-		return -1;
-	} else
-		fullxpathint = atoi(data);
-
-	if (config_reload(handle, connection_handle, fullxpathint) < 0)
-		return -1;
-
-	if (!fullxpathint)
-		*rtn =
-		    _ccs_get_xpathlite(handle, connection_handle, query, list);
-	else
-		*rtn =
-		    _ccs_get_fullxpath(handle, connection_handle, query, list);
-
-	confdb_disconnect(handle);
-
-	if (!*rtn)
-		return -1;
-
-	return 0;
-}
-
-/**** PUBLIC API ****/
-
-/**
- * ccs_connect
- *
- * Returns: ccs_desc on success, < 0 on failure
- */
-int ccs_connect(void)
-{
-	confdb_handle_t handle = 0;
-	int ccs_handle = 0;
-
-	handle = confdb_connect();
-	if (handle == -1)
-		return handle;
-
-#ifdef EXPERIMENTAL_BUILD
-	clean_stalled_ccs_handles(handle);
-#endif
-
-	get_ccs_handle(handle, &ccs_handle, fullxpath);
-	if (ccs_handle < 0)
-		goto fail;
-
-	if (fullxpath) {
-		if (xpathfull_init(handle)) {
-			ccs_disconnect(ccs_handle);
-			return -1;
-		}
-	}
-
-fail:
-	confdb_disconnect(handle);
-
-	return ccs_handle;
-}
-
-/**
- * ccs_force_connect
- *
- * @cluster_name: verify that we are trying to connect to the requested cluster (tbd)
- * @blocking: retry connection forever
- *
- * Returns: ccs_desc on success, < 0 on failure
- */
-int ccs_force_connect(const char *cluster_name, int blocking)
-{
-	int res = -1;
-
-	if (blocking) {
-		while (res < 0) {
-			res = ccs_connect();
-			if (res < 0)
-				sleep(1);
-		}
-	} else {
-		res = ccs_connect();
-		if (res < 0)
-			return res;
-	}
-	if (cluster_name)
-		return check_cluster_name(res, cluster_name);
-	else
-		return res;
-}
-
-/**
- * ccs_disconnect
- *
- * @desc: the descriptor returned by ccs_connect
- *
- * Returns: 0 on success, < 0 on error
- */
-int ccs_disconnect(int desc)
-{
-	confdb_handle_t handle = 0;
-	unsigned int connection_handle = 0;
-	int ret;
-	char data[128];
-	int datalen = 0;
-	int fullxpathint = 0;
-
-	handle = confdb_connect();
-	if (handle <= 0)
-		return handle;
-
-	connection_handle = find_ccs_handle(handle, desc);
-	if (connection_handle == -1)
-		return -1;
-
-	memset(data, 0, sizeof(data));
-	if (confdb_key_get
-	    (handle, connection_handle, "fullxpath", strlen("fullxpath"), &data,
-	     &datalen) != CS_OK) {
-		errno = EINVAL;
-		return -1;
-	} else
-		fullxpathint = atoi(data);
-
-	if (fullxpathint)
-		xpathfull_finish();
-
-	ret = destroy_ccs_handle(handle, connection_handle);
-	confdb_disconnect(handle);
-	return ret;
-}
-
-/* see _ccs_get */
-int ccs_get(int desc, const char *query, char **rtn)
-{
-	return _ccs_get(desc, query, rtn, 0);
-}
-
-/* see _ccs_get */
-int ccs_get_list(int desc, const char *query, char **rtn)
-{
-	return _ccs_get(desc, query, rtn, 1);
-}
-
-/**
- * ccs_set: set an individual element's value in the config file.
- * @desc:
- * @path:
- * @val:
- *
- * This function is used to update individual elements in a config file.
- * It's effects are cluster wide.  It only succeeds when the node is part
- * of a quorate cluster.
- *
- * Note currently implemented.
- * 
- * Returns: 0 on success, < 0 on failure
- */
-int ccs_set(int desc, const char *path, char *val)
-{
-	errno = ENOSYS;
-	return -1;
-}
diff --git a/config/libs/libccsconfdb/xpathlite.c b/config/libs/libccsconfdb/xpathlite.c
deleted file mode 100644
index 90558b9..0000000
--- a/config/libs/libccsconfdb/xpathlite.c
+++ /dev/null
@@ -1,424 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <limits.h>
-#include <corosync/corotypes.h>
-#include <corosync/confdb.h>
-
-#include "ccs.h"
-#include "ccs_internal.h"
-
-static int tokenizer(char *current_query)
-{
-	int index = 0;
-	char *curpos = current_query;
-	char *next = NULL;
-	char *end;
-
-	end = current_query + strlen(current_query);
-
-	while (curpos <= end) {
-		index++;
-
-		if (strncmp(curpos, "/", 1)) {
-			errno = EINVAL;
-			return -1;
-		}
-
-		memset(curpos, 0, 1);
-		curpos = curpos + 1;
-
-		next = strstr(curpos, "/");
-		if (next == curpos) {
-			errno = EINVAL;
-			return -1;
-		}
-
-		if (!next)
-			return index;
-
-		if ((strstr(curpos, "[") > next) || !strstr(curpos, "["))
-			curpos = next;
-		else
-			curpos = strstr(strstr(curpos, "]"), "/");
-
-	}
-	errno = EINVAL;
-	return -1;
-}
-
-/*
- * return 0 on success
- * return -1 on errors
- */
-static int path_dive(confdb_handle_t handle, unsigned int *query_handle,
-		     char *current_query, int tokens)
-{
-	char *pos = NULL, *next = NULL;
-	int i;
-	unsigned int new_obj_handle;
-
-	pos = current_query + 1;
-
-	for (i = 1; i <= tokens; i++) {
-		if (confdb_object_find_start(handle, *query_handle) !=
-		    CS_OK)
-			goto fail;
-
-		next = pos + strlen(pos) + 1;
-
-		if (!strstr(pos, "[")) {
-			/* straight path diving */
-			if (confdb_object_find
-			    (handle, *query_handle, pos, strlen(pos),
-			     &new_obj_handle) != CS_OK)
-				goto fail;
-			else {
-				confdb_object_find_destroy(handle,
-							   *query_handle);
-				*query_handle = new_obj_handle;
-			}
-		} else {
-			/*
-			 * /something[int]/ or /something[@foo="bar"]/
-			 * start and end will identify []
-			 * middle will point to the inside request
-			 */
-
-			char *start = NULL, *middle = NULL, *end = NULL;
-			char data[PATH_MAX];
-			int datalen;
-
-			/*
-			 * those ones should be always good because
-			 * the tokenizer takes care of them
-			 */
-
-			start = strstr(pos, "[");
-			if (!start)
-				goto fail;
-
-			end = strstr(pos, "]");
-			if (!end)
-				goto fail;
-
-			middle = start + 1;
-			memset(start, 0, 1);
-			memset(end, 0, 1);
-
-			if (!strcmp(pos, "child::*")) {
-				int val, i;
-
-				val = atoi(middle);
-
-				if (val < 1)
-					goto fail;
-
-				if (confdb_object_iter_start
-				    (handle, *query_handle) != CS_OK)
-					goto fail;
-
-				for (i = 1; i <= val; i++) {
-					if (confdb_object_iter
-					    (handle, *query_handle,
-					     &new_obj_handle, data,
-					     &datalen) != CS_OK)
-						goto fail;
-				}
-				confdb_object_iter_destroy(handle,
-							   *query_handle);
-				confdb_object_find_destroy(handle,
-							   *query_handle);
-				*query_handle = new_obj_handle;
-
-			} else if (!strstr(middle, "@")) {
-				/* lookup something with index num = int */
-				int val, i;
-
-				val = atoi(middle);
-
-				if (val < 1)
-					goto fail;
-
-				for (i = 1; i <= val; i++) {
-					if (confdb_object_find
-					    (handle, *query_handle, pos,
-					     strlen(pos),
-					     &new_obj_handle) != CS_OK)
-						goto fail;
-				}
-				confdb_object_find_destroy(handle,
-							   *query_handle);
-				*query_handle = new_obj_handle;
-
-			} else {
-				/* lookup something with obj foo = bar */
-				char *equal = NULL, *value = NULL, *tmp = NULL;
-				int goout = 0;
-
-				equal = strstr(middle, "=");
-				if (!equal)
-					goto fail;
-
-				memset(equal, 0, 1);
-
-				value = strstr(equal + 1, "\"");
-				if (!value)
-					goto fail;
-
-				value = value + 1;
-
-				tmp = strstr(value, "\"");
-				if (!tmp)
-					goto fail;
-
-				memset(tmp, 0, 1);
-
-				middle = strstr(middle, "@") + 1;
-				if (!middle)
-					goto fail;
-
-				// middle points to foo
-				// value to bar
-
-				memset(data, 0, PATH_MAX);
-				while (!goout) {
-					if (confdb_object_find
-					    (handle, *query_handle, pos,
-					     strlen(pos),
-					     &new_obj_handle) != CS_OK)
-						goto fail;
-					else {
-						if (confdb_key_get
-						    (handle, new_obj_handle,
-						     middle, strlen(middle),
-						     data,
-						     &datalen) == CS_OK) {
-							if (!strcmp
-							    (data, value))
-								goout = 1;
-						}
-					}
-				}
-				confdb_object_find_destroy(handle,
-							   *query_handle);
-				*query_handle = new_obj_handle;
-			}
-		}
-
-		pos = next;
-	}
-
-	return 0;
-
-fail:
-	errno = EINVAL;
-	return -1;
-}
-
-static int get_data(confdb_handle_t handle, unsigned int connection_handle,
-		    unsigned int query_handle, unsigned int *list_handle,
-		    char **rtn, char *curpos, int list, int is_oldlist)
-{
-	int datalen, cmp;
-	char data[PATH_MAX];
-	char resval[PATH_MAX];
-	char keyval[PATH_MAX];
-	int keyvallen = PATH_MAX;
-	unsigned int new_obj_handle;
-	unsigned int value = 0;
-
-	memset(data, 0, PATH_MAX);
-	memset(resval, 0, PATH_MAX);
-	memset(keyval, 0, PATH_MAX);
-
-	// we need to handle child::*[int value] in non list mode.
-	cmp = strcmp(curpos, "child::*");
-	if (cmp >= 0) {
-		char *start = NULL, *end = NULL;
-
-		// a pure child::* request should come down as list
-		if (!cmp && !list)
-			goto fail;
-
-		if (confdb_object_iter_start(handle, query_handle) != CS_OK)
-			goto fail;
-
-		if (!is_oldlist)
-			*list_handle = query_handle;
-
-		if (cmp) {
-			start = strstr(curpos, "[");
-			if (!start)
-				goto fail;
-
-			start = start + 1;
-
-			end = strstr(start, "]");
-			if (!end)
-				goto fail;
-
-			memset(end, 0, 1);
-			value = atoi(start);
-			if (value <= 0)
-				goto fail;
-		} else {
-			if (confdb_key_increment
-			    (handle, connection_handle, "iterator_tracker",
-			     strlen("iterator_tracker"), &value) != CS_OK)
-				value = 1;
-		}
-
-		while (value != 0) {
-			memset(data, 0, PATH_MAX);
-			if (confdb_object_iter
-			    (handle, query_handle, &new_obj_handle, data,
-			     &datalen) != CS_OK) {
-				reset_iterator(handle, connection_handle);
-				goto fail;
-			}
-
-			value--;
-		}
-
-		snprintf(resval, sizeof(resval), "%s=%s", data, keyval);
-		*rtn = strndup(resval, datalen + keyvallen + 2);
-
-	} else if (!strncmp(curpos, "@*", strlen("@*"))) {
-
-		// this query makes sense only if we are in list mode
-		if (!list)
-			goto fail;
-
-		if (confdb_key_iter_start(handle, query_handle) != CS_OK)
-			goto fail;
-
-		*list_handle = query_handle;
-
-		if (confdb_key_increment
-		    (handle, connection_handle, "iterator_tracker",
-		     strlen("iterator_tracker"), &value) != CS_OK)
-			value = 1;
-
-		while (value != 0) {
-			memset(data, 0, PATH_MAX);
-			if (confdb_key_iter
-			    (handle, query_handle, data, &datalen, keyval,
-			     &keyvallen) != CS_OK) {
-				reset_iterator(handle, connection_handle);
-				goto fail;
-			}
-
-			value--;
-		}
-
-		snprintf(resval, sizeof(resval), "%s=%s", data, keyval);
-		*rtn = strndup(resval, datalen + keyvallen + 2);
-
-	} else {		/* pure data request */
-		char *query;
-
-		// this query doesn't make sense in list mode
-		if (list)
-			goto fail;
-
-		if (confdb_object_find_start(handle, query_handle) != CS_OK)
-			goto fail;
-
-		query = strstr(curpos, "@");
-		if (!query)
-			goto fail;
-
-		query = query + 1;
-
-		if (confdb_key_get
-		    (handle, query_handle, query, strlen(query), data,
-		     &datalen) != CS_OK)
-			goto fail;
-
-		*rtn = strndup(data, datalen);
-	}
-
-	return 0;
-
-fail:
-	errno = EINVAL;
-	return -1;
-}
-
-/**
- * _ccs_get_xpathlite
- * @handle:
- * @connection_handle:
- * @query:
- * @list: 1 to operate in list fashion
- *
- * This function will allocate space for the value that is the result
- * of the given query.  It is the user's responsibility to ensure that
- * the data returned is freed.
- *
- * Returns: char * to result or NULL in case of failure.
- */
-char *_ccs_get_xpathlite(confdb_handle_t handle, unsigned int connection_handle,
-			 const char *query, int list)
-{
-	char current_query[PATH_MAX];
-	char *datapos, *rtn = NULL;
-	char previous_query[PATH_MAX];
-	unsigned int list_handle = 0;
-	unsigned int query_handle = 0;
-	int prev = 0, is_oldlist = 0;
-	int tokens, i;
-
-	memset(current_query, 0, PATH_MAX);
-	strncpy(current_query, query, PATH_MAX - 1);
-
-	memset(previous_query, 0, PATH_MAX);
-
-	datapos = current_query + 1;
-
-	prev =
-	    get_previous_query(handle, connection_handle, previous_query,
-			       &list_handle);
-
-	if (list && !prev && !strcmp(current_query, previous_query)) {
-		query_handle = list_handle;
-		is_oldlist = 1;
-	} else {
-		reset_iterator(handle, connection_handle);
-		query_handle = OBJECT_PARENT_HANDLE;
-	}
-
-	if (confdb_object_find_start(handle, query_handle) != CS_OK) {
-		errno = ENOENT;
-		goto fail;
-	}
-
-	tokens = tokenizer(current_query);
-	if (tokens < 1)
-		goto fail;
-
-	for (i = 1; i < tokens; i++)
-		datapos = datapos + strlen(datapos) + 1;
-
-	if (!is_oldlist)
-		if (path_dive(handle, &query_handle, current_query, tokens - 1) < 0)	/* path dive can mangle tokens */
-			goto fail;
-
-	if (get_data
-	    (handle, connection_handle, query_handle, &list_handle, &rtn,
-	     datapos, list, is_oldlist) < 0)
-		goto fail;
-
-	if (list)
-		if (set_previous_query
-		    (handle, connection_handle, (char *)query, list_handle))
-			goto fail;
-
-	return rtn;
-
-fail:
-	return NULL;
-}
diff --git a/config/man/Makefile b/config/man/Makefile
deleted file mode 100644
index bf289e0..0000000
--- a/config/man/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-TARGET= cluster.conf.5
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/man.mk
diff --git a/config/man/cluster.conf.5 b/config/man/cluster.conf.5
deleted file mode 100644
index b45d410..0000000
--- a/config/man/cluster.conf.5
+++ /dev/null
@@ -1,61 +0,0 @@
-.TH cluster.conf 5
-
-.SH NAME
-cluster.conf - configuration file for cman, fence, dlm, gfs, rgmanager
-
-.SH DESCRIPTION
-
-The \fBcluster.conf\fP file is located in the /etc/cluster directory.  It
-is the source of information used by cman, fence, dlm, gfs and rgmanager.
-It's accessed indirectly through libccs (see \fBccs(7)\fP).  This file
-contains all the information needed for the cluster to operate, such as
-what nodes are in the cluster and how to I/O fence those nodes.
-
-This man page describes the generic contents of the \fBcluster.conf\fP
-file.  For other information see man pages for cman(5), fenced(8) and
-dlm_controld(8).
-
-\fBcluster.conf\fP is an XML file.  It has one top-level \fIcluster\fP
-section containing everything else.  The cluster section has two mandatory
-attributes: \fIname\fP and \fIconfig_version\fP.  \fIname\fP can be up to
-16 characters long and specifies the name of the cluster.  It is important
-that this name is unique from other clusters the user might set up.
-\fIconfig_version\fP is a number used to identify the revision level of
-the \fBcluster.conf\fP file.  Given this information, your
-\fBcluster.conf\fP file might look something like:
-
-  <cluster name="alpha" config_version="1">
-  </cluster>
-
-.SS Nodes
-
-The set of nodes that make up the cluster are defined under the
-\fIclusternodes\fP section.  A \fIclusternode\fP section defines each
-node.  A clusternode has two mandatory attributes:
-.I name
-and
-.I nodeid
-
-The name should correspond to the hostname (the fully qualified name is
-generally not necessary) on the network interface to be used for cluster
-communication.  Nodeid's must be greater than zero and unique.
-
-  <cluster name="alpha" config_version="1">
-          <clusternodes>
-                  <clusternode name="node-01" nodeid="1">
-                  </clusternode>
-
-                  <clusternode name="node-02" nodeid="2">
-                  </clusternode>
-
-                  <clusternode name="node-03" nodeid="3">
-                  </clusternode>
-          </clusternodes>
-  </cluster>
-
-The next step in completing cluster.conf is adding fencing information;
-see fenced(8).
-
-.SH SEE ALSO
-ccs(7), ccs_tool(8), ccsd(8), cman(5), fenced(8), dlm_controld(8)
-
diff --git a/config/plugins/Makefile b/config/plugins/Makefile
deleted file mode 100644
index d39b807..0000000
--- a/config/plugins/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../../make/defines.mk
-include $(OBJDIR)/make/passthrough.mk
-
-SUBDIRS = xml ldap
diff --git a/config/plugins/ldap/99cluster.ldif b/config/plugins/ldap/99cluster.ldif
deleted file mode 100644
index 7b53a12..0000000
--- a/config/plugins/ldap/99cluster.ldif
+++ /dev/null
@@ -1,138 +0,0 @@
-# Schema for Red Hat cluster suite LDAP configuration
-# 2008, Christine Caulfield ccaulfie@redhat.com
-#
-# This schema is incomplete, and probably always will be
-#
-#
-dn: cn=schema
-attributeTypes: (
-  1.3.6.1.4.1.2312.8.1.1.1 NAME 'rhcsConfig-version'
-  DESC 'An integer describing the configuration version'
-  EQUALITY integerMatch
-  SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
-  SINGLE-VALUE
-  )
-attributeTypes: (
-  1.3.6.1.4.1.2312.8.1.1.2 NAME 'rhcsNodeid'
-  DESC 'An integer describing the node ID number'
-  EQUALITY integerMatch
-  SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
-  SINGLE-VALUE
-  )
-attributeTypes: (
-  1.3.6.1.4.1.2312.8.1.1.3 NAME 'rhcsCluster-id'
-  DESC 'An integer describing the cluster ID number'
-  EQUALITY integerMatch
-  SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
-  SINGLE-VALUE
-  )
-attributeTypes: (
-  1.3.6.1.4.1.2312.8.1.1.4 NAME 'rhcsVotes'
-  DESC 'An integer describing the number of votes a node has'
-  EQUALITY integerMatch
-  SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
-  SINGLE-VALUE
-  )
-attributeTypes: (
-  1.3.6.1.4.1.2312.8.1.1.5 NAME 'rhcsTwo-node'
-  DESC 'set to 1 for two_node mode'
-  EQUALITY integerMatch
-  SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
-  SINGLE-VALUE
-  )
-attributeTypes: (
-  1.3.6.1.4.1.2312.8.1.1.6 NAME 'rhcsExpected-votes'
-  DESC 'An integer describing the number of votes expected for the whole cluster'
-  EQUALITY integerMatch
-  SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
-  SINGLE-VALUE
-  )
-attributeTypes: (
-  1.3.6.1.4.1.2312.8.1.1.7 NAME 'rhcsMax-queued'
-  DESC 'An integer describing the maximum number of outstanding client requests to cman'
-  EQUALITY integerMatch
-  SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
-  SINGLE-VALUE
-  )
-attributeTypes: (
-  1.3.6.1.4.1.2312.8.1.1.8 NAME 'rhcsToken'
-  DESC 'An integer describing the totem token timeout'
-  EQUALITY integerMatch
-  SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
-  SINGLE-VALUE
-  )
-attributeTypes: (
-  1.3.6.1.4.1.2312.8.1.1.9 NAME 'rhcsAgent'
-  DESC 'The fencing agent to use'
-  EQUALITY caseIgnoreIA5Match
-  SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
-  SINGLE-VALUE
-  )
-attributeTypes: (
-  1.3.6.1.4.1.2312.8.1.1.10 NAME 'rhcsUsername'
-  DESC 'Username to log into the fencing agent'
-  EQUALITY caseIgnoreIA5Match
-  SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
-  SINGLE-VALUE
-  )
-attributeTypes: (
-  1.3.6.1.4.1.2312.8.1.1.11 NAME 'rhcsPassword'
-  DESC 'Password to log into the fencing agent'
-  EQUALITY caseIgnoreIA5Match
-  SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
-  SINGLE-VALUE
-  )
-attributeTypes: (
-  1.3.6.1.4.1.2312.8.1.1.12 NAME 'rhcsIpaddr'
-  DESC 'IP Address the fencing agent'
-  EQUALITY caseIgnoreIA5Match
-  SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
-  SINGLE-VALUE
-  )
-attributeTypes: (
-  1.3.6.1.4.1.2312.8.1.1.13 NAME 'rhcsPort'
-  DESC 'Port number for fence agent or cman'
-  EQUALITY IntegerMatch
-  SYNTAX 1.3.6.1.4.1.1466.115.121.1.27
-  SINGLE-VALUE
-  )
-objectClasses: ( 
-     1.3.6.1.4.1.2312.8.1.2.1 NAME 'rhcsCluster' SUP top STRUCTURAL
-     DESC 'Cluster top-level entry'
-     MUST ( cn $ name $ rhcsConfig-version )
-   )
-objectClasses: ( 
-     1.3.6.1.4.1.2312.8.1.2.2 NAME 'rhcsNode' SUP top STRUCTURAL
-     DESC 'Cluster node entry'
-     MUST ( name $ rhcsNodeid )
-     MAY rhcsVotes
-   )
-objectClasses: ( 
-     1.3.6.1.4.1.2312.8.1.2.3 NAME 'rhcsCman' SUP top STRUCTURAL
-     DESC 'Cluster node entry'
-     MUST ( cn )
-     MAY ( rhcsCluster-id $ rhcsTwo-node $ rhcsExpected-votes $ rhcsMax-queued $ rhcsPort )
-   )
-objectClasses: ( 
-     1.3.6.1.4.1.2312.8.1.2.4 NAME 'rhcsTotem' SUP top STRUCTURAL
-     DESC 'Totem options'
-     MUST ( cn )
-     MAY ( rhcsToken )
-   )
-objectClasses: ( 
-     1.3.6.1.4.1.2312.8.1.2.5 NAME 'rhcsFencedevice' SUP top STRUCTURAL
-     DESC 'A Fence device'
-     MUST ( name $ rhcsAgent )
-     MAY ( rhcsIpaddr $ rhcsUsername $ rhcsPassword )
-   )
-objectClasses: ( 
-     1.3.6.1.4.1.2312.8.1.2.6 NAME 'rhcsFenceagent' SUP top STRUCTURAL
-     DESC 'A Fence device'
-     MUST ( name )
-     MAY ( rhcsPort $ rhcsIpaddr )
-   )
-objectClasses: ( 
-     1.3.6.1.4.1.2312.8.1.2.7 NAME 'rhcsFencemethod' SUP top STRUCTURAL
-     DESC 'A Fence method placeholder'
-     MUST ( name )
-)
diff --git a/config/plugins/ldap/Makefile b/config/plugins/ldap/Makefile
deleted file mode 100644
index 33e907d..0000000
--- a/config/plugins/ldap/Makefile
+++ /dev/null
@@ -1,30 +0,0 @@
-TARGET= config_ldap.lcrso
-
-LCRSOT=$(TARGET)
-
-DOCS =	99cluster.ldif \
-	example.ldif
-
-all: ${TARGET}
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-CFLAGS += -fPIC
-CFLAGS += -I${ldapincdir}
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${ldaplibdir} -lldap
-LDFLAGS += -L${libdir}
-
-OBJS=	configldap.o
-
-${TARGET}: ${OBJS}
-	$(CC) -shared -Wl,-soname,$@ -o $@ $^ $(LDFLAGS)
-
-clean: generalclean 
-
--include $(OBJS:.o=.d)
diff --git a/config/plugins/ldap/configldap.c b/config/plugins/ldap/configldap.c
deleted file mode 100644
index 11a5250..0000000
--- a/config/plugins/ldap/configldap.c
+++ /dev/null
@@ -1,279 +0,0 @@
-#include <sys/types.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <arpa/inet.h>
-
-// CC: temp until I tame SASL ... is this necessary?
-#define LDAP_DEPRECATED 1
-#include <ldap.h>
-
-/* corosync headers */
-#include <corosync/lcr/lcr_comp.h>
-#include <corosync/engine/objdb.h>
-#include <corosync/engine/config.h>
-
-/* These are defaults. they can be overridden with environment variables
- *  LDAP_URL & LDAP_BASEDN
- */
-#define DEFAULT_LDAP_URL "ldap:///";
-#define DEFAULT_LDAP_BASEDN "dc=chrissie,dc=net"
-
-static int ldap_readconfig(struct objdb_iface_ver0 *objdb, char **error_string);
-static int init_config(struct objdb_iface_ver0 *objdb);
-static char error_reason[1024];
-static char *ldap_url = DEFAULT_LDAP_URL;
-static char *ldap_basedn = DEFAULT_LDAP_BASEDN;
-
-/*
- * Exports the interface for the service
- */
-
-static struct config_iface_ver0 ldapconfig_iface_ver0 = {
-	.config_readconfig        = ldap_readconfig
-};
-
-static struct lcr_iface ifaces_ver0[2] = {
-	{
-		.name		       	= "ldapconfig",
-		.version	       	= 0,
-		.versions_replace      	= 0,
-		.versions_replace_count	= 0,
-		.dependencies	       	= 0,
-		.dependency_count      	= 0,
-		.constructor	       	= NULL,
-		.destructor	       	= NULL,
-		.interfaces	       	= NULL,
-	}
-};
-
-static struct lcr_comp ldap_comp_ver0 = {
-	.iface_count				= 1,
-	.ifaces					= ifaces_ver0,
-};
-
-
-
-__attribute__ ((constructor)) static void ldap_comp_register(void) {
-	lcr_interfaces_set(&ifaces_ver0[0], &ldapconfig_iface_ver0);
-	lcr_component_register(&ldap_comp_ver0);
-};
-
-static int ldap_readconfig(struct objdb_iface_ver0 *objdb, char **error_string)
-{
-	int ret;
-
-	/* Read config tree from LDAP */
-	if (!(ret = init_config(objdb)))
-	    sprintf(error_reason, "%s", "Successfully read config from LDAP\n");
-
-        *error_string = error_reason;
-
-	return ret;
-}
-
-/*
- * Convert hyphens to underscores in all attribute names
- */
-static void convert_underscores(char *s, int len)
-{
-	int j;
-
-	for (j=0; j < len; j++) {
-		if (s[j] == '-')
-			s[j] = '_';
-	}
-}
-
-static void convert_dn_underscores(LDAPDN dn)
-{
-	int i=0;
-
-	while (dn[i]) {
-		convert_underscores(dn[i][0][0].la_attr.bv_val, dn[i][0][0].la_attr.bv_len);
-		i++;
-	}
-}
-
-/*
- * Return the parent object of a DN.
- * Actually, this returns the LAST parent with that name. which should (!) be correct.
- */
-static unsigned int find_parent(struct objdb_iface_ver0 *objdb, LDAPDN dn, int startdn, char *parent)
-{
-	int i=startdn;
-	int gotstart=0;
-	int start=0, end=startdn;
-	unsigned int parent_handle = OBJECT_PARENT_HANDLE;
-	unsigned int object_handle=0;
-	unsigned int find_handle;
-
-	/*
-	 * Find the start and end positions first.
-	 * start is where the 'parent' entry is.
-	 * end   is the end of the list
-	 */
-	do {
-		if (!gotstart && dn[i][0][0].la_value.bv_len == 7 &&
-		    !strncmp(parent, dn[i][0][0].la_value.bv_val, 7)) {
-			gotstart = 1;
-			start = i;
-		}
-		i++;
-	} while (dn[i]);
-	if (start <= 0)
-		return parent_handle;
-
-	for (i=start; i>=end; i--) {
-		objdb->object_find_create(parent_handle,
-					     dn[i][0][0].la_value.bv_val, dn[i][0][0].la_value.bv_len,
-					     &find_handle);
-		while (!objdb->object_find_next(find_handle, &object_handle)) {
-			parent_handle = object_handle;
-		}
-		objdb->object_find_destroy(find_handle);
-	}
-	return object_handle;
-}
-
-
-
-static int read_config_for(LDAP *ld, struct objdb_iface_ver0 *objdb, unsigned int parent,
-			   char *object, char *sub_dn, int always_create)
-{
-	char search_dn[4096];
-	int rc;
-	char *dn;
-	LDAPMessage *result, *e;
-	unsigned int parent_handle = OBJECT_PARENT_HANDLE;
-	unsigned int object_handle;
-
-	sprintf(search_dn, "%s,%s", sub_dn, ldap_basedn);
-
-	/* Search the whole tree from the base DN provided */
-	rc = ldap_search_ext_s(ld, search_dn, LDAP_SCOPE_SUBTREE, "(objectClass=*)", NULL, 0,
-			       NULL, NULL, NULL, 0, &result);
-	if (rc != LDAP_SUCCESS) {
-		sprintf(error_reason, "ldap_search_ext_s: %s\n", ldap_err2string(rc));
-		if (rc == LDAP_NO_SUCH_OBJECT)
-			return 0;
-		else
-			return -1;
-	}
-	for (e = ldap_first_entry(ld, result); e != NULL;
-	     e = ldap_next_entry(ld, e)) {
-		if ((dn = ldap_get_dn(ld, e)) != NULL) {
-			char *attr;
-			BerElement *attr_ber;
-			LDAPDN parsed_dn;
-
-			/* Make it parsable so we can discern the hierarchy */
-			if (ldap_str2dn(dn, &parsed_dn, LDAP_DN_PEDANTIC)) {
-				sprintf(error_reason, "ldap_str2dn failed: %s\n", ldap_err2string(rc));
-				return -1;
-			}
-
-			/*
-			 * LDAP doesn't allow underscores in dn names so we replace hypens with
-			 * underscores so we can have thing like config_version, appear as
-			 * config-version in ldap
-			 */
-			convert_dn_underscores(parsed_dn);
-
-			/* Create a new object if the top-level is NOT name= */
-			if (strncmp(parsed_dn[0][0][0].la_attr.bv_val, "name", 4)) {
-				parent_handle = find_parent(objdb, parsed_dn, 0, object);
-
-				objdb->object_create(parent_handle, &object_handle, parsed_dn[0][0][0].la_value.bv_val,
-						     parsed_dn[0][0][0].la_value.bv_len);
-			}
-			else {
-				parent_handle = find_parent(objdb, parsed_dn, 2, object);
-				/* Create a new object with the same name as the current one */
-				objdb->object_create(parent_handle, &object_handle, parsed_dn[1][0][0].la_value.bv_val,
-						     parsed_dn[1][0][0].la_value.bv_len);
-			}
-
-			/* Finished with the text representation */
-			ldap_memfree(dn);
-
-			/* Store the attributes as keys */
-			attr = ldap_first_attribute(ld, e, &attr_ber);
-			while (attr) {
-				int i;
-				struct berval **val_ber;
-
-				val_ber = ldap_get_values_len(ld, e, attr);
-				i=0;
-				while (val_ber[i]) {
-					/*
-					 * If the attribute starts "rhcs" then remove that bit
-					 * and make the first letter lower case so it matches the
-					 * cluster.conf entry.
-					 * so, after the above underscore change too:
-					 *   eg 'rhcsConfig-version' becomes 'config_version'. magic!
-					 */
-					if (strncmp(attr, "rhcs", 4) == 0) {
-						memmove(attr, attr+4, strlen(attr+4)+1);
-						attr[0] |= 0x60;
-					}
-					convert_underscores(attr, strlen(attr));
-
-					/*
-					 * Add a key - but ignore "objectClass" & "cn" attributes
-					 * as they don't provide anything we can use
-					 */
-					if (strcmp("objectClass", attr) &&
-					    strcmp("cn", attr)) {
-						objdb->object_key_create(object_handle, attr, strlen(attr),
-									 val_ber[i]->bv_val,
-									 val_ber[i]->bv_len+1);
-					}
-					i++;
-				}
-				ldap_memfree(attr);
-				attr = ldap_next_attribute(ld, e, attr_ber);
-				ldap_value_free_len(val_ber);
-			}
-			ldap_memfree(attr);
-			ber_free(attr_ber, 0);
-		}
-	}
-	ldap_msgfree(result);
-
-	return 0;
-}
-
-/* The real work starts here */
-static int init_config(struct objdb_iface_ver0 *objdb)
-{
-	LDAP *ld;
-	int version, rc;
-
-	if (getenv("COROSYNC_LDAP_URL"))
-		ldap_url = getenv("COROSYNC_LDAP_URL");
-	if (getenv("COROSYNC_LDAP_BASEDN"))
-		ldap_basedn = getenv("COROSYNC_LDAP_BASEDN");
-
-	/* Connect to the LDAP server */
-	if (ldap_initialize(&ld, ldap_url)) {
-		sprintf(error_reason, "ldap_simple_bind failed: %s\n", strerror(errno));
-		return -1;
-	}
-	version = LDAP_VERSION3;
-	ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &version);
-
-	/*
-	 * CC: Do I need to use sasl ?!
-	 */
-	rc = ldap_simple_bind_s(ld, getenv("COROSYNC_LDAP_BINDDN"), getenv("COROSYNC_LDAP_BINDPWD"));
-	if (rc != LDAP_SUCCESS) {
-		sprintf(error_reason, "ldap_simple_bind failed: %s\n", ldap_err2string(rc));
-		return -1;
-	}
-
-	rc = read_config_for(ld, objdb, OBJECT_PARENT_HANDLE, "cluster", "cn=cluster", 1);
-
-	ldap_unbind(ld);
-	return 0;
-}
diff --git a/config/plugins/ldap/example.ldif b/config/plugins/ldap/example.ldif
deleted file mode 100644
index 0182dcf..0000000
--- a/config/plugins/ldap/example.ldif
+++ /dev/null
@@ -1,137 +0,0 @@
-# Example cluster LDIF file
-# Christine Caulfield <ccaulfie@redhat.com>
-#
-# You WILL need to change this to suit your needs, in particular a search
-# and replace of dc=chrissie,dc=net with your own domanin name.
-#
-# Load with:
-#  ldapmodify -x -a -D"cn=Directory Manager" -f example.ldif -c -v -W
-#
-#
-# What follows is the LDAP equivalent of the following cluster.conf file:
-#
-#<totem token="21000"/>
-#
-#<cluster config_version="1"  name="cc_cluster">
-#  <cman cluster_id="444"/>
-#
-#  <fencedevices>
-#        <fencedevice name="myapc"
-#            password="apc"
-#            username="apc"
-#            ipaddr="myapc.chrissie.net"
-#            agent="fence_apc"
-#        </fencedevice>
-#  </fencedevice>
-#  <clusternodes>
-#    <clusternode name="ford"
-#                 votes="1"
-#            	  nodeid="32">
-#		  <fence>
-#                    <method name="apc">
-# 		       <device name="myapc" port="4"/>
-#		     </method>
-#                 </fence>
-#    </clusternode>
-#
-#    <clusternode name="arthur"
-#                 votes="1"
-#            	  nodeid="10">
-#    </clusternode>
-#
-#    <clusternode name="jeltz"
-#                 votes="2"
-#            	  nodeid="1">
-#    </clusternode>
-#  </clusternodes>
-#</cluster>
-#
-#
-
-dn: cn=cluster,dc=chrissie,dc=net
-cn: cluster
-objectClass: rhcsCluster
-name: cc_cluster
-rhcsConfig-version: 1
-
-# Some cman parameters
-dn: cn=cman,cn=cluster,dc=chrissie,dc=net
-cn: cman
-objectClass: rhcsCman
-rhcsCluster-id: 444
-
-# Some totem parameters
-dn: cn=totem,cn=cluster,dc=chrissie,dc=net
-cn: totem
-objectClass: rhcsTotem
-rhcsToken: 21000
-
-# Define nodes
-dn: cn=clusternodes,cn=cluster,dc=chrissie,dc=net
-cn: clusternodes
-objectClass: nsContainer
-
-
-dn: cn=clusternode,cn=clusternodes,cn=cluster,dc=chrissie,dc=net
-cn: clusternode
-objectClass: nsContainer
-
-
-dn: name=jeltz,cn=clusternode,cn=clusternodes,cn=cluster,dc=chrissie,dc=net
-objectClass: rhcsNode
-name: jeltz
-rhcsNodeid: 1
-rhcsVotes: 2
-
-# Define a fence agent for this node ...!
-dn: cn=fence,name=jeltz,cn=clusternode,cn=clusternodes,cn=cluster,dc=chrissie,dc=net
-cn: fence
-objectclass: nsContainer
-
-dn: cn=method,cn=fence,name=jeltz,cn=clusternode,cn=clusternodes,cn=cluster,dc=chrissie,dc=net
-cn: method
-objectclass: nsContainer
-
-dn: name=apc,cn=method,cn=fence,name=jeltz,cn=clusternode,cn=clusternodes,cn=cluster,dc=chrissie,dc=net
-name: apc
-objectclass: rhcsFenceMethod
-
-dn: cn=device,name=apc,cn=method,cn=fence,name=jeltz,cn=clusternode,cn=clusternodes,cn=cluster,dc=chrissie,dc=net
-cn: device
-objectclass: nsContainer
-
-dn: name=myapc,cn=device,name=apc,cn=method,cn=fence,name=jeltz,cn=clusternode,cn=clusternodes,cn=cluster,dc=chrissie,dc=net
-name: myapc
-objectclass: rhcsFenceAgent
-rhcsPort: 4
-
-dn: name=arthur,cn=clusternode,cn=clusternodes,cn=cluster,dc=chrissie,dc=net
-objectClass: rhcsNode
-name: arthur
-rhcsNodeid: 10
-rhcsVotes: 1
-
-dn: name=ford,cn=clusternode,cn=clusternodes,cn=cluster,dc=chrissie,dc=net
-objectClass: rhcsNode
-name: ford
-rhcsNodeid: 32
-rhcsVotes: 1
-
-# Fence agent
-
-dn: cn=fencedevices,cn=cluster,dc=chrissie,dc=net
-cn: fencedevices
-objectClass: nsContainer
-
-dn: cn=fencedevice,cn=fencedevices,cn=cluster,dc=chrissie,dc=net
-cn: fencedevice
-objectClass: nsContainer
-
-
-dn: name=myapc,cn=fencedevice,cn=fencedevices,cn=cluster,dc=chrissie,dc=net
-objectClass: rhcsFencedevice
-name: myapc
-rhcsAgent: fence_apc
-rhcsIpaddr: myapc.chrissie.net
-rhcsUsername: apc
-rhcsPassword: apc
diff --git a/config/plugins/xml/Makefile b/config/plugins/xml/Makefile
deleted file mode 100644
index b95d005..0000000
--- a/config/plugins/xml/Makefile
+++ /dev/null
@@ -1,28 +0,0 @@
-TARGET= config_xml.lcrso
-
-LCRSOT=$(TARGET)
-
-all: ${TARGET}
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-CFLAGS += -fPIC -D_GNU_SOURCE
-CFLAGS += `xml2-config --cflags`
-CFLAGS += -I${cmanincdir}/../daemon
-CFLAGS += -I${incdir}
-
-LDFLAGS += `xml2-config --libs`
-LDFLAGS += -L${libdir}
-
-OBJS=	config.o
-
-${TARGET}: ${OBJS}
-	$(CC) -shared -Wl,-soname,$@ -o $@ $^ $(LDFLAGS)
-
-clean: generalclean 
-
--include $(OBJS:.o=.d)
diff --git a/config/plugins/xml/config.c b/config/plugins/xml/config.c
deleted file mode 100644
index 9da448b..0000000
--- a/config/plugins/xml/config.c
+++ /dev/null
@@ -1,150 +0,0 @@
-#include <string.h>
-#include <syslog.h>
-
-#include <libxml/tree.h>
-
-#include <corosync/lcr/lcr_comp.h>
-#include <corosync/engine/objdb.h>
-#include <corosync/engine/config.h>
-
-#include "logging.h"
-
-static int xml_readconfig(struct objdb_iface_ver0 *objdb, char **error_string);
-static int xml_reloadconfig(struct objdb_iface_ver0 *objdb, int flush,
-			    char **error_string);
-static int init_config(struct objdb_iface_ver0 *objdb, char *configfile,
-		       char *error_string);
-static char error_reason[1024];
-
-#define DEFAULT_CONFIG DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE
-
-/*
- * Exports the interface for the service
- */
-
-static struct config_iface_ver0 xmlconfig_iface_ver0 = {
-	.config_readconfig = xml_readconfig,
-	.config_reloadconfig = xml_reloadconfig
-};
-
-static struct lcr_iface ifaces_ver0[2] = {
-	{
-	 .name = "xmlconfig",
-	 .version = 0,
-	 .versions_replace = 0,
-	 .versions_replace_count = 0,
-	 .dependencies = 0,
-	 .dependency_count = 0,
-	 .constructor = NULL,
-	 .destructor = NULL,
-	 .interfaces = NULL,
-	 }
-};
-
-static struct lcr_comp xml_comp_ver0 = {
-	.iface_count = 1,
-	.ifaces = ifaces_ver0,
-};
-
-__attribute__ ((constructor))
-static void xml_comp_register(void)
-{
-	lcr_interfaces_set(&ifaces_ver0[0], &xmlconfig_iface_ver0);
-	lcr_component_register(&xml_comp_ver0);
-};
-
-static void addkeys(xmlAttrPtr tmpattr, struct objdb_iface_ver0 *objdb,
-		    unsigned int object_handle)
-{
-	for (tmpattr = tmpattr; tmpattr; tmpattr = tmpattr->next) {
-		if (tmpattr->type == XML_ATTRIBUTE_NODE)
-			objdb->object_key_create(object_handle,
-						 (char *)tmpattr->name,
-						 strlen((char *)tmpattr->name),
-						 (char *)tmpattr->children->
-						 content,
-						 strlen((char *)tmpattr->
-							children->content) + 1);
-	}
-}
-
-static void xml2objdb(xmlNodePtr tmpnode, struct objdb_iface_ver0 *objdb,
-		      unsigned int parent)
-{
-	unsigned int object_handle = 0;
-
-	for (tmpnode = tmpnode; tmpnode; tmpnode = tmpnode->next) {
-		if (tmpnode->type == XML_ELEMENT_NODE) {
-			objdb->object_create(parent, &object_handle,
-					     (char *)tmpnode->name,
-					     strlen((char *)tmpnode->name));
-			if (tmpnode->properties)
-				addkeys(tmpnode->properties, objdb,
-					object_handle);
-		}
-		xml2objdb(tmpnode->children, objdb, object_handle);
-	}
-}
-
-static int xml_reloadconfig(struct objdb_iface_ver0 *objdb, int flush,
-			    char **error_string)
-{
-	return xml_readconfig(objdb, error_string);
-}
-
-static int xml_readconfig(struct objdb_iface_ver0 *objdb, char **error_string)
-{
-	int ret = 0;
-	char *configfile = DEFAULT_CONFIG;
-
-	/* We need to set this up to internal defaults too early */
-	openlog("corosync", LOG_CONS | LOG_PID, SYSLOGFACILITY);
-
-	if (getenv("COROSYNC_CLUSTER_CONFIG_FILE"))
-		configfile = getenv("COROSYNC_CLUSTER_CONFIG_FILE");
-
-	/* Read low-level totem/aisexec etc config from cluster.conf */
-	if (!(ret = init_config(objdb, configfile, error_reason)))
-		sprintf(error_reason, "Successfully read config from %s\n",
-			configfile);
-	else
-		sprintf(error_reason, "Unable to read config from %s\n",
-			configfile);
-
-	*error_string = error_reason;
-
-	return ret;
-}
-
-static int init_config(struct objdb_iface_ver0 *objdb, char *configfile,
-		       char *error_string)
-{
-	int err = 0;
-	xmlDocPtr doc = NULL;
-	xmlNodePtr root_node = NULL;
-
-	/* openfile */
-
-	doc = xmlParseFile(configfile);
-	if (!doc) {
-		err = -1;
-		goto fail;
-	}
-
-	root_node = xmlDocGetRootElement(doc);
-	if (!root_node) {
-		err = -1;
-		goto fail;
-	}
-
-	/* load it in objdb */
-	xml2objdb(root_node, objdb, OBJECT_PARENT_HANDLE);
-
-fail:
-	if (doc)
-		xmlFreeDoc(doc);
-
-	xmlCleanupParser();
-
-	return err;
-}
diff --git a/config/tools/Makefile b/config/tools/Makefile
deleted file mode 100644
index 04cc742..0000000
--- a/config/tools/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../../make/defines.mk
-include $(OBJDIR)/make/passthrough.mk
-
-SUBDIRS=ccs_tool ldap man
diff --git a/config/tools/ccs_tool/Makefile b/config/tools/ccs_tool/Makefile
deleted file mode 100644
index c363b73..0000000
--- a/config/tools/ccs_tool/Makefile
+++ /dev/null
@@ -1,41 +0,0 @@
-TARGET1 = ccs_tool
-TARGET2 = ccs_test
-
-SBINDIRT = $(TARGET1)
-SBINSYMT = $(TARGET2)
-
-include ../../../make/defines.mk
-
-all: ${TARGET1} ${TARGET2}
-
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-OBJS =	ccs_tool.o \
-	editconf.o
-
-CFLAGS += -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
-CFLAGS += -I${cmanincdir} `xml2-config --cflags`
-CFLAGS += -I${ccsincdir} -I$(SRCDIR)/config/daemons/ccsd
-CFLAGS += -I$(SRCDIR)/config/libs/libccscompat
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${cmanlibdir} -lcman
-LDFLAGS += -L${ccslibdir} -lccs
-LDFLAGS += `xml2-config --libs`
-LDFLAGS += -L${libdir}
-
-${TARGET1}: ${OBJS} ${LDDEPS}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-${TARGET2}: ${TARGET1}
-	ln -sf ${TARGET1} ${TARGET2}
-
-depends:
-	$(MAKE) -C $(OBJDIR)/cman/lib all
-
-clean: generalclean
-
--include $(OBJS:.o=.d)
diff --git a/config/tools/ccs_tool/ccs_tool.c b/config/tools/ccs_tool/ccs_tool.c
deleted file mode 100644
index 2850b40..0000000
--- a/config/tools/ccs_tool/ccs_tool.c
+++ /dev/null
@@ -1,296 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <getopt.h>
-#include <string.h>
-#include <errno.h>
-
-#include "copyright.cf"
-#include "editconf.h"
-#include "ccs.h"
-
-
-/*
- * Old libccs retruned -error (mostly!) but didn't set errno (sigh)
- * New libccs sets errno correctly
- */
-static char *errstring(int retcode)
-{
-	return strerror(errno);
-}
-
-static void tool_print_usage(FILE *stream);
-
-int globalverbose=0;
-
-static void test_print_usage(FILE *stream);
-
-static int test_main(int argc, char *argv[], int old_format){
-  int desc=0;
-  int i=0;
-  int error = 0;
-  int force = 0, blocking = 0;
-  char *str=NULL;
-  char *cluster_name = NULL;
-
-  if(argc <= 1){
-    test_print_usage(stderr);
-    exit(EXIT_FAILURE);
-  }
-
-  for(i=1; i < argc; i++){
-    if(!strcmp(argv[i], "-h")){
-      test_print_usage(stdout);
-      exit(EXIT_SUCCESS);
-    }
-    if(!strcmp(argv[i], "-V")){
-      printf("%s %s (built %s %s)\n", argv[0], RELEASE_VERSION, __DATE__, __TIME__);
-      printf("%s\n", REDHAT_COPYRIGHT);
-      exit(EXIT_SUCCESS);
-    }
-  }
-
-  if(!strcmp(argv[1], "connect")){
-    for(i=2; i < argc; i++){
-      if(!strcmp(argv[i], "force")){
-	printf("Force is set.\n");
-	force = 1;
-      } else if(!strcmp(argv[i], "block")){
-	printf("Blocking is set.\n");
-	blocking = 1;
-      } else {
-	cluster_name = argv[i];
-	printf("Setting cluster name to %s\n", cluster_name);
-      }
-    }
-    if(blocking && !force){
-      fprintf(stderr, "Blocking can only be used with \"force\".\n");
-      exit(EXIT_FAILURE);
-    }
-    if(force){
-      desc = ccs_force_connect(cluster_name, blocking);
-    } else {
-      if(cluster_name){
-	fprintf(stderr, "A cluster name can only be specified when using 'force'.\n");
-	exit(EXIT_FAILURE);
-      }
-      desc = ccs_connect();
-    }
-    if(desc < 0){
-      fprintf(stderr, "ccs_connect failed: %s\n", errstring(-desc));
-      exit(EXIT_FAILURE);
-    } else {
-      printf("Connect successful.\n");
-      printf(" Connection descriptor = %d\n", desc);
-      ccs_disconnect(desc);
-    }
-  }
-  else if(!strcmp(argv[1], "disconnect")){
-    if(argc < 3){
-      fprintf(stderr, "Wrong number of arguments.\n");
-      exit(EXIT_FAILURE);
-    }
-    desc = ccs_connect();
-    if((error = ccs_disconnect(desc))){
-      fprintf(stderr, "ccs_disconnect failed: %s\n", errstring(-error));
-      exit(EXIT_FAILURE);
-    } else {
-      printf("Disconnect successful.\n");
-    }
-  }
-  else if(!strcmp(argv[1], "get")){
-    if(argc < 4){
-      fprintf(stderr, "Wrong number of arguments.\n");
-      exit(EXIT_FAILURE);
-    }
-    desc = ccs_connect();
-    if((desc < 0) || (error = ccs_get(desc, argv[3], &str))){
-      fprintf(stderr, "ccs_get failed: %s\n", errstring(-error));
-      exit(EXIT_FAILURE);
-    } else {
-	    if (old_format) {
-		    printf("Get successful.\n");
-		    printf(" Value = <%s>\n", str);
-	    }
-	    else {
-		    printf("%s\n", str);
-	    }
-      if(str)free(str);
-      ccs_disconnect(desc);
-    }
-  }
-  else {
-    fprintf(stderr, "Unknown command: %s\n", argv[1]);
-    exit(EXIT_FAILURE);
-  }
-
-  exit(EXIT_SUCCESS);
-}
-
-static void test_print_usage(FILE *stream)
-{
-	fprintf(stream,
-	  "Usage:\n"
-	  "\n"
-	  "ccs_test [Options] <Command>\n"
-	  "\n"
-	  "Options:\n"
-	  "  -h                        Print usage.\n"
-	  "  -V                        Print version information.\n"
-	  "\n"
-	  "Commands:\n"
-	  "  connect <force> <block>   Connect to CCS and return connection descriptor.\n"
-	  "  disconnect <desc>         Disconnect from CCS.\n"
-	  "  get <desc> <request>      Get a value from CCS.\n"
-	  );
-}
-
-static int xpath_query(int argc, char **argv)
-{
-	int handle;
-	char *ret;
-	int i;
-
-	if (argc < 2) {
-		fprintf(stderr,
-			"Usage:\n"
-			"\n"
-			"ccs_tool query <xpath query>\n");
-		return 1;
-	}
-
-	/* Tell the library we want full XPath parsing */
-	fullxpath = 1;
-
-	handle = ccs_connect();
-
-	/* Process all the queries on the command-line */
-	for (i=1; i<argc; i++) {
-		if (!ccs_get(handle, argv[1], &ret)) {
-			printf("%s\n", ret);
-			free(ret);
-		}
-		else {
-			fprintf(stderr, "Query failed: %s\n", strerror(errno));
-			ccs_disconnect(handle);
-			return -1;
-		}
-	}
-	ccs_disconnect(handle);
-	return 0;
-}
-
-static int tool_main(int argc, char *argv[])
-{
-  optind = 1;
-
-  if (argc < 2 || !strcmp(argv[optind], "-h")) {
-      tool_print_usage(stdout);
-      exit(EXIT_SUCCESS);
-  }
-  if (!strcmp(argv[optind], "-V")) {
-      printf("%s %s (built %s %s)\n", argv[0], RELEASE_VERSION,
-	     __DATE__, __TIME__);
-      printf("%s\n", REDHAT_COPYRIGHT);
-      exit(EXIT_SUCCESS);
-  }
-
-  if(optind < argc){
-    if(!strcmp(argv[optind], "-verbose")){
-      optind++;
-      globalverbose=1;
-    }
-    if(!strcmp(argv[optind], "help")){
-      tool_print_usage(stdout);
-      exit(EXIT_SUCCESS);
-    }
-    else if(!strcmp(argv[optind], "query")){
-	    return xpath_query(argc-1, argv+1);
-    }
-    else if(!strcmp(argv[optind], "addnode")){
-	    add_node(argc-1, argv+1);
-	    exit(EXIT_SUCCESS);
-    }
-    else if(!strcmp(argv[optind], "delnode")){
-	    del_node(argc-1, argv+1);
-	    exit(EXIT_SUCCESS);
-    }
-    else if(!strcmp(argv[optind], "addfence")){
-	    add_fence(argc-1, argv+1);
-	    exit(EXIT_SUCCESS);
-    }
-    else if(!strcmp(argv[optind], "delfence")){
-	    del_fence(argc-1, argv+1);
-	    exit(EXIT_SUCCESS);
-    }
-    else if(!strcmp(argv[optind], "lsnode")){
-	    list_nodes(argc-1, argv+1);
-	    exit(EXIT_SUCCESS);
-    }
-    else if(!strcmp(argv[optind], "lsfence")){
-	    list_fences(argc-1, argv+1);
-	    exit(EXIT_SUCCESS);
-    }
-    else if(!strcmp(argv[optind], "create")){
-	    create_skeleton(argc-1, argv+1);
-	    exit(EXIT_SUCCESS);
-    }
-    else if(!strcmp(argv[optind], "addnodeids")){
-	    add_nodeids(argc-1, argv+1);
-	    exit(EXIT_SUCCESS);
-    }
-
-    else {
-      fprintf(stderr, "Unknown command, %s.\n"
-	      "Try 'ccs_tool help' for help.\n", argv[optind]);
-      exit(EXIT_FAILURE);
-    }
-  } else {
-    fprintf(stderr, "Too few arguments.\n"
-	    "Try 'ccs_tool help' for help.\n");
-    exit(EXIT_FAILURE);
-  }
-  exit(EXIT_SUCCESS);
-}
-
-static void tool_print_usage(FILE *stream){
-  fprintf(stream,
-	  "Usage:\n"
-	  "  ccs_tool [options] <command>\n"
-	  "\n"
-	  "Options:\n"
-	  "  -verbose            Make some operations print more details.\n"
-	  "  -h                  Print this usage and exit.\n"
-	  "  -V                  Print version information and exit.\n"
-	  "\n"
-	  "Commands:\n"
-	  "  help                Print this usage and exit.\n"
-	  "  query <xpath query> Query the cluster configuration.\n"
-	  "  addnode <node>      Add a node\n"
-          "  delnode <node>      Delete a node\n"
-          "  lsnode              List nodes\n"
-          "  lsfence             List fence devices\n"
-	  "  addfence <fencedev> Add a new fence device\n"
-	  "  delfence <fencedev> Delete a fence device\n"
-	  "  create              Create a skeleton config file\n"
-	  "  addnodeids          Assign node ID numbers to all nodes\n"
-	  "\n");
-}
-
-
-int main(int argc, char *argv[])
-{
-	char *name = strdup(argv[0]);
-
-	/*
-	 * Don't be anal about the binary name.
-	 * We expect either 'ccs_tool' or 'ccs_test',
-	 * but interpret anything other than 'ccs_test'
-	 * as 'ccs_tool'.
-	 * That's not a bug, it's a feature.
-	 */
-
-	if (strcmp(basename(name), "ccs_test") == 0)
-		return test_main(argc, argv, 1);
-	else
-		return tool_main(argc, argv);
-}
diff --git a/config/tools/ccs_tool/editconf.c b/config/tools/ccs_tool/editconf.c
deleted file mode 100644
index 86fa65e..0000000
--- a/config/tools/ccs_tool/editconf.c
+++ /dev/null
@@ -1,1248 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <getopt.h>
-#include <errno.h>
-#include <assert.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-
-#include <libxml/tree.h>
-
-#define MAX_NODES 256
-
-char *prog_name = "ccs_tool";
-
-#define die(fmt, args...) \
-do { \
-	fprintf(stderr, "%s: ", prog_name); \
-	fprintf(stderr, fmt "\n", ##args); \
-	exit(EXIT_FAILURE); \
-} while (0)
-
-
-struct option_info
-{
-	char *name;
-	char *altname;
-	char *votes;
-	char *nodeid;
-	char *mcast_addr;
-	char *fence_type;
-	char *configfile;
-	char *outputfile;
-	int  do_delete;
-	int  tell_ccsd;
-	int  force_ccsd;
-};
-
-static void config_usage(int rw)
-{
-	fprintf(stderr, " -c --configfile    Name of configuration file (" DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE ")\n");
-	if (rw)
-	{
-		fprintf(stderr, " -o --outputfile    Name of output file (defaults to same as --configfile)\n");
-		fprintf(stderr, " -C --no_ccs        Don't tell CCSD about this change\n");
-		fprintf(stderr, "                    default: run \"ccs_tool update\" if file is updated in place)\n");
-		fprintf(stderr, " -F --force_ccs     Force \"ccs_tool upgrade\" even if input & output files differ\n");
-	}
-}
-
-static void help_usage(void)
-{
-	fprintf(stderr, " -h --help          Display this help text\n");
-}
-
-static void list_usage(const char *name)
-{
-	fprintf(stderr, "Usage: %s %s [options]\n", prog_name, name);
-	fprintf(stderr, " -v --verbose       Print all properties of the item\n");
-	config_usage(0);
-	help_usage();
-
-	exit(0);
-}
-
-static void create_usage(const char *name)
-{
-	fprintf(stderr, "Usage: %s %s [-2] <clustername>\n", prog_name, name);
-	fprintf(stderr, " -2                 Create a 2-node cman cluster config file\n");
-	config_usage(0);
-	help_usage();
-	fprintf(stderr, "\n"
-	  "Note that \"create\" on its own will not create a valid configuration file.\n"
-	  "Fence agents and nodes will need to be added to it before handing it over\n"
-	  "to ccsd.\n"
-	  "\n"
-	  "eg:\n"
-	  "  ccs_tool create MyCluster\n"
-	  "  ccs_tool addfence apc fence_apc ipaddr=apc.domain.net user=apc password=apc\n"
-	  "  ccs_tool addnode node1 -n 1 -f apc port=1\n"
-	  "  ccs_tool addnode node2 -n 2 -f apc port=2\n"
-	  "  ccs_tool addnode node3 -n 3 -f apc port=3\n"
-	  "  ccs_tool addnode node4 -n 4 -f apc port=4\n"
-          "\n");
-
-	exit(0);
-}
-
-static void addfence_usage(const char *name)
-{
-	fprintf(stderr, "Usage: %s %s [options] <name> <agent> [param=value]\n", prog_name, name);
-	config_usage(1);
-	help_usage();
-
-	exit(0);
-}
-
-static void delfence_usage(const char *name)
-{
-	fprintf(stderr, "Usage: %s %s [options] <name>\n", prog_name, name);
-	config_usage(1);
-	help_usage();
-	fprintf(stderr, "\n");
-	fprintf(stderr, "%s will allow you to remove a fence device that is in use by nodes.\n", name);
-	fprintf(stderr, "This is to allow changes to be made, but be aware that it may produce an\n");
-	fprintf(stderr, "invalid configuration file if you don't add it back in again.\n");
-
-	exit(0);
-}
-
-static void delnode_usage(const char *name)
-{
-	fprintf(stderr, "Usage: %s %s [options] <name>\n", prog_name, name);
-	config_usage(1);
-	help_usage();
-
-	exit(0);
-}
-
-static void addnodeid_usage(const char *name)
-{
-	fprintf(stderr, "Add node IDs to all nodes in the config file that don't have them.\n");
-	fprintf(stderr, "Nodes with IDs will not be afftected, so you can run this as many times\n");
-	fprintf(stderr, "as you like without doing any harm.\n");
-	fprintf(stderr, "It will optionally add a multicast address to the cluster config too.\n");
-	fprintf(stderr, "\n");
-	fprintf(stderr, "Usage: %s %s [options] <name>\n", prog_name, name);
-	fprintf(stderr, " -n --nodeid        Nodeid to start with (default 1)\n");
-	fprintf(stderr, " -m --multicast     Set or change the multicast address\n");
-	fprintf(stderr, " -v --verbose       Print nodeids that are assigned\n");
-	config_usage(1);
-	help_usage();
-
-	exit(0);
-}
-
-static void addnode_usage(const char *name)
-{
-	fprintf(stderr, "Usage: %s %s [options] <nodename> [<fencearg>=<value>]...\n", prog_name, name);
-	fprintf(stderr, " -n --nodeid        Nodeid (required)\n");
-	fprintf(stderr, " -v --votes         Number of votes for this node (default 1)\n");
-	fprintf(stderr, " -a --altname       Alternative name/interface for multihomed hosts\n");
-	fprintf(stderr, " -f --fence_type    Type of fencing to use\n");
-	config_usage(1);
-	help_usage();
-
-	fprintf(stderr, "\n");
-	fprintf(stderr, "Examples:\n");
-	fprintf(stderr, "\n");
-	fprintf(stderr, "Add a new node to default configuration file:\n");
-	fprintf(stderr, "  %s %s -n 1 -f manual ipaddr=newnode\n", prog_name, name);
-	fprintf(stderr, "\n");
-	fprintf(stderr, "Add a new node and dump config file to stdout rather than save it\n");
-	fprintf(stderr, "  %s %s -n 2 -f apc -o- newnode.temp.net port=1\n", prog_name, name);
-
-	exit(0);
-}
-
-/* Is it really ?
- * Actually, we don't check that this is a valid multicast address(!),
- * merely that it is a valid IP[46] address.
- */
-static int valid_mcast_addr(char *mcast)
-{
-        struct addrinfo *ainfo;
-        struct addrinfo ahints;
-	int ret;
-
-        memset(&ahints, 0, sizeof(ahints));
-
-        ret = getaddrinfo(mcast, NULL, &ahints, &ainfo);
-	if (ret) {
-		freeaddrinfo(ainfo);
-		return 0;
-	}
-	return 1;
-}
-
-static void save_file(xmlDoc *doc, struct option_info *ninfo)
-{
-	char tmpfile[strlen(ninfo->outputfile)+5];
-	char oldfile[strlen(ninfo->outputfile)+5];
-	int using_stdout = 0;
-	mode_t old_mode;
-	int ret;
-
-	old_mode = umask(026);
-
-	if (strcmp(ninfo->outputfile, "-") == 0)
-		using_stdout = 1;
-
-	/*
-	 * Save it to a temp file before moving the old one out of the way
-	 */
-	if (!using_stdout)
-	{
-		snprintf(tmpfile, sizeof(tmpfile), "%s.tmp", ninfo->outputfile);
-		snprintf(oldfile, sizeof(oldfile), "%s.old", ninfo->outputfile);
-	}
-	else
-	{
-		strcpy(tmpfile, ninfo->outputfile);
-	}
-
-	xmlKeepBlanksDefault(0);
-	ret = xmlSaveFormatFile(tmpfile, doc, 1);
-	if (ret == -1)
-		die("Error writing new config file %s", ninfo->outputfile);
-
-	if (!using_stdout)
-	{
-		if (rename(ninfo->outputfile, oldfile) == -1 && errno != ENOENT)
-			die("Can't move old config file out of the way\n");
-
-		if (rename(tmpfile, ninfo->outputfile))
-		{
-			perror("Error renaming new file to its real filename");
-
-			/* Drat, that failed, try to put the old one back */
-			if (rename(oldfile, ninfo->outputfile))
-				die("Can't move old config fileback in place - clean up after me please\n");
-		}
-	}
-
-	/* free the document */
-	xmlFreeDoc(doc);
-
-	umask(old_mode);
-}
-
-static void validate_int_arg(char argopt, char *arg)
-{
-	char *tmp;
-	int val;
-
-	val = strtol(arg, &tmp, 10);
-	if (tmp == arg || tmp != arg + strlen(arg))
-		die("argument to %c (%s) is not an integer", argopt, arg);
-
-	if (val < 0)
-		die("argument to %c cannot be negative", argopt);
-}
-
-/* Get the config_version string from the file */
-static xmlChar *find_version(xmlNode *root)
-{
-	if (xmlHasProp(root, BAD_CAST "config_version"))
-	{
-		xmlChar *ver;
-
-		ver = xmlGetProp(root, BAD_CAST "config_version");
-		return ver;
-	}
-	return NULL;
-}
-
-/* Get the cluster name string from the file */
-static xmlChar *cluster_name(xmlNode *root)
-{
-	if (xmlHasProp(root, BAD_CAST "name"))
-	{
-		xmlChar *ver;
-
-		ver = xmlGetProp(root, BAD_CAST "name");
-		return ver;
-	}
-	return NULL;
-}
-
-static void increment_version(xmlNode *root_element)
-{
-	int ver;
-	unsigned char *version_string;
-	char newver[32];
-
-	/* Increment version */
-	version_string = find_version(root_element);
-	if (!version_string)
-		die("Can't find \"config_version\" in config file\n");
-
-	ver = atoi((char *)version_string);
-	snprintf(newver, sizeof(newver), "%d", ++ver);
-	xmlSetProp(root_element, BAD_CAST "config_version", BAD_CAST newver);
-}
-
-static xmlNode *findnode(xmlNode *root, char *name)
-{
-	xmlNode *cur_node;
-
-	for (cur_node = root->children; cur_node; cur_node = cur_node->next)
-	{
-		if (cur_node->type == XML_ELEMENT_NODE && strcmp((char *)cur_node->name, name)==0)
-		{
-			return cur_node;
-		}
-	}
-	return NULL;
-}
-
-/* Return the fence type name (& node) for a cluster node */
-static xmlChar *get_fence_type(xmlNode *clusternode, xmlNode **fencenode)
-{
-	xmlNode *f;
-
-	f = findnode(clusternode, "fence");
-	if (f)
-	{
-		f = findnode(f, "method");
-		if (f)
-		{
-			f = findnode(f, "device");
-			*fencenode = f;
-			return xmlGetProp(f, BAD_CAST "name");
-		}
-	}
-	return NULL;
-}
-
-/* Check the fence type exists under <fencedevices> */
-static xmlNode *valid_fence_type(xmlNode *root, char *fencetype)
-{
-	xmlNode *devs;
-	xmlNode *cur_node;
-
-	devs = findnode(root, "fencedevices");
-	if (!devs)
-		return NULL;
-
-	for (cur_node = devs->children; cur_node; cur_node = cur_node->next)
-	{
-		if (cur_node->type == XML_ELEMENT_NODE && strcmp((char *)cur_node->name, "fencedevice") == 0)
-		{
-			xmlChar *name = xmlGetProp(cur_node, BAD_CAST "name");
-			if (strcmp((char *)name, fencetype) == 0)
-				return cur_node;
-		}
-	}
-	return NULL;
-}
-
-/* Check the nodeid is not already in use by another node */
-static xmlNode *get_by_nodeid(xmlNode *root, int nodeid)
-{
-	xmlNode *cnodes;
-	xmlNode *cur_node;
-
-	cnodes = findnode(root, "clusternodes");
-	if (!cnodes)
-		return NULL;
-
-	for (cur_node = cnodes->children; cur_node; cur_node = cur_node->next)
-	{
-		if (cur_node->type == XML_ELEMENT_NODE && strcmp((char *)cur_node->name, "clusternode") == 0)
-		{
-			xmlChar *idstring = xmlGetProp(cur_node, BAD_CAST "nodeid");
-			if (idstring && atoi((char *)idstring) == nodeid)
-				return cur_node;
-		}
-	}
-	return NULL;
-}
-
-
-/* Get the multicast address node.
- */
-static xmlNode *find_multicast_addr(xmlNode *clusternodes)
-{
-	xmlNode *clnode = findnode(clusternodes, "cman");
-	if (clnode)
-	{
-		xmlNode *mcast = findnode(clnode, "multicast");
-		return mcast;
-	}
-	return NULL;
-}
-
-static xmlNode *find_node(xmlNode *clusternodes, char *nodename)
-{
-	xmlNode *cur_node;
-
-	for (cur_node = clusternodes->children; cur_node; cur_node = cur_node->next)
-	{
-		if (cur_node->type == XML_ELEMENT_NODE && strcmp((char *)cur_node->name, "clusternode") == 0)
-		{
-			xmlChar *name = xmlGetProp(cur_node, BAD_CAST "name");
-			if (strcmp((char *)name, nodename) == 0)
-				return cur_node;
-		}
-	}
-	return NULL;
-}
-
-/* Print name=value pairs for a (n XML) node.
- * "ignore" is a string to ignore if present as a property (probably already printed on the main line)
- */
-static int print_properties(xmlNode *node, char *prefix, char *ignore, char *ignore2)
-{
-	xmlAttr *attr;
-	int done_prefix = 0;
-
-	for (attr = node->properties; attr; attr = attr->next)
-	{
-		/* Don't print "name=" */
-		if (strcmp((char *)attr->name, "name") &&
-		    strcmp((char *)attr->name, ignore) &&
-		    strcmp((char *)attr->name, ignore2)
-			)
-		{
-			if (!done_prefix)
-			{
-				done_prefix = 1;
-				printf("%s", prefix);
-			}
-			printf(" %s=%s", attr->name, xmlGetProp(node, attr->name));
-		}
-	}
-	if (done_prefix)
-		printf("\n");
-	return done_prefix;
-}
-
-/* Add name=value pairs from the commandline as properties to a node */
-static void add_fence_args(xmlNode *fencenode, int argc, char **argv, int optind)
-{
-	int i;
-
-	for (i = optind; i<argc; i++)
-	{
-		char *prop;
-		char *value;
-		char *equals;
-
-		prop = strdup(argv[i]);
-		// FIXME: handle failed strdup
-		equals = strchr(prop, '=');
-		if (!equals)
-			die("option '%s' is not opt=value pair\n", prop);
-
-		value = equals+1;
-		*equals = '\0';
-
-		/* "name" is used for the fence type itself, so this is just
-		 *  to protect the user from their own stupidity
-		 */
-		if (strcmp(prop, "name") == 0)
-			die("Can't use \"name\" as a fence argument name\n");
-
-		xmlSetProp(fencenode, BAD_CAST prop, BAD_CAST value);
-		free(prop);
-	}
-}
-
-static void add_clusternode(xmlNode *root_element, struct option_info *ninfo,
-			    int argc, char **argv, int optind)
-{
-	xmlNode *clusternodes;
-	xmlNode *newnode;
-
-	xmlNode *newfence;
-	xmlNode *newfencemethod;
-	xmlNode *newfencedevice;
-
-	clusternodes = findnode(root_element, "clusternodes");
-	if (!clusternodes)
-		die("Can't find \"clusternodes\" in %s\n", ninfo->configfile);
-
-	/* Don't allow duplicate node names */
-	if (find_node(clusternodes, ninfo->name))
-		die("node %s already exists in %s\n", ninfo->name, ninfo->configfile);
-
-	/* Check for duplicate node ID */
-	if (!ninfo->nodeid)
-		die("nodeid not specified\n");
-
-	if (get_by_nodeid(root_element, atoi((char *)ninfo->nodeid)))
-		die("nodeid %s already in use\n", ninfo->nodeid);
-
-        /* Don't allow random fence types */
-	if (!valid_fence_type(root_element, ninfo->fence_type))
-		die("fence type '%s' not known\n", ninfo->fence_type);
-
-	/* Add the new node */
-	newnode = xmlNewNode(NULL, BAD_CAST "clusternode");
-	xmlSetProp(newnode, BAD_CAST "name", BAD_CAST ninfo->name);
-	xmlSetProp(newnode, BAD_CAST "votes", BAD_CAST ninfo->votes);
-	xmlSetProp(newnode, BAD_CAST "nodeid", BAD_CAST ninfo->nodeid);
-	xmlAddChild(clusternodes, newnode);
-
-	if (ninfo->altname)
-	{
-		xmlNode *altnode;
-
-		altnode = xmlNewNode(NULL, BAD_CAST "altname");
-		xmlSetProp(altnode, BAD_CAST "name", BAD_CAST ninfo->altname);
-		xmlAddChild(newnode, altnode);
-	}
-
-	/* Add the fence attributes */
-	newfence = xmlNewNode(NULL, BAD_CAST "fence");
-	newfencemethod = xmlNewNode(NULL, BAD_CAST "method");
-	xmlSetProp(newfencemethod, BAD_CAST "name", BAD_CAST "single");
-
-	newfencedevice = xmlNewNode(NULL, BAD_CAST "device");
-	xmlSetProp(newfencedevice, BAD_CAST "name", BAD_CAST ninfo->fence_type);
-
-	/* Add name=value options */
-	add_fence_args(newfencedevice, argc, argv, optind+1);
-
-	xmlAddChild(newnode, newfence);
-	xmlAddChild(newfence, newfencemethod);
-	xmlAddChild(newfencemethod, newfencedevice);
-}
-
-static xmlDoc *open_configfile(struct option_info *ninfo)
-{
-	xmlDoc *doc;
-
-	/* Init libxml */
-	xmlInitParser();
-	LIBXML_TEST_VERSION;
-
-	if (!ninfo->configfile)
-		ninfo->configfile = DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE;
-	if (!ninfo->outputfile)
-		ninfo->outputfile = ninfo->configfile;
-
-	/* Load XML document */
-	doc = xmlParseFile(ninfo->configfile);
-	if (doc == NULL)
-		die("Error: unable to parse requested configuration file\n");
-
-	return doc;
-
-}
-
-static void del_clusternode(xmlNode *root_element, struct option_info *ninfo)
-{
-	xmlNode *clusternodes;
-	xmlNode *oldnode;
-
-	clusternodes = findnode(root_element, "clusternodes");
-	if (!clusternodes)
-	{
-		fprintf(stderr, "Can't find \"clusternodes\" in %s\n", ninfo->configfile);
-		exit(1);
-	}
-
-	oldnode = find_node(clusternodes, ninfo->name);
-	if (!oldnode)
-	{
-		fprintf(stderr, "node %s does not exist in %s\n", ninfo->name, ninfo->configfile);
-		exit(1);
-	}
-
-	xmlUnlinkNode(oldnode);
-}
-
-struct option addnode_options[] =
-{
-      { "votes", required_argument, NULL, 'v'},
-      { "nodeid", required_argument, NULL, 'n'},
-      { "altname", required_argument, NULL, 'a'},
-      { "fence_type", required_argument, NULL, 'f'},
-      { "outputfile", required_argument, NULL, 'o'},
-      { "configfile", required_argument, NULL, 'c'},
-      { "no_ccs", no_argument, NULL, 'C'},
-      { "force_ccs", no_argument, NULL, 'F'},
-      { NULL, 0, NULL, 0 },
-};
-
-struct option delnode_options[] =
-{
-      { "outputfile", required_argument, NULL, 'o'},
-      { "configfile", required_argument, NULL, 'c'},
-      { "no_ccs", no_argument, NULL, 'C'},
-      { "force_ccs", no_argument, NULL, 'F'},
-      { NULL, 0, NULL, 0 },
-};
-
-struct option addfence_options[] =
-{
-      { "outputfile", required_argument, NULL, 'o'},
-      { "configfile", required_argument, NULL, 'c'},
-      { "no_ccs", no_argument, NULL, 'C'},
-      { "force_ccs", no_argument, NULL, 'F'},
-      { NULL, 0, NULL, 0 },
-};
-
-struct option addnodeid_options[] =
-{
-      { "outputfile", required_argument, NULL, 'o'},
-      { "configfile", required_argument, NULL, 'c'},
-      { "multicast", required_argument, NULL, 'm'},
-      { "nodeid", no_argument, NULL, 'n'},
-      { "verbose", no_argument, NULL, 'v'},
-      { NULL, 0, NULL, 0 },
-};
-
-struct option list_options[] =
-{
-      { "configfile", required_argument, NULL, 'c'},
-      { "verbose", no_argument, NULL, 'v'},
-      { NULL, 0, NULL, 0 },
-};
-
-
-static int next_nodeid(int startid, int *nodeids, int nodecount)
-{
-	int i;
-	int nextid = startid;
-
-retry:
-	for (i=0; i<nodecount; i++)
-	{
-		if (nodeids[i] == nextid)
-		{
-			nextid++;
-			goto retry;
-		}
-	}
-
-	return nextid;
-}
-
-void add_nodeids(int argc, char **argv)
-{
-	struct option_info ninfo;
-	unsigned char *nodenames[MAX_NODES];
-	xmlDoc *doc;
-	xmlNode *root_element;
-	xmlNode *clusternodes;
-	xmlNode *cur_node;
-	xmlNode *mcast;
-	int  verbose = 0;
-	int  opt;
-	int  i;
-	int  nodenumbers[MAX_NODES];
-	int  nodeidx;
-	int  totalnodes;
-	int  nextid;
-
-	memset(nodenames, 0, sizeof(nodenames));
-	memset(nodenumbers, 0, sizeof(nodenumbers));
-	memset(&ninfo, 0, sizeof(ninfo));
-	ninfo.nodeid = "1";
-
-	while ( (opt = getopt_long(argc, argv, "n:o:c:m:vh?", addnodeid_options, NULL)) != EOF)
-	{
-		switch(opt)
-		{
-		case 'n':
-			validate_int_arg(opt, optarg);
-			ninfo.nodeid = strdup(optarg);
-			break;
-
-		case 'c':
-			ninfo.configfile = strdup(optarg);
-			break;
-
-		case 'o':
-			ninfo.outputfile = strdup(optarg);
-			break;
-
-		case 'm':
-			if (!valid_mcast_addr(optarg)) {
-				fprintf(stderr, "%s is not a valid multicast address\n", optarg);
-				return;
-			}
-			ninfo.mcast_addr = strdup(optarg);
-			break;
-
-		case 'v':
-			verbose++;
-			break;
-
-		case '?':
-		default:
-			addnodeid_usage(argv[0]);
-		}
-	}
-
-	doc = open_configfile(&ninfo);
-
-	root_element = xmlDocGetRootElement(doc);
-
-	increment_version(root_element);
-
-	/* Warn if the cluster doesn't have a multicast address */
-	mcast = find_multicast_addr(root_element);
-	if (!mcast & !ninfo.mcast_addr) {
-		fprintf(stderr, "\nWARNING: The cluster does not have a multicast address.\n");
-		fprintf(stderr, "A default will be assigned a run-time which might not suit your installation\n\n");
-	}
-
-	if (ninfo.mcast_addr) {
-		if (!mcast) {
-			xmlNode *cman = xmlNewNode(NULL, BAD_CAST "cman");
-			mcast = xmlNewNode(NULL, BAD_CAST "multicast");
-
-			xmlAddChild(cman, mcast);
-			xmlAddChild(root_element, cman);
-		}
-		xmlSetProp(mcast, BAD_CAST "addr", BAD_CAST ninfo.mcast_addr);
-	}
-
-	/* Get a list of nodes that /do/ have nodeids so we don't generate
-	   any duplicates */
-	nodeidx=0;
-	clusternodes = findnode(root_element, "clusternodes");
-	if (!clusternodes)
-		die("Can't find \"clusternodes\" in %s\n", ninfo.configfile);
-
-
-	for (cur_node = clusternodes->children; cur_node; cur_node = cur_node->next)
-	{
-		if (cur_node->type == XML_ELEMENT_NODE && strcmp((char *)cur_node->name, "clusternode") == 0)
-		{
-			xmlChar *name   = xmlGetProp(cur_node, BAD_CAST "name");
-			xmlChar *nodeid = xmlGetProp(cur_node, BAD_CAST "nodeid");
-			nodenames[nodeidx]  = name;
-			if (nodeid)
-				nodenumbers[nodeidx] = atoi((char*)nodeid);
-			nodeidx++;
-		}
-	}
-	totalnodes = nodeidx;
-
-	/* Loop round nodes adding nodeIDs where they don't exist. */
-	nextid = next_nodeid(atoi(ninfo.nodeid), nodenumbers, totalnodes);
-	for (i=0; i<totalnodes; i++)
-	{
-		if (nodenumbers[i] == 0)
-		{
-			nodenumbers[i] = nextid;
-			nextid = next_nodeid(nextid, nodenumbers, totalnodes);
-			if (verbose)
-				fprintf(stderr, "Node %s now has id %d\n", nodenames[i], nodenumbers[i]);
-		}
-	}
-
-	/* Now write them into the tree */
-	nodeidx = 0;
-	for (cur_node = clusternodes->children; cur_node; cur_node = cur_node->next)
-	{
-		if (cur_node->type == XML_ELEMENT_NODE && strcmp((char *)cur_node->name, "clusternode") == 0)
-		{
-			char tmp[80];
-			xmlChar *name = xmlGetProp(cur_node, BAD_CAST "name");
-
-			assert(strcmp((char*)nodenames[nodeidx], (char*)name) == 0);
-
-			sprintf(tmp, "%d", nodenumbers[nodeidx]);
-			xmlSetProp(cur_node, BAD_CAST "nodeid", BAD_CAST tmp);
-			nodeidx++;
-		}
-	}
-
-
-	/* Write it out */
-	save_file(doc, &ninfo);
-
-	/* Shutdown libxml */
-	xmlCleanupParser();
-}
-
-void add_node(int argc, char **argv)
-{
-	struct option_info ninfo;
-	int opt;
-	xmlDoc *doc;
-	xmlNode *root_element;
-
-	memset(&ninfo, 0, sizeof(ninfo));
-	ninfo.tell_ccsd = 1;
-	ninfo.votes = "1";
-
-	while ( (opt = getopt_long(argc, argv, "v:n:a:f:o:c:CFh?", addnode_options, NULL)) != EOF)
-	{
-		switch(opt)
-		{
-		case 'v':
-			validate_int_arg(opt, optarg);
-			ninfo.votes = optarg;
-			break;
-
-		case 'n':
-			validate_int_arg(opt, optarg);
-			ninfo.nodeid = optarg;
-			break;
-
-		case 'a':
-			ninfo.altname = strdup(optarg);
-			break;
-
-		case 'f':
-			ninfo.fence_type = strdup(optarg);
-			break;
-
-		case 'c':
-			ninfo.configfile = strdup(optarg);
-			break;
-
-		case 'o':
-			ninfo.outputfile = strdup(optarg);
-			break;
-
-		case 'C':
-			ninfo.tell_ccsd = 0;
-			break;
-
-		case 'F':
-			ninfo.force_ccsd = 1;
-			break;
-
-		case '?':
-		default:
-			addnode_usage(argv[0]);
-		}
-	}
-
-	/* Get node name parameter */
-	if (optind < argc)
-		ninfo.name = strdup(argv[optind]);
-	else
-		addnode_usage(argv[0]);
-
-	if (!ninfo.fence_type)
-		addnode_usage(argv[0]);
-
-
-	doc = open_configfile(&ninfo);
-
-	root_element = xmlDocGetRootElement(doc);
-
-	increment_version(root_element);
-
-	add_clusternode(root_element, &ninfo, argc, argv, optind);
-
-	/* Write it out */
-	save_file(doc, &ninfo);
-	/* Shutdown libxml */
-	xmlCleanupParser();
-
-}
-
-void del_node(int argc, char **argv)
-{
-	struct option_info ninfo;
-	int opt;
-	xmlDoc *doc;
-	xmlNode *root_element;
-
-	memset(&ninfo, 0, sizeof(ninfo));
-	ninfo.tell_ccsd = 1;
-
-	while ( (opt = getopt_long(argc, argv, "o:c:CFh?", delnode_options, NULL)) != EOF)
-	{
-		switch(opt)
-		{
-		case 'c':
-			ninfo.configfile = strdup(optarg);
-			break;
-
-		case 'o':
-			ninfo.outputfile = strdup(optarg);
-			break;
-
-		case 'C':
-			ninfo.tell_ccsd = 0;
-			break;
-
-		case 'F':
-			ninfo.force_ccsd = 1;
-			break;
-
-		case '?':
-		default:
-			delnode_usage(argv[0]);
-		}
-	}
-
-	/* Get node name parameter */
-	if (optind < argc)
-		ninfo.name = strdup(argv[optind]);
-	else
-		delnode_usage(argv[0]);
-
-	doc = open_configfile(&ninfo);
-
-	root_element = xmlDocGetRootElement(doc);
-
-	increment_version(root_element);
-
-	del_clusternode(root_element, &ninfo);
-
-	/* Write it out */
-	save_file(doc, &ninfo);
-}
-
-void list_nodes(int argc, char **argv)
-{
-	xmlNode *cur_node;
-	xmlNode *root_element;
-	xmlNode *clusternodes;
-	xmlNode *fencenode = NULL;
-	xmlDocPtr doc;
-	xmlNode *mcast;
-	struct option_info ninfo;
-	int opt;
-	int verbose = 0;
-
-	memset(&ninfo, 0, sizeof(ninfo));
-
-	while ( (opt = getopt_long(argc, argv, "c:vh?", list_options, NULL)) != EOF)
-	{
-		switch(opt)
-		{
-		case 'c':
-			ninfo.configfile = strdup(optarg);
-			break;
-		case 'v':
-			verbose++;
-			break;
-		case '?':
-		default:
-			list_usage(argv[0]);
-		}
-	}
-	doc = open_configfile(&ninfo);
-
-	root_element = xmlDocGetRootElement(doc);
-
-
-	printf("\nCluster name: %s, config_version: %s\n\n",
-	       (char *)cluster_name(root_element),
-	       (char *)find_version(root_element));
-
-	clusternodes = findnode(root_element, "clusternodes");
-	if (!clusternodes)
-		die("Can't find \"clusternodes\" in %s\n", ninfo.configfile);
-
-	mcast = find_multicast_addr(root_element);
-	if (mcast)
-		printf("Multicast address for cluster: %s\n\n", xmlGetProp(mcast, BAD_CAST "addr"));
-
-	printf("Nodename                        Votes Nodeid Fencetype\n");
-	for (cur_node = clusternodes->children; cur_node; cur_node = cur_node->next)
-	{
-		if (cur_node->type == XML_ELEMENT_NODE && strcmp((char *)cur_node->name, "clusternode") == 0)
-		{
-			xmlChar *name   = xmlGetProp(cur_node, BAD_CAST "name");
-			xmlChar *votes  = xmlGetProp(cur_node, BAD_CAST "votes");
-			xmlChar *nodeid = xmlGetProp(cur_node, BAD_CAST "nodeid");
-			xmlChar *ftype  = get_fence_type(cur_node, &fencenode);
-
-			if (!nodeid)
-				nodeid=(unsigned char *)"0";
-			if (!votes)
-				votes = (unsigned char *)"1";
-
-			printf("%-32s %3d  %3d    %s\n", name, atoi((char *)votes),
-			       atoi((char *)nodeid),
-			       ftype?ftype:(xmlChar *)"");
-			if (verbose)
-			{
-				xmlNode *a = findnode(cur_node, "altname");
-				if (a)
-				{
-					printf(" altname %s=%s", "name", xmlGetProp(a, BAD_CAST "name"));
-					if (!print_properties(a, "","",""))
-						printf("\n");
-				}
-				print_properties(cur_node, "  Node properties: ", "votes", "nodeid");
-				print_properties(fencenode, "  Fence properties: ", "agent", "");
-			}
-
-		}
-	}
-}
-
-void create_skeleton(int argc, char **argv)
-{
-	xmlNode *root_element;
-	xmlNode *fencedevices;
-	xmlNode *clusternodes;
-	xmlNode *rm;
-	xmlNode *rm1;
-	xmlNode *rm2;
-	xmlDocPtr doc;
-	char *clustername;
-	struct option_info ninfo;
-	struct stat st;
-	int twonode = 0;
-	int opt;
-
-	memset(&ninfo, 0, sizeof(ninfo));
-
-	while ( (opt = getopt_long(argc, argv, "c:2h?", list_options, NULL)) != EOF)
-	{
-		switch(opt)
-		{
-		case 'c':
-			ninfo.outputfile = strdup(optarg);
-			break;
-
-		case '2':
-			twonode = 1;
-			break;
-
-		case '?':
-		default:
-			create_usage(argv[0]);
-		}
-	}
-	if (!ninfo.outputfile)
-		ninfo.outputfile = DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE;
-	ninfo.configfile = "-";
-
-	if (argc - optind < 1)
-		create_usage(argv[0]);
-
-	clustername = argv[optind];
-
-	if (stat(ninfo.outputfile, &st) == 0)
-		die("%s already exists", ninfo.outputfile);
-
-	/* Init libxml */
-	xmlInitParser();
-	LIBXML_TEST_VERSION;
-
-	doc = xmlNewDoc(BAD_CAST "1.0");
-	root_element = xmlNewNode(NULL, BAD_CAST "cluster");
-	xmlDocSetRootElement(doc, root_element);
-
-	xmlSetProp(root_element, BAD_CAST "name", BAD_CAST clustername);
-	xmlSetProp(root_element, BAD_CAST "config_version", BAD_CAST "1");
-
-	/* Generate extra bits for a 2node cman cluster */
-	if (twonode) {
-
-		xmlNode *cman = xmlNewNode(NULL, BAD_CAST "cman");
-		xmlSetProp(cman, BAD_CAST "two_node", BAD_CAST "1");
-		xmlSetProp(cman, BAD_CAST "expected_votes", BAD_CAST "1");
-		xmlAddChild(root_element, cman);
-	}
-
-	clusternodes = xmlNewNode(NULL, BAD_CAST "clusternodes");
-	fencedevices = xmlNewNode(NULL, BAD_CAST "fencedevices");
-	rm = xmlNewNode(NULL, BAD_CAST "rm");
-	rm1 = xmlNewNode(NULL, BAD_CAST "failoverdomains");
-
-	xmlAddChild(root_element, clusternodes);
-	xmlAddChild(root_element, fencedevices);
-	xmlAddChild(root_element, rm);
-
-	/* Create empty resource manager sections to keep GUI happy */
-	rm2 = xmlNewNode(NULL, BAD_CAST "resources");
-	xmlAddChild(rm, rm1);
-	xmlAddChild(rm, rm2);
-
-	save_file(doc, &ninfo);
-
-}
-
-void add_fence(int argc, char **argv)
-{
-	xmlNode *root_element;
-	xmlNode *fencedevices;
-	xmlNode *fencenode = NULL;
-	xmlDocPtr doc;
-	char *fencename;
-	char *agentname;
-	struct option_info ninfo;
-	int opt;
-
-	memset(&ninfo, 0, sizeof(ninfo));
-	ninfo.tell_ccsd = 1;
-
-	while ( (opt = getopt_long(argc, argv, "c:o:CFh?", list_options, NULL)) != EOF)
-	{
-		switch(opt)
-		{
-		case 'c':
-			ninfo.configfile = strdup(optarg);
-			break;
-		case 'o':
-			ninfo.outputfile = strdup(optarg);
-			break;
-
-		case 'C':
-			ninfo.tell_ccsd = 0;
-			break;
-
-		case 'F':
-			ninfo.force_ccsd = 1;
-			break;
-
-		case '?':
-		default:
-			addfence_usage(argv[0]);
-		}
-	}
-
-	if (argc - optind < 2)
-		addfence_usage(argv[0]);
-
-	doc = open_configfile(&ninfo);
-	root_element = xmlDocGetRootElement(doc);
-
-	increment_version(root_element);
-
-	fencedevices = findnode(root_element, "fencedevices");
-	if (!fencedevices)
-		die("Can't find \"fencedevices\" %s\n", ninfo.configfile);
-
-	/* First param is the fence name - check it doesn't already exist */
-	fencename = argv[optind++];
-
-	if (valid_fence_type(root_element, fencename))
-		die("fence type %s already exists\n", fencename);
-
-	agentname = argv[optind++];
-
-	/* Add it */
-	fencenode = xmlNewNode(NULL, BAD_CAST "fencedevice");
-	xmlSetProp(fencenode, BAD_CAST "name", BAD_CAST fencename);
-	xmlSetProp(fencenode, BAD_CAST "agent", BAD_CAST agentname);
-
-	/* Add name=value options */
-	add_fence_args(fencenode, argc, argv, optind);
-
-	xmlAddChild(fencedevices, fencenode);
-
-	save_file(doc, &ninfo);
-}
-
-void del_fence(int argc, char **argv)
-{
-	xmlNode *root_element;
-	xmlNode *fencedevices;
-	xmlNode *fencenode;
-	xmlDocPtr doc;
-	char *fencename;
-	struct option_info ninfo;
-	int opt;
-
-	memset(&ninfo, 0, sizeof(ninfo));
-	ninfo.tell_ccsd = 1;
-
-	while ( (opt = getopt_long(argc, argv, "c:o:CFhv?", list_options, NULL)) != EOF)
-	{
-		switch(opt)
-		{
-		case 'c':
-			ninfo.configfile = strdup(optarg);
-			break;
-		case 'o':
-			ninfo.outputfile = strdup(optarg);
-			break;
-
-		case 'C':
-			ninfo.tell_ccsd = 0;
-			break;
-
-		case 'F':
-			ninfo.force_ccsd = 1;
-			break;
-
-		case '?':
-		default:
-			delfence_usage(argv[0]);
-		}
-	}
-
-	if (argc - optind < 1)
-		delfence_usage(argv[0]);
-
-	fencename = argv[optind];
-
-	doc = open_configfile(&ninfo);
-	root_element = xmlDocGetRootElement(doc);
-	increment_version(root_element);
-
-	fencedevices = findnode(root_element, "fencedevices");
-	if (!fencedevices)
-		die("Can't find \"fencedevices\" in %s\n", ninfo.configfile);
-
-	fencenode = valid_fence_type(root_element, fencename);
-	if (!fencenode)
-		die("fence type %s does not exist\n", fencename);
-
-	xmlUnlinkNode(fencenode);
-
-	save_file(doc, &ninfo);
-}
-
-void list_fences(int argc, char **argv)
-{
-	xmlNode *cur_node;
-	xmlNode *root_element;
-	xmlNode *fencedevices;
-	xmlDocPtr doc;
-	struct option_info ninfo;
-	int opt;
-	int verbose=0;
-
-	memset(&ninfo, 0, sizeof(ninfo));
-
-	while ( (opt = getopt_long(argc, argv, "c:hv?", list_options, NULL)) != EOF)
-	{
-		switch(opt)
-		{
-		case 'c':
-			ninfo.configfile = strdup(optarg);
-			break;
-		case 'v':
-			verbose++;
-			break;
-		case '?':
-		default:
-			list_usage(argv[0]);
-		}
-	}
-	doc = open_configfile(&ninfo);
-	root_element = xmlDocGetRootElement(doc);
-
-	fencedevices = findnode(root_element, "fencedevices");
-	if (!fencedevices)
-		die("Can't find \"fencedevices\" in %s\n", ninfo.configfile);
-
-
-	printf("Name             Agent\n");
-	for (cur_node = fencedevices->children; cur_node; cur_node = cur_node->next)
-	{
-		if (cur_node->type == XML_ELEMENT_NODE && strcmp((char *)cur_node->name, "fencedevice") == 0)
-		{
-			xmlChar *name  = xmlGetProp(cur_node, BAD_CAST "name");
-			xmlChar *agent = xmlGetProp(cur_node, BAD_CAST "agent");
-
-			printf("%-16s %s\n", name, agent);
-			if (verbose)
-				print_properties(cur_node, "  Properties: ", "agent", "");
-		}
-	}
-}
-
diff --git a/config/tools/ccs_tool/editconf.h b/config/tools/ccs_tool/editconf.h
deleted file mode 100644
index 1847e2c..0000000
--- a/config/tools/ccs_tool/editconf.h
+++ /dev/null
@@ -1,8 +0,0 @@
-void add_node(int argc, char **argv);
-void add_nodeids(int argc, char **argv);
-void add_fence(int argc, char **argv);
-void del_node(int argc, char **argv);
-void del_fence(int argc, char **argv);
-void list_nodes(int argc, char **argv);
-void list_fences(int argc, char **argv);
-void create_skeleton(int argc, char **argv);
diff --git a/config/tools/ldap/Makefile b/config/tools/ldap/Makefile
deleted file mode 100644
index 5c6b2d6..0000000
--- a/config/tools/ldap/Makefile
+++ /dev/null
@@ -1,27 +0,0 @@
-TARGET= confdb2ldif
-
-SBINDIRT=$(TARGET)
-
-all: ${TARGET}
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-OBJS=	confdb2ldif.o
-
-CFLAGS += -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
-CFLAGS += -I${corosyncincdir}
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${corosynclibdir} -lconfdb
-LDFLAGS += -L${libdir}
-
-${TARGET}: ${OBJS}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-clean: generalclean
-
--include $(OBJS:.o=.d)
diff --git a/config/tools/ldap/confdb2ldif.c b/config/tools/ldap/confdb2ldif.c
deleted file mode 100644
index 0606d7e..0000000
--- a/config/tools/ldap/confdb2ldif.c
+++ /dev/null
@@ -1,201 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <signal.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/un.h>
-
-#include <openais/saAis.h>
-#include <corosync/confdb.h>
-
-confdb_callbacks_t callbacks = {
-};
-
-/* This structure maps object parent names to object classes */
-struct objectclasses
-{
-	char *name;
-	char *class;
-} objectclasses[] =
-{
-	{ "cluster", "rhcsCluster" },
-	{ "cman", "rhcsCman" },
-	{ "totem", "rhcsTotem" },
-	{ "clusternode", "rhcsNode" },
-	{ "device", "rhcsFenceagent" },
-	{ "fencedevice", "rhcsFencedevice" },
-	{ "method", "rhcsFencemethod" },
-	{ "logging", "rhcsLoggersubsys" },
-};
-/* TODO: Add more here as the schema gets filled in */
-
-
-static char *ldap_attr_name(char *attrname)
-{
-	static char newname[1024];
-	int i;
-
-	if (strcmp(attrname, "name") == 0)
-		return attrname;
-
-	sprintf(newname, "rhcs");
-	for (i=0; i<strlen(attrname)+1; i++) {
-		if (i == 0)
-			newname[4+i] = attrname[i] & 0x5F;
-		else
-			if (attrname[i] == '_')
-				newname[4+i] = '-';
-			else
-				newname[4+i] = attrname[i];
-	}
-	return newname;
-}
-
-
-/* Recursively dump the object tree */
-static void print_config_tree(confdb_handle_t handle, unsigned int parent_object_handle, char *dn, char *fulldn)
-{
-	unsigned int object_handle;
-	char object_name[1024];
-	int object_name_len;
-	char key_name[1024];
-	int key_name_len;
-	char key_value[1024];
-	int key_value_len;
-	char cumulative_dn[4096];
-	int res;
-	int i;
-	int keycount=0;
-
-	printf("\ndn: %s\n", fulldn);
-
-	/* Show the keys */
-	res = confdb_key_iter_start(handle, parent_object_handle);
-	if (res != SA_AIS_OK) {
-		printf( "error resetting key iterator for object %d: %d\n", parent_object_handle, res);
-		return;
-	}
-
-	while ( (res = confdb_key_iter(handle, parent_object_handle, key_name, &key_name_len,
-				       key_value, &key_value_len)) == SA_AIS_OK) {
-		key_name[key_name_len] = '\0';
-		key_value[key_value_len] = '\0';
-
-		printf("%s: %s\n", ldap_attr_name(key_name), key_value);
-		keycount++;
-	}
-	if (strncmp(fulldn, "cn=", 3) == 0) {
-		printf("cn: %s\n", dn);
-	}
-
-
-	/* Determine objectclass... */
-	if (keycount == 0) {
-		printf("objectclass: nsContainer\n");
-	}
-	else {
-		for (i = 0; i < sizeof(objectclasses)/sizeof(struct objectclasses); i++) {
-			if (strcmp(objectclasses[i].name, dn) == 0)
-				printf("objectclass: %s\n", objectclasses[i].class);
-		}
-	}
-
-	/* Show sub-objects */
-	res = confdb_object_iter_start(handle, parent_object_handle);
-	if (res != SA_AIS_OK) {
-		printf( "error resetting object iterator for object %d: %d\n", parent_object_handle, res);
-		return;
-	}
-
-	while ( (res = confdb_object_iter(handle, parent_object_handle, &object_handle, object_name, &object_name_len)) == SA_AIS_OK)	{
-		unsigned int parent;
-
-		res = confdb_object_parent_get(handle, object_handle, &parent);
-		if (res != SA_AIS_OK) {
-			printf( "error getting parent for object %d: %d\n", object_handle, res);
-			return;
-		}
-
-		object_name[object_name_len] = '\0';
-
-		/* Check for "name", and create dummy parent object */
-		res = confdb_key_get(handle, object_handle, "name", strlen("name"), key_value, &key_value_len);
-		if (res == SA_AIS_OK) {
-			sprintf(cumulative_dn, "cn=%s,%s", object_name, fulldn);
-			printf("\n");
-			printf("dn: %s\n", cumulative_dn);
-			printf("cn: %s\n", object_name);
-			printf("objectclass: %s\n", "nsContainer");
-
-			sprintf(cumulative_dn, "name=%s,cn=%s,%s", key_value, object_name, fulldn);
-		}
-		else {
-			sprintf(cumulative_dn, "cn=%s,%s", object_name, fulldn);
-		}
-
-		/* Down we go ... */
-		print_config_tree(handle, object_handle, object_name, cumulative_dn);
-	}
-}
-
-
-int main(int argc, char *argv[])
-{
-	confdb_handle_t handle;
-	int result;
-	unsigned int cluster_handle;
-	char *clusterroot = "cluster";
-	char basedn[1024];
-
-	if (argc == 1) {
-		fprintf(stderr, "usage: \n");
-		fprintf(stderr, "    %s <dn> [<objdb root>]\n", argv[0]);
-		fprintf(stderr, "\n");
-		fprintf(stderr, " eg: \n");
-		fprintf(stderr, "     %s dc=mycompany,dc=com\n", argv[0]);
-		fprintf(stderr, "     %s dc=mycompany,dc=com rhcluster\n", argv[0]);
-		fprintf(stderr, "\n");
-		fprintf(stderr, "objdb root defaults to 'cluster'\n");
-		fprintf(stderr, "\n");
-		return 0;
-	}
-
-	if (argc > 2) {
-		clusterroot = argv[2];
-	}
-
-	result = confdb_initialize (&handle, &callbacks);
-	if (result != SA_AIS_OK) {
-		printf ("Could not initialize Cluster Configuration Database API instance error %d\n", result);
-		exit (1);
-	}
-
-	/* Find the starting object ... this should be a param */
-
-	result = confdb_object_find_start(handle, OBJECT_PARENT_HANDLE);
-	if (result != SA_AIS_OK) {
-		printf ("Could not start object_find %d\n", result);
-		exit (1);
-	}
-
-	result = confdb_object_find(handle, OBJECT_PARENT_HANDLE, clusterroot, strlen(clusterroot), &cluster_handle);
-	if (result != SA_AIS_OK) {
-		printf ("Could not object_find \"cluster\": %d\n", result);
-		exit (1);
-	}
-
-	sprintf(basedn, "cn=%s,%s", clusterroot, argv[1]);
-
-	/* Print a header */
-	printf("# This file was generated by confdb2ldif, from an existing cluster configuration\n");
-	printf("#\n");
-
-	/* Print the configuration */
-	print_config_tree(handle, cluster_handle, clusterroot, basedn);
-
-
-	result = confdb_finalize (handle);
-	return (0);
-}
diff --git a/config/tools/man/Makefile b/config/tools/man/Makefile
deleted file mode 100644
index f2d6d92..0000000
--- a/config/tools/man/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-TARGET= ccs_tool.8 \
-	confdb2ldif.8
-
-include ../../../make/defines.mk
-
-include $(OBJDIR)/make/man.mk
diff --git a/config/tools/man/ccs_tool.8 b/config/tools/man/ccs_tool.8
deleted file mode 100644
index ef13406..0000000
--- a/config/tools/man/ccs_tool.8
+++ /dev/null
@@ -1,185 +0,0 @@
-.TH "ccs_tool" "8" "" "" ""
-.SH "NAME"
-ccs_tool \- The tool used to make online updates of CCS config files.
-
-.SH "SYNOPSIS"
-.B ccs_tool
-[\fIOPTION\fR].. <\fBcommand\fP>
-
-.SH "DESCRIPTION"
-
-\fBccs_tool\fP is part of the Cluster Configuration System (CCS).  It is
-used to make online updates to cluster.conf.  It can also be used to
-upgrade old style (GFS <= 6.0) CCS archives to the new xml cluster.conf
-format.
-
-.SH "OPTIONS"
-.TP 
-\fB\-h\fP
-Help.  Print out the usage.
-.TP 
-\fB\-V\fP
-Print the version information.
-
-sub\-commands have their own options, see below for more detail
-.SH "COMMANDS"
-.TP 
-\fBupdate\fP \fI<xml file>\fP
-This command is used to update the config file that ccsd is working with
-while the cman cluster is operational (i.e. online).  Run this on a single
-machine to update cluster.conf on all current cluster members.  This also
-notifies cman of the new config version.
-
-.TP 
-\fBupgrade\fP \fI<location>\fP
-This command is used to upgrade an old CCS format archive to the new
-xml format.  \fI<location>\fP is the location of the old archive,
-which can be either a block device archive or a file archive.  The
-converted configuration will be printed to stdout.
-
-.TP 
-\fBaddnode\fP [options] \fI<node> [<fenceoption=value>]...\fP
-Adds a new node to the cluster configuration file. Fencing device options
-are specified as key=value pairs (as many as required) and are entered into the
-configuration file as is. See the documentation for your fencing agent for more
-details (eg a powerswitch fence device may need to know which port the node is
-connected to).
-.br
-\fIOptions:\fP
-.br
-\-v <votes>        Number of votes for this node (mandatory)
-.br 
-\-n <nodeid>       Node id for this node (optional)
-.br
-\-i <interface>    Network interface to use for this node. Mandatory if the cluster 
-is using multicast as transport. Forbidden if not.
-.br
-\-m <multicast>    Multicast address for cluster. Only allowed on the first node to 
-be added to the file. Subsequent nodes will use either multicast or broadcast 
-depending on the properties of the first node.
-.br
-\-f <fencedevice>  Name of fence device to use for this node. The fence device 
-section must already have been added to the file, probably using the addfence command.
-.br
-\-c <file>         Config file to use. Defaults to /etc/cluster/cluster.conf
-.br
-\-o <file>         Output file. Defaults to the same as -c
-.br
-\-C                Don't run "ccs_tool update" after changing file. This will
-happen by default if the input file is the same as the output file.
-.br
-\-F                Force a "ccs_tool update" even if the input and output files
-are different.
-
-
-
-.TP 
-\fBdelnode\fP [options] \fI<node>\fP
-Delete a node from the cluster configuration file. Note: there is no 
-"edit" command so to change the properties of a node you must delete it
-and add it back in with the new properties.
-.br
-\fIOptions:\fP
-.br
-\-c <file>         Config file to use. Defaults to /etc/cluster/cluster.conf
-.br
-\-o <file>         Output file. Defaults to the same as -c
-.br
-\-C                Don't run "ccs_tool update" after changing file. This will
-happen by default if the input file is the same as the output file.
-.br
-\-F                Force a "ccs_tool update" even if the input and output files
-are different.
-
-
-
-.TP 
-\fBaddfence\fP [options] \fI<name> <agent> [<option>=<value>]...\fP
-Adds a new fence device section to the cluster configuration file. <agent> is the
-name of the fence agent that controls the device. the options following are entered
-as key-value pairs. See the fence agent documentation for details about these. eg:
-you may need to enter the IP address and username/password for a powerswitch fencing
-device.
-.br
-\fIOptions:\fP
-.br
-\-c <file>         Config file to use. Defaults to /etc/cluster/cluster.conf
-.br
-\-o <file>         Output file. Defaults to the same as -c
-.br
-\-C                Don't run "ccs_tool update" after changing file. This will
-happen by default if the input file is the same as the output file.
-.br
-\-F                Force a "ccs_tool update" even if the input and output files
-are different.
-
-.TP 
-\fBdelfence\fP [options] \fI<node>\fP
-Deletes a fencing device from the cluster configuration file.
-delfence will allow you to remove a fence device that is in use by nodes.
-This is to allow changes to be made, but be aware that it may produce an
-invalid configuration file if you don't add it back in again.
-.br
-\fIOptions:\fP
-.br
-\-c <file>         Config file to use. Defaults to /etc/cluster/cluster.conf
-.br
-\-o <file>         Output file. Defaults to the same as -c
-.br
-\-C                Don't run "ccs_tool update" after changing file. This will
-happen by default if the input file is the same as the output file.
-.br
-\-F                Force a "ccs_tool update" even if the input and output files
-are different.
-
-
-.TP 
-\fBlsnode [options] \fP
-List the nodes in the configuration file. This is (hopefully obviously) not
-necessarily the same as the nodes currently in the cluster, but it should
-be a superset.
-.br
-\fIOptions:\fP
-.br
-\-v                Verbose. Lists all the properties of the node, and the
-node-specific properties of the fence device too.
-.br
-\-c <file>         Config file to use. Defaults to /etc/cluster/cluster.conf
-
-
-.TP 
-\fBlsfence [options] \fP
-List all the fence devices in the cluster configuration file.
-.br
-\fIOptions:\fP
-.br
-\-v                Verbose. Lists all the properties of the fence device rather
-than just the names and agents.
-.br
-\-c <file>         Config file to use. Defaults to /etc/cluster/cluster.conf
-
-
-.TP 
-\fBcreate [options] \fP \fI<clustername>\fP
-Create a new, skeleton, configuration file. Note that "create" on its own will 
-not create a valid configuration file. Fence agents and nodes will need to be 
-added to it before handing it over to ccsd. The new configuration file will
-have a version number of 1. Subsequent addnode/delnode/addfence/delfence operations
-will increment the version number by 1 each time.
-.br
-\fIOptions:\fP
-.br
-.br
-\-c <file>         Config file to create. Defaults to /etc/cluster/cluster.conf
-
-.TP 
-\fBaddnodeids\fP
-Adds node ID numbers to all the nodes in cluster.conf. In RHEL4, node IDs were optional
-and assigned by cman when a node joined the cluster. In RHEL5 they must be pre-assigned
-in cluster.conf. This command will not change any node IDs that are already set in 
-cluster.conf, it will simply add unique node ID numbers to nodes that do not already
-have them.
-
-
-.SH "SEE ALSO"
-ccs(7), ccsd(8), cluster.conf(5)
diff --git a/config/tools/man/confdb2ldif.8 b/config/tools/man/confdb2ldif.8
deleted file mode 100644
index 2964eec..0000000
--- a/config/tools/man/confdb2ldif.8
+++ /dev/null
@@ -1,64 +0,0 @@
-.TH confdb2ldif 8
-
-.SH NAME
-confdb2ldif - Create an LDIF file from a cluster configuration
-
-.SH SYNOPSIS
-.B confdb2ldap <basedn> [<config object base>]
-
-.SH DESCRIPTION
-\fBconfdb2ldif\fP reads the cluster configuration from the openais object database
-and generates an LDIF file suitable for importing into an LDAP database. The LDIF
-file is written to standard output.
-
-.SH OPTIONS
-.TP
-\fB<basedn>\fP
-This is the base DN of the LDAP server into which the configuration will be imported.
-confdb2ldif will create a "cn=cluster" object below this to contain the cluster configuration.
-The base DN is usually derived from the host's domain name. So if the host is ldapsrv.mycorp.com
-then the base DN could be dc=mycorp,dc=com.
-.TP
-\fB[<config object base>]\fP
-Configuration object in the objdb to start from. This defaults to "cluster" and 
-there should rarely be any need to change it.
-
-.SH COMMENTS
-\fBconfdb2ldif\fP uses the openais libconfdb to read the configuration. The default way to
-do this is run against a running aisexec to read the live configuration. 
-It is possible to generate an LDIF file from a non-running system by using the standalone feature of openais's libconfdb.
-.br
-eg to read the configuration from /etc/cluster/cluster.conf, use the following command:
-
-.nf
-OPENAIS_DEFAULT_CONFIG_IFACE=xmlconfig:cmanpreconfig confdb2ldif dc=mycompany,dc=com
-.fi
-
-or to do it from CCS
-
-.nf
-OPENAIS_DEFAULT_CONFIG_IFACE=ccsconfig:cmanpreconfig confdb2ldif dc=mycompany,dc=com
-.fi
-
-The LDIF file is written to stdout and so can be saved or piped straight into ldapmodify if required.
-.br
-.br
-It's important that the 99cluster.ldif schema file has been loaded into the LDAP server
-before adding the contents of this generated LDIF file.
-
-.SH EXAMPLE
-
-.nf
-confdb2ldif dc=mycorp,dc=com | ldapmodify -x -a -D"cn=Directory Manager" -c -v -W
-.fi
-
-.SH BUGS
-\fBconfdb2ldif\fP parses the cluster configuration without checking it against the loaded
-schema. So if there are attributes in the config file that are not known to the schema, 
-parts of the load will fail. It is important to check the results of feeding the
-output into ldapmodify. In particular aisexec logging operations will not convert
-into LDIF because they rely on duplicate keys.
-
-
-.SH SEE ALSO
-libconfdb(3), openais(8), cluster.conf(5)
diff --git a/configure b/configure
index 8b78dc9..d042edf 100755
--- a/configure
+++ b/configure
@@ -33,77 +33,20 @@ my %options = (
 	gfskincdir => \$gfskincdir,
         incdir => \$incdir,
 	libdir => \$libdir,
-        ccsincdir => \$ccsincdir,
-	ccslibdir => \$ccslibdir,
-	cmanincdir => \$cmanincdir,
-	cmanlibdir => \$cmanlibdir,
-	dlmincdir => \$dlmincdir,
-	dlmlibdir => \$dlmlibdir,
-	dlmcontrolincdir => \$dlmcontrolincdir,
-	dlmcontrollibdir => \$dlmcontrollibdir,
-	fenceincdir => \$fenceincdir,
-	fencelibdir => \$fencelibdir,
-	logtincdir => \$logtincdir,
-	logtlibdir => \$logtlibdir,
 	volidincdir => \$volidincdir,
 	volidlibdir => \$volidlibdir,
-	ncursesincdir => \$ncursesincdir,
-	ncurseslibdir => \$ncurseslibdir,
-	slangincdir => \$slangincdir,
-	slanglibdir => \$slanglibdir,
-	readlineincdir => \$readlineincdir,
-	readlinelibdir => \$readlinelibdir,
-	corosyncincdir => \$corosyncincdir,
-	corosynclibdir => \$corosynclibdir,
-	openaisincdir => \$openaisincdir,
-	openaislibdir => \$openaislibdir,
-	corosyncbin => \$corosyncbin,
-	virtincdir => \$virtincdir,
-	virtlibdir => \$virtlibdir,
-	zlibincdir => \$zlibincdir,
-	zliblibdir => \$zliblibdir,
-	nssincdir => \$nssincdir,
-	nsslibdir => \$nsslibdir,
-	nsprincdir => \$nsprincdir,
-	nsprlibdir => \$nsprlibdir,
-	xenincdir => \$xenincdir,
-	xenlibdir => \$xenlibdir,
-	ldapincdir => \$ldapincdir,
-	ldaplibdir => \$ldaplibdir,
-	libexecdir => \$libexecdir,
 	mandir  => \$mandir,
 	prefix => \$prefix,
 	sbindir => \$sbindir,
 	initddir => \$initddir,
-	sharedir => \$sharedir,
 	docdir => \$docdir,
-	logdir => \$logdir,
-	logrotatedir => \$logrotatedir,
-	syslogfacility => \$syslogfacility,
-	sysloglevel => \$sysloglevel,
-	mibdir => \$mibdir,
-	snmpbin => \$snmpbin,
-	confdir => \$confdir,
-	conffile => \$conffile,
-	fence_agents => \$fence_agents,
-	fenceagentslibdir => \$fenceagentslibdir,
 	enable_crack_of_the_day => \$enable_crack_of_the_day,
 	enable_legacy_code => \$enable_legacy_code,
 	enable_contrib => \$enable_contrib,
-	enable_virt => \$enable_virt,
-	enable_pacemaker => \$enable_pacemaker,
 	somajor => \$somajor,
 	sominor => \$sominor,
 	release_version => \$release_version,
-	without_common => \$without_common,
-	without_config => \$without_config,
-	without_cman => \$without_cman,
-	without_dlm => \$without_dlm,
-	without_group => \$without_group,
-	without_fence => \$without_fence,
 	without_gfs => \$without_gfs,
-	without_gfs2 => \$without_gfs2,
-	without_rgmanager => \$without_rgmanager,
 	without_bindings => \$without_bindings,
 	without_kernel_modules => \$without_kernel_modules,
 	disable_kernel_check => \$disable_kernel_check,
@@ -124,77 +67,21 @@ my $err = &GetOptions (\%options,
 		    'gfskincdir=s',
 		    'incdir=s',
 		    'libdir=s',
-		    'ccsincdir=s',
-		    'ccslibdir=s',
-		    'cmanincdir=s',
-		    'cmanlibdir=s',
-		    'dlmincdir=s',
-		    'dlmlibdir=s',
-		    'dlmcontrolincdir=s',
-		    'dlmcontrollibdir=s',
-		    'fenceincdir=s',
-		    'fencelibdir=s',
-		    'logtincdir=s',
-		    'logtlibdir=s',
 		    'volidincdir=s',
 		    'volidlibdir=s',
-		    'ncursesincdir=s',
-		    'ncurseslibdir=s',
-		    'slangincdir=s',
-		    'slanglibdir=s',
-		    'readlineincdir=s',
-		    'readlinelibdir=s',
-		    'corosyncincdir=s',
-		    'corosynclibdir=s',
-		    'openaisincdir=s',
-		    'openaislibdir=s',
-		    'corosyncbin=s',
-		    'virtincdir=s',
-		    'virtlibdir=s',
-		    'zlibincdir=s',
-		    'zliblibdir=s',
-		    'nssincdir=s',
-		    'nsslibdir=s',
-		    'nsprincdir=s',
-		    'nsprlibdir=s',
-		    'xenincdir=s',
-		    'xenlibdir=s',
-		    'ldapincdir=s',
-		    'ldaplibdir=s',
-		    'libexecdir=s',
 		    'mandir=s',
 		    'prefix=s',
 		    'sbindir=s',
 		    'initddir=s',
-		    'sharedir=s',
 		    'docdir=s',
-		    'logdir=s',
-		    'logrotatedir=s',
-		    'syslogfacility=s',
-		    'sysloglevel=s',
-		    'mibdir=s',
-		    'snmpbin=s',
-		    'confdir=s',
-		    'conffile=s',
 		    'somajor=s',
 		    'sominor=s',
 		    'release_version=s',
-		    'fence_agents=s',
-		    'fenceagentslibdir=s',
 		    'enable_crack_of_the_day',
 		    'enable_legacy_code',
 		    'enable_contrib',
-		    'enable_virt',
-		    'enable_pacemaker',
-		    'without_common',
-		    'without_config',
-		    'without_cman',
-		    'without_dlm',
-		    'without_group',
-		    'without_fence',
 		    'without_gfs',
 		    'without_gfs2',
-		    'without_rgmanager',
 		    'without_bindings',
 		    'without_kernel_modules',
 		    'disable_kernel_check');
@@ -215,17 +102,7 @@ if ($help || !$err) {
   print "--sbindir=\tthe base directory for system binaries.  (Default: {prefix}/sbin)\n";
   print "--initddir=\tthe base directory for init.d scripts.  (Default: /etc/init.d)\n";
   print "--libdir=\tthe base directory for libraries.  (Default: {prefix}/lib)\n";
-  print "--libexecdir=\tthe base directory for executable components.  (Default: {prefix}/libexec)\n";
-  print "--sharedir=\tthe base directory for misc cluster files.  (Default: {prefix}/share/cluster)\n";
   print "--docdir=\tthe base directory for misc cluster documentation files.  (Default: {prefix}/share/doc/cluster)\n";
-  print "--logdir=\tthe base directory for cluster logging files.  (Default: /var/log/cluster/)\n";
-  print "--logrotatedir=\tthe base directory for logrorate.d files.  (Default: /etc/logrotate.d/)\n";
-  print "--syslogfacility=\tset the default syslog facility.  (Default: LOG_LOCAL4)\n";
-  print "--sysloglevel=\tset the default syslog level.  (Default: LOG_INFO)\n";
-  print "--mibdir=\tthe base directory for snmp mibs.  (Default: {prefix}/share/snmp/mibs)\n";
-  print "--snmpbin=\tthe base directory for snmp binaries (Ex: /usr/bin/snmpwalk).  (Default: {prefix}/bin)\n";
-  print "--confdir=\tthe cluster config directory.  (Default: /etc/cluster)\n";
-  print "--conffile=\tthe cluster config file.  (Default: cluster.conf)\n";
   print "--mandir=\tthe base directory for man pages.  (Default: {prefix}/share/man)\n";
   print "--module_dir=\tthe base directory for kernel modules.  (Default:  /lib/modules/`uname -r`/kernel\n";
   print "\nbuild flags:\n";
@@ -239,60 +116,11 @@ if ($help || !$err) {
   print "--kernel_build=\tthe directory containing the kernel object tree you wish to\n\t\tcompile against. (Default: /lib/modules/`uname -r`/build\n\t\tif available or /usr/src/linux as fallback)\n";
   print "--kernel_src=\tthe directory containing the kernel source you wish to\n\t\tcompile against.  (Default: /lib/modules/`uname -r`/source\n\t\tif available or \$kernel_build as fallback)\n";
   print "--incdir=\tthe base directory for include files.  (Default: {prefix}/include)\n";
-  print "--ccsincdir=\tthe base directory for ccs include files.  (Default: ./config/libs/libccsconfdb)\n";
-  print "--ccslibdir=\tthe base directory for ccs libraries.  (Default: ./config/libs/libccsconfdb)\n";
-  print "--cmanincdir=\tthe base directory for cman include files.  (Default: ./cman/lib)\n";
-  print "--cmanlibdir=\tthe base directory for cman libraries.  (Default: ./cman/lib)\n";
-  print "--dlmincdir=\tthe base directory for dlm include files.  (Default: ./dlm/libdlm)\n";
-  print "--dlmlibdir=\tthe base directory for dlm libraries.  (Default: ./dlm/libdlm)\n";
-  print "--dlmcontrolincdir=\tthe base directory for dlmcontrol include files.  (Default: ./dlm/libdlmcontrol)\n";
-  print "--dlmcontrollibdir=\tthe base directory for dlmcontrol libraries.  (Default: ./dlm/libdlmcontrol)\n";
-  print "--fenceincdir=\tthe base directory for fence include files.  (Default: ./fence/libfence)\n";
-  print "--fencelibdir=\tthe base directory for fence libraries.  (Default: ./fence/libfence)\n";
-  print "--logtincdir=\tthe base directory for logthread include files.  (Default: ./common/liblogthread)\n";
-  print "--logtlibdir=\tthe base directory for logthread libraries.  (Default: ./common/liblogthread)\n";
   print "--volidincdir=\tthe base directory for volume_id include files.  (Default: {incdir})\n";
   print "--volidlibdir=\tthe base directory for volume_id libraries.  (Default: {libdir})\n";
-  print "--ncursesincdir=\tthe base directory for ncurses include files.  (Default: {incdir})\n";
-  print "--ncurseslibdir=\tthe base directory for ncurses libraries.  (Default: {libdir})\n";
-  print "--slangincdir=\tthe base directory for S-Lang include files.  (Default: {incdir})\n";
-  print "--slanglibdir=\tthe base directory for S-Lang libraries.  (Default: {libdir})\n";
-  print "--readlineincdir=\tthe base directory for readline include files.  (Default: {incdir})\n";
-  print "--readlinelibdir=\tthe base directory for readline libraries.  (Default: {libdir})\n";
-  print "--corosyncincdir=\tthe base directory for corosync include files.  (Default: {incdir})\n";
-  print "--corosynclibdir=\tthe base directory for corosync libraries.  (Default: {libdir}/corosync)\n";
-  print "--openaisincdir=\tthe base directory for openais include files.  (Default: {incdir})\n";
-  print "--openaislibdir=\tthe base directory for openais libraries.  (Default: {libdir}/openais)\n";
-  print "--corosyncbin=\tlocation of corosync executable file.  (Default: /usr/sbin/corosync)\n";
-  print "--nssincdir=\tthe base directory for libnss include files.  (Default: {incdir}/nss3)\n";
-  print "--nsslibdir=\tthe base directory for libnss libraries.  (Default: {libdir})\n";
-  print "--nsprincdir=\tthe base directory for libnspr include files.  (Default: {incdir}/nspr4)\n";
-  print "--nsprlibdir=\tthe base directory for libnspr libraries.  (Default: {libdir})\n";
-  print "--virtincdir=\tthe base directory for libvirt include files.  (Default: {incdir}/libvirt)\n";
-  print "--virtlibdir=\tthe base directory for libvirt libraries.  (Default: {libdir})\n";
-  print "--zlibincdir=\tthe base directory for libz include files.  (Default: {incdir})\n";
-  print "--zliblibdir=\tthe base directory for libz libraries.  (Default: {libdir})\n";
-  print "--xenincdir=\tthe base directory for xen include files.  (Default: {incdir}/xen)\n";
-  print "--xenlibdir=\tthe base directory for xen libraries.  (Default: {libdir})\n";
-  print "--ldapincdir=\tthe base directory for ldap include files.  (Default: {incdir})\n";
-  print "--ldaplibdir=\tthe base directory for ldap libraries.  (Default: {libdir})\n";
-  print "--fence_agents=\tlist of fence agents to configure.  (Default: all)\n";
-  print "\t\tUse --fence_agents=help for a list\n";
-  print "--fenceagentslibdir=\tspecify directory where to install common fence python lib.  (Default: /usr/share/fence)\n";
-  print "--enable_crack_of_the_day\tEnable build of highly experimental features that rely on code that is not yet available for general use. (Default: no)\n";
   print "--enable_contrib\tEnable build of community contributed code/tools.  (Default: no)\n";
   print "--enable_legacy_code\tEnable build of old/obsolete/unsupported code/tools.  (Default: no)\n";
-  print "--enable_virt\tEnable building of virtualization code (Default: disabled\n";
-  print "--enable_pacemaker\tEnable building of Pacemaker-specific pieces\n";
-  print "--without_common\tDisable common building  (Default: enabled)\n";
-  print "--without_config\tDisable config building  (Default: enabled)\n";
-  print "--without_cman\tDisable cman building  (Default: enabled)\n";
-  print "--without_dlm\tDisable dlm building  (Default: enabled)\n";
-  print "--without_group\tDisable group building  (Default: enabled)\n";
-  print "--without_fence\tDisable fence building  (Default: enabled)\n";
   print "--without_gfs\tDisable gfs building  (Default: enabled)\n";
-  print "--without_gfs2\tDisable gfs2 building  (Default: enabled)\n";
-  print "--without_rgmanager\tDisable rgmanager building  (Default: enabled)\n";
   print "--without_bindings\tDisable perl/python bindings building  (Default: enabled)\n";
   print "--without_kernel_modules\tDisable kernel modules building  (Default: enabled)\n";
   print "--disable_kernel_check\tDisable kernel version check  (Default: enabled)\n";
@@ -447,123 +275,12 @@ if (!$incdir) {
 if (!$libdir) {
   $libdir="${prefix}/lib";
 }
-if (!$ccsincdir) {
-  $ccsincdir="${cdir}/config/libs/libccsconfdb";
-}
-if (!$ccslibdir) {
-  $ccslibdir="${objdir}/config/libs/libccsconfdb";
-}
-if (!$cmanincdir) {
-  $cmanincdir="${cdir}/cman/lib";
-}
-if (!$cmanlibdir) {
-  $cmanlibdir="${objdir}/cman/lib";
-}
-if (!$dlmincdir) {
-  $dlmincdir="${cdir}/dlm/libdlm";
-}
-if (!$dlmlibdir) {
-  $dlmlibdir="${objdir}/dlm/libdlm";
-}
-if (!$dlmcontrolincdir) {
-  $dlmcontrolincdir="${cdir}/dlm/libdlmcontrol";
-}
-if (!$dlmcontrollibdir) {
-  $dlmcontrollibdir="${objdir}/dlm/libdlmcontrol";
-}
-if (!$fenceincdir) {
-  $fenceincdir="${cdir}/fence/libfence";
-}
-if (!$fencelibdir) {
-  $fencelibdir="${objdir}/fence/libfence";
-}
-if (!$logtincdir) {
-  $logtincdir="${cdir}/common/liblogthread";
-}
-if (!$logtlibdir) {
-  $logtlibdir="${objdir}/common/liblogthread";
-}
 if (!$volidincdir) {
   $volidincdir="${incdir}";
 }
 if (!$volidlibdir) {
   $volidlibdir="${libdir}";
 }
-if (!$readlineincdir) {
-  $readlineincdir="${incdir}";
-}
-if (!$readlinelibdir) {
-  $readlinelibdir="${libdir}";
-}
-if (!$ncursesincdir) {
-  $ncursesincdir="${incdir}";
-}
-if (!$ncurseslibdir) {
-  $ncurseslibdir="${libdir}";
-}
-if (!$slangincdir) {
-  $slangincdir="${incdir}";
-  if (! -f "$slangincdir/slang.h") {
-    $slangincdir="${incdir}/slang";
-  }
-}
-if (!$slanglibdir) {
-  $slanglibdir="${libdir}";
-}
-if (!$corosyncincdir) {
-  $corosyncincdir="${incdir}";
-}
-if (!$corosynclibdir) {
-  $corosynclibdir="${libdir}/corosync";
-}
-if (!$openaisincdir) {
-  $openaisincdir="${incdir}";
-}
-if (!$openaislibdir) {
-  $openaislibdir="${libdir}/openais";
-}
-if (!$corosyncbin) {
-  $corosyncbin="/usr/sbin/corosync";
-}
-if (!$nssincdir) {
-  $nssincdir="${incdir}/nss3";
-}
-if (!$nsslibdir) {
-  $nsslibdir="${libdir}";
-}
-if (!$nsprincdir) {
-  $nsprincdir="${incdir}/nspr4";
-}
-if (!$nsprlibdir) {
-  $nsprlibdir="${libdir}";
-}
-if (!$virtincdir) {
-  $virtincdir="${incdir}/libvirt";
-}
-if (!$virtlibdir) {
-  $virtlibdir="${libdir}";
-}
-if (!$zlibincdir) {
-  $zlibincdir="${incdir}";
-}
-if (!$zliblibdir) {
-  $zliblibdir="${libdir}";
-}
-if (!$xenincdir) {
-  $xenincdir="${incdir}/xen";
-}
-if (!$xenlibdir) {
-  $xenlibdir="${libdir}";
-}
-if (!$ldapincdir) {
-  $ldapincdir="${incdir}";
-}
-if (!$ldaplibdir) {
-  $ldaplibdir="${libdir}";
-}
-if (!$libexecdir) {
-  $libexecdir="${prefix}/libexec";
-}
 if (!$mandir) {
   $mandir="${prefix}/share/man";
 }
@@ -573,42 +290,9 @@ if (!$sbindir) {
 if (!$initddir) {
   $initddir="/etc/init.d";
 }
-if (!$sharedir) {
-  $sharedir="${prefix}/share/cluster";
-}
 if (!$docdir) {
   $docdir="${prefix}/share/doc/cluster";
 }
-if (!$logdir) {
-  $logdir="/var/log/cluster";
-}
-if (!$logrotatedir) {
-  $logrotatedir="/etc/logrotate.d";
-}
-if (!$syslogfacility) {
-  $syslogfacility="LOG_LOCAL4";
-}
-if (!$sysloglevel) {
-  $sysloglevel="LOG_INFO";
-}
-if (!$mibdir) {
-  $mibdir="${prefix}/share/snmp/mibs";
-}
-if (!$snmpbin) {
-  $snmpbin="${prefix}/bin";
-}
-if (!$confdir) {
-  $confdir="/etc/cluster";
-}
-if (!$conffile) {
-  $conffile="cluster.conf";
-}
-if (!$fence_agents) {
-  $fence_agents="all";
-}
-if (!$fenceagentslibdir) {
-  $fenceagentslibdir="/usr/share/fence";
-}
 if (!$enable_crack_of_the_day) {
   $enable_crack_of_the_day="";
 } else {
@@ -630,39 +314,9 @@ if (!$enable_legacy_code) {
   print "\n********************************************************************************************\n";
   $cflags="${cflags} -DLEGACY_CODE";
 }
-if (!$enable_virt) {
-  $enable_virt="";
-}
-if (!$enable_pacemaker) {
-  $enable_pacemaker=""
-}
-if (!$without_common) {
-  $without_common="";
-}
-if (!$without_config) {
-  $without_config="";
-}
-if (!$without_cman) {
-  $without_cman="";
-}
-if (!$without_dlm) {
-  $without_dlm="";
-}
-if (!$without_group) {
-  $without_group="";
-}
-if (!$without_fence) {
-  $without_fence="";
-}
 if (!$without_gfs) {
   $without_gfs="";
 }
-if (!$without_gfs2) {
-  $without_gfs2="";
-}
-if (!$without_rgmanager) {
-  $without_rgmanager="";
-}
 if (!$without_bindings) {
   $without_bindings="";
 }
@@ -684,27 +338,6 @@ if (defined($release_version) && not length $release_version) {
   $release_version="";
 }
 
-@args = "find fence/agents -mindepth 2 -maxdepth 2 -name Makefile -printf '%h'";
-open (IFILE, "@args |");
-while (<IFILE>) {
-  chomp;
-  s|fence\/agents\/| |g;
-  s|lib ||g;
-  $all_fence = $_;
-}
-close IFILE;
-
-if ($fence_agents eq "help") {
-  print "Available fence agents:\n$all_fence\n";
-  exit 0;
-}
-
-if ((!$fence_agents) || ($fence_agents eq "all")) {
-  print "\nThe following fence agents will be build on this system:\n$all_fence\n";
-  print "\nNOTE: xvm will build only if --enable_virt has been specified\n\n";
-  $fence_agents = $all_fence
-}
-
 open IFILE, "<make/defines.mk.input" or die "Can't redirect stdin";
 open OFILE, ">${objdir}/make/defines.mk" or die "Can't redirect stdout";
 
@@ -723,74 +356,17 @@ while (<IFILE>) {
   $_ =~ s/\@GFSKINCDIR\@/$gfskincdir/;
   $_ =~ s/\@INCDIR\@/$incdir/;
   $_ =~ s/\@LIBDIR\@/$libdir/;
-  $_ =~ s/\@CCSINCDIR\@/$ccsincdir/;
-  $_ =~ s/\@CCSLIBDIR\@/$ccslibdir/;
-  $_ =~ s/\@CMANINCDIR\@/$cmanincdir/;
-  $_ =~ s/\@CMANLIBDIR\@/$cmanlibdir/;
-  $_ =~ s/\@DLMINCDIR\@/$dlmincdir/;
-  $_ =~ s/\@DLMLIBDIR\@/$dlmlibdir/;
-  $_ =~ s/\@DLMCONTROLINCDIR\@/$dlmcontrolincdir/;
-  $_ =~ s/\@DLMCONTROLLIBDIR\@/$dlmcontrollibdir/;
-  $_ =~ s/\@FENCEINCDIR\@/$fenceincdir/;
-  $_ =~ s/\@FENCELIBDIR\@/$fencelibdir/;
-  $_ =~ s/\@LOGTINCDIR\@/$logtincdir/;
-  $_ =~ s/\@LOGTLIBDIR\@/$logtlibdir/;
   $_ =~ s/\@VOLIDINCDIR\@/$volidincdir/;
   $_ =~ s/\@VOLIDLIBDIR\@/$volidlibdir/;
-  $_ =~ s/\@READLINEINCDIR\@/$readlineincdir/;
-  $_ =~ s/\@READLINELIBDIR\@/$readlinelibdir/;
-  $_ =~ s/\@NCURSESINCDIR\@/$ncursesincdir/;
-  $_ =~ s/\@NCURSESLIBDIR\@/$ncurseslibdir/;
-  $_ =~ s/\@SLANGINCDIR\@/$slangincdir/;
-  $_ =~ s/\@SLANGLIBDIR\@/$slanglibdir/;
-  $_ =~ s/\@COROSYNCINCDIR\@/$corosyncincdir/;
-  $_ =~ s/\@COROSYNCLIBDIR\@/$corosynclibdir/;
-  $_ =~ s/\@OPENAISINCDIR\@/$openaisincdir/;
-  $_ =~ s/\@OPENAISLIBDIR\@/$openaislibdir/;
-  $_ =~ s/\@COROSYNCBIN\@/$corosyncbin/;
-  $_ =~ s/\@XENINCDIR\@/$xenincdir/;
-  $_ =~ s/\@XENLIBDIR\@/$xenlibdir/;
-  $_ =~ s/\@LDAPINCDIR\@/$ldapincdir/;
-  $_ =~ s/\@LDAPLIBDIR\@/$ldaplibdir/;
-  $_ =~ s/\@NSSINCDIR\@/$nssincdir/;
-  $_ =~ s/\@NSSLIBDIR\@/$nsslibdir/;
-  $_ =~ s/\@NSPRINCDIR\@/$nsprincdir/;
-  $_ =~ s/\@NSPRLIBDIR\@/$nsprlibdir/;
-  $_ =~ s/\@VIRTINCDIR\@/$virtincdir/;
-  $_ =~ s/\@VIRTLIBDIR\@/$virtlibdir/;
-  $_ =~ s/\@ZLIBINCDIR\@/$zlibincdir/;
-  $_ =~ s/\@ZLIBLIBDIR\@/$zliblibdir/;
-  $_ =~ s/\@LIBEXECDIR\@/$libexecdir/;
   $_ =~ s/\@MANDIR\@/$mandir/;
   $_ =~ s/\@SBINDIR\@/$sbindir/;
   $_ =~ s/\@INITDDIR\@/$initddir/;
-  $_ =~ s/\@SHAREDIR\@/$sharedir/;
   $_ =~ s/\@DOCDIR\@/$docdir/;
-  $_ =~ s/\@LOGDIR\@/$logdir/;
-  $_ =~ s/\@LOGROTATEDIR\@/$logrotatedir/;
-  $_ =~ s/\@SYSLOGFACILITY\@/$syslogfacility/;
-  $_ =~ s/\@SYSLOGLEVEL\@/$sysloglevel/;
-  $_ =~ s/\@MIBDIR\@/$mibdir/;
-  $_ =~ s/\@SNMPBIN\@/$snmpbin/;
-  $_ =~ s/\@CONFDIR\@/$confdir/;
-  $_ =~ s/\@CONFFILE\@/$conffile/;
-  $_ =~ s/\@FENCE_AGENTS\@/$fence_agents/;
-  $_ =~ s/\@FENCEAGENTSLIBDIR\@/$fenceagentslibdir/;
   $_ =~ s/\@ENABLE_CRACK_OF_THE_DAY\@/$enable_crack_of_the_day/;
   $_ =~ s/\@ENABLE_LEGACY_CODE\@/$enable_legacy_code/;
   $_ =~ s/\@ENABLE_CONTRIB\@/$enable_contrib/;
-  $_ =~ s/\@ENABLE_VIRT\@/$enable_virt/;
-  $_ =~ s/\@ENABLE_PACEMAKER\@/$enable_pacemaker/;
-  $_ =~ s/\@DISABLE_COMMON\@/$without_common/;
-  $_ =~ s/\@DISABLE_CONFIG\@/$without_config/;
-  $_ =~ s/\@DISABLE_CMAN\@/$without_cman/;
-  $_ =~ s/\@DISABLE_DLM\@/$without_dlm/;
-  $_ =~ s/\@DISABLE_GROUP\@/$without_group/;
-  $_ =~ s/\@DISABLE_FENCE\@/$without_fence/;
   $_ =~ s/\@DISABLE_GFS\@/$without_gfs/;
   $_ =~ s/\@DISABLE_GFSKERNEL\@/$without_gfskernel/;
-  $_ =~ s/\@DISABLE_GFS2\@/$without_gfs2/;
-  $_ =~ s/\@DISABLE_RGMANAGER\@/$without_rgmanager/;
   $_ =~ s/\@DISABLE_BINDINGS\@/$without_bindings/;
 
   print OFILE "$_\n";
diff --git a/contrib/Makefile b/contrib/Makefile
index 77a4b96..3f1d0e1 100644
--- a/contrib/Makefile
+++ b/contrib/Makefile
@@ -2,5 +2,5 @@ include ../make/defines.mk
 include $(OBJDIR)/make/passthrough.mk
 
 ifdef contrib_code
-SUBDIRS=askant libaislock
+SUBDIRS=
 endif
diff --git a/contrib/askant/INSTALL b/contrib/askant/INSTALL
deleted file mode 100644
index ce26b82..0000000
--- a/contrib/askant/INSTALL
+++ /dev/null
@@ -1,42 +0,0 @@
-
-  How To Install Askant
-  ---------------------
-
-o Build Dependencies
-  - Python
-  - libgfs2 (part of the Red Hat cluster suite as a static lib)
-
-o Dependencies
-  - Python
-  - blktrace and blkparse with appropriate kernel config options enabled and
-    debugfs mounted
-
-o Intro
-  Askant uses Python's distutils for its standard installation procedure so the
-  setup.py script provides installation routines. Note that it doesn't provide
-  uninstallation routines so the best way to install it is to obtain a package
-  for your particular distribution and install that.
-
-o Installation
-  To install askant to the default location on your system, run as root:
-
-    ./setup.py install
-
-  If you wish to install it to a different root directory (e.g. /var/mychroot)
-  or prefix directory (e.g. /usr/local instead of /usr) see:
-  
-    ./setup.py install --help
-
-  To find out everything else setup.py can do:
-
-    ./setup.py --help-commands
-
-o Use Without Installing
-  To use askant without installing it (e.g. if you want to test patches
-  quickly) it is necessary to carry out the build stage to compile the required
-  plugins. Do:
-
-    ./setup.py build
-    cd build/lib*
-    python askant/askant.py
-
diff --git a/contrib/askant/Makefile b/contrib/askant/Makefile
deleted file mode 100644
index 3773349..0000000
--- a/contrib/askant/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
-include ../../make/defines.mk
-
-all: build
-
-include $(OBJDIR)/make/clean.mk
-
-CFLAGS += -I$(SRCDIR)/gfs2/libgfs2
-CFLAGS += -I$(SRCDIR)/gfs2/include
-
-LDFLAGS += -L$(OBJDIR)/gfs2/libgfs2 -lgfs2
-
-build:
-	CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" python $(S)/setup.py build
-
-install:
-	python $(S)/setup.py install --root $(DESTDIR)
-
-uninstall:
-	@echo UNINSTALL TARGET UNSUPPORTED
-
-clean:
-	python $(S)/setup.py clean
-	rm -rf askant/*.pyc
-	rm -rf build
diff --git a/contrib/askant/PLUGINAPI b/contrib/askant/PLUGINAPI
deleted file mode 100644
index 4c2eceb..0000000
--- a/contrib/askant/PLUGINAPI
+++ /dev/null
@@ -1,65 +0,0 @@
-
-  Writing File System Plugins for Askant
-  --------------------------------------
-
-0. Contents
-
-  1. Intro
-  2. API
-  3. Reference
-
-
-1. Intro
-
-In order to gather file system data with which to enhance the data provided by
-blktrace, there must be specific code written for each file system type we wish
-to support. This is where file system plugins come along. The plugins must
-basically traverse an on-disk file system structure on a block device and report
-back their findings through a callback handed to them by askant. They must also
-expose a function which stops their traversal loop in case askant wishes to stop
-their execution prematurely.
-
-
-2. API
-
-A file system plugin must be written as a Python module. This means that C, C++
-and Python are suitable languages to write them in. They must expose a number of
-Python functions to askant:
-
-parsefs(dev)
-    
-    This function is called when askant wants the plugin to parse the file
-    system on the device specified by the device, dev.
-
-get_block_size()
-
-    This function is called to ascertain the file system block size which is
-    required in order to map the disk sector numbers provided by blktrace to
-    file system block numbers. It takes no arguments and should return a Python
-    integer value.
-
-set_report_hook(func)
-
-    This function is called to pass in a report function which the plugin should
-    call to report the details of a file system block. func is a function which
-    accepts four arguments in this order:
-    
-    Block number: a Python long integer
-    Block type: a Python string
-    Block number of parent: a Python long integer
-    Block file name: a Python string (should be "" for non-inode blocks)
-
-handle_sigint()
-
-    This function should make the plugin stop its parsing loop. This allows it
-    to be interrupted if askant catches a signal, for example. It takes no
-    arguments and its return value is not used.
-
-
-3. Reference
-
-o See fsplugins/gfs2/gfs2module.c for an example of writing a Python fs plugin
-  module in C.
-
-o http://www.python.org/doc/ext/intro.html shows how to extend Python with C or
-  C++.
diff --git a/contrib/askant/README b/contrib/askant/README
deleted file mode 100644
index 74e3219..0000000
--- a/contrib/askant/README
+++ /dev/null
@@ -1,74 +0,0 @@
-
- Askant - A Block I/O Analysis Tool
- ----------------------------------
-
-0. Contents
-
-  1. Intro
-  2. Commands and their options
-  3. Examples
-
-
-1. Intro
-
-Askant allows you to gather file system block I/O data for performance analysis.
-It uses blktrace to trace block operations and adds file system specific data by
-parsing fs block information straight from the storage device. To do this it
-invokes functionality from file system parser plugins which traverse the on-disk
-structures and report details of the blocks they encounter through callbacks.
-
-Usage: askant <command> [options...]
-
-o See 'askant --commands' for a full list of commands.
-
-
-2. Commands and their options
-
-  dumpfs
-
-    Dumps the block data provided by an fs plugin from the given file system.
-
-    -d  The block device which contains the file system under scrutiny
-    -t  The type of the file system, i.e. the name of the fs plugin to load
-    -o  Output file (optional). Stdout is used if '-' or omitted.
-        (Note that the output file should be on a different device to the one
-	specified with -d.)
-  
-  unlinks
-
-    Does a dumpfs and runs blktrace until interrupted. It then blkparses the
-    blktrace data and adds the block data. This is suitable for tracing I/O
-    operations during an unlink test run.
-
-    -d  The block device which contains the file system under scrutiny
-    -t  The type of the file system, i.e. the name of the fs plugin to load
-    -g  The path to the debugfs mount point, defaults to /sys/kernel/debug
-    -D  The directory in which to store the block dumps and blktrace files.
-
-  creates
-
-    Runs blktrace until interrupted. It then does a dumpfs and blkparses the
-    blktrace data and adds the block data. This is suitable for tracing I/O
-    operations during a file creation test run.
-
-    -d  The block device which contains the file system under scrutiny
-    -t  The type of the file system, i.e. the name of the fs plugin to load
-    -g  The path to the debugfs mount point, defaults to /sys/kernel/debug
-    -D  The directory in which to store the block dumps and blktrace files.
-
-3. Examples
-
-o Parse the file system and dump information about each block to stdout e.g.:
-
-    # askant dumpfs -t gfs2 -d /dev/sda3
-
-o Trace 'unlinks' by dumping block information before the blktrace and matching
-  block data to provide a more detailed blkparse output e.g.:
-
-    # askant unlinks -t gfs2 -d /dev/sda3 -D /tmp/dir -g /mnt/debugfs
-
-o Trace 'creates' by dumping block information after the blktrace and matching
-  block data to provide a more detailed blkparse output e.g.:
-
-    # askant creates -t gfs2 -d /dev/sda3 -D /tmp/dir -g /mnt/debugfs
-
diff --git a/contrib/askant/askant/__init__.py b/contrib/askant/askant/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/contrib/askant/askant/about.py b/contrib/askant/askant/about.py
deleted file mode 100644
index 3d40a74..0000000
--- a/contrib/askant/askant/about.py
+++ /dev/null
@@ -1,5 +0,0 @@
-"""
-Version information for askant.
-"""
-
-version = "0.0.1"
diff --git a/contrib/askant/askant/askant.py b/contrib/askant/askant/askant.py
deleted file mode 100644
index a4376b6..0000000
--- a/contrib/askant/askant/askant.py
+++ /dev/null
@@ -1,24 +0,0 @@
-"""
-The main entry point for askant.
-"""
-
-import sys
-import commands
-
-def main():
-
-	"""Run askant"""
-
-	cmds = commands.Commands()
-	cmds.register_command(commands.DumpFSCommand())
-	cmds.register_command(commands.UnlinksCommand())
-	cmds.register_command(commands.CreatesCommand())
-
-	try:
-		cmds.process_argv(sys.argv)
-	except commands.NoFSPluginException, p:
-		print >>sys.stderr, "Plugin not found: %s" %p
-
-
-if __name__ == '__main__':
-	main()
diff --git a/contrib/askant/askant/blktrace.py b/contrib/askant/askant/blktrace.py
deleted file mode 100644
index fdf0219..0000000
--- a/contrib/askant/askant/blktrace.py
+++ /dev/null
@@ -1,93 +0,0 @@
-"""
-Wrapper classes for running blktrace and blkparse and using their output
-"""
-
-import os
-import sys
-import time
-import signal
-from subprocess import Popen
-from subprocess import PIPE
-from sysfs import Sysfs
-
-class BlktraceException(Exception):
-
-	def __init__(self, val, msg):
-		Exception.__init__(self)
-		self.val = val
-		self.msg = msg
-	
-	def __str__(self):
-		return self.msg
-
-class Blktrace:
-
-	def __init__(self, dev, debugfs='/sys/kernel/debug'):
-		self.dev = dev
-		self.debugfs = debugfs
-		self.sysfs = Sysfs(dev)
-		self.btpid = -1
-
-	def handle_sigint(self, sig, frame):
-		if self.btpid >= 0:
-			os.kill(self.btpid, signal.SIGTERM)
-
-	def trace(self, tracefile):
-
-		if not self.dev:
-			raise Exception("No device specified.")
-
-		btargs = ['blktrace',
-			'-d', self.dev,
-			'-r', self.debugfs,
-			'-o', tracefile]
-
-		blktrace = Popen(btargs, bufsize=1, stdout=PIPE,
-						stderr=open('/dev/null','w'))
-		self.btpid = blktrace.pid
-		btres = None
-		while btres is None:
-			time.sleep(1)
-			btres = blktrace.poll()
-
-		self.btpid = -1
-		if btres:
-			raise BlktraceException(btres,
-				'blktrace exited with code ' + str(btres))
-
-
-
-	def parse(self, tracefile, getblk):
-
-		if not self.dev:
-			raise Exception("No device specified.")
-
-		offset = self.sysfs.get_partition_start_sector()
-
-		bpargs = ['blkparse', '-i', tracefile]
-		blkparse = Popen(bpargs, bufsize=1, stdout=PIPE)
-
-		bpres = None
-		while bpres is None:
-			output = blkparse.stdout.readline().strip()
-			if output:
-				chunks = output.split()
-				try:
-					# chunks[7] is the sector number
-					blk = list(getblk(int(chunks[7])))
-					print "%s %s %s" %\
-						(' '.join(blk[0:3]),\
-						 output.strip(),
-						 blk[3].strip())
-				except KeyError:
-					pass
-				except ValueError:
-					pass
-
-			bpres = blkparse.poll()
-
-		if bpres:
-			raise BlktraceException(bpres,
-				'blkparse exited with code ' + str(bpres))
-
-
diff --git a/contrib/askant/askant/commands.py b/contrib/askant/askant/commands.py
deleted file mode 100644
index ad4639f..0000000
--- a/contrib/askant/askant/commands.py
+++ /dev/null
@@ -1,333 +0,0 @@
-"""Command line parsing and processing for askant"""
-
-import fs
-import os
-import sys
-import time
-import about
-import signal
-import tempfile
-from sysfs import Sysfs, SysfsException
-from blktrace import Blktrace, BlktraceException
-from optparse import OptionParser, make_option
-
-class NoFSPluginException(Exception):
-
-	"""A generic Exception class for when file system plugins are missing"""
-
-	pass # Nothing special about this exception
-
-class Commands:
-
-	"""Provides a convenient interface to the askant commands"""
-
-	def __init__(self):
-
-		self.commands = {}
-		self.parser = OptionParser(usage="%prog COMMAND [options]",
-				version=about.version)
-
-
-	def register_command(self, command):
-		self.commands[str(command)] = command
-	
-	def __lookup_command(self, command):
-		try:
-			return self.commands[command]
-		except KeyError, k:
-			return DefaultCommand()
-	
-	def __parse_command(self, command, argv):
-		self.parser.prog = "%s %s" %\
-			(self.parser.get_prog_name(), str(command))
-		self.parser.set_usage(command.get_usage())
-		optlst = command.get_options()
-		for o in optlst:
-			self.parser.add_option(o)
-		self.parser.set_description(command.get_help())
-
-		if str(command) != "":
-			argv = argv[1:]
-
-		return self.parser.parse_args(argv)
-
-	def process_argv(self, argv):
-		try:
-			command = self.__lookup_command(argv[1])
-		except IndexError, i:
-			# This exits
-			self.parser.error("No command specified. Try --help")
-
-		options, args = self.__parse_command(command, argv[1:])
-
-		command.do_command(options, args, self)
-
-class Command:
-	def __init__(self):
-		self.options = []
-
-class DefaultCommand(Command):
-	def __str__(self):
-		return ""
-
-	def get_options(self):
-		self.options.append(make_option("-c","--commands",
-			action="store_true",
-			help="Lists available commands"))
-		return self.options
-
-	def get_usage(self):
-		return "%prog COMMAND [options] [args]"
-
-	def get_help(self):
-		return "Askant is a tool for tracing I/O activity in Linux "\
-			"and adding extra file system context by "\
-			"parsing file system data directly."
-	
-	def do_command(self, options, args, base):
-		if options.commands:
-			base.parser.print_usage()
-			print "Available commands:"
-			keys = base.commands.keys()
-			keys.sort()
-			for k in keys:
-				print " %10s  %s" %\
-					(k, base.commands[k].get_help())
-			print ""
-			print "For command-specific help, use "\
-				"%sCOMMAND --help" % base.parser.get_prog_name()
-		else:
-			base.parser.error("Command not found. Try --commands")
-
-
-class FSCommandTemplate(Command):
-	def __init__(self):
-		self.fsmod = None
-		self.block_table = {}
-		self.block_func = self.__report_hook
-		self.sector_size = None
-		self.offset = None
-		self.options = [
-			make_option("-d","--device", metavar="DEVICE",
-				help="The device to analyse."),
-		]
-
-	def load_fs_plugin(self, fsname):
-		try:
-			self.fsmod = __import__("fs." + fsname,
-					globals(), locals(), ["fs"])
-		except ImportError, i:
-			raise NoFSPluginException(fsname)
-
-	def parse_fs(self, dev, hook=None):
-		if hook is None:
-			hook = self.block_func
-
-		sfs = Sysfs(dev)
-		offset = sfs.get_partition_start_sector()
-		sector_size = sfs.get_dev_sector_size()
-
-		self.fsmod.set_report_hook(hook)
-
-		try:
-	                sfs = Sysfs(dev)
-        	        self.offset = sfs.get_partition_start_sector()
-                	self.sector_size = sfs.get_dev_sector_size()
-			signal.signal(signal.SIGINT, self.fsmod.handle_sigint)
-			self.blk_size = self.fsmod.get_block_size(dev)
-			self.fsmod.parsefs(dev)
-			signal.signal(signal.SIGINT, signal.SIG_DFL)
-		except IOError, i:
-			print >>sys.stderr, str(i)
-			sys.exit(1)
-
-	def set_outfile(self, outfile):
-		self.outfile = outfile
-
-	def trace(self, options, dump_before):
-
-		sfs = Sysfs(options.device)
-		self.offset = sfs.get_partition_start_sector()
-		self.sector_size = sfs.get_dev_sector_size()
-
-		tmstamp = time.strftime('%Y%m%d%H%M%S')
-		self.block_func = self.__report_hook
-		try:
-			self.outfile = open(os.path.join(options.outdir, "blocks-%s" %
-				tmstamp), 'w')
-		except IOError, e:
-			print >>sys.stderr, str(e)
-			sys.exit(1)
-
-		if dump_before:
-			print >>sys.stderr, "Gathering block data..."
-			self.parse_fs(options.device)
-			self.outfile.close()
-
-		if options.debugfs:
-			bt = Blktrace(options.device, options.debugfs)
-		else:
-			bt = Blktrace(options.device)
-
-		os.chdir(options.outdir) # Blktrace doesn't use absolute paths
-		print >>sys.stderr, "Tracing. Hit Ctrl-C to end..."
-		try:
-			signal.signal(signal.SIGINT, bt.handle_sigint)
-			bt.trace(tmstamp)
-			signal.signal(signal.SIGINT, signal.SIG_DFL)
-		except BlktraceException, b:
-			signal.signal(signal.SIGINT, signal.SIG_DFL)
-			print >>sys.stderr, str(b)
-			sys.exit(1)
-
-		if not dump_before:
-			print >>sys.stderr, "Gathering block data..."
-			self.parse_fs(options.device)
-			self.outfile.close()
-
-		print >>sys.stderr, "Matching blocks..."
-		blockdb = open(self.outfile.name, 'r')
-		blocks = {}
-		for l in blockdb.readlines():
-			s = l.split('\t')
-			blocks[int(s[0])] = tuple(s[1:])
-
-		bt.parse(os.path.join(options.outdir, tmstamp), blocks.__getitem__)
-		blockdb.close()
-
-	def __report_hook(self, blk, type, parent, fn):
-		if not fn:
-			fn = ""
-		try:
-			self.outfile.write("%d\t%d\t%s\t%d\t\"%s\"\n" % (
-			((blk * self.blk_size)/self.sector_size) + self.offset,
-			blk, type, parent, fn))
-		except Exception, e:
-			print str(e)
-
-	def __dict_hook(self, blk, type, parent, fn):
-		self.block_table[
-		    ((blk * self.blk_size)/self.sector_size)+self.offset] =\
-		    (blk, type, parent, fn)
-
-
-class DumpFSCommand(FSCommandTemplate):
-	def __str__(self):
-		return "dumpfs"
-
-	def get_options(self):
-		self.options.append(make_option("-t","--type", metavar="FSTYPE",
-			help="The type of file system on the device."))
-		self.options.append(make_option("-o","--output", metavar="FILE",
-			default="-",
-			help="File to write output to or '-' for stdout "
-			"(default)"))
-		return self.options
-	
-	def get_usage(self):
-		return "%prog [options]"
-	
-	def get_help(self):
-		return "Dump fs block information in TSV format."
-	
-	def do_command(self, options, args, base):
-
-		if not options.device:
-			base.parser.error("No device specified. Use -d.")
-
-		if not options.type:
-			base.parser.error("No file system type specified. "
-								"Use -t.")
-		try:
-			if options.output != "-":
-				self.set_outfile(open(options.output, 'w'))
-			else:
-				self.set_outfile(sys.stdout)
-		except IOError, e:
-			print >>sys.stderr,\
-				"Unable to open file for writing: %s" %\
-				options.output
-			return
-		except KeyError:
-			pass
-
-		self.load_fs_plugin(options.type)
-		try:
-			self.parse_fs(options.device)
-		except SysfsException, s:
-			base.parser.error(s)
-		
-class UnlinksCommand(FSCommandTemplate):
-	def __str__(self):
-		return "unlinks"
-
-	def get_options(self):
-		self.options.append(make_option("-t","--type", metavar="FSTYPE",
-			help="The type of file system on the device."))
-		self.options.append(make_option("-g","--debugfs", metavar="PATH",
-			default="/sys/kernel/debug",
-			help="The path to the debugfs mountpoint. Default "
-			"/sys/kernel/debug"))
-		self.options.append(make_option("-D","--outdir", metavar="DIR",
-			help="Directory to write output to. Required."))
-		return self.options
-	
-	def get_usage(self):
-		return "%prog [options]"
-	
-	def get_help(self):
-		return "Trace block I/O activity during unlink tests."
-	
-	def do_command(self, options, args, base):
-		if not options.device:
-			base.parser.error("No device specified. Use -d.")
-
-		self.device = options.device
-
-		if not options.type:
-			base.parser.error("No file system type specified. "
-								"Use -t.")
-		if not options.outdir:
-			base.parser.error("No output directory specified. "
-								"Use -D.")
-
-		self.load_fs_plugin(options.type)
-		self.trace(options, dump_before=True)
-
-class CreatesCommand(FSCommandTemplate):
-	def __str__(self):
-		return "creates"
-
-	def get_options(self):
-		self.options.append(make_option("-t","--type", metavar="FSTYPE",
-			help="The type of file system on the device."))
-		self.options.append(make_option("-g","--debugfs", metavar="PATH",
-			default="/sys/kernel/debug",
-			help="The path to the debugfs mountpoint. Default "
-			"/sys/kernel/debug"))
-		self.options.append(make_option("-D","--outdir", metavar="DIR",
-			help="Directory to write output to. Required."))
-		return self.options
-	
-	def get_usage(self):
-		return "%prog [options]"
-	
-	def get_help(self):
-		return "Trace block I/O activity during create tests."
-	
-	def do_command(self, options, args, base):
-		if not options.device:
-			base.parser.error("No device specified. Use -d.")
-
-		self.device = options.device
-
-		if not options.type:
-			base.parser.error("No file system type specified. "
-								"Use -t.")
-		if not options.outdir:
-			base.parser.error("No output directory specified. "
-								"Use -D.")
-
-		self.load_fs_plugin(options.type)
-		self.trace(options, dump_before=False)
-
diff --git a/contrib/askant/askant/fs/__init__.py b/contrib/askant/askant/fs/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/contrib/askant/askant/sysfs.py b/contrib/askant/askant/sysfs.py
deleted file mode 100644
index 12b7a3b..0000000
--- a/contrib/askant/askant/sysfs.py
+++ /dev/null
@@ -1,86 +0,0 @@
-"""
-Provides access to sysfs data pertaining to storage partitions.
-"""
-
-import os
-import os.path
-
-class SysfsException(Exception):
-	"""
-	An exception which is raised when things go wrong with Sysfs.
-	"""
-	pass # No functionality to add over Exception class
-
-class Sysfs:
-	"""
-	Provides access to sysfs data pertaining to storage partitions.
-	"""
-	def __init__(self, partition, sysfs_path='/sys'):
-		"""
-		Instantiate a Sysfs object. partition should be a path to a
-		disc partition device e.g. /dev/sda3.
-		"""
-		self.partition = partition
-		self.device = self.__partition2parent()
-		self.sysfs_path = sysfs_path
-		line = self.__firstline(os.path.join(
-				sysfs_path,'block',
-				os.path.split(self.device)[1],
-				os.path.split(self.partition)[1],
-				'start'))
-		self.partition_start = int(line)
-		line = self.__firstline(os.path.join(
-				sysfs_path,'block',
-				os.path.split(self.device)[1],
-				'queue',
-				'hw_sector_size'))
-		self.dev_sector_size = int(line)
-		line = self.__firstline(os.path.join(
-				sysfs_path,'block',
-				os.path.split(self.device)[1],
-				os.path.split(self.partition)[1],
-				'size'))
-		self.partition_size = int(line)
-
-	def __firstline(self, fname):
-		"""
-		Read the first line of a file
-		"""
-		try:
-			fobj = open(fname, 'r')
-		except IOError:
-			raise SysfsException(
-				'Could not open file "%s" for reading. Please '
-				'check your kernel is 2.6.25 or later and '
-				'sysfs is mounted.' % fname)
-		line = fobj.readline()
-		fobj.close()
-		return line
-
-	def __partition2parent(self):
-		"""
-		Return the name of a partition device's parent device
-		e.g. /dev/sda3 -> /dev/sda
-		"""
-		# This may need thinking about a bit more -
-		# nothing in life can be this simple.
-		return self.partition.rstrip('0123456789')
-
-
-	def get_partition_start_sector(self):
-		"""
-		Look up the start sector of the partition.
-		"""
-		return self.partition_start
-	
-	def get_dev_sector_size(self):
-		"""
-		Look up the size of the device's sectors.
-		"""
-		return self.dev_sector_size
-	
-	def get_partition_size(self):
-		"""
-		Look up the size of the partition.
-		"""
-		return self.partition_size
diff --git a/contrib/askant/fsplugins/__init__.py b/contrib/askant/fsplugins/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/contrib/askant/fsplugins/gfs2/gfs2.c b/contrib/askant/fsplugins/gfs2/gfs2.c
deleted file mode 100644
index bac9c35..0000000
--- a/contrib/askant/fsplugins/gfs2/gfs2.c
+++ /dev/null
@@ -1,405 +0,0 @@
-/**
- * main.c - Functions for parsing the on-disk structure of a GFS2 fs.
- *          Written by Andrew Price
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <fcntl.h>
-#include <libgfs2.h>
-#include <errno.h>
-
-void (*report_func)(long int blk, char *type, long int parent, char *fn);
-
-/* Define how the block information is reported */
-#define report(b,p,t,n) \
-	((*report_func)((long int)b, t, (long int)p,n))
-/*	(printf("%lu\t%s\t%lu\t%s\n", (long int)b, t, (long int)p, f)) */
-#define report_data(b,p) report(b,p,"D","")
-#define report_leaf(b,p) report(b,p,"L","")
-#define report_indir(b,p) report(b,p,"i","")
-#define report_inode(b,p,n) report(b,p,"I",n)
-
-struct blk_extended {
-	uint64_t parent_blk;
-	char *fname;
-	char *blk;
-};
-
-/* FIXME: A static length block stack is most likely a stupid idea */
-struct blkstack {
-	int top;
-	struct blk_extended blocks[1024];
-};
-
-struct blkstack blk_stack;
-struct gfs2_sb sb;
-uint32_t blk_size;
-off_t max_seek;
-int fd;
-int flag_stop;
-
-/* prog_name and print_it() are needed to satisfy externs in libgfs2 */
-char *prog_name = "askant";
-
-void print_it(const char *label, const char *fmt, const char *fmt2, ...)
-{
-	va_list args;
-
-	va_start(args, fmt2);
-	printf("%s = ", label);
-	vprintf(fmt, args);
-	printf("\n");
-	va_end(args);
-}
-
-/**
- * Push a block onto the stack
- */
-static void push_blk(char *blk, uint64_t parent, char *fn)
-{
-	struct blk_extended eblk;
-
-	eblk.blk = blk;
-	eblk.parent_blk = parent;
-	eblk.fname = fn;
-
-	blk_stack.top++;
-	blk_stack.blocks[blk_stack.top] = eblk;
-}
-
-/**
- * Initialise the block stack
- */
-static int blk_stack_init(void)
-{
-	blk_stack.top = -1;
-	return 1;
-}
-
-/**
- * Pop a block from the stack
- */
-static struct blk_extended pop_blk(void)
-{
-	return blk_stack.blocks[blk_stack.top--];
-}
-
-/**
- * Read the GFS2 superblock into the global sb variable.
- * Returns 1 on error, 0 on success.
- */
-static int read_gfs2_sb(void)
-{
-	off_t offsetsb;
-	off_t offsetres;
-	unsigned char buffer[GFS2_BASIC_BLOCK];
-	ssize_t readsz;
-
-	offsetsb = GFS2_SB_ADDR * GFS2_BASIC_BLOCK;
-	offsetres = lseek(fd, offsetsb, SEEK_SET);
-
-	if (offsetres != offsetsb) {
-		fprintf(stderr, "Could not seek to sb location on device.\n");
-		return 0;
-	}
-
-	readsz = read(fd, buffer, GFS2_BASIC_BLOCK);
-	if (readsz != GFS2_BASIC_BLOCK) {
-		fprintf(stderr, "Could not read superblock.\n");
-		return 0;
-	}
-
-	gfs2_sb_in(&sb, (char *)buffer);
-	if (check_sb(&sb)) {
-		fprintf(stderr, "Not a GFS2 filesystem.\n");
-		return 0;
-	}
-
-	return 1;
-}
-
-/**
- * Read a block.
- * blk_offset must be a block number.
- * The returned pointer must be free'd.
- */
-static char *read_gfs2_blk(off_t blk_offset)
-{
-	off_t offset;
-	off_t offsetres;
-	ssize_t readsz;
-	char *buffer;
-
-	buffer = (char *)malloc(blk_size);
-	if (!buffer) {
-		fprintf(stderr, "Could not allocate memory for block.\n");
-		return NULL;
-	}
-
-	offset = blk_offset * blk_size;
-
-	offsetres = lseek(fd, offset, SEEK_SET);
-	if (offsetres != offset) {
-		fprintf(stderr,
-			"Could not seek to block location: %lu error: %s\n",
-			(long int)blk_offset, strerror(errno));
-		return NULL;
-	}
-
-	readsz = read(fd, buffer, blk_size);
-	if (readsz != blk_size) {
-		fprintf(stderr, "Could not read block: %lu\n",
-					(long int)blk_offset);
-		return NULL;
-	}
-
-	return buffer;
-}
-
-/**
- * Look at indirect pointers from a starting point in a block.
- */
-static void do_indirect(char *start, uint16_t height, uint64_t parent)
-{
-	uint64_t ptr;
-	unsigned int i;
-	char *blk;
-
-	for (i = 0; i < blk_size; i += sizeof(uint64_t)) {
-		ptr = be64_to_cpu(*(uint64_t *)(start + i));
-		if (ptr > 0 && ptr < (max_seek / blk_size)) {
-			if (height == 1) {
-				report_data(ptr, parent);
-			} else if (height > 1) {
-				blk = read_gfs2_blk(ptr);
-				if (blk) {
-					report_indir(ptr, parent);
-					do_indirect(blk, height - 1, ptr);
-					free(blk);
-				}
-			}
-		} else {
-			break;
-		}
-	}
-}
-
-/**
- * Parse count number of dirents from a starting point in a block.
- */
-static void do_dirents(char *dirents, char *end, uint64_t parent, uint64_t gparent)
-{
-	struct gfs2_dirent dirent;
-	char *di_blk;
-	char *fname;
-
-	while (dirents < end) {
-		gfs2_dirent_in(&dirent, dirents);
-		if (dirent.de_inum.no_addr &&
-			dirent.de_inum.no_addr != parent &&
-			dirent.de_inum.no_addr != gparent &&
-			dirent.de_name_len > 0 &&
-			dirent.de_name_len <= GFS2_FNAMESIZE) {
-
-			fname = (char *)malloc(dirent.de_name_len + 1);
-			if (!fname) {
-				break;
-			}
-
-			memcpy(fname, dirents + sizeof(struct gfs2_dirent),
-				dirent.de_name_len);
-			fname[dirent.de_name_len] = '\0';
-
-			di_blk = read_gfs2_blk(dirent.de_inum.no_addr);
-			if (di_blk) {
-				push_blk(di_blk, parent, fname);
-			}
-		}
-		dirents += dirent.de_rec_len;
-	}
-}
-
-/**
- * Examine the dirents in a leaf block.
- * If the leaf is chained, do the chained leaves too.
- */
-static void do_leaf(char *blk, uint64_t parent, uint64_t gparent)
-{
-	struct gfs2_leaf leaf;
-
-	while (blk) {
-		gfs2_leaf_in(&leaf, blk);
-		do_dirents(blk + sizeof(struct gfs2_leaf), blk + blk_size,
-							parent, gparent);
-		free(blk);
-		if (!leaf.lf_next) {
-			break;
-		}
-
-		blk = read_gfs2_blk(leaf.lf_next);
-	}
-}
-
-/**
- * Parse leaf pointer data and examine the
- * dirents in the destination leaf blocks.
- */
-static void do_leaves(char *start, uint64_t parent, uint64_t gparent)
-{
-	uint64_t ptr;
-	uint64_t prev;
-	unsigned int i;
-	char *blk;
-
-	prev = 0;
-	for (i = 0; i < blk_size - sizeof(struct gfs2_dinode);
-					i += sizeof(uint64_t)) {
-		ptr = be64_to_cpu(*(uint64_t *)(start + i));
-
-		if (ptr >= (max_seek / blk_size)) {
-			break;
-		}
-
-		if (ptr && ptr != prev) {
-			blk = read_gfs2_blk(ptr);
-			if (blk) {
-				report_leaf(ptr, parent);
-				do_leaf(blk, parent, gparent);
-			}
-			prev = ptr;
-		}
-	}
-}
-
-/**
- * Parse inode data from a block
- */
-static void do_inode_blk(char *blk, uint64_t parent, char *fname)
-{
-	struct gfs2_dinode di;
-	char *data;
-
-	gfs2_dinode_in(&di, blk);
-	report_inode(di.di_num.no_addr, parent, fname);
-
-	data = (char *)((struct gfs2_dinode *)blk + 1);
-
-	if (di.di_height > 0) {
-		/* Indirect pointers */
-		do_indirect(data, di.di_height, di.di_num.no_addr);
-	} else if (S_ISDIR(di.di_mode) && !(di.di_flags & GFS2_DIF_EXHASH)) {
-		/* Stuffed directory */
-		do_dirents(data, blk + blk_size, di.di_num.no_addr, parent);
-	} else if (S_ISDIR(di.di_mode) && 
-				(di.di_flags & GFS2_DIF_EXHASH) && 
-				!(di.di_height)) {
-		/* Directory, has hashtable, height == 0 */
-		do_leaves(data, di.di_num.no_addr, parent);
-	}
-
-	/* free previously stacked block */
-	free(fname);
-	free(blk);
-}
-
-/**
- * Get the root dir block and parse the fs
- * using a stack to keep track of the unvisited
- * inode blocks.
- */
-static void parse_fs(void)
-{
-	struct gfs2_inum *root_dir_inum;
-	struct gfs2_inum *master_dir_inum;
-	struct blk_extended blk;
-	char *root_blk;
-	char *master_blk;
-
-	flag_stop = 0;
-
-	root_dir_inum = &(sb.sb_root_dir);
-	master_dir_inum = &(sb.sb_master_dir);
-
-	root_blk = read_gfs2_blk(root_dir_inum->no_addr);
-	master_blk = read_gfs2_blk(master_dir_inum->no_addr);
-	if (!root_blk || !master_blk) {
-		return;
-	}
-
-	push_blk(root_blk, root_dir_inum->no_addr, NULL);
-	while (blk_stack.top >= 0 && !flag_stop) {
-		blk = pop_blk();
-		do_inode_blk(blk.blk, blk.parent_blk, blk.fname);
-	}
-
-	push_blk(master_blk, master_dir_inum->no_addr, NULL);
-	while (blk_stack.top >= 0 && !flag_stop) {
-		blk = pop_blk();
-		/* TODO: Examine each block's magic number instead of assuming
-		 * they're inodes. Omitted for now due to time constraints and
-		 * the number of GFS2_METATYPE_*s which need catering for.
-		 */
-		do_inode_blk(blk.blk, blk.parent_blk, blk.fname);
-	}
-}
-
-/**
- * Raise a flag to stop the parse loop cleanly
- */
-void gfs2_stop(void)
-{
-	flag_stop = 1;
-}
-
-/**
- * Parse a gfs2 file system on a given device
- */
-int gfs2_parse(char *dev, void (*func)(long int b, char *t, long int p, char *f))
-{
-	report_func = func;
-
-	if (!blk_stack_init()) {
-		return 0;
-	}
-
-	if ((fd = open(dev, O_RDONLY)) < 0) {
-		return 0;
-	}
-
-	if (!read_gfs2_sb()) {
-		close(fd);
-		return 0;
-	}
-
-	blk_size = sb.sb_bsize;
-	max_seek = lseek(fd, 0, SEEK_END);
-
-	parse_fs();
-
-	close(fd);
-
-	return 1;
-}
-
-/**
- * Return the block size of the gfs2 file system on a given device.
- */
-uint32_t gfs2_block_size(char *dev)
-{
-	if ((fd = open(dev, O_RDONLY)) < 0) {
-		return 0;
-	}
-
-	if (!read_gfs2_sb()) {
-		close(fd);
-		return 0;
-	}
-	close(fd);
-	return sb.sb_bsize;
-}
diff --git a/contrib/askant/fsplugins/gfs2/gfs2.h b/contrib/askant/fsplugins/gfs2/gfs2.h
deleted file mode 100644
index 6c72eb0..0000000
--- a/contrib/askant/fsplugins/gfs2/gfs2.h
+++ /dev/null
@@ -1,3 +0,0 @@
-uint32_t gfs2_block_size(char *dev);
-int gfs2_parse(char *dev, void (*func)(long int b, char *t, long int p, char *f));
-void gfs2_stop(void);
diff --git a/contrib/askant/fsplugins/gfs2/gfs2module.c b/contrib/askant/fsplugins/gfs2/gfs2module.c
deleted file mode 100644
index c6a0584..0000000
--- a/contrib/askant/fsplugins/gfs2/gfs2module.c
+++ /dev/null
@@ -1,104 +0,0 @@
-#include <Python.h>
-
-#include "gfs2.h"
-
-static PyObject *report_func = NULL;
-
-void report_func_wrapper(long int blk, char *type, long int parent, char *fn)
-{
-	PyObject *arglist;
-	PyObject *result;
-
-	arglist = Py_BuildValue("lsls", blk, type, parent, fn);
-	if (!arglist) {
-		return;
-	}
-	result = PyEval_CallObject(report_func, arglist);
-	Py_DECREF(arglist);
-	if (!result) {
-		return;
-	}
-	Py_DECREF(result);
-}
-
-static PyObject *gfs2_set_report_hook(PyObject *self, PyObject *args)
-{
-	PyObject *result = NULL;
-	PyObject *temp;
-
-	if (PyArg_ParseTuple(args, "O:set_callback", &temp)) {
-		if (!PyCallable_Check(temp)) {
-			PyErr_SetString(PyExc_TypeError, "parameter must be callable");
-			return NULL;
-		}
-		Py_XINCREF(temp);
-		Py_XDECREF(report_func);
-		report_func = temp;
-
-		Py_INCREF(Py_None);
-		result = Py_None;
-	}
-	return result;
-}
-
-static PyObject *gfs2_parsefs(PyObject *self, PyObject *args)
-{
-	char *dev;
-
-	if (!PyArg_ParseTuple(args, "s:parsefs", &dev)) {
-		return NULL;
-	}
-
-	if (!gfs2_parse(dev, &report_func_wrapper)) {
-		return PyErr_SetFromErrno(PyExc_IOError);
-	}
-	Py_INCREF(Py_None);
-
-	return Py_None;
-}
-
-static PyObject *gfs2_get_block_size(PyObject *self, PyObject *args)
-{
-	char *dev;
-	uint32_t blksize;
-
-	if (!PyArg_ParseTuple(args, "s:get_block_size", &dev)) {
-		return NULL;
-	}
-
-	blksize = gfs2_block_size(dev);
-	if (!blksize) {
-		return PyErr_SetFromErrno(PyExc_IOError);
-	}
-
-	PyObject *size = Py_BuildValue("I", blksize);
-	if (!size) {
-		return NULL;
-	}
-	Py_INCREF(size);
-	return size;
-}
-
-static PyObject *gfs2_handle_sigint(PyObject *signum, PyObject *frame)
-{
-	gfs2_stop();
-	Py_INCREF(Py_None);
-	return Py_None;
-}
-
-static PyMethodDef GFS2Methods[] = {
-	{"set_report_hook", gfs2_set_report_hook, METH_VARARGS,
-		"Specify a hook function through which to report blocks."},
-	{"parsefs", gfs2_parsefs, METH_VARARGS,
-		"Parses the given block device as a GFS2 file system."},
-	{"get_block_size", gfs2_get_block_size, METH_VARARGS,
-		"Returns the file system block size."},
-	{"handle_sigint", gfs2_handle_sigint, METH_VARARGS,
-		"Handles signal SIGINT."},
-	{NULL, NULL, 0, NULL}
-};
-
-PyMODINIT_FUNC initgfs2(void)
-{
-    (void)Py_InitModule("gfs2", GFS2Methods);
-}
diff --git a/contrib/askant/scripts/askant b/contrib/askant/scripts/askant
deleted file mode 100644
index 3375b0c..0000000
--- a/contrib/askant/scripts/askant
+++ /dev/null
@@ -1,6 +0,0 @@
-#! /usr/bin/env python
-
-from askant import askant
-
-if __name__ == '__main__':
-	askant.main()
diff --git a/contrib/askant/setup.py b/contrib/askant/setup.py
deleted file mode 100644
index 3c971bc..0000000
--- a/contrib/askant/setup.py
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/env python
-
-from distutils.core import setup, Extension
-from askant import about
-
-setup(name="askant",
-	  version=about.version,
-	  description="File system performance analysis tool",
-	  author="Andrew Price",
-	  author_email="andy@andrewprice.me.uk",
-	  url="http://andrewprice.me.uk/projects/askant";,
-	  packages = ['askant','askant.fs'],
-	  ext_modules = [Extension("askant.fs.gfs2",
-		  sources = ["fsplugins/gfs2/gfs2module.c","fsplugins/gfs2/gfs2.c"])],
-	  scripts = ['scripts/askant']) 
diff --git a/contrib/libaislock/Makefile b/contrib/libaislock/Makefile
deleted file mode 100644
index b392d55..0000000
--- a/contrib/libaislock/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-TARGET= libaislock
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/libs.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-CFLAGS += -fPIC
-CFLAGS += -I${incdir}
-
-LDFLAGS += -lpthread
diff --git a/contrib/libaislock/libaislock.c b/contrib/libaislock/libaislock.c
deleted file mode 100644
index 82f06ab..0000000
--- a/contrib/libaislock/libaislock.c
+++ /dev/null
@@ -1,466 +0,0 @@
-#include <pthread.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <sys/param.h>
-#include <sys/types.h>
-#include <sys/file.h>
-#include <sys/stat.h>
-
-#include <linux/types.h>
-#include <linux/dlm.h>
-#define BUILDING_LIBDLM
-#include "libdlm.h"
-#include "libaislock.h"
-#include <linux/dlm_device.h>
-
-enum {
-	SA_LCK_GRANT_CB = 1,
-	SA_LCK_WAITER_CB = 2,
-};
-
-static struct dlm_ls_info *sa_default_ls = NULL;
-
-inline int lkmode_ais2dlm(SaLckLockModeT mode)
-{
-	switch(mode)
-	{
-	case SA_LCK_PR_LOCK_MODE:
-		return DLM_LOCK_PR;
-	case SA_LCK_EX_LOCK_MODE:
-		return DLM_LOCK_EX;
-	default:
-		return -1;
-	}
-}
-
-inline SaLckLockModeT lkmode_dlm2ais(int mode)
-{
-	switch(mode)
-	{
-	case DLM_LOCK_PR:
-		return SA_LCK_PR_LOCK_MODE;
-	case DLM_LOCK_EX:
-		return SA_LCK_EX_LOCK_MODE;
-	default:
-		return -1;
-	}
-}
-
-inline unsigned long lkflag_ais2dlm(SaLckLockFlagsT flag)
-{
-	unsigned long dlm_flag = 0;
-
-	if(flag & SA_LCK_LOCK_NO_QUEUE)
-		dlm_flag |= DLM_LKF_NOQUEUE;
-	if(flag & SA_LCK_LOCK_ORPHAN)
-		dlm_flag |= DLM_LKF_ORPHAN;
-
-	return dlm_flag;
-}
-
-inline SaLckLockStatusT lkstatus_dlm2ais(int status)
-{
-	switch(status)
-	{
-	case -ENOMEM:
-		return SA_LCK_LOCK_NO_MORE;
-	case 0:
-		return SA_LCK_LOCK_GRANTED;
-	case -EAGAIN:
-		return SA_LCK_LOCK_NOT_QUEUED;
-	default:
-		return -1;
-	}
-}
-
-inline SaErrorT lkerr_dlm2ais(int status)
-{
-	switch(status)
-	{
-	case -EINVAL:
-		return SA_ERR_INVALID_PARAM;
-	case 0:
-		return SA_OK;
-	default:
-		return -1;
-	}
-}
-
-
-SaErrorT
-saLckInitialize(SaLckHandleT *lckHandle, const SaLckCallbacksT *lckCallbacks,
-		const SaVersionT *version)
-{
-	dlm_lshandle_t ls = NULL;
-
-	if (NULL == lckHandle)
-		return SA_ERR_INVALID_PARAM;
-
-	if (lckCallbacks) {
-		lckHandle->callback.saLckLockGrantCallback =
-			lckCallbacks->saLckLockGrantCallback;
-		lckHandle->callback.saLckLockWaiterCallback =
-			lckCallbacks->saLckLockWaiterCallback;
-		lckHandle->callback.saLckResourceUnlockCallback =
-			lckCallbacks->saLckResourceUnlockCallback;
-	} else {
-		lckHandle->callback.saLckLockGrantCallback = NULL;
-		lckHandle->callback.saLckLockWaiterCallback = NULL;
-		lckHandle->callback.saLckResourceUnlockCallback = NULL;
-	}
-	lckHandle->version.releaseCode = version->releaseCode;
-	lckHandle->version.major = version->major;
-	lckHandle->version.minor = version->minor;
-
-	ls = dlm_create_lockspace("sa_default", 0600);
-	if (!ls)
-		return SA_ERR_LIBRARY;
-
-	sa_default_ls = (struct dlm_ls_info *)ls;
-	return SA_OK;
-}
-
-
-SaErrorT
-saLckFinalize(SaLckHandleT *lckHandle)
-{
-	if ( NULL == sa_default_ls ) {
-		return SA_ERR_LIBRARY;
-	}
-
-	if(!dlm_release_lockspace("sa_default", sa_default_ls, 1)) {
-		return SA_OK;
-	} else {
-		return SA_ERR_LIBRARY;
-	}
-}
-
-SaErrorT
-saLckResourceOpen(const SaLckHandleT *lckHandle, const SaNameT *lockName,
-		  SaLckResourceIdT *resourceId)
-{
-	if ( NULL == sa_default_ls ) {
-		return SA_ERR_LIBRARY;
-	}
-
-	if (lockName->length <= 31 ) /* OpenDLM only support namelen <= 31*/
-	{
-		resourceId->name.length = lockName->length;
-		strncpy((char *)resourceId->name.value, (char *)lockName->value, lockName->length);
-	} else {
-		return SA_ERR_NO_MEMORY;
-	}
-
-	return SA_OK;
-}
-
-
-SaErrorT
-saLckResourceClose(SaLckHandleT *lckHandle, SaLckResourceIdT *resourceId)
-{
-	if ( NULL == sa_default_ls ) {
-		return SA_ERR_LIBRARY;
-	}
-
-	return SA_OK;
-}
-
-
-SaErrorT
-saLckSelectionObjectGet(const SaLckHandleT *lckHandle,
-			SaSelectionObjectT *selectionObject)
-{
-	int fd = -1;
-
-	if ( NULL == sa_default_ls ) {
-		return SA_ERR_LIBRARY;
-	}
-
-	fd = dlm_ls_get_fd(sa_default_ls);
-
-	if(!fd)
-		return SA_ERR_LIBRARY;
-
-	*selectionObject = fd;
-
-	return SA_OK;
-}
-
-
-SaErrorT
-saLckDispatch(const SaLckHandleT *lckHandle,
-	      const SaDispatchFlagsT dispatchFlags)
-{
-	int status;
-	int fdflags;
-	char resultbuf[sizeof(struct dlm_lock_result)];
-	struct dlm_lock_result *result = (struct dlm_lock_result *)resultbuf;
-	char *fullresult=NULL;
-	SaLckLockIdT *lkid;
-	SaLckLockModeT lock_mode;
-	int fd = -1;
-
-	if ( NULL == sa_default_ls ) {
-		return SA_ERR_LIBRARY;
-	}
-
-	fd = dlm_ls_get_fd(sa_default_ls);
-
-	if(!fd)
-		return SA_ERR_LIBRARY;
-
-	fdflags = fcntl(fd, F_GETFL, 0);
-	fcntl(fd, F_SETFL,  fdflags | O_NONBLOCK);
-
-	do
-	{
-
-		/* Just read the header first */
-		status = read(fd, result, sizeof(struct dlm_lock_result));
-		if (status <= 0)
-    			break;
-
-		if (result->length != status)
-		{
-        		int newstat;
-
-        		fullresult = malloc(result->length);
-        		if (!fullresult)
-            			break;
-
-        		newstat = read(fd, fullresult, result->length);
-
-			/* If it read OK then use the new data. otherwise we can
-			   still deliver the AST, it just might not have all the
-			   info in it...hmmm */
-			if (newstat == result->length)
-				result = (struct dlm_lock_result *)fullresult;
-		}
-
-		/* Copy lksb to user's buffer - except the LVB ptr */
-		memcpy(result->user_lksb, &result->lksb,
-		       sizeof(struct dlm_lksb) - sizeof(char*));
-
-		/* Flip the status. Kernel space likes negative return codes,
-		   userspace positive ones */
-		result->user_lksb->sb_status = -result->user_lksb->sb_status;
-
-		/* Need not to care LVB*/
-#ifdef QUERY
-		/* Copy optional items */
-		if (result->qinfo_offset)
-		{
-    			/* Just need the lockcount written out here */
-    			struct dlm_queryinfo *qi = (struct dlm_queryinfo *)
-				(fullresult+result->qinfo_offset);
-    			result->user_qinfo->gqi_lockcount = qi->gqi_lockcount;
-		}
-
-		if (result->qresinfo_offset)
-			memcpy(result->user_qinfo->gqi_resinfo,
-			       fullresult+result->qresinfo_offset,
-			       sizeof(struct dlm_resinfo));
-
-		if (result->qlockinfo_offset)
-			memcpy(result->user_qinfo->gqi_lockinfo,
-			       fullresult+result->qlockinfo_offset,
-			       sizeof(struct dlm_lockinfo) *
-			       result->user_qinfo->gqi_lockcount);
-#endif
- 		/* Call AST */
-		lkid = (SaLckLockIdT *)result->user_astparam;
-		if (lkid->unlock) {
-			/* dispatch unlock ast */
-			lkid->unlock = 0;
-			lkid->held_mode = 0;
-			if(lckHandle->callback.saLckResourceUnlockCallback)
-				lckHandle->callback.
-					saLckResourceUnlockCallback(
-						lkid->args, lkid->resource, lkid,
-						SA_LCK_LOCK_RELEASED, SA_OK);
-
-		} else if (SA_LCK_GRANT_CB == (int)result->user_astaddr) {
-			/* dispatch lock ast */
-			if (0 == lkid->lksb.sb_status) {
-				lkid->held_mode = lkid->requested_mode;
-				lock_mode = lkid->requested_mode;
-			} else {
-				lock_mode = lkid->held_mode;
-			}
-
-			if(lckHandle->callback.saLckLockGrantCallback)
-				lckHandle->callback.
-					saLckLockGrantCallback(
-						lkid->args, lkid->resource,
-						lkid, lock_mode,
-						lkstatus_dlm2ais(
-							lkid->lksb.sb_status),
-						SA_OK);
-		} else if (SA_LCK_WAITER_CB == (int)result->user_astaddr) {
-			/* dispatch waiter ast */
-			if(lckHandle->callback.saLckLockWaiterCallback)
-				lckHandle->callback.
-					saLckLockWaiterCallback(
-						lkid->args, lkid->resource,
-						lkid, lkid->held_mode, result->bast_mode);
-		} else {
-			return SA_ERR_LIBRARY;
-		}
-	} while (0 !=status && SA_DISPATCH_ONE != dispatchFlags);
-
-	/* EAGAIN is not an error */
-	if (status < 0 && errno == EAGAIN)
-                status = 0;
-
-	fcntl(fd, F_SETFL, fdflags);
-    	return SA_OK;
-}
-
-SaErrorT
-SaLckResourceLockAsync(const SaLckHandleT *lckHandle, SaInvocationT invocation,
-		       const SaLckResourceIdT *resourceId, SaLckLockIdT *lockId,
-		       SaLckLockModeT lockMode, SaLckLockFlagsT lockFlags,
-		       SaTimeT timeout)
-{
-	int ret_val;		/* value to be returned from function */
-
-	if ( NULL == sa_default_ls ) {
-		return SA_ERR_LIBRARY;
-	}
-
-	/*FIXME deal with timeout in lock/lockasync/unlock.
-	 */
-	lockId->resource = (SaLckResourceIdT *)resourceId;
-	lockId->requested_mode = lockMode;
-	lockId->args = invocation;
-
-	ret_val = dlm_ls_lock(sa_default_ls, lkmode_ais2dlm(lockMode),
-			      &(lockId->lksb), lkflag_ais2dlm(lockFlags),
-			      (void *)(resourceId->name.value),
-			      resourceId->name.length, 0, (void *)SA_LCK_GRANT_CB,
-			      lockId, (void *)SA_LCK_WAITER_CB, NULL);
-
-	return lkerr_dlm2ais(ret_val);
-}
-
-SaErrorT
-saLckResourceLock(const SaLckHandleT *lckHandle, SaInvocationT invocation,
-		  const SaLckResourceIdT *resourceId, SaLckLockIdT *lockId,
-		  SaLckLockModeT lockMode, SaLckLockFlagsT lockFlags,
-		  SaTimeT timeout, SaLckLockStatusT *lockStatus)
-
-{
-	int ret_val;		/* value to be returned from function */
-
-	if ( NULL == sa_default_ls ) {
-		return SA_ERR_LIBRARY;
-	}
-
-	lockId->resource = (SaLckResourceIdT *)resourceId;
-	lockId->requested_mode = lockMode;
-	lockId->args = invocation;
-
-	ret_val = dlm_ls_lock_wait(sa_default_ls, lkmode_ais2dlm(lockMode),
-				   &(lockId->lksb), lkflag_ais2dlm(lockFlags),
-				   (void *)(resourceId->name.value),
-				   resourceId->name.length, 0, lockId,
-				   (void *)SA_LCK_WAITER_CB, NULL);
-
-	*lockStatus = lkstatus_dlm2ais(lockId->lksb.sb_status);
-	lockId->held_mode = lockId->requested_mode;
-
-	return lkerr_dlm2ais(ret_val);
-}
-
-SaErrorT
-saLckResourceUnlock(const SaLckHandleT *lckHandle, SaLckLockIdT *lockId,
-		    SaTimeT timeout)
-{
-	int ret_val;	/* value to be returned from function */
-
-	if ( NULL == sa_default_ls ) {
-		return SA_ERR_LIBRARY;
-	}
-
-	ret_val = dlm_ls_unlock_wait(sa_default_ls, lockId->lksb.sb_lkid, 0,
-				     &(lockId->lksb));
-	lockId->held_mode = 0;
-
-	return lkerr_dlm2ais(ret_val);
-}
-
-SaErrorT
-saLckResourceUnlockAsync(const SaLckHandleT *lckHandle,
-			 SaInvocationT invocation, SaLckLockIdT *lockId)
-{
-	int ret_val;	/* value to be returned from function */
-
-	if ( NULL == sa_default_ls ) {
-		return SA_ERR_LIBRARY;
-	}
-
-	lockId->unlock = 1;
-	lockId->args = invocation;
-
-
-	ret_val = dlm_ls_unlock(sa_default_ls, lockId->lksb.sb_lkid, 0, &(lockId->lksb),
-				lockId);
-
-	return lkerr_dlm2ais(ret_val);
-}
-
-
-SaErrorT
-saLckLockPurge(const SaLckHandleT *lckHandle,
-	       const SaLckResourceIdT *resourceId)
-{
-#ifdef QUERY
-	int ret_val;	/* value to be returned from function */
-	SaLckLockIdT lockId;
-	struct dlm_lksb lksb;
-	struct dlm_resinfo resinfo;
-	static struct dlm_queryinfo qinfo;
-	struct dlm_lockinfo *p;
-
-	qinfo.gqi_resinfo = &resinfo;
-	qinfo.gqi_lockinfo = malloc(sizeof(struct dlm_lockinfo) * 10);
-	qinfo.gqi_locksize = 10;
-
-
-	if ( NULL == sa_default_ls ) {
-		return SA_ERR_LIBRARY;
-	}
-
-	lockId.resource = (SaLckResourceIdT *)resourceId;
-	lockId.requested_mode = DLM_LOCK_NL;
-
-	ret_val = dlm_ls_lock_wait(sa_default_ls, DLM_LOCK_NL,
-				   &(lockId.lksb), DLM_LKF_EXPEDITE,
-				   (void *)(resourceId->name.value),
-				   resourceId->name.length, 0, &lockId,
-				   (void *)SA_LCK_WAITER_CB, NULL);
-
-	dlm_ls_query_wait(sa_default_ls, &(lockId.lksb),
-			  DLM_QUERY_QUEUE_ALL|DLM_QUERY_LOCKS_ORPHAN, &qinfo);
-
-	for ( p = qinfo.gqi_lockinfo; 0 != p->lki_lkid; p++ ) {
-		lksb.sb_lkid = p->lki_lkid;
-		ret_val = dlm_ls_unlock_wait(sa_default_ls, p->lki_lkid, 0,
-					     &lksb);
-	}
-
-	ret_val = dlm_ls_unlock_wait(sa_default_ls, lockId.lksb.sb_lkid, 0,
-				     &(lockId.lksb));
-
-	return lkerr_dlm2ais(ret_val);
-#else
-	return -1;
-#endif
-}
-
diff --git a/contrib/libaislock/libaislock.h b/contrib/libaislock/libaislock.h
deleted file mode 100644
index 3faeffd..0000000
--- a/contrib/libaislock/libaislock.h
+++ /dev/null
@@ -1,190 +0,0 @@
-typedef char  			SaInt8T;
-typedef short 			SaInt16T;
-typedef long  			SaInt32T;
-typedef long long 		SaInt64T;
-typedef unsigned char 		SaUint8T;
-typedef unsigned short 		SaUint16T;
-typedef unsigned long 		SaUint32T;
-typedef unsigned long long 	SaUint64T;
-typedef SaInt64T 		SaTimeT;
-
-#define SA_MAX_NAME_LENGTH 256
-
-typedef struct {
-    SaUint16T length;
-    unsigned char value[SA_MAX_NAME_LENGTH];
-} SaNameT;
-
-typedef struct {
-    char releaseCode;
-    unsigned char major;
-    unsigned char minor;
-} SaVersionT;
-
-typedef int SaSelectionObjectT;
-
-typedef void *SaInvocationT;
-
-typedef enum {
-    SA_DISPATCH_ONE = 1,
-    SA_DISPATCH_ALL = 2,
-    SA_DISPATCH_BLOCKING = 3
-} SaDispatchFlagsT;
-
-typedef enum {
-    SA_OK = 1,
-    SA_ERR_LIBRARY = 2,
-    SA_ERR_VERSION = 3,
-    SA_ERR_INIT = 4,
-    SA_ERR_TIMEOUT = 5,
-    SA_ERR_TRY_AGAIN = 6,
-    SA_ERR_INVALID_PARAM = 7,
-    SA_ERR_NO_MEMORY = 8,
-    SA_ERR_BAD_HANDLE = 9,
-    SA_ERR_BUSY = 10,
-    SA_ERR_ACCESS = 11,
-    SA_ERR_NOT_EXIST = 12,
-    SA_ERR_NAME_TOO_LONG = 13,
-    SA_ERR_EXIST = 14,
-    SA_ERR_NO_SPACE = 15,
-    SA_ERR_INTERRUPT =16,
-    SA_ERR_SYSTEM = 17,
-    SA_ERR_NAME_NOT_FOUND = 18,
-    SA_ERR_NO_RESOURCES = 19,
-    SA_ERR_NOT_SUPPORTED = 20,
-    SA_ERR_BAD_OPERATION = 21,
-    SA_ERR_FAILED_OPERATION = 22,
-    SA_ERR_MESSAGE_ERROR = 23,
-    SA_ERR_NO_MESSAGE = 24,
-    SA_ERR_QUEUE_FULL = 25,
-    SA_ERR_QUEUE_NOT_AVAILABLE = 26,
-    SA_ERR_BAD_CHECKPOINT = 27,
-    SA_ERR_BAD_FLAGS = 28
-} SaErrorT;
-
-/* Chapter 10 */
-typedef enum {
-    SA_LCK_PR_LOCK_MODE = 1,
-    SA_LCK_EX_LOCK_MODE = 2
-} SaLckLockModeT;
-
-typedef struct{
-	int site;
-	int pid;
-} SaLckLockHolderT;
-
-typedef struct {
-	SaLckLockHolderT	orphan_holder;
-	SaNameT			name;
-} SaLckResourceIdT;
-
-typedef struct {
-	struct dlm_lksb		lksb;
-	SaLckResourceIdT	*resource;
-	SaLckLockModeT		held_mode;
-	SaLckLockModeT		requested_mode;
-	int			unlock;
-	SaInvocationT		args;
-} SaLckLockIdT;
-
-#define SA_LCK_LOCK_NO_QUEUE 0x1
-#define SA_LCK_LOCK_ORPHAN 0x2
-#define SA_LCK_LOCK_TIMEOUT 0X4
-typedef SaUint32T SaLckLockFlagsT;
-
-typedef enum {
-    SA_LCK_LOCK_GRANTED = 1,
-    SA_LCK_LOCK_RELEASED = 2,
-    SA_LCK_LOCK_DEADLOCK = 3,
-    SA_LCK_LOCK_NOT_QUEUED = 4,
-    SA_LCK_LOCK_TIMED_OUT = 5,
-    SA_LCK_LOCK_ORPHANED = 6,
-    SA_LCK_LOCK_NO_MORE = 7
-} SaLckLockStatusT;
-
-typedef void 
-(*SaLckLockGrantCallbackT)(SaInvocationT invocation,
-                           const SaLckResourceIdT *resourceId,
-                           const SaLckLockIdT *lockId,
-                           SaLckLockModeT lockMode,
-                           SaLckLockStatusT lockStatus,
-                           SaErrorT error);
-
-typedef void 
-(*SaLckLockWaiterCallbackT)(SaInvocationT invocation,
-                            const SaLckResourceIdT *resourceId,
-                            const SaLckLockIdT *lockId,
-                            SaLckLockModeT modeHeld,
-                            SaLckLockModeT modeRequested);
-
-typedef void 
-(*SaLckResourceUnlockCallbackT)(SaInvocationT invocation,
-                                const SaLckResourceIdT *resourceId,
-                                const SaLckLockIdT *lockId,
-                                SaLckLockStatusT lockStatus,
-                                SaErrorT error);
-typedef struct SaLckCallbacks {
-    SaLckLockGrantCallbackT saLckLockGrantCallback;
-    SaLckLockWaiterCallbackT saLckLockWaiterCallback;
-    SaLckResourceUnlockCallbackT saLckResourceUnlockCallback;
-}SaLckCallbacksT;
-
-typedef struct {
-	SaLckCallbacksT		callback;
-	SaVersionT		version;
-} SaLckHandleT;
-
-    SaErrorT 
-saLckInitialize(SaLckHandleT *lckHandle, const SaLckCallbacksT *lckCallbacks,
-                const SaVersionT *version);
-
-    SaErrorT 
-saLckSelectionObjectGet(const SaLckHandleT *lckHandle,
-                        SaSelectionObjectT *selectionObject);
-
-    SaErrorT 
-saLckDispatch(const SaLckHandleT *lckHandle,
-              const SaDispatchFlagsT dispatchFlags);
-
-    SaErrorT 
-saLckFinalize(SaLckHandleT *lckHandle);
-
-    SaErrorT 
-saLckResourceOpen(const SaLckHandleT *lckHandle,
-                  const SaNameT *lockName,
-                  SaLckResourceIdT *resourceId);
-
-    SaErrorT 
-saLckResourceClose(SaLckHandleT *lckHandle, SaLckResourceIdT *resourceId);
-
-    SaErrorT 
-saLckResourceLock(const SaLckHandleT *lckHandle, SaInvocationT invocation,
-                  const SaLckResourceIdT *resourceId,
-                  SaLckLockIdT *lockId,
-                  SaLckLockModeT lockMode,
-                  SaLckLockFlagsT lockFlags,
-                  SaTimeT timeout,
-                  SaLckLockStatusT *lockStatus);
-
-    SaErrorT
-SaLckResourceLockAsync(const SaLckHandleT *lckHandle,
-                       SaInvocationT invocation,
-                       const SaLckResourceIdT *resourceId,
-                       SaLckLockIdT *lockId,
-                       SaLckLockModeT lockMode,
-                       SaLckLockFlagsT lockFlags,
-                       SaTimeT timeout);
-
-    SaErrorT 
-saLckResourceUnlock(const SaLckHandleT *lckHandle,
-                    SaLckLockIdT *lockId,
-                    SaTimeT timeout);
-
-    SaErrorT 
-saLckResourceUnlockAsync(const SaLckHandleT *lckHandle,
-                         SaInvocationT invocation,
-                         SaLckLockIdT *lockId);
-
-    SaErrorT
-saLckLockPurge(const SaLckHandleT *lckHandle,
-               const SaLckResourceIdT *resourceId);
diff --git a/dlm/Makefile b/dlm/Makefile
deleted file mode 100644
index 7c8cc33..0000000
--- a/dlm/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../make/defines.mk
-include $(OBJDIR)/make/passthrough.mk
-
-SUBDIRS=libdlm libdlmcontrol tool man
diff --git a/dlm/doc/dlm_tool.txt b/dlm/doc/dlm_tool.txt
deleted file mode 100644
index d66cdb0..0000000
--- a/dlm/doc/dlm_tool.txt
+++ /dev/null
@@ -1,167 +0,0 @@
-
-The dlm is configured and controlled from user space through sysfs and a
-couple of ioctl's.  A command line program, dlm_tool, can be used to do
-everything manually.
-
-Here are the dlm_tool config/control actions that will be used:
-
-set_local  <nodeid> <ipaddr> [<weight>]
-set_node   <nodeid> <ipaddr> [<weight>]
-stop       <ls_name>
-terminate  <ls_name>
-start      <ls_name> <event_nr> <type> <nodeid>...
-get_done   <ls_name>
-finish     <ls_name> <event_nr>
-set_id     <ls_name> <id>
-
-For testing and illustration, some actions have been added to dlm_tool to use
-the libdlm API.
-
-create     <ls_name>
-release    <ls_name>
-lock       <ls_name> <res_name> <mode> [<flag>,...]
-unlock     <ls_name> <lkid>            [<flag>,...]
-convert    <ls_name> <lkid> <mode>     [<flag>,...]
-
-So, dlm_tool is standing in for what would usually be two different entities.
-The first set of config/control actions would usually be performed by a system
-daemon associated with a cluster membership manager.  The second set of libdlm
-actions would usually be performed by an application that wants to use the dlm
-for synchronization.
-
-
-Example
-
-1. There are three machines that we want to use the dlm:
-
-nodea -- 10.0.0.1 
-nodeb -- 10.0.0.2
-nodec -- 10.0.0.3
-
-
-2. We'll pick arbitrary integer node ID's for these machines:
-
-nodea -- 1
-nodeb -- 2
-nodec -- 3
-
-
-3. On each node we first need to tell the dlm what the local IP address
-and nodeid are:
-
-nodea> dlm_tool set_local 1 10.0.0.1
-nodeb> dlm_tool set_local 2 10.0.0.2
-nodec> dlm_tool set_local 3 10.0.0.3
-
-
-4. On all nodes we need to set up the nodeid to IP address mappings:
-
-all> dlm_tool set_node 1 10.0.0.1
-all> dlm_tool set_node 2 10.0.0.2
-all> dlm_tool set_node 3 10.0.0.3
-
-
-5. All dlm locking happens within a lockspace; we need to create a test
-lockspace for all the nodes to use.  This step would usually be an application
-that wants to use the dlm and creates a lockspace to use.
-
-all> dlm_tool create test
-
-
-6. The lockspace needs to be "started" on all the nodes.  The <event_nr>
-should begin at 1 and be incremented for each consecutive start that's done on
-the dlm.  The <type> field isn't used by the dlm and can be 0.  Finally, a
-list of nodeid's using the lockspace is given.
-
-all> dlm_tool start test 1 0 1 2 3
-
-
-7. The dlm will now start up on all three nodes.  Whenever it starts it needs
-to do recovery.  Once recovery is done, the event_nr used for the start (1
-above) will be shown as the dlm_tool get_done output.  You need to wait for
-this on all nodes (i.e. for all nodes to complete recovery) before moving on
-to the next step.
-
-all> dlm_tool get_done test
-done event_nr 1
-
-
-8. The lockspace finally needs to know that recovery is finished on all nodes.
-The event_nr used for the start is used here.
-
-all> dlm_tool finish test 1
-
-
-9. The lockspace can now be used by the application for locking, or using
-dlm_tool using the libdlm actions above.
-
-all> dlm_tool lock/unlock/convert ...
-
-
-10. Say that nodea fails.  Nodeb and nodec need to remove nodea from the
-lockspace and do recovery.  The first step is to suspend the dlm operation on
-the remaining nodes:
-
-nodeb,nodec> dlm_tool stop test
-
-
-11. The lockspace then needs to be started again with the new set of lockspace
-members and an incremented event_nr.
-
-nodeb,nodec> dlm_tool start test 2 0 2 3
-
-
-12. We wait for recovery to complete on nodeb and nodec.
-
-nodeb,nodec> dlm_tool get_done test
-done event_nr 2
-
-
-13. Tell the lockspace that recovery is finished on both nodes.
-
-nodeb,nodec> dlm_tool finish test 2
-
-
-14. Nodea comes back and wants to use the dlm again.
-
-nodea> dlm_tool create test
-
-
-15. To add nodea back into the lockspace, first suspend lockspace operations
-on nodeb and nodec.
-
-nodeb,nodec> dlm_tool stop test
-
-
-16.  Start the lockspace on all the nodes with an incremented event_nr
-(event_nr can go back to 1 again for nodea).
-
-nodeb,nodec> dlm_tool start test 3 0 1 2 3
-nodea>       dlm_tool start test 1 0 1 2 3
-
-
-17. Wait for all nodes to complete recovery.
-
-nodeb,nodec> dlm_tool get_done test
-done event_nr 3
-
-nodea> dlm_tool get_done test
-done event_nr 1
-
-
-18. Tell the lockspace that recovery is finished everywhere.
-
-nodeb,nodec> dlm_tool finish test 3
-nodea>       dlm_tool finish test 1
-
-
-
-Notes:
-
-- When you use more than one lockspace on the nodes, you need to use
-  dlm_tool set_id on all nodes to assign each lockspace a unique
-  integer id.  This is done between the create and the first start.
-
-- A node can leave a lockspace using dlm_tool release (the opposite of
-  dlm_tool create).
-
diff --git a/dlm/doc/example.c b/dlm/doc/example.c
deleted file mode 100644
index 9f3ea11..0000000
--- a/dlm/doc/example.c
+++ /dev/null
@@ -1,52 +0,0 @@
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdint.h>
-#include <errno.h>
-#include <string.h>
-#include <stdio.h>
-#include <signal.h>
-#include <libdlm.h>
-
-/*
- * Simple libdlm locking demo
- *
- * Daniel Phillips, phillips@redhat.com
- *
- */
-
-#define error(string, args...) do { printf(string, ##args); exit(1); } while (0)
-
-void my_ast(void *arg)
-{
-	printf("ast got arg %p\n", arg);
-}
-
-int main(void)
-{
-	int fd, child;
-	struct dlm_lksb lksb;
-
-	if ((fd = dlm_get_fd()) < 0)
-		error("dlm error %i, %s\n", errno, strerror(errno));
-
-	switch (child = fork()) {
-	case -1:
-		error("fork error %i, %s\n", errno, strerror(errno));
-	case 0:
-		while (1)
-			dlm_dispatch(fd);
-	}
-
-	if (dlm_lock(LKM_PWMODE, &lksb, LKF_NOQUEUE, "foo", 3,
-		     0, my_ast, (void *)&fd, NULL, NULL) < 0)
-		error("dlm error %i, %s\n", errno, strerror(errno));
-	sleep(1);
-
-	if (dlm_unlock(lksb.sb_lkid, 0, &lksb, NULL) < 0)
-		error("dlm error %i, %s\n", errno, strerror(errno));
-	sleep(1);
-
-	kill(child, SIGTERM);
-	return 0;
-}
-
diff --git a/dlm/doc/libdlm.txt b/dlm/doc/libdlm.txt
deleted file mode 100644
index 18d44f9..0000000
--- a/dlm/doc/libdlm.txt
+++ /dev/null
@@ -1,533 +0,0 @@
-User-space interface to DLM
----------------------------
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdint.h>
-#include <libdlm.h>
-
-cc -D_REENTRANT prog.c  -ldlm -lpthread
-
-cc prog.c  -ldlm_lt
-
-
-There are basically two interfaces to libdlm. The first is the "dead simple"
-one that has limited functionality and assumes that the application is linked
-with pthreads. The second is the full-featured DLM interface that looks
-identical to the kernel interface.
-
-See CVS dlm/tests/usertest for examples of use of both these APIs.
-
-The simple one
---------------
-This provides two API calls, lock_resource() and unlock_resource(). Both of
-these calls block until the lock operation has completed - using a worker
-thread to deal with the callbacks that come from the kernel.
-
-int lock_resource(const char *resource, int mode, int flags, int *lockid);
-
-  This function locks a named (NUL-terminated) resource and returns the
-  lockid if successful. The mode may be any of
-
-    LKM_NLMODE LKM_CRMODE LKM_CWMODE LKM_PRMODE LKM_PWMODE LKM_EXMODE
-
-  Flags may be any combination of
-
-    LKF_NOQUEUE - Don't wait if the lock cannot be granted immediately,
-                  will return EAGAIN if this is so.
-
-    LKF_CONVERT - Convert lock to new mode. *lockid must be valid,
-                  resource name is ignored.
-
-    LKF_QUECVT  - Add conversion to the back of the convert queue - only
-                  valid for some convert operations
-
-    LKF_PERSISTENT - Don't automatically unlock this lock when the process
-                     exits (must be root).
-
-
-int unlock_resource(int lockid);
-
-  Unlocks the resource.
-
-
-
-The complicated one
--------------------
-This interface is identical to the kernel interface with the exception of
-the lockspace argument. All userland locks sit in the same lockspace by default.
-
-libdlm can be used in pthread or non-pthread applications. For pthread
-applications simply call the following function before doing any lock
-operations. If you're using pthreads, remember to define _REENTRANT at the
-top of the program or using -D_REENTRANT on the compile line.
-
-int dlm_pthread_init()
-
-  Creates a thread to receive all lock ASTs. The AST callback function
-  for lock operations will be called in the context of this thread.
-  If there is a potential for local resource access conflicts you must
-  provide your own pthread-based locking in the AST routine.
-
-
-int dlm_pthread_cleanup()
-
-  Cleans up the default lockspace threads after use. Normally you 
-  don't need to call this, but if the locking code is in a 
-  dynamically loadable shared library this will probably be necessary.
-
-
-For non-pthread based applications the DLM provides a file descriptor
-that the program can feed into poll/select. If activity is detected
-on that FD then a dispatch function should be called:
-
-int dlm_get_fd()
-
-  Returns a file-descriptor for the DLM suitable for passing in to
-  poll() or select().
-
-int dlm_dispatch(int fd)
-
-  Reads from the DLM and calls any AST routines that may be needed.
-  This routine runs in the context of the caller so no extra locking
-  is needed to protect local resources.
-
-
-int dlm_lock(uint32_t mode,
-	     struct dlm_lksb *lksb,
-	     uint32_t flags,
-	     const void *name,
-	     unsigned int namelen,
-	     uint32_t parent,
-	     void (*astaddr) (void *astarg),
-	     void *astarg,
-	     void (*bastaddr) (void *astarg),
-	     struct dlm_range *range);
-	      
-
-mode		lock mode:
-                LKM_NLMODE 	NULL Lock
-		LKM_CRMODE    	Concurrent read
-		LKM_CWMODE    	Concurrent write
-		LKM_PRMODE    	Protected read
-		LKM_PWMODE    	Protected write
-		LKM_EXMODE    	Exclusive
-
-flags		LKF_NOQUEUE	Don't queue the lock. If it cannot be
-				granted return -EAGAIN
-		LKF_CONVERT	Convert an existing lock
-		LKF_VALBLK	Lock has a value block
-		LKF_QUECVT	Put conversion to the back of the queue
-		LKF_EXPEDITE    Grant a NL lock immediately regardless of
-				other locks on the conversion queue
-		LKF_PERSISTENT  Specifies a lock that will
-                                not be unlocked when the process exits.
-
-lksb		Lock status block.
-		This structure contains the returned lock ID, the actual
-		status of the lock operation (all lock ops are asynchronous)
-		and the value block if LKF_VALBLK is set.
-
-name		Name of the lock. Can be binary, max 64 bytes. Ignored for lock
-		conversions.
-
-namelen		Length of the above name. Ignored for lock conversions.
-
-parent		ID of parent lock or NULL if this is a top-level lock
-
-ast		Address of AST routine to be called when the lock operation
-		completes. The final completion status of the lock will be
-		in the lksb. the AST routine must not be NULL.
-		
-astargs		Argument to pass to the AST routine (most people pass the lksb
-		in here but it can be anything you like.)
-		
-bast		Blocking AST routine. address of a function to call if this 
-		lock is blocking another. The function will be called with
-		astargs. 
-
-range		an optional structure of two uint64_t that indicate the range
-		of the lock. Locks with overlapping ranges will be granted only
-		if the lock modes are compatible. locks with non-overlapping
-		ranges (on the same resource) do not conflict. A lock with no
-		range is assumed to have a range emcompassing the largest
-		possible range. ie. 0-0xFFFFFFFFFFFFFFFF.  Note that is is more
-		efficient to specify no range than to specify the full range
-		above.
-
-
-dlm_lock operations are asynchronous. If the call to dlm_lock returns an error
-then the operation has failed and the AST routine will not be called. If
-dlm_lock returns 0 it is still possible that the lock operation will fail. The
-AST routine will be called when the locking is complete or has failed and the
-status is returned in the lksb.
-
-For conversion operations the name and namelen are ignored and the lock ID in
-the LKSB is used to identify the lock.  
-
-If a lock value block is specified then in general, a grant or a conversion to 
-an equal-level or higher-level lock mode reads the lock value from the resource 
-into the caller's lock value block. When a lock conversion from EX or PW
-to an equal-level or lower-level lock mode occurs, the contents of 
-the caller's lock value block are written into the resource.
-
-If the AST routines or parameter are passed to a conversion operation then they
-will overwrite those values that were passed to a previous dlm_lock call.
-
-int dlm_lock_wait(uint32_t mode,
-		  struct dlm_lksb *lksb,
-		  uint32_t flags,
-		  const void *name,
-		  unsigned int namelen,
-		  uint32_t parent,
-		  void *bastarg,
-		  void (*bastaddr) (void *bastarg),
-		  struct dlm_range *range);
-	      
-
-As above except that the call will block until the lock is
-granted or has failed. The return from the function is
-the final status of the lock request (ie that was returned
-in the lksb after the AST routine was called).
-
-
-
-int dlm_unlock(uint32_t lkid, 
-               uint32_t flags, 
-               struct dlm_lksb *lksb, 
-               void *astarg)
-
-lkid		Lock ID as returned in the lksb
-
-flags		flags affecting the unlock operation:
-		LKF_CANCEL	CANCEL a pending lock or conversion. 
-				This returns the lock to it's
-				previously granted mode (in case of a
-				conversion) or unlocks it (in case of a
-				waiting lock).
-					
-		LKF_IVVALBLK	Invalidate value block
-
-lksb		LKSB to return status and value block information. 
-
-astarg 		New parameter to be passed to the completion AST.
-		The completion AST routine is the
-		last completion AST routine specified in a dlm_lock call.
-		If dlm_lock_wait() was the last routine to issue a lock, 
-		dlm_unlock_wait() must be used to release the lock. If dlm_lock()
-		was the last routine to issue a lock then either dlm_unlock()
-		or dlm_unlock_wait() may be called.
-		
-Unlocks are also asynchronous. The AST routine is called when the resource is
-successfully unlocked (see below).
-
-
-Extra status returns to the completion AST (apart from those already
-defined in errno.h)
-
-ECANCEL
-  A lock conversion was successfully cancelled
-  
-EUNLOCK
-  An Unlock operation completed successfully
-
-EDEADLOCK
-  The lock operation is causing a deadlock and has been cancelled. If this
-  was a conversion then the lock is reverted to its previously granted state.
-  If it was a new lock then it has not been granted. 
-  (NB Only conversion deadlocks are currently detected)
-  
-int dlm_unlock_wait(uint32_t lkid, 
-                    uint32 flags, 
-                    struct dlm_lksb *lksb)
-
-As above but returns when the unlock operation is complete either because it
-finished or because an error was detected. In the case where
-the unlock operation was succesful no error is returned.
-
-The return value of the function call is the status of issuing
-the unlock operation. The status of the unlock operation itself
-is in the lock status block. Both of these must be checked to
-verify that the unlock has completed succesfully.
-
-Lock Query Operations
----------------------
-int dlm_query(struct dlm_lksb *lksb,
-              int query,
-	      struct dlm_queryinfo *qinfo,
-	      void (*ast_routine(void *astarg)),
-	      void *astarg);
-
-The operation is asynchronous, the ultimate status and data will be returned into the
-dlm_query_info structure which should be checked when the ast_routine is
-called. The lksb must contain a valid lock ID in sb_lkid which is used to 
-identify the resource to be queried, status will be returned in sb_status;
-As with the locking calls an AST woutine will be called when the query completes
-if the call itself returns 0.
-
-int dlm_query_wait(struct dlm_lksb *lksb,
-                   int query,
-	           struct dlm_queryinfo *qinfo)
-
-Same as dlm_query() except that it waits for the operation to complete.
-When the operation is complete the status of will be in the lksb. Both
-the return value from the function call and the condition code in the
-lksb must be evaluated.
-
-If the provided lock list is too short to hold all the locks, then sb_status
-in the lksb will contain -E2BIG but the list will be filled in as far as possible.
-Either gqi_lockinfo or gqi_resinfo may be NULL if that information is not required.
-
-/* Structures passed into and out of the query */
-
-struct gdlm_lockinfo
-{
-    int   lki_lkid;          /* Lock ID on originating node */
-    int   lki_parent;
-    int   lki_node;          /* Originating node (not master) */
-    int   lki_ownpid;        /* Owner pid on the originating node */
-    uint8 lki_state;         /* Queue the lock is on */
-    int8  lki_grmode         /* Granted mode */
-    int8  lki_rqmode;        /* Requested mode */
-    struct dlm_range lki_grrange /* Granted range, if applicable */
-    struct dlm_range lki_rqrange /* Requested range, if applicable */
-};
-
-struct gdlm_resinfo
-{
-    int	 rsi_length;
-    int  rsi_grantcount; /* No. of nodes on grant queue */
-    int  rsi_convcount;  /* No. of nodes on convert queue */
-    int  rsi_waitcount;  /* No. of nodes on wait queue */
-    int  rsi_masternode; /* Master for this resource */
-    char rsi_name[DLM_RESNAME_MAXLEN]; /* Resource name */
-    char rsi_valblk[DLM_LVB_LEN];      /* Master's LVB contents, if applicable */
-};
-
-struct dlm_queryinfo
-{
-    struct dlm_resinfo  *gqi_resinfo;   /* Points to a single resinfo struct */
-    struct dlm_lockinfo *gqi_lockinfo;  /* This points to an array of structs */
-    int                   gqi_locksize;  /* input */
-    int                   gqi_lockcount; /* output */
-};
-
-The query is made up of several blocks of bits as follows:
-
-                   9  8        6  5     3           0
-+----------------+---+-------+---+-------+-----------+
-|    reserved    | Q | query | F | queue | lock mode |
-+----------------+---+-------+---+-------+-----------+
-
-lock mode is a normal DLM lock mode or DLM_LOCK_THIS
-to use the mode of the lock in sb_lkid.
-
-queue is a bitmap of
- DLM_QUERY_QUEUE_WAIT
- DLM_QUERY_QUEUE_CONVERT
- DLM_QUERY_QUEUE_GRANT
-
-or one of the two shorthands:
- DLM_QUERY_QUEUE_GRANTED (for WAIT+GRANT)
- DLM_QUERY_QUEUE_ALL     (for all queues)
-
- F is a flag DLM_QUERY_LOCAL
-which specifies that a remote access should not
-happen. Only lock information that can
-be gleaned from the local node will be returned so
-be aware that it may not be complete.
-
-The query is one of the following:
- DLM_QUERY_LOCKS_HIGHER
- DLM_QUERY_LOCKS_LOWER
- DLM_QUERY_LOCKS_EQUAL
- DLM_QUERY_LOCKS_BLOCKING
- DLM_QUERY_LOCKS_NOTBLOCK
- DLM_QUERY_LOCKS_ALL
-
-which specifies which locks to look for by mode,
-either the lockmode is lower, equal or higher
-to the mode at the bottom of the query. 
-DLM_QUERY_ALL will return all locks on the
-resource.
-
-DLM_QUERY_LOCKS_BLOCKING returns only locks
-that are blocking the current lock. The lock
-must not be waiting for grant or conversion
-for this to be a valid query, the other flags
-are ignored.
-
-DLM_QUERY_LOCKS_NOTBLOCKING returns only locks
-that are granted but NOT blocking the current lock.
-
-Q specifies which lock queue to compare. By default
-the granted queue is used. If the flags 
-DLM_QUERY_RQMODE is set then the requested mode
-will be used instead.
-
-
-The "normal" way to call dlm_query is to put the
-address of the dlm_queryinfo struct into 
-lksb.sb_lvbptr and pass the lksb as the AST param,
-that way all the information is available to you
-in the AST routine.
-
-Lockspace Operations
---------------------
-The DLM allows locks to be partitioned into "lockspaces", and these can be
-manipulated by userspace calls. It is possible (though not recommended) for
-an application to have multiple lockspaces open at one time. 
-
-All the above calls work on the "default" lockspace, which should be
-fine for most users. The calls below allow you to isolate your
-application from all others running in the cluster. Remember, lockspaces
-are a cluster-wide resource, so if you create a lockspace called "myls" it 
-will share locks with a lockspace called "myls" on all nodes.
-
-
-dlm_lshandle_t dlm_create_lockspace(const char *name, mode_t mode);
-
-  This creates a lockspace called <name> and the mode of the file 
-  user to access it wil be <mode> (subject to umask as usual). 
-  The lockspace must not already exist on this node, if it does -1
-  will be returned and errno will be set to EEXIST. If you really
-  want to use this lockspace you can then user dlm_open_lockspace()
-  below. The name is the name of a misc device that will be created
-  in /dev/misc.
-
-  On success a handle to the lockspace is returned, which can be used 
-  to pass into subsequent dlm_ls_lock/unlock calls. Make no assumptions
-  as to the content of this handle as it's content may change in future.
-
-  The caller must have CAP_SYSADMIN privileges to do this operation.
-
-
-int dlm_release_lockspace(const char *name, dlm_lshandle_t lockspace, int force)
-
-  Deletes a lockspace. If the lockspace still has active locks then -1 will be
-  returned and errno set to EBUSY. Both the lockspace handle /and/ the name
-  must be specified. This call also closes the lockspace and stops the thread
-  associated with the lockspace, if any.
-
-  Note that other nodes in the cluster may still have locks open on this 
-  lockspace.
-  This call only removes the lockspace from the current node.
-
-  If the force flag is set then the lockspace will be removed even if another
-  user on this node has active locks in it. Existing users will NOT
-  be notified if you do this, so be careful.
-
-
-dlm_lshandle_t dlm_open_lockspace(const char *name)
-
-  Opens an already existing lockspace and returns a handle to it.
-
-
-int dlm_close_lockspace(dlm_lshandle_t lockspace)
-
-  Close the lockspace. Any locks held by this process will be freed.
-  If a thread is associated with this lockspace then it will be stopped.
-
-
-int dlm_ls_get_fd(dlm_lshandle_t lockspace)
-
-  Returns the file descriptor associated with the lockspace so that the
-  user call use it as input to poll/select.
-
-
-int dlm_ls_pthread_init(dlm_lshandle_t lockspace)
-
-  Initialise threaded environment for this lockspace, similar
-  to dlm_pthread_init() above.
-
-
-int dlm_ls_lock(dlm_lshandle_t lockspace,
-		int mode,
-		struct dlm_lksb *lksb,
-		uint32_t flags,
-		void *name,
-		unsigned int namelen,
-		uint32_t parent,
-		void (*ast) (void *astarg),
-		void *astarg,
-		void (*bast) (void *astarg),
-		struct dlm_range *range)
-
-  Same as dlm_lock() above but takes a lockspace argument.
-
-int dlm_ls_lock_wait(dlm_lshandle_t lockspace,
-		     int mode,
-		     struct dlm_lksb *lksb,
-		     uint32_t flags,
-		     void *name,
-		     unsigned int namelen,
-		     uint32_t parent,
-		     void *bastarg,
-		     void (*bast) (void *bastarg),
-		     struct dlm_range *range)
-
-  Same as dlm_lock_wait() above but takes a lockspace argument.
-
-
-int dlm_ls_unlock(dlm_lshandle_t lockspace,
-		  uint32_t lkid, 
-                  uint32_t flags, 
-                  struct dlm_lksb *lksb, 
-                  void *astarg)
-
-
-  Same as dlm_unlock above but takes a lockspace argument.
-
-int dlm_ls_unlock_wait(dlm_lshandle_t lockspace,
-		       uint32_t lkid, 
-                       uint32_t flags, 
-                       struct dlm_lksb *lksb)
-
-
-  Same as dlm_unlock_wait above but takes a lockspace argument.
-
-
-int dlm_ls_query(dlm_lshandle_t lockspace,
-                 struct dlm_lksb *lksb,
-                 int query,
-	         struct dlm_queryinfo *qinfo,
-	         void (*ast_routine(void *astarg)),
-	         void *astarg);
-
-  Same as dlm_query above but takes a lockspace argument.
-
-int dlm_ls_query_wait(dlm_lshandle_t lockspace,
-                      struct dlm_lksb *lksb,
-                      int query,
-	              struct dlm_queryinfo *qinfo)
-
-  Same as dlm_query_wait above but takes a lockspace argument.
-
-
-One further point about lockspace operations is that there is no locking
-on the creating/destruction of lockspaces in the library so it is up to the
-application to only call dlm_*_lockspace when it is sure that
-no other locking operations are likely to be happening within that process.
-
-Libraries
----------
-There are two DLM libraries, one that uses pthreads (libdlm) to deliver ASTs
-and a light one one that doesn't (libdlm_lt). 
-
-The "light" library contains only the following calls.
-
-- dlm_lock
-- dlm_unlock
-- dlm_query
-- dlm_get_fd
-- dlm_dispatch
-- dlm_ls_lock
-- dlm_ls_unlock
-- dlm_ls_query
-- dlm_ls_get_fd
-- dlm_create_lockspace
-- dlm_open_lockspace
-- dlm_release_lockspace
-- dlm_close_lockspace
-
-Note that libdlm (the pthreads one) also contains the non-threaded calls
-so you can choose at runtime if you need to.
diff --git a/dlm/doc/user-dlm-overview.txt b/dlm/doc/user-dlm-overview.txt
deleted file mode 100644
index bda3aea..0000000
--- a/dlm/doc/user-dlm-overview.txt
+++ /dev/null
@@ -1,325 +0,0 @@
-
-There are five ways to request a dlm lock (and five corresponding ways to
-unlock).
-
-- lock_resource
-- dlm_lock
-- dlm_ls_lock
-- dlm_lock_wait
-- dlm_ls_lock_wait
-
-- unlock_resource
-- dlm_unlock
-- dlm_ls_unlock
-- dlm_unlock_wait
-- dlm_ls_unlock_wait
-
-There is also a set of "administrative" functions that are used along with
-some of the lock/unlock requests.  Which are used depends on which locking
-method is used or whether the application is threaded.
-
-- dlm_pthread_init
-- dlm_ls_pthread_init
-- dlm_pthread_cleanup
-- dlm_get_fd
-- dlm_ls_get_fd
-- dlm_dispatch
-- dlm_create_lockspace
-- dlm_open_lockspace
-- dlm_release_lockspace
-- dlm_close_lockspace
-
-
-Overview of lock request methods
---------------------------------
-
-- synchronous, default lockspace
-  use dlm_pthread_init/dlm_pthread_cleanup if app is threaded
-  use dlm_get_fd/dlm_dispatch if app is not threaded
-  use unlock_resource to unlock
-
-int lock_resource(
-        const char *resource,
-        uint32_t mode,
-        uint32_t flags,
-        uint32_t *lkid);
-
-
-- asynchronous, default lockspace
-  use dlm_pthread_init/dlm_pthread_cleanup if app is threaded
-  use dlm_get_fd/dlm_dispatch if app is not threaded
-  use dlm_unlock/dlm_unlock_wait to unlock
-
-int dlm_lock(
-        uint32_t mode,
-        struct dlm_lksb *lksb,
-        uint32_t flags,
-        void *name,
-        unsigned int namelen,
-        uint32_t parent,
-        void (*ast) (void *astarg),
-        void *astarg,
-        void (*bast) (void *astarg),
-        struct dlm_range *range);
-
-
-- synchronous, default lockspace
-  use dlm_pthread_init/dlm_pthread_cleanup if app is threaded
-  use dlm_get_fd/dlm_dispatch if app is not threaded
-  use dlm_unlock/dlm_unlock_wait to unlock
-
-int dlm_lock_wait(
-        uint32_t mode,
-        struct dlm_lksb *lksb,
-        uint32_t flags,
-        void *name,
-        unsigned int namelen,
-        uint32_t parent,
-        void *bastarg,
-        void (*bast) (void *bastarg),
-        struct dlm_range *range);
-
-
-- asynchronous, any lockspace
-  use dlm_ls_pthread_init/dlm_pthread_cleanup if app is threaded
-  use dlm_ls_get_fd/dlm_dispatch if app is not threaded
-  use dlm_create_lockspace/dlm_open_lockspace to start
-  use dlm_release_lockspace/dlm_close_lockspace to finish
-  use dlm_ls_unlock/dlm_ls_unlock_wait to unlock
-
-int dlm_ls_lock(
-        dlm_lshandle_t lockspace,
-        uint32_t mode,
-        struct dlm_lksb *lksb,
-        uint32_t flags,
-        void *name,
-        unsigned int namelen,
-        uint32_t parent,
-        void (*ast) (void *astarg),
-        void *astarg,
-        void (*bast) (void *astarg),
-        struct dlm_range *range);
-
-
-- synchronous, any lockspace
-  use dlm_ls_pthread_init/dlm_pthread_cleanup if app is threaded
-  use dlm_ls_get_fd/dlm_dispatch if app is not threaded
-  use dlm_create_lockspace/dlm_open_lockspace to start
-  use dlm_release_lockspace/dlm_close_lockspace to finish
-  use dlm_ls_unlock/dlm_ls_unlock_wait to unlock
-
-int dlm_ls_lock_wait(
-        dlm_lshandle_t lockspace,
-        uint32_t mode,
-        struct dlm_lksb *lksb,
-        uint32_t flags,
-        void *name,
-        unsigned int namelen,
-        uint32_t parent,
-        void *bastarg,
-        void (*bast) (void *bastarg),
-        struct dlm_range *range);
-
-
-
-Corresponding unlock requests 
------------------------------
-
-int unlock_resource(
-	uint32_t lkid);
-
-int dlm_unlock(
-	uint32_t lkid,
-	uint32_t flags,
-	struct dlm_lksb *lksb,
-	void *astarg);
-
-int dlm_unlock_wait(
-	uint32_t lkid,
-	uint32_t flags,
-	struct dlm_lksb *lksb);
-
-int dlm_ls_unlock(
-	dlm_lshandle_t lockspace,
-	uint32_t lkid,
-	uint32_t flags,
-	struct dlm_lksb *lksb,
-	void *astarg);
-
-int dlm_ls_unlock_wait(
-	dlm_lshandle_t lockspace,
-	uint32_t lkid,
-	uint32_t flags,
-	struct dlm_lksb *lksb);
-
-
-
-Common to all of the above
---------------------------
-
-#define DLM_RESNAME_MAXLEN (64)
-#define DLM_LVB_LEN        (32)
-
-#define LKM_NLMODE         0               /* null lock */
-#define LKM_CRMODE         1               /* concurrent read */
-#define LKM_CWMODE         2               /* concurrent write */
-#define LKM_PRMODE         3               /* protected read */
-#define LKM_PWMODE         4               /* protected write */
-#define LKM_EXMODE         5               /* exclusive */
-
-#define LKF_NOQUEUE        (0x00000001)
-#define LKF_CANCEL         (0x00000002)
-#define LKF_CONVERT        (0x00000004)
-#define LKF_VALBLK         (0x00000008)
-#define LKF_QUECVT         (0x00000010)
-#define LKF_IVVALBLK       (0x00000020)
-#define LKF_CONVDEADLK     (0x00000040)
-#define LKF_PERSISTENT     (0x00000080)
-#define LKF_NODLCKWT       (0x00000100)
-#define LKF_NODLCKBLK      (0x00000200)
-#define LKF_EXPEDITE       (0x00000400)
-#define LKF_NOQUEUEBAST    (0x00000800)
-#define LKF_HEADQUE        (0x00001000)
-#define LKF_NOORDER        (0x00002000)
-
-#define ECANCEL            (0x10001)
-#define EUNLOCK            (0x10002)
-#define EINPROG            (0x10003)
-
-struct dlm_lksb {
-	int sb_status;
-	uint32_t sb_lkid;
-	char sb_flags;
-	char *sb_lvbptr;
-};
-
-struct dlm_range {
-	uint64_t ra_start;
-	uint64_t ra_end;
-};
-
-
-
-
-Overview of administrative functions
-------------------------------------
-
-- dlm_pthread_init
-- dlm_ls_pthread_init
-- dlm_pthread_cleanup
-- dlm_get_fd
-- dlm_ls_get_fd
-- dlm_dispatch
-- dlm_create_lockspace
-- dlm_open_lockspace
-- dlm_release_lockspace
-- dlm_close_lockspace
-
-
-typedef void * dlm_lshandle_t;
-
-dlm_lshandle_t dlm_create_lockspace(const char *name, mode_t mode);
-
-int dlm_release_lockspace(const char *name, dlm_lshandle_t ls, int force);
-
-dlm_lshandle_t dlm_open_lockspace(const char *name);
-
-int dlm_close_lockspace(dlm_lshandle_t ls);
-
-int dlm_pthread_init();
-
-int dlm_ls_pthread_init(dlm_lshandle_t lockspace);
-
-int dlm_pthread_cleanup();
-
-int dlm_get_fd();
-
-int dlm_ls_get_fd(dlm_lshandle_t ls);
-
-int dlm_dispatch(int fd);
-
-
-
-Query functions
----------------
-
-Query functions follow the same pattern as the lock and unlock functions.
-
-int dlm_query(
-	struct dlm_lksb *lksb,
-	int query,
-	struct dlm_queryinfo *qinfo,
-	void (*astaddr) (void *astarg),
-	void *astarg);
-
-int dlm_query_wait(
-	struct dlm_lksb *lksb,
-	int query,
-	struct dlm_queryinfo *qinfo);
-
-int dlm_ls_query(
-	dlm_lshandle_t lockspace,
-	struct dlm_lksb *lksb,
-	int query,
-	struct dlm_queryinfo *qinfo,
-	void (*astaddr) (void *astarg),
-	void *astarg);
-
-int dlm_ls_query_wait(
-	dlm_lshandle_t lockspace,
-	struct dlm_lksb *lksb,
-	int query,
-	struct dlm_queryinfo *qinfo);
-
-#define DLM_LOCK_THIS            0x0007
-#define DLM_QUERY_MODE_MASK      0x0007
-
-#define DLM_QUERY_QUEUE_WAIT     0x0008
-#define DLM_QUERY_QUEUE_CONVERT  0x0010
-#define DLM_QUERY_QUEUE_GRANT    0x0020
-#define DLM_QUERY_QUEUE_GRANTED  0x0030
-#define DLM_QUERY_QUEUE_ALL      0x0038
-
-#define DLM_QUERY_LOCKS_HIGHER   0x0100
-#define DLM_QUERY_LOCKS_LOWER    0x0200
-#define DLM_QUERY_LOCKS_EQUAL    0x0300
-#define DLM_QUERY_LOCKS_BLOCKING 0x0400
-#define DLM_QUERY_LOCKS_NOTBLOCK 0x0500
-#define DLM_QUERY_LOCKS_ALL      0x0600
-#define DLM_QUERY_MASK           0x0F00
-
-#define DLM_QUERY_GRMODE         0x0000
-#define DLM_QUERY_RQMODE         0x1000
-
-struct dlm_lockinfo {
-        int lki_lkid;
-        int lki_mstlkid;
-        int lki_parent;
-        int lki_node;
-        int lki_ownpid;
-        uint8_t lki_state;
-        uint8_t lki_grmode;
-        uint8_t lki_rqmode;
-        struct dlm_range lki_grrange;
-        struct dlm_range lki_rqrange;
-};
-
-struct dlm_resinfo {
-        int rsi_length;
-        int rsi_grantcount;
-        int rsi_convcount;
-        int rsi_waitcount;
-        int rsi_masternode;
-        char rsi_name[DLM_RESNAME_MAXLEN];
-        char rsi_valblk[DLM_LVB_LEN];
-};
-
-struct dlm_queryinfo {
-        struct dlm_resinfo *gqi_resinfo;
-        struct dlm_lockinfo *gqi_lockinfo;
-        int gqi_locksize;
-        int gqi_lockcount;
-};
-
-
-
diff --git a/dlm/libdlm/51-dlm.rules b/dlm/libdlm/51-dlm.rules
deleted file mode 100644
index f71e79d..0000000
--- a/dlm/libdlm/51-dlm.rules
+++ /dev/null
@@ -1,5 +0,0 @@
-KERNEL=="dlm-control", NAME="misc/dlm-control", MODE="0666"
-KERNEL=="dlm-monitor", NAME="misc/dlm-monitor", MODE="0666"
-KERNEL=="dlm_default", NAME="misc/dlm_default", MODE="0666"
-KERNEL=="dlm_*", NAME="misc/%k", MODE="0660"
-
diff --git a/dlm/libdlm/Makefile b/dlm/libdlm/Makefile
deleted file mode 100644
index 3419dfb..0000000
--- a/dlm/libdlm/Makefile
+++ /dev/null
@@ -1,61 +0,0 @@
-TARGET= libdlm
-
-LIBDIRT=$(TARGET).a \
-	$(TARGET)_lt.a \
-	$(TARGET).so.${SOMAJOR}.${SOMINOR} \
-	$(TARGET)_lt.so.${SOMAJOR}.${SOMINOR}
-
-LIBSYMT=$(TARGET).so \
-	$(TARGET)_lt.so \
-	$(TARGET).so.$(SOMAJOR) \
-	$(TARGET)_lt.so.$(SOMAJOR)
-
-INCDIRT=$(TARGET).h
-
-UDEVT=51-dlm.rules
-
-include ../../make/defines.mk
-
-SHAREDLIB=$(TARGET).so.${SOMAJOR}.${SOMINOR} $(TARGET)_lt.so.${SOMAJOR}.${SOMINOR}
-STATICLIB=$(TARGET).a $(TARGET)_lt.a
-
-all: $(STATICLIB) $(SHAREDLIB)
-
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-CFLAGS += -fPIC
-CFLAGS += -I$(S)
-CFLAGS += -I${incdir}
-CFLAGS += -I$(KERNEL_SRC)/include
-
-REENT_CFLAGS += -D_REENTRANT
-
-LDFLAGS += -L${libdir}
-
-PTHREAD_LDFLAGS += -lpthread 
-
-$(TARGET).a: $(TARGET).o
-	${AR} cru $@ $^
-	${RANLIB} $@
-
-$(TARGET)_lt.a: $(TARGET)_lt.o
-	${AR} cru $@ $^
-	${RANLIB} $@
-
-$(TARGET).so.${SOMAJOR}.${SOMINOR}: $(TARGET).o
-	$(CC) -shared -o $@ -Wl,-soname=$(TARGET).so.$(SOMAJOR) $< $(PTHREAD_LDFLAGS) $(LDFLAGS)
-	ln -sf $(TARGET).so.$(SOMAJOR).$(SOMINOR) $(TARGET).so
-	ln -sf $(TARGET).so.$(SOMAJOR).$(SOMINOR) $(TARGET).so.$(SOMAJOR)
-
-$(TARGET)_lt.so.${SOMAJOR}.${SOMINOR}: $(TARGET)_lt.o
-	$(CC) -shared -o $@ -Wl,-soname=$(TARGET)_lt.so.$(SOMAJOR) $< $(LDFLAGS)
-	ln -sf $(TARGET)_lt.so.$(SOMAJOR).$(SOMINOR) $(TARGET)_lt.so
-	ln -sf $(TARGET)_lt.so.$(SOMAJOR).$(SOMINOR) $(TARGET)_lt.so.$(SOMAJOR)
-
-clean: generalclean
-
--include $(TARGET).d
--include $(TARGET)_lt.d
diff --git a/dlm/libdlm/libdlm.c b/dlm/libdlm/libdlm.c
deleted file mode 100644
index af203d4..0000000
--- a/dlm/libdlm/libdlm.c
+++ /dev/null
@@ -1,1483 +0,0 @@
-#ifdef _REENTRANT
-#include <pthread.h>
-#endif
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <sys/param.h>
-#include <sys/stat.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <inttypes.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <stdio.h>
-#include <dirent.h>
-#include <linux/major.h>
-#ifdef HAVE_SELINUX
-#include <selinux/selinux.h>
-#endif
-#include <linux/types.h>
-#include <linux/dlm.h>
-#define BUILDING_LIBDLM
-#include "libdlm.h"
-#include <linux/dlm_device.h>
-
-#define MISC_PREFIX		"/dev/misc/"
-#define DLM_PREFIX		"dlm_"
-#define DLM_MISC_PREFIX		MISC_PREFIX DLM_PREFIX
-#define DLM_CONTROL_NAME	"dlm-control"
-#define DLM_CONTROL_PATH	MISC_PREFIX DLM_CONTROL_NAME
-#define DEFAULT_LOCKSPACE	"default"
-
-/*
- * V5 of the dlm_device.h kernel/user interface structs
- */
-
-struct dlm_lock_params_v5 {
-	__u8 mode;
-	__u8 namelen;
-	__u16 flags;
-	__u32 lkid;
-	__u32 parent;
-	void *castparam;
-	void *castaddr;
-	void *bastparam;
-	void *bastaddr;
-	struct dlm_lksb *lksb;
-	char lvb[DLM_USER_LVB_LEN];
-	char name[0];
-};
-
-struct dlm_write_request_v5 {
-	__u32 version[3];
-	__u8 cmd;
-	__u8 is64bit;
-	__u8 unused[2];
-
-	union  {
-		struct dlm_lock_params_v5 lock;
-		struct dlm_lspace_params lspace;
-	} i;
-};
-
-struct dlm_lock_result_v5 {
-	__u32 length;
-	void *user_astaddr;
-	void *user_astparam;
-	struct dlm_lksb *user_lksb;
-	struct dlm_lksb lksb;
-	__u8 bast_mode;
-	__u8 unused[3];
-	/* Offsets may be zero if no data is present */
-	__u32 lvb_offset;
-};
-
-
-/*
- * One of these per lockspace in use by the application
- */
-
-struct dlm_ls_info {
-    int fd;
-#ifdef _REENTRANT
-    pthread_t tid;
-#else
-    int tid;
-#endif
-};
-
-/*
- * The default lockspace.
- * I've resisted putting locking around this as the user should be
- * "sensible" and only do lockspace operations either in the
- * main thread or ... carefully...
- */
-
-static struct dlm_ls_info *default_ls = NULL;
-static int control_fd = -1;
-static struct dlm_device_version kernel_version;
-static int kernel_version_detected = 0;
-
-
-static int release_lockspace(uint32_t minor, uint32_t flags);
-
-
-static void ls_dev_name(const char *lsname, char *devname, int devlen)
-{
-	snprintf(devname, devlen, DLM_MISC_PREFIX "%s", lsname);
-}
-
-static void dummy_ast_routine(void *arg)
-{
-}
-
-#ifdef _REENTRANT
-/* Used for the synchronous and "simplified, synchronous" API routines */
-struct lock_wait
-{
-    pthread_cond_t  cond;
-    pthread_mutex_t mutex;
-    struct dlm_lksb lksb;
-};
-
-static void sync_ast_routine(void *arg)
-{
-    struct lock_wait *lwait = arg;
-
-    pthread_mutex_lock(&lwait->mutex);
-    pthread_cond_signal(&lwait->cond);
-    pthread_mutex_unlock(&lwait->mutex);
-}
-
-/* lock_resource & unlock_resource
- * are the simplified, synchronous API.
- * Aways uses the default lockspace.
- */
-int lock_resource(const char *resource, int mode, int flags, int *lockid)
-{
-    int status;
-    struct lock_wait lwait;
-
-    if (default_ls == NULL)
-    {
-	if (dlm_pthread_init())
-	{
-	    return -1;
-	}
-    }
-
-    if (!lockid)
-    {
-	errno = EINVAL;
-	return -1;
-    }
-
-    /* Conversions need the lockid in the LKSB */
-    if (flags & LKF_CONVERT)
-	lwait.lksb.sb_lkid = *lockid;
-
-    pthread_cond_init(&lwait.cond, NULL);
-    pthread_mutex_init(&lwait.mutex, NULL);
-    pthread_mutex_lock(&lwait.mutex);
-
-    status = dlm_lock(mode,
-		      &lwait.lksb,
-		      flags,
-		      resource,
-		      strlen(resource),
-		      0,
-		      sync_ast_routine,
-		      &lwait,
-		      NULL,
-		      NULL);
-    if (status)
-	return status;
-
-    /* Wait for it to complete */
-    pthread_cond_wait(&lwait.cond, &lwait.mutex);
-    pthread_mutex_unlock(&lwait.mutex);
-
-    *lockid = lwait.lksb.sb_lkid;
-
-    errno = lwait.lksb.sb_status;
-    if (lwait.lksb.sb_status)
-	return -1;
-    else
-	return 0;
-}
-
-
-int unlock_resource(int lockid)
-{
-    int status;
-    struct lock_wait lwait;
-
-    if (default_ls == NULL)
-    {
-	errno = -ENOTCONN;
-	return -1;
-    }
-
-    pthread_cond_init(&lwait.cond, NULL);
-    pthread_mutex_init(&lwait.mutex, NULL);
-    pthread_mutex_lock(&lwait.mutex);
-
-    status = dlm_unlock(lockid, 0, &lwait.lksb, &lwait);
-
-    if (status)
-	return status;
-
-    /* Wait for it to complete */
-    pthread_cond_wait(&lwait.cond, &lwait.mutex);
-    pthread_mutex_unlock(&lwait.mutex);
-
-    errno = lwait.lksb.sb_status;
-    if (lwait.lksb.sb_status != DLM_EUNLOCK)
-	return -1;
-    else
-	return 0;
-}
-
-/* Tidy up threads after a lockspace is closed */
-static int ls_pthread_cleanup(struct dlm_ls_info *lsinfo)
-{
-    int status = 0;
-    int fd;
-
-    /* Must close the fd after the thread has finished */
-    fd = lsinfo->fd;
-    if (lsinfo->tid)
-    {
-	status = pthread_cancel(lsinfo->tid);
-	if (!status)
-	    pthread_join(lsinfo->tid, NULL);
-    }
-    if (!status)
-    {
-	free(lsinfo);
-	close(fd);
-    }
-
-    return status;
-}
-
-/* Cleanup default lockspace */
-int dlm_pthread_cleanup()
-{
-    struct dlm_ls_info *lsinfo = default_ls;
-
-    /* Protect users from their own stupidity */
-    if (!lsinfo)
-	return 0;
-
-    default_ls = NULL;
-
-    return ls_pthread_cleanup(lsinfo);
-}
-#else
-
-/* Non-pthread version of cleanup */
-static int ls_pthread_cleanup(struct dlm_ls_info *lsinfo)
-{
-    close(lsinfo->fd);
-    free(lsinfo);
-    return 0;
-}
-#endif
-
-
-static void set_version_v5(struct dlm_write_request_v5 *req)
-{
-	req->version[0] = kernel_version.version[0];
-	req->version[1] = kernel_version.version[1];
-	req->version[2] = kernel_version.version[2];
-	if (sizeof(long) == sizeof(long long))
-		req->is64bit = 1;
-	else
-		req->is64bit = 0;
-}
-
-static void set_version_v6(struct dlm_write_request *req)
-{
-	req->version[0] = kernel_version.version[0];
-	req->version[1] = kernel_version.version[1];
-	req->version[2] = kernel_version.version[2];
-	if (sizeof(long) == sizeof(long long))
-		req->is64bit = 1;
-	else
-		req->is64bit = 0;
-}
-
-static int open_default_lockspace(void)
-{
-	if (!default_ls) {
-		dlm_lshandle_t ls;
-
-		/* This isn't the race it looks, create_lockspace will
-		 * do the right thing if the lockspace has already been
-		 * created.
-		 */
-
-		ls = dlm_open_lockspace(DEFAULT_LOCKSPACE);
-		if (!ls)
-			ls = dlm_create_lockspace(DEFAULT_LOCKSPACE, 0600);
-		if (!ls)
-			return -1;
-
-		default_ls = (struct dlm_ls_info *)ls;
-	}
-	return 0;
-}
-
-static void detect_kernel_version(void)
-{
-	struct dlm_device_version v;
-	int rv;
-
-	rv = read(control_fd, &v, sizeof(struct dlm_device_version));
-	if (rv < 0) {
-		kernel_version.version[0] = 5;
-		kernel_version.version[1] = 0;
-		kernel_version.version[2] = 0;
-	} else {
-		kernel_version.version[0] = v.version[0];
-		kernel_version.version[1] = v.version[1];
-		kernel_version.version[2] = v.version[2];
-	}
-
-	kernel_version_detected = 1;
-}
-
-static int find_control_minor(int *minor)
-{
-	FILE *f;
-	char name[256];
-	int found = 0, m = 0;
-
-	f = fopen("/proc/misc", "r");
-	if (!f)
-		return -1;
-
-	while (!feof(f)) {
-		if (fscanf(f, "%d %s", &m, name) != 2)
-			continue;
-		if (strcmp(name, DLM_CONTROL_NAME))
-			continue;
-		found = 1;
-		break;
-	}
-	fclose(f);
-
-	if (found) {
-		*minor = m;
-		return 0;
-	}
-	return -1;
-}
-
-static int open_control_device(void)
-{
-	struct stat st;
-	int i, rv, minor, found = 0;
-
-	if (control_fd > -1)
-		goto out;
-
-	rv = find_control_minor(&minor);
-	if (rv < 0)
-		return -1;
-
-	/* wait for udev to create the device */
-
-	for (i = 0; i < 10; i++) {
-		if (stat(DLM_CONTROL_PATH, &st) == 0 &&
-		    minor(st.st_rdev) == minor) {
-			found = 1;
-			break;
-		}
-		sleep(1);
-		continue;
-	}
-
-	if (!found)
-		return -1;
-
-	control_fd = open(DLM_CONTROL_PATH, O_RDWR);
-	if (control_fd == -1)
-		return -1;
-
- out:
-	fcntl(control_fd, F_SETFD, 1);
-
-	if (!kernel_version_detected)
-		detect_kernel_version();
-	return 0;
-}
-
-/* the max number of characters in a sysfs device name, not including \0 */
-#define MAX_SYSFS_NAME 19
-
-static int find_udev_device(const char *lockspace, int minor, char *udev_path)
-{
-	char basename[PATH_MAX];
-	char tmp_path[PATH_MAX];
-	DIR *d;
-	struct dirent *de;
-	struct stat st;
-	size_t basename_len;
-	int i;
-
-	ls_dev_name(lockspace, udev_path, PATH_MAX);
-	snprintf(basename, PATH_MAX, DLM_PREFIX "%s", lockspace);
-	basename_len = strlen(basename);
-
-	for (i = 0; i < 10; i++) {
-
-		/* look for a device with the full name */
-
-		if (stat(udev_path, &st) == 0 && minor(st.st_rdev) == minor)
-			return 0;
-
-		if (basename_len < MAX_SYSFS_NAME) {
-			sleep(1);
-			continue;
-		}
-
-		/* look for a device with a truncated name */
-
-		d = opendir(MISC_PREFIX);
-		while ((de = readdir(d))) {
-			if (de->d_name[0] == '.')
-				continue;
-			if (strlen(de->d_name) < MAX_SYSFS_NAME)
-				continue;
-			if (strncmp(de->d_name, basename, MAX_SYSFS_NAME))
-				continue;
-			snprintf(tmp_path, PATH_MAX, MISC_PREFIX "%s",
-				 de->d_name);
-			if (stat(tmp_path, &st))
-				continue;
-			if (minor(st.st_rdev) != minor)
-				continue;
-
-			/* truncated name */
-			strncpy(udev_path, tmp_path, PATH_MAX);
-			closedir(d);
-			return 0;
-		}
-		closedir(d);
-		sleep(1);
-	}
-
-	return -1;
-}
-
-/*
- * do_dlm_dispatch()
- * Read an ast from the kernel.
- */
-
-static int do_dlm_dispatch_v5(int fd)
-{
-	char resultbuf[sizeof(struct dlm_lock_result_v5) + DLM_USER_LVB_LEN];
-	struct dlm_lock_result_v5 *result = (struct dlm_lock_result_v5 *)resultbuf;
-	char *fullresult = NULL;
-	int status;
-	void (*astaddr)(void *astarg);
-
-	status = read(fd, result, sizeof(resultbuf));
-	if (status <= 0)
-		return -1;
-
-	/* This shouldn't happen any more, can probably be removed */
-
-	if (result->length != status) {
-		int newstat;
-
-		fullresult = malloc(result->length);
-		if (!fullresult)
-			return -1;
-
-		newstat = read(fd, (struct dlm_lock_result_v5 *)fullresult,
-			       result->length);
-
-		/* If it read OK then use the new data. otherwise we can
-		   still deliver the AST, it just might not have all the
-		   info in it...hmmm */
-
-		if (newstat == result->length)
-			result = (struct dlm_lock_result_v5 *)fullresult;
-	} else {
-		fullresult = resultbuf;
-	}
-
-
-	/* Copy lksb to user's buffer - except the LVB ptr */
-	memcpy(result->user_lksb, &result->lksb,
-	       sizeof(struct dlm_lksb) - sizeof(char*));
-
-	/* Flip the status. Kernel space likes negative return codes,
-	   userspace positive ones */
-	result->user_lksb->sb_status = -result->user_lksb->sb_status;
-
-	/* Copy optional items */
-	if (result->lvb_offset)
-		memcpy(result->user_lksb->sb_lvbptr,
-		       fullresult + result->lvb_offset, DLM_LVB_LEN);
-
-	/* Call AST */
-	if (result->user_astaddr) {
-		astaddr = result->user_astaddr;
-		astaddr(result->user_astparam);
-	}
-
-	if (fullresult != resultbuf)
-		free(fullresult);
-
-	return 0;
-}
-
-static int do_dlm_dispatch_v6(int fd)
-{
-	char resultbuf[sizeof(struct dlm_lock_result) + DLM_USER_LVB_LEN];
-	struct dlm_lock_result *result = (struct dlm_lock_result *)resultbuf;
-	int status;
-	void (*astaddr)(void *astarg);
-
-	status = read(fd, result, sizeof(resultbuf));
-	if (status <= 0)
-		return -1;
-
-	/* Copy lksb to user's buffer - except the LVB ptr */
-	memcpy(result->user_lksb, &result->lksb,
-	       sizeof(struct dlm_lksb) - sizeof(char*));
-
-	/* Copy lvb to user's buffer */
-	if (result->lvb_offset)
-		memcpy(result->user_lksb->sb_lvbptr,
-		       (char *)result + result->lvb_offset, DLM_LVB_LEN);
-
-	result->user_lksb->sb_status = -result->user_lksb->sb_status;
-
-	if (result->user_astaddr) {
-		astaddr = result->user_astaddr;
-		astaddr(result->user_astparam);
-	}
-
-	return 0;
-}
-
-static int do_dlm_dispatch(int fd)
-{
-	if (kernel_version.version[0] == 5)
-		return do_dlm_dispatch_v5(fd);
-	else
-		return do_dlm_dispatch_v6(fd);
-}
-
-
-/*
- * sync_write()
- * Helper routine which supports the synchronous DLM calls. This
- * writes a parameter block down to the DLM and waits for the
- * operation to complete. This hides the different completion mechanism
- * used when called from the main thread or the DLM 'AST' thread.
- */
-
-#ifdef _REENTRANT
-
-static int sync_write_v5(struct dlm_ls_info *lsinfo,
-			 struct dlm_write_request_v5 *req, int len)
-{
-	struct lock_wait lwait;
-	int status;
-
-	if (pthread_self() == lsinfo->tid) {
-		/* This is the DLM worker thread, don't use lwait to sync */
-		req->i.lock.castaddr  = dummy_ast_routine;
-		req->i.lock.castparam = NULL;
-
-		status = write(lsinfo->fd, req, len);
-		if (status < 0)
-			return -1;
-
-		while (req->i.lock.lksb->sb_status == EINPROG) {
-			do_dlm_dispatch_v5(lsinfo->fd);
-		}
-	} else {
-		pthread_cond_init(&lwait.cond, NULL);
-		pthread_mutex_init(&lwait.mutex, NULL);
-		pthread_mutex_lock(&lwait.mutex);
-
-		req->i.lock.castaddr  = sync_ast_routine;
-		req->i.lock.castparam = &lwait;
-
-		status = write(lsinfo->fd, req, len);
-		if (status < 0)
-			return -1;
-
-		pthread_cond_wait(&lwait.cond, &lwait.mutex);
-		pthread_mutex_unlock(&lwait.mutex);
-	}
-
-	return status; /* lock status is in the lksb */
-}
-
-static int sync_write_v6(struct dlm_ls_info *lsinfo,
-			 struct dlm_write_request *req, int len)
-{
-	struct lock_wait lwait;
-	int status;
-
-	if (pthread_self() == lsinfo->tid) {
-		/* This is the DLM worker thread, don't use lwait to sync */
-		req->i.lock.castaddr  = dummy_ast_routine;
-		req->i.lock.castparam = NULL;
-
-		status = write(lsinfo->fd, req, len);
-		if (status < 0)
-			return -1;
-
-		while (req->i.lock.lksb->sb_status == EINPROG) {
-			do_dlm_dispatch_v6(lsinfo->fd);
-		}
-	} else {
-		pthread_cond_init(&lwait.cond, NULL);
-		pthread_mutex_init(&lwait.mutex, NULL);
-		pthread_mutex_lock(&lwait.mutex);
-
-		req->i.lock.castaddr  = sync_ast_routine;
-		req->i.lock.castparam = &lwait;
-
-		status = write(lsinfo->fd, req, len);
-		if (status < 0)
-			return -1;
-
-		pthread_cond_wait(&lwait.cond, &lwait.mutex);
-		pthread_mutex_unlock(&lwait.mutex);
-	}
-
-	return status; /* lock status is in the lksb */
-}
-
-#else /* _REENTRANT */
-
-static int sync_write_v5(struct dlm_ls_info *lsinfo,
-			 struct dlm_write_request_v5 *req, int len)
-{
-	int status;
-
-	req->i.lock.castaddr  = dummy_ast_routine;
-	req->i.lock.castparam = NULL;
-
-	status = write(lsinfo->fd, req, len);
-	if (status < 0)
-		return -1;
-
-	while (req->i.lock.lksb->sb_status == EINPROG) {
-		do_dlm_dispatch_v5(lsinfo->fd);
-	}
-
-	errno = req->i.lock.lksb->sb_status;
-	if (errno && errno != EUNLOCK)
-		return -1;
-	return 0;
-}
-
-static int sync_write_v6(struct dlm_ls_info *lsinfo,
-			 struct dlm_write_request *req, int len)
-{
-	int status;
-
-	req->i.lock.castaddr  = dummy_ast_routine;
-	req->i.lock.castparam = NULL;
-
-	status = write(lsinfo->fd, req, len);
-	if (status < 0)
-		return -1;
-
-	while (req->i.lock.lksb->sb_status == EINPROG) {
-		do_dlm_dispatch_v6(lsinfo->fd);
-	}
-
-	errno = req->i.lock.lksb->sb_status;
-	if (errno && errno != EUNLOCK)
-		return -1;
-	return 0;
-}
-
-#endif /* _REENTRANT */
-
-
-/*
- * Lock
- * All the ways to request/convert a lock
- */
-
-static int ls_lock_v5(dlm_lshandle_t ls,
-		uint32_t mode,
-		struct dlm_lksb *lksb,
-		uint32_t flags,
-		const void *name,
-		unsigned int namelen,
-		uint32_t parent,
-		void (*astaddr) (void *astarg),
-		void *astarg,
-		void (*bastaddr) (void *astarg))
-{
-	char parambuf[sizeof(struct dlm_write_request_v5) + DLM_RESNAME_MAXLEN];
-	struct dlm_write_request_v5 *req = (struct dlm_write_request_v5 *)parambuf;
-	struct dlm_ls_info *lsinfo = (struct dlm_ls_info *)ls;
-	int status;
-	int len;
-
-	memset(req, 0, sizeof(*req));
-	set_version_v5(req);
-
-	req->cmd = DLM_USER_LOCK;
-	req->i.lock.mode = mode;
-	req->i.lock.flags = (flags & ~LKF_WAIT);
-	req->i.lock.lkid = lksb->sb_lkid;
-	req->i.lock.parent = parent;
-	req->i.lock.lksb = lksb;
-	req->i.lock.castaddr = astaddr;
-	req->i.lock.bastaddr = bastaddr;
-	req->i.lock.castparam = astarg;	/* same comp and blocking ast arg */
-	req->i.lock.bastparam = astarg;
-
-	if (flags & LKF_CONVERT) {
-		req->i.lock.namelen = 0;
-	} else {
-		if (namelen > DLM_RESNAME_MAXLEN) {
-			errno = EINVAL;
-			return -1;
-		}
-		req->i.lock.namelen = namelen;
-		memcpy(req->i.lock.name, name, namelen);
-	}
-
-	if (flags & LKF_VALBLK) {
-		memcpy(req->i.lock.lvb, lksb->sb_lvbptr, DLM_LVB_LEN);
-	}
-
-	len = sizeof(struct dlm_write_request_v5) + namelen;
-	lksb->sb_status = EINPROG;
-
-	if (flags & LKF_WAIT)
-		status = sync_write_v5(lsinfo, req, len);
-	else
-		status = write(lsinfo->fd, req, len);
-
-	if (status < 0)
-		return -1;
-
-	/*
-	 * the lock id is the return value from the write on the device
-	 */
-
-	if (status > 0)
-		lksb->sb_lkid = status;
-	return 0;
-}
-
-static int ls_lock_v6(dlm_lshandle_t ls,
-		uint32_t mode,
-		struct dlm_lksb *lksb,
-		uint32_t flags,
-		const void *name,
-		unsigned int namelen,
-		uint32_t parent,
-		void (*astaddr) (void *astarg),
-		void *astarg,
-		void (*bastaddr) (void *astarg),
-		uint64_t *xid,
-		uint64_t *timeout)
-{
-	char parambuf[sizeof(struct dlm_write_request) + DLM_RESNAME_MAXLEN];
-	struct dlm_write_request *req = (struct dlm_write_request *)parambuf;
-	struct dlm_ls_info *lsinfo = (struct dlm_ls_info *)ls;
-	int status;
-	int len;
-
-	memset(req, 0, sizeof(*req));
-	set_version_v6(req);
-
-	req->cmd = DLM_USER_LOCK;
-	req->i.lock.mode = mode;
-	req->i.lock.flags = (flags & ~LKF_WAIT);
-	req->i.lock.lkid = lksb->sb_lkid;
-	req->i.lock.parent = parent;
-	req->i.lock.lksb = lksb;
-	req->i.lock.castaddr = astaddr;
-	req->i.lock.bastaddr = bastaddr;
-	req->i.lock.castparam = astarg;	/* same comp and blocking ast arg */
-	req->i.lock.bastparam = astarg;
-
-	if (xid)
-		req->i.lock.xid = *xid;
-	if (timeout)
-		req->i.lock.timeout = *timeout;
-
-	if (flags & LKF_CONVERT) {
-		req->i.lock.namelen = 0;
-	} else {
-		if (namelen > DLM_RESNAME_MAXLEN) {
-			errno = EINVAL;
-			return -1;
-		}
-		req->i.lock.namelen = namelen;
-		memcpy(req->i.lock.name, name, namelen);
-	}
-
-	if (flags & LKF_VALBLK) {
-		memcpy(req->i.lock.lvb, lksb->sb_lvbptr, DLM_LVB_LEN);
-	}
-
-	len = sizeof(struct dlm_write_request) + namelen;
-	lksb->sb_status = EINPROG;
-
-	if (flags & LKF_WAIT)
-		status = sync_write_v6(lsinfo, req, len);
-	else
-		status = write(lsinfo->fd, req, len);
-
-	if (status < 0)
-		return -1;
-
-	/*
-	 * the lock id is the return value from the write on the device
-	 */
-
-	if (status > 0)
-		lksb->sb_lkid = status;
-	return 0;
-}
-
-static int ls_lock(dlm_lshandle_t ls,
-		uint32_t mode,
-		struct dlm_lksb *lksb,
-		uint32_t flags,
-		const void *name,
-		unsigned int namelen,
-		uint32_t parent,
-		void (*astaddr) (void *astarg),
-		void *astarg,
-		void (*bastaddr) (void *astarg),
-		void *range)
-{
-	/* no support for range locks */
-	if (range) {
-		errno = ENOSYS;
-		return -1;
-	}
-
-	if (flags & LKF_VALBLK && !lksb->sb_lvbptr) {
-		errno = EINVAL;
-		return -1;
-	}
-
-	if (kernel_version.version[0] == 5)
-		return ls_lock_v5(ls, mode, lksb, flags, name, namelen, parent,
-				  astaddr, astarg, bastaddr);
-	else
-		return ls_lock_v6(ls, mode, lksb, flags, name, namelen, parent,
-				  astaddr, astarg, bastaddr, NULL, NULL);
-}
-
-/*
- * Extended async locking in own lockspace
- */
-int dlm_ls_lockx(dlm_lshandle_t ls,
-		 uint32_t mode,
-		 struct dlm_lksb *lksb,
-		 uint32_t flags,
-		 const void *name,
-		 unsigned int namelen,
-		 uint32_t parent,
-		 void (*astaddr) (void *astarg),
-		 void *astarg,
-		 void (*bastaddr) (void *astarg),
-		 uint64_t *xid,
-		 uint64_t *timeout)
-{
-	if (kernel_version.version[0] < 6) {
-		errno = ENOSYS;
-		return -1;
-	}
-
-	return ls_lock_v6(ls, mode, lksb, flags, name, namelen, parent,
-			  astaddr, astarg, bastaddr, xid, timeout);
-}
-
-/*
- * Async locking in own lockspace
- */
-int dlm_ls_lock(dlm_lshandle_t ls,
-		uint32_t mode,
-		struct dlm_lksb *lksb,
-		uint32_t flags,
-		const void *name,
-		unsigned int namelen,
-		uint32_t parent,
-		void (*astaddr) (void *astarg),
-		void *astarg,
-		void (*bastaddr) (void *astarg),
-		void *range)
-{
-	return ls_lock(ls, mode, lksb, flags, name, namelen, parent,
-		       astaddr, astarg, bastaddr, range);
-}
-
-/*
- * Sync locking in own lockspace
- */
-int dlm_ls_lock_wait(dlm_lshandle_t ls,
-		     uint32_t mode,
-		     struct dlm_lksb *lksb,
-		     uint32_t flags,
-		     const void *name,
-		     unsigned int namelen,
-		     uint32_t parent,
-		     void *bastarg,
-		     void (*bastaddr) (void *bastarg),
-		     void *range)
-{
-	return ls_lock(ls, mode, lksb, flags | LKF_WAIT, name, namelen, parent,
-		       NULL, bastarg, bastaddr, range);
-}
-
-/*
- * Async locking in the default lockspace
- */
-int dlm_lock(uint32_t mode,
-	     struct dlm_lksb *lksb,
-	     uint32_t flags,
-	     const void *name,
-	     unsigned int namelen,
-	     uint32_t parent,
-	     void (*astaddr) (void *astarg),
-	     void *astarg,
-	     void (*bastaddr) (void *astarg),
-	     void *range)
-{
-	if (open_default_lockspace())
-		return -1;
-
-	return ls_lock(default_ls, mode, lksb, flags, name, namelen, parent,
-		       astaddr, astarg, bastaddr, range);
-}
-
-/*
- * Sync locking in the default lockspace
- */
-int dlm_lock_wait(uint32_t mode,
-		     struct dlm_lksb *lksb,
-		     uint32_t flags,
-		     const void *name,
-		     unsigned int namelen,
-		     uint32_t parent,
-		     void *bastarg,
-		     void (*bastaddr) (void *bastarg),
-		     void *range)
-{
-	if (open_default_lockspace())
-		return -1;
-
-	return ls_lock(default_ls, mode, lksb, flags | LKF_WAIT, name, namelen,
-		       parent, NULL, bastarg, bastaddr, range);
-}
-
-
-/*
- * Unlock
- * All the ways to unlock/cancel a lock
- */
-
-static int ls_unlock_v5(struct dlm_ls_info *lsinfo, uint32_t lkid,
-			uint32_t flags, struct dlm_lksb *lksb, void *astarg)
-{
-	struct dlm_write_request_v5 req;
-
-	set_version_v5(&req);
-	req.cmd = DLM_USER_UNLOCK;
-	req.i.lock.lkid = lkid;
-	req.i.lock.flags = (flags & ~LKF_WAIT);
-	req.i.lock.lksb  = lksb;
-	req.i.lock.castparam = astarg;
-	/* DLM_USER_UNLOCK will default to existing completion AST */
-	req.i.lock.castaddr = 0;
-	lksb->sb_status = EINPROG;
-
-	if (flags & LKF_WAIT)
-		return sync_write_v5(lsinfo, &req, sizeof(req));
-	else
-		return write(lsinfo->fd, &req, sizeof(req));
-}
-
-static int ls_unlock_v6(struct dlm_ls_info *lsinfo, uint32_t lkid,
-			uint32_t flags, struct dlm_lksb *lksb, void *astarg)
-{
-	struct dlm_write_request req;
-
-	set_version_v6(&req);
-	req.cmd = DLM_USER_UNLOCK;
-	req.i.lock.lkid = lkid;
-	req.i.lock.flags = (flags & ~LKF_WAIT);
-	req.i.lock.lksb  = lksb;
-	req.i.lock.namelen = 0;
-	req.i.lock.castparam = astarg;
-	/* DLM_USER_UNLOCK will default to existing completion AST */
-	req.i.lock.castaddr = 0;
-	lksb->sb_status = EINPROG;
-
-	if (flags & LKF_WAIT)
-		return sync_write_v6(lsinfo, &req, sizeof(req));
-	else
-		return write(lsinfo->fd, &req, sizeof(req));
-}
-
-int dlm_ls_unlock(dlm_lshandle_t ls, uint32_t lkid, uint32_t flags,
-		  struct dlm_lksb *lksb, void *astarg)
-{
-	struct dlm_ls_info *lsinfo = (struct dlm_ls_info *)ls;
-	int status;
-
-	if (ls == NULL) {
-		errno = ENOTCONN;
-		return -1;
-	}
-
-	if (!lkid) {
-		errno = EINVAL;
-		return -1;
-	}
-
-	if (kernel_version.version[0] == 5)
-		status = ls_unlock_v5(lsinfo, lkid, flags, lksb, astarg);
-	else
-		status = ls_unlock_v6(lsinfo, lkid, flags, lksb, astarg);
-
-	if (status < 0)
-		return -1;
-	return 0;
-}
-
-int dlm_ls_unlock_wait(dlm_lshandle_t ls, uint32_t lkid, uint32_t flags,
-		       struct dlm_lksb *lksb)
-{
-	return dlm_ls_unlock(ls, lkid, flags | LKF_WAIT, lksb, NULL);
-}
-
-int dlm_unlock_wait(uint32_t lkid, uint32_t flags, struct dlm_lksb *lksb)
-{
-	return dlm_ls_unlock_wait(default_ls, lkid, flags | LKF_WAIT, lksb);
-}
-
-int dlm_unlock(uint32_t lkid, uint32_t flags, struct dlm_lksb *lksb,
-	       void *astarg)
-{
-	return dlm_ls_unlock(default_ls, lkid, flags, lksb, astarg);
-}
-
-int dlm_ls_deadlock_cancel(dlm_lshandle_t ls, uint32_t lkid, uint32_t flags)
-{
-	struct dlm_ls_info *lsinfo = (struct dlm_ls_info *)ls;
-	struct dlm_write_request req;
-
-	if (kernel_version.version[0] < 6) {
-		errno = ENOSYS;
-		return -1;
-	}
-
-	if (ls == NULL) {
-		errno = ENOTCONN;
-		return -1;
-	}
-
-	if (!lkid) {
-		errno = EINVAL;
-		return -1;
-	}
-
-	set_version_v6(&req);
-	req.cmd = DLM_USER_DEADLOCK;
-	req.i.lock.lkid = lkid;
-	req.i.lock.flags = flags;
-
-	return write(lsinfo->fd, &req, sizeof(req));
-}
-
-
-/*
- * Purge
- * Clear away orphan locks
- */
-
-int dlm_ls_purge(dlm_lshandle_t ls, int nodeid, int pid)
-{
-	struct dlm_write_request req;
-	struct dlm_ls_info *lsinfo = (struct dlm_ls_info *)ls;
-	int status;
-
-	if (kernel_version.version[0] < 6) {
-		errno = ENOSYS;
-		return -1;
-	}
-
-	if (ls == NULL) {
-		errno = ENOTCONN;
-		return -1;
-	}
-
-	set_version_v6(&req);
-	req.cmd = DLM_USER_PURGE;
-	req.i.purge.nodeid = nodeid;
-	req.i.purge.pid = pid;
-
-	status = write(lsinfo->fd, &req, sizeof(req));
-
-	if (status < 0)
-		return -1;
-	return 0;
-}
-
-
-/* These two routines for for users that want to
- * do their own fd handling.
- * This allows a non-threaded app to use the DLM.
- */
-int dlm_get_fd(void)
-{
-    if (default_ls)
-    {
-	return default_ls->fd;
-    }
-    else
-    {
-	if (open_default_lockspace())
-	    return -1;
-	else
-	    return default_ls->fd;
-    }
-}
-
-int dlm_dispatch(int fd)
-{
-    int status;
-    int fdflags;
-
-    fdflags = fcntl(fd, F_GETFL, 0);
-    fcntl(fd, F_SETFL,  fdflags | O_NONBLOCK);
-    do
-    {
-	status = do_dlm_dispatch(fd);
-    } while (status == 0);
-
-    /* EAGAIN is not an error */
-    if (status < 0 && errno == EAGAIN)
-	status = 0;
-
-    fcntl(fd, F_SETFL, fdflags);
-    return status;
-}
-
-/* Converts a lockspace handle into a file descriptor */
-int dlm_ls_get_fd(dlm_lshandle_t lockspace)
-{
-    struct dlm_ls_info *lsinfo = (struct dlm_ls_info *)lockspace;
-
-    return lsinfo->fd;
-}
-
-#ifdef _REENTRANT
-static void *dlm_recv_thread(void *lsinfo)
-{
-    struct dlm_ls_info *lsi = lsinfo;
-
-    for (;;)
-	do_dlm_dispatch(lsi->fd);
-}
-
-/* Multi-threaded callers normally use this */
-int dlm_pthread_init()
-{
-    if (open_default_lockspace())
-	return -1;
-
-    if (default_ls->tid)
-    {
-	errno = EEXIST;
-	return -1;
-    }
-
-    if (pthread_create(&default_ls->tid, NULL, dlm_recv_thread, default_ls))
-    {
-	int saved_errno = errno;
-	close(default_ls->fd);
-	free(default_ls);
-	default_ls = NULL;
-	errno = saved_errno;
-	return -1;
-    }
-    return 0;
-}
-
-/* And same, for those with their own lockspace */
-int dlm_ls_pthread_init(dlm_lshandle_t ls)
-{
-    struct dlm_ls_info *lsinfo = (struct dlm_ls_info *)ls;
-
-    if (lsinfo->tid)
-    {
-	errno = EEXIST;
-	return -1;
-    }
-
-    return pthread_create(&lsinfo->tid, NULL, dlm_recv_thread, (void *)ls);
-}
-#endif
-
-/*
- * Lockspace manipulation functions
- * Privileged users (checked by the kernel) can create/release lockspaces
- */
-
-static int create_lockspace_v5(const char *name, uint32_t flags)
-{
-	char reqbuf[sizeof(struct dlm_write_request_v5) + DLM_LOCKSPACE_LEN];
-	struct dlm_write_request_v5 *req = (struct dlm_write_request_v5 *)reqbuf;
-	int namelen = strlen(name);
-	int minor;
-
-	memset(reqbuf, 0, sizeof(reqbuf));
-	set_version_v5(req);
-
-	req->cmd = DLM_USER_CREATE_LOCKSPACE;
-	req->i.lspace.flags = flags;
-
-	if (namelen > DLM_LOCKSPACE_LEN) {
-		errno = EINVAL;
-		return -1;
-	}
-	memcpy(req->i.lspace.name, name, namelen);
-
-	minor = write(control_fd, req, sizeof(*req) + namelen);
-
-	return minor;
-}
-
-static int create_lockspace_v6(const char *name, uint32_t flags)
-{
-	char reqbuf[sizeof(struct dlm_write_request) + DLM_LOCKSPACE_LEN];
-	struct dlm_write_request *req = (struct dlm_write_request *)reqbuf;
-	int namelen = strlen(name);
-	int minor;
-
-	memset(reqbuf, 0, sizeof(reqbuf));
-	set_version_v6(req);
-
-	req->cmd = DLM_USER_CREATE_LOCKSPACE;
-	req->i.lspace.flags = flags;
-
-	if (namelen > DLM_LOCKSPACE_LEN) {
-		errno = EINVAL;
-		return -1;
-	}
-	memcpy(req->i.lspace.name, name, namelen);
-
-	minor = write(control_fd, req, sizeof(*req) + namelen);
-
-	return minor;
-}
-
-static dlm_lshandle_t create_lockspace(const char *name, mode_t mode,
-				       uint32_t flags)
-{
-	char dev_path[PATH_MAX];
-	char udev_path[PATH_MAX];
-	struct dlm_ls_info *newls;
-	int error, saved_errno, minor;
-
-	/* We use the control device for creating lockspaces. */
-	if (open_control_device())
-		return NULL;
-
-	newls = malloc(sizeof(struct dlm_ls_info));
-	if (!newls)
-		return NULL;
-
-	ls_dev_name(name, dev_path, sizeof(dev_path));
-
-	if (kernel_version.version[0] == 5)
-		minor = create_lockspace_v5(name, flags);
-	else
-		minor = create_lockspace_v6(name, flags);
-
-	if (minor < 0)
-		goto fail;
-
-	/* Wait for udev to create the device; the device it creates may
-	   have a truncated name due to the sysfs device name limit. */
-	   
-	error = find_udev_device(name, minor, udev_path);
-	if (error)
-		goto fail;
-
-	/* If the symlink already exists, find_udev_device() will return
-	   it and we'll skip this. */
-
-	if (strcmp(dev_path, udev_path)) {
-		error = symlink(udev_path, dev_path);
-		if (error)
-			goto fail;
-	}
-
-	/* Open it and return the struct as a handle */
-
-	newls->fd = open(dev_path, O_RDWR);
-	if (newls->fd == -1)
-		goto fail;
-	if (mode)
-		fchmod(newls->fd, mode);
-	newls->tid = 0;
-	fcntl(newls->fd, F_SETFD, 1);
-	return (dlm_lshandle_t)newls;
-
- fail:
-	saved_errno = errno;
-	free(newls);
-	errno = saved_errno;
-	return NULL;
-}
-
-dlm_lshandle_t dlm_new_lockspace(const char *name, mode_t mode, uint32_t flags)
-{
-	return create_lockspace(name, mode, flags);
-}
-
-dlm_lshandle_t dlm_create_lockspace(const char *name, mode_t mode)
-{
-	return create_lockspace(name, mode, 0);
-}
-
-static int release_lockspace_v5(uint32_t minor, uint32_t flags)
-{
-	struct dlm_write_request_v5 req;
-
-	set_version_v5(&req);
-	req.cmd = DLM_USER_REMOVE_LOCKSPACE;
-	req.i.lspace.minor = minor;
-	req.i.lspace.flags = flags;
-
-	return write(control_fd, &req, sizeof(req));
-}
-
-static int release_lockspace_v6(uint32_t minor, uint32_t flags)
-{
-	struct dlm_write_request req;
-
-	set_version_v6(&req);
-	req.cmd = DLM_USER_REMOVE_LOCKSPACE;
-	req.i.lspace.minor = minor;
-	req.i.lspace.flags = flags;
-
-	return write(control_fd, &req, sizeof(req));
-}
-
-static int release_lockspace(uint32_t minor, uint32_t flags)
-{
-	if (kernel_version.version[0] == 5)
-		return release_lockspace_v5(minor, flags);
-	else
-		return release_lockspace_v6(minor, flags);
-}
-
-int dlm_release_lockspace(const char *name, dlm_lshandle_t ls, int force)
-{
-	char dev_path[PATH_MAX];
-	struct stat st;
-	struct dlm_ls_info *lsinfo = (struct dlm_ls_info *)ls;
-	uint32_t flags = 0;
-	int fd, is_symlink = 0;
-
-	ls_dev_name(name, dev_path, sizeof(dev_path));
-	if (!lstat(dev_path, &st) && S_ISLNK(st.st_mode))
-		is_symlink = 1;
-
-	/* We need the minor number */
-	if (fstat(lsinfo->fd, &st))
-		return -1;
-
-	/* Close the lockspace first if it's in use */
-	ls_pthread_cleanup(lsinfo);
-
-	if (open_control_device())
-		return -1;
-
-	if (force)
-		flags = DLM_USER_LSFLG_FORCEFREE;
-
-	release_lockspace(minor(st.st_rdev), flags);
-
-	if (!is_symlink)
-		return 0;
-
-	/* The following open is used to detect if our release was the last.
-	   It will fail if our release was the last, because either:
-	   . udev has already removed the truncated sysfs device name (ENOENT)
-	   . the misc device has been deregistered in the kernel (ENODEV)
-	     (the deregister completes before release returns)
-
-	   So, if the open fails, we know that our release was the last,
-	   udev will be removing the device with the truncated name (if it
-	   hasn't already), and we should remove the symlink. */
-
-	fd = open(dev_path, O_RDWR);
-	if (fd < 0)
-		unlink(dev_path);
-	else
-		close(fd); /* our release was not the last */
-
-	return 0;
-}
-
-/*
- * Normal users just open/close lockspaces
- */
-
-dlm_lshandle_t dlm_open_lockspace(const char *name)
-{
-	char dev_name[PATH_MAX];
-	struct dlm_ls_info *newls;
-	int saved_errno;
-
-	/* Need to detect kernel version */
-	if (open_control_device())
-		return NULL;
-
-	newls = malloc(sizeof(struct dlm_ls_info));
-	if (!newls)
-		return NULL;
-
-	newls->tid = 0;
-	ls_dev_name(name, dev_name, sizeof(dev_name));
-
-	newls->fd = open(dev_name, O_RDWR);
-	saved_errno = errno;
-
-	if (newls->fd == -1) {
-		free(newls);
-		errno = saved_errno;
-		return NULL;
-	}
-	fcntl(newls->fd, F_SETFD, 1);
-	return (dlm_lshandle_t)newls;
-}
-
-int dlm_close_lockspace(dlm_lshandle_t ls)
-{
-	struct dlm_ls_info *lsinfo = (struct dlm_ls_info *)ls;
-
-	ls_pthread_cleanup(lsinfo);
-	return 0;
-}
-
-int dlm_kernel_version(uint32_t *major, uint32_t *minor, uint32_t *patch)
-{
-	if (open_control_device())
-		return -1;
-	*major = kernel_version.version[0];
-	*minor = kernel_version.version[1];
-	*patch = kernel_version.version[2];
-	return 0;
-}
-
-void dlm_library_version(uint32_t *major, uint32_t *minor, uint32_t *patch)
-{
-	*major = DLM_DEVICE_VERSION_MAJOR;
-	*minor = DLM_DEVICE_VERSION_MINOR;
-	*patch = DLM_DEVICE_VERSION_PATCH;
-}
-
diff --git a/dlm/libdlm/libdlm.h b/dlm/libdlm/libdlm.h
deleted file mode 100644
index c1cdf9b..0000000
--- a/dlm/libdlm/libdlm.h
+++ /dev/null
@@ -1,275 +0,0 @@
-#ifndef __LIBDLM_H
-#define __LIBDLM_H
-
-/*
- * Typedefs for things that are compatible with the kernel but replicated here
- * so that users only need the libdlm include file.  libdlm itself needs the
- * full kernel file so shouldn't use these.
- */
-
-#define DLM_LVB_LEN             32
-
-#ifndef BUILDING_LIBDLM
-
-/*
- * These two lengths are copied from linux/dlmconstants.h
- * They are the max length of a lockspace name and the max length of a
- * resource name.
- */
-
-#define DLM_LOCKSPACE_LEN       64
-#define DLM_RESNAME_MAXLEN      64
-
-struct dlm_lksb {
-	int sb_status;
-	uint32_t sb_lkid;
-	char sb_flags;
-	char *sb_lvbptr;
-};
-
-/* lksb flags */
-#define DLM_SBF_DEMOTED         0x01
-#define DLM_SBF_VALNOTVALID     0x02
-#define DLM_SBF_ALTMODE         0x04
-
-/* dlm_new_lockspace flags */
-#define DLM_LSFL_NODIR          0x00000001
-#define DLM_LSFL_TIMEWARN       0x00000002
-#define DLM_LSFL_FS             0x00000004
-/* #define DLM_LSFL_NEWEXCL        0x00000008 (expected in 2.6.28-rc) */
-
-#endif
-
-
-#if 0
-/* Dummy definition to keep linkages */
-struct dlm_queryinfo;
-#endif
-
-extern int dlm_kernel_version(uint32_t *maj, uint32_t *min, uint32_t *patch);
-extern void dlm_library_version(uint32_t *maj, uint32_t *min, uint32_t *patch);
-
-
-/*
- * Using the default lockspace
- *
- * lock_resource() - simple sync request or convert (requires pthreads)
- * unlock_resource() - simple sync unlock (requires pthreads)
- * dlm_lock() - async request or convert
- * dlm_unlock() - async unlock or cancel
- * dlm_lock_wait() - sync request or convert
- * dlm_unlock_wait() - sync unlock or cancel
- */
-
-#ifdef _REENTRANT
-extern int lock_resource(const char *resource, int mode, int flags, int *lockid);
-extern int unlock_resource(int lockid);
-#endif
-
-extern int dlm_lock(uint32_t mode,
-		struct dlm_lksb *lksb,
-		uint32_t flags,
-		const void *name,
-		unsigned int namelen,
-		uint32_t parent,			/* unusued */
-		void (*astaddr) (void *astarg),
-		void *astarg,
-		void (*bastaddr) (void *astarg),
-		void *range);				/* unused */
-
-extern int dlm_unlock(uint32_t lkid,
-		uint32_t flags,
-		struct dlm_lksb *lksb,
-		void *astarg);
-
-extern int dlm_lock_wait(uint32_t mode,
-		struct dlm_lksb *lksb,
-		uint32_t flags,
-		const void *name,
-		unsigned int namelen,
-		uint32_t parent,			/* unused */
-		void *bastarg,
-		void (*bastaddr) (void *bastarg),
-		void *range);				/* unused */
-
-extern int dlm_unlock_wait(uint32_t lkid,
-		uint32_t flags,
-		struct dlm_lksb *lksb);
-
-
-/* 
- * These two are for users that want to do their own FD handling
- *
- * dlm_get_fd() - returns fd for the default lockspace for polling and dispatch
- * dlm_dispatch() - dispatches pending asts and basts
- */
-
-extern int dlm_get_fd(void);
-extern int dlm_dispatch(int fd);
-
-
-/*
- * Creating your own lockspace
- *
- * dlm_create_lockspace() - create and open a lockspace and return a handle
- *                          to it.  Privileges are required to create/release.
- * dlm_new_lockspace() - same as create but allows flags
- * dlm_open_lockspace() - simply returns a handle for an existing lockspace and
- *                        may be called by ordinary users.
- * dlm_release_lockspace()
- * dlm_close_lockspace()
- * dlm_ls_get_fd()
- *
- * NOTE: that if you dlm_create_lockspace() then dlm_open_lockspace() you will
- * have two open files on the same device. Hardly a major problem but I thought
- * it worth pointing out.
- */
-
-typedef void *dlm_lshandle_t;
-
-extern dlm_lshandle_t dlm_create_lockspace(const char *name, mode_t mode);
-extern int dlm_release_lockspace(const char *name, dlm_lshandle_t ls,
-		int force);
-extern dlm_lshandle_t dlm_open_lockspace(const char *name);
-extern int dlm_close_lockspace(dlm_lshandle_t ls);
-extern int dlm_ls_get_fd(dlm_lshandle_t ls);
-extern dlm_lshandle_t dlm_new_lockspace(const char *name, mode_t mode,
-		uint32_t flags);
-
-
-/*
- * Using your own lockspace
- *
- * dlm_ls_lock()
- * dlm_ls_lockx()
- * dlm_ls_unlock()
- * dlm_ls_lock_wait()
- * dlm_ls_unlock_wait()
- * dlm_ls_deadlock_cancel()
- * dlm_ls_purge()
- */
-
-extern int dlm_ls_lock(dlm_lshandle_t lockspace,
-		uint32_t mode,
-		struct dlm_lksb *lksb,
-		uint32_t flags,
-		const void *name,
-		unsigned int namelen,
-		uint32_t parent,			/* unused */
-		void (*astaddr) (void *astarg),
-		void *astarg,
-		void (*bastaddr) (void *astarg),
-		void *range);				/* unused */
-
-extern int dlm_ls_lockx(dlm_lshandle_t lockspace,
-		uint32_t mode,
-		struct dlm_lksb *lksb,
-		uint32_t flags,
-		const void *name,
-		unsigned int namelen,
-		uint32_t parent,			/* unused */
-		void (*astaddr) (void *astarg),
-		void *astarg,
-		void (*bastaddr) (void *astarg),
-		uint64_t *xid,
-		uint64_t *timeout);
-
-extern int dlm_ls_unlock(dlm_lshandle_t lockspace,
-		uint32_t lkid,
-		uint32_t flags,
-		struct dlm_lksb *lksb,
-		void *astarg);
-
-extern int dlm_ls_lock_wait(dlm_lshandle_t lockspace,
-		uint32_t mode,
-		struct dlm_lksb *lksb,
-		uint32_t flags,
-		const void *name,
-		unsigned int namelen,
-		uint32_t parent,			/* unused */
-		void *bastarg,
-		void (*bastaddr) (void *bastarg),
-		void *range);				/* unused */
-
-extern int dlm_ls_unlock_wait(dlm_lshandle_t lockspace,
-		uint32_t lkid,
-		uint32_t flags,
-		struct dlm_lksb *lksb);
-
-extern int dlm_ls_deadlock_cancel(dlm_lshandle_t ls,
-		uint32_t lkid,
-		uint32_t flags);
-
-extern int dlm_ls_purge(dlm_lshandle_t lockspace,
-		int nodeid,
-		int pid);
-
-
-/*
- * For threaded applications
- *
- * dlm_pthread_init()
- * dlm_ls_pthread_init() - call this before any locking operations and the ASTs
- *                         will be delivered in their own thread.
- * dlm_pthread_cleanup() - call the cleanup routine at application exit
- *			   (optional) or, if the locking functions are in a
- *			   shared library that is to be unloaded.
- *
- * dlm_close/release_lockspace() will tidy the threads for a non-default
- * lockspace
- */
-
-#ifdef _REENTRANT
-extern int dlm_pthread_init();
-extern int dlm_ls_pthread_init(dlm_lshandle_t lockspace);
-extern int dlm_pthread_cleanup();
-#endif
-
-
-/*
- * Lock modes
- */
-
-#define LKM_NLMODE          0           /* null lock */
-#define LKM_CRMODE          1           /* concurrent read */
-#define LKM_CWMODE          2           /* concurrent write */
-#define LKM_PRMODE          3           /* protected read */
-#define LKM_PWMODE          4           /* protected write */
-#define LKM_EXMODE          5           /* exclusive */
-
-
-/*
- * Locking flags - these match the ones in dlm.h
- */
-
-#define LKF_NOQUEUE         0x00000001
-#define LKF_CANCEL          0x00000002
-#define LKF_CONVERT         0x00000004
-#define LKF_VALBLK          0x00000008
-#define LKF_QUECVT          0x00000010
-#define LKF_IVVALBLK        0x00000020
-#define LKF_CONVDEADLK      0x00000040
-#define LKF_PERSISTENT      0x00000080
-#define LKF_NODLCKWT        0x00000100
-#define LKF_NODLCKBLK       0x00000200
-#define LKF_EXPEDITE        0x00000400
-#define LKF_NOQUEUEBAST     0x00000800
-#define LKF_HEADQUE         0x00001000
-#define LKF_NOORDER         0x00002000
-#define LKF_ORPHAN          0x00004000
-#define LKF_ALTPR           0x00008000
-#define LKF_ALTCW           0x00010000
-#define LKF_FORCEUNLOCK     0x00020000
-#define LKF_TIMEOUT         0x00040000
-#define LKF_WAIT            0x80000000  /* Userspace only, for sync API calls */
-
-/*
- * Extra return codes used by the DLM
- */
-
-#define ECANCEL             0x10001
-#define EUNLOCK             0x10002
-#define	EINPROG		    0x10003     /* lock operation is in progress */
-
-#endif
-
diff --git a/dlm/libdlm/libdlm_internal.h b/dlm/libdlm/libdlm_internal.h
deleted file mode 100644
index c8b270e..0000000
--- a/dlm/libdlm/libdlm_internal.h
+++ /dev/null
@@ -1,9 +0,0 @@
-
-/* Needed before we include the kernel libdlm header */
-#define __user
-typedef uint8_t __u8;
-typedef uint16_t __u16;
-typedef uint32_t __u32;
-#define BUILDING_LIBDLM
-
-
diff --git a/dlm/libdlmcontrol/Makefile b/dlm/libdlmcontrol/Makefile
deleted file mode 100644
index 28faedd..0000000
--- a/dlm/libdlmcontrol/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-TARGET= libdlmcontrol
-
-OBJS=	main.o
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/libs.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-CFLAGS += -fPIC
-CFLAGS += -I$(S)/../../group/dlm_controld
-CFLAGS += -I${incdir}
-CFLAGS += -I$(KERNEL_SRC)/include
diff --git a/dlm/libdlmcontrol/libdlmcontrol.h b/dlm/libdlmcontrol/libdlmcontrol.h
deleted file mode 100644
index c85bd3f..0000000
--- a/dlm/libdlmcontrol/libdlmcontrol.h
+++ /dev/null
@@ -1,89 +0,0 @@
-#ifndef _LIBDLMCONTROL_H_
-#define _LIBDLMCONTROL_H_
-
-#define DLMC_DUMP_SIZE		(1024 * 1024)
-
-#define DLMC_NF_MEMBER		0x00000001 /* node is member in cg */
-#define DLMC_NF_START		0x00000002 /* start message recvd for cg */
-#define DLMC_NF_DISALLOWED	0x00000004 /* node disallowed in cg */
-#define DLMC_NF_CHECK_FENCING	0x00000008
-#define DLMC_NF_CHECK_QUORUM	0x00000010
-#define DLMC_NF_CHECK_FS	0x00000020
-
-struct dlmc_node {
-	int nodeid;
-	uint32_t flags;
-	uint32_t added_seq;
-	uint32_t removed_seq;
-	int failed_reason;
-};
-
-struct dlmc_change {
-	int member_count;
-	int joined_count;
-	int remove_count;
-	int failed_count;
-	int wait_condition;	/* 0 no, 1 fencing, 2 quorum, 3 fs */
-	int wait_messages;	/* 0 no, 1 yes */
-	uint32_t seq;
-	uint32_t combined_seq;
-};
-
-#define DLMC_LF_JOINING		0x00000001
-#define DLMC_LF_LEAVING		0x00000002
-#define DLMC_LF_KERNEL_STOPPED	0x00000004
-#define DLMC_LF_FS_REGISTERED	0x00000008
-#define DLMC_LF_NEED_PLOCKS	0x00000010
-#define DLMC_LF_SAVE_PLOCKS	0x00000020
-
-struct dlmc_lockspace {
-	int group_mode;
-	struct dlmc_change cg_prev;	/* completed change (started_change) */
-	struct dlmc_change cg_next;	/* in-progress change (changes list) */
-	uint32_t flags;
-	uint32_t global_id;
-	char name[DLM_LOCKSPACE_LEN+1];
-};
-
-/* dlmc_lockspace_nodes() types
-
-   MEMBERS: members in completed (prev) change,
-            zero if there's no completed (prev) change
-   NEXT:    members in in-progress (next) change,
-            zero if there's no in-progress (next) change
-   ALL:     NEXT + nonmembers if there's an in-progress (next) change,
-            MEMBERS + nonmembers if there's no in-progress (next) change, but
-            there is a completed (prev) change
-            nonmembers if there's no in-progress (next) or completed (prev)
-            change (possible?)
-
-   dlmc_node_info() returns info for in-progress (next) change, if one exists,
-   otherwise it returns info for completed (prev) change.
-*/
-
-#define DLMC_NODES_ALL		1
-#define DLMC_NODES_MEMBERS	2
-#define DLMC_NODES_NEXT		3
-
-int dlmc_dump_debug(char *buf);
-int dlmc_dump_plocks(char *name, char *buf);
-int dlmc_lockspace_info(char *lsname, struct dlmc_lockspace *ls);
-int dlmc_node_info(char *lsname, int nodeid, struct dlmc_node *node);
-int dlmc_lockspaces(int max, int *count, struct dlmc_lockspace *lss);
-int dlmc_lockspace_nodes(char *lsname, int type, int max, int *count,
-			 struct dlmc_node *nodes);
-
-#define DLMC_RESULT_REGISTER	1
-#define DLMC_RESULT_NOTIFIED	2
-
-int dlmc_fs_connect(void);
-void dlmc_fs_disconnect(int fd);
-int dlmc_fs_register(int fd, char *name);
-int dlmc_fs_unregister(int fd, char *name);
-int dlmc_fs_notified(int fd, char *name, int nodeid);
-int dlmc_fs_result(int fd, char *name, int *type, int *nodeid, int *result);
-
-int dlmc_deadlock_check(char *name);
-
-#endif
-
diff --git a/dlm/libdlmcontrol/main.c b/dlm/libdlmcontrol/main.c
deleted file mode 100644
index c31afb8..0000000
--- a/dlm/libdlmcontrol/main.c
+++ /dev/null
@@ -1,414 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdint.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-
-#include <linux/dlmconstants.h>
-#include "dlm_controld.h"
-#include "libdlmcontrol.h"
-
-static int do_read(int fd, void *buf, size_t count)
-{
-	int rv, off = 0;
-
-	while (off < count) {
-		rv = read(fd, buf + off, count - off);
-		if (rv == 0)
-			return -1;
-		if (rv == -1 && errno == EINTR)
-			continue;
-		if (rv == -1)
-			return -1;
-		off += rv;
-	}
-	return 0;
-}
-
-static int do_write(int fd, void *buf, size_t count)
-{
-	int rv, off = 0;
-
- retry:
-	rv = write(fd, buf + off, count);
-	if (rv == -1 && errno == EINTR)
-		goto retry;
-	if (rv < 0) {
-		return rv;
-	}
-
-	if (rv != count) {
-		count -= rv;
-		off += rv;
-		goto retry;
-	}
-	return 0;
-}
-
-static int do_connect(char *sock_path)
-{
-	struct sockaddr_un sun;
-	socklen_t addrlen;
-	int rv, fd;
-
-	fd = socket(PF_UNIX, SOCK_STREAM, 0);
-	if (fd < 0)
-		goto out;
-
-	memset(&sun, 0, sizeof(sun));
-	sun.sun_family = AF_UNIX;
-	strcpy(&sun.sun_path[1], sock_path);
-	addrlen = sizeof(sa_family_t) + strlen(sun.sun_path+1) + 1;
-
-	rv = connect(fd, (struct sockaddr *) &sun, addrlen);
-	if (rv < 0) {
-		close(fd);
-		fd = rv;
-	}
- out:
-	return fd;
-}
-
-static void init_header(struct dlmc_header *h, int cmd, char *name,
-			int extra_len)
-{
-	memset(h, 0, sizeof(struct dlmc_header));
-
-	h->magic = DLMC_MAGIC;
-	h->version = DLMC_VERSION;
-	h->len = sizeof(struct dlmc_header) + extra_len;
-	h->command = cmd;
-
-	if (name)
-		strncpy(h->name, name, DLM_LOCKSPACE_LEN);
-}
-
-int do_dump(int cmd, char *name, char *buf)
-{
-	struct dlmc_header h, *rh;
-	char *reply;
-	int reply_len;
-	int fd, rv;
-
-	init_header(&h, cmd, name, 0);
-
-	reply_len = sizeof(struct dlmc_header) + DLMC_DUMP_SIZE;
-	reply = malloc(reply_len);
-	if (!reply) {
-		rv = -1;
-		goto out;
-	}
-	memset(reply, 0, reply_len);
-
-	fd = do_connect(DLMC_QUERY_SOCK_PATH);
-	if (fd < 0) {
-		rv = fd;
-		goto out;
-	}
-
-	rv = do_write(fd, &h, sizeof(h));
-	if (rv < 0)
-		goto out_close;
-
-	/* won't always get back the full reply_len */
-	do_read(fd, reply, reply_len);
-
-	rh = (struct dlmc_header *)reply;
-	rv = rh->data;
-	if (rv < 0)
-		goto out_close;
-
-	memcpy(buf, (char *)reply + sizeof(struct dlmc_header),
-	       DLMC_DUMP_SIZE);
- out_close:
-	close(fd);
- out:
-	return rv;
-}
-
-int dlmc_dump_debug(char *buf)
-{
-	return do_dump(DLMC_CMD_DUMP_DEBUG, NULL, buf);
-}
-
-int dlmc_dump_plocks(char *name, char *buf)
-{
-	return do_dump(DLMC_CMD_DUMP_PLOCKS, name, buf);
-}
-
-int dlmc_node_info(char *name, int nodeid, struct dlmc_node *node)
-{
-	struct dlmc_header h, *rh;
-	char reply[sizeof(struct dlmc_header) + sizeof(struct dlmc_node)];
-	int fd, rv;
-
-	init_header(&h, DLMC_CMD_NODE_INFO, name, 0);
-	h.data = nodeid;
-
-	memset(reply, 0, sizeof(reply));
-
-	fd = do_connect(DLMC_QUERY_SOCK_PATH);
-	if (fd < 0) {
-		rv = fd;
-		goto out;
-	}
-
-	rv = do_write(fd, &h, sizeof(h));
-	if (rv < 0)
-		goto out_close;
-
-	rv = do_read(fd, reply, sizeof(reply));
-	if (rv < 0)
-		goto out_close;
-
-	rh = (struct dlmc_header *)reply;
-	rv = rh->data;
-	if (rv < 0)
-		goto out_close;
-
-	memcpy(node, (char *)reply + sizeof(struct dlmc_header),
-	       sizeof(struct dlmc_node));
- out_close:
-	close(fd);
- out:
-	return rv;
-}
-
-int dlmc_lockspace_info(char *name, struct dlmc_lockspace *lockspace)
-{
-	struct dlmc_header h, *rh;
-	char reply[sizeof(struct dlmc_header) + sizeof(struct dlmc_lockspace)];
-	int fd, rv;
-
-	init_header(&h, DLMC_CMD_LOCKSPACE_INFO, name, 0);
-
-	memset(reply, 0, sizeof(reply));
-
-	fd = do_connect(DLMC_QUERY_SOCK_PATH);
-	if (fd < 0) {
-		rv = fd;
-		goto out;
-	}
-
-	rv = do_write(fd, &h, sizeof(h));
-	if (rv < 0)
-		goto out_close;
-
-	rv = do_read(fd, reply, sizeof(reply));
-	if (rv < 0)
-		goto out_close;
-
-	rh = (struct dlmc_header *)reply;
-	rv = rh->data;
-	if (rv < 0)
-		goto out_close;
-
-	memcpy(lockspace, (char *)reply + sizeof(struct dlmc_header),
-	       sizeof(struct dlmc_lockspace));
- out_close:
-	close(fd);
- out:
-	return rv;
-}
-
-int dlmc_lockspaces(int max, int *count, struct dlmc_lockspace *lss)
-{
-	struct dlmc_header h, *rh;
-	char *reply;
-	int reply_len;
-	int fd, rv, result, ls_count;
-
-	init_header(&h, DLMC_CMD_LOCKSPACES, NULL, 0);
-	h.data = max;
-
-	reply_len = sizeof(struct dlmc_header) +
-		    (max * sizeof(struct dlmc_lockspace));
-	reply = malloc(reply_len);
-	if (!reply) {
-		rv = -1;
-		goto out;
-	}
-	memset(reply, 0, reply_len);
-
-	fd = do_connect(DLMC_QUERY_SOCK_PATH);
-	if (fd < 0) {
-		rv = fd;
-		goto out;
-	}
-
-	rv = do_write(fd, &h, sizeof(h));
-	if (rv < 0)
-		goto out_close;
-
-	/* won't usually get back the full reply_len */
-	do_read(fd, reply, reply_len);
-
-	rh = (struct dlmc_header *)reply;
-	result = rh->data;
-	if (result < 0 && result != -E2BIG) {
-		rv = result;
-		goto out_close;
-	}
-
-	if (result == -E2BIG) {
-		*count = -E2BIG;
-		ls_count = max;
-	} else {
-		*count = result;
-		ls_count = result;
-	}
-	rv = 0;
-
-	memcpy(lss, (char *)reply + sizeof(struct dlmc_header),
-	       ls_count * sizeof(struct dlmc_lockspace));
- out_close:
-	close(fd);
- out:
-	return rv;
-}
-
-int dlmc_lockspace_nodes(char *name, int type, int max, int *count,
-			 struct dlmc_node *nodes)
-{
-	struct dlmc_header h, *rh;
-	char *reply;
-	int reply_len;
-	int fd, rv, result, node_count;
-
-	init_header(&h, DLMC_CMD_LOCKSPACE_NODES, name, 0);
-	h.option = type;
-	h.data = max;
-
-	reply_len = sizeof(struct dlmc_header) +
-		    (max * sizeof(struct dlmc_node));
-	reply = malloc(reply_len);
-	if (!reply) {
-		rv = -1;
-		goto out;
-	}
-	memset(reply, 0, reply_len);
-
-	fd = do_connect(DLMC_QUERY_SOCK_PATH);
-	if (fd < 0) {
-		rv = fd;
-		goto out;
-	}
-
-	rv = do_write(fd, &h, sizeof(h));
-	if (rv < 0)
-		goto out_close;
-
-	/* won't usually get back the full reply_len */
-	do_read(fd, reply, reply_len);
-
-	rh = (struct dlmc_header *)reply;
-	result = rh->data;
-	if (result < 0 && result != -E2BIG) {
-		rv = result;
-		goto out_close;
-	}
-
-	if (result == -E2BIG) {
-		*count = -E2BIG;
-		node_count = max;
-	} else {
-		*count = result;
-		node_count = result;
-	}
-	rv = 0;
-
-	memcpy(nodes, (char *)reply + sizeof(struct dlmc_header),
-	       node_count * sizeof(struct dlmc_node));
- out_close:
-	close(fd);
- out:
-	return rv;
-}
-
-int dlmc_fs_connect(void)
-{
-	return do_connect(DLMC_SOCK_PATH);
-}
-
-void dlmc_fs_disconnect(int fd)
-{
-	close(fd);
-}
-
-int dlmc_fs_register(int fd, char *name)
-{
-	struct dlmc_header h;
-
-	init_header(&h, DLMC_CMD_FS_REGISTER, name, 0);
-
-	return do_write(fd, &h, sizeof(h));
-}
-
-int dlmc_fs_unregister(int fd, char *name)
-{
-	struct dlmc_header h;
-
-	init_header(&h, DLMC_CMD_FS_UNREGISTER, name, 0);
-
-	return do_write(fd, &h, sizeof(h));
-}
-
-int dlmc_fs_notified(int fd, char *name, int nodeid)
-{
-	struct dlmc_header h;
-
-	init_header(&h, DLMC_CMD_FS_NOTIFIED, name, 0);
-	h.data = nodeid;
-
-	return do_write(fd, &h, sizeof(h));
-}
-
-int dlmc_fs_result(int fd, char *name, int *type, int *nodeid, int *result)
-{
-	struct dlmc_header h;
-	int rv;
-
-	rv = do_read(fd, &h, sizeof(h));
-	if (rv < 0)
-		goto out;
-
-	strncpy(name, h.name, DLM_LOCKSPACE_LEN);
-	*nodeid = h.option;
-	*result = h.data;
-
-	switch (h.command) {
-	case DLMC_CMD_FS_REGISTER:
-		*type = DLMC_RESULT_REGISTER;
-		break;
-	case DLMC_CMD_FS_NOTIFIED:
-		*type = DLMC_RESULT_NOTIFIED;
-		break;
-	default:
-		*type = 0;
-	}
- out:
-	return rv;
-}
-
-int dlmc_deadlock_check(char *name)
-{
-	struct dlmc_header h;
-	int fd, rv;
-
-	init_header(&h, DLMC_CMD_DEADLOCK_CHECK, name, 0);
-
-	fd = do_connect(DLMC_SOCK_PATH);
-	if (fd < 0) {
-		rv = fd;
-		goto out;
-	}
-
-	rv = do_write(fd, &h, sizeof(h));
-	close(fd);
- out:
-	return rv;
-}
-
diff --git a/dlm/man/Makefile b/dlm/man/Makefile
deleted file mode 100644
index 9041a93..0000000
--- a/dlm/man/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
-TARGET= dlm_cleanup.3 \
-	dlm_close_lockspace.3 \
-	dlm_create_lockspace.3 \
-	dlm_dispatch.3 \
-	dlm_get_fd.3 \
-	dlm_lock.3 \
-	dlm_lock_wait.3 \
-	dlm_ls_lock.3 \
-	dlm_ls_lockx.3 \
-	dlm_ls_lock_wait.3 \
-	dlm_ls_pthread_init.3 \
-	dlm_ls_unlock.3 \
-	dlm_ls_unlock_wait.3 \
-	dlm_new_lockspace.3 \
-	dlm_open_lockspace.3 \
-	dlm_pthread_init.3 \
-	dlm_release_lockspace.3 \
-	dlm_unlock.3 \
-	dlm_unlock_wait.3 \
-	libdlm.3 \
-	dlm_tool.8
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/man.mk
diff --git a/dlm/man/dlm_cleanup.3 b/dlm/man/dlm_cleanup.3
deleted file mode 100644
index db4a9cf..0000000
--- a/dlm/man/dlm_cleanup.3
+++ /dev/null
@@ -1 +0,0 @@
-.so man3/libdlm.3
diff --git a/dlm/man/dlm_close_lockspace.3 b/dlm/man/dlm_close_lockspace.3
deleted file mode 100644
index e5db408..0000000
--- a/dlm/man/dlm_close_lockspace.3
+++ /dev/null
@@ -1 +0,0 @@
-.so man3/dlm_create_lockspace.3
diff --git a/dlm/man/dlm_create_lockspace.3 b/dlm/man/dlm_create_lockspace.3
deleted file mode 100644
index 3879e85..0000000
--- a/dlm/man/dlm_create_lockspace.3
+++ /dev/null
@@ -1,94 +0,0 @@
-.TH DLM_CREATE_LOCKSPACE 3 "July 5, 2007" "libdlm functions"
-.SH NAME
-dlm_create_lockspace, dlm_open_lockspace, dlm_close_lockspace, dlm_release_lockspace \- manipulate DLM lockspaces
-.SH SYNOPSIS
-.nf
- #include <libdlm.h>
-
-dlm_lshandle_t dlm_create_lockspace(const char *name, mode_t mode);
-dlm_lshandle_t dlm_new_lockspace(const char *name, mode_t mode,
-                                 uint32_t flags);
-dlm_lshandle_t dlm_open_lockspace(const char *name);
-int dlm_close_lockspace(dlm_lshandle_t ls);
-int dlm_release_lockspace(const char *name, dlm_lshandle_t ls,
-                          int force);
-
-.fi
-.SH DESCRIPTION
-The DLM allows locks to be partitioned into "lockspaces", and these can be manipulated by userspace calls. It is possible (though not recommended) for an application to have multiple lockspaces open at one time. 
-
-Many of the DLM calls work on the "default" lockspace, which should be fine for most users. The calls with _ls_ in them allow you to isolate your application from all others running in the cluster. Remember, lockspaces are a cluster-wide resource, so if you create a lockspace called "myls" it will share locks with a lockspace called "myls" on all nodes. These calls allow users to create & remove lockspaces, and users to connect to existing lockspace to store their locks there.
-.PP
-.SS
-dlm_lshandle_t dlm_create_lockspace(const char *name, mode_t mode);
-.br
-This creates a lockspace called <name> and the mode of the file user to access it will be <mode> (subject to umask as usual). The lockspace must not already exist on this node, if it does -1 will be returned and errno will be set to EEXIST. If you really want to use this lockspace you can then use dlm_open_lockspace() below. The name is the name of a misc device that will be created in /dev/misc.
-.br
-On success a handle to the lockspace is returned, which can be used to pass into subsequent dlm_ls_lock/unlock calls. Make no assumptions as to the content of this handle as it's content may change in future.
-.br
-The caller must have CAP_SYSADMIN privileges to do this operation.
-.PP
-Return codes:
-0 is returned if the call completed successfully. If not, -1 is returned and errno is set to one of the following:
-.nf
-EINVAL          An invalid parameter was passed to the call
-ENOMEM          A (kernel) memory allocation failed
-EEXIST          The lockspace already exists
-EPERM           Process does not have capability to create lockspaces
-ENOSYS          A fatal error occurred initializing the DLM
-Any error returned by the open() system call
-.fi
-.SS
-int dlm_new_lockspace(const char *name, mode_t mode, uint32_t flags)
-.PP
-Performs the same function as 
-.B dlm_create_lockspace()
-above, but passes some creation flags to the call that affect the lockspace being created. Currently supported flags are:
-.nf
-DLM_LSFL_NODIR    the lockspace should not use a resource directory
-DLM_LSFL_TIMEWARN the dlm should emit warnings over netlink when locks
-                  have been waiting too long; required for deadlock
-                  detection
-.fi
-.SS
-int dlm_release_lockspace(const char *name, dlm_lshandle_t ls, int force)
-.PP
-Deletes a lockspace. If the lockspace still has active locks then -1 will be returned and errno set to EBUSY. Both the lockspace handle /and/ the name must be specified. This call also closes the lockspace and stops the thread associated with the lockspace, if any.
-.br
-Note that other nodes in the cluster may still have locks open on this lockspace. This call only removes the lockspace from the current node.  If the force flag is set then the lockspace will be removed even if another user on this node has active locks in it. Existing users will NOT be notified if you do this, so be careful.
-.br
-The caller must have CAP_SYSADMIN privileges to do this operation.
-.PP
-Return codes:
-0 is returned if the call completed successfully. If not, -1 is returned and errno is set to one of the following:
-.nf
-EINVAL          An invalid parameter was passed to the call
-EPERM           Process does not have capability to release lockspaces
-EBUSY           The lockspace could not be freed because it still
-                contains locks and force was not set.
-.fi
-
-.SS
-dlm_lshandle_t dlm_open_lockspace(const char *name)
-.PP
-Opens an already existing lockspace and returns a handle to it.
-.PP
-Return codes:
-0 is returned if the call completed successfully. If not, -1 is returned and errno is set to an error returned by the open() system call
-.SS
-int dlm_close_lockspace(dlm_lshandle_t ls)
-.br
-Close the lockspace. Any locks held by this process will be freed. If a thread is associated with this lockspace then it will be stopped.
-.PP
-Return codes:
-0 is returned if the call completed successfully. If not, -1 is returned and errno is set to one of the following:
-.nf
-EINVAL		lockspace was not a valid lockspace handle
-.fi
-
-
-.SH SEE ALSO
-
-.BR libdlm (3),
-.BR dlm_unlock (3),
-.BR dlm_lock (3),
diff --git a/dlm/man/dlm_dispatch.3 b/dlm/man/dlm_dispatch.3
deleted file mode 100644
index db4a9cf..0000000
--- a/dlm/man/dlm_dispatch.3
+++ /dev/null
@@ -1 +0,0 @@
-.so man3/libdlm.3
diff --git a/dlm/man/dlm_get_fd.3 b/dlm/man/dlm_get_fd.3
deleted file mode 100644
index db4a9cf..0000000
--- a/dlm/man/dlm_get_fd.3
+++ /dev/null
@@ -1 +0,0 @@
-.so man3/libdlm.3
diff --git a/dlm/man/dlm_lock.3 b/dlm/man/dlm_lock.3
deleted file mode 100644
index 3c5f8b5..0000000
--- a/dlm/man/dlm_lock.3
+++ /dev/null
@@ -1,239 +0,0 @@
-.TH DLM_LOCK 3 "July 5, 2007" "libdlm functions"
-.SH NAME
-dlm_lock \- acquire or convert a DLM lock
-.SH SYNOPSIS
-.nf
- #include <libdlm.h>
-
-int dlm_lock(uint32_t mode,
-		struct dlm_lksb *lksb,	
-		uint32_t flags,	
-		const void *name,	
-		unsigned int namelen,
-		uint32_t parent,		/* unused */
-		void (*astaddr) (void *astarg),
-		void *astarg,
-		void (*bastaddr) (void *astarg),
-		void *range);			/* unused */
-
-int dlm_lock_wait(uint32_t mode,
-		struct dlm_lksb *lksb,
-		uint32_t flags,
-		const void *name,
-		unsigned int namelen,
-		uint32_t parent,		/* unused */
-		void *bastarg,
-		void (*bastaddr) (void *bastarg),
-		void *range);			/* unused */
-
-int dlm_ls_lock(dlm_lshandle_t lockspace,
-		uint32_t mode,
-		struct dlm_lksb *lksb,
-		uint32_t flags,
-		const void *name,
-		unsigned int namelen,
-		uint32_t parent,		/* unused */
-		void (*astaddr) (void *astarg),
-		void *astarg,
-		void (*bastaddr) (void *astarg),
-		void *range);			/* unused */
-
-int dlm_ls_lock_wait(dlm_lshandle_t lockspace,
-		uint32_t mode,
-		struct dlm_lksb *lksb,
-		uint32_t flags,
-		const void *name,
-		unsigned int namelen,
-		uint32_t parent,		/* unusued */
-		void *bastarg,
-		void (*bastaddr) (void *bastarg),
-		void *range);			/* unused */
-
-int dlm_ls_lockx(dlm_lshandle_t lockspace,
-		uint32_t mode,
-		struct dlm_lksb *lksb,
-		uint32_t flags,
-		const void *name,
-		unsigned int namelen,
-		uint32_t parent,		/* unused */
-		(*astaddr) (void *astarg),
-		void *astarg,
-		void (*bastaddr) (void *astarg),
-		uint64_t *xid,
-		uint64_t *timeout);
-
-
-
-.fi
-.SH DESCRIPTION
-dlm_lock and its variants acquire and convert locks in the DLM.
-.PP
-dlm_lock() operations are asynchronous. If the call to dlm_lock returns an error then the operation has failed and the AST routine will not be called. If dlm_lock returns 0 it is still possible that the lock operation will fail. The AST routine will be called when the locking is complete or has failed and the status is returned in the lksb. 
-.B dlm_lock_wait()
-will wait until the lock operation has completed and returns the final completion status.
-.B dlm_ls_lock()
-is the same as 
-.B dlm_lock()
-but takes a lockspace argument. This lockspace must have been previously opened by
-.B dlm_lockspace_open() or
-.B dlm_lockspace_create().
-.PP
-For conversion operations the name and namelen are ignored and the lock ID in the LKSB is used to identify the lock to be converted.
-.PP
-If a lock value block is specified then in general, a grant or a conversion to an equal-level or higher-level lock mode reads the lock value from the resource into the caller's lock value block. When a lock conversion from EX or PW to an equal-level or lower-level lock mode occurs, the contents of the caller's lock value block are written into the resource. If the LVB is invalidated the lksb.sb_flags member will be set to DLM_SBF_VALNOTVALID. Lock values blocks are always 32 bytes long.
-.PP
-If the AST routines or parameter are passed to a conversion operation then they will overwrite those values that were passed to a previous dlm_lock call.
-.PP
-.B mode
-Lock mode to acquire or convert to.
-.nf
-  LKM_NLMODE	NULL Lock
-  LKM_CRMODE	Concurrent read
-  LKM_CWMODE	Concurrent write
-  LKM_PRMODE	Protected read
-  LKM_PWMODE	Protected write
-  LKM_EXMODE	Exclusive
-.fi
-.PP
-.B flags
-Affect the operation of the lock call:
-.nf
-  LKF_NOQUEUE     Don't queue the lock. If it cannot be granted return
-                  -EAGAIN
-  LKF_CONVERT     Convert an existing lock
-  LKF_VALBLK      Lock has a value block
-  LKF_QUECVT      Put conversion to the back of the queue
-  LKF_EXPEDITE    Grant a NL lock immediately regardless of other locks
-                  on the conversion queue
-  LKF_PERSISTENT  Specifies a lock that will not be unlocked when the
-                  process exits; it will become an orphan lock.
-  LKF_CONVDEADLK  Enable internal conversion deadlock resolution where
-                  the lock's granted mode may be set to NL and
-                  DLM_SBF_DEMOTED is returned in lksb.sb_flags.
-  LKF_NODLCKWT    Do not consider this lock when trying to detect
-                  deadlock conditions.
-  LKF_NODLCKBLK   Not implemented
-  LKF_NOQUEUEBAST Send blocking ASTs even for NOQUEUE operations
-  LKF_HEADQUE     Add locks to the head of the convert or waiting queue
-  LKF_NOORDER     Avoid the VMS rules on grant order
-  LKF_ALTPR       If the requested mode can't be granted (generally CW),
-                  try to grant in PR and return DLM_SBF_ALTMODE.
-  LKF_ALTCW       If the requested mode can't be granted (generally PR),
-                  try to grant in CW and return DLM_SBF_ALTMODE.
-  LKF_TIMEOUT     The lock will time out per the timeout arg.
-
-.fi
-.PP
-.B lksb
-Lock Status block
-.br
-This structure contains the returned lock ID, the actual
-status of the lock operation (all lock ops are asynchronous)
-and the value block if LKF_VALBLK is set.
-.PP
-.B name
-.br
-Name of the lock. Can be binary, max 64 bytes. Ignored for lock
-conversions.  (Should be a string to work with debugging tools.)
-.PP
-.B namelen	
-.br
-Length of the above name. Ignored for lock conversions.
-.PP
-.B parent	
-.br
-ID of parent lock or NULL if this is a top-level lock. This is currently unused.
-.PP
-.B ast	
-.br
-Address of AST routine to be called when the lock operation
-completes. The final completion status of the lock will be
-in the lksb. the AST routine must not be NULL.
-.PP		
-.B astargs	
-.br
-Argument to pass to the AST routine (most people pass the lksb
-in here but it can be anything you like.)
-.PP
-.B bast
-.br
-Blocking AST routine. address of a function to call if this 
-lock is blocking another. The function will be called with
-astargs. 
-.PP
-.B range
-.br
-This is unused.
-.PP
-.B xid
-.br
-Optional transaction ID for deadlock detection.
-.PP
-.B timeout
-.br
-Timeout in centiseconds. If it takes longer than this to acquire the lock
-(usually because it is already blocked by another lock), then the AST 
-will trigger with ETIMEDOUT as the status. If the lock operation is a conversion
-then the lock will remain at its current status. If this is a new lock then
-the lock will not exist and any LKB in the lksb will be invalid.  This is
-ignored without the LKF_TIMEOUT flag.
-.PP
-.SS Return values
-0 is returned if the call completed successfully. If not, -1 is returned and errno is set to one of the following:
-.PP
-.nf
-EINVAL          An invalid parameter was passed to the call (eg bad lock
-                mode or flag)
-ENOMEM          A (kernel) memory allocation failed
-EAGAIN          LKF_NOQUEUE was requested and the lock could not be
-                granted
-EBUSY           The lock is currently being locked or converted
-EFAULT          The userland buffer could not be read/written by the
-                kernel (this indicates a library problem)
-EDEADLOCK       The lock operation is causing a deadlock and has been
-                cancelled. If this was a conversion then the lock is
-                reverted to its previously granted state. If it was a
-                new lock then it has not been granted. (NB Only
-                conversion deadlocks are currently detected)
-.PP
-If an error is returned in the AST, then lksb.sb_status is set to the one of the above values instead of zero.
-.SS Structures
-.nf
-struct dlm_lksb {
-  int      sb_status; /* Final status of lock operation */
-  uint32_t sb_lkid;   /* ID of lock. Returned from dlm_lock()
-                         on first use. Used as input to
-                         dlm_lock() for a conversion operation */
-  char     sb_flags;  /* Completion flags, see above */
-  char     sb_lvbptr; /* Optional pointer to lock value block */
-};
-
-.fi
-.SH EXAMPLE
-.nf
-int status;
-struct dlm_lksb lksb;
-
-status = dlm_lock_wait(LKM_EXMODE,
-                       &lksb,
-                       LKF_NOQUEUE,
-                       "MyLock",
-                       strlen("MyLock"),
-                       0, // Parent,
-                       NULL, // bast arg
-                       NULL, // bast routine,
-                       NULL); // Range
-
-if (status == 0)
-	dlm_unlock_wait(lksb.sb_lkid, 0, &lksb);
-
-.fi
-
-.SH SEE ALSO
-
-.BR libdlm (3),
-.BR dlm_unlock (3),
-.BR dlm_open_lockspace (3),
-.BR dlm_create_lockspace (3),
-.BR dlm_close_lockspace (3),
-.BR dlm_release_lockspace (3)
diff --git a/dlm/man/dlm_lock_wait.3 b/dlm/man/dlm_lock_wait.3
deleted file mode 100644
index a99225c..0000000
--- a/dlm/man/dlm_lock_wait.3
+++ /dev/null
@@ -1 +0,0 @@
-.so man3/dlm_lock.3
diff --git a/dlm/man/dlm_ls_lock.3 b/dlm/man/dlm_ls_lock.3
deleted file mode 100644
index a99225c..0000000
--- a/dlm/man/dlm_ls_lock.3
+++ /dev/null
@@ -1 +0,0 @@
-.so man3/dlm_lock.3
diff --git a/dlm/man/dlm_ls_lock_wait.3 b/dlm/man/dlm_ls_lock_wait.3
deleted file mode 100644
index a99225c..0000000
--- a/dlm/man/dlm_ls_lock_wait.3
+++ /dev/null
@@ -1 +0,0 @@
-.so man3/dlm_lock.3
diff --git a/dlm/man/dlm_ls_lockx.3 b/dlm/man/dlm_ls_lockx.3
deleted file mode 100644
index a99225c..0000000
--- a/dlm/man/dlm_ls_lockx.3
+++ /dev/null
@@ -1 +0,0 @@
-.so man3/dlm_lock.3
diff --git a/dlm/man/dlm_ls_pthread_init.3 b/dlm/man/dlm_ls_pthread_init.3
deleted file mode 100644
index db4a9cf..0000000
--- a/dlm/man/dlm_ls_pthread_init.3
+++ /dev/null
@@ -1 +0,0 @@
-.so man3/libdlm.3
diff --git a/dlm/man/dlm_ls_unlock.3 b/dlm/man/dlm_ls_unlock.3
deleted file mode 100644
index 91babd2..0000000
--- a/dlm/man/dlm_ls_unlock.3
+++ /dev/null
@@ -1 +0,0 @@
-.so man3/dlm_unlock.3
diff --git a/dlm/man/dlm_ls_unlock_wait.3 b/dlm/man/dlm_ls_unlock_wait.3
deleted file mode 100644
index 91babd2..0000000
--- a/dlm/man/dlm_ls_unlock_wait.3
+++ /dev/null
@@ -1 +0,0 @@
-.so man3/dlm_unlock.3
diff --git a/dlm/man/dlm_new_lockspace.3 b/dlm/man/dlm_new_lockspace.3
deleted file mode 100644
index e5db408..0000000
--- a/dlm/man/dlm_new_lockspace.3
+++ /dev/null
@@ -1 +0,0 @@
-.so man3/dlm_create_lockspace.3
diff --git a/dlm/man/dlm_open_lockspace.3 b/dlm/man/dlm_open_lockspace.3
deleted file mode 100644
index e5db408..0000000
--- a/dlm/man/dlm_open_lockspace.3
+++ /dev/null
@@ -1 +0,0 @@
-.so man3/dlm_create_lockspace.3
diff --git a/dlm/man/dlm_pthread_init.3 b/dlm/man/dlm_pthread_init.3
deleted file mode 100644
index db4a9cf..0000000
--- a/dlm/man/dlm_pthread_init.3
+++ /dev/null
@@ -1 +0,0 @@
-.so man3/libdlm.3
diff --git a/dlm/man/dlm_release_lockspace.3 b/dlm/man/dlm_release_lockspace.3
deleted file mode 100644
index e5db408..0000000
--- a/dlm/man/dlm_release_lockspace.3
+++ /dev/null
@@ -1 +0,0 @@
-.so man3/dlm_create_lockspace.3
diff --git a/dlm/man/dlm_tool.8 b/dlm/man/dlm_tool.8
deleted file mode 100644
index 57e3da3..0000000
--- a/dlm/man/dlm_tool.8
+++ /dev/null
@@ -1,39 +0,0 @@
-.TH dlm_tool 8
-
-.SH NAME
-dlm_tool - A program to join and leave lockspaces and display dlm information
-
-.SH SYNOPSIS
-.B
-dlm_tool
-[\fIOPTIONS\fR]
-<\fBjoin | leave | lockdump | deadlock_check\fP>
-<\fBname\fP>
-
-.SH DESCRIPTION
-
-\fBdlm_tool\fP is a program used to join or leave dlm lockspaces, dump
-dlm lock state, and initiate deadlock detection cycles.  The name of a
-lockspace follows the subcommand.
-
-.SH OPTIONS
-.TP
-\fB-m\fP
-The permission mode (in octal) of the lockspace device created by join;
-default 0600.
-.TP
-\fB-M\fP
-Dump MSTCPY locks in addition to locks held by local processes.
-.TP
-\fB-d\fP <num>
-Resource directory enabled (1) or disabled (0) during join; default 0.
-.TP
-\fB-h\fP
-Help.  Print out the usage syntax.
-.TP
-\fB-V\fP
-Print version information.
-
-.SH SEE ALSO
-libdlm(3)
-
diff --git a/dlm/man/dlm_unlock.3 b/dlm/man/dlm_unlock.3
deleted file mode 100644
index 9023139..0000000
--- a/dlm/man/dlm_unlock.3
+++ /dev/null
@@ -1,94 +0,0 @@
-.TH DLM_UNLOCK 3 "July 5, 2007" "libdlm functions"
-.SH NAME
-dlm_unlock \- unlock a DLM lock
-.SH SYNOPSIS
-.nf
-#include <libdlm.h>
-
-int dlm_unlock(uint32_t lkid,
-               uint32_t flags, struct dlm_lksb *lksb, void *astarg);
-
-int dlm_unlock_wait(uint32_t lkid,
-                    uint32_t flags, struct dlm_lksb *lksb);
-
-.fi
-.SH DESCRIPTION
-.B dlm_unlock()
-unlocks a lock previously acquired by dlm_lock and its variants.
-.PP
-Unless 
-.B dlm_unlock_wait() 
-is used unlocks are also asynchronous. The AST routine is called when the resource is successfully unlocked (see below).
-.PP
-.B lkid
-Lock ID as returned in the lksb
-.PP
-.B flags
-flags affecting the unlock operation:
-.nf
-  LKF_CANCEL       Cancel a pending lock or conversion. 
-                   This returns the lock to it's previously
-                   granted mode (in case of a conversion) or
-                   unlocks it (in case of a waiting lock).
-  LKF_IVVALBLK     Invalidate value block
-  LKF_FORCEUNLOCK  Unlock the lock even if it's waiting.
-.fi
-.PP
-.B lksb
-LKSB to return status and value block information.
-.PP
-.B astarg
-New parameter to be passed to the completion AST.
-The completion AST routine is the
-last completion AST routine specified in a dlm_lock call.
-If dlm_lock_wait() was the last routine to issue a lock, 
-dlm_unlock_wait() must be used to release the lock. If dlm_lock()
-was the last routine to issue a lock then either dlm_unlock()
-or dlm_unlock_wait() may be called.
-.PP
-
-.SS Return values
-0 is returned if the call completed successfully. If not, -1 is returned and errno is set to one of the following:
-.PP
-.nf
-EINVAL          An invalid parameter was passed to the call (eg bad
-                lock mode or flag)
-EINPROGRESS     The lock is already being unlocked
-EBUSY           The lock is currently being locked or converted
-ENOTEMPTY       An attempt to made to unlock a parent lock that still has
-                child locks.
-ECANCEL         A lock conversion was successfully cancelled
-EUNLOCK         An unlock operation completed successfully
-                (sb_status only)
-EFAULT          The userland buffer could not be read/written by the
-                kernel
-.fi
-If an error is returned in the AST, then lksb.sb_status is set to the one of the above numbers instead of zero.
-.SH EXAMPLE
-.nf
-int status;
-struct dlm_lksb lksb;
-
-status = dlm_lock_wait(LKM_EXMODE,
-                       &lksb,
-                       LKF_NOQUEUE,
-                       "MyLock",
-                       strlen("MyLock"),
-                       0,     // Parent,
-                       NULL,  // bast arg
-                       NULL,  // bast routine,
-                       NULL); // Range
-
-if (status == 0)
-	dlm_unlock_wait(lksb.sb_lkid, 0, &lksb);
-
-.fi
-
-.SH SEE ALSO
-
-.BR libdlm (3),
-.BR dlm_lock (3),
-.BR dlm_open_lockspace (3),
-.BR dlm_create_lockspace (3),
-.BR dlm_close_lockspace (3),
-.BR dlm_release_lockspace (3)
diff --git a/dlm/man/dlm_unlock_wait.3 b/dlm/man/dlm_unlock_wait.3
deleted file mode 100644
index 91babd2..0000000
--- a/dlm/man/dlm_unlock_wait.3
+++ /dev/null
@@ -1 +0,0 @@
-.so man3/dlm_unlock.3
diff --git a/dlm/man/libdlm.3 b/dlm/man/libdlm.3
deleted file mode 100644
index a020560..0000000
--- a/dlm/man/libdlm.3
+++ /dev/null
@@ -1,105 +0,0 @@
-.TH LIBDLM 3 "July 5, 2007" "libdlm functions"
-.SH NAME
-libdlm \- dlm_get_fd, dlm_dispatch, dlm_pthread_init, dlm_ls_pthread_init, dlm_cleanup
-.SH SYNOPSIS
-.nf
-#include <libdlm.h>
-.nf
-int dlm_pthread_init();
-int dlm_ls_pthread_init(dlm_lshandle_t lockspace);
-int dlm_pthread_cleanup();
-int dlm_get_fd(void);
-int dlm_dispatch(int fd);
-
-link with -ldlm
-.fi
-.SH DESCRIPTION
-libdlm provides the programmatic userspace interface to the Distributed Lock manager. It provides all the calls you need to manipulate locks & lockspaces
-.br
-libdlm can be used in pthread or non-pthread applications. For pthread applications simply call the following function before doing any lock operations. If you're using pthreads, remember to define _REENTRANT at the top of the program or using -D_REENTRANT on the compile line.
-.br
-pthreads is the normal way of using the DLM. This way you simply initialize the DLM's thread and all the AST routines will be delivered in that thread. You just call the dlm_lock() etc routines in the main line of your program.
-.br
-If you don't want to use pthreads or you want to handle the dlm callback ASTs yourself then you can get an FD handle to the DLM device and call 
-.B dlm_dispatch()
-on it whenever it becomes active. That was ASTs will be delivered in the context of the thread/process that called 
-.B dlm_dispatch().
-
-
-.SS int dlm_pthread_init()
-.br
-Creates a thread to receive all lock ASTs. The AST callback function for lock operations will be called in the context of this thread. If there is a potential for local resource access conflicts you must provide your own pthread-based locking in the AST routine.
-.PP
-.SS int dlm_ls_pthread_init(dlm_lshandle_t lockspace)
-.br
-As dlm_pthread_init but initializes a thread for the specified lockspace.
-.PP
-.SS int dlm_pthread_cleanup()
-.br
-Cleans up the default lockspace threads after use. Normally you don't need to call this, but if the locking code is in a dynamically loadable shared library this will probably be necessary.
-.br
-For non-pthread based applications the DLM provides a file descriptor that the program can feed into poll/select. If activity is detected on that FD then a dispatch function should be called:
-.PP
-.SS int dlm_get_fd()
-Returns a file-descriptor for the DLM suitable for passing in to poll() or select().
-.PP
-.SS int dlm_dispatch(int fd)
-.br
-Reads from the DLM and calls any AST routines that may be needed. This routine runs in the context of the caller so no extra locking is needed to protect local resources.
-.PP
-
-
-.SH libdlm_lt
-There also exists a "light" version of the libdlm library called libdlm_lt. This is provided for those applications that do not want to use pthread functions. If you use this library it is important that your application is NOT compiled with -D_REENTRANT or linked with libpthread.
-
-.SH EXAMPLES
-
-Create a lockspace and start a thread to deliver its callbacks:
-.nf
-dlm_lshandle_t ls;
-
-ls = dlm_create_lockspace("myLS", 0660);
-dlm_ls_pthread_init(ls);
-
- ...
-
-status = dlm_ls_lock(ls,
-                     ... );
-
-
-.fi
-.PP
- Using poll(2) to wait for and dispatch ASTs
-.nf
-
-
-static int poll_for_ast(dlm_lshandle_t ls)
-{
-    struct pollfd pfd;
-
-    pfd.fd = dlm_ls_get_fd(ls);
-    pfd.events = POLLIN;
-    while (!ast_called)
-    {
-        if (poll(&pfd, 1, 0) < 0)
-        {
-            perror("poll");
-            return -1;
-        }
-        dlm_dispatch(dlm_ls_get_fd(ls));
-    }
-    ast_called = 0;
-    return 0;
-}
-.fi
-
-
-.SH SEE ALSO
-
-.BR libdlm (3),
-.BR dlm_lock (3),
-.BR dlm_unlock (3),
-.BR dlm_open_lockspace (3),
-.BR dlm_create_lockspace (3),
-.BR dlm_close_lockspace (3),
-.BR dlm_release_lockspace (3)
diff --git a/dlm/tests/Makefile b/dlm/tests/Makefile
deleted file mode 100644
index 28685d2..0000000
--- a/dlm/tests/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../../make/defines.mk
-include $(OBJDIR)/make/passthrough.mk
-
-SUBDIRS=usertest
diff --git a/dlm/tests/usertest/Makefile b/dlm/tests/usertest/Makefile
deleted file mode 100644
index 5e070f7..0000000
--- a/dlm/tests/usertest/Makefile
+++ /dev/null
@@ -1,23 +0,0 @@
-TARGETS= dlmtest asttest lstest pingtest lvb \
-	 dlmtest2 flood alternate-lvb joinleave threads
-
-all: depends ${TARGETS}
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-
-CFLAGS += -D_REENTRANT
-CFLAGS += -I${dlmincdir}
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${dlmlibdir} -ldlm -lpthread
-LDFLAGS += -L${libdir}
-
-depends:
-	$(MAKE) -C ../../libdlm all
-
-%: %.o
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-clean: generalclean
diff --git a/dlm/tests/usertest/alternate-lvb.c b/dlm/tests/usertest/alternate-lvb.c
deleted file mode 100644
index 779125a..0000000
--- a/dlm/tests/usertest/alternate-lvb.c
+++ /dev/null
@@ -1,165 +0,0 @@
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <stddef.h>
-#include <string.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <time.h>
-#include <sys/time.h>
-#include <syslog.h>
-#include <asm/types.h>
-#include <sys/socket.h>
-#include <sys/poll.h>
-#include <sys/un.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/errno.h>
-
-#include "libdlm.h"
-
-#define die(fmt, args...) \
-do \
-{ \
-  fprintf(stderr, "%s: ", prog_name); \
-  fprintf(stderr, fmt, ##args); \
-  exit(EXIT_FAILURE); \
-} \
-while (0)
-
-static char *prog_name;
-static dlm_lshandle_t *dh;
-static int verbose;
-
-static struct dlm_lksb lksb;
-static char lvb[32];
-
-int main(int argc, char *argv[])
-{
-	unsigned long long offset;
-	unsigned long long num, last_num = 0;
-	unsigned int id, clients, sleep = 0;
-	unsigned long long skip = 0;
-	char *name;
-	int rv;
-
-	prog_name = argv[0];
-	verbose = 0;
-
-	if (argc < 5)
-		die("name offset id clients [sleep]\n");
-
-	name = argv[1];
-	offset = atoll(argv[2]);
-	id = atoi(argv[3]);
-	clients = atoi(argv[4]);
-
-	if (argc > 5)
-		sleep = atoi(argv[5]);
-
-	printf("Joining \"alternate\" lockspace...\n");
-
-	dh = dlm_create_lockspace("alternate", 0600);
-	if (!dh) {
-		printf("dlm_create_lockspace error %d %d\n", (int) dh, errno);
-		return -ENOTCONN;
-	}
-
-	rv = dlm_ls_pthread_init(dh);
-	if (rv < 0) {
-		printf("dlm_ls_pthread_init error %d %d\n", rv, errno);
-		dlm_release_lockspace("alternate", dh, 1);
-		return rv;
-	}
-
-	memset(&lksb, 0, sizeof(lksb));
-	memset(&lvb, 0, sizeof(lvb));
-	lksb.sb_lvbptr = lvb;
-
-	if (verbose)
-		printf("request NL\n");
-
-	rv = dlm_ls_lock_wait(dh, LKM_NLMODE, &lksb, LKF_VALBLK,
-			      name, strlen(name), 0, NULL, NULL, NULL);
-
-	while (1) {
-		if (verbose)
-			printf("convert NL->PR\n");
-
-		rv = dlm_ls_lock_wait(dh, LKM_PRMODE, &lksb,
-				      LKF_VALBLK | LKF_CONVERT,
-			      	      name, strlen(name),
-				      0, NULL, NULL, NULL);
-		if (rv)
-			printf("lock1 error: %d %d\n", rv, lksb.sb_status);
-
-		memcpy(&num, &lvb, sizeof(num));
-
-		if (verbose)
-			printf("read lvb %llu\n", num);
-
-		/* it's our turn */
-		if (num % clients == id) {
-			if (last_num && last_num + clients != num + 1)
-				die("bad: num %llu last_num %llu\n",
-				    num, last_num);
-
-			if (verbose)
-				printf("convert PR->EX\n");
-
-			rv = dlm_ls_lock_wait(dh, LKM_EXMODE, &lksb,
-				      	      LKF_VALBLK | LKF_CONVERT,
-					      name, strlen(name),
-					      0, NULL, NULL, NULL);
-			if (rv)
-				printf("lock2 error: %d %d\n", rv,
-					lksb.sb_status);
-
-			memcpy(&num, &lvb, sizeof(num));
-			if (num % clients != id)
-				die("bad2: num %llu\n", num);
-
-			num++;
-
-			memcpy(&lvb, &num, sizeof(num));
-			printf("%llu %llu\n", num, skip);
-
-			if (verbose)
-				printf("convert EX->NL\n");
-
-			rv = dlm_ls_lock_wait(dh, LKM_NLMODE, &lksb,
-				      	      LKF_VALBLK | LKF_CONVERT,
-					      name, strlen(name),
-					      0, NULL, NULL, NULL);
-			if (rv)
-				printf("lock3 error: %d %d\n", rv,
-					lksb.sb_status);
-
-			last_num = num;
-			skip = 0;
-		} else {
-			skip++;
-
-			if (verbose)
-				printf("convert PR->NL, skip %llu\n", skip);
-
-			rv = dlm_ls_lock_wait(dh, LKM_NLMODE, &lksb,
-				      	      LKF_VALBLK | LKF_CONVERT,
-					      name, strlen(name),
-					      0, NULL, NULL, NULL);
-			if (rv)
-				printf("lock4 error: %d %d\n", rv,
-					lksb.sb_status);
-		}
-
-		if (sleep)
-			usleep(sleep);
-	}
-
-	dlm_ls_unlock_wait(dh, lksb.sb_lkid, 0, &lksb);
-	dlm_release_lockspace("alternate", dh, 1);
-
-	exit(EXIT_SUCCESS);
-}
-
diff --git a/dlm/tests/usertest/asttest.c b/dlm/tests/usertest/asttest.c
deleted file mode 100644
index da498f3..0000000
--- a/dlm/tests/usertest/asttest.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/* Test program for userland DLM interface w/ AST */
-/* NOTE: This is not much of a program and it fails in all
-   sorts of ways. But it /does/ illustrate the full dlm_lock
-   call and ASTs. It doesn /not/ show how you should use the
-   FD parts fo the API!
-*/
-
-#ifdef _REENTRANT
-#include <pthread.h>
-#endif
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <sys/poll.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <net/if.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <fcntl.h>
-#include <netdb.h>
-#include <limits.h>
-#include <unistd.h>
-#include <errno.h>
-#include <getopt.h>
-
-#include "libdlm.h"
-
-static struct dlm_lksb lksb;
-static int use_threads = 0;
-static int quiet = 0;
-
-/* Used by the pthread test */
-static pthread_cond_t  cond;
-static pthread_mutex_t mutex;
-
-/* Used by the poll() test */
-static int ast_called = 0;
-
-static int modetonum(char *modestr)
-{
-    int mode = LKM_EXMODE;
-
-    if (strncasecmp(modestr, "NL", 2) == 0) mode = LKM_NLMODE;
-    if (strncasecmp(modestr, "CR", 2) == 0) mode = LKM_CRMODE;
-    if (strncasecmp(modestr, "CW", 2) == 0) mode = LKM_CWMODE;
-    if (strncasecmp(modestr, "PR", 2) == 0) mode = LKM_PRMODE;
-    if (strncasecmp(modestr, "PW", 2) == 0) mode = LKM_PWMODE;
-    if (strncasecmp(modestr, "EX", 2) == 0) mode = LKM_EXMODE;
-
-    return mode;
-}
-
-static char *numtomode(int mode)
-{
-    switch (mode)
-    {
-    case LKM_NLMODE: return "NL";
-    case LKM_CRMODE: return "CR";
-    case LKM_CWMODE: return "CW";
-    case LKM_PRMODE: return "PR";
-    case LKM_PWMODE: return "PW";
-    case LKM_EXMODE: return "EX";
-    default: return "??";
-    }
-}
-
-static void usage(char *prog, FILE *file)
-{
-    fprintf(file, "Usage:\n");
-    fprintf(file, "%s [mcnpquhV] <lockname>\n", prog);
-    fprintf(file, "\n");
-    fprintf(file, "   -V         Show version of dlmtest\n");
-    fprintf(file, "   -h         Show this help information\n");
-    fprintf(file, "   -m <mode>  lock mode (default EX)\n");
-    fprintf(file, "   -c <mode>  mode to convert to (default none)\n");
-    fprintf(file, "   -n         don't block\n");
-    fprintf(file, "   -p         Use pthreads\n");
-    fprintf(file, "   -u         Don't unlock\n");
-    fprintf(file, "   -C         Crash after lock\n");
-    fprintf(file, "   -q         Quiet\n");
-    fprintf(file, "   -u         Don't unlock explicitly\n");
-    fprintf(file, "\n");
-
-}
-
-static void ast_routine(void *arg)
-{
-    struct dlm_lksb *lksb = arg;
-
-    if (!quiet)
-	printf("ast called, status = %d, lkid=%x\n", lksb->sb_status, lksb->sb_lkid);
-
-    /* Wake the main thread */
-    if (use_threads)
-    {
-	pthread_mutex_lock(&mutex);
-	pthread_cond_signal(&cond);
-	pthread_mutex_unlock(&mutex);
-    }
-    else
-    {
-	ast_called = 1;
-    }
-}
-
-static void bast_routine(void *arg)
-{
-    struct dlm_lksb *lksb = arg;
-
-    if (!quiet)
-	printf("\nblocking ast called, status = %d, lkid=%x\n", lksb->sb_status, lksb->sb_lkid);
-}
-
-/* Using poll(2) to wait for and dispatch ASTs */
-static int poll_for_ast()
-{
-    struct pollfd pfd;
-
-    pfd.fd = dlm_get_fd();
-    pfd.events = POLLIN;
-    while (!ast_called)
-    {
-	if (poll(&pfd, 1, 0) < 0)
-	{
-	    perror("poll");
-	    return -1;
-	}
-	dlm_dispatch(pfd.fd);
-    }
-    ast_called = 0;
-    return 0;
-}
-
-int main(int argc, char *argv[])
-{
-    char *resource = "LOCK-NAME";
-    int  flags = 0;
-    int  delay = 0;
-    int  status;
-    int  mode = LKM_EXMODE;
-    int  convmode = -1;
-    int  do_unlock = 1;
-    int  do_crash = 0;
-    signed char opt;
-
-    /* Deal with command-line arguments */
-    opterr = 0;
-    optind = 0;
-    while ((opt=getopt(argc,argv,"?m:nqupc:d:CvV")) != EOF)
-    {
-	switch(opt)
-	{
-	case 'h':
-	    usage(argv[0], stdout);
-	    exit(0);
-
-	case '?':
-	    usage(argv[0], stderr);
-	    exit(0);
-
-	case 'm':
-	    mode = modetonum(optarg);
-	    break;
-
-	case 'c':
-	    convmode = modetonum(optarg);
-	    break;
-
-        case 'p':
-            use_threads++;
-            break;
-
-	case 'n':
-	    flags |= LKF_NOQUEUE;
-	    break;
-
-        case 'q':
-            quiet = 1;
-            break;
-
-        case 'u':
-            do_unlock = 0;
-            break;
-
-	case 'C':
-	    do_crash = 1;
-	    break;
-
-	case 'd':
-	    delay = atoi(optarg);	
-	    break;
-
-	case 'V':
-	    printf("\nasttest version 0.1\n\n");
-	    exit(1);
-	    break;
-	}
-    }
-
-    if (argv[optind])
-	resource = argv[optind];
-
-    if (!quiet)
-    fprintf(stderr, "locking %s %s %s...", resource,
-	    numtomode(mode),
-	    (flags&LKF_NOQUEUE?"(NOQUEUE)":""));
-
-    fflush(stderr);
-
-    if (use_threads)
-    {
-	pthread_cond_init(&cond, NULL);
-	pthread_mutex_init(&mutex, NULL);
-	pthread_mutex_lock(&mutex);
-
-	dlm_pthread_init();
-    }
-
-    status = dlm_lock(mode,
-		      &lksb,
-		      flags,
-		      resource,
-		      strlen(resource),
-		      0, // Parent,
-		      ast_routine,
-		      &lksb,
-		      bast_routine,
-		      NULL); // Range
-    if (status == -1)
-    {
-	if (!quiet) fprintf(stderr, "\n");
-	perror("lock");
-
-	return -1;
-    }
-    printf("(lkid=%x)", lksb.sb_lkid);
-
-    if (do_crash)
-	*(int *)0 = 0xdeadbeef;
-
-    /* Wait */
-    if (use_threads)
-	pthread_cond_wait(&cond, &mutex);
-    else
-	poll_for_ast();
-
-    if (delay)
-        sleep(delay);
-
-    if (!quiet)
-    {
-        fprintf(stderr, "unlocking %s...", resource);
-        fflush(stderr);
-    }
-
-    if (do_unlock)
-    {
-	status = dlm_unlock(lksb.sb_lkid,
-			    0, // flags
-			    &lksb,
-			    &lksb); // AST args
-	if (status == -1)
-	{
-	    if (!quiet) fprintf(stderr, "\n");
-	    perror("unlock");
-	    return -1;
-	}
-
-	/* Wait */
-	if (use_threads)
-	    pthread_cond_wait(&cond, &mutex);
-	else
-	    poll_for_ast();
-    }
-
-    return 0;
-}
-
diff --git a/dlm/tests/usertest/dlmtest.c b/dlm/tests/usertest/dlmtest.c
deleted file mode 100644
index 1c3e312..0000000
--- a/dlm/tests/usertest/dlmtest.c
+++ /dev/null
@@ -1,291 +0,0 @@
-/* Test program for userland DLM interface */
-
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <net/if.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <fcntl.h>
-#include <netdb.h>
-#include <limits.h>
-#include <unistd.h>
-#include <errno.h>
-#include <getopt.h>
-
-#include "libdlm.h"
-
-static struct dlm_lksb lksb;
-static int modetonum(char *modestr)
-{
-    int mode = LKM_EXMODE;
-
-    if (strncasecmp(modestr, "NL", 2) == 0) mode = LKM_NLMODE;
-    if (strncasecmp(modestr, "CR", 2) == 0) mode = LKM_CRMODE;
-    if (strncasecmp(modestr, "CW", 2) == 0) mode = LKM_CWMODE;
-    if (strncasecmp(modestr, "PR", 2) == 0) mode = LKM_PRMODE;
-    if (strncasecmp(modestr, "PW", 2) == 0) mode = LKM_PWMODE;
-    if (strncasecmp(modestr, "EX", 2) == 0) mode = LKM_EXMODE;
-
-    return mode;
-}
-
-static char *numtomode(int mode)
-{
-    switch (mode)
-    {
-    case LKM_NLMODE: return "NL";
-    case LKM_CRMODE: return "CR";
-    case LKM_CWMODE: return "CW";
-    case LKM_PRMODE: return "PR";
-    case LKM_PWMODE: return "PW";
-    case LKM_EXMODE: return "EX";
-    default: return "??";
-    }
-}
-
-static void usage(char *prog, FILE *file)
-{
-    fprintf(file, "Usage:\n");
-    fprintf(file, "%s [hmcnQpequdV] <lockname>\n", prog);
-    fprintf(file, "\n");
-    fprintf(file, "   -V         Show version of dlmtest\n");
-    fprintf(file, "   -h         Show this help information\n");
-    fprintf(file, "   -m <mode>  lock mode (default EX)\n");
-    fprintf(file, "   -c <mode>  mode to convert to (default none)\n");
-    fprintf(file, "   -n         don't block\n");
-    fprintf(file, "   -Q         query the lock\n");
-    fprintf(file, "   -p         Persistent lock\n");
-    fprintf(file, "   -e         Expedite conversion\n");
-    fprintf(file, "   -q         Quiet\n");
-    fprintf(file, "   -u         Don't unlock explicitly\n");
-    fprintf(file, "   -d <secs>  Time to hold the lock for\n");
-    fprintf(file, "\n");
-
-}
-
-#ifdef QUERY
-static void query_ast_routine(void *arg)
-{
-    struct dlm_lksb *lksb = arg;
-    struct dlm_queryinfo *qi = (struct dlm_queryinfo *)lksb->sb_lvbptr;
-    int i;
-
-    qi->gqi_resinfo->rsi_name[qi->gqi_resinfo->rsi_length] = '\0';
-    /* Dump resource info */
-    printf("lockinfo: status     = %d\n", lksb->sb_status);
-    printf("lockinfo: resource   = '%s'\n", qi->gqi_resinfo->rsi_name);
-    printf("lockinfo: grantcount = %d\n", qi->gqi_resinfo->rsi_grantcount);
-    printf("lockinfo: convcount  = %d\n", qi->gqi_resinfo->rsi_convcount);
-    printf("lockinfo: waitcount  = %d\n", qi->gqi_resinfo->rsi_waitcount);
-    printf("lockinfo: masternode = %d\n", qi->gqi_resinfo->rsi_masternode);
-
-    /* Dump all the locks */
-    for (i = 0; i < qi->gqi_lockcount; i++)
-    {
-	struct dlm_lockinfo *li = &qi->gqi_lockinfo[i];
-
-	printf("lockinfo: lock: lkid        = %x\n", li->lki_lkid);
-	printf("lockinfo: lock: master lkid = %x\n", li->lki_mstlkid);
-	printf("lockinfo: lock: parent lkid = %x\n", li->lki_parent);
-	printf("lockinfo: lock: node        = %d\n", li->lki_node);
-	printf("lockinfo: lock: pid         = %d\n", li->lki_ownpid);
-	printf("lockinfo: lock: state       = %d\n", li->lki_state);
-	printf("lockinfo: lock: grmode      = %d\n", li->lki_grmode);
-	printf("lockinfo: lock: rqmode      = %d\n", li->lki_rqmode);
-	printf("\n");
-    }
-
-    if (qi->gqi_lockinfo)
-	free(qi->gqi_lockinfo);
-}
-
-static struct dlm_queryinfo qinfo;
-static struct dlm_resinfo resinfo;
-#define MAX_QUERY_LOCKS 10
-
-
-static int query_lock(int lockid)
-{
-    int status;
-struct dlm_lksb tmplksb;
-    lksb.sb_lkid = lockid;
-    qinfo.gqi_resinfo = &resinfo;
-    qinfo.gqi_lockinfo = malloc(sizeof(struct dlm_lockinfo) * MAX_QUERY_LOCKS);
-    qinfo.gqi_locksize = MAX_QUERY_LOCKS;
-    lksb.sb_lvbptr = (char *)&qinfo;
-
-    status = dlm_query(&tmplksb,
-		       DLM_QUERY_QUEUE_ALL | DLM_QUERY_LOCKS_ALL,
-		       &qinfo,
-		       query_ast_routine,
-		       &tmplksb);
-    if (status)
-	perror("Query failed");
-    else
-	sleep(1); /* Just to allow the result to come back. There isn't
-		     a synchronous version of this call */
-    return status;
-}
-#endif
-
-
-int main(int argc, char *argv[])
-{
-    char *resource = "LOCK-NAME";
-    int  flags = 0;
-    int  status;
-    int  delay = 5;
-    int  mode = LKM_EXMODE;
-    int  convmode = -1;
-    int  lockid;
-    int  quiet = 0;
-    int  do_unlock = 1;
-    int  do_query = 0;
-    int  do_expedite = 0;
-    signed char opt;
-    int i;
-
-    /* Deal with command-line arguments */
-    opterr = 0;
-    optind = 0;
-    while ((opt=getopt(argc,argv,"?m:nquQepd:c:vV")) != EOF)
-    {
-	switch(opt)
-	{
-	case 'h':
-	    usage(argv[0], stdout);
-	    exit(0);
-
-	case '?':
-	    usage(argv[0], stderr);
-	    exit(0);
-
-	case 'm':
-	    mode = modetonum(optarg);
-	    break;
-
-	case 'c':
-	    convmode = modetonum(optarg);
-	    break;
-
-        case 'e':
-            do_expedite = 1;
-            break;
-
-        case 'p':
-            flags |= LKF_PERSISTENT;
-            break;
-
-	case 'n':
-	    flags |= LKF_NOQUEUE;
-	    break;
-
-	case 'd':
-	    delay = atoi(optarg);
-	    break;
-
-        case 'q':
-            quiet = 1;
-            break;
-
-        case 'u':
-            do_unlock = 0;
-            break;
-
-	case 'Q':
-	    do_query = 1;
-	    break;
-
-	case 'V':
-	    printf("\ndlmtest version 0.3\n\n");
-	    exit(1);
-	    break;
-	}
-    }
-
-    if (argv[optind])
-	resource = argv[optind];
-
-    if (!quiet)
-    fprintf(stderr, "locking %s %s %s...", resource,
-	    numtomode(mode),
-	    (flags&LKF_NOQUEUE?"(NOQUEUE)":""));
-
-    fflush(stderr);
-
-    status = lock_resource(resource, mode, flags, &lockid);
-    if (status == -1)
-    {
-	if (!quiet) fprintf(stderr, "\n");
-	perror("lock");
-
-	return -1;
-    }
-    if (lockid == 0)
-    {
-	fprintf(stderr, "error: got lockid of zero\n");
-	return 0;
-    }
-
-    if (!quiet) fprintf(stderr, "done (lkid = %x)\n", lockid);
-
-    if (!do_unlock) return 0;
-
-#ifdef QUERY
-    if (do_query) query_lock(lockid);
-#endif
-
-    sleep(delay);
-
-    if (convmode != -1)
-    {
-        if (do_expedite)
-		flags |= LKF_EXPEDITE;
-
-	if (!quiet)
-	{
-	    fprintf(stderr, "converting %s to %s...", resource, numtomode(convmode));
-	    fflush(stderr);
-	}
-
-	status = lock_resource(resource, convmode, flags | LKF_CONVERT, &lockid);
-	if (status == -1)
-	{
-	    if (!quiet) fprintf(stderr, "\n");
-	    perror("convert");
-	    return -1;
-	}
-	if (!quiet) fprintf(stderr, "done\n");
-    }
-
-    sleep(delay);
-
-    if (!quiet)
-    {
-        fprintf(stderr, "unlocking %s...", resource);
-        fflush(stderr);
-    }
-
-    status = unlock_resource(lockid);
-    if (status == -1)
-    {
-	if (!quiet) fprintf(stderr, "\n");
-	perror("unlock");
-	return -1;
-    }
-
-    if (!quiet) fprintf(stderr, "done\n");
-
-    /* For some reason, calling this IMMEDIATELY before
-       exitting, causes a thread hang. either don't call it at
-       all or do something in afterwards before calling exit
-    */
-    dlm_pthread_cleanup();
-    return 0;
-}
-
diff --git a/dlm/tests/usertest/dlmtest2.c b/dlm/tests/usertest/dlmtest2.c
deleted file mode 100644
index da63b93..0000000
--- a/dlm/tests/usertest/dlmtest2.c
+++ /dev/null
@@ -1,1468 +0,0 @@
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <stddef.h>
-#include <string.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <time.h>
-#include <signal.h>
-#include <syslog.h>
-#include <sys/time.h>
-#include <asm/types.h>
-#include <sys/socket.h>
-#include <sys/poll.h>
-#include <sys/un.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/errno.h>
-
-#include "libdlm.h"
-
-#define MAX_CLIENTS 4
-#define MAX_LOCKS 16
-#define MAX_RESOURCES 16
-
-static dlm_lshandle_t *dh;
-static int libdlm_fd;
-static int timewarn = 0;
-static uint64_t timeout = 0;
-static int noqueue = 1;
-static int persistent = 0;
-static int ignore_bast = 0;
-static int quiet = 1;
-static int verbose = 0;
-static int bast_cb;
-static int maxn = MAX_LOCKS;
-static int maxr = MAX_RESOURCES;
-static int iterations;
-static int minhold = 0;
-static int stress_stop = 0;
-static int stress_delay = 0;
-static int stress_lock_only = 0;
-static int openclose_ls = 0;
-static uint64_t our_xid;
-static char cmd[32];
-static int opt_cmd = 0;
-
-static unsigned int sts_eunlock, sts_ecancel, sts_etimedout, sts_edeadlk, sts_eagain, sts_other, sts_zero;
-static unsigned int bast_unlock, bast_skip;
-
-
-#define log_print(fmt, args...) \
-do { \
-	if (!quiet) \
-		printf(fmt , ##args); \
-} while (0)
-
-#define log_op(fmt, args...) \
-do { \
-	if (!quiet) \
-		printf(fmt , ##args); \
-} while (0)
-
-#define log_ast(fmt, args...) \
-do { \
-	if (verbose) \
-		printf(fmt , ##args); \
-} while (0)
-
-#define log_bast(fmt, args...) \
-do { \
-	if (verbose > 1) \
-		printf(fmt , ##args); \
-} while (0)
-
-#define log_verbose(fmt, args...) \
-do { \
-	if (verbose > 2) \
-		printf(fmt , ##args); \
-} while (0)
-
-struct client {
-	int fd;
-	char type[32];
-};
-
-static int client_size = MAX_CLIENTS;
-static struct client client[MAX_CLIENTS];
-static struct pollfd pollfd[MAX_CLIENTS];
-
-enum {
-	Op_lock = 1,
-	Op_unlock,
-	Op_unlockf,
-	Op_cancel,
-};
-
-struct lk {
-	int id;
-	int rqmode;
-	int grmode;
-	int wait_ast;
-	int lastop;
-	int last_status;
-	int bast;
-	int minhold;
-	struct dlm_lksb lksb;
-	struct timeval begin;
-	struct timeval acquired;
-};
-
-struct lk *locks;
-
-static void unlock(int i);
-static void unlockf(int i);
-
-
-static int rand_int(int a, int b)
-{
-	return a + (int) (((float)(b - a + 1)) * random() / (RAND_MAX+1.0)); 
-}
-
-static char *status_str(int status)
-{
-	static char sts_str[8];
-
-	switch (status) {
-	case 0:
-		return "0      ";
-	case EUNLOCK:
-		return "EUNLOCK";
-	case ECANCEL:
-		return "ECANCEL";
-	case EAGAIN:
-		return "EAGAIN ";
-	case EBUSY:
-		return "EBUSY  ";
-	case ETIMEDOUT:
-		return "ETIMEDO";
-	case EDEADLK:
-		return "EDEADLK";
-	default:
-		snprintf(sts_str, 8, "%8x", status);
-		return sts_str;
-	}
-}
-
-static char *op_str(int op)
-{
-	switch (op) {
-	case Op_lock:
-		return "lock";
-	case Op_unlock:
-		return "unlock";
-	case Op_unlockf:
-		return "unlockf";
-	case Op_cancel:
-		return "cancel";
-	default:
-		return "unknown";
-	}
-}
-
-static struct lk *get_lock(int i)
-{
-	if (i < 0)
-		return NULL;
-	if (i >= maxn)
-		return NULL;
-	return &locks[i];
-}
-
-static int all_unlocks_done(void)
-{
-	struct lk *lk;
-	int i;
-
-	for (i = 0; i < maxn; i++) {
-		lk = get_lock(i);
-		if (lk->grmode == -1 && !lk->wait_ast)
-			continue;
-		return 0;
-	}
-	return 1;
-}
-
-static void dump(void)
-{
-	struct timeval now;
-	struct lk *lk;
-	int i;
-
-	gettimeofday(&now, NULL);
-
-	for (i = 0; i < maxn; i++) {
-		lk = get_lock(i);
-		printf("x %2d lkid %08x gr %2d rq %2d wait_ast %d last op %s  \t%s  %us\n",
-			i,
-			lk->lksb.sb_lkid,
-			lk->grmode,
-			lk->rqmode,
-			lk->wait_ast,
-			op_str(lk->lastop),
-			status_str(lk->last_status),
-			lk->wait_ast ? (unsigned int)(now.tv_sec - lk->begin.tv_sec) : 0);
-	}
-}
-
-static void bastfn(void *arg)
-{
-	struct lk *lk = arg;
-	lk->bast = 1;
-	bast_cb = 1;
-}
-
-static void do_bast(struct lk *lk)
-{
-	int skip = 0;
-
-	if (lk->lastop == Op_unlock || lk->lastop == Op_unlockf) {
-		skip = 1;
-	}
-	if (!lk->lksb.sb_lkid) {
-		skip = 1;
-	}
-
-	if (skip) {
-		bast_skip++;
-		log_bast("    bast: skip    %3d\t%x\n", lk->id, lk->lksb.sb_lkid);
-	} else {
-		bast_unlock++;
-		log_bast("    bast: unlockf %3d\t%x\n", lk->id, lk->lksb.sb_lkid);
-		unlockf(lk->id);
-	}
-	lk->bast = 0;
-}
-
-static void do_bast_unlocks(void)
-{
-	struct lk *lk;
-	int i;
-
-	for (i = 0; i < maxn; i++) {
-		lk = get_lock(i);
-		if (lk->bast)
-			do_bast(lk);
-	}
-	bast_cb = 0;
-}
-
-static void process_libdlm(void)
-{
-	dlm_dispatch(libdlm_fd);
-	if (bast_cb && !ignore_bast)
-		do_bast_unlocks();
-}
-
-static void astfn(void *arg)
-{
-	struct lk *lk = arg;
-	int i = lk->id;
-
-	if (!lk->wait_ast) {
-		printf("     ast: %s %3d\t%x: !wait_ast gr %d rq %d last op %s %s\n",
-		       status_str(lk->lksb.sb_status), i, lk->lksb.sb_lkid,
-		       lk->grmode, lk->rqmode,
-		       op_str(lk->lastop), status_str(lk->last_status));
-	}
-
-	log_ast("     ast: %s %3d\t%x\n",
-		status_str(lk->lksb.sb_status), i, lk->lksb.sb_lkid);
-
-	lk->last_status = lk->lksb.sb_status;
-
-	if (lk->lksb.sb_status == EUNLOCK) {
-		sts_eunlock++;
-		memset(&lk->lksb, 0, sizeof(struct dlm_lksb));
-		lk->grmode = -1;
-		lk->wait_ast = 0;
-
-	} else if (lk->lksb.sb_status == ECANCEL) {
-		sts_ecancel++;
-		if (lk->grmode == -1) {
-			memset(&lk->lksb, 0, sizeof(struct dlm_lksb));
-			lk->wait_ast = 0;
-		} else {
-			if (lk->lastop != Op_unlock && lk->lastop != Op_unlockf)
-				lk->wait_ast = 0;
-		}
-
-	} else if (lk->lksb.sb_status == ETIMEDOUT) {
-		sts_etimedout++;
-		if (lk->grmode == -1) {
-			memset(&lk->lksb, 0, sizeof(struct dlm_lksb));
-			lk->wait_ast = 0;
-		} else {
-			if (lk->lastop != Op_unlock && lk->lastop != Op_unlockf)
-				lk->wait_ast = 0;
-		}
-
-	} else if (lk->lksb.sb_status == EDEADLK) {
-		sts_edeadlk++;
-		if (lk->grmode == -1) {
-			memset(&lk->lksb, 0, sizeof(struct dlm_lksb));
-			lk->wait_ast = 0;
-		} else {
-			if (lk->lastop != Op_unlock && lk->lastop != Op_unlockf)
-				lk->wait_ast = 0;
-		}
-
-	} else if (lk->lksb.sb_status == EAGAIN) {
-		sts_eagain++;
-		if (lk->grmode == -1) {
-			memset(&lk->lksb, 0, sizeof(struct dlm_lksb));
-			lk->wait_ast = 0;
-		} else {
-			if (lk->lastop != Op_unlockf)
-				lk->wait_ast = 0;
-		}
-
-	} else {
-		if (lk->lksb.sb_status != 0) {
-			sts_other++;
-			printf("BAD  ast: %d %3d\t%x: gr %d rq %d last op %s %s\n",
-		       		lk->lksb.sb_status, i, lk->lksb.sb_lkid,
-				lk->grmode, lk->rqmode, op_str(lk->lastop),
-				status_str(lk->last_status));
-			stress_stop = 1;
-			return;
-		}
-
-		sts_zero++;
-
-		if (lk->lastop != Op_unlockf)
-			lk->wait_ast = 0;
-
-		lk->grmode = lk->rqmode;
-
-		if (minhold) {
-			gettimeofday(&lk->acquired, NULL);
-			lk->minhold = minhold;
-		}
-	}
-
-	lk->rqmode = -1;
-}
-
-/* EBUSY from dlm_ls_lockx() is expected sometimes, e.g. lock, cancel, lock;
-   the first lock is successful and the app gets the status back,
-   and issues the second lock before the reply for the overlapping
-   cancel (which did nothing) has been received in the dlm. */
-
-static void lock(int i, int mode)
-{
-	char name[DLM_RESNAME_MAXLEN];
-	struct lk *lk;
-	int flags = 0;
-	int rv;
-	uint64_t *timeout_arg = NULL;
-
-	lk = get_lock(i);
-	if (!lk)
-		return;
-
-	if (noqueue)
-		flags |= LKF_NOQUEUE;
-	if (persistent)
-		flags |= LKF_PERSISTENT;
-	if (timeout) {
-		flags |= LKF_TIMEOUT;
-		timeout_arg = &timeout;
-	}
-
-	if (lk->lksb.sb_lkid)
-		flags |= LKF_CONVERT;
-
-	memset(name, 0, sizeof(name));
-	snprintf(name, sizeof(name), "test%d", (i % maxr));
-
-	log_verbose("lock: %d grmode %d rqmode %d flags %x lkid %x %s\n",
-	            i, lk->grmode, mode, flags, lk->lksb.sb_lkid, name);
-
-#if 0
-	rv = dlm_ls_lock(dh, mode, &lk->lksb, flags, name, strlen(name), 0,
-			  astfn, (void *) lk, bastfn, NULL);
-#else
-	rv = dlm_ls_lockx(dh, mode, &lk->lksb, flags, name, strlen(name), 0,
-			  astfn, (void *) lk, bastfn, &our_xid, timeout_arg);
-#endif
-	if (!rv) {
-		lk->wait_ast = 1;
-		lk->rqmode = mode;
-		gettimeofday(&lk->begin, NULL);
-	} else if (rv == -1 && errno == EBUSY) {
-		printf("        : lock    %3d\t%x: EBUSY gr %d rq %d wait_ast %d\n",
-			i, lk->lksb.sb_lkid, lk->grmode, lk->rqmode, lk->wait_ast);
-	} else {
-		printf("        : lock    %3d\t%x: errno %d rv %d gr %d rq %d wait_ast %d\n",
-			i, lk->lksb.sb_lkid, errno, rv, lk->grmode, lk->rqmode, lk->wait_ast);
-		stress_stop = 1;
-	}
-
-	log_verbose("lock: %d rv %d sb_lkid %x sb_status %x\n",
-	            i, rv, lk->lksb.sb_lkid, lk->lksb.sb_status);
-
-	lk->lastop = Op_lock;
-}
-
-static void lock_sync(int i, int mode)
-{
-	char name[DLM_RESNAME_MAXLEN];
-	int flags = 0;
-	int rv;
-	struct lk *lk;
-
-	lk = get_lock(i);
-	if (!lk)
-		return;
-
-	if (noqueue)
-		flags |= LKF_NOQUEUE;
-	if (persistent)
-		flags |= LKF_PERSISTENT;
-
-	if (lk->lksb.sb_lkid)
-		flags |= LKF_CONVERT;
-
-	memset(name, 0, sizeof(name));
-	snprintf(name, sizeof(name), "test%d", (i % maxr));
-
-	log_verbose("lock_sync: %d rqmode %d flags %x lkid %x %s\n",
-	            i, mode, flags, lk->lksb.sb_lkid, name);
-
-	rv = dlm_ls_lock_wait(dh, mode, &lk->lksb, flags,
-			 name, strlen(name), 0, (void *) lk,
-			 bastfn, NULL);
-
-	log_verbose("lock_sync: %d rv %d sb_lkid %x sb_status %x\n",
-	            i, rv, lk->lksb.sb_lkid, lk->lksb.sb_status);
-
-	if (!rv) {
-		lk->grmode = mode;
-		lk->rqmode = -1;
-	} else if (rv == EAGAIN) {
-		if (lk->grmode == -1)
-			memset(&lk->lksb, 0, sizeof(struct dlm_lksb));
-	} else {
-		printf("unknown rv %d\n", rv);
-		exit(-1);
-	}
-}
-
-static void lock_all(int mode)
-{
-	int i;
-
-	for (i = 0; i < maxn; i++)
-		lock(i, mode);
-}
-
-static char *uflags(uint32_t flags)
-{
-	if (flags == LKF_FORCEUNLOCK)
-		return "FORCEUNLOCK";
-	if (flags == LKF_CANCEL)
-		return "CANCEL";
-	return "0";
-}
-
-/* ENOENT is expected from dlm_ls_unlock() sometimes because we'll
-   try to do an unlockf during an outstanding op that will free
-   the lock itself */
-
-static void _unlock(int i, uint32_t flags)
-{
-	struct lk *lk;
-	uint32_t lkid;
-	int rv;
-
-	lk = get_lock(i);
-	if (!lk)
-		return;
-
-	lkid = lk->lksb.sb_lkid;
-	if (!lkid)
-		return;
-
-	log_verbose("unlock: %d lkid %x flags %x\n", i, lkid, flags);
-
-	rv = dlm_ls_unlock(dh, lkid, flags, &lk->lksb, lk);
-	if (!rv) {
-		lk->wait_ast = 1;
-		gettimeofday(&lk->begin, NULL);
-	} else if (rv == -1 && errno == EBUSY) {
-		printf("        : unlock  %3d\t%x: EBUSY flags %s gr %d rq %d wait_ast %d\n",
-			i, lk->lksb.sb_lkid, uflags(flags), lk->grmode, lk->rqmode, lk->wait_ast);
-	} else if (rv == -1 && errno == ENOENT) {
-		printf("        : unlock  %3d\t%x: ENOENT flags %s gr %d rq %d wait_ast %d\n",
-			i, lk->lksb.sb_lkid, uflags(flags), lk->grmode, lk->rqmode, lk->wait_ast);
-	} else {
-		printf("        : unlock  %3d\t%x: errno %d flags %s rv %d gr %d rq %d wait_ast %d\n",
-			i, lk->lksb.sb_lkid, errno, uflags(flags), rv, lk->grmode, lk->rqmode, lk->wait_ast);
-	}
-}
-
-static void unlock(int i)
-{
-	struct lk *lk = get_lock(i);
-
-	if (minhold) {
-		struct timeval now;
-
-		if (lk->wait_ast)
-			return;
-
-		gettimeofday(&now, NULL);
-		if (lk->acquired.tv_sec + lk->minhold > now.tv_sec) {
-			printf("        : unlock  %3d\t%x: gr %d rq %d held %u of %u s\n",
-				i, lk->lksb.sb_lkid, lk->grmode, lk->rqmode,
-				(unsigned int)(now.tv_sec - lk->acquired.tv_sec), lk->minhold);
-			return;
-		}
-	}
-
-	_unlock(i, 0);
-	lk->rqmode = -1;
-	lk->lastop = Op_unlock;
-}
-
-static void unlockf(int i)
-{
-	struct lk *lk = get_lock(i);
-
-	if (minhold) {
-		struct timeval now;
-
-		if (lk->wait_ast)
-			return;
-
-		gettimeofday(&now, NULL);
-		if (lk->acquired.tv_sec + lk->minhold > now.tv_sec) {
-			printf("        : unlockf %3d\t%x: gr %d rq %d held %u of %u s\n",
-				i, lk->lksb.sb_lkid, lk->grmode, lk->rqmode,
-				(unsigned int)(now.tv_sec - lk->acquired.tv_sec), lk->minhold);
-			return;
-		}
-	}
-
-	_unlock(i, LKF_FORCEUNLOCK);
-	lk->rqmode = -1;
-	lk->lastop = Op_unlockf;
-}
-
-static void cancel(int i)
-{
-	struct lk *lk = get_lock(i);
-	_unlock(i, LKF_CANCEL);
-	lk->lastop = Op_cancel;
-}
-
-static void canceld(int i, uint32_t lkid)
-{
-	int rv;
-
-	rv = dlm_ls_deadlock_cancel(dh, lkid, 0);
-
-	printf("canceld %x: %d %d\n", lkid, rv, errno);
-}
-
-static void unlock_sync(int i)
-{
-	uint32_t lkid;
-	int rv;
-	struct lk *lk;
-
-	lk = get_lock(i);
-	if (!lk)
-		return;
-
-	lkid = lk->lksb.sb_lkid;
-	if (!lkid) {
-		log_print("unlock %d skip zero lkid\n", i);
-		return;
-	}
-
-	log_verbose("unlock_sync: %d lkid %x\n", i, lkid);
-
-	rv = dlm_ls_unlock_wait(dh, lkid, 0, &lk->lksb);
-
-	log_verbose("unlock_sync: %d rv %d sb_status %x\n", i, rv,
-	            lk->lksb.sb_status);
-
-	memset(&lk->lksb, 0, sizeof(struct dlm_lksb));
-	lk->grmode = -1;
-	lk->rqmode = -1;
-}
-
-static void unlock_all(void)
-{
-	struct lk *lk;
-	int i;
-
-	for (i = 0; i < maxn; i++) {
-		lk = get_lock(i);
-		unlock(i);
-	}
-}
-
-static void purge(int nodeid, int pid)
-{
-	struct lk *lk;
-	int i, rv;
-
-	rv = dlm_ls_purge(dh, nodeid, pid);
-	if (rv) {
-		printf("dlm_ls_purge %d %d error %d\n", nodeid, pid, rv);
-		return;
-	}
-
-	for (i = 0; i < maxn; i++) {
-		lk = get_lock(i);
-		memset(&lk->lksb, 0, sizeof(struct dlm_lksb));
-		lk->grmode = -1;
-		lk->wait_ast = 0;
-	}
-}
-
-static void purgetest(int nodeid, int pid)
-{
-	struct lk *lk;
-	int i, mid = maxn / 2;
-
-	printf("lock %d to %d\n", 0, mid-1);
-	for (i = 0; i < mid; i++)
-		lock(i, 3);
-
-	while (1) {
-		process_libdlm();
-		for (i = 0; i < mid; i++) {
-			lk = get_lock(i);
-			if (!lk->wait_ast)
-				continue;
-			break;
-		}
-		if (i == mid)
-			break;
-	}
-
-	for (i = mid; i < maxn; i++)
-		lock(i, 3);
-	for (i = 0; i < mid; i++)
-		unlock(i);
-	/* usleep(10000); */
-	purge(nodeid, pid);
-}
-
-static void tstress_unlocks(void)
-{
-	struct lk *lk;
-	struct timeval now;
-	int i;
-
-	for (i = 0; i < maxn; i++) {
-		lk = get_lock(i);
-		if (!lk)
-			continue;
-		if (lk->wait_ast)
-			continue;
-		if (lk->grmode < 0)
-			continue;
-
-		/* if we've held the lock for minhold seconds, then unlock */
-
-		gettimeofday(&now, NULL);
-
-		if (now.tv_sec >= lk->acquired.tv_sec + minhold) {
-			printf("        : unlock  %3d\t%x: gr %d rq %d held %u of %u s\n",
-				i, lk->lksb.sb_lkid, lk->grmode, lk->rqmode,
-				(unsigned int)(now.tv_sec - lk->acquired.tv_sec), minhold);
-
-			_unlock(i, 0);
-			lk->rqmode = -1;
-			lk->lastop = Op_unlock;
-		}
-
-	}
-}
-
-static void tstress(int num)
-{
-	unsigned int n, skips, lock_ops, unlock_ops, unlockf_ops, cancel_ops;
-	int i;
-	struct lk *lk;
-
-	n = skips = lock_ops = unlock_ops = unlockf_ops = cancel_ops = 0;
-	sts_eunlock = sts_ecancel = sts_etimedout = sts_edeadlk = sts_eagain = sts_other = sts_zero = 0;
-	bast_unlock = bast_skip = 0;
-
-	noqueue = 0;
-	ignore_bast = 1;
-	quiet = 0;
-
-	if (!timeout)
-		timeout = 4;
-	if (!minhold)
-		minhold = 5;
-
-	while (!stress_stop) {
-		if (stress_delay)
-			usleep(stress_delay);
-
-		process_libdlm();
-
-		tstress_unlocks();
-
-		if (++n == num) {
-			if (all_unlocks_done())
-				break;
-			else
-				continue;
-		}
-
-		i = rand_int(0, maxn-1);
-		lk = get_lock(i);
-		if (!lk)
-			continue;
-
-		if (lk->wait_ast || lk->grmode > -1)
-			continue;
-
-		lock(i, rand_int(0, 5));
-		lock_ops++;
-		printf("%8x: lock    %3d\t%x\n", n, i, lk->lksb.sb_lkid);
-	}
-
-	printf("ops: skip %d lock %d unlock %d unlockf %d cancel %d\n",
-		skips, lock_ops, unlock_ops, unlockf_ops, cancel_ops);
-	printf("bast: unlock %u skip %u\n", bast_unlock, bast_skip);
-	printf("ast status: eunlock %d ecancel %d etimedout %d edeadlk %d eagain %d\n",
-		sts_eunlock, sts_ecancel, sts_etimedout, sts_edeadlk, sts_eagain);
-	printf("ast status: zero %d other %d\n", sts_zero, sts_other);
-}
-
-static void dstress(int num)
-{
-	unsigned int n, skips, lock_ops, unlock_ops, unlockf_ops, cancel_ops;
-	int i;
-	struct lk *lk;
-
-	n = skips = lock_ops = unlock_ops = unlockf_ops = cancel_ops = 0;
-	sts_eunlock = sts_ecancel = sts_etimedout = sts_edeadlk = sts_eagain = sts_other = sts_zero = 0;
-	bast_unlock = bast_skip = 0;
-
-	noqueue = 0;
-	ignore_bast = 1;
-	quiet = 0;
-
-	while (!stress_stop && n < num) {
-
-		sleep(1);
-
-		process_libdlm();
-
-		if (n && !(n % 60))
-			unlock_all();
-		n++;
-
-		i = rand_int(0, maxn-1);
-		lk = get_lock(i);
-		if (!lk)
-			continue;
-
-		if (lk->wait_ast || lk->grmode > -1) {
-			printf("%8x: lock    %3d\t%x: skip gr %d wait_ast %d\n",
-				n, i, lk->lksb.sb_lkid, lk->grmode, lk->wait_ast);
-			continue;
-		}
-
-		lock(i, rand_int(0, 5));
-		lock_ops++;
-		printf("%8x: lock    %3d\t%x\n", n, i, lk->lksb.sb_lkid);
-	}
-
-	printf("ops: skip %d lock %d unlock %d unlockf %d cancel %d\n",
-		skips, lock_ops, unlock_ops, unlockf_ops, cancel_ops);
-	printf("bast: unlock %u skip %u\n", bast_unlock, bast_skip);
-	printf("ast status: eunlock %d ecancel %d etimedout %d edeadlk %d eagain %d\n",
-		sts_eunlock, sts_ecancel, sts_etimedout, sts_edeadlk, sts_eagain);
-	printf("ast status: zero %d other %d\n", sts_zero, sts_other);
-}
-
-static void stress(int num)
-{
-	int i, o, op, max_op, skip;
-	unsigned int n, skips, lock_ops, unlock_ops, unlockf_ops, cancel_ops;
-	struct lk *lk;
-
-	n = skips = lock_ops = unlock_ops = unlockf_ops = cancel_ops = 0;
-	sts_eunlock = sts_ecancel = sts_etimedout = sts_edeadlk = sts_eagain = sts_other = sts_zero = 0;
-	bast_unlock = bast_skip = 0;
-
-	while (!stress_stop) {
-		if (stress_delay)
-			usleep(stress_delay);
-
-		process_libdlm();
-
-		if (++n == num)
-			break;
-
-		i = rand_int(0, maxn-1);
-		lk = get_lock(i);
-		if (!lk)
-			continue;
-
-		max_op = 5;
-		if (stress_lock_only)
-			max_op = 2;
-
-		o = rand_int(0, max_op);
-		switch (o) {
-		case 0:
-		case 1:
-		case 2:
-			op = Op_lock;
-			break;
-		case 3:
-			op = Op_unlock;
-			break;
-		case 4:
-			op = Op_unlockf;
-			break;
-		case 5:
-			op = Op_cancel;
-			break;
-		default:
-			op = 0;
-		}
-
-		skip = 0;
-
-		switch (op) {
-		case Op_lock:
-			if (lk->wait_ast) {
-				skip = 1;
-				break;
-			}
-
-			noqueue = !!o;
-			our_xid = n;
-
-			lock(i, rand_int(0, 5));
-			lock_ops++;
-			log_op("%8x: lock    %3d\t%x\n", n, i, lk->lksb.sb_lkid);
-			break;
-
-		case Op_unlock:
-			if (lk->wait_ast) {
-				skip = 1;
-				break;
-			}
-			if (lk->lastop == Op_unlock || lk->lastop == Op_unlockf) {
-				skip = 1;
-				break;
-			}
-			if (!lk->lksb.sb_lkid) {
-				skip = 1;
-				break;
-			}
-
-			unlock(i);
-			unlock_ops++;
-			log_op("%8x: unlock  %3d\t%x\n", n, i, lk->lksb.sb_lkid);
-			break;
-
-		case Op_unlockf:
-			if (lk->lastop == Op_unlock || lk->lastop == Op_unlockf) {
-				skip = 1;
-				break;
-			}
-			if (!lk->lksb.sb_lkid) {
-				skip = 1;
-				break;
-			}
-
-			unlockf(i);
-			unlockf_ops++;
-			log_op("%8x: unlockf %3d\t%x\n", n, i, lk->lksb.sb_lkid);
-			break;
-
-		case Op_cancel:
-			if (!lk->wait_ast) {
-				skip = 1;
-				break;
-			}
-			if (lk->lastop > Op_lock) {
-				skip = 1;
-				break;
-			}
-
-			cancel(i);
-			cancel_ops++;
-			log_op("%8x: cancel  %3d\t%x\n", n, i, lk->lksb.sb_lkid);
-			break;
-		}
-
-		if (skip)
-			skips++;
-	}
-
-	printf("ops: skip %d lock %d unlock %d unlockf %d cancel %d\n",
-		skips, lock_ops, unlock_ops, unlockf_ops, cancel_ops);
-	printf("bast: unlock %u skip %u\n", bast_unlock, bast_skip);
-	printf("ast status: eunlock %d ecancel %d etimedout %d edeadlk %d eagain %d\n",
-		sts_eunlock, sts_ecancel, sts_etimedout, sts_edeadlk, sts_eagain);
-	printf("ast status: zero %d other %d\n", sts_zero, sts_other);
-}
-
-static int client_add(int fd, int *maxi)
-{
-	int i;
-
-	for (i = 0; i < client_size; i++) {
-		if (client[i].fd == -1) {
-			client[i].fd = fd;
-			pollfd[i].fd = fd;
-			pollfd[i].events = POLLIN;
-			if (i > *maxi)
-				*maxi = i;
-			printf("client %d fd %d added\n", i, fd);
-			return i;
-		}
-	}
-	printf("client add failed\n");
-	return -1;
-}
-
-static void client_dead(int ci)
-{
-	printf("client %d fd %d dead\n", ci, client[ci].fd);
-	close(client[ci].fd);
-	client[ci].fd = -1;
-	pollfd[ci].fd = -1;
-}
-
-static void client_init(void)
-{
-	int i;
-
-	for (i = 0; i < client_size; i++)
-		client[i].fd = -1;
-}
-
-static void print_commands(void)
-{
-	printf("Usage:\n");
-	printf("max locks (maxn) is %d (x of 0 to %d)\n", maxn, maxn-1);
-	printf("max resources (maxr) is %d, lock x used on resource (x %% maxr)\n", maxr);
-	printf("EXIT		 - exit program after unlocking any held locks\n");
-	printf("kill		 - exit program without unlocking any locks\n");
-	printf("lock x mode	 - request/convert lock x\n");
-	printf("unlock x 	 - unlock lock x\n");
-	printf("unlockf x 	 - force unlock lock x\n");
-	printf("cancel x 	 - cancel lock x\n");
-	printf("canceld x lkid	 - cancel lock x, return EDEADLK as status\n");
-	printf("lock_sync x mode - synchronous version of lock\n");
-	printf("unlock_sync x 	 - synchronous version of unlock\n");
-	printf("ex x		 - equivalent to: lock x 5\n");
-	printf("pr x		 - equivalent to: lock x 3\n");
-	printf("hold		 - for x in 0 to max, lock x 3\n");
-	printf("release		 - for x in 0 to max, unlock x\n");
-	printf("purge nodeid pid - purge orphan locks of process\n");
-	printf("stress n	 - loop doing random lock/unlock/unlockf/cancel on all locks, n times\n");
-	printf("tstress n	 - stress timeouts\n");
-	printf("dstress n	 - stress deadlock\n");
-	printf("timeout n	 - enable lock timeouts, set timeout to n seconds\n");
-	printf("dump		 - show info for all locks\n");
-	printf("minhold		 - set minimum number of seconds locks will be held\n");
-	printf("ignore_bast	 - ignore all basts\n");
-	printf("noqueue		 - toggle NOQUEUE flag for all requests\n");
-	printf("persistent	 - toggle PERSISTENT flag for all requests\n");
-	printf("quiet		 - toggle quiet flag\n");
-	printf("verbose		 - toggle verbose flag\n");
-	printf("settings	 - show settings\n");
-
-	printf("\ncombined operations\n");
-	printf("hold-kill                     - hold; kill\n");
-	printf("release-kill                  - release; kill\n");
-	printf("lock-kill x mode              - lock; kill\n");
-	printf("unlock-kill x                 - unlock; kill\n");
-	printf("lock-cancel x mode msec       - lock; sleep; cancel\n");
-	printf("lock-unlockf x mode msec      - lock; sleep; unlockf\n");
-	printf("lock-cancel-kill x mode msec  - lock; sleep; cancel; kill\n");
-	printf("lock-unlockf-kill x mode msec - lock; sleep; unlockf; kill\n");
-	printf("purgetest nodeid pid\n");
-}
-
-static void print_settings(void)
-{
-	printf("timewarn %d\n", timewarn);
-	printf("timeout %llu\n", (unsigned long long) timeout);
-	printf("noqueue %d\n", noqueue);
-	printf("persistent %d\n", persistent);
-	printf("ignore_bast %d\n", ignore_bast);
-	printf("quiet %d\n", quiet);
-	printf("verbose %d\n", verbose);
-	printf("maxn %d\n", maxn);
-	printf("maxr %d\n", maxr);
-	printf("iterations %d\n", iterations);
-	printf("minhold %d\n", minhold);
-	printf("stress_stop %d\n", stress_stop);
-	printf("stress_delay %d\n", stress_delay);
-	printf("stress_lock_only %d\n", stress_lock_only);
-	printf("our_xid %llx\n", (unsigned long long)our_xid);
-}
-
-static void process_command(int *quit)
-{
-	char inbuf[132];
-	int x = 0, y = 0;
-
-	if (!opt_cmd) {
-		fgets(inbuf, sizeof(inbuf), stdin);
-		sscanf(inbuf, "%s %d %d", cmd, &x, &y);
-	}
-
-	if (!strncmp(cmd, "EXIT", 4)) {
-		*quit = 1;
-		unlock_all();
-		return;
-	}
-
-	if (!strncmp(cmd, "CLOSE", 5)) {
-		*quit = 1;
-		openclose_ls = 1;
-		unlock_all();
-		return;
-	}
-
-	if (!strncmp(cmd, "kill", 4)) {
-		printf("process exiting\n");
-		exit(0);
-	}
-
-	if (!strncmp(cmd, "lock", 4) && strlen(cmd) == 4) {
-		lock(x, y);
-		return;
-	}
-
-	if (!strncmp(cmd, "unlock", 6) && strlen(cmd) == 6) {
-		unlock(x);
-		return;
-	}
-
-	if (!strncmp(cmd, "unlockf", 7) && strlen(cmd) == 7) {
-		unlockf(x);
-		return;
-	}
-
-	if (!strncmp(cmd, "cancel", 6) && strlen(cmd) == 6) {
-		cancel(x);
-		return;
-	}
-
-	if (!strncmp(cmd, "canceld", 7) && strlen(cmd) == 7) {
-		canceld(x, y);
-		return;
-	}
-
-	if (!strncmp(cmd, "lock_sync", 9) && strlen(cmd) == 9) {
-		lock_sync(x, y);
-		return;
-	}
-
-	if (!strncmp(cmd, "unlock_sync", 11) && strlen(cmd) == 11) {
-		unlock_sync(x);
-		return;
-	}
-
-	if (!strncmp(cmd, "lock-kill", 9) && strlen(cmd) == 9) {
-		lock(x, y);
-		printf("process exiting\n");
-		exit(0);
-	}
-
-	if (!strncmp(cmd, "unlock-kill", 11) && strlen(cmd) == 11) {
-		unlock(x);
-		printf("process exiting\n");
-		exit(0);
-	}
-
-	if (!strncmp(cmd, "lock-cancel", 11) && strlen(cmd) == 11) {
-		lock(x, y);
-		/* usleep(1000 * z); */
-		cancel(x);
-		return;
-	}
-
-	if (!strncmp(cmd, "lock-unlockf", 12) && strlen(cmd) == 12) {
-		lock(x, y);
-		/* usleep(1000 * z); */
-		unlockf(x);
-		return;
-	}
-
-	if (!strncmp(cmd, "ex", 2)) {
-		lock(x, LKM_EXMODE);
-		return;
-	}
-
-	if (!strncmp(cmd, "pr", 2)) {
-		lock(x, LKM_PRMODE);
-		return;
-	}
-
-	if (!strncmp(cmd, "hold", 4) && strlen(cmd) == 4) {
-		lock_all(LKM_PRMODE);
-		return;
-	}
-
-	if (!strncmp(cmd, "hold-kill", 9) && strlen(cmd) == 9) {
-		lock_all(LKM_PRMODE);
-		exit(0);
-	}
-
-	if (!strncmp(cmd, "release", 7) && strlen(cmd) == 7) {
-		unlock_all();
-		return;
-	}
-
-	if (!strncmp(cmd, "release-kill", 12) && strlen(cmd) == 12) {
-		unlock_all();
-		exit(0);
-	}
-
-	if (!strncmp(cmd, "dump", 4) && strlen(cmd) == 4) {
-		dump();
-		return;
-	}
-
-	if (!strncmp(cmd, "stress", 6) && strlen(cmd) == 6) {
-		if (iterations && !x)
-			x = iterations;
-		stress(x);
-		return;
-	}
-
-	if (!strncmp(cmd, "tstress", 7) && strlen(cmd) == 7) {
-		tstress(x);
-		return;
-	}
-
-	if (!strncmp(cmd, "dstress", 7) && strlen(cmd) == 7) {
-		dstress(x);
-		return;
-	}
-
-	if (!strncmp(cmd, "stress_delay", 12) && strlen(cmd) == 12) {
-		stress_delay = x;
-		return;
-	}
-
-	if (!strncmp(cmd, "stress_lock_only", 16) && strlen(cmd) == 16) {
-		stress_lock_only = !stress_lock_only;
-		printf("stress_lock_only is %s\n", stress_lock_only ? "on" : "off");
-		return;
-	}
-
-	if (!strncmp(cmd, "stress_stop", 11) && strlen(cmd) == 11) {
-		stress_stop = !stress_stop;
-		printf("stress_stop is %d\n", stress_stop);
-		return;
-	}
-
-	if (!strncmp(cmd, "ignore_bast", 11) && strlen(cmd) == 11) {
-		ignore_bast = !ignore_bast;
-		printf("ignore_bast is %s\n", ignore_bast ? "on" : "off");
-		return;
-	}
-
-	if (!strncmp(cmd, "our_xid", 7) && strlen(cmd) == 7) {
-		our_xid = x;
-		printf("our_xid is %llx\n", (unsigned long long)our_xid);
-		return;
-	}
-
-
-	if (!strncmp(cmd, "purge", 5) && strlen(cmd) == 5) {
-		purge(x, y);
-		return;
-	}
-
-	if (!strncmp(cmd, "purgetest", 9) && strlen(cmd) == 9) {
-		purgetest(x, y);
-		return;
-	}
-
-	if (!strncmp(cmd, "noqueue", 7)) {
-		noqueue = !noqueue;
-		printf("noqueue is %s\n", noqueue ? "on" : "off");
-		return;
-	}
-
-	if (!strncmp(cmd, "persistent", 10)) {
-		persistent = !persistent;
-		printf("persistent is %s\n", persistent ? "on" : "off");
-		return;
-	}
-
-	if (!strncmp(cmd, "minhold", 7)) {
-		minhold = x;
-		return;
-	}
-
-	if (!strncmp(cmd, "timeout", 7)) {
-		timeout = (uint64_t) 100 * x; /* dlm takes it in centiseconds */
-		printf("timeout is %d\n", x);
-		return;
-	}
-
-	if (!strncmp(cmd, "quiet", 5)) {
-		quiet = !quiet;
-		printf("quiet is %d\n", quiet);
-		return;
-	}
-
-	if (!strncmp(cmd, "verbose", 7)) {
-		verbose = !verbose;
-		printf("verbose is %d\n", verbose);
-		return;
-	}
-
-	if (!strncmp(cmd, "help", 4)) {
-		print_commands();
-		return;
-	}
-
-	if (!strncmp(cmd, "settings", 8)) {
-		print_settings();
-		return;
-	}
-
-	printf("unknown command %s\n", cmd);
-}
-
-static void print_usage(void)
-{
-	printf("Options:\n");
-	printf("\n");
-	printf("  -n           The number of locks to work with, default %d\n", MAX_LOCKS);
-	printf("  -r           The number of resources to work with, default %d\n", MAX_RESOURCES);
-	printf("  -i           Iterations in looping stress test, default 0 is no limit\n");
-	printf("  -t           Enable timeout warnings\n");
-}
-
-static void decode_arguments(int argc, char **argv)
-{
-	int cont = 1;
-	int optchar;
-
-	while (cont) {
-		optchar = getopt(argc, argv, "n:r:c:i:thVoq:v:");
-
-		switch (optchar) {
-
-		case 'n':
-			maxn = atoi(optarg);
-			break;
-
-		case 'r':
-			maxr = atoi(optarg);
-			break;
-
-		case 'c':
-			strcpy(cmd, optarg);
-			opt_cmd = 1;
-			break;
-
-		case 'i':
-			iterations = atoi(optarg);
-			break;
-
-		case 't':
-			timewarn = 1;
-			break;
-
-		case 'o':
-			openclose_ls = 1;
-			break;
-
-		case 'q':
-			quiet = atoi(optarg);
-			break;
-
-		case 'v':
-			verbose = atoi(optarg);
-			break;
-
-		case 'h':
-			print_usage();
-			exit(EXIT_SUCCESS);
-			break;
-
-		case 'V':
-			printf("%s (built %s %s)\n", argv[0], __DATE__, __TIME__);
-			/* printf("%s\n", REDHAT_COPYRIGHT); */
-			exit(EXIT_SUCCESS);
-			break;
-
-		case ':':
-		case '?':
-			fprintf(stderr, "Please use '-h' for usage.\n");
-			exit(EXIT_FAILURE);
-			break;
-
-		case EOF:
-			cont = 0;
-			break;
-
-		default:
-			fprintf(stderr, "unknown option: %c\n", optchar);
-			exit(EXIT_FAILURE);
-			break;
-		};
-	}
-}
-
-static void sigterm_handler(int sig)
-{
-	stress_stop = 1;
-}
-
-int main(int argc, char *argv[])
-{
-	uint32_t major, minor, patch;
-	struct lk *lk;
-	int i, rv, maxi = 0, quit = 0;
-
-	srandom(time(NULL));
-
-	decode_arguments(argc, argv);
-
-	if (maxn < maxr) {
-		printf("number of resources must be >= number of locks\n");
-		return -1;
-	}
-	if (maxn % maxr) {
-		printf("number of locks must be multiple of number of resources\n");
-		return -1;
-	}
-
-	printf("maxn = %d\n", maxn);
-	printf("maxr = %d\n", maxr);
-	printf("locks per resource = %d\n", maxn / maxr);
-
-	signal(SIGTERM, sigterm_handler);
-
-	client_init();
-
-	locks = malloc(maxn * sizeof(struct lk));
-	if (!locks) {
-		printf("no mem for %d locks\n", maxn);
-		return 0;
-	}
-	memset(locks, 0, sizeof(*locks));
-
-	lk = locks;
-	for (i = 0; i < maxn; i++) {
-		lk->id = i;
-		lk->grmode = -1;
-		lk->rqmode = -1;
-		lk++;
-	}
-
-	rv = dlm_kernel_version(&major, &minor, &patch);
-	if (rv < 0) {
-		printf("can't detect dlm in kernel %d\n", errno);
-		return -1;
-	}
-	printf("dlm kernel version: %u.%u.%u\n", major, minor, patch);
-	dlm_library_version(&major, &minor, &patch);
-	printf("dlm library version: %u.%u.%u\n", major, minor, patch);
-
-	if (openclose_ls) {
-		printf("dlm_open_lockspace...\n");
-
-		dh = dlm_open_lockspace("test");
-		if (!dh) {
-			printf("dlm_open_lockspace error %lu %d\n",
-				(unsigned long)dh, errno);
-			return -ENOTCONN;
-		}
-	} else {
-		printf("dlm_new_lockspace...\n");
-
-		dh = dlm_new_lockspace("test", 0600,
-				       timewarn ? DLM_LSFL_TIMEWARN : 0);
-		if (!dh) {
-			printf("dlm_new_lockspace error %lu %d\n",
-				(unsigned long)dh, errno);
-			return -ENOTCONN;
-		}
-	}
-
-	rv = dlm_ls_get_fd(dh);
-	if (rv < 0) {
-		printf("dlm_ls_get_fd error %d %d\n", rv, errno);
-		dlm_release_lockspace("test", dh, 1);
-		return rv;
-	}
-	libdlm_fd = rv;
-
-	client_add(libdlm_fd, &maxi);
-
-	if (cmd) {
-		process_command(&quit);
-		goto out;
-	}
-
-	client_add(STDIN_FILENO, &maxi);
-
-	printf("Type EXIT to finish, help for usage\n");
-
-	while (1) {
-		rv = poll(pollfd, maxi + 1, -1);
-		if (rv < 0 && errno == EINTR)
-			continue;
-		if (rv < 0)
-			printf("poll error %d errno %d\n", rv, errno);
-
-		for (i = 0; i <= maxi; i++) {
-			if (client[i].fd < 0)
-				continue;
-
-			if (pollfd[i].revents & POLLIN) {
-				if (pollfd[i].fd == libdlm_fd)
-					process_libdlm();
-				else if (pollfd[i].fd == STDIN_FILENO)
-					process_command(&quit);
-			}
-
-			if (pollfd[i].revents & (POLLHUP | POLLERR | POLLNVAL))
-				client_dead(i);
-		}
-
-		if (quit && all_unlocks_done())
-			break;
-	}
-
- out:
-	if (openclose_ls) {
-		printf("dlm_close_lockspace\n");
-
-		rv = dlm_close_lockspace(dh);
-		if (rv < 0)
-			printf("dlm_close_lockspace error %d %d\n", rv, errno);
-	} else {
-		printf("dlm_release_lockspace\n");
-
-		rv = dlm_release_lockspace("test", dh, 1);
-		if (rv < 0)
-			printf("dlm_release_lockspace error %d %d\n", rv, errno);
-	}
-
-	return 0;
-}
-
diff --git a/dlm/tests/usertest/flood.c b/dlm/tests/usertest/flood.c
deleted file mode 100644
index efe3a4b..0000000
--- a/dlm/tests/usertest/flood.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/* Flood the DLM !
-   but not too much...
-*/
-#include <pthread.h>
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <sys/poll.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <net/if.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <fcntl.h>
-#include <netdb.h>
-#include <limits.h>
-#include <unistd.h>
-#include <errno.h>
-#include <getopt.h>
-
-#include "libdlm.h"
-
-static pthread_cond_t  cond;
-static pthread_mutex_t mutex;
-
-static int count = 0;
-
-static void usage(char *prog, FILE *file)
-{
-    fprintf(file, "Usage:\n");
-    fprintf(file, "%s [mcnpquhV] <lockname>\n", prog);
-    fprintf(file, "\n");
-    fprintf(file, "   -V         Show version of %s\n", prog);
-    fprintf(file, "   -h         Show this help information\n");
-    fprintf(file, "   -m <num>   Maximum number of locks to hold (default 100000)\n");
-    fprintf(file, "   -i <num>   Show progress in <n> increments (default 1000)\n");
-    fprintf(file, "   -n <num>   Number of resources (default 10)\n");
-    fprintf(file, "   -q         Quit\n");
-
-
-    fprintf(file, "\n");
-
-}
-
-static void ast_routine(void *arg)
-{
-    struct dlm_lksb *lksb = arg;
-
-    if (lksb->sb_status == 0) {
-	dlm_unlock(lksb->sb_lkid, 0, lksb, lksb);
-	return;
-    }
-
-    if (lksb->sb_status == EUNLOCK) {
-	    count--;
-    }
-}
-
-int main(int argc, char *argv[])
-{
-    int  flags = 0;
-    int  lockops = 0;
-    int  maxlocks = 100000;
-    int  rescount = 10;
-    int  increment = 1000;
-    int  quiet = 0;
-    int  status;
-    int  i;
-    int  mode = LKM_CRMODE;
-    int  lksbnum = 0;
-    signed char opt;
-    char **resources;
-    struct dlm_lksb *lksbs;
-
-    /* Deal with command-line arguments */
-    opterr = 0;
-    optind = 0;
-    while ((opt=getopt(argc,argv,"?m:i:qn:vV")) != EOF)
-    {
-	switch(opt)
-	{
-	case 'h':
-	    usage(argv[0], stdout);
-	    exit(0);
-
-	case '?':
-	    usage(argv[0], stderr);
-	    exit(0);
-
-	case 'm':
-	    maxlocks = atoi(optarg);
-	    break;
-
-	case 'i':
-	    increment = atoi(optarg);
-	    break;
-
-	case 'n':
-	    rescount = atoi(optarg);
-	    break;
-
-	case 'q':
-	    quiet = 1;
-	    break;
-
-	case 'V':
-	    printf("\nflood version 0.3\n\n");
-	    exit(1);
-	    break;
-	}
-    }
-
-    resources = malloc(sizeof(char*) * rescount);
-    for (i=0; i < rescount; i++) {
-	    char resname[256];
-	    sprintf(resname, "TESTLOCK%d", i);
-	    resources[i] = strdup(resname);
-    }
-
-    lksbs = malloc(sizeof(struct dlm_lksb) * maxlocks);
-    if (!lksbs)
-    {
-	    perror("cannot allocate lksbs");
-	    return 1;
-    }
-
-    pthread_cond_init(&cond, NULL);
-    pthread_mutex_init(&mutex, NULL);
-    pthread_mutex_lock(&mutex);
-
-    dlm_pthread_init();
-
-    while (1) {
-	    char *resource = resources[rand() % rescount];
-
-	    status = dlm_lock(mode,
-			      &lksbs[lksbnum],
-			      flags,
-			      resource,
-			      strlen(resource),
-			      0, // Parent,
-			      ast_routine,
-			      &lksbs[lksbnum],
-			      NULL, // bast_routine,
-			      NULL); // Range
-	    if (status == -1)
-	    {
-		    perror("lock failed");
-		    return -1;
-	    }
-
-	    count++;
-	    lockops++;
-	    if ((lockops % increment) == 0 && !quiet)
-		    fprintf(stderr, "%d lockops, %d locks\n", lockops, count);
-
-	    while (count > maxlocks) {
-		    sleep(1);
-	    }
-	    lksbnum = (lksbnum+1)%maxlocks;
-    }
-
-    return 0;
-}
-
diff --git a/dlm/tests/usertest/joinleave.c b/dlm/tests/usertest/joinleave.c
deleted file mode 100644
index b44116f..0000000
--- a/dlm/tests/usertest/joinleave.c
+++ /dev/null
@@ -1,62 +0,0 @@
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <stddef.h>
-#include <errno.h>
-#include <time.h>
-#include <sys/time.h>
-#include <syslog.h>
-#include <sys/types.h>
-#include <sys/errno.h>
-
-#include "libdlm.h"
-
-static dlm_lshandle_t *dh;
-
-int main(int argc, char *argv[])
-{
-	struct timeval begin, end, diff;
-	char *name;
-	int sec = 0;
-
-	if (argc < 2) {
-		printf("%s <lockspace name> [sleep sec]\n", argv[0]);
-		exit(-1);
-	}
-
-	name = argv[1];
-
-	if (argc > 2)
-		sec = atoi(argv[2]);
-
-	printf("Joining lockspace \"%s\" ... ", name);
-	fflush(stdout);
-
-	gettimeofday(&begin, NULL);
-	dh = dlm_create_lockspace(name, 0600);
-	if (!dh) {
-		printf("dlm_create_lockspace error %d %d\n", (int) dh, errno);
-		return -ENOTCONN;
-	}
-	gettimeofday(&end, NULL);
-
-	timersub(&end, &begin, &diff);
-	printf("%lu s\n", diff.tv_sec);
-
-	if (sec)
-		sleep(sec);
-
-	printf("Leaving lockspace \"%s\" ... ", name);
-	fflush(stdout);
-
-	gettimeofday(&begin, NULL);
-	dlm_release_lockspace(name, dh, 1);
-	gettimeofday(&end, NULL);
-
-	timersub(&end, &begin, &diff);
-	printf("%lu s\n", diff.tv_sec);
-
-	return 0;
-}
-
diff --git a/dlm/tests/usertest/lstest.c b/dlm/tests/usertest/lstest.c
deleted file mode 100644
index 025572a..0000000
--- a/dlm/tests/usertest/lstest.c
+++ /dev/null
@@ -1,326 +0,0 @@
-/* Test program for userland lockspaces */
-
-#ifdef _REENTRANT
-#include <pthread.h>
-#endif
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <sys/poll.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <net/if.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <fcntl.h>
-#include <netdb.h>
-#include <limits.h>
-#include <unistd.h>
-#include <errno.h>
-#include <getopt.h>
-
-#include "libdlm.h"
-
-static struct dlm_lksb lksb;
-static int use_threads = 0;
-static int quiet = 0;
-
-/* Used by the pthread test */
-static pthread_cond_t  cond;
-static pthread_mutex_t mutex;
-
-/* Used by the poll() test */
-static int ast_called = 0;
-
-static int modetonum(char *modestr)
-{
-    int mode = LKM_EXMODE;
-
-    if (strncasecmp(modestr, "NL", 2) == 0) mode = LKM_NLMODE;
-    if (strncasecmp(modestr, "CR", 2) == 0) mode = LKM_CRMODE;
-    if (strncasecmp(modestr, "CW", 2) == 0) mode = LKM_CWMODE;
-    if (strncasecmp(modestr, "PR", 2) == 0) mode = LKM_PRMODE;
-    if (strncasecmp(modestr, "PW", 2) == 0) mode = LKM_PWMODE;
-    if (strncasecmp(modestr, "EX", 2) == 0) mode = LKM_EXMODE;
-
-    return mode;
-}
-
-static char *numtomode(int mode)
-{
-    switch (mode)
-    {
-    case LKM_NLMODE: return "NL";
-    case LKM_CRMODE: return "CR";
-    case LKM_CWMODE: return "CW";
-    case LKM_PRMODE: return "PR";
-    case LKM_PWMODE: return "PW";
-    case LKM_EXMODE: return "EX";
-    default: return "??";
-    }
-}
-
-static void usage(char *prog, FILE *file)
-{
-    fprintf(file, "Usage:\n");
-    fprintf(file, "%s [mcnpqdlrfuhV] <lockname>\n", prog);
-    fprintf(file, "\n");
-    fprintf(file, "   -V         Show version of dlmtest\n");
-    fprintf(file, "   -h         Show this help information\n");
-    fprintf(file, "   -m <mode>  lock mode (default EX)\n");
-    fprintf(file, "   -n         don't block\n");
-    fprintf(file, "   -p         Use pthreads\n");
-    fprintf(file, "   -q         Quiet\n");
-    fprintf(file, "   -d <secs>  Delay betwen lock & unlock\n");
-    fprintf(file, "   -l <ls>    Lockspace name to create\n");
-    fprintf(file, "   -r         Don't release lockspace before finishing\n");
-    fprintf(file, "   -f         Force release lockspace\n");
-    fprintf(file, "   -u         Don't unlock explicitly\n");
-    fprintf(file, "\n");
-
-}
-
-static void ast_routine(void *arg)
-{
-    struct dlm_lksb *lksb = arg;
-
-    if (!quiet)
-	printf("ast called, status = %d, lkid=%x\n", lksb->sb_status, lksb->sb_lkid);
-
-    /* Wake the main thread */
-    if (use_threads)
-    {
-	pthread_mutex_lock(&mutex);
-	pthread_cond_signal(&cond);
-	pthread_mutex_unlock(&mutex);
-    }
-    else
-    {
-	ast_called = 1;
-    }
-}
-
-static void bast_routine(void *arg)
-{
-    struct dlm_lksb *lksb = arg;
-
-    if (!quiet)
-	printf("\nblocking ast called, status = %d, lkid=%x\n", lksb->sb_status, lksb->sb_lkid);
-}
-
-/* Using poll(2) to wait for and dispatch ASTs */
-static int poll_for_ast(dlm_lshandle_t ls)
-{
-    struct pollfd pfd;
-
-    pfd.fd = dlm_ls_get_fd(ls);
-    pfd.events = POLLIN;
-    while (!ast_called)
-    {
-	if (poll(&pfd, 1, 0) < 0)
-	{
-	    perror("poll");
-	    return -1;
-	}
-	dlm_dispatch(dlm_ls_get_fd(ls));
-    }
-    ast_called = 0;
-    return 0;
-}
-
-int main(int argc, char *argv[])
-{
-    char *resource = "LOCK-NAME";
-    int  flags = 0;
-    int  status;
-    int  mode = LKM_EXMODE;
-    int  do_unlock = 1;
-    int  release_ls = 1;
-    int  open_ls = 0;
-    int  force = 0;
-    int  sleeptime = 5;
-    signed char opt;
-    char lsname[64];
-    dlm_lshandle_t  ls;
-
-    strcpy(lsname, "testls");
-
-    /* Deal with command-line arguments */
-    opterr = 0;
-    optind = 0;
-    while ((opt=getopt(argc,argv,"?m:nqupd:c:l:rfoV")) != EOF)
-    {
-	switch(opt)
-	{
-	case 'h':
-	    usage(argv[0], stdout);
-	    exit(0);
-
-	case '?':
-	    usage(argv[0], stderr);
-	    exit(0);
-
-	case 'm':
-	    mode = modetonum(optarg);
-	    break;
-
-	case 'l':
-	    strcpy(lsname, optarg);
-	    break;
-
-	case 'd':
-	    sleeptime = atoi(optarg);
-	    break;
-
-        case 'p':
-            use_threads++;
-            break;
-
-        case 'o':
-            open_ls++;
-            break;
-
-        case 'f':
-            force++;
-            break;
-
-        case 'r':
-            release_ls = 0;
-            break;
-
-	case 'n':
-	    flags |= LKF_NOQUEUE;
-	    break;
-
-        case 'q':
-            quiet = 1;
-            break;
-
-        case 'u':
-            do_unlock = 0;
-            break;
-
-	case 'V':
-	    printf("\nasttest version 0.2\n\n");
-	    exit(1);
-	    break;
-	}
-    }
-
-    if (argv[optind])
-	resource = argv[optind];
-
-
-    if (!open_ls)
-    {
-	if (!quiet)
-	    fprintf(stderr, "Creating lockspace %s\n", lsname);
-
-
-	ls = dlm_create_lockspace(lsname, 0444);
-	if (ls == NULL)
-	{
-	    perror("ls create");
-	    exit(4);
-	}
-    }
-    else
-    {
-	if (!quiet)
-	    fprintf(stderr, "Opening lockspace %s\n", lsname);
-
-
-	ls = dlm_open_lockspace(lsname);
-	if (ls == NULL)
-	{
-	    perror("ls open");
-	    exit(4);
-	}
-    }
-
-
-    if (!quiet)
-    fprintf(stderr, "locking %s %s %s...", resource,
-	    numtomode(mode),
-	    (flags&LKF_NOQUEUE?"(NOQUEUE)":""));
-
-    fflush(stderr);
-
-    if (use_threads)
-    {
-	pthread_cond_init(&cond, NULL);
-	pthread_mutex_init(&mutex, NULL);
-	pthread_mutex_lock(&mutex);
-
-	status = dlm_ls_pthread_init(ls); printf("status=%d\n", status);
-	status = dlm_ls_pthread_init(ls); printf("status=%d\n", status);
-    }
-
-    status = dlm_ls_lock(ls,mode,
-			 &lksb,
-			 flags,
-			 resource,
-			 strlen(resource),
-			 0, // Parent,
-			 ast_routine,
-			 &lksb,
-			 bast_routine,
-			 NULL); // Range
-    if (status == -1)
-    {
-	if (!quiet) fprintf(stderr, "\n");
-	perror("lock");
-
-	return -1;
-    }
-
-    /* Wait */
-    if (use_threads)
-	pthread_cond_wait(&cond, &mutex);
-    else
-	poll_for_ast(ls);
-
-    sleep(sleeptime);
-
-    if (!quiet)
-    {
-        fprintf(stderr, "unlocking %s...", resource);
-        fflush(stderr);
-    }
-
-    if (do_unlock)
-    {
-	status = dlm_ls_unlock(ls,
-			       lksb.sb_lkid,
-			       0, // flags
-			       &lksb,
-			       &lksb); // AST args
-	if (status == -1)
-	{
-	    if (!quiet) fprintf(stderr, "\n");
-	    perror("unlock");
-	    return -1;
-	}
-
-	/* Wait */
-	if (use_threads)
-	    pthread_cond_wait(&cond, &mutex);
-	else
-	    poll_for_ast(ls);
-    }
-
-    if (release_ls)
-    {
-	if (!quiet)
-	    fprintf(stderr, "Releasing ls %s\n", lsname);
-
-	status = dlm_release_lockspace(lsname, ls, force);
-	if (status)
-	    perror("release ls");
-    }
-
-    return 0;
-}
-
diff --git a/dlm/tests/usertest/lvb.c b/dlm/tests/usertest/lvb.c
deleted file mode 100644
index 0683103..0000000
--- a/dlm/tests/usertest/lvb.c
+++ /dev/null
@@ -1,241 +0,0 @@
-/* Simple LVB test prog */
-
-#ifdef VMS
-#include starlet
-#include psldef
-#include ssdef
-#include errno
-#include descrip
-#include rsdmdef
-#include lckdef
-
-#include stdio
-#include stdlib
-#include string
-
-struct lksb
-{
-    int sb_status;
-    int sb_lkid;
-    char sb_lvb[16];
-};
-#endif
-
-#ifdef __linux__
-#include <stdio.h>
-#include <pthread.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <netdb.h>
-#include <stdlib.h>
-#include <string.h>
-#include <libdlm.h>
-#define LCK$M_VALBLK LKF_VALBLK
-#define LCK$M_CONVERT LKF_CONVERT
-#define LCK$K_CRMODE LKM_CRMODE
-#define LCK$K_PWMODE LKM_PWMODE
-#define PSL$C_USER 0
-#define SS$_NORMAL 0
-#define SS$_DEADLOCK EDEADLOCK
-#define EVMSERR errno
-#define sys$exit exit
-#define sys$hiber pause
-
-
-struct lksb {
-	int sb_status;
-	uint32_t sb_lkid;
-	char sb_flags;
-	char *sb_lvb;
-};
-
-struct dsc$descriptor_s
-{
-	int dsc$w_length;
-	char *dsc$a_pointer;
-};
-
-static int sys$enq(int efn, int mode, struct lksb *lksb, int flags,
-		   struct dsc$descriptor_s *name, int parent,
-		   void *compast, void *astarg, void *blockast,
-		   int accmode, int nullarg)
-{
-	if (name)
-		return dlm_lock(mode, (struct dlm_lksb *)lksb, flags,
-				name->dsc$a_pointer,
-				name->dsc$w_length,
-				parent,
-				compast, astarg,
-				blockast, NULL);
-	else
-		return dlm_lock(mode, (struct dlm_lksb *)lksb, flags,
-				NULL,
-				0,
-				parent,
-				compast, astarg,
-				blockast, NULL);
-}
-
-static int sys$deq(int lkid, struct lksb *lksb, int accmode, int flags, int c)
-{
-	return dlm_unlock(lkid, flags, (struct dlm_lksb *)lksb, NULL);
-}
-
-static char *linux_strerror(int vmserr, int err)
-{
-	return strerror(err);
-}
-#define strerror linux_strerror
-
-#endif
-
-
-static struct lksb our_lksb;
-static int cur_mode;
-static void compast_routine(void *arg);
-static void blockast_routine(void *arg, int mode);
-static char *name = "TESTLOCK";
-
-#ifdef __linux__
-static char lksb_lvb[DLM_LVB_LEN];
-#endif
-
-static void start_lock(int mode)
-{
-    struct dsc$descriptor_s name_s;
-    int status;
-
-    cur_mode = mode;
-
-/* Make a descriptor of the name */
-    memset(&name_s, 0, sizeof(struct dsc$descriptor_s));
-    name_s.dsc$w_length = strlen(name);
-    name_s.dsc$a_pointer = name;
-
-    /* Lock it */
-    status = sys$enq(0,
-		      cur_mode,
-		      &our_lksb,
-		      LCK$M_VALBLK, /* flags */
-		      &name_s,
-		      0, /* parent */
-		      compast_routine,
-		      0, /* astp */
-		      blockast_routine,
-		      PSL$C_USER,
- 		      0);
-
-    if (status != SS$_NORMAL)
-    {
-        printf("lock enq failed : %s\n", strerror(EVMSERR, status));
-	sys$exit(status);
-    }
-
-    printf("Lock ID is %x\n", our_lksb.sb_lkid);
-    return;
-}
-
-static int convert_lock(int mode, char *lvb)
-{
-    int status;
-
-    memset(our_lksb.sb_lvb, 0, 16);
-    if (lvb[strlen(lvb)-1] == '\n')
-      lvb[strlen(lvb)-1] = '\0';
-
-    cur_mode = mode;
-    strcpy(our_lksb.sb_lvb, lvb);
-    printf("converting to %d\n", mode);
-
-    /* Lock it */
-    status = sys$enq(0,
-		     mode,
-		     &our_lksb,
-		     LCK$M_CONVERT | LCK$M_VALBLK,
-		     NULL,
-		     0, /* parent */
-		     compast_routine,
-		     0, /* astp */
-		     blockast_routine,
-		     PSL$C_USER,
-		     0);
-
-    if (status != SS$_NORMAL)
-    {
-        printf("convert enq failed : %s\n", strerror(EVMSERR, status));
-    }
-
-    return status;
-}
-
-static void unlock()
-{
-    int status;
-
-    status = sys$deq(our_lksb.sb_lkid, NULL,0,0,0);
-    if (status != SS$_NORMAL)
-    {
-        printf("denq failed : %s\n", strerror(EVMSERR, status));
-    }
-}
-
-static void compast_routine(void *arg)
-{
-#ifdef __linux__
-    if (our_lksb.sb_flags & DLM_SBF_VALNOTVALID)
-    {
-        printf("testlock: LVB not valid\n");
-	sys$hiber();
-    }
-#endif
-    if (our_lksb.sb_status == SS$_DEADLOCK)
-    {
-	printf("testlock: deadlocked\n");
-	unlock();
-	return;
-    }
-
-    if (our_lksb.sb_status == SS$_NORMAL)
-    {
-	printf("testlock. compast, now at %d, lvb=%s\n", cur_mode, our_lksb.sb_lvb);
-    }
-    else
-    {
-	printf("testlock: lock failed (compast): %s\n", strerror(EVMSERR, our_lksb.sb_status));
-	sys$hiber();
-    }
-}
-
-static void blockast_routine(void *arg, int mode)
-{
-    printf("testlock. blkast.\n");
-}
-
-int main(int argc, char *argv[])
-{
-    char buf[80];
-
-#ifdef __linux__
-    our_lksb.sb_lvb = lksb_lvb;
-    dlm_pthread_init();
-#endif
-
-    if (argc > 1)
-      name = argv[1];
-
-    start_lock(LCK$K_CRMODE);
-
-    do {
-      fgets(buf, sizeof(buf), stdin);
-      char cmd = buf[0] & 0x5F;
-
-      if (cmd == 'W')
-	convert_lock(LCK$K_CRMODE, &buf[1]);
-      else
-	convert_lock(LCK$K_PWMODE, &buf[1]);
-    }
-    while (buf[0] != 'x');
-
-    return SS$_NORMAL;
-}
-
diff --git a/dlm/tests/usertest/pingtest.c b/dlm/tests/usertest/pingtest.c
deleted file mode 100644
index adf2042..0000000
--- a/dlm/tests/usertest/pingtest.c
+++ /dev/null
@@ -1,343 +0,0 @@
-
-/* Ping Test the locking interface */
-
-#ifdef __linux__
-#include <pthread.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <netdb.h>
-
-#include <libdlm.h>
-
-static char our_lvb[DLM_LVB_LEN];
-static struct dlm_lksb our_lksb = {.sb_lvbptr = our_lvb};
-static int *lvb_int = (int *)our_lvb;
-#define SUCCESS 0
-#endif
-
-
-#ifdef VMS
-#include starlet
-#include psldef
-#include ssdef
-#include errno
-#include descrip
-#include rsdmdef
-#include lckdef
-
-#include stdio
-#include stdlib
-#include string
-
-struct lksb
-{
-    int sb_status;
-    int sb_lkid;
-    char sb_lvb[16];
-};
-
-static struct lksb our_lksb;
-static int *lvb_int = (int *)&our_lksb.sb_lvb;
-
-#define LKM_NLMODE LCK$K_NLMODE
-#define LKM_CRMODE LCK$K_CRMODE
-#define LKM_CWMODE LCK$K_CWMODE
-#define LKM_PRMODE LCK$K_PRMODE
-#define LKM_PWMODE LCK$K_PWMODE
-#define LKM_EXMODE LCK$K_EXMODE
-#define EDEADLOCK SS$_DEADLOCK
-
-/* This is wrong...VMS does not deliver ASTs
-   for $DEQ but we'll never get this code, honest.
- */
-#define EUNLOCK 65535
-
-#define SUCCESS SS$_NORMAL
-#endif
-
-static char *lockname="ping";
-static int us = 1;
-static int maxnode = 2;
-static int cur_mode;
-
-static int granted = 0;
-static void compast_routine(void *arg);
-static void blockast_routine(void *arg);
-
-#ifdef __linux__
-static int convert_lock(int mode)
-{
-    int old_mode = cur_mode;
-    int status;
-
-    printf("pinglock: convert to %d starting\n", mode);
-    status = dlm_lock( mode,
-		       &our_lksb,
-		       LKF_VALBLK | LKF_CONVERT,
-		       NULL,
-		       0,
-		       0,
-		       compast_routine,
-		       &our_lksb,
-		       blockast_routine,
-		       NULL);
-    if (status != 0)
-    {
-	perror("pinglock: convert failed");
-    }
-    else
-    {
-	cur_mode = mode;
-	printf("pinglock: convert to %d started\n", mode);
-    }
-    return status;
-}
-
-static void unlock()
-{
-    int status;
-    status = dlm_unlock( our_lksb.sb_lkid,
-			 0,
-			 &our_lksb,
-			 0);
-    if (status != 0)
-	perror("pinglock: unlock failed");
-
-}
-
-static void start_lock()
-{
-    int status;
-    cur_mode = LKM_EXMODE;
-
-    *lvb_int = us-1;
-
-    printf("pinglock: starting\n");
-    status = dlm_lock( cur_mode,
-		       &our_lksb,
-		       LKF_VALBLK,
-		       lockname,
-		       strlen(lockname)+1, /* include trailing NUL for ease of following */
-		       0, /* Parent */
-		       compast_routine,
-		       &our_lksb,
-		       blockast_routine,
-		       NULL);
-    if (status != 0)
-	perror("pinglock: lock failed");
-}
-
-#endif /* __linux__ */
-
-#ifdef VMS
-
-static void start_lock()
-{
-    struct dsc$descriptor_s name_s;
-    int status;
-    char *name = "PINGLOCK";
-
-    cur_mode = LCK$K_EXMODE;
-
-    *lvb_int = us-1;
-
-/* Make a descriptor of the name */
-    memset(&name_s, 0, sizeof(struct dsc$descriptor_s));
-    name_s.dsc$w_length = strlen(name);
-    name_s.dsc$a_pointer = name;
-
-    /* Lock it */
-    status = sys$enqw(0,
-		      cur_mode,
-		      &our_lksb,
-		      0, /* flags */
-		      &name_s,
-		      0, /* parent */
-		      compast_routine,
-		      0, /* astp */
-		      blockast_routine,
-		      PSL$C_USER,
-		      RSDM$K_PROCESS_RSDM_ID,
-		      0);
-
-    if (status != SS$_NORMAL)
-    {
-        printf("lock enq failed : %s\n", strerror(EVMSERR, status));
-	sys$exit(status);
-    }
-
-    printf("Lock ID is %x\n", our_lksb.sb_lkid);
-    return;
-}
-
-static int convert_lock(int mode)
-{
-    int status;
-    int old_mode = cur_mode;
-
-    printf("converting to %d\n", mode);
-
-    /* Lock it */
-    status = sys$enq(0,
-		     mode,
-		     &our_lksb,
-		     LCK$M_CONVERT | LCK$M_VALBLK,
-		     NULL,
-		     0, /* parent */
-		     compast_routine,
-		     0, /* astp */
-		     blockast_routine,
-		     PSL$C_USER,
-		     RSDM$K_PROCESS_RSDM_ID,
-		     0);
-
-    if (status != SS$_NORMAL)
-    {
-        printf("convert enq failed : %s\n", strerror(EVMSERR, status));
-	sys$wake();
-    }
-    else
-    {
-	cur_mode = mode;
-	status = 0; /* simulate Unix retcodes */
-    }
-    return status;
-}
-
-static void unlock()
-{
-    int status;
-
-    status = sys$deq(our_lksb.sb_lkid, NULL,0,0,0);
-    if (status != SS$_NORMAL)
-    {
-        printf("denq failed : %s\n", strerror(EVMSERR, status));
-	sys$wake();
-    }
-}
-
-#endif
-
-static void compast_routine(void *arg)
-{
-
-#ifdef __linux__
-    if (our_lksb.sb_flags & DLM_SBF_VALNOTVALID)
-#endif
-#ifdef VMS
-    if (our_lksb.sb_status == SS$_VALNOTVALID)
-#endif
-    {
-	    printf(" valblk not valid. current value is %d\n", *lvb_int);
-	    unlock();
-	    exit(10);
-    }
-
-    if (our_lksb.sb_status == EDEADLOCK)
-    {
-	printf("pinglock: deadlocked\n");
-	unlock();
-	exit(11);
-    }
-
-    if (our_lksb.sb_status == EUNLOCK)
-    {
-	return;
-    }
-
-    if (our_lksb.sb_status == SUCCESS)
-    {
-	granted = 1;
-	switch (cur_mode)
-	{
-	case LKM_NLMODE:
-	    printf("pinglock. compast, (valblk = %d) now at NL\n", *lvb_int);
-	    if (convert_lock(LKM_CRMODE) == 0)
-		granted = 0;
-	    break;
-
-	case LKM_CRMODE:
-	    printf("pinglock. compast, (valblk = %d) now at CR\n", *lvb_int);
-	    if (*lvb_int == us-1)
-	    {
-		if (convert_lock(LKM_EXMODE) == 0)
-		    granted = 0;
-	    }
-	    break;
-
-	case LKM_EXMODE:
-	    printf("pinglock. compast. (valblk = %d) now at EX\n", *lvb_int);
-	    if (*lvb_int == us-1)
-	    {
-		(*lvb_int)++;
-		*lvb_int %= maxnode;
-		printf("pinglock. compast. incrementing valblk to %d\n", *lvb_int);
-	    }
-	    if (convert_lock(LKM_CRMODE) == 0)
-		granted = 0;
-	    break;
-	}
-    }
-    else
-    {
-	printf("pinglock: lock failed (compast): %d\n", our_lksb.sb_status);
-	unlock();
-    }
-}
-
-static void blockast_routine(void *arg)
-{
-    printf("pinglock. blkast, granted = %d\n", granted);
-    if (!granted)
-    {
-	return;
-    }
-
-    printf("pinglock. blkast, demoting lock to NL\n");
-    if (convert_lock(LKM_NLMODE) == 0)
-	granted = 0;
-}
-
-
-#ifdef __linux__
-int main(int argc, char *argv[])
-{
-    if (argc < 3)
-    {
-        printf("usage: %s <maxnodes> <us>\n", argv[0]);
-	return 2;
-    }
-    maxnode = atoi(argv[1]);
-    us = atoi(argv[2]);
-
-    dlm_pthread_init();
-    start_lock();
-    while(1)
-	    sleep(100000);
-    return 0;
-}
-
-
-#endif
-
-#ifdef VMS
-int main(int argc, char *argv[])
-{
-    if (argc < 3)
-    {
-        printf("usage: %s <maxnodes> <us>\n", argv[0]);
-	return 2;
-    }
-    maxnode = atoi(argv[1]);
-    us = atoi(argv[2]);
-
-    start_lock();
-    while(1)
-	sys$hiber();
-
-    return SS$_NORMAL;
-}
-#endif
diff --git a/dlm/tests/usertest/sublocks.c b/dlm/tests/usertest/sublocks.c
deleted file mode 100644
index d994b86..0000000
--- a/dlm/tests/usertest/sublocks.c
+++ /dev/null
@@ -1,178 +0,0 @@
-/* Test program for userland DLM interface */
-
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <net/if.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <fcntl.h>
-#include <netdb.h>
-#include <limits.h>
-#include <unistd.h>
-#include <errno.h>
-#include <getopt.h>
-
-#include "libdlm.h"
-
-static int modetonum(char *modestr)
-{
-    int mode = LKM_EXMODE;
-
-    if (strncasecmp(modestr, "NL", 2) == 0) mode = LKM_NLMODE;
-    if (strncasecmp(modestr, "CR", 2) == 0) mode = LKM_CRMODE;
-    if (strncasecmp(modestr, "CW", 2) == 0) mode = LKM_CWMODE;
-    if (strncasecmp(modestr, "PR", 2) == 0) mode = LKM_PRMODE;
-    if (strncasecmp(modestr, "PW", 2) == 0) mode = LKM_PWMODE;
-    if (strncasecmp(modestr, "EX", 2) == 0) mode = LKM_EXMODE;
-
-    return mode;
-}
-
-static void usage(char *prog, FILE *file)
-{
-    fprintf(file, "Usage:\n");
-    fprintf(file, "%s [mndvV] <parent>\n", prog);
-    fprintf(file, "\n");
-    fprintf(file, "   -V         Show version of %s\n", prog);
-    fprintf(file, "   -h         Show this help information\n");
-    fprintf(file, "   -v         Do it verbosely\n");
-    fprintf(file, "   -m <mode>  lock mode (default CR)\n");
-    fprintf(file, "   -p         Pause at end\n");
-    fprintf(file, "   -d <num>   Depth of lock tree (default 4)\n");
-    fprintf(file, "   -n <num>   Number of children (default 4)\n");
-    fprintf(file, "   -s <name>  Subresource name (eg SUBRES-%%d)\n");
-    fprintf(file, "\n");
-
-}
-
-int  maxdepth = 4;
-int  nchildren = 4;
-int  verbose = 0;
-char *subresformat="SUBRES-%d-%d";
-
-
-int do_childlocks(int parent, int mode, int depth, int flags)
-{
-    int status;
-    int i;
-    char subresname[64];
-    struct dlm_lksb lksb;
-
-    if (depth > maxdepth) return 0;
-
-    memset(&lksb, 0, sizeof(lksb));
-
-    for (i = 0; i < nchildren; i++)
-    {
-	sprintf(subresname, subresformat, depth, i);
-
-	if (verbose)
-	    printf("locking '%s', depth %d\n", subresname, depth);
-
-	status = dlm_lock_wait(mode, &lksb, flags, subresname, strlen(subresname)+1,
-			       parent, NULL, NULL, NULL);
-	if (status || !lksb.sb_lkid)
-	{
-	    perror("lock failed");
-	    return 0;
-	}
-	do_childlocks(lksb.sb_lkid, mode, depth+1, flags);
-    }
-    return 0;
-}
-
-
-int main(int argc, char *argv[])
-{
-    char *resource = "LOCK-NAME";
-    int  flags = 0;
-    int  status;
-    int  mode = LKM_CRMODE;
-    int  pause_at_end=0;
-    struct dlm_lksb lksb;
-    signed char opt;
-
-    /* Deal with command-line arguments */
-    opterr = 0;
-    optind = 0;
-    while ((opt=getopt(argc,argv,"?m:n:d:s:pvV")) != EOF)
-    {
-	switch(opt)
-	{
-	case 'h':
-	    usage(argv[0], stdout);
-	    exit(0);
-
-	case '?':
-	    usage(argv[0], stderr);
-	    exit(0);
-
-	case 'm':
-	    mode = modetonum(optarg);
-	    break;
-
-	case 'v':
-	    verbose++;
-	    break;
-
-	case 'p':
-	    pause_at_end++;
-	    break;
-
-	case 'd':
-	    maxdepth = atoi(optarg);
-	    break;
-
-	case 'n':
-	    nchildren = atoi(optarg);
-	    break;
-
-	case 's':
-	    strcpy(subresformat, optarg);
-	    break;
-
-	case 'V':
-	    printf("\n%s version 0.1\n\n", argv[0]);
-	    exit(1);
-	    break;
-	}
-    }
-
-    if (argv[optind])
-	resource = argv[optind];
-
-    /* Lock parent */
-    if (verbose)
-	fprintf(stderr, "locking parent '%s'\n", resource);
-
-    fflush(stderr);
-
-    status = dlm_lock_wait(mode, &lksb, flags,
-			   resource, strlen(resource)+1,
-			   0, NULL, NULL, NULL);
-    if (status == -1)
-    {
-	perror("lock");
-	return -1;
-    }
-
-    if (lksb.sb_lkid == 0)
-    {
-	fprintf(stderr, "error: got lockid of zero\n");
-	return 0;
-    }
-
-    do_childlocks(lksb.sb_lkid, mode, 0, flags);
-
-    if (pause_at_end)
-    {
-	printf("paused\n");
-	pause();
-    }
-    return 0;
-}
diff --git a/dlm/tests/usertest/threads.c b/dlm/tests/usertest/threads.c
deleted file mode 100644
index 1d6ba5d..0000000
--- a/dlm/tests/usertest/threads.c
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- * Threaded DLM example
- */
-
-#include <pthread.h>
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <sys/poll.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <net/if.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <fcntl.h>
-#include <netdb.h>
-#include <limits.h>
-#include <unistd.h>
-#include <errno.h>
-#include <getopt.h>
-
-#include "libdlm.h"
-
-struct lock_wait {
-	pthread_cond_t cond;
-	pthread_mutex_t mutex;
-	struct dlm_lksb lksb;
-};
-
-struct thread_args
-{
-	dlm_lshandle_t *lockspace;
-	char *resource;
-	int flags;
-	int delay;
-	int mode;
-	int verbose;
-	int num;
-};
-
-static int modetonum(char *modestr)
-{
-    int mode = LKM_EXMODE;
-
-    if (strncasecmp(modestr, "NL", 2) == 0) mode = LKM_NLMODE;
-    if (strncasecmp(modestr, "CR", 2) == 0) mode = LKM_CRMODE;
-    if (strncasecmp(modestr, "CW", 2) == 0) mode = LKM_CWMODE;
-    if (strncasecmp(modestr, "PR", 2) == 0) mode = LKM_PRMODE;
-    if (strncasecmp(modestr, "PW", 2) == 0) mode = LKM_PWMODE;
-    if (strncasecmp(modestr, "EX", 2) == 0) mode = LKM_EXMODE;
-
-    return mode;
-}
-
-static char *numtomode(int mode)
-{
-    switch (mode)
-    {
-    case LKM_NLMODE: return "NL";
-    case LKM_CRMODE: return "CR";
-    case LKM_CWMODE: return "CW";
-    case LKM_PRMODE: return "PR";
-    case LKM_PWMODE: return "PW";
-    case LKM_EXMODE: return "EX";
-    default: return "??";
-    }
-}
-
-static void usage(char *prog, FILE *file)
-{
-    fprintf(file, "Usage:\n");
-    fprintf(file, "%s [mcnpquhV] <lockname>\n", prog);
-    fprintf(file, "\n");
-    fprintf(file, "   -V           show version of %s\n", prog);
-    fprintf(file, "   -h           show this help information\n");
-    fprintf(file, "   -m <mode>    lock mode (default EX)\n");
-    fprintf(file, "   -n           don't block\n");
-    fprintf(file, "   -t <threads> number of threads\n");
-    fprintf(file, "   -d <secs>    delay while holding lock\n");
-    fprintf(file, "   -l <name>    lockspace name\n");
-    fprintf(file, "   -v           verbose (up to 3)\n");
-    fprintf(file, "\n");
-
-}
-
-/* Simply wakes the thread that initiated the lock */
-static void sync_ast_routine(void *arg)
-{
-	struct lock_wait *lwait = arg;
-
-	pthread_mutex_lock(&lwait->mutex);
-	pthread_cond_signal(&lwait->cond);
-	pthread_mutex_unlock(&lwait->mutex);
-}
-
-/* Get/Convert a lock and wait for it to complete (or fail) */
-static int sync_lock(dlm_lshandle_t lockspace,
-		     const char *resource,
-		     int mode,
-		     int flags,
-		     int *lockid)
-{
-	int status;
-	struct lock_wait lwait;
-
-	if (!lockid) {
-		errno = EINVAL;
-		return -1;
-	}
-
-	/* Conversions need the lockid in the LKSB */
-	if (flags & LKF_CONVERT)
-		lwait.lksb.sb_lkid = *lockid;
-
-	pthread_cond_init(&lwait.cond, NULL);
-	pthread_mutex_init(&lwait.mutex, NULL);
-	pthread_mutex_lock(&lwait.mutex);
-
-	status = dlm_ls_lock(lockspace,
-			     mode,
-			     &lwait.lksb,
-			     flags,
-			     resource,
-			     strlen(resource),
-			     0, sync_ast_routine, &lwait, NULL, NULL);
-	if (status)
-		return status;
-
-	/* Wait for it to complete */
-	pthread_cond_wait(&lwait.cond, &lwait.mutex);
-	pthread_mutex_unlock(&lwait.mutex);
-
-	*lockid = lwait.lksb.sb_lkid;
-
-	errno = lwait.lksb.sb_status;
-
-	if (lwait.lksb.sb_status)
-		return -1;
-	else
-		return 0;
-}
-
-/* Unlock - and wait for it to complete */
-static int sync_unlock(dlm_lshandle_t lockspace, int lockid)
-{
-	int status;
-	struct lock_wait lwait;
-
-	pthread_cond_init(&lwait.cond, NULL);
-	pthread_mutex_init(&lwait.mutex, NULL);
-	pthread_mutex_lock(&lwait.mutex);
-
-	status = dlm_ls_unlock(lockspace, lockid, 0, &lwait.lksb, &lwait);
-
-	if (status)
-		return status;
-
-	/* Wait for it to complete */
-	pthread_cond_wait(&lwait.cond, &lwait.mutex);
-	pthread_mutex_unlock(&lwait.mutex);
-
-	errno = lwait.lksb.sb_status;
-	if (lwait.lksb.sb_status != EUNLOCK)
-		return -1;
-	else
-		return 0;
-
-}
-
-static void *thread_fn(void *arg)
-{
-	struct thread_args *ta = arg;
-	int lockid;
-	int status;
-
-	if (ta->verbose > 1)
-		fprintf(stderr, "Locking in thread %d\n", pthread_self);
-
-	status = sync_lock(ta->lockspace, ta->resource,
-			   ta->mode, ta->flags, &lockid);
-
-	if (status)
-	{
-		if (ta->verbose)
-			fprintf(stderr, "Lock in thread %x failed: %s\n", pthread_self, strerror(errno));
-		return NULL;
-	}
-
-	sleep(ta->delay);
-
-	if (ta->verbose > 1)
-		fprintf(stderr, "Unlocking in thread %x\n", pthread_self());
-
-	status = sync_unlock(ta->lockspace,lockid);
-	if (status)
-	{
-		if (ta->verbose)
-			fprintf(stderr, "Unlock in thread %x failed: %s\n", pthread_self(), strerror(errno));
-	}
-
-	return NULL;
-}
-
-
-int main(int argc, char *argv[])
-{
-    char *resource = "LOCK-NAME";
-    char *lockspace_name = "threadtest";
-    dlm_lshandle_t *lockspace;
-    int  flags = 0;
-    int  num_threads = 5;
-    int  delay = 1;
-    int  mode;
-    int  verbose;
-    int  i;
-    signed char opt;
-    pthread_t *threads;
-    struct thread_args ta;
-
-    /* Deal with command-line arguments */
-    opterr = 0;
-    optind = 0;
-    while ((opt=getopt(argc,argv,"h?nt:d:l:m:vV")) != EOF)
-    {
-	switch(opt)
-	{
-	case 'h':
-	    usage(argv[0], stdout);
-	    exit(0);
-
-	case '?':
-	    usage(argv[0], stderr);
-	    exit(0);
-
-	case 'n':
-	    flags |= LKF_NOQUEUE;
-	    break;
-
-	case 't':
-            num_threads = atoi(optarg);
-	    break;
-
-	case 'm':
-            mode = modetonum(optarg);
-	    break;
-
-	case 'l':
-	    lockspace_name = strdup(optarg);
-	    break;
-
-	case 'd':
-            delay = atoi(optarg);
-	    break;
-
-	case 'v':
-	    verbose++;
-	    break;
-
-	case 'V':
-	    printf("\nthread example version 0.1\n\n");
-	    exit(1);
-	    break;
-	}
-    }
-
-    if (argv[optind])
-	resource = argv[optind];
-
-    if (verbose)
-	    fprintf(stderr, "Creating lockspace '%s'...", lockspace_name);
-
-    /* You need to be root to create the lockspace ... but not to use it */
-    lockspace = dlm_create_lockspace(lockspace_name, 0666);
-    if (!lockspace) {
-	    perror("Unable to create lockspace");
-	    return 1;
-    }
-    if (verbose)
-	    fprintf(stderr, "done\n");
-
-    dlm_ls_pthread_init(lockspace);
-
-    threads = malloc(sizeof(pthread_t) * num_threads);
-    if (!threads)
-    {
-	    perror("can't malloc threads array");
-	    return 2;
-    }
-
-    if (verbose)
-	    fprintf(stderr, "Starting threads\n");
-
-    ta.lockspace = lockspace;
-    ta.mode = mode;
-    ta.flags = flags;
-    ta.delay = delay;
-    ta.verbose = verbose;
-    ta.resource = resource;
-
-    for (i=0; i<num_threads; i++)
-    {
-	    if (verbose > 2)
-		    fprintf(stderr, "Starting thread %d\n", i);
-
-	    pthread_create(&threads[i], NULL, thread_fn, &ta);
-    }
-
-    if (verbose)
-	    fprintf(stderr, "All threads started\n");
-
-    for (i=0; i<num_threads; i++)
-    {
-	    void *status;
-	    if (verbose > 2)
-		    fprintf(stderr, "Waiting for thread %d\n", i);
-	    pthread_join(threads[i], &status);
-    }
-
-    return 0;
-}
-
diff --git a/dlm/tool/Makefile b/dlm/tool/Makefile
deleted file mode 100644
index 9d75b6c..0000000
--- a/dlm/tool/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-TARGET= dlm_tool
-
-SBINDIRT=$(TARGET)
-
-all: depends ${TARGET}
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-OBJS=	main.o
-
-CFLAGS += -I${dlmincdir} -I${dlmcontrolincdir}
-CFLAGS += -I$(SRCDIR)/group/dlm_controld/
-CFLAGS += -I${incdir}
-CFLAGS += -I${KERNEL_SRC}/include/
-
-LDFLAGS += -L${dlmlibdir} -L${dlmcontrollibdir} -ldlm -ldlmcontrol
-LDFLAGS += -L${libdir}
-
-${TARGET}: ${OBJS}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-clean: generalclean
-
-depends:
-	$(MAKE) -C ../libdlm all
-	$(MAKE) -C ../libdlmcontrol all
-
--include $(OBJS:.o=.d)
diff --git a/dlm/tool/main.c b/dlm/tool/main.c
deleted file mode 100644
index 6d1f53a..0000000
--- a/dlm/tool/main.c
+++ /dev/null
@@ -1,1053 +0,0 @@
-#include <sys/types.h>
-#include <sys/un.h>
-#include <inttypes.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <stddef.h>
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-#include <limits.h>
-#include <netinet/in.h>
-
-#include <linux/dlmconstants.h>
-#include "libdlm.h"
-#include "libdlmcontrol.h"
-#include "copyright.cf"
-
-#define LKM_IVMODE -1
-
-#define OP_JOIN				1
-#define OP_LEAVE			2
-#define OP_JOINLEAVE			3
-#define OP_LIST				4
-#define OP_DEADLOCK_CHECK		5
-#define OP_DUMP				6
-#define OP_PLOCKS			7
-#define OP_LOCKDUMP			8
-#define OP_LOCKDEBUG			9
-
-static char *prog_name;
-static char *lsname;
-static int operation;
-static int opt_ind;
-static int ls_all_nodes = 0;
-static int opt_dir = 0;
-static int opt_excl = 0;
-static int opt_fs = 0;
-static int dump_mstcpy = 0;
-static mode_t create_mode = 0600;
-static int verbose;
-static int wide;
-
-#define MAX_LS 128
-#define MAX_NODES 128
-
-/* from linux/fs/dlm/dlm_internal.h */
-#define DLM_LKSTS_WAITING       1
-#define DLM_LKSTS_GRANTED       2
-#define DLM_LKSTS_CONVERT       3
-
-struct dlmc_lockspace lss[MAX_LS];
-struct dlmc_node nodes[MAX_NODES];
-
-static int rsb_nodeid, print_granted, print_convert, print_waiting, print_lookup;
-
-char *mode_str(int mode)
-{
-	switch (mode) {
-	case -1:
-		return "IV";
-	case LKM_NLMODE:
-		return "NL";
-	case LKM_CRMODE:
-		return "CR";
-	case LKM_CWMODE:
-		return "CW";
-	case LKM_PRMODE:
-		return "PR";
-	case LKM_PWMODE:
-		return "PW";
-	case LKM_EXMODE:
-		return "EX";
-	}
-	return "??";
-}
-
-static void print_usage(void)
-{
-	printf("Usage:\n");
-	printf("\n");
-	printf("dlm_tool [options] [join | leave | lockdump | lockdebug |\n"
-	       "                    ls | dump | plocks | deadlock_check]\n");
-	printf("\n");
-	printf("Options:\n");
-	printf("  -n               Show all node information in ls\n");
-	printf("  -d <n>           Resource directory off/on (0/1) in join, default 0\n");
-#ifdef LINUX2628rc
-	printf("  -e <n>           Exclusive create off/on (0/1) in join, default 0\n");
-#endif
-	printf("  -f <n>           FS memory allocation off/on (0/1) in join, default 0\n");
-	printf("  -m <mode>        Permission mode for lockspace device (octal), default 0600\n");
-	printf("  -M               Print MSTCPY locks in lockdump\n"
-	       "                   (remote locks that are locally mastered)\n");
-	printf("  -v               Verbose lockdebug output\n");
-	printf("  -w               Wide lockdebug output\n");
-	printf("  -h               Print this help, then exit\n");
-	printf("  -V               Print program version information, then exit\n");
-	printf("\n");
-}
-
-#define OPTION_STRING "MhVnd:m:e:f:vw"
-
-static void decode_arguments(int argc, char **argv)
-{
-	int cont = 1;
-	int optchar;
-	int need_lsname;
-	char modebuf[8];
-
-	while (cont) {
-		optchar = getopt(argc, argv, OPTION_STRING);
-
-		switch (optchar) {
-		case 'd':
-			opt_dir = atoi(optarg);
-			break;
-
-		case 'e':
-			opt_excl = atoi(optarg);
-			break;
-
-		case 'f':
-			opt_fs = atoi(optarg);
-			break;
-
-		case 'm':
-			memset(modebuf, 0, sizeof(modebuf));
-			snprintf(modebuf, 8, "%s", optarg);
-			sscanf(modebuf, "%o", &create_mode);
-			break;
-
-		case 'M':
-			dump_mstcpy = 1;
-			break;
-
-		case 'n':
-			ls_all_nodes = 1;
-			break;
-
-		case 'v':
-			verbose = 1;
-			break;
-
-		case 'w':
-			wide = 1;
-			break;
-
-		case 'h':
-			print_usage();
-			exit(EXIT_SUCCESS);
-			break;
-
-		case 'V':
-			printf("%s %s (built %s %s)\n",
-				prog_name, RELEASE_VERSION, __DATE__, __TIME__);
-			printf("%s\n", REDHAT_COPYRIGHT);
-			exit(EXIT_SUCCESS);
-			break;
-
-		case ':':
-		case '?':
-			fprintf(stderr, "Please use '-h' for usage.\n");
-			exit(EXIT_FAILURE);
-			break;
-
-		case EOF:
-			cont = 0;
-			break;
-
-		default:
-			fprintf(stderr, "unknown option: %c\n", optchar);
-			exit(EXIT_FAILURE);
-			break;
-		};
-	}
-
-	need_lsname = 1;
-
-	while (optind < argc) {
-
-		/*
-		 * libdlm
-		 */
-
-		if (!strncmp(argv[optind], "join", 4) &&
-		    (strlen(argv[optind]) == 4)) {
-			operation = OP_JOIN;
-			opt_ind = optind + 1;
-			break;
-		} else if (!strncmp(argv[optind], "leave", 5) &&
-			   (strlen(argv[optind]) == 5)) {
-			operation = OP_LEAVE;
-			opt_ind = optind + 1;
-			break;
-		} else if (!strncmp(argv[optind], "joinleave", 9) &&
-			   (strlen(argv[optind]) == 9)) {
-			operation = OP_JOINLEAVE;
-			opt_ind = optind + 1;
-			break;
-		}
-
-		/*
-		 * libdlmcontrol
-		 */
-
-		else if (!strncmp(argv[optind], "ls", 2) &&
-			   (strlen(argv[optind]) == 2)) {
-			operation = OP_LIST;
-			opt_ind = optind + 1;
-			need_lsname = 0;
-			break;
-		} else if (!strncmp(argv[optind], "deadlock_check", 14) &&
-			   (strlen(argv[optind]) == 14)) {
-			operation = OP_DEADLOCK_CHECK;
-			opt_ind = optind + 1;
-			break;
-		} else if (!strncmp(argv[optind], "dump", 4) &&
-			   (strlen(argv[optind]) == 4)) {
-			operation = OP_DUMP;
-			opt_ind = optind + 1;
-			need_lsname = 0;
-			break;
-		} else if (!strncmp(argv[optind], "plocks", 6) &&
-			   (strlen(argv[optind]) == 6)) {
-			operation = OP_PLOCKS;
-			opt_ind = optind + 1;
-			break;
-		}
-
-		/*
-		 * debugfs
-		 */
-
-		else if (!strncmp(argv[optind], "lockdump", 8) &&
-			   (strlen(argv[optind]) == 8)) {
-			operation = OP_LOCKDUMP;
-			opt_ind = optind + 1;
-			break;
-		} else if (!strncmp(argv[optind], "lockdebug", 9) &&
-			   (strlen(argv[optind]) == 9)) {
-			operation = OP_LOCKDEBUG;
-			opt_ind = optind + 1;
-			break;
-		}
-		optind++;
-	}
-
-	if (!operation || !opt_ind) {
-		print_usage();
-		exit(EXIT_FAILURE);
-	}
-
-	if (optind < argc - 1)
-		lsname = argv[opt_ind];
-	else if (need_lsname) {
-		fprintf(stderr, "lockspace name required\n");
-		exit(EXIT_FAILURE);
-	}
-}
-
-static int do_write(int fd, void *buf, size_t count)
-{
-	int rv, off = 0;
-
- retry:
-	rv = write(fd, buf + off, count);
-	if (rv == -1 && errno == EINTR)
-		goto retry;
-	if (rv < 0)
-		return rv;
-
-	if (rv != count) {
-		count -= rv;
-		off += rv;
-		goto retry;
-	}
-	return 0;
-}
-
-static char *flag_str(uint32_t flags)
-{
-	static char join_flags[128];
-
-	memset(join_flags, 0, sizeof(join_flags));
-
-	strcat(join_flags, "flags ");
-
-	if (flags & DLM_LSFL_NODIR)
-		strcat(join_flags, "NODIR ");
-
-#ifdef LINUX2628rc
-	if (flags & DLM_LSFL_NEWEXCL)
-		strcat(join_flags, "NEWEXCL ");
-#endif
-
-	if (flags & DLM_LSFL_FS)
-		strcat(join_flags, "FS ");
-
-	return join_flags;
-}
-
-void do_join(char *name)
-{
-	dlm_lshandle_t *dh;
-	uint32_t flags = 0;
-
-	if (!opt_dir)
-		flags |= DLM_LSFL_NODIR;
-
-#ifdef LINUX2628rc
-	if (opt_excl)
-		flags |= DLM_LSFL_NEWEXCL;
-#endif
-
-	if (opt_fs)
-		flags |= DLM_LSFL_FS;
-
-	printf("Joining lockspace \"%s\" permission %o %s\n",
-	       name, create_mode, flags ? flag_str(flags) : "");
-	fflush(stdout);
-
-	dh = dlm_new_lockspace(name, create_mode, flags);
-	if (!dh) {
-		fprintf(stderr, "dlm_new_lockspace %s error %d\n",
-			name, errno);
-		exit(-1);
-	}
-
-	dlm_close_lockspace(dh);
-	/* there's no autofree so the ls should stay around */
-	printf("done\n");
-}
-
-void do_leave(char *name)
-{
-	dlm_lshandle_t *dh;
-
-	printf("Leaving lockspace \"%s\"\n", name);
-	fflush(stdout);
-
-	dh = dlm_open_lockspace(name);
-	if (!dh) {
-		fprintf(stderr, "dlm_open_lockspace %s error %p %d\n",
-			name, dh, errno);
-		exit(-1);
-	}
-
-	dlm_release_lockspace(name, dh, 1);
-	printf("done\n");
-}
-
-char *pr_master(int nodeid, uint32_t first_lkid)
-{
-	static char buf[64];
-
-	memset(buf, 0, sizeof(buf));
-
-	if (nodeid > 0)
-		sprintf(buf, "Local %d", nodeid);
-	else if (!nodeid)
-		sprintf(buf, "Master");
-	else if (nodeid == -1)
-		sprintf(buf, "Lookup lkid %08x", first_lkid);
-
-	return buf;
-}
-
-char *pr_recovery(uint32_t flags, int root_list, int recover_list,
-		  int recover_locks_count)
-{
-	static char buf[128];
-
-	memset(buf, 0, sizeof(buf));
-
-	if (flags || root_list || recover_list || recover_locks_count)
-		sprintf(buf, "flags %08x root %d recover %d locks_count %d",
-			flags, root_list, recover_list, recover_locks_count);
-
-	return buf;
-}
-
-void print_rsb(char *line)
-{
-	char type[4], namefmt[4], *p;
-	char addr[64];
-	int rv, nodeid, root_list, recover_list, recover_locks_count, namelen;
-	uint32_t first_lkid, flags;
-
-	rv = sscanf(line, "%s %s %d %u %u %d %d %u %u %s",
-		    type,
-		    addr,
-		    &nodeid,
-		    &first_lkid,
-		    &flags,
-		    &root_list,
-		    &recover_list,
-		    &recover_locks_count,
-		    &namelen,
-		    namefmt);
-
-	if (rv != 10)
-		goto fail;
-
-	/* used for lkb prints */
-	rsb_nodeid = nodeid;
-	
-	p = strchr(line, '\n');
-	if (!p)
-		goto fail;
-	*p = '\0';
-
-	p = strstr(line, namefmt);
-	if (!p)
-		goto fail;
-	p += 4;
-
-	strcat(addr, " ");
-
-	if (!strncmp(namefmt, "str", 3))
-		printf("Resource len %2d  \"%s\"\n", namelen, p);
-	else if (!strncmp(namefmt, "hex", 3))
-		printf("Resource len %2d hex %s\n", namelen, p);
-	else
-		goto fail;
-
-	printf("%-16s %s\n",
-		pr_master(nodeid, first_lkid),
-		pr_recovery(flags, root_list, recover_list, recover_locks_count));
-
-	return;
-
- fail:
-	fprintf(stderr, "print_rsb error rv %d line \"%s\"\n", rv, line);
-}
-
-void print_lvb(char *line)
-{
-	char lvb[1024];
-	char type[4];
-	int i, c, rv, lvblen;
-	uint32_t lvbseq;
-
-	memset(lvb, 0, 1024);
-
-	rv = sscanf(line, "%s %u %d %[0-9A-Fa-f ]", type, &lvbseq, &lvblen, lvb);
-
-	if (rv != 4) {
-		fprintf(stderr, "print_lvb error rv %d line \"%s\"\n", rv, line);
-		return;
-	}
-
-	printf("LVB len %d seq %u\n", lvblen, lvbseq);
-
-	for (c = 0, i = 0; ; i++) {
-		printf("%c", lvb[i]);
-		if (lvb[i] != ' ')
-			c++;
-		if (!wide && lvb[i] == ' ' && !(c % 32))
-			printf("\n");
-		if (c == (lvblen * 2))
-			break;
-	}
-	printf("\n");
-}
-
-struct lkb {
-	uint64_t xid, timestamp, time_bast;
-	uint32_t id, remid, exflags, flags, lvbseq;
-	int nodeid, ownpid, status, grmode, rqmode, highbast, rsb_lookup, wait_type;
-};
-
-char *pr_grmode(struct lkb *lkb)
-{
-	if (lkb->status == DLM_LKSTS_GRANTED || lkb->status == DLM_LKSTS_CONVERT)
-		return mode_str(lkb->grmode);
-	else if (lkb->status == DLM_LKSTS_WAITING || lkb->rsb_lookup)
-		return "--";
-	else
-		return "XX";
-}
-
-char *pr_rqmode(struct lkb *lkb)
-{
-	static char buf[5];
-
-	memset(buf, 0, sizeof(buf));
-
-	if (lkb->status == DLM_LKSTS_GRANTED) {
-		return "    ";
-	} else if (lkb->status == DLM_LKSTS_CONVERT ||
-		   lkb->status == DLM_LKSTS_WAITING ||
-		   lkb->rsb_lookup) {
-		sprintf(buf, "(%s)", mode_str(lkb->rqmode));
-		return buf;
-	} else {
-		return "(XX)";
-	}
-}
-
-char *pr_remote(struct lkb *lkb)
-{
-	static char buf[64];
-
-	memset(buf, 0, sizeof(buf));
-
-	if (!lkb->nodeid) {
-		return "                    ";
-	} else if (lkb->nodeid != rsb_nodeid) {
-		sprintf(buf, "Remote: %3d %08x", lkb->nodeid, lkb->remid);
-		return buf;
-	} else {
-		sprintf(buf, "Master: %3d %08x", lkb->nodeid, lkb->remid);
-		return buf;
-	}
-}
-
-char *pr_wait(struct lkb *lkb)
-{
-	static char buf[16];
-
-	memset(buf, 0, sizeof(buf));
-
-	if (!lkb->wait_type) {
-		return "        ";
-	} else {
-		sprintf(buf, " wait %02d", lkb->wait_type);
-		return buf;
-	}
-}
-
-char *pr_verbose(struct lkb *lkb)
-{
-	static char buf[128];
-
-	memset(buf, 0, sizeof(buf));
-
-	sprintf(buf, "time %016llu flags %08x %08x bast %d %llu",
-		(unsigned long long)lkb->timestamp,
-		lkb->exflags, lkb->flags, lkb->highbast,
-		(unsigned long long)lkb->time_bast);
-
-	return buf;
-}
-
-void print_lkb(char *line)
-{
-	struct lkb lkb;
-	char type[4];
-	int rv;
-
-	rv = sscanf(line, "%s %x %d %x %u %llu %x %x %d %d %d %d %d %d %u %llu %llu",
-		    type,
-		    &lkb.id,
-		    &lkb.nodeid,
-		    &lkb.remid,
-		    &lkb.ownpid,
-		    &lkb.xid,
-		    &lkb.exflags,
-		    &lkb.flags,
-		    &lkb.status,
-		    &lkb.grmode,
-		    &lkb.rqmode,
-		    &lkb.highbast,
-		    &lkb.rsb_lookup,
-		    &lkb.wait_type,
-		    &lkb.lvbseq,
-		    &lkb.timestamp,
-		    &lkb.time_bast);
-
-	if ((lkb.status == DLM_LKSTS_GRANTED) && !print_granted) {
-		printf("Granted\n");
-		print_granted = 1;
-	}
-	if ((lkb.status == DLM_LKSTS_CONVERT) && !print_convert) {
-		printf("Convert\n");
-		print_convert = 1;
-	}
-	if ((lkb.status == DLM_LKSTS_WAITING) && !print_waiting) {
-		printf("Waiting\n");
-		print_waiting = 1;
-	}
-	if (lkb.rsb_lookup && !print_lookup) {
-		printf("Lookup\n");
-		print_lookup = 1;
-	}
-
-	printf("%08x %s %s %s %s %s\n",
-	       lkb.id, pr_grmode(&lkb), pr_rqmode(&lkb),
-	       pr_remote(&lkb), pr_wait(&lkb),
-	       (verbose && wide) ? pr_verbose(&lkb) : "");
-
-	if (verbose && !wide)
-		printf("%s\n", pr_verbose(&lkb));
-}
-
-#define LOCK_LINE_MAX 1024
-
-void do_lockdebug(char *name)
-{
-	FILE *file;
-	char path[PATH_MAX];
-	char line[LOCK_LINE_MAX];
-	int old = 0;
-
-	snprintf(path, PATH_MAX, "/sys/kernel/debug/dlm/%s_all", name);
-
-	file = fopen(path, "r");
-	if (!file) {
-		snprintf(path, PATH_MAX, "/sys/kernel/debug/dlm/%s", name);
-		file = fopen(path, "r");
-		if (!file) {
-			fprintf(stderr, "can't open %s: %s\n", path, strerror(errno));
-			return;
-		}
-		old = 1;
-	}
-
-	while (fgets(line, LOCK_LINE_MAX, file)) {
-
-		if (old)
-			goto raw;
-
-		if (!strncmp(line, "version", 7))
-			continue;
-
-		if (!strncmp(line, "rsb", 3)) {
-			rsb_nodeid = -9;
-			print_granted = print_convert = print_waiting = print_lookup = 0;
-			printf("\n");
-			print_rsb(line);
-			continue;
-		}
-		
-		if (!strncmp(line, "lvb", 3)) {
-			print_lvb(line);
-			continue;
-		}
-		
-		if (!strncmp(line, "lkb", 3)) {
-			print_lkb(line);
-			continue;
-		}
- raw:
-		printf("%s", line);
-	}
-	fclose(file);
-}
-
-void parse_r_name(char *line, char *name)
-{
-	char *p;
-	int i = 0;
-	int begin = 0;
-
-	for (p = line; ; p++) {
-		if (*p == '"') {
-			if (begin)
-				break;
-			begin = 1;
-			continue;
-		}
-		if (begin)
-			name[i++] = *p;
-	}
-}
-
-void do_lockdump(char *name)
-{
-	FILE *file;
-	char path[PATH_MAX];
-	char line[LOCK_LINE_MAX];
-	char r_name[65];
-	int r_nodeid;
-	int r_len;
-	int rv;
-	unsigned int time;
-	unsigned long long xid;
-	uint32_t	id;
-	int		nodeid;
-	uint32_t	remid;
-	int		ownpid;
-	uint32_t	exflags;
-	uint32_t	flags;
-	int8_t		status;
-	int8_t		grmode;
-	int8_t		rqmode;
-
-	snprintf(path, PATH_MAX, "/sys/kernel/debug/dlm/%s_locks", name);
-
-	file = fopen(path, "r");
-	if (!file) {
-		fprintf(stderr, "can't open %s: %s\n", path, strerror(errno));
-		return;
-	}
-
-	/* skip the header on the first line */
-	if(!fgets(line, LOCK_LINE_MAX, file)) {
-		fprintf(stderr, "can't read %s: %s\n", path, strerror(errno));
-		return;
-	}
-
-	while (fgets(line, LOCK_LINE_MAX, file)) {
-		rv = sscanf(line, "%x %d %x %u %llu %x %x %hhd %hhd %hhd %u %d %d",
-		       &id,
-		       &nodeid,
-		       &remid,
-		       &ownpid,
-		       &xid,
-		       &exflags,
-		       &flags,
-		       &status,
-		       &grmode,
-		       &rqmode,
-		       &time,
-		       &r_nodeid,
-		       &r_len);
-
-		if (rv != 13) {
-			fprintf(stderr, "invalid debugfs line %d: %s\n",
-				rv, line);
-			return;
-		}
-
-		memset(r_name, 0, sizeof(r_name));
-		parse_r_name(line, r_name);
-
-		/* don't print MSTCPY locks without -M */
-		if (!r_nodeid && nodeid) {
-			if (!dump_mstcpy)
-				continue;
-			printf("id %08x gr %s rq %s pid %u MSTCPY %d \"%s\"\n",
-				id, mode_str(grmode), mode_str(rqmode),
-				ownpid, nodeid, r_name);
-			continue;
-		}
-
-		/* A hack because dlm-kernel doesn't set rqmode back to IV when
-		   a NOQUEUE convert fails, which means in a lockdump it looks
-		   like a granted lock is still converting since rqmode is not
-		   IV.  (does it make sense to include status in the output,
-		   e.g. G,C,W?) */
-
-		if (status == DLM_LKSTS_GRANTED)
-			rqmode = LKM_IVMODE;
-
-		printf("id %08x gr %s rq %s pid %u master %d \"%s\"\n",
-			id, mode_str(grmode), mode_str(rqmode),
-			ownpid, nodeid, r_name);
-	}
-
-	fclose(file);
-}
-
-static char *dlmc_lf_str(uint32_t flags)
-{
-	static char str[128];
-	int i = 0;
-
-	memset(str, 0, sizeof(str));
-
-	if (flags & DLMC_LF_SAVE_PLOCKS) {
-		i++;
-		strcat(str, "save_plock");
-	}
-	if (flags & DLMC_LF_NEED_PLOCKS) {
-		strcat(str, i++ ? "," : "");
-		strcat(str, "need_plock");
-	}
-	if (flags & DLMC_LF_FS_REGISTERED) {
-		strcat(str, i++ ? "," : "");
-		strcat(str, "fs_reg");
-	}
-	if (flags & DLMC_LF_KERNEL_STOPPED) {
-		strcat(str, i++ ? "," : "");
-		strcat(str, "kern_stop");
-	}
-	if (flags & DLMC_LF_LEAVING) {
-		strcat(str, i++ ? "," : "");
-		strcat(str, "leave");
-	}
-	if (flags & DLMC_LF_JOINING) {
-		strcat(str, i++ ? "," : "");
-		strcat(str, "join");
-	}
-
-	return str;
-}
-
-static char *nf_check_str(uint32_t flags)
-{
-	if (flags & DLMC_NF_CHECK_FENCING)
-		return "fence";
-
-	if (flags & DLMC_NF_CHECK_QUORUM)
-		return "quorum";
-
-	if (flags & DLMC_NF_CHECK_FS)
-		return "fs";
-
-	return "none";
-}
-
-static char *condition_str(int cond)
-{
-	switch (cond) {
-	case 0:
-		return "";
-	case 1:
-		return "fencing";
-	case 2:
-		return "quorum";
-	case 3:
-		return "fs";
-	case 4:
-		return "pending";
-	default:
-		return "unknown";
-	}
-}
-
-static int node_compare(const void *va, const void *vb)
-{
-	const struct dlmc_node *a = va;
-	const struct dlmc_node *b = vb;
-
-	return a->nodeid - b->nodeid;
-}
-
-static void show_nodeids(int count, struct dlmc_node *nodes)
-{
-	struct dlmc_node *n = nodes;
-	int i;
-
-	for (i = 0; i < count; i++) {
-		printf("%d ", n->nodeid);
-		n++;
-	}
-	printf("\n");
-}
-
-static void show_ls(struct dlmc_lockspace *ls)
-{
-	int rv, node_count;
-
-	printf("name          %s\n", ls->name);
-	printf("id            0x%08x\n", ls->global_id);
-	printf("flags         0x%08x %s\n",
-		ls->flags, dlmc_lf_str(ls->flags));
-	printf("change        member %d joined %d remove %d failed %d seq %d,%d\n",
-		ls->cg_prev.member_count, ls->cg_prev.joined_count,
-		ls->cg_prev.remove_count, ls->cg_prev.failed_count,
-		ls->cg_prev.combined_seq, ls->cg_prev.seq);
-
-	node_count = 0;
-	memset(&nodes, 0, sizeof(nodes));
-	rv = dlmc_lockspace_nodes(ls->name, DLMC_NODES_MEMBERS,
-				  MAX_NODES, &node_count, nodes);
-	if (rv < 0) {
-		printf("members       error\n");
-		goto next;
-	}
-	qsort(nodes, node_count, sizeof(struct dlmc_node), node_compare);
-
-	printf("members       ");
-	show_nodeids(node_count, nodes);
-
- next:
-	if (!ls->cg_next.seq)
-		return;
-
-	printf("new change    member %d joined %d remove %d failed %d seq %d,%d\n",
-		ls->cg_next.member_count, ls->cg_next.joined_count,
-		ls->cg_next.remove_count, ls->cg_next.failed_count,
-	        ls->cg_next.combined_seq, ls->cg_next.seq);
-
-	printf("new status    wait_messages %d wait_condition %d %s\n",
-		ls->cg_next.wait_messages, ls->cg_next.wait_condition,
-		condition_str(ls->cg_next.wait_condition));
-
-	node_count = 0;
-	memset(&nodes, 0, sizeof(nodes));
-	rv = dlmc_lockspace_nodes(ls->name, DLMC_NODES_NEXT,
-				  MAX_NODES, &node_count, nodes);
-	if (rv < 0) {
-		printf("new members   error\n");
-		return;
-	}
-	qsort(nodes, node_count, sizeof(struct dlmc_node), node_compare);
-
-	printf("new members   ");
-	show_nodeids(node_count, nodes);
-}
-
-static int member_int(struct dlmc_node *n)
-{
-	if (n->flags & DLMC_NF_DISALLOWED)
-		return -1;
-	if (n->flags & DLMC_NF_MEMBER)
-		return 1;
-	return 0;
-}
-
-static void show_all_nodes(int count, struct dlmc_node *nodes)
-{
-	struct dlmc_node *n = nodes;
-	int i;
-
-	for (i = 0; i < count; i++) {
-		printf("nodeid %d member %d failed %d start %d seq_add %u seq_rem %u check %s\n",
-			n->nodeid,
-			member_int(n),
-			n->failed_reason,
-			(n->flags & DLMC_NF_START) ? 1 : 0,
-			n->added_seq,
-			n->removed_seq,
-			nf_check_str(n->flags));
-		n++;
-	}
-}
-
-static void do_list(char *name)
-{
-	struct dlmc_lockspace *ls;
-	int node_count;
-	int ls_count;
-	int rv;
-	int i;
-
-	memset(lss, 0, sizeof(lss));
-
-	if (name) {
-		rv = dlmc_lockspace_info(name, lss);
-		if (rv < 0)
-			return;
-		ls_count = 1;
-	} else {
-		rv = dlmc_lockspaces(MAX_LS, &ls_count, lss);
-		if (rv < 0)
-			return;
-	}
-
-	if (ls_count)
-		printf("dlm lockspaces\n");
-
-	for (i = 0; i < ls_count; i++) {
-		ls = &lss[i];
-
-		show_ls(ls);
-
-		if (!ls_all_nodes)
-			goto next;
-
-		node_count = 0;
-		memset(&nodes, 0, sizeof(nodes));
-
-		rv = dlmc_lockspace_nodes(ls->name, DLMC_NODES_ALL,
-					  MAX_NODES, &node_count, nodes);
-		if (rv < 0) {
-			printf("all nodes error %d %d\n", rv, errno);
-			goto next;
-		}
-
-		qsort(nodes, node_count, sizeof(struct dlmc_node),node_compare);
-
-		printf("all nodes\n");
-		show_all_nodes(node_count, nodes);
- next:
-		printf("\n");
-	}
-}
-
-static void do_deadlock_check(char *name)
-{
-	dlmc_deadlock_check(name);
-}
-
-static void do_plocks(char *name)
-{
-	char buf[DLMC_DUMP_SIZE];
-
-	memset(buf, 0, sizeof(buf));
-
-	dlmc_dump_plocks(name, buf);
-
-	do_write(STDOUT_FILENO, buf, strlen(buf));
-}
-
-static void do_dump(void)
-{
-	char buf[DLMC_DUMP_SIZE];
-
-	memset(buf, 0, sizeof(buf));
-
-	dlmc_dump_debug(buf);
-
-	do_write(STDOUT_FILENO, buf, strlen(buf));
-}
-
-int main(int argc, char **argv)
-{
-	prog_name = argv[0];
-	decode_arguments(argc, argv);
-
-	switch (operation) {
-
-	/* calls to libdlm; pass a command to dlm-kernel */
-
-	case OP_JOIN:
-		do_join(lsname);
-		break;
-
-	case OP_LEAVE:
-		do_leave(lsname);
-		break;
-
-	case OP_JOINLEAVE:
-		do_join(lsname);
-		do_leave(lsname);
-		break;
-
-	/* calls to libdlmcontrol; pass a command/query to dlm_controld */
-
-	case OP_LIST:
-		do_list(lsname);
-		break;
-
-	case OP_DUMP:
-		do_dump();
-		break;
-
-	case OP_PLOCKS:
-		do_plocks(lsname);
-		break;
-
-	case OP_DEADLOCK_CHECK:
-		do_deadlock_check(lsname);
-		break;
-
-	/* calls to read debugfs; query info from dlm-kernel */
-
-	case OP_LOCKDUMP:
-		do_lockdump(lsname);
-		break;
-
-	case OP_LOCKDEBUG:
-		do_lockdebug(lsname);
-		break;
-	}
-	return 0;
-}
-
diff --git a/fence/Makefile b/fence/Makefile
deleted file mode 100644
index dd9b33d..0000000
--- a/fence/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../make/defines.mk
-include $(OBJDIR)/make/passthrough.mk
-
-SUBDIRS=agents libfence libfenced fenced fence_node fence_tool man
diff --git a/fence/agents/Makefile b/fence/agents/Makefile
deleted file mode 100644
index 7c963ae..0000000
--- a/fence/agents/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
-include ../../make/defines.mk
-
-SUBDIRS = ${fence_agents} lib
-
-all: ${SUBDIRS}
-
-%:
-	set -e && \
-	for i in ${SUBDIRS}; do \
-		if [ "$$i" = "xvm" ] && [ "${enable_virt}" != "1" ] && [ "$@" != "clean" ]; then \
-			continue; \
-		else \
-			${MAKE} -C $$i $@; \
-		fi; \
-	done
diff --git a/fence/agents/alom/Makefile b/fence/agents/alom/Makefile
deleted file mode 100644
index 6efc272..0000000
--- a/fence/agents/alom/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-include ../../../make/defines.mk
-
-TARGET= fence_alom
-
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/alom/fence_alom.py b/fence/agents/alom/fence_alom.py
deleted file mode 100644
index 9f10650..0000000
--- a/fence/agents/alom/fence_alom.py
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/usr/bin/python
-
-# The Following Agent Has Been Tested On:
-#
-# Sun(tm) Advanced Lights Out Manager CMT v1.6.1
-# as found on SUN T2000 Niagara
-
-import sys, re, pexpect, time
-sys.path.append("@FENCEAGENTSLIBDIR@")
-from fencing import *
-
-#BEGIN_VERSION_GENERATION
-RELEASE_VERSION="Sun Advanced Lights Out Manager (ALOM)"
-REDHAT_COPYRIGHT=""
-BUILD_DATE=""
-#END_VERSION_GENERATION
-
-def get_power_status(conn, options):
-	result = ""
-	try:
-		conn.sendline("showplatform")
-                conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
-		status = re.search("standby",conn.before.lower())
-		result=(status!=None and "off" or "on")
-	except pexpect.EOF:
-		fail(EC_CONNECTION_LOST)
-	except pexpect.TIMEOUT:
-		fail(EC_TIMED_OUT)
-
-	return result
-
-def set_power_status(conn, options):
-	try:
-		cmd_line=(options["-o"]=="on" and "poweron" or "poweroff -f -y")
-		conn.sendline(cmd_line)
-		conn.log_expect(options, options["-c"],POWER_TIMEOUT)
-		#Get the machine some time between poweron and poweroff
-		time.sleep(POWER_TIMEOUT)
-		
-	except pexpect.EOF:
-		fail(EC_CONNECTION_LOST)
-	except pexpect.TIMEOUT:
-		fail(EC_TIMED_OUT)
-		
-def main():
-	device_opt = [  "help", "version", "agent", "quiet", "verbose", "debug",
-			"action", "ipaddr", "login", "passwd", "passwd_script",
-			"secure",  "test" ]
-
-	options = check_input(device_opt, process_input(device_opt))
-
-	# Default command is sc>
-	if (not options.has_key("-c")):
-            options["-c"] = "sc\>\ "
-
-	# Default to ssh
-	options["-x"] = 1
-	options["telnet_over_ssh"] = 1
-		
-	# Operate the fencing device
-	conn = fence_login(options)
-	fence_action(conn, options, set_power_status, get_power_status,None)
-
-	# Logout from system
-	conn.sendline("logout")
-	conn.close()
-
-if __name__ == "__main__":
-	main()
diff --git a/fence/agents/apc/Makefile b/fence/agents/apc/Makefile
deleted file mode 100644
index 88cd004..0000000
--- a/fence/agents/apc/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-include ../../../make/defines.mk
-
-TARGET= fence_apc
-
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/apc/fence_apc.py b/fence/agents/apc/fence_apc.py
deleted file mode 100755
index 653d214..0000000
--- a/fence/agents/apc/fence_apc.py
+++ /dev/null
@@ -1,216 +0,0 @@
-#!/usr/bin/python
-
-#####
-##
-## The Following Agent Has Been Tested On:
-##
-##  Model       Firmware
-## +---------------------------------------------+
-##  AP7951	AOS v2.7.0, PDU APP v2.7.3
-##  AP7941      AOS v3.5.7, PDU APP v3.5.6
-##  AP9606	AOS v2.5.4, PDU APP v2.7.3
-##
-## @note: ssh is very slow on AP79XX devices protocol (1) and 
-##        cipher (des/blowfish) have to be defined
-#####
-
-import sys, re, pexpect, exceptions
-sys.path.append("@FENCEAGENTSLIBDIR@")
-from fencing import *
-
-#BEGIN_VERSION_GENERATION
-RELEASE_VERSION="New APC Agent - test release on steroids"
-REDHAT_COPYRIGHT=""
-BUILD_DATE="March, 2008"
-#END_VERSION_GENERATION
-
-def get_power_status(conn, options):
-	result = ""
-	outlets = {}
-	try:
-		conn.send("1\r\n")
-		conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
-
-		version = 0
-		admin = 0
-		switch = 0;
-
-		if (None != re.compile('.* MasterSwitch plus.*', re.IGNORECASE | re.S).match(conn.before)):
-			switch = 1;
-			if (None != re.compile('.* MasterSwitch plus 2', re.IGNORECASE | re.S).match(conn.before)):
-				if (0 == options.has_key("-s")):
-					fail_usage("Failed: You have to enter physical switch number")
-			else:
-				if (0 == options.has_key("-s")):
-					options["-s"] = "1"
-
-		if (None == re.compile('.*Outlet Management.*', re.IGNORECASE | re.S).match(conn.before)):
-			version = 2
-		else:
-			version = 3
-
-		if (None == re.compile('.*Outlet Control/Configuration.*', re.IGNORECASE | re.S).match(conn.before)):
-			admin = 0
-		else:
-			admin = 1
-
-		if switch == 0:
-			if version == 2:
-				if admin == 0:
-					conn.send("2\r\n")
-				else:
-					conn.send("3\r\n")
-			else:
-				conn.send("2\r\n")
-				conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
-				conn.send("1\r\n")
-		else:
-			conn.send(options["-s"]+"\r\n")
-			
-		while 1 == conn.log_expect(options, [ options["-c"],  "Press <ENTER>" ], SHELL_TIMEOUT):
-			result += conn.before
-			lines = conn.before.split("\n");
-			show_re = re.compile('^\s*(\d+)- (.*?)\s+(ON|OFF)\s*$')
-			for x in lines:
-				res = show_re.search(x)
-				if (res != None):
-					outlets[res.group(1)] = (res.group(2), res.group(3))
-			conn.send("\r\n")
-		result += conn.before
-		conn.send(chr(03))		
-		conn.log_expect(options, "- Logout", SHELL_TIMEOUT)
-		conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
-	except pexpect.EOF:
-		fail(EC_CONNECTION_LOST)
-	except pexpect.TIMEOUT:
-		fail(EC_TIMED_OUT)
-
-	if ["list", "monitor"].count(options["-o"]) == 1:
-		return outlets
-	else:
-		status = re.compile("\s*"+options["-n"]+"-.*(ON|OFF)", re.IGNORECASE).search(result).group(1)
-		return status.lower().strip()
-
-def set_power_status(conn, options):
-	action = {
-		'on' : "1",
-		'off': "2"
-	}[options["-o"]]
-
-	try:
-		conn.send("1\r\n")
-		conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
-
-		version = 0
-		admin = 0
-		switch = 0
-
-		if (None != re.compile('.* MasterSwitch plus.*', re.IGNORECASE | re.S).match(conn.before)):
-			switch = 1;
-			## MasterSwitch has different schema for on/off actions
-			action = {
-				'on' : "1",
-				'off': "3"
-			}[options["-o"]]
-			if (None != re.compile('.* MasterSwitch plus 2', re.IGNORECASE | re.S).match(conn.before)):
-				if (0 == options.has_key("-s")):
-					fail_usage("Failed: You have to enter physical switch number")
-			else:
-				if (0 == options.has_key("-s")):
-					options["-s"] = 1
-
-		if (None == re.compile('.*Outlet Management.*', re.IGNORECASE | re.S).match(conn.before)):
-			version = 2
-		else:
-			version = 3
-
-		if (None == re.compile('.*Outlet Control/Configuration.*', re.IGNORECASE | re.S).match(conn.before)):
-			admin = 0
-		else:
-			admin = 1
-
-		if switch == 0:
-			if version == 2:
-				if admin == 0:
-					conn.send("2\r\n")
-				else:
-					conn.send("3\r\n")
-			else:
-				conn.send("2\r\n")
-				conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
-				conn.send("1\r\n")
-		else:
-			conn.send(options["-s"] + "\r\n")
-
-		while 1 == conn.log_expect(options, [ options["-c"],  "Press <ENTER>" ], SHELL_TIMEOUT):
-			conn.send("\r\n")
-		conn.send(options["-n"]+"\r\n")
-		conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
-
-		if switch == 0:
-			if admin == 1:
-				conn.send("1\r\n")
-				conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
-			if version == 3:
-				conn.send("1\r\n")
-				conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
-		else:
-			conn.send("1\r\n")
-			conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
-			
-		conn.send(action+"\r\n")
-		conn.log_expect(options, "Enter 'YES' to continue or <ENTER> to cancel :", SHELL_TIMEOUT)
-		conn.send("YES\r\n")
-		conn.log_expect(options, "Press <ENTER> to continue...", SHELL_TIMEOUT)
-		conn.send("\r\n")
-		conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
-		conn.send(chr(03))
-		conn.log_expect(options, "- Logout", SHELL_TIMEOUT)
-		conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
-	except pexpect.EOF:
-		fail(EC_CONNECTION_LOST)
-	except pexpect.TIMEOUT:
-		fail(EC_TIMED_OUT)
-
-def main():
-	device_opt = [  "help", "version", "agent", "quiet", "verbose", "debug",
-			"action", "ipaddr", "login", "passwd", "passwd_script",
-			"secure", "port", "switch", "test", "separator" ]
-
-	options = check_input(device_opt, process_input(device_opt))
-
-	## 
-	## Fence agent specific defaults
-	#####
-	options["ssh_options"] = "-1 -c blowfish"
-
-	if 0 == options.has_key("-c"):
-		options["-c"] = "\n>"
-
-	## Support for -n [switch]:[plug] notation that was used before
-	if (options.has_key("-n") == 1) and (-1 != options["-n"].find(":")):
-		(switch, plug) = options["-n"].split(":", 1)
-		options["-s"] = switch;
-		options["-n"] = plug;
-
-	##
-	## Operate the fencing device
-	####
-	conn = fence_login(options)
-	fence_action(conn, options, set_power_status, get_power_status, get_power_status)
-
-	##
-	## Logout from system
-	##
-	## In some special unspecified cases it is possible that 
-	## connection will be closed before we run close(). This is not 
-	## a problem because everything is checked before.
-	######
-	try:
-		conn.sendline("4")
-		conn.close()
-	except exceptions.OSError:
-		pass
-
-if __name__ == "__main__":
-	main()
diff --git a/fence/agents/apc_snmp/Makefile b/fence/agents/apc_snmp/Makefile
deleted file mode 100644
index d5da610..0000000
--- a/fence/agents/apc_snmp/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-TARGET= fence_apc_snmp
-MIBRESOURCE= powernet369.mib
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/apc_snmp/README b/fence/agents/apc_snmp/README
deleted file mode 100644
index 75aa37a..0000000
--- a/fence/agents/apc_snmp/README
+++ /dev/null
@@ -1,45 +0,0 @@
-This is an snmp based fence agent for APC power switches to be used
-with RHEL4 Red Hat Cluster Suite.
-
-The reasons to use this agent rather than the current fence_apc agent are:
-1) This script has been tested with EVERY powerswitch that APC currently
-makes.
-2) It will work on many older models that are no longer supported by APC.
-I have been told that it even works with the AP9200 switch. Older switches
-usually don't do well with the fence_apc script.
-3) This agent works with large power switches that have more than 8 outlets.
-The fence_apc script will also, in the next update -- this script will work for you now.
-
-If feedback on this beta version of the agent is good, and if ganged switches 
-can be supported, then this agent may replace fence_apc.
-
-In order to use this agent, you will need to have net-snmp-utils installed 
-on every node in your cluster. net-snmp-utils is scheduled for inclusion 
-in the base RHEL distribution for Update 4, and is yummable in FC5.
-
-After net-snmp-utils is installed, there will be a directory named:
-/usr/share/snmp/mibs/
-
-Place the accompanying powernet369.mib file in this directory.
-
-To use the agent, cp the agent to the /sbin directory on every
-cluster node. The interface for the fence_apc_snmp agent is identical to
-the existing fence_apc agent, so if you are using APC for fencing in 
-your cluster, you *could* backup your current fence_apc agent, and 
-rename this agent from fence_apc_snmp to fence_apc, and it should just work.
-
-NOTE: The fence_apc_snmp agent does not yet support ganged or 'daisy-chained'
-APC switches. 
-
-If you would rather not copy over your fence_apc agent, you can still use 
-the fence_apc_snmp agent by dropping it into /sbin on every node, and then
-defining a <fencedevice> in the cluster.conf file with agent="fence_apc_snmp"
-as an attribute, and use it that way. Note, please, that the GUI does
-not support this agent yet, and you will have to edit your cluster.conf 
-by hand and then propagate it yourself. If you need help with this, email
-me on linux-cluster or at the address below.
-
-Big thanks to Nate Straz who laid the foundation for this agent.
-
-Please let me know how this agent works.
---Jim Parsons - jparsons@redhat.com
diff --git a/fence/agents/apc_snmp/fence_apc_snmp.py b/fence/agents/apc_snmp/fence_apc_snmp.py
deleted file mode 100644
index b7a8c8a..0000000
--- a/fence/agents/apc_snmp/fence_apc_snmp.py
+++ /dev/null
@@ -1,455 +0,0 @@
-#!/usr/bin/python
-
-#############################################################################
-## This APC Fence script uses snmp to control the APC power
-## switch. This script requires that net-snmp-utils be installed
-## on all nodes in the cluster, and that the powernet369.mib file be
-## located in @MIBDIR@
-#############################################################################
-
-import getopt, sys
-import os
-import datetime
-import time
-import select
-import signal
-from glob import glob
-
-#BEGIN_VERSION_GENERATION
-RELEASE_VERSION=""
-REDHAT_COPYRIGHT=""
-BUILD_DATE=""
-#END_VERSION_GENERATION
-
-POWER_ON="outletOn"
-POWER_OFF="outletOff"
-POWER_REBOOT="outletReboot"
-
-
-# oid defining fence device 
-oid_sysObjectID = '.1.3.6.1.2.1.1.2.0'
-
-
-
-class SNMP:
-	def __init__(self, params):
-		self.hostname  = params['ipaddr']
-		self.udpport   = params['udpport']
-		self.community = params['community']
-	
-	def get(self, oid):
-		args = ['@SNMPBIN@/snmpget']
-		args.append('-Oqn')
-		args.append('-v')
-		args.append('1')
-		args.append('-c')
-		args.append(self.community)
-		args.append('-m')
-		args.append('ALL')
-		args.append(self.hostname + ':' + self.udpport)
-		args.append(oid)
-		strr, code = execWithCaptureStatus("@SNMPBIN@/snmpget", args)
-		if code:
-			raise Exception, 'snmpget failed'
-		l = strr.strip().split()
-		return l[0], ' '.join(l[1:])
-	
-	def set_int(self, oid, value):
-		args = ['@SNMPBIN@/snmpset']
-		args.append('-Oqn')
-		args.append('-v')
-		args.append('1')
-		args.append('-c')
-		args.append(self.community)
-		args.append('-m')
-		args.append('ALL')
-		args.append(self.hostname + ':' + self.udpport)
-		args.append(oid)
-		args.append('i')
-		args.append(str(value))
-		strr,code = execWithCaptureStatus("@SNMPBIN@/snmpset", args)
-		if code:
-			raise Exception, 'snmpset failed'
-		
-	def walk(self, oid):
-		args = ['@SNMPBIN@/snmpwalk']
-		args.append('-Oqn')
-		args.append('-v')
-		args.append('1')
-		args.append('-c')
-		args.append(self.community)
-		args.append('-m')
-		args.append('ALL')
-		args.append(self.hostname + ':' + self.udpport)
-		args.append(oid)
-		strr,code = execWithCaptureStatus("@SNMPBIN@/snmpwalk", args)
-		if code:
-			raise Exception, 'snmpwalk failed'
-		lines = strr.strip().splitlines()
-		ret = []
-		for line in lines:
-			l = line.strip().split()
-			ret.append((l[0], ' '.join(l[1:]).strip('"')))
-		return ret
-	
-
-
-class FenceAgent:
-	
-	def __init__(self, params):
-	   self.snmp = SNMP(params)
-	
-	def resolve_outlet(self):
-		raise Exception, 'resolve_outlet() not implemented'
-	
-	def status(self):
-		oid = self.status_oid % self.resolve_outlet()
-		dummy, stat = self.snmp.get(oid)
-		if stat == self.state_on or stat == "outletStatusOn":
-			return 'on'
-		elif stat == self.state_off or stat == "outletStatusOff":
-			return 'off'
-		else:
-			raise Exception, 'invalid status ' + stat
-	
-	def power_off(self):
-		oid = self.control_oid % self.resolve_outlet()
-		self.snmp.set_int(oid, self.turn_off)
-	
-	def power_on(self):
-		oid = self.control_oid % self.resolve_outlet()
-		self.snmp.set_int(oid, self.turn_on)
-	
-
-
-
-		
-
-		
-
-class MasterSwitch(FenceAgent):
-	
-	def __init__(self, params):
-	   FenceAgent.__init__(self, params)
-	   
-	   self.status_oid       = '.1.3.6.1.4.1.318.1.1.12.3.5.1.1.4.%s'
-	   self.control_oid      = '.1.3.6.1.4.1.318.1.1.12.3.3.1.1.4.%s'
-	   self.outlet_table_oid = '.1.3.6.1.4.1.318.1.1.12.3.5.1.1.2'
-	   
-	   self.state_on  = '1'
-	   self.state_off = '2'
-	   
-	   self.turn_on   = '1'
-	   self.turn_off  = '2'
-	   
-	   self.port = params['port']
-	
-	def resolve_outlet(self):
-		outlet = None
-		try:
-			outlet = str(int(self.port))
-		except:
-			table = self.snmp.walk(self.outlet_table_oid)
-			for row in table:
-				if row[1] == self.port:
-					t = row[0].strip().split('.')
-					outlet = t[len(t)-1]
-		if outlet == None:
-			raise Exception, 'unable to resolve ' + self.port
-		else:
-			self.port = outlet
-		return outlet
-	
-	
-class MasterSwitchPlus(FenceAgent):
-	def __init__(self, params):
-	   FenceAgent.__init__(self, params)
-	   
-	   self.status_oid       = '.1.3.6.1.4.1.318.1.1.6.7.1.1.5.%s.1.%s'
-	   self.control_oid      = '.1.3.6.1.4.1.318.1.1.6.5.1.1.5.%s.1.%s'
-	   self.outlet_table_oid = '.1.3.6.1.4.1.318.1.1.6.7.1.1.4'
-	   
-	   self.state_on  = '1'
-	   self.state_off = '2'
-	   
-	   self.turn_on   = '1'
-	   self.turn_off  = '3'
-	   
-	   try:
-		   self.switch = params['switch']
-	   except:
-		   self.switch = ''
-	   self.port   = params['port']
-   
-	def resolve_outlet(self):
-		switch = None
-		outlet = None
-		try:
-			switch = str(int(self.switch))
-			outlet = str(int(self.port))
-		except:
-			table = self.snmp.walk(self.outlet_table_oid)
-			for row in table:
-				if row[1] == self.port:
-					t = row[0].strip().split('.')
-					outlet = t[len(t)-1]
-					switch = t[len(t)-3]
-		if outlet == None:
-			raise Exception, 'unable to resolve ' + self.port
-		else:
-			self.switch = switch
-			self.port   = outlet
-		return (switch, outlet)
-	
-
-
-
-	
-
-def usage():
-        print "Usage:"
-        print ""
-        print "Options:"
-        print "  -h               Usage"
-        print "  -a <ip>          IP address or hostname of fence device"
-        print "  -u <udpport>     UDP port to use (default 161)"
-        print "  -c <community>   SNMP community (default 'private')"
-        print "  -n <num>         Outlet name/number to act on"
-        print "  -o <string>      Action: reboot (default), on, off or status"
-        print "  -v               Verbose mode - write to @LOGDIR@/fence_apc_snmp.log"
-        print "  -V               Version"
-	
-        sys.exit(0)
-
-
-
-file_log = None
-def set_logging(verbose):
-	global file_log
-	if verbose:
-		file_log = open('@LOGDIR@/fence_apc_snmp.log', 'a')
-		file_log.write('\n-----------  ')
-		file_log.write(datetime.datetime.today().ctime())
-		file_log.write('  -----------\n')
-def log(msg, error=False):
-	global file_log
-	if msg.rfind('\n') != len(msg)-1:
-		msg += '\n'
-	if file_log != None:
-		file_log.write(msg)
-	if error:
-		o = sys.stderr
-	else:
-		o = sys.stdout
-	o.write(msg)
-
-
-
-def main():
-	try:
-		main2()
-		return 0
-	except Exception, e:
-		log(str(e), True)
-		sys.exit(1)
-def main2():
-  
-  agents_dir = {'.1.3.6.1.4.1.318.1.3.4.5' : MasterSwitch,
-		'.1.3.6.1.4.1.318.1.3.4.4' : MasterSwitchPlus}
-  
-  verbose = False
-  params = {}
-  
-  if len(sys.argv) > 1:
-    try:
-      opts, args = getopt.getopt(sys.argv[1:], "ha:u:c:n:o:vV", ["help", "output="])
-    except getopt.GetoptError:
-      usage()
-      sys.exit(2)
-
-    for o, a in opts:
-      o = o.strip()
-      a = a.strip()
-      if o == "-v":
-        verbose = True
-      if o == "-V":
-        print "%s\n" % RELEASE_VERSION
-        print "%s\n" % REDHAT_COPYRIGHT
-        print "%s\n" % BUILD_DATE
-        sys.exit(0)
-      if o in ("-h", "--help"):
-        usage()
-	sys.exit(0)
-      if o == "-a":
-        params['ipaddr'] = a
-      if o == "-u":
-        params['udpport'] = a
-      if o == "-c":
-        params['community'] = a
-      if o == "-n":
-        switch = ''
-	port   = a
-	if ':' in port:
-	   idx = port.find(':')
-	   switch = port[:idx]
-	   port = port[idx+1:]
-	params['switch'] = switch
-	params['port']   = port
-      if o == "-o":
-        params['option'] = a.lower()
-
-  else: #Get opts from stdin 
-    for line in sys.stdin:
-      val = line.strip().split("=")
-      if len(val) == 2:
-         o = val[0].strip().lower()
-	 a = val[1].strip()
-	 if o == 'verbose':
-	    if a.lower() == 'on' or a.lower() == 'true' or a == '1':
-	       verbose = True
-	 else:
-	    params[o] = a 
-	
-    
-  set_logging(verbose)
-  
-  
-  ### validation ###
-  
-  try:
-	  if params['ipaddr'] == '':
-		  raise Exception, 'missing ipadddr'
-  except:
-	  log("FENCE: Missing ipaddr param for fence_apc_snmp...exiting", True)
-	  sys.exit(1)
-  if 'udpport' not in params:
-	  params['udpport'] = '161'
-  try:
-	  t = int(params['udpport'])
-	  if t >= 65536 or t < 0:
-		  raise Exception, 'invalid udpport'
-  except:
-	  log("FENCE: Invalid udpport for fence_apc_snmp...exiting", True)
-	  sys.exit(1)
-  if 'community' not in params:
-	  params['community'] = 'private'
-  try:
-	  port = params['port']
-	  if len(port) == 0:
-		  raise Exception, 'missing port'
-  except:
-	  log("FENCE: Missing port param for fence_apc_snmp...exiting", True)
-	  sys.exit(1)
-  if 'switch' not in params:
-	  params['switch'] = ''
-
-  if 'option' not in params:
-          params['option'] = 'reboot'
-  try:
-	  act = params['option'].lower()
-	  if act in ['on', 'off', 'reboot', 'status']:
-		  params['option'] = act
-	  else:
-		  raise Exception
-  except:
-          usage()
-          sys.exit(3)
-	  
-  ### End of validation ###
-
-  if verbose:
-     log('called with ' + str(params))
-  
-  agent = None
-  dummy, sys_id = SNMP(params).get(oid_sysObjectID)
-  if sys_id not in agents_dir:
-     log('Fence device with \'oid_sysObjectID=' + sys_id + '\' is not supported', True)
-     sys.exit(1)
-  agent = agents_dir[sys_id](params)
-  
-  if params['option'] == 'status':
-	  log('Outlet "%s" - %s is %s' % (params['port'], 
-					  str(agent.resolve_outlet()),
-					  agent.status()))
-  elif params['option'] == 'on':
-	  agent.power_on()
-	  if agent.status() != 'on':
-		  raise Exception, 'Error turning outlet on'
-  elif params['option'] == 'off':
-	  agent.power_off()
-	  if agent.status() != 'off':
-		  raise Exception, 'Error turning outlet off'
-  elif params['option'] == 'reboot':
-	  agent.power_off()
-          time.sleep(3)
-	  if agent.status() != 'off':
-		  raise Exception, 'Error turning outlet off'
-	  agent.power_on()
-	  if agent.status() != 'on':
-		  raise Exception, 'Error turning outlet on'
-  else:
-	  print 'nothing to do'
-	  sys.exit(1)
-	  pass
-  
-
-  
-def execWithCaptureStatus(command, argv, searchPath = 0, root = '/', stdin = 0,
-			  catchfd = 1, closefd = -1):
-	
-    if not os.access (root + command, os.X_OK):
-        raise Exception, command + " cannot be run"
-    
-    (read, write) = os.pipe()
-    
-    childpid = os.fork()
-    if (not childpid):
-        if (root and root != '/'): os.chroot (root)
-        if isinstance(catchfd, tuple):
-            for fd in catchfd:
-                os.dup2(write, fd)
-        else:
-            os.dup2(write, catchfd)
-        os.close(write)
-        os.close(read)
-	
-        if closefd != -1:
-            os.close(closefd)
-	
-        if stdin:
-            os.dup2(stdin, 0)
-            os.close(stdin)
-	
-        if (searchPath):
-            os.execvp(command, argv)
-        else:
-            os.execv(command, argv)
-	
-        sys.exit(1)
-    
-    os.close(write)
-    
-    rc = ""
-    s = "1"
-    while (s):
-        select.select([read], [], [])
-        s = os.read(read, 1000)
-        rc = rc + s
-    
-    os.close(read)
-    
-    try:
-        (pid, status) = os.waitpid(childpid, 0)
-    except OSError, (errno, msg):
-        print __name__, "waitpid:", msg
-    
-    if os.WIFEXITED(status) and (os.WEXITSTATUS(status) == 0):
-        status = os.WEXITSTATUS(status)
-    else:
-        status = -1
-    
-    return (rc, status)
-
-if __name__ == "__main__":
-	ret = main()
-	sys.exit(ret)
diff --git a/fence/agents/apc_snmp/powernet369.mib b/fence/agents/apc_snmp/powernet369.mib
deleted file mode 100644
index ab948f8..0000000
--- a/fence/agents/apc_snmp/powernet369.mib
+++ /dev/null
@@ -1,31109 +0,0 @@
--- *************************************************************************
--- AMERICAN POWER CONVERSION PowerNet-MIB
--- *************************************************************************
--- Copyright (c) 2005 American Power Conversion, Inc.
--- PowerNet is a Trademark of American Power Conversion Corp.
---
--- Title: APC TOP LEVEL PowerNet MIB
---
--- Version : 3.6.9
---
--- Generated by script: tomib.awk
---
--- Input File: powernetPS.mib
---
--- Created: Wednesday, January, 26, 2005
---
--- Revision History:
--- *************************************************************************
-
---          - v3.2.0 Added functionality for MasterSwitch Plus
---          - v3.3.0 Added functionality for MX28B (dcDM3) and 3-phase UPS
---          - v3.3.2 New traps for Symmetra PX UPS
--- 07/15/01 - v3.4.0 Added transfer switch
---          - v3.4.3 Added functionality for External and Integrated Environmental Monitor
--- 06/14/02 - v3.4.4 Added dcmim2(Siemens) branch, Battery Manager(Reading) traps, and
---                         Psx Traps for PDU and RM-PDU and Netlock branch/traps
--- 06/18/02 - v3.5.0a Sync Control Group support
--- 08/06/02 - v3.5.0a Environmental Management System branch/traps
--- 09/16/02 - v3.5.0b Fixed some odds/ends ... going to RM-PDU for MS additions
--- 09/25/02 - v3.5.0c MS3 additions
--- 11/05/02 - v3.5.0e More Environmental Management System/A-Link devices(ARU)
--- 11/22/02 - v3.5.0g Added General APC device status OID
--- 11/27/02 - v3.5.0h Wrapped up MS3 ((Controlled or Metered) Rack PDU) changes
--- 12/26/02 - v3.5.1a Changed MS3 name again, Controlled to Switched Rack PDU
--- 01/07/03 - v3.6.0a Added OIDs/Traps for UPS Switchable Outlet Groups.
--- 01/09/03 -         Adding the General APC device discovery OIDs (hidden)
--- 01/28/03 - v3.6.0c Made some small trap pair fixes for Switched Rack PDU (MS3) 
--- 02/13/03 - v3.6.0d Mods from the review and some EMS fixes.
---                    Added OID for the new 20kVA Symmetra 3 Phase type.
---                    Added OIDs to upsAdvConfig for Symmetra type UPSs.
---                    Added upsDiagnostics branch OID for Symmetra module information.
--- 04/05/03 - v3.6.2  Added OID for the new Smart-UPS 7500 and 10000 types.
--- 06/04/03 - v3.6.3  Added OIDs/Traps for AirFM.
--- 06/24/03 - v3.6.4  Moved some AirFM temps and humidities from system level to module level.
--- 10/24/03 - v3.6.4a Added OIDs/Traps for xPDU.
--- 10/27/03 - v3.6.4f Added AirPA OIDs.
--- 11/03/03 - v3.6.4g Merge of 3.6.4e and 3.6.4f
--- 11/07/03 - v3.6.4h Additional review corrections
--- 12/01/03 - v3.6.5a Added group OIDs for Air FM.  Added C & F OIDs for Air PA setpoint.
--- 12/19/03 - v3.6.5b Review corrections.
--- 02/23/04 - v3.6.5c Added Modbus to experimental and multiple CB(bank) rPDU support
--- 05/05/04 - v3.6.6  Adding EMS status OID and trap for H/W issues, redefined duplicate 
---                     trap #228 (to ARU Device config change) and minor clean-up
--- 05/12/04 - v3.6.7a Added Air FM alarm status OIDs.
--- 06/03/04 - v3.6.7b Added UPS Config for Simple Signal Shutdowns and Number of External
---                    batteries.  Added Mute option to the UPS Config Audible Alarm.
--- 07/12/04 - v3.6.7d Removed Air FM alarm status OIDs due to delay in release.
--- 07/14/04 - v3.6.7d Added a detailed description to the UPSAdvConfigAlarm OID
--- 07/14/04 - v3.6.7e Added Custom Event traps
--- 08/04/04 - v3.6.7  Tag for final builds, see v3.6.7 beta build notes for changes
--- 08/26/04 - v3.6.8a Added new traps for UPS internal over temperature fault and cleared.
--- 09/01/04 - v3.6.8b Adding new thresholds for EMS probe config & status
--- 09/08/04 - v3.6.8c Corrections from MIB review.
--- 09/30/04 - v3.6.8d Added new traps for AIS ^F Message events.
--- 10/21/04 - v3.6.8e EMS.  Added missing traps and new Rate functionality.
--- 10/22/04 - v3.6.8f Added resetNetworkLeaveModeAndRestart option to the mcontrolRestartAgent OID.
--- 10/28/04 - v3.6.8g Updated EMS sections from mib committee review.
--- 11/22/04 - v3.6.8  Tag for final build.
--- 12/02/04 - v3.6.9a Added OIDs and traps for BMS-HVA.
--- 12/20/04 - v3.6.9c corrections to xPDU.
--- 12/20/04 - v3.6.9c added OIDs and traps for xATS.
--- 01/03/05 - v3.6.9d removed traps for xATS.
--- 01/03/05 - v3.6.9e correction to xATS entries, that removed underscores (mib browser incompatibility)
--- 01/07/05 - v3.6.9f
--- 01/14/05 - v3.6.9g add xPDU OIDs and traps and some corrections.
--- 01/14/05 - v3.6.9g modifications to xATS OIDs and traps.
-
--- *************************************************************************
--- *************************************************************************
--- PowerNet-MIB { iso org(3) dod(6) internet(1) private(4)
---    enterprises(1) apc(318) }
-
-PowerNet-MIB DEFINITIONS ::= BEGIN
-
-IMPORTS
-   enterprises, IpAddress, Gauge, TimeTicks             FROM RFC1155-SMI
-   DisplayString                                        FROM RFC1213-MIB
-   OBJECT-TYPE                                          FROM RFC-1212
-   TRAP-TYPE                                            FROM RFC-1215;
-
-apc                            OBJECT IDENTIFIER ::=  { enterprises 318 }
-
-products                       OBJECT IDENTIFIER ::=  { apc 1 }
-apcmgmt                        OBJECT IDENTIFIER ::=  { apc 2 }
-
-hardware                       OBJECT IDENTIFIER ::=  { products 1 }
-software                       OBJECT IDENTIFIER ::=  { products 2 }
-system                         OBJECT IDENTIFIER ::=  { products 3 }
-experimental                   OBJECT IDENTIFIER ::=  { products 4 }
-
-mconfig                        OBJECT IDENTIFIER ::=  { apcmgmt 1 }
-mcontrol                       OBJECT IDENTIFIER ::=  { apcmgmt 2 }
-mtrapargs                      OBJECT IDENTIFIER ::=  { apcmgmt 3 }
-mfiletransfer                  OBJECT IDENTIFIER ::=  { apcmgmt 4 }
-
-mconfigClock                   OBJECT IDENTIFIER ::=  { mconfig 6 }
-
-mfiletransferStatus            OBJECT IDENTIFIER ::=  { mfiletransfer 1 }
-mfiletransferConfig            OBJECT IDENTIFIER ::=  { mfiletransfer 2 }
-mfiletransferControl           OBJECT IDENTIFIER ::=  { mfiletransfer 3 }
-
-mfiletransferConfigSettings    OBJECT IDENTIFIER ::=  { mfiletransferConfig 1 }
-mfiletransferConfigTFTP        OBJECT IDENTIFIER ::=  { mfiletransferConfig 2 }
-mfiletransferConfigFTP         OBJECT IDENTIFIER ::=  { mfiletransferConfig 3 }
-
-ups                            OBJECT IDENTIFIER ::=  { hardware 1 }
-measureUps                     OBJECT IDENTIFIER ::=  { hardware 2 }
-miniSNMPadapter                OBJECT IDENTIFIER ::=  { hardware 3 }
-masterswitch                   OBJECT IDENTIFIER ::=  { hardware 4 }
-masterswitchVM                 OBJECT IDENTIFIER ::=  { hardware 5 }
-masterswitchMSP                OBJECT IDENTIFIER ::=  { hardware 6 }
-dcDM3                          OBJECT IDENTIFIER ::=  { hardware 7 }
-automaticTransferSwitch        OBJECT IDENTIFIER ::=  { hardware 8 }
-dc2                            OBJECT IDENTIFIER ::=  { hardware 9 }
-environmentalMonitor           OBJECT IDENTIFIER ::=  { hardware 10 }
-netlock                        OBJECT IDENTIFIER ::=  { hardware 11 }
-rPDU                           OBJECT IDENTIFIER ::=  { hardware 12 }
-airConditioners                OBJECT IDENTIFIER ::=  { hardware 13 }
-rARU                           OBJECT IDENTIFIER ::=  { hardware 14 }
-xPDU                           OBJECT IDENTIFIER ::=  { hardware 15 }
-battMan                        OBJECT IDENTIFIER ::=  { hardware 16 }
-xATS                           OBJECT IDENTIFIER ::=  { hardware 17 }
-generator                      OBJECT IDENTIFIER ::=  { hardware 18 }
-
-powerNetSubAgent               OBJECT IDENTIFIER ::=  { software 1 }
-
-powerNetSoftwareSystem         OBJECT IDENTIFIER ::=  { powerNetSubAgent 1 }
-powerNetSoftwareConfig         OBJECT IDENTIFIER ::=  { powerNetSubAgent 2 }
-
-backUPS                        OBJECT IDENTIFIER ::=  { system  1 }
-smartUPS                       OBJECT IDENTIFIER ::=  { system  2 }
-matrixUPS                      OBJECT IDENTIFIER ::=  { system  3 }
-masterSwitch                   OBJECT IDENTIFIER ::=  { system  4 }
-symmetraUPS                    OBJECT IDENTIFIER ::=  { system  5 }
-dp100E                         OBJECT IDENTIFIER ::=  { system  6 }
-dp300E                         OBJECT IDENTIFIER ::=  { system  7 }
-monitors                       OBJECT IDENTIFIER ::=  { system  8 }
-redundantSwitch                OBJECT IDENTIFIER ::=  { system  9 }
-dcPower                        OBJECT IDENTIFIER ::=  { system  10 }
-automaticXferSwitch            OBJECT IDENTIFIER ::=  { system  11 }
-netLock                        OBJECT IDENTIFIER ::=  { system  12 }
-symmetra3PhaseUPS              OBJECT IDENTIFIER ::=  { system  13 }
-networkAir                     OBJECT IDENTIFIER ::=  { system  14 }
-infraXurePDU                   OBJECT IDENTIFIER ::=  { system  15 }
-ais5000UPS                     OBJECT IDENTIFIER ::=  { system  16 }
-smartUPS3Phase                 OBJECT IDENTIFIER ::=  { system  17 }
-battManager                    OBJECT IDENTIFIER ::=  { system  18 }
-infraXureATS                   OBJECT IDENTIFIER ::=  { system  19 }
-
-battManIdent                   OBJECT IDENTIFIER ::=  { battMan 1 }
-battManSystemCalib             OBJECT IDENTIFIER ::=  { battMan 2 }
-battManUnitCalib               OBJECT IDENTIFIER ::=  { battMan 3 }
-battManStringCalib             OBJECT IDENTIFIER ::=  { battMan 4 }
-battManBatteryCalib            OBJECT IDENTIFIER ::=  { battMan 5 }
-battManConfig                  OBJECT IDENTIFIER ::=  { battMan 6 }
-battManAlarm                   OBJECT IDENTIFIER ::=  { battMan 7 }
-battManSystemStatus            OBJECT IDENTIFIER ::=  { battMan 8 }
-battManStringStatus            OBJECT IDENTIFIER ::=  { battMan 9 }
-battManBatteryStatus           OBJECT IDENTIFIER ::=  { battMan 10 }
-battManInputContactStatus      OBJECT IDENTIFIER ::=  { battMan 11 }
-battManControl                 OBJECT IDENTIFIER ::=  { battMan 12 }
-battManTestResults             OBJECT IDENTIFIER ::=  { battMan 13 }
-
-xPDUIdent                      OBJECT IDENTIFIER ::=  { xPDU 1 }
-xPDUDevice                     OBJECT IDENTIFIER ::=  { xPDU 2 }
-xPDUACMonitoringPoint          OBJECT IDENTIFIER ::=  { xPDU 3 }
-xPDUCircuitBreakers            OBJECT IDENTIFIER ::=  { xPDU 4 }
-xPDUInputContacts              OBJECT IDENTIFIER ::=  { xPDU 5 }
-xPDUOutputRelays               OBJECT IDENTIFIER ::=  { xPDU 6 }
-xPDUMiscGroup                  OBJECT IDENTIFIER ::=  { xPDU 7 }
-
-xPDUMainInput                  OBJECT IDENTIFIER ::=  { xPDUACMonitoringPoint 1 }
-xPDUBypassInput                OBJECT IDENTIFIER ::=  { xPDUACMonitoringPoint 2 }
-xPDUUPSInput                   OBJECT IDENTIFIER ::=  { xPDUACMonitoringPoint 3 }
-xPDUSystemOutput               OBJECT IDENTIFIER ::=  { xPDUACMonitoringPoint 4 }
-xPDUGroundMonitorPoint         OBJECT IDENTIFIER ::=  { xPDUACMonitoringPoint 5 }
-
-xPDUSystemBreakers             OBJECT IDENTIFIER ::=  { xPDUCircuitBreakers 1 }
-xPDUBranchBreakers             OBJECT IDENTIFIER ::=  { xPDUCircuitBreakers 2 }
-
-xATSIdent                      OBJECT IDENTIFIER ::=  { xATS 1 }
-xATSDevice                     OBJECT IDENTIFIER ::=  { xATS 2 }
-xATSSwitch                     OBJECT IDENTIFIER ::=  { xATS 3 }
-xATSACMonitoringPoint          OBJECT IDENTIFIER ::=  { xATS 4 }
-xATSTesting                    OBJECT IDENTIFIER ::=  { xATS 5 }
-xATSInputContacts              OBJECT IDENTIFIER ::=  { xATS 6 }
-xATSOutputRelays               OBJECT IDENTIFIER ::=  { xATS 7 }
-xATSMisc                       OBJECT IDENTIFIER ::=  { xATS 8 }
-
-xATSSwitchStatus               OBJECT IDENTIFIER ::=  { xATSSwitch 1 }
-xATSSwitchSettings             OBJECT IDENTIFIER ::=  { xATSSwitch 2 }
-xATSSwitchTimers               OBJECT IDENTIFIER ::=  { xATSSwitch 3 }
-xATSSwitchBlockMap             OBJECT IDENTIFIER ::=  { xATSSwitch 4 }
-xATSSwitchStatistics           OBJECT IDENTIFIER ::=  { xATSSwitch 5 }
-
-xATSSource1                    OBJECT IDENTIFIER ::=  { xATSACMonitoringPoint 1 }
-xATSSource2                    OBJECT IDENTIFIER ::=  { xATSACMonitoringPoint 2 }
-xATSSystemOutput               OBJECT IDENTIFIER ::=  { xATSACMonitoringPoint 3 }
-
-xATSTestingStatus              OBJECT IDENTIFIER ::=  { xATSTesting 1 }
-xATSTestingResults             OBJECT IDENTIFIER ::=  { xATSTesting 2 }
-xATSTestingSchedule            OBJECT IDENTIFIER ::=  { xATSTesting 3 }
-xATSTestingSimulatePowerFail   OBJECT IDENTIFIER ::=  { xATSTesting 4 }
-
-xATSGenerator                  OBJECT IDENTIFIER ::=  { generator 1 }
-
-xATSGeneratorIdent             OBJECT IDENTIFIER ::=  { xATSGenerator 1 }
-xATSGeneratorStatus            OBJECT IDENTIFIER ::=  { xATSGenerator 2 }
-xATSGeneratorAdvStatus         OBJECT IDENTIFIER ::=  { xATSGenerator 3 }
-xATSGeneratorOutput            OBJECT IDENTIFIER ::=  { xATSGenerator 4 }
-xATSGeneratorSettings          OBJECT IDENTIFIER ::=  { xATSGenerator 5 }
-xATSGeneratorService           OBJECT IDENTIFIER ::=  { xATSGenerator 6 }
-xATSGeneratorFuelSystem        OBJECT IDENTIFIER ::=  { xATSGenerator 7 }
-
-
-smartUPS250                    OBJECT IDENTIFIER ::=  { smartUPS  1 }
-smartUPS400                    OBJECT IDENTIFIER ::=  { smartUPS  2 }
-smartUPS600                    OBJECT IDENTIFIER ::=  { smartUPS  3 }
-smartUPS900                    OBJECT IDENTIFIER ::=  { smartUPS  4 }
-smartUPS1250                   OBJECT IDENTIFIER ::=  { smartUPS  5 }
-smartUPS2000                   OBJECT IDENTIFIER ::=  { smartUPS  6 }
-
-smartUPS450                    OBJECT IDENTIFIER ::=  { smartUPS  7 }
-smartUPS700                    OBJECT IDENTIFIER ::=  { smartUPS  8 }
-smartUPS1000                   OBJECT IDENTIFIER ::=  { smartUPS  9 }
-smartUPS1400                   OBJECT IDENTIFIER ::=  { smartUPS  10 }
-smartUPS2200                   OBJECT IDENTIFIER ::=  { smartUPS  11 }
-smartUPS3000                   OBJECT IDENTIFIER ::=  { smartUPS  12 }
-smartUPS5000                   OBJECT IDENTIFIER ::=  { smartUPS  13 }
-smartUPS7500                   OBJECT IDENTIFIER ::=  { smartUPS  14 }
-smartUPS10000                  OBJECT IDENTIFIER ::=  { smartUPS  15 }
-smartUPS1500                   OBJECT IDENTIFIER ::=  { smartUPS  16 }
-
-matrixUPS3000                  OBJECT IDENTIFIER ::=  { matrixUPS 1 }
-matrixUPS5000                  OBJECT IDENTIFIER ::=  { matrixUPS 2 }
-
-masterSwitchV1                 OBJECT IDENTIFIER ::=  { masterSwitch 1}
-masterSwitchV2                 OBJECT IDENTIFIER ::=  { masterSwitch 2}
-masterSwitchVM                 OBJECT IDENTIFIER ::=  { masterSwitch 3}
-masterSwitchMSP                OBJECT IDENTIFIER ::=  { masterSwitch 4}
-masterSwitchrPDU               OBJECT IDENTIFIER ::=  { masterSwitch 5}
-
-symmetraUPS4kVA                OBJECT IDENTIFIER ::=  { symmetraUPS 1 }
-symmetraUPS8kVA                OBJECT IDENTIFIER ::=  { symmetraUPS 2 }
-symmetraUPS12kVA               OBJECT IDENTIFIER ::=  { symmetraUPS 3 }
-symmetraUPS16kVA               OBJECT IDENTIFIER ::=  { symmetraUPS 4 }
-
-environmental                  OBJECT IDENTIFIER ::=  { monitors  1 }
-environmentalMgtSystem         OBJECT IDENTIFIER ::=  { monitors  2 }
-emu2                           OBJECT IDENTIFIER ::=  { monitors  3 }
-
-dm3                            OBJECT IDENTIFIER ::=  { dcPower  1 }
-dcmim2                         OBJECT IDENTIFIER ::=  { dcPower  2 }
-
-symmetra3PhaseUPS40kVA         OBJECT IDENTIFIER ::=  { symmetra3PhaseUPS 1 }
-symmetra3PhaseUPS60kVA         OBJECT IDENTIFIER ::=  { symmetra3PhaseUPS 2 }
-symmetra3PhaseUPS80kVA         OBJECT IDENTIFIER ::=  { symmetra3PhaseUPS 3 }
-symmetra3PhaseUPS20kVA         OBJECT IDENTIFIER ::=  { symmetra3PhaseUPS 4 }
-
-airFMSeries                    OBJECT IDENTIFIER ::=  { networkAir 1 }
-rackAirRemovalUnit             OBJECT IDENTIFIER ::=  { networkAir 2 }
-airPASeries                    OBJECT IDENTIFIER ::=  { networkAir 3 }  
-
-ais5000UPS10kVA                OBJECT IDENTIFIER ::=  { ais5000UPS  1 }
-ais5000UPS20kVA                OBJECT IDENTIFIER ::=  { ais5000UPS  2 }
-ais5000UPS30kVA                OBJECT IDENTIFIER ::=  { ais5000UPS  3 }
-ais5000UPS40kVA                OBJECT IDENTIFIER ::=  { ais5000UPS  4 }
-ais5000UPS60kVA                OBJECT IDENTIFIER ::=  { ais5000UPS  5 }
-ais5000UPS80kVA                OBJECT IDENTIFIER ::=  { ais5000UPS  6 }
-ais5000UPS100kVA               OBJECT IDENTIFIER ::=  { ais5000UPS  7 }
-
-smartUPS3Phase10kVA            OBJECT IDENTIFIER ::=  { smartUPS3Phase  1 }
-smartUPS3Phase15kVA            OBJECT IDENTIFIER ::=  { smartUPS3Phase  2 }
-smartUPS3Phase20kVA            OBJECT IDENTIFIER ::=  { smartUPS3Phase  3 }
-smartUPS3Phase30kVA            OBJECT IDENTIFIER ::=  { smartUPS3Phase  4 }
-smartUPS3Phase40kVA            OBJECT IDENTIFIER ::=  { smartUPS3Phase  5 }
-
-upsIdent                       OBJECT IDENTIFIER ::=  { ups 1 }
-upsBattery                     OBJECT IDENTIFIER ::=  { ups 2 }
-upsInput                       OBJECT IDENTIFIER ::=  { ups 3 }
-upsOutput                      OBJECT IDENTIFIER ::=  { ups 4 }
-upsConfig                      OBJECT IDENTIFIER ::=  { ups 5 }
-upsControl                     OBJECT IDENTIFIER ::=  { ups 6 }
-upsTest                        OBJECT IDENTIFIER ::=  { ups 7 }
-upsComm                        OBJECT IDENTIFIER ::=  { ups 8 }
-upsPhase                       OBJECT IDENTIFIER ::=  { ups 9 }
-upsSyncCtrlGroup               OBJECT IDENTIFIER ::=  { ups 10 }
-upsState                       OBJECT IDENTIFIER ::=  { ups 11 }
-upsOutletGroups                OBJECT IDENTIFIER ::=  { ups 12 }
-upsDiagnostics                 OBJECT IDENTIFIER ::=  { ups 13 }
-
-upsBasicIdent                  OBJECT IDENTIFIER ::=  { upsIdent 1 }
-upsAdvIdent                    OBJECT IDENTIFIER ::=  { upsIdent 2 }
-
-upsBasicBattery                OBJECT IDENTIFIER ::=  { upsBattery 1 }
-upsAdvBattery                  OBJECT IDENTIFIER ::=  { upsBattery 2 }
-
-upsBasicInput                  OBJECT IDENTIFIER ::=  { upsInput 1 }
-upsAdvInput                    OBJECT IDENTIFIER ::=  { upsInput 2 }
-
-upsBasicOutput                 OBJECT IDENTIFIER ::=  { upsOutput 1 }
-upsAdvOutput                   OBJECT IDENTIFIER ::=  { upsOutput 2 }
-
-upsBasicConfig                 OBJECT IDENTIFIER ::=  { upsConfig 1 }
-upsAdvConfig                   OBJECT IDENTIFIER ::=  { upsConfig 2 }
-
-upsBasicControl                OBJECT IDENTIFIER ::=  { upsControl 1 }
-upsAdvControl                  OBJECT IDENTIFIER ::=  { upsControl 2 }
-
-upsBasicTest                   OBJECT IDENTIFIER ::=  { upsTest 1 }
-upsAdvTest                     OBJECT IDENTIFIER ::=  { upsTest 2 }
-
-upsPhaseResetValues            OBJECT IDENTIFIER ::=  { upsPhase 1 }
-upsPhaseInput                  OBJECT IDENTIFIER ::=  { upsPhase 2 }
-upsPhaseOutput                 OBJECT IDENTIFIER ::=  { upsPhase 3 }
-
-upsSyncCtrlGroupConfig         OBJECT IDENTIFIER ::=  { upsSyncCtrlGroup 1 }
-upsSyncCtrlGroupStatus         OBJECT IDENTIFIER ::=  { upsSyncCtrlGroup 2 }
-
-upsBasicState                  OBJECT IDENTIFIER ::=  { upsState 1 }
-upsAdvState                    OBJECT IDENTIFIER ::=  { upsState 2 }
-
-upsOutletGroupStatus           OBJECT IDENTIFIER ::=  { upsOutletGroups 1 }
-upsOutletGroupConfig           OBJECT IDENTIFIER ::=  { upsOutletGroups 2 }
-upsOutletGroupControl          OBJECT IDENTIFIER ::=  { upsOutletGroups 3 }
-
-upsDiagnosticIM                OBJECT IDENTIFIER ::=  { upsDiagnostics 1 }
-upsDiagnosticPowerModules      OBJECT IDENTIFIER ::=  { upsDiagnostics 2 }
-upsDiagnosticBatteries         OBJECT IDENTIFIER ::=  { upsDiagnostics 3 }
-upsDiagnosticSubsystem         OBJECT IDENTIFIER ::=  { upsDiagnostics 4 }
-upsDiagnosticExternalDevices   OBJECT IDENTIFIER ::=  { upsDiagnostics 5 }
-upsDiagnosticComBus            OBJECT IDENTIFIER ::=  { upsDiagnostics 6 }
-
-upsDiagSwitchGear              OBJECT IDENTIFIER ::=  { upsDiagnosticExternalDevices 1 }
-upsDiagMCCBBox                 OBJECT IDENTIFIER ::=  { upsDiagnosticExternalDevices 2 }
-upsDiagTransformer             OBJECT IDENTIFIER ::=  { upsDiagnosticExternalDevices 3 }
-
-mUpsEnviron                    OBJECT IDENTIFIER ::=  { measureUps 1 }
-mUpsContact                    OBJECT IDENTIFIER ::=  { measureUps 2 }
-
-serialPort                     OBJECT IDENTIFIER ::=  { miniSNMPadapter 1}
-
-serialPort1                    OBJECT IDENTIFIER ::=  { serialPort 1}
-serialPort2                    OBJECT IDENTIFIER ::=  { serialPort 2}
-
-serialPort2Config              OBJECT IDENTIFIER ::=  { serialPort2 1}
-serialPort2Control             OBJECT IDENTIFIER ::=  { serialPort2 2}
-
-sPDUIdent                      OBJECT IDENTIFIER ::=  { masterswitch 1 }
-sPDUMasterControl              OBJECT IDENTIFIER ::=  { masterswitch 2 }    
-sPDUMasterConfig               OBJECT IDENTIFIER ::=  { masterswitch 3 }
-sPDUOutletControl              OBJECT IDENTIFIER ::=  { masterswitch 4 }
-sPDUOutletConfig               OBJECT IDENTIFIER ::=  { masterswitch 5 }
-
-sPDUIdentVM                    OBJECT IDENTIFIER ::=  { masterswitchVM 1 }
-sPDUMasterControlVM            OBJECT IDENTIFIER ::=  { masterswitchVM 2 }    
-sPDUMasterConfigVM             OBJECT IDENTIFIER ::=  { masterswitchVM 3 }
-sPDUMasterStatusVM             OBJECT IDENTIFIER ::=  { masterswitchVM 4 }
-sPDUOutletControlVM            OBJECT IDENTIFIER ::=  { masterswitchVM 5 }
-sPDUOutletConfigVM             OBJECT IDENTIFIER ::=  { masterswitchVM 6 }
-sPDUOutletStatusVM             OBJECT IDENTIFIER ::=  { masterswitchVM 7 }
-
-sPDUIdentMSP                   OBJECT IDENTIFIER ::=  { masterswitchMSP 1 }
-sPDUMasterControlMSP           OBJECT IDENTIFIER ::=  { masterswitchMSP 2 }    
-sPDUMasterConfigMSP            OBJECT IDENTIFIER ::=  { masterswitchMSP 3 }
-sPDUMasterStatusMSP            OBJECT IDENTIFIER ::=  { masterswitchMSP 4 }
-sPDUOutletControlMSP           OBJECT IDENTIFIER ::=  { masterswitchMSP 5 }
-sPDUOutletConfigMSP            OBJECT IDENTIFIER ::=  { masterswitchMSP 6 }
-sPDUOutletStatusMSP            OBJECT IDENTIFIER ::=  { masterswitchMSP 7 }
-
-sPDUOutletConfigMSPall         OBJECT IDENTIFIER ::=  { sPDUOutletConfigMSP 1 }
-sPDUOutletConfigMSPgs          OBJECT IDENTIFIER ::=  { sPDUOutletConfigMSP 2 }
-sPDUOutletConfigMSPannun       OBJECT IDENTIFIER ::=  { sPDUOutletConfigMSP 3 }
-sPDUOutletConfigMSPmups        OBJECT IDENTIFIER ::=  { sPDUOutletConfigMSP 4 }
-
-rPDUIdent                      OBJECT IDENTIFIER ::=  { rPDU 1 }
-rPDULoad                       OBJECT IDENTIFIER ::=  { rPDU 2 }    
-rPDUOutlet                     OBJECT IDENTIFIER ::=  { rPDU 3 }
-rPDUPowerSupply                OBJECT IDENTIFIER ::=  { rPDU 4 }
-
-rPDULoadDevice                 OBJECT IDENTIFIER ::=  { rPDULoad 1 }
-rPDULoadPhaseConfig            OBJECT IDENTIFIER ::=  { rPDULoad 2 }    
-rPDULoadStatus                 OBJECT IDENTIFIER ::=  { rPDULoad 3 }
-rPDULoadBankConfig             OBJECT IDENTIFIER ::=  { rPDULoad 4 }    
-
-rPDUOutletDevice               OBJECT IDENTIFIER ::=  { rPDUOutlet 1 }
-rPDUOutletPhase                OBJECT IDENTIFIER ::=  { rPDUOutlet 2 }
-rPDUOutletControl              OBJECT IDENTIFIER ::=  { rPDUOutlet 3 }
-rPDUOutletConfig               OBJECT IDENTIFIER ::=  { rPDUOutlet 4 }    
-rPDUOutletStatus               OBJECT IDENTIFIER ::=  { rPDUOutlet 5 }
-rPDUOutletBank                 OBJECT IDENTIFIER ::=  { rPDUOutlet 6 }
-
-rPDUPowerSupplyDevice          OBJECT IDENTIFIER ::=  { rPDUPowerSupply 1 }
-
-dm3Ident                       OBJECT IDENTIFIER ::=  { dcDM3 1 }
-dm3Config                      OBJECT IDENTIFIER ::=  { dcDM3 2 }
-dm3Status                      OBJECT IDENTIFIER ::=  { dcDM3 3 }
-
-dm3IdentSystem                 OBJECT IDENTIFIER ::=  { dm3Ident 1}
-
-dm3ConfigSystem                OBJECT IDENTIFIER ::=  { dm3Config 1 }
-dm3ConfigLVD                   OBJECT IDENTIFIER ::=  { dm3Config 2 }
-dm3ConfigBattery               OBJECT IDENTIFIER ::=  { dm3Config 3 }
-dm3ConfigPowerModules          OBJECT IDENTIFIER ::=  { dm3Config 4 }
-dm3ConfigRelays                OBJECT IDENTIFIER ::=  { dm3Config 5 }
-dm3ConfigDistribution          OBJECT IDENTIFIER ::=  { dm3Config 6 }
-
-dm3ConfigRectifier             OBJECT IDENTIFIER ::=  { dm3ConfigPowerModules 1 }
-dm3ConfigConverter             OBJECT IDENTIFIER ::=  { dm3ConfigPowerModules 2 }
-
-dm3ConfigRectThresh            OBJECT IDENTIFIER ::=  { dm3ConfigRectifier 1 }
-dm3ConfigRectAlarms            OBJECT IDENTIFIER ::=  { dm3ConfigRectifier 2 }
-
-dm3ConfigConvThresh            OBJECT IDENTIFIER ::=  { dm3ConfigConverter 1 }
-dm3ConfigConvAlarms            OBJECT IDENTIFIER ::=  { dm3ConfigConverter 2 }
-
-dm3ConfigOutputRelays          OBJECT IDENTIFIER ::=  { dm3ConfigRelays 1 }
-dm3ConfigInputRelays           OBJECT IDENTIFIER ::=  { dm3ConfigRelays 2 }
-
-dm3ConfigBreakers              OBJECT IDENTIFIER ::=  { dm3ConfigDistribution 1 }
-dm3ConfigFuses                 OBJECT IDENTIFIER ::=  { dm3ConfigDistribution 2 }
-
-dm3StatusSystem                OBJECT IDENTIFIER ::=  { dm3Status 1 }
-dm3StatusAlarms                OBJECT IDENTIFIER ::=  { dm3Status 2 }
-dm3StatusBattery               OBJECT IDENTIFIER ::=  { dm3Status 3 }
-dm3StatusOEM                   OBJECT IDENTIFIER ::=  { dm3Status 4 }
-dm3StatusLVD                   OBJECT IDENTIFIER ::=  { dm3Status 5 }
-dm3StatusPowerModules          OBJECT IDENTIFIER ::=  { dm3Status 6 }
-dm3StatusRelays                OBJECT IDENTIFIER ::=  { dm3Status 7 }
-dm3StatusDistribution          OBJECT IDENTIFIER ::=  { dm3Status 8 }
-
-dm3StatusRectifier             OBJECT IDENTIFIER ::=  { dm3StatusPowerModules 1 }
-dm3StatusConverter             OBJECT IDENTIFIER ::=  { dm3StatusPowerModules 2 }
-
-dm3StatusOutputRelays          OBJECT IDENTIFIER ::=  { dm3StatusRelays 1 }
-dm3StatusInputRelays           OBJECT IDENTIFIER ::=  { dm3StatusRelays 2 }
-
-dm3StatusBreakers              OBJECT IDENTIFIER ::=  { dm3StatusDistribution 1 }
-dm3StatusFuses                 OBJECT IDENTIFIER ::=  { dm3StatusDistribution 2 }
-
-atsIdent                       OBJECT IDENTIFIER ::=  { automaticTransferSwitch 1 }
-atsCalibration                 OBJECT IDENTIFIER ::=  { automaticTransferSwitch 2 } 
-atsControl                     OBJECT IDENTIFIER ::=  { automaticTransferSwitch 3 }    
-atsConfig                      OBJECT IDENTIFIER ::=  { automaticTransferSwitch 4 }
-atsStatus                      OBJECT IDENTIFIER ::=  { automaticTransferSwitch 5 }
-
-atsCalibrationInput            OBJECT IDENTIFIER ::=  { atsCalibration 1 }
-atsCalibrationPowerSupply      OBJECT IDENTIFIER ::=  { atsCalibration 2 }
-atsCalibrationOutput           OBJECT IDENTIFIER ::=  { atsCalibration 3 }
-
-atsStatusDeviceStatus          OBJECT IDENTIFIER ::=  { atsStatus 1 }
-atsStatusResetValues           OBJECT IDENTIFIER ::=  { atsStatus 2 }
-atsStatusInput                 OBJECT IDENTIFIER ::=  { atsStatus 3 }
-atsStatusOutput                OBJECT IDENTIFIER ::=  { atsStatus 4 }
-
-dcmim2Ident                    OBJECT IDENTIFIER ::=  { dc2 1 }
-dcmim2Control                  OBJECT IDENTIFIER ::=  { dc2 2 }
-dcmim2Config                   OBJECT IDENTIFIER ::=  { dc2 3 }
-dcmim2Status                   OBJECT IDENTIFIER ::=  { dc2 4 }
-
-dcmim2IdentSystem              OBJECT IDENTIFIER ::=  { dcmim2Ident 1 }
-
-dcmim2ControlSystem            OBJECT IDENTIFIER ::=  { dcmim2Control 1 }
-
-dcmim2ConfigSystem             OBJECT IDENTIFIER ::=  { dcmim2Config 1 }
-dcmim2ConfigBattery            OBJECT IDENTIFIER ::=  { dcmim2Config 2 }
-dcmim2ConfigLVD                OBJECT IDENTIFIER ::=  { dcmim2Config 3 }
-
-dcmim2StatusSystem             OBJECT IDENTIFIER ::=  { dcmim2Status 1 }
-dcmim2StatusRectifier          OBJECT IDENTIFIER ::=  { dcmim2Status 2 }
-dcmim2StatusBattery            OBJECT IDENTIFIER ::=  { dcmim2Status 3 }
-dcmim2StatusLVD                OBJECT IDENTIFIER ::=  { dcmim2Status 4 }
-dcmim2StatusAlarms             OBJECT IDENTIFIER ::=  { dcmim2Status 5 }
-
-external                       OBJECT IDENTIFIER ::=  { environmentalMonitor 1 }
-integrated                     OBJECT IDENTIFIER ::=  { environmentalMonitor 2 }
-envMgtSystem                   OBJECT IDENTIFIER ::=  { environmentalMonitor 3 }
-
-emIdent                        OBJECT IDENTIFIER ::=  { external 1 }
-emConfig                       OBJECT IDENTIFIER ::=  { external 2 }
-emStatus                       OBJECT IDENTIFIER ::=  { external 3 }
-
-iemIdent                       OBJECT IDENTIFIER ::=  { integrated 1 }
-iemConfig                      OBJECT IDENTIFIER ::=  { integrated 2 }
-iemStatus                      OBJECT IDENTIFIER ::=  { integrated 3 }
-
-emsIdent                        OBJECT IDENTIFIER ::=  { envMgtSystem 1 }
-
-emsOutputRelayControl           OBJECT IDENTIFIER ::=  { envMgtSystem 2 }
-emsOutletControl                OBJECT IDENTIFIER ::=  { envMgtSystem 3 }
-emsSensorControl                OBJECT IDENTIFIER ::=  { envMgtSystem 4 }
-emsAlarmDeviceControl           OBJECT IDENTIFIER ::=  { envMgtSystem 5 }
-
-emsConfig                       OBJECT IDENTIFIER ::=  { envMgtSystem 6 }
-emsProbeConfig                  OBJECT IDENTIFIER ::=  { envMgtSystem 7 }
-emsInputContactConfig           OBJECT IDENTIFIER ::=  { envMgtSystem 8 }
-emsOutputRelayConfig            OBJECT IDENTIFIER ::=  { envMgtSystem 9 }
-emsOutletConfig                 OBJECT IDENTIFIER ::=  { envMgtSystem 10 }
-emsSensorConfig                 OBJECT IDENTIFIER ::=  { envMgtSystem 11 }
-
-emsStatus                       OBJECT IDENTIFIER ::=  { envMgtSystem 12 }
-emsProbeStatus                  OBJECT IDENTIFIER ::=  { envMgtSystem 13 }
-emsInputContactStatus           OBJECT IDENTIFIER ::=  { envMgtSystem 14 }
-emsOutputRelayStatus            OBJECT IDENTIFIER ::=  { envMgtSystem 15 }
-emsOutletStatus                 OBJECT IDENTIFIER ::=  { envMgtSystem 16 }
-emsAlarmDeviceStatus            OBJECT IDENTIFIER ::=  { envMgtSystem 17 }
-emsSensorStatus                 OBJECT IDENTIFIER ::=  { envMgtSystem 18 }
-
-nlIdent                        OBJECT IDENTIFIER ::=  { netlock 1 }
-nlStatus                       OBJECT IDENTIFIER ::=  { netlock 2 }
-
-airFM                           OBJECT IDENTIFIER ::=  { airConditioners 1 }
-airFMIdent                      OBJECT IDENTIFIER ::=  { airFM 1 }
-airFMStatus                     OBJECT IDENTIFIER ::=  { airFM 2 }
-airFMGroup                      OBJECT IDENTIFIER ::=  { airFM 3 }
-
-airPA                           OBJECT IDENTIFIER ::= { airConditioners 2 }
-airPAIdent                      OBJECT IDENTIFIER ::= { airPA 1 }
-airPAStatus                     OBJECT IDENTIFIER ::= { airPA 2 }
-
-rARUIdent                      OBJECT IDENTIFIER ::=  { rARU 1 }
-rARUConfig                     OBJECT IDENTIFIER ::=  { rARU 2 }
-rARUStatus                     OBJECT IDENTIFIER ::=  { rARU 3 }
-
-
--- object types
-
--- the products group
--- the experimental group
-
-
-
--- the apcmgmt group
--- the mconfig group
-
-mconfigNumTrapReceivers OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of managers to send traps to."
-   ::= { mconfig 1 }
-
-mconfigTrapReceiverTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF MconfigTrapReceiverEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "A list of managers to send traps to.  The number of
-       entries is given by the value of mconfigNumTrapReceivers.
-      Maximum number of Trap Receivers is four."
-   ::= { mconfig 2 }
-
-mconfigTrapReceiverEntry OBJECT-TYPE
-   SYNTAX MconfigTrapReceiverEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The managers to send traps to."
-   INDEX  { trapIndex}
-   ::= { mconfigTrapReceiverTable 1 }
-
-MconfigTrapReceiverEntry ::=
-   SEQUENCE {
-      trapIndex
-         INTEGER,
-      receiverAddr
-         IpAddress,
-      communityString
-          DisplayString,
-      severity
-         INTEGER,
-      acceptThisReceiver
-         INTEGER, 
-      receiveTrapType
-         INTEGER
-   }
-
-trapIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to a trap receiver entry."
-   ::= { mconfigTrapReceiverEntry 1 }
-
-receiverAddr OBJECT-TYPE
-   SYNTAX IpAddress
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The IP address of the manager to send a trap to."
-   ::= { mconfigTrapReceiverEntry 2 }
-
-communityString OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The community name to use in the trap when
-       sent to the manager."
-   ::= { mconfigTrapReceiverEntry 3 }
-
-severity OBJECT-TYPE
-   SYNTAX INTEGER {
-      information(1),
-      warning(2),
-      severe(3)
-   }
-   ACCESS read-only
-   STATUS obsolete
-   DESCRIPTION
-      "The severity threshold of traps to send to the manager.
-       traps are labeled in severity as informational(1), warning(2),
-       severe(3).  Only traps of equal or greater severity than
-       this value are sent to the manager."
-   ::= { mconfigTrapReceiverEntry 4 }
-
-acceptThisReceiver OBJECT-TYPE
-   SYNTAX INTEGER   {
-      yes (1),
-      no  (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "An entry will become active if yes, and will
-       be deleted if no."
-   ::= { mconfigTrapReceiverEntry 5 }
-
-
-receiveTrapType OBJECT-TYPE
-   SYNTAX INTEGER   {
-      powernet (1),
-      ietf     (2),
-      both     (3)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The node in this entry will receive traps defined in APC
-       PowerNet MIB, if this OID is set to yes."
-   ::= { mconfigTrapReceiverEntry 6 }
-
-mconfigBOOTPEnabled OBJECT-TYPE
-   SYNTAX INTEGER {
-      yes (1),
-      no  (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The value of yes(1) indicates the PowerNet Adapter is configured to
-       obtain its IP configuration parameters from a BOOTP server.
-       
-       The value of no(2) indicates adapter will assume IP configuration parameters 
-       values saved in adapter's eeprom, which was originally configured at local
-       console."
-   ::= { mconfig 3 }
-
-mconfigTFTPServerIP OBJECT-TYPE
-   SYNTAX IpAddress
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The IP address of TFTP server. If mconfigBOOTPEnabled is yes(1), then this IP address
-       is provided by BOOTP server and not allowed to be modified; otherwise, this IP address
-       can be modified.
-       
-       Before using TFTP to load new code image, the image file should be placed in proper
-       directory of the specified TFTP server. This OID is only supported by AP9605, AP9205, 
-       and AP9603 PowerNet SNMP Adapters."
-   ::= { mconfig 4 }
-
-newCodeAuthentViaTFTP OBJECT-TYPE
-   SYNTAX INTEGER {
-      unknown                (1),
-      validNewAgentCodeImage (2),
-      sameAgentCodeImage     (3),
-      invalidAgentCodeImage  (4)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Once mcontrolRestartAgent is set to loadAndExecuteNewAgent (3), PowerNet adapter will
-       start to load the remote image file, for authentication only, instead of saving the code 
-       into flash memory. Only if a validNewAgentCodeImage (1) is found will the agent reboot
-       the PowerNet adapter and invoke the loader to load and save new code into the flash memory. 
-       Otherwise, the current agent code will continue to run.
-       
-       This OID shows the result of the above authentication process.  
-                validNewAgentCodeImage (1) means the code image on TFTP server 
-                is a valid APC agent code and is different version from the current agent.
-                Once agent identifies this, loader will start to update flash memory with
-                the new agent code.
-       
-                sameAgentCodeImage  (2)  means the code image on TFTP server is exactly the
-                same as the currently running agent. Currently running agent will not invoke
-                loader to load the same again.
-                
-                invalidAgentCodeImage  (3) means the code image on TFTP server is NOT a valid
-                APC agent code. Thus, current agent will not load it into the flash memory.
-                
-       The value of this OID will be associated with TRAP codeImageAuthentDone.
-       This OID is only supported by AP9605, AP9205, and AP9603 PowerNet SNMP Adapters."
-       
-   ::= { mconfig 5 }
-
-mconfigClockDate OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The current date in the mm/dd/yyyy format. Example: 01/01/2000."
-   ::= { mconfigClock 1 }
-
-mconfigClockTime OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The current time in the hh:mm:ss am/pm format. Example: 12:00:00 am."
-   ::= { mconfigClock 2 }
-
-mcontrolRestartAgent OBJECT-TYPE
-   SYNTAX INTEGER   {
-      restartCurrentAgent    (1),
-      continueCurrentAgent   (2),
-      loadAndExecuteNewAgent (3),
-      restartWithoutAgent    (4),
-      resetNetworkAndRestart (5),
-      resetNetworkLeaveModeAndRestart (6)
-  }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this OID to restartCurrentAgent (1) will restart the same SNMP
-       agent code currently saved in flash memory. Setting this OID to
-       loadAndExecuteNewAgent (3) will enable adapter to load a new agent code
-       into the flash memory and start to execute this new agent code.
-       Bootp/tftp is the default protocol. loadAndExecuteNewAgent is only
-       supported by AP9605, AP9205, and AP9603 PowerNet SNMP Adapters. Setting
-       this OID to restartWithoutAgent (4) will restart the system and not
-       start the agent. The subsequent time the system restarts the agent will
-       also automatically restart. Setting this OID to
-       resetNetworkAndRestart (5) will set the Boot Mode, IP Address, Subnet
-       Mask, and Default Gateway to defaults, expire any existing DHCP lease
-       and then restart the system. Setting this OID to
-       resetNetworkLeaveModeAndRestart (6) will leave the Boot Mode at the
-       current setting, set the IP Address, Subnet Mask, and Default Gateway to
-       defaults, expire any existing DHCP lease and then restart the system."
-
-   ::= { mcontrol 1 }
-
--- The mtrapargs group
--- These OIDs allows APC traps to be sent with additional arguments
--- which may not be defined in the APC MIB.
-      
-mtrapargsInteger OBJECT-TYPE
-   SYNTAX INTEGER    
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID allows APC traps to be sent with an integer argument
-       that my not be defined in the APC MIB.
-      
-       A get of this OID will return 0."
-   ::= { mtrapargs 1 }
-
-mtrapargsIpAddress OBJECT-TYPE
-   SYNTAX IpAddress   
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID allows APC traps to be sent with an IP address argument
-       that my not be defined in the APC MIB.
-      
-       A get of this OID will return 0.0.0.0."
-   ::= { mtrapargs 2 }
-
-mtrapargsString OBJECT-TYPE
-   SYNTAX  DisplayString 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID allows APC traps to be sent with an octet string argument
-       that my not be defined in the APC MIB.
-      
-       A get of this OID will return a NULL string."
-   ::= { mtrapargs 3 }
-
-mtrapargsGauge OBJECT-TYPE
-   SYNTAX  Gauge 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID allows APC traps to be sent with a Gauge argument
-       that my not be defined in the APC MIB.
-      
-       A get of this OID will return 0."
-   ::= { mtrapargs 4 }
-
-mtrapargsTimeTicks OBJECT-TYPE
-   SYNTAX TimeTicks  
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID allows APC traps to be sent with a TimeTicks argument
-       that my not be defined in the APC MIB.
-      
-       A get of this OID will return 0."
-   ::= { mtrapargs 5 }
-
-mtrapargsInteger02 OBJECT-TYPE
-   SYNTAX INTEGER    
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID allows APC traps to be sent with an integer argument
-       that my not be defined in the APC MIB.
-      
-       A get of this OID will return 0."
-   ::= { mtrapargs 6 }
-
-mtrapargsInteger03 OBJECT-TYPE
-   SYNTAX INTEGER    
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID allows APC traps to be sent with an integer argument
-       that my not be defined in the APC MIB.
-      
-       A get of this OID will return 0."
-   ::= { mtrapargs 7 }
-
-mtrapargsIpAddress02 OBJECT-TYPE
-   SYNTAX IpAddress   
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID allows APC traps to be sent with an IP address argument
-       that my not be defined in the APC MIB.
-      
-       A get of this OID will return 0.0.0.0."
-   ::= { mtrapargs 8 }
-
-mtrapargsIpAddress03 OBJECT-TYPE
-   SYNTAX IpAddress   
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID allows APC traps to be sent with an IP address argument
-       that my not be defined in the APC MIB.
-      
-       A get of this OID will return 0.0.0.0."
-   ::= { mtrapargs 9 }
-   
-mtrapargsString02 OBJECT-TYPE
-   SYNTAX  DisplayString 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID allows APC traps to be sent with an octet string argument
-       that my not be defined in the APC MIB.
-      
-       A get of this OID will return a NULL string."
-   ::= { mtrapargs 10 }
-
-mtrapargsString03 OBJECT-TYPE
-   SYNTAX  DisplayString 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID allows APC traps to be sent with an octet string argument
-       that my not be defined in the APC MIB.
-      
-       A get of this OID will return a NULL string."
-   ::= { mtrapargs 11 }
-
-mtrapargsGauge02 OBJECT-TYPE
-   SYNTAX  Gauge 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID allows APC traps to be sent with a Gauge argument
-       that my not be defined in the APC MIB.
-      
-       A get of this OID will return 0."
-   ::= { mtrapargs 12 }
-
-mtrapargsGauge03 OBJECT-TYPE
-   SYNTAX  Gauge 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID allows APC traps to be sent with a Gauge argument
-       that my not be defined in the APC MIB.
-      
-       A get of this OID will return 0."
-   ::= { mtrapargs 13 }
-
-mtrapargsTimeTicks02 OBJECT-TYPE
-   SYNTAX TimeTicks  
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID allows APC traps to be sent with a TimeTicks argument
-       that my not be defined in the APC MIB.
-      
-       A get of this OID will return 0."
-   ::= { mtrapargs 14 }
-
-mtrapargsTimeTicks03 OBJECT-TYPE
-   SYNTAX TimeTicks  
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID allows APC traps to be sent with a TimeTicks argument
-       that my not be defined in the APC MIB.
-      
-       A get of this OID will return 0."
-   ::= { mtrapargs 15 }
-   
--- the mfiletransfer group
--- the mfiletransferStatus group
-mfiletransferStatusLastTransferResult OBJECT-TYPE
-   SYNTAX INTEGER {
-      lastFileTransferResultSuccessful                 (1),
-      lastFileTransferResultNotAvailable               (2),
-      lastFileTransferResultFailureUnknown             (3),
-      lastFileTransferResultFailureServerInaccessible  (4),
-      lastFileTransferResultFailureServerAccessDenied  (5),
-      lastFileTransferResultFailureFileNotFound        (6),
-      lastFileTransferResultFailureFileTypeUnknown     (7),
-      lastFileTransferResultFailureFileCorrupted       (8)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Once mfiletransferControlInitiateFileTransfer is set to a value other than doNotInitiateFileTransfer
-      a file transfer of mfiletransferConfigSettingsFilename will be attempted from either a TFTP or FTP
-      server.
-       
-      This OID shows the last attempted file transfer result.
-        lastFileTransferResultSuccessful (1) means the file transfer was successful.
-        lastFileTransferResultNotAvailable (2) means that there have been no previous file transfers.
-        lastFileTransferResultFailureUnknown (3) means that the last file transfer failed for an unknown reason.
-        lastFileTransferResultFailureServerInaccessible (4) means that the TFTP or FTP server could not be found on the network.
-        lastFileTransferResultFailureServerAccessDenied (5) means that the TFTP or FTP server denied access.
-        lastFileTransferResultFailureFileNotFound (6) means that the file could not be located.
-        lastFileTransferResultFailureFileTypeUnknown (7) means the file was examined, but the contents were unknown.
-        lastFileTransferResultFailureFileCorrupt (8) means the transferred file was corrupt."
-       
-   ::= { mfiletransferStatus 1 }
-   
--- the mfiletransferConfig group
--- the mfiletransferConfigSettings group
-
-mfiletransferConfigSettingsFilename  OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-write
-   STATUS  mandatory
-   DESCRIPTION
-      "The path and name of the file to transfer using the mfiletransferControlInitiateFileTransfer OID.
-      If the file to transfer exists in the default server directory then the path may be omitted."
-
-   ::= { mfiletransferConfigSettings 1 }
-
--- the mfiletransferConfigTFTP group
-
-mfiletransferConfigTFTPServerAddress     OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-write
-   STATUS  mandatory
-   DESCRIPTION
-      "The IP Address in dotted decimal notation of the TFTP server involved in the file transfer."
-
-   ::= { mfiletransferConfigTFTP 1 }
-
--- the mfiletransferConfigFTP group
-
-mfiletransferConfigFTPServerAddress  OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-write
-   STATUS  mandatory
-   DESCRIPTION
-      "The IP Address in dotted decimal notation of the FTP server involved in the file transfer."
-
-   ::= { mfiletransferConfigFTP 1 }
-
-mfiletransferConfigFTPServerUser     OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-write
-   STATUS  mandatory
-   DESCRIPTION
-      "The user identification for logging into the FTP server specified with mfiletransferConfigFTPServerAddress."
-
-   ::= { mfiletransferConfigFTP 2 }
-
-mfiletransferConfigFTPServerPassword     OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-write
-   STATUS  mandatory
-   DESCRIPTION
-      "The password for logging into the FTP server specified with mfiletransferConfigFTPServerAddress."
-
-   ::= { mfiletransferConfigFTP 3 }
-
--- the mfiletransferControl group
-
-mfiletransferControlInitiateFileTransfer OBJECT-TYPE
-   SYNTAX INTEGER   {
-      doNotInitiateFileTransfer             (1),
-      initiateFileTransferDownloadViaTFTP   (2),
-      initiateFileTransferDownloadViaFTP    (3)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this OID to doNotInitiateFileTransfer (1) will do nothing.
-       
-      Setting this OID to initiateFileTransferDownloadViaTFTP (2) will attempt to transfer the file named in 
-      mfiletransferConfigSettingsFilename from the TFTP Server identified in mfiletransferConfigTFTPAddress.
-       
-      Setting this OID to initiateFileTransferDownloadViaFTP (3) will attempt to transfer the file named in 
-      mfiletransferConfigSettingsFilename from the FTP Server identified in mfiletransferConfigFTPAddress 
-      using mfiletransferConfigFTPUser and mfiletransferConfigFTPPassword for the FTP Server login process."
-
-   ::= { mfiletransferControl 1 }
-
--- the battManIdent group
-
-battManIdentProductName OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-write
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the battery manager."
-   ::= { battManIdent 1 }
-
-battManIdentHardwareRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The battery manager network interface hardware revision. 
-       This value is set at the factory." 
-   ::= { battManIdent 2 }
-
-battManIdentFirmwareRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The battery manager network interface firmware revision. 
-       This value is set at the factory and can change with firmware update." 
-   ::= {  battManIdent 3 }
-
-battManIdentDateOfManufacture OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The date the battery manager was manufactured in mm/dd/yyyy format. 
-       This value is set at the factory." 
-   ::= { battManIdent 4 }
-   
-battManIdentModelNumber OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The battery manager model number character string. 
-       This value is set at the factory."
-   ::= { battManIdent 5 }
-
-battManIdentSerialNumber OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The battery manager serial number character string. 
-       This value is set at the factory."
-   ::= { battManIdent 6 }
-
--- the battManCalib group
--- system calibration
-
-battManOhmicValueCorrectionFactor OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-       "The system ohmic value correction factor in percent."
-   ::= { battManSystemCalib 1 }
-
--- unit calibration
-
-battManUnitCalibTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "The number of entries in the battManUnitCalibTable."
-   ::= { battManUnitCalib 1 }
-   
-battManUnitCalibTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF BattManUnitCalibTableEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-       "Allows for getting calibration information from each unit in the system."
-   ::= { battManUnitCalib 2 }
-   
-battManUnitCalibTableEntry OBJECT-TYPE
-   SYNTAX BattManUnitCalibTableEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-       "The unit to get data from."
-   INDEX { battManUnitCalibIndex }
-   ::= { battManUnitCalibTable 1 }
-   
-BattManUnitCalibTableEntry ::=
-   SEQUENCE {
-       battManUnitCalibIndex           INTEGER,
-       battManUnitSerialNumber         DisplayString,
-       battManBatteryVoltageZeroCalib  INTEGER,                                 
-       battManBatteryVoltageSpanCalib  INTEGER
-   }       
-
-battManUnitCalibIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "Index of unit calibration entries in the table."
-   ::= { battManUnitCalibTableEntry 1 }
-
-battManUnitSerialNumber OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "The serial number of the unit."
-   ::= { battManUnitCalibTableEntry 2 }
-
-battManBatteryVoltageZeroCalib OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-       "The unit battery voltage zero calibration in millivolts."
-   ::= { battManUnitCalibTableEntry 3 }
-
-battManBatteryVoltageSpanCalib OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-       "The unit battery voltage span calibration in percent."
-   ::= { battManUnitCalibTableEntry 4 }
-
--- string calibration table
-
-battManStringCalibTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "The number of entries in the battManStringCalibTable."
-   ::= { battManStringCalib 1 }
-   
-battManStringCalibTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF BattManStringCalibTableEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-       "Allows for getting calibration information from each string in the system."
-   ::= { battManStringCalib 2 }
-   
-battManStringCalibTableEntry OBJECT-TYPE
-   SYNTAX BattManStringCalibTableEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-       "The string to get data from."
-   INDEX { battManStringCalibIndex }
-   ::= { battManStringCalibTable 1 }
-   
-BattManStringCalibTableEntry ::=
-   SEQUENCE {
-       battManStringCalibIndex             INTEGER,
-       battManDCCurrentZeroCalib           INTEGER,                                 
-       battManACCurrentZeroCalib           INTEGER,
-       battManProbeRange                   INTEGER
-   }       
-
-battManStringCalibIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "Index of string calibration entries in the table."
-   ::= { battManStringCalibTableEntry 1 }
-
-battManDCCurrentZeroCalib OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-       "The string DC current zero calibration in tenths of amps."
-   ::= { battManStringCalibTableEntry 2 }
-
-battManACCurrentZeroCalib OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-       "The string AC current zero calibration in tenths of amps."
-   ::= { battManStringCalibTableEntry 3 }
-
-battManProbeRange OBJECT-TYPE
-   SYNTAX INTEGER {
-       amps1000    (1),
-       amps500     (2),
-       amps100     (3)
-   }    
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-       "The string probe range in amps."
-   ::= { battManStringCalibTableEntry 4 }
-
---string 1 battery calibration table
-
-battManString1BatteryCalibTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "The number of entries in the battManString1BatteryCalibTable."
-   ::= { battManBatteryCalib 1 }
-   
-battManString1BatteryCalibTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF BattManString1BatteryCalibTableEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-       "Allows for getting calibration information from each battery in String 1."
-   ::= { battManBatteryCalib 2 }
-   
-battManString1BatteryCalibTableEntry OBJECT-TYPE
-   SYNTAX BattManString1BatteryCalibTableEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-       "The string to get data from."
-   INDEX { battManString1BatteryCalibIndex }
-   ::= { battManString1BatteryCalibTable 1 }
-   
-BattManString1BatteryCalibTableEntry ::=
-   SEQUENCE {
-       battManString1BatteryCalibIndex             INTEGER,
-       battManString1BatteryInterTierOhmicValue    INTEGER
-   }       
-
-battManString1BatteryCalibIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "Index of battery calibration entries in the table."
-   ::= { battManString1BatteryCalibTableEntry 1 }
-
-battManString1BatteryInterTierOhmicValue OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-       "The battery inter-tier ohmic value in ohms.  This corresponds to the ohmic 
-       value for the positive terminal of the battery."
-   ::= { battManString1BatteryCalibTableEntry 2 }
-
---string 2 battery calibration table
-
-battManString2BatteryCalibTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "The number of entries in the battManString2BatteryCalibTable."
-   ::= { battManBatteryCalib 3 }
-   
-battManString2BatteryCalibTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF BattManString2BatteryCalibTableEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-       "Allows for getting calibration information from each battery in String 2."
-   ::= { battManBatteryCalib 4 }
-   
-battManString2BatteryCalibTableEntry OBJECT-TYPE
-   SYNTAX BattManString2BatteryCalibTableEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-       "The string to get data from."
-   INDEX { battManString2BatteryCalibIndex }
-   ::= { battManString2BatteryCalibTable 1 }
-   
-BattManString2BatteryCalibTableEntry ::=
-   SEQUENCE {
-       battManString2BatteryCalibIndex             INTEGER,
-       battManString2BatteryInterTierOhmicValue    INTEGER
-   }       
-
-battManString2BatteryCalibIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "Index of battery calibration entries in the table."
-   ::= { battManString2BatteryCalibTableEntry 1 }
-
-battManString2BatteryInterTierOhmicValue OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-       "The battery inter-tier ohmic value in ohms."
-   ::= { battManString2BatteryCalibTableEntry 2 }
-
--- the battManConfig group
-
-battManConfigApplication OBJECT-TYPE
-   SYNTAX INTEGER {
-     silcon          (1),
-     other           (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The type of application the battery manager is installed on: 
-       Silcon(1) Silcon UPS or 
-       Other(2) Other UPS/Charger."
-   ::= { battManConfig 1 } 
-
-battManConfigBatteryChemistry OBJECT-TYPE
-   SYNTAX INTEGER {
-     leadAcid        (1),
-     nickel-Cadmium  (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The battery chemistry of the monitored batteries: 
-       LeadAcid(1) Lead Acid or 
-       Nickel-Cadmium(2) Nickel-Cadmium."
-   ::= { battManConfig 2 }
-
-battManConfigBatteryAHCapacity OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The amp hour capacity of the monitored batteries 5-2000 AH."
-   ::= { battManConfig 3 }
-
-battManConfigNumberofStrings OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The number of strings in the battery manager system (1 - 2 Silcon)/(1 Other)."
-   ::= { battManConfig 4 }
-
-battManConfigBatteriesperString OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The number of batteries per string."
-   ::= { battManConfig 5 }
-
-battManConfigCellsperBattery OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The number of cells per battery (1 - 6 for lead-acid, 1 - 2 for NiCd."
-   ::= { battManConfig 6 }
-
-battManConfigMinCellVoltage OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The minimum battery cell voltage alarm limit in millivolts DC."
-   ::= { battManConfig 7 }
-
-battManConfigMaxCellVoltage OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The maximum battery cell voltage alarm limit in millivolts DC."
-   ::= { battManConfig 8 }
-
-battManConfigMaxPilotTempF OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The maximum pilot battery temperature alarm limit in tenths of degrees Fahrenheit."
-   ::= { battManConfig 9 }
-
-battManConfigMaxPilotTempC OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The maximum pilot battery temperature alarm limit in tenths of degrees Celcius."
-   ::= { battManConfig 10 }
-
-battManConfigMaxAmbientTempF OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The maximum ambient temperature alarm limit in tenths of degrees Fahrenheit."
-   ::= { battManConfig 11 }
-
-battManConfigMaxAmbientTempC OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The maximum ambient temperature alarm limit in tenths of degrees Celcius."
-   ::= { battManConfig 12 }
-
-battManConfigMinAmbientTempF OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The Minimum Ambient Temperature alarm limit in tenths of degrees Fahrenheit."
-   ::= { battManConfig 13 }
-
-battManConfigMinAmbientTempC OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The Minimum Ambient Temperature alarm limit in tenths of degrees Celcius."
-   ::= { battManConfig 14 }
-
-battManConfigMaxRippleCurrent OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The maximum ripple current alarm limit for the monitored battery 
-       strings in percent of AH capacity."
-   ::= { battManConfig 15 }
-
-battManConfigMaxCurrentAcceptanceDeviation OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The maximum current acceptance deviation alarm limit in percentage."
-   ::= { battManConfig 16 }
-
-battManConfigMonitorWireLength OBJECT-TYPE
-   SYNTAX INTEGER {
-     fiftyFeetOrLess   (1),
-     moreThanFiftyFeet (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The monitor wire length:
-       fiftyFeetOrLess (1) indicates that the wire length is less than or equal to 50 feet.
-       moreThanFiftyFeet (2) indicates that the wire length is greater than 50 feet."
-   ::= { battManConfig 17 }
-
-battManConfigDischargeVoltageAlarmLevel OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The discharge voltage alarm level in percent."
-   ::= { battManConfig 18 }
-
-battManConfigAutoAnnunciatorReset OBJECT-TYPE
-   SYNTAX INTEGER {
-     disabled  (1),
-     enabled   (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The annunciator output signal reset method:
-       disabled(1) means the annunciator signal output will be reset when the reset button is pressed.
-       enabled(2) means the annunciator will stop signalling when all alarm conditions clear."
-   ::= { battManConfig 19 }
-
--- the battManAlarm group
-
-battManAlarmManagementController OBJECT-TYPE
-   SYNTAX INTEGER {
-     normal          (1),
-     alarm           (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The Management Controller Alarm is : 
-       normal(1) no alarm condtions identified
-       alarm(2) an alarm condition exits."
-   ::= { battManAlarm 1 }
-
-battManAlarmBatteries  OBJECT-TYPE
-   SYNTAX INTEGER {
-     normal          (1),
-     alarm           (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The Batteries Alarm is : 
-       normal(1) no alarm condtions identified
-       alarm(2) an alarm condition exits."
-   ::= { battManAlarm 2 }
-
-battManAlarmCharger OBJECT-TYPE
-   SYNTAX INTEGER {
-     normal          (1),
-     alarm           (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The Charger Alarm is : 
-       normal(1) no alarm condtions identified
-       alarm(2) an alarm condition exits."
-   ::= { battManAlarm 3 }
-
-battManAlarmEnvironment OBJECT-TYPE
-   SYNTAX INTEGER {
-     normal          (1),
-     alarm           (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The Environment Alarm is : 
-       normal(1) no alarm condtions identified
-       alarm(2) an alarm condition exits."
-   ::= { battManAlarm 4 }
-
--- the battManSystemStatus group
-
--- These are system wide parameters
-
-battManSystemAmbientTempC OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The system ambient temperture in tenths of degrees Celcius."
-   ::= { battManSystemStatus 1 }
-
-battManSystemAmbientTempF OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The system ambient temperture in tenths of degrees Fahrenheit."
-   ::= { battManSystemStatus 2 }
-
-battManSystemPilotTempC OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The system pilot temperature in tenths of degrees Celcius."
-   ::= { battManSystemStatus 3 }
-
-battManSystemPilotTempF OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The system pilot temperature in tenths of degrees Fahrenheit."
-   ::= { battManSystemStatus 4 }
-
-battManSystemAmbientHighTempAlarm OBJECT-TYPE
-   SYNTAX INTEGER {
-     normal          (1),
-     alarm           (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "When set to alarm(2), indicates that the system has a high temperature alarm."
-   ::= { battManSystemStatus 5 }
-
-battManSystemAmbientLowTempAlarm OBJECT-TYPE
-   SYNTAX INTEGER {
-     normal          (1),
-     alarm           (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "When set to alarm(2), indicates that the system has a low temperature alarm."
-   ::= { battManSystemStatus 6 }
-
-battManSystemPilotBatteryHighTempAlarm OBJECT-TYPE
-   SYNTAX INTEGER {
-     normal          (1),
-     alarm           (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "When set to alarm(2), indicates that the system has a pilot battery high temperature alarm."
-   ::= { battManSystemStatus 7 }
-
-battManSystemPilotProbeDisconnected OBJECT-TYPE
-   SYNTAX INTEGER {
-     normal          (1),
-     alarm           (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "When set to alarm(2), indicates that the system pilot probe is disconnected."
-   ::= { battManSystemStatus 8 }
-
-battManSystemAmbientProbeDisconnected OBJECT-TYPE
-   SYNTAX INTEGER {
-     normal          (1),
-     alarm           (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "When set to alarm(2), indicates that the system ambient probe is disconnected."
-   ::= { battManSystemStatus 9 }
-
--- This is a table of input contact parameters
-
-battManInputContactTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of entries in the battManContactTable." 
-   ::= { battManInputContactStatus 1 }
-
-battManInputContactTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF BattManInputContactTableEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for getting information from each contact 
-       in the system. " 
-   ::= { battManInputContactStatus 2 }
-
-battManInputContactTableEntry OBJECT-TYPE
-   SYNTAX BattManInputContactTableEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The contact to get data from."
-   INDEX  { battManInputContactIndex }
-   ::= { battManInputContactTable 1 }
-
-BattManInputContactTableEntry ::=
-   SEQUENCE {
-      battManInputContactIndex                 INTEGER,
-      battManInputContactName                  DisplayString,
-      battManInputContactAlarmState            INTEGER,
-      battManInputContactState                 INTEGER,
-      battManInputContactNormalState           INTEGER,
-      battManInputContactAlarmDelay            INTEGER
-   }
-   
-battManInputContactIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Index of contact entries in the table."
-   ::= { battManInputContactTableEntry 1 }
-
-battManInputContactName OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-write
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the input contact."
-   ::= { battManInputContactTableEntry 2 }
-
-battManInputContactAlarmState OBJECT-TYPE
-   SYNTAX INTEGER {
-     normal          (1),
-     alarm           (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "When set to alarm(2), indicates that the alarm condition is active for this contact."
-   ::= { battManInputContactTableEntry 3 }
-
-battManInputContactState OBJECT-TYPE
-   SYNTAX INTEGER {
-     open      (1),
-     closed    (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "When set to open(1), the input contact is in the open state.
-       When set to closed(2), the input contact is in the closed state."
-   ::= { battManInputContactTableEntry 4 }
-
-battManInputContactNormalState OBJECT-TYPE
-   SYNTAX INTEGER {
-     open      (1),
-     closed    (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "When set to open(1), the input contact is normally open.
-       When set to closed(2), the input contact is normally closed."
-   ::= { battManInputContactTableEntry 5 }
-
-battManInputContactAlarmDelay OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The alarm delay time in seconds."
-   ::= { battManInputContactTableEntry 6 }
-
--- This is a table of battery string parameters
-
-battManStringTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of entries in the battManStringTable." 
-   ::= { battManStringStatus 1 }
-
-battManStringTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF BattManStringTableEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for getting information from each string 
-       in the system. " 
-   ::= { battManStringStatus 2 }
-
-battManStringTableEntry OBJECT-TYPE
-   SYNTAX BattManStringTableEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The string to get data from."
-   INDEX  { battManStringIndex }
-   ::= { battManStringTable 1 }
-
-BattManStringTableEntry ::=
-   SEQUENCE {
-      battManStringIndex                       INTEGER,
-      battManStringCurrent                     INTEGER,
-      battManStringRippleCurrent               INTEGER,
-      battManStringChargerHighVoltageAlarm     INTEGER,
-      battManStringChargerLowVoltageAlarm      INTEGER,
-      battManStringCurrentProbeDisconnected    INTEGER,
-      battManStringOnBattery                   INTEGER
-   }
-   
-battManStringIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Index of string entries in the table."
-   ::= { battManStringTableEntry 1 }
-
-battManStringCurrent OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The string current in tenths of Amps."
-   ::= { battManStringTableEntry 2 }
-
-battManStringRippleCurrent OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The string ripple current in tenths of Amps."
-   ::= { battManStringTableEntry 3 }
-
-battManStringChargerHighVoltageAlarm OBJECT-TYPE
-   SYNTAX INTEGER {
-     normal          (1),
-     alarm           (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "When set to alarm(2), indicates that the string charger has a high voltage alarm."
-   ::= { battManStringTableEntry 4 }
-
-battManStringChargerLowVoltageAlarm OBJECT-TYPE
-   SYNTAX INTEGER {
-     normal          (1),
-     alarm           (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "When set to alarm(2), indicates that the string charger has a low voltage alarm."
-   ::= { battManStringTableEntry 5 }
-
-battManStringCurrentProbeDisconnected OBJECT-TYPE
-   SYNTAX INTEGER {
-     normal          (1),
-     alarm           (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "When set to alarm(2), indicates that the string charger probe is disconnected."
-   ::= { battManStringTableEntry 6 }
-
-battManStringOnBattery OBJECT-TYPE
-   SYNTAX INTEGER {
-     normal          (1),
-     alarm           (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "When set to alarm(2), indicates that the string is in the on-battery state."
-   ::= { battManStringTableEntry 7 }
-
--- the battManString1BatteryStatus group
-
-battManString1BatteryTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of entries in the battManString1BatteryStatusTable." 
-   ::= { battManBatteryStatus 1 }
-
-battManString1BatteryTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF BattManString1BatteryTableEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for getting information from each string 
-       in the system. " 
-   ::= { battManBatteryStatus 2 }
-
-battManString1BatteryTableEntry OBJECT-TYPE
-   SYNTAX BattManString1BatteryTableEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The string to get data from."
-   INDEX  { battManString1BatteryIndex }
-   ::= { battManString1BatteryTable 1 }
-
-BattManString1BatteryTableEntry ::=
-   SEQUENCE {
-      battManString1BatteryIndex                       INTEGER,
-      battManString1BatteryVoltage                     INTEGER,
-      battManString1BatteryLowestVoltage               INTEGER,
-      battManString1BatteryCellShorted                 INTEGER, 
-      battManString1BatteryOpenFuseOrConnection        INTEGER, 
-      battManString1BatteryLowCapacity                 INTEGER, 
-      battManString1BatteryHighOhmicValue              INTEGER, 
-      battManString1BatteryThermalRunaway              INTEGER, 
-      battManString1BatteryDryout                      INTEGER
-   }
-   
-battManString1BatteryIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Index of string entries in the table."
-   ::= { battManString1BatteryTableEntry 1 }
-
-battManString1BatteryVoltage OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The battery voltage in milli VDC."
-   ::= { battManString1BatteryTableEntry 2 }
-   
-battManString1BatteryLowestVoltage OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The lowest battery discharge voltage during the last power event in milli VDC."
-   ::= { battManString1BatteryTableEntry 3 }
-   
-battManString1BatteryCellShorted OBJECT-TYPE
-   SYNTAX INTEGER {
-     normal          (1),
-     alarm           (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "When set to alarm(2), indicates that a battery cell is shorted."
-   ::= { battManString1BatteryTableEntry 4 }
-
-battManString1BatteryOpenFuseOrConnection OBJECT-TYPE
-   SYNTAX INTEGER {
-     normal          (1),
-     alarm           (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "When set to alarm(2), indicates that a fuse or connection is open."
-   ::= { battManString1BatteryTableEntry 5 }
-
-battManString1BatteryLowCapacity OBJECT-TYPE
-   SYNTAX INTEGER {
-     normal          (1),
-     alarm           (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "When set to alarm(2), indicates a battery has low capacity."
-   ::= { battManString1BatteryTableEntry 6 }
-
-battManString1BatteryHighOhmicValue OBJECT-TYPE
-   SYNTAX INTEGER {
-     normal          (1),
-     alarm           (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "When set to alarm(2), indicates a battery has a high ohmic value."
-   ::= { battManString1BatteryTableEntry 7 }
-
-battManString1BatteryThermalRunaway OBJECT-TYPE
-   SYNTAX INTEGER {
-     normal          (1),
-     alarm           (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "When set to alarm(2), indicates a battery has a thermal runaway condition."
-   ::= { battManString1BatteryTableEntry 8 }
-
-battManString1BatteryDryout OBJECT-TYPE
-   SYNTAX INTEGER {
-     normal          (1),
-     alarm           (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "When set to alarm(2), indicates a battery has a dryout condition."
-   ::= { battManString1BatteryTableEntry 9 }
-
--- the battManString2BatteryStatus group
-
-battManString2BatteryTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of entries in the battManString2BatteryStatusTable." 
-   ::= { battManBatteryStatus 3 }
-
-battManString2BatteryTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF BattManString2BatteryTableEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for getting information from each string 
-       in the system. " 
-   ::= { battManBatteryStatus 4 }
-
-battManString2BatteryTableEntry OBJECT-TYPE
-   SYNTAX BattManString2BatteryTableEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The string to get data from."
-   INDEX  { battManString2BatteryIndex }
-   ::= { battManString2BatteryTable 1 }
-
-BattManString2BatteryTableEntry ::=
-   SEQUENCE {
-      battManString2BatteryIndex                       INTEGER,
-      battManString2BatteryVoltage                     INTEGER,
-      battManString2BatteryLowestVoltage               INTEGER,
-      battManString2BatteryCellShorted                 INTEGER, 
-      battManString2BatteryOpenFuseOrConnection        INTEGER, 
-      battManString2BatteryLowCapacity                 INTEGER, 
-      battManString2BatteryHighOhmicValue              INTEGER, 
-      battManString2BatteryThermalRunaway              INTEGER, 
-      battManString2BatteryDryout                      INTEGER
-   }
-   
-battManString2BatteryIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Index of string entries in the table."
-   ::= { battManString2BatteryTableEntry 1 }
-
-battManString2BatteryVoltage OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The battery voltage in milli VDC."
-   ::= { battManString2BatteryTableEntry 2 }
-   
-battManString2BatteryLowestVoltage OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The lowest battery discharge voltage during the last power event in milli VDC."
-   ::= { battManString2BatteryTableEntry 3 }
-   
-battManString2BatteryCellShorted OBJECT-TYPE
-   SYNTAX INTEGER {
-     normal          (1),
-     alarm           (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "When set to alarm(2), indicates that a battery cell is shorted."
-   ::= { battManString2BatteryTableEntry 4 }
-
-battManString2BatteryOpenFuseOrConnection OBJECT-TYPE
-   SYNTAX INTEGER {
-     normal          (1),
-     alarm           (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "When set to alarm(2), indicates that a fuse or connection is open."
-   ::= { battManString2BatteryTableEntry 5 }
-
-battManString2BatteryLowCapacity OBJECT-TYPE
-   SYNTAX INTEGER {
-     normal          (1),
-     alarm           (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "When set to alarm(2), indicates a battery has low capacity."
-   ::= { battManString2BatteryTableEntry 6 }
-
-battManString2BatteryHighOhmicValue OBJECT-TYPE
-   SYNTAX INTEGER {
-     normal          (1),
-     alarm           (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "When set to alarm(2), indicates a battery has a high ohmic value."
-   ::= { battManString2BatteryTableEntry 7 }
-
-battManString2BatteryThermalRunaway OBJECT-TYPE
-   SYNTAX INTEGER {
-     normal          (1),
-     alarm           (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "When set to alarm(2), indicates a battery has a thermal runaway condition."
-   ::= { battManString2BatteryTableEntry 8 }
-
-battManString2BatteryDryout OBJECT-TYPE
-   SYNTAX INTEGER {
-     normal          (1),
-     alarm           (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "When set to alarm(2), indicates a battery has a dryout condition."
-   ::= { battManString2BatteryTableEntry 9 }
-
--- battery manager control group
-battManRemoteAnnunciatorReset OBJECT-TYPE
-   SYNTAX INTEGER {
-       noOperation (1),
-       reset       (2)
-   }    
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this OID to reset(2) will reset the user interface annunciator.
-       Getting this OID will do nothing and return the noOperation(1) value."
-   ::= { battManControl 1 }
-
-battManResetChargeCurrentDeviationBenchmark OBJECT-TYPE
-   SYNTAX INTEGER {
-       noOperation (1),
-       reset       (2)
-   }    
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this OID to reset(2) will reset the charge current deviation benchmark.
-       Getting this OID will do nothing and return the noOperation(1) value."
-   ::= { battManControl 2 }
-
-battManResetLowestDischargeVoltages OBJECT-TYPE
-   SYNTAX INTEGER {
-       noOperation (1),
-       reset       (2)
-   }     
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this OID to reset(2) will reset the lowest discharge voltages.
-       Getting this OID will do nothing and return the noOperation(1) value."
-   ::= { battManControl 3 }
-
--- the battManTestResults group
-
---string 1 test results table
-
-battManString1OhmicValueLastDischargeInfo OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "Informational text showing the date/time, load, and pilot temperature for the string
-       during the last discharge when ohmic values were recorded."
-   ::= { battManTestResults 1 }       
-
-battManString1OhmicValueTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "The number of entries in the battManString1OhmicValueTable."
-   ::= { battManTestResults 2 }
-   
-battManString1OhmicValueTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF BattManString1OhmicValueTableEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-       "Allows for getting ohmic value information from each battery in String 1."
-   ::= { battManTestResults 3 }
-   
-battManString1OhmicValueTableEntry OBJECT-TYPE
-   SYNTAX BattManString1OhmicValueTableEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-       "The string to get data from."
-   INDEX { battManString1OhmicValueIndex }
-   ::= { battManString1OhmicValueTable 1 }
-   
-BattManString1OhmicValueTableEntry ::=
-   SEQUENCE {
-       battManString1OhmicValueIndex   INTEGER,
-       battManString1OhmicValueData    INTEGER
-   }       
-
-battManString1OhmicValueIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "The battery number."
-   ::= { battManString1OhmicValueTableEntry 1 }
-
-battManString1OhmicValueData OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "The battery inter-tier ohmic value in ohms.
-       Note: Negative values are invalid and may indicate faulty calibration
-       of ohmic value correction factors."
-   ::= { battManString1OhmicValueTableEntry 2 }
-
-battManString1ResponseTestChangeTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "The number of entries in the battManString1ResponseTestChangeTable."
-   ::= { battManTestResults 4 }
-   
-battManString1ResponseTestChangeTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF BattManString1ResponseTestChangeTableEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-       "Allows for getting response test change information from each battery in String 1."
-   ::= { battManTestResults 5 }
-   
-battManString1ResponseTestChangeTableEntry OBJECT-TYPE
-   SYNTAX BattManString1ResponseTestChangeTableEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-       "The string to get data from."
-   INDEX { battManString1ResponseTestChangeIndex }
-   ::= { battManString1ResponseTestChangeTable 1 }
-   
-BattManString1ResponseTestChangeTableEntry ::=
-   SEQUENCE {
-       battManString1ResponseTestChangeIndex   INTEGER,
-       battManString1ResponseTestChangeData    INTEGER
-   }       
-
-battManString1ResponseTestChangeIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "Index of the entries in the table."
-   ::= { battManString1ResponseTestChangeTableEntry 1 }
-
-battManString1ResponseTestChangeData OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "The battery response test change in percent."
-   ::= { battManString1ResponseTestChangeTableEntry 2 }
-
-battManString2OhmicValueLastDischargeInfo OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "Informational text showing the date/time, load, and pilot temperature for the string
-       during the last discharge when ohmic values were recorded."
-   ::= { battManTestResults 6 }       
-
-battManString2OhmicValueTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "The number of entries in the battManString2OhmicValueTable."
-   ::= { battManTestResults 7 }
-   
-battManString2OhmicValueTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF BattManString2OhmicValueTableEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-       "Allows for getting ohmic value information from each battery in String 1."
-   ::= { battManTestResults 8 }
-   
-battManString2OhmicValueTableEntry OBJECT-TYPE
-   SYNTAX BattManString2OhmicValueTableEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-       "The string to get data from."
-   INDEX { battManString2OhmicValueIndex }
-   ::= { battManString2OhmicValueTable 1 }
-   
-BattManString2OhmicValueTableEntry ::=
-   SEQUENCE {
-       battManString2OhmicValueIndex   INTEGER,
-       battManString2OhmicValueData    INTEGER
-   }       
-
-battManString2OhmicValueIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "Index of battery calibration entries in the table."
-   ::= { battManString2OhmicValueTableEntry 1 }
-
-battManString2OhmicValueData OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "The battery inter-tier ohmic value in ohms.
-       Note: Negative values are invalid and may indicate faulty calibration
-       of ohmic value correction factors."
-   ::= { battManString2OhmicValueTableEntry 2 }
-
-battManString2ResponseTestChangeTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "The number of entries in the battManString2ResponseTestChangeTable."
-   ::= { battManTestResults 9 }
-   
-battManString2ResponseTestChangeTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF BattManString2ResponseTestChangeTableEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-       "Allows for getting response test change information from each battery in String 1."
-   ::= { battManTestResults 10 }
-   
-battManString2ResponseTestChangeTableEntry OBJECT-TYPE
-   SYNTAX BattManString2ResponseTestChangeTableEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-       "The string to get data from."
-   INDEX { battManString2ResponseTestChangeIndex }
-   ::= { battManString2ResponseTestChangeTable 1 }
-   
-BattManString2ResponseTestChangeTableEntry ::=
-   SEQUENCE {
-       battManString2ResponseTestChangeIndex   INTEGER,
-       battManString2ResponseTestChangeData    INTEGER
-   }       
-
-battManString2ResponseTestChangeIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "Index of the entries in the table."
-   ::= { battManString2ResponseTestChangeTableEntry 1 }
-
-battManString2ResponseTestChangeData OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "The battery response test change in percent."
-   ::= { battManString2ResponseTestChangeTableEntry 2 }
-
--- the xPDUIdent group
-
-xPDUIdentProductName OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-write
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the PDU."
-   ::= { xPDUIdent 1 }
-
-xPDUIdentHardwareRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The hardware revision of the PDU. 
-       This value is set at the factory."
-   ::= { xPDUIdent 2 }
-
-xPDUIdentFirmwareAppRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "An ID string identifying the application firmware revision of the  PDU." 
-   ::= {  xPDUIdent 3 }
-
-xPDUIdentFirmwareAppOSRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "An ID string identifying the application operating system firmware revision of the PDU." 
-   ::= {  xPDUIdent 4 }
-
-xPDUIdentFirmwareControllerRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "An ID string identifying the PDU controller firmware revision." 
-   ::= {  xPDUIdent 5 }
-
-xPDUIdentDateOfManufacture OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The date when the PDU was manufactured in mm/dd/yyyy format. 
-       This value is set at the factory." 
-   ::= { xPDUIdent 6 }
-   
-xPDUIdentModelNumber OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A character string identifying the model number of 
-       the PDU. This value is set at the factory."
-   ::= { xPDUIdent 7 }
-
-xPDUIdentSerialNumber OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A character string identifying the serial number of 
-       the PDU. This value is set at the factory."
-   ::= { xPDUIdent 8 }
-
---  the xPDUDevice group
-
-xPDUDeviceNominalMainInputVoltage OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The nominal main input voltage to the PDU. 
-       Measured in Volts,  line-to-line for a delta service or 
-       line-to-neutral for a wye service."
-   ::= { xPDUDevice 1 }
-
-xPDUDeviceServiceType OBJECT-TYPE
-    SYNTAX INTEGER  {
-        delta (1),
-        wye   (2)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The type of utility input to the PDU. Either 3 wires (delta), or 4 wires (wye)."
-   ::= { xPDUDevice 2 }
-
-xPDUDeviceNominalOutputVoltage OBJECT-TYPE
-       SYNTAX     INTEGER 
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-      "The nominal line-to-neutral output voltage to the load measured in Volts."
-   ::= { xPDUDevice 3 }
-
-xPDUDeviceMainInputBreakerRating OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The rating of the main input breaker measured in Amps."
-   ::= { xPDUDevice 4 }
-
-xPDUDevicePanelBreakerRating OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The rating of the panel breaker measured in Amps."
-   ::= { xPDUDevice 5 }
-
-xPDUDeviceTransformerPresent OBJECT-TYPE
-    SYNTAX INTEGER  {
-        notPresent  (1),
-        present     (2)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Indicates whether or not a transformer is installed in the PDU."
-   ::= { xPDUDevice 6 }
-
-xPDUDeviceLoadTieBreakerPresent OBJECT-TYPE
-    SYNTAX INTEGER  {
-        notPresent (1),
-        present    (2)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Indicates whether or not a load tie breaker is installed in the PDU."
-   ::= { xPDUDevice 7 }
-
-xPDUDeviceLoadTestPortPresent OBJECT-TYPE
-    SYNTAX INTEGER  {
-        notPresent  (1),
-        present     (2)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Indicates whether or not a load test port is installed in the PDU."
-   ::= { xPDUDevice 8 }
-
-xPDUDeviceFusesPresent OBJECT-TYPE
-    SYNTAX INTEGER  {
-        notPresent  (1),
-        present     (2)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Indicates whether or not the UPS feed from the PDU includes fuses."
-   ::= { xPDUDevice 9 }
-
-xPDUDeviceFansPresent OBJECT-TYPE
-    SYNTAX INTEGER  {
-        notPresent  (1),
-        present     (2)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Indicates whether or not cooling fans are installed in the PDU."
-   ::= { xPDUDevice 10 }
-
-xPDUDeviceBypassInputPresent OBJECT-TYPE
-    SYNTAX INTEGER  {
-        notPresent  (1),
-        present     (2)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Indicates whether or not the PDU is equipped with a second feed for
-       the UPS's bypass input."
-   ::= { xPDUDevice 11 }
-
-xPDUDeviceCrossTieOutputPresent OBJECT-TYPE
-    SYNTAX INTEGER  {
-        notPresent  (1),
-        present     (2)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Indicates whether or not the PDU is equipped with a cross-tie output."
-   ::= { xPDUDevice 12 }
-
-xPDUDeviceEarthGroundMonitorPresent OBJECT-TYPE
-    SYNTAX INTEGER  {
-        notPresent  (1),
-        present     (2)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Indicates whether or not the PDU can provide ground current measurements."
-   ::= { xPDUDevice 13 }
-
-xPDUDeviceInfraXureType OBJECT-TYPE
-    SYNTAX INTEGER  {
-        typeB     (1),
-        typeC     (2)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Indicates the configuration of this PDU system. 
-       Type-B PDU is in a distributed UPS system and has bypass capabilities. 
-       Type-C PDU receives power from a larger central UPS."
-   ::= { xPDUDevice 14 }
-
--- Main Input 
-
-xPDUMainInputOverVoltThreshold OBJECT-TYPE
-   SYNTAX INTEGER (0..30)                
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Threshold above which an input over voltage condition will be generated.
-       Specified as percent deviation from nominal."
-   ::= { xPDUMainInput 1 }
-
-xPDUMainInputUnderVoltThreshold OBJECT-TYPE
-   SYNTAX INTEGER (0..30)                
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Threshold below which an input under voltage condition will be generated.
-       Specified as percent deviation from nominal."
-   ::= { xPDUMainInput 2 }
-
--- Main Input Voltage Table
-
-xPDUMainInputVoltageTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of Main input voltage entries."
-   ::= { xPDUMainInput 3 }
-
-xPDUMainInputVoltageTable OBJECT-TYPE
-       SYNTAX     SEQUENCE OF XPDUMainInputVoltagePhaseEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-          "A list of input voltage table entries. The number of 
-           entries are the phase entries.
-           The number of entries is contained in the 
-           xPDUMainInputVoltageTableSize OID."
-       ::= { xPDUMainInput 4 }
-
-   xPDUMainInputVoltagePhaseEntry OBJECT-TYPE
-       SYNTAX     XPDUMainInputVoltagePhaseEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-          "An entry containing information applicable to a 
-           particular main input voltage phase."
-       INDEX { xPDUMainInputVoltagePhaseIndex }
-       ::= { xPDUMainInputVoltageTable 1 }
-
-   XPDUMainInputVoltagePhaseEntry ::= SEQUENCE {
-       xPDUMainInputVoltagePhaseIndex      INTEGER,
-       xPDUMainInputVoltageLtoL            INTEGER,
-       xPDUMainInputVoltageLtoN            INTEGER
-      }
-
-   xPDUMainInputVoltagePhaseIndex OBJECT-TYPE
-       SYNTAX     INTEGER{
-          phase1(1),
-          phase2(2),
-          phase3(3)
-         } 
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "Description of each input phase entry in the table."
-       ::= { xPDUMainInputVoltagePhaseEntry 1 }
-
-   xPDUMainInputVoltageLtoL OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "Line-to-line PDU input voltage when an isolation transformer is present, 
-           or -1 if no transformer present in this PDU. Measured in tenths of Volts."
-       ::= { xPDUMainInputVoltagePhaseEntry 2 }
-
-   xPDUMainInputVoltageLtoN OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "Line-to-neutral PDU input voltage when an isolation transformer is not present,
-           or -1 if a transformer is present in this PDU. Measured in tenths of Volts."
-   ::= { xPDUMainInputVoltagePhaseEntry 3 }
-
-
-xPDUBypassInputOverVoltThreshold OBJECT-TYPE
-   SYNTAX INTEGER (0..30)
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Threshold above which a bypass input over voltage condition will be generated. 
-       Specified as percent deviation from nominal."
-   ::= { xPDUBypassInput 1 }
-
-xPDUBypassInputUnderVoltThreshold OBJECT-TYPE
-   SYNTAX INTEGER (0..30)
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Threshold below which an bypass input under voltage condition will be generated. 
-       Specified as percent deviation from nominal."
-   ::= { xPDUBypassInput 2 }
-
--- Bypass Input  Voltage Table
-
-xPDUBypassInputVoltageTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of bypass input voltage entries."
-   ::= { xPDUBypassInput 3 }
-   
-xPDUBypassInputVoltageTable OBJECT-TYPE
-       SYNTAX     SEQUENCE OF XPDUBypassInputVoltagePhaseEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-          "A list of output table entries.  The number of 
-           entries are the phase entries.
-           The number of entries is contained in the 
-           xPDUBypassInputVoltageTableSize OID."
-       ::= { xPDUBypassInput 4 }
-
-   xPDUBypassInputVoltagePhaseEntry OBJECT-TYPE
-       SYNTAX     XPDUBypassInputVoltagePhaseEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-          "An entry containing information applicable to a 
-           particular bypass input voltage phase."
-       INDEX { xPDUBypassInputVoltagePhaseIndex }
-       ::= { xPDUBypassInputVoltageTable 1 }
-
-   XPDUBypassInputVoltagePhaseEntry ::= SEQUENCE {
-       xPDUBypassInputVoltagePhaseIndex       INTEGER,
-       xPDUBypassInputVoltageLtoL             INTEGER,
-       xPDUBypassInputVoltageLtoN             INTEGER
-      }
-
-   xPDUBypassInputVoltagePhaseIndex OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "Index of each bypass input phase entry in the table."
-       ::= { xPDUBypassInputVoltagePhaseEntry 1 }
-
-   xPDUBypassInputVoltageLtoL OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "Line-to-line bypass input voltage, or -1 if no bypass 
-           feed is present in this PDU. Measured in tenths of Volts"
-       ::= { xPDUBypassInputVoltagePhaseEntry 2 }
-
-   xPDUBypassInputVoltageLtoN OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "Line-to-neutral bypass input voltage, or -1 if no bypass
-           feed is present in this PDU. Measured in tenths of Volts"
-       ::= { xPDUBypassInputVoltagePhaseEntry 3 }
-
--- UPS Input Table
-
-xPDUUPSInputVoltageTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of UPS input voltage entries."
-   ::= { xPDUUPSInput 1 }
-   
-xPDUUPSInputVoltageTable OBJECT-TYPE
-       SYNTAX     SEQUENCE OF XPDUUPSInputVoltagePhaseEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-          "A list of UPS input table entries.  The number of 
-           entries are the phase entries.
-           The number of entries is contained in the 
-           xPDUUPSInputVoltageTableSize OID."
-       ::= { xPDUUPSInput 2 }
-
-   xPDUUPSInputVoltagePhaseEntry OBJECT-TYPE
-       SYNTAX     XPDUUPSInputVoltagePhaseEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-          "An entry containing information applicable to a 
-           particular UPS input voltage phase."
-       INDEX { xPDUUPSInputVoltagePhaseIndex }
-       ::= { xPDUUPSInputVoltageTable 1 }
-
-   XPDUUPSInputVoltagePhaseEntry ::= SEQUENCE {
-       xPDUUPSInputVoltagePhaseIndex      INTEGER,
-       xPDUUPSInputVoltageLtoNPresent     INTEGER
-      }
-
-   xPDUUPSInputVoltagePhaseIndex OBJECT-TYPE
-       SYNTAX     INTEGER{
-          phase1(1),
-          phase2(2),
-          phase3(3)
-         } 
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "Description of each UPS input phase entry in the table."
-       ::= { xPDUUPSInputVoltagePhaseEntry 1 }
-
-  xPDUUPSInputVoltageLtoNPresent OBJECT-TYPE
-    SYNTAX INTEGER  {
-        notPresent  (1),
-        present     (2)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Indicates whether or not voltage is present at the UPS feed."
-       ::= { xPDUUPSInputVoltagePhaseEntry 2 }
-
--- System Output
-
-xPDUSystemOutputFrequency OBJECT-TYPE
-   SYNTAX     INTEGER
-   ACCESS     read-only
-   STATUS     mandatory
-   DESCRIPTION
-      "The system output frequency in tenths of Hertz."
-   ::= { xPDUSystemOutput 1 }
-
-xPDUSystemOutputNeutralCurrent OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Shows the neutral current measured at the system output in tenths of Amps."
-   ::= { xPDUSystemOutput 2 }
-
-xPDUSystemOutputTotalPower OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Shows the total system output power in tenths of kW."
-   ::= { xPDUSystemOutput 3 }
-
-xPDUSystemOutputTotalApparentPower OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Shows the total system output power in tenths of kVA."
-   ::= { xPDUSystemOutput 4 }
-
-xPDUSystemOutputTotalPowerFactor OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Indicates the total power factor of the system output.
-       A value of 100 representing a unity power factor (1.00).
-       Measured in hundredths."
-   ::= { xPDUSystemOutput 5 }
-
-xPDUSystemOutputFrequencyTolerance OBJECT-TYPE
-   SYNTAX     INTEGER{
-      freqToleranceOff              (1),
-      freqTolerancePointTwo         (2),
-      freqTolerancePointFive        (3),
-      freqToleranceOne              (4),
-      freqToleranceOnePointFive     (5),
-      freqToleranceTwo              (6),
-      freqToleranceThree            (7),
-      freqToleranceFour             (8),
-      freqToleranceFive             (9),
-      freqToleranceNine             (10)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Shows the circuit panel output frequency tolerance in Hertz."
-   ::= { xPDUSystemOutput 6 }
-
-xPDUSystemOutputMaxKWPower OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Defines 100% load in kW. 
-       Purpose is to set to match UPS capabilities."
-   ::= { xPDUSystemOutput 7 }
-
-xPDUSystemOutputOverVoltThreshold OBJECT-TYPE
-   SYNTAX INTEGER (0..30)                
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Threshold above which an output over voltage condition will be generated. 
-       Specified as percent deviation from nominal."
-   ::= { xPDUSystemOutput 8 }
-
-xPDUSystemOutputUnderVoltThreshold OBJECT-TYPE
-   SYNTAX INTEGER (0..30)                
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Threshold below which an output under voltage condition will be generated. 
-       Specified as percent deviation from nominal."
-   ::= { xPDUSystemOutput 9 }
-
-
-xPDUSystemOutputOverCurrentThreshold OBJECT-TYPE
-   SYNTAX INTEGER (0..100)                
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Threshold above which an over current condition will be generated. 
-       Specified as a percent of the panel breaker rating."
-   ::= { xPDUSystemOutput 10 }
-
-xPDUSystemOutputOverCurrentNeutralThreshold OBJECT-TYPE
-   SYNTAX INTEGER (0..100)
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Threshold above which an Over current neutral condition will be generated. 
-       Specified as a percent of the panel breaker rating."
-   ::= { xPDUSystemOutput 11 }
-
-xPDUSystemOutputUnderCurrentThreshold OBJECT-TYPE
-   SYNTAX INTEGER (0..100)
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Threshold below which an under current condition will be generated. 
-       Specified as a percent of the panel breaker rating."
-   ::= { xPDUSystemOutput 12 }
-
-xPDUSystemOutputTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of System Output phase entries."
-   ::= { xPDUSystemOutput 13 }
-   
-xPDUSystemOutputTable OBJECT-TYPE
-   SYNTAX     SEQUENCE OF XPDUSystemOutputPhaseEntry
-   ACCESS     not-accessible
-   STATUS     mandatory
-   DESCRIPTION
-      "A list of system output table entries.
-       The number of entries is contained in the 
-       xPDUSystemOutputTableSize OID."
-   ::= { xPDUSystemOutput 14 }
-
-   xPDUSystemOutputPhaseEntry OBJECT-TYPE
-       SYNTAX     XPDUSystemOutputPhaseEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-          "An entry containing information applicable to a 
-           particular system output phase."
-       INDEX { xPDUSystemOutputPhaseIndex }
-       ::= { xPDUSystemOutputTable 1 }
-
-   XPDUSystemOutputPhaseEntry ::= SEQUENCE {
-       xPDUSystemOutputPhaseIndex      INTEGER,
-       xPDUSystemOutputVoltageLtoL     INTEGER,
-       xPDUSystemOutputVoltageLtoN     INTEGER,
-       xPDUSystemOutputPhaseCurrent    INTEGER,
-       xPDUSystemOutputPower           INTEGER,
-       xPDUSystemOutputApparentPower   INTEGER,
-       xPDUSystemOutputPowerFactor     INTEGER
-      }
-
-   xPDUSystemOutputPhaseIndex OBJECT-TYPE
-       SYNTAX     INTEGER{
-          phase1(1),
-          phase2(2),
-          phase3(3)
-         } 
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "Description of each output phase entry in the table."
-       ::= { xPDUSystemOutputPhaseEntry 1 }
-
-   xPDUSystemOutputVoltageLtoL OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "Line-to-line system output voltage available at the cicuit panel. 
-           Measured in tenths of Volts."
-       ::= { xPDUSystemOutputPhaseEntry 2 }
-
-   xPDUSystemOutputVoltageLtoN OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "Line-to-neutral system output voltage available at the cicuit panel. 
-           Measured in tenths of Volts."
-       ::= { xPDUSystemOutputPhaseEntry 3 }
-
-
-   xPDUSystemOutputPhaseCurrent OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "System load current per phase. Measured in tenths of Amps."
-       ::= { xPDUSystemOutputPhaseEntry 4 }
-
-   xPDUSystemOutputPower OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "System output power per phase. Measured in tenths of kW."
-       ::= { xPDUSystemOutputPhaseEntry 5 }
-
-   xPDUSystemOutputApparentPower OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "System output power per phase. Measured in tenths of kVA."
-       ::= { xPDUSystemOutputPhaseEntry 6 }
-
-   xPDUSystemOutputPowerFactor OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "Indicates the Power Factor of the system output per phase.
-           A value of 100 representing a unity Power Factor (1.00).
-           Measured in hundredths."
-       ::= { xPDUSystemOutputPhaseEntry 7 }
-
-xPDUGroundCurrent OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Shows the current measured in the earth ground conductor in tenths of Amps."
-   ::= { xPDUGroundMonitorPoint 1 }
-
-xPDUGroundCurrentThreshold OBJECT-TYPE
-   SYNTAX INTEGER (0..50)
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Threshold above which a ground current over current 
-       condition will be generated. Measured in tenths of Amps."
-   ::= { xPDUGroundMonitorPoint 2 }
-
--- System Breakers 
-
-xPDUSystemBreakerTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of system breaker entries."
-   ::= { xPDUSystemBreakers 1 }
-   
-xPDUSystemBreakerTable OBJECT-TYPE
-       SYNTAX     SEQUENCE OF XPDUSystemBreakerTableEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-          "A list of system breaker entries.
-          The number of entries is contained in the 
-          xPDUSystemBreakerTableSize OID."
-       ::= { xPDUSystemBreakers 2 }
-
-   xPDUSystemBreakerTableEntry OBJECT-TYPE
-       SYNTAX     XPDUSystemBreakerTableEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-          "An entry containing information applicable to a 
-           particular system breaker."
-       INDEX { xPDUSystemBreakerTableIndex }
-       ::= { xPDUSystemBreakerTable 1 }
-
-   XPDUSystemBreakerTableEntry ::= SEQUENCE {
-       xPDUSystemBreakerTableIndex    INTEGER,
-       xPDUSystemBreakerDescription   DisplayString,
-       xPDUSystemBreakerPosition      INTEGER
-      }
-
-   xPDUSystemBreakerTableIndex OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "Index of system breaker entries in the table."
-       ::= { xPDUSystemBreakerTableEntry 1 }
-
-xPDUSystemBreakerDescription OBJECT-TYPE
-   SYNTAX  DisplayString (SIZE (0..79))
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "A brief description of the system breakers."
-   ::= { xPDUSystemBreakerTableEntry 2 }
-
-   xPDUSystemBreakerPosition OBJECT-TYPE
-       SYNTAX INTEGER  {
-          open    (1),
-          closed  (2)
-       } 
-       ACCESS read-only
-       STATUS mandatory
-       DESCRIPTION
-          "Indicates whether this breaker is open(1) or closed(2)."
-       ::= { xPDUSystemBreakerTableEntry 3 }
-
--- Branch Breakers (Breaker Panel)
-
-xPDUNumOfBranchBreakers OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of branch breakers in the Panel."
-   ::= { xPDUBranchBreakers 1 }
-
--- Branch Breakers Table
-
-xPDUBranchBreakerTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of branch breaker entries."
-   ::= { xPDUBranchBreakers 2 }
-   
-xPDUBranchBreakerTable OBJECT-TYPE
-       SYNTAX     SEQUENCE OF XPDUBranchBreakerEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-          "A list of branch breaker table entries. The 
-           number of entries is given by the value of xPDUBranchBreakerTableSize
-           The number of entries is contained in the 
-           xPDUBranchBreakerTableSize OID."
-       ::= { xPDUBranchBreakers 3 }
-
-   xPDUBranchBreakerEntry OBJECT-TYPE
-       SYNTAX     XPDUBranchBreakerEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-          "An entry containing information applicable to a 
-           particular branch breaker."
-       INDEX { xPDUBranchBreakerTableIndex }
-       ::= { xPDUBranchBreakerTable 1 }
-
-   XPDUBranchBreakerEntry ::= SEQUENCE {
-       xPDUBranchBreakerTableIndex             INTEGER,
-       xPDUBranchBreakerRating                 INTEGER,
-       xPDUBranchBreakerRDPFeed                INTEGER,
-       xPDUBranchBreakerTieIndicator           INTEGER,
-       xPDUBranchBreakerCurrent                INTEGER,
-       xPDUBranchBreakerOverCurrentThreshold   INTEGER,
-       xPDUBranchBreakerUnderCurrentThreshold  INTEGER
-       }
-
-   xPDUBranchBreakerTableIndex OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "Index of branch breaker entries in the table."
-       ::= { xPDUBranchBreakerEntry 1 }
-
-   xPDUBranchBreakerRating OBJECT-TYPE
-       SYNTAX INTEGER (0..100)
-       ACCESS read-write
-       STATUS mandatory
-       DESCRIPTION
-          "Indicates current rating of this breaker.  
-           0=Breaker is not present.
-           1=Earth leakage connection.
-		   2=Neutral connection.
-           A value greater than 2 indicates breaker current rating in Amps."
-       ::= { xPDUBranchBreakerEntry 2 }
-
-   xPDUBranchBreakerRDPFeed OBJECT-TYPE
-       SYNTAX INTEGER  {
-          remoteDistribution   (1),
-          noRemoteDistribution (2)
-       } 
-       ACCESS read-write
-       STATUS mandatory
-       DESCRIPTION
-          "Indicates that a breaker position is feeding a remote 
-           distribution panel."
-       ::= { xPDUBranchBreakerEntry 3 }
-
-   xPDUBranchBreakerTieIndicator OBJECT-TYPE
-       SYNTAX INTEGER  {
-          breakerTied   (1),
-          breakerUntied (2)
-       } 
-       ACCESS read-write
-       STATUS mandatory
-       DESCRIPTION
-          "Indicates whether or not the breaker pole is physically 
-           connected to the breaker immediately below."
-       ::= { xPDUBranchBreakerEntry 4 }
-
-    xPDUBranchBreakerCurrent OBJECT-TYPE
-       SYNTAX INTEGER
-       ACCESS read-only
-       STATUS mandatory
-       DESCRIPTION
-          "Indicates the branch current in tenths of  Amps or -1 when not available."
-       ::= { xPDUBranchBreakerEntry 5 }
-
-    xPDUBranchBreakerOverCurrentThreshold OBJECT-TYPE
-       SYNTAX INTEGER (0..100)
-       ACCESS read-write
-       STATUS mandatory
-       DESCRIPTION
-          "Threshold above which a branch circuit over current 
-           condition will be generated. 
-           Specified as a percent of the branch breaker rating."
-       ::= { xPDUBranchBreakerEntry 6 }
-
-    xPDUBranchBreakerUnderCurrentThreshold OBJECT-TYPE
-       SYNTAX INTEGER (0..100)
-       ACCESS read-write
-       STATUS mandatory
-       DESCRIPTION
-          "Threshold below which a branch circuit under current 
-           condition will be generated. 
-           Specified as a percent of the branch breaker rating."
-       ::= { xPDUBranchBreakerEntry 7 }
-
--- the xPDUInputContacts group
-
-xPDUInputContactNumContacts OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of contacts supported by the PDU."
-   ::= { xPDUInputContacts 1 }
-
-xPDUInputContactTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of input contact entries."
-   ::= { xPDUInputContacts 2 }
-
-xPDUInputContactTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF XPDUInputContactEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "A list of contacts supported by the PDU.
-       The number of entries is contained in the 
-       xPDUInputContactTableSize OID."
-   ::= { xPDUInputContacts 3 }
-
-xPDUInputContactEntry OBJECT-TYPE
-   SYNTAX XPDUInputContactEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "A contact entry containing information for a given contact."
-   INDEX  { xPDUInputContactNumber }
-   ::= { xPDUInputContactTable 1 }
-
-XPDUInputContactEntry ::=
-   SEQUENCE {
-      xPDUInputContactNumber       INTEGER,
-      xPDUInputContactName         DisplayString,
-      xPDUInputContactNormalState  INTEGER,
-      xPDUInputContactCurrentState INTEGER
-   }
-
-xPDUInputContactNumber OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "An index identifying the contact on the PDU."
-   ::= { xPDUInputContactEntry 1 }
-
-xPDUInputContactName OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The description of the purpose/use of the contact."
-   ::= { xPDUInputContactEntry 2 }
-
-xPDUInputContactNormalState OBJECT-TYPE
-   SYNTAX INTEGER {
-      open    (1),
-      closed  (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The normal operating position of the contact."
-   ::= { xPDUInputContactEntry 3 }
-
-xPDUInputContactCurrentState OBJECT-TYPE
-   SYNTAX INTEGER {
-      open    (1),
-      closed  (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This value indicates the current state of the contact."
-   ::= { xPDUInputContactEntry 4 }
-
--- the xPDUOutputRelays group
-
-xPDUOutputRelaysNumRelays OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of output relays supported by the PDU."
-   ::= { xPDUOutputRelays 1 }
-
-xPDUOutputRelaysTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of output relay entries."
-   ::= { xPDUOutputRelays 2 }
-
-xPDUOutputRelayTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF XPDUOutputRelayEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "A list of output relays supported by the PDU.
-       The number of entries is contained in the 
-       xPDUOutputRelayTableSize OID."
-   ::= { xPDUOutputRelays 3 }
-
-xPDUOutputRelayEntry OBJECT-TYPE
-   SYNTAX XPDUOutputRelayEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "A output relay entry containing information for a given contact."
-   INDEX  { xPDUOutputRelayNumber }
-   ::= { xPDUOutputRelayTable 1 }
-
-XPDUOutputRelayEntry ::=
-   SEQUENCE {
-      xPDUOutputRelayNumber        INTEGER,
-      xPDUOutputRelayName          DisplayString,
-      xPDUOutputRelayNormalState   INTEGER,
-      xPDUOutputRelayCurrentState  INTEGER
-   }
-
-xPDUOutputRelayNumber OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "An index identifying the output relay on the PDU."
-   ::= { xPDUOutputRelayEntry 1 }
-
-xPDUOutputRelayName OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The description of the purpose/use of the output relay."
-   ::= { xPDUOutputRelayEntry 2 }
-
-xPDUOutputRelayNormalState OBJECT-TYPE
-   SYNTAX INTEGER {
-      open     (1),
-      closed   (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The normal operating position of the output relay."
-   ::= { xPDUOutputRelayEntry 3 }
-
-xPDUOutputRelayCurrentState OBJECT-TYPE
-   SYNTAX INTEGER {
-      open      (1),
-      closed    (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This value indicates the current state of the output relay."
-   ::= { xPDUOutputRelayEntry 4 }
-
--- the xPDUMiscGroup
-
-xPDUEPOMode OBJECT-TYPE
-    SYNTAX INTEGER  {
-        armed    (1),
-        disarmed (2)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Indicates whether the EPO System is armed(1) or disarmed(2)."
-       ::= { xPDUMiscGroup 1 }
-
-xPDUTransformTempStatus OBJECT-TYPE
-    SYNTAX INTEGER  {
-        normal               (1),
-        overtemp             (2),
-		noTransformerPresent (3)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Indicates if the PDU's isolation transformer is over temperature."
-   ::= { xPDUMiscGroup 2 }
-
-xPDUCoolingFanStatus OBJECT-TYPE
-    SYNTAX INTEGER  {
-        normal                (1),
-        failed                (2),
-		noCoolingFansPresent  (3)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Indicates if one or more of the PDU's cooling fans have failed."
-   ::= { xPDUMiscGroup 3 }
-
--- The xATSIdent group
-
-xATSIdentProductName OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-write
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the transfer switch unit."
-   ::= { xATSIdent 1 }
-
-xATSIdentHardwareRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The hardware revision of the transfer switch. 
-       This value is set at the factory."
-   ::= { xATSIdent 2 }
-
-xATSIdentFirmwareAppRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "An ID string identifying the application firmware revision of the  transfer switch." 
-   ::= {  xATSIdent 3 }
-
-xATSIdentFirmwareAppOSRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "An ID string identifying the application operating system firmware revision of the transfer switch." 
-   ::= {  xATSIdent 4 }
-
-xATSIdentFirmwareControllerRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "An ID string identifying the transfer switch controller firmware revision." 
-   ::= {  xATSIdent 5 }
-
-xATSIdentDateOfManufacture OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The date when the transfer switch was manufactured in mm/dd/yyyy format. 
-       This value is set at the factory." 
-   ::= { xATSIdent 6 }
-   
-xATSIdentModelNumber OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A character string identifying the model number of the transfer switch.
-       This value is set at the factory."
-   ::= { xATSIdent 7 }
-
-xATSIdentSerialNumber OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A character string identifying the serial number of the transfer switch.
-        This value is set at the factory."
-   ::= { xATSIdent 8 }
-
---  The xATSDevice group
-
-xATSDeviceServiceType OBJECT-TYPE
-    SYNTAX INTEGER  {
-        threeWire  (1),
-        fourWire   (2)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The type of utility input to the transfer switch.
-       Either 3 wires (delta), or 4 wires (wye)."
-   ::= { xATSDevice 1 }
-
-xATSDeviceNominalVoltage OBJECT-TYPE
-       SYNTAX     INTEGER 
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-      "The nominal line-to-neutral system voltage.
-       Measured in Volts,  line-to-line for a 3-wire service or 
-       line-to-neutral for a 4-wire service. -1 if not available."
-   ::= { xATSDevice 2 }
-
-xATSDeviceNominalFrequency OBJECT-TYPE
-   SYNTAX     INTEGER
-   ACCESS     read-only
-   STATUS     mandatory
-   DESCRIPTION
-      "The nominal system frequency. Measured in tenths of Hertz.
-       -1 if not available."
-   ::= { xATSDevice 3 }
-
-xATSDeviceTransferSwitchRating OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The rating of the transfer switch.
-       Measured in Amps."
-   ::= { xATSDevice 4 }
-
-xATSDeviceDCBackUpPresent OBJECT-TYPE
-   SYNTAX     INTEGER{
-      yes     (1),
-      no      (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Indicates if a DC backup is present or not."
-   ::= { xATSDevice 5 }
-
--- The xATS Switch Status group
-
-xATSSwitchStatusSelectedSource OBJECT-TYPE
-   SYNTAX     INTEGER{
-      none         (1),
-      source1      (2),
-      source2      (3),
-      fault        (4),
-      unknown      (5)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The source which is currently selected, i.e. supplying power to the load."
-   ::= { xATSSwitchStatus 1 }
-   
-xATSSwitchStatusOperationalMode OBJECT-TYPE
-   SYNTAX     INTEGER{
-      automatic                 (1),
-      notInAutoAbnormal         (2),
-      notInAuto                 (3),
-      unknown                   (4)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The current operating mode of the transfer switch. When the ATS is in
-       automatic mode, generator starting and ATS transferring is all done automatically
-       as needed based on the state of source 1.  Automatic operation is halted when the
-       ATS is in either of the notInAuto modes.
-       A mode of notInAuto indicates that the automatic operation switch is in the
-       disabled position, as indicated by the xATSSwitchStatusAutomaticOperationSwitch OID.
-       The notInAutoAbnormal condition indicates that an abnormal
-       condition has caused the transfer switch to halt automatic operation.
-       In this case, traps can indicate the exact problem. In the case of
-       notInAutoAbnormal, refer to the operation manual for details
-       on how debug the condition and restore automatic operation."
-   ::= { xATSSwitchStatus 2 }
-
-xATSSwitchStatusAutomaticOperationSwitch OBJECT-TYPE
-   SYNTAX     INTEGER{
-      disabled   (1),
-      enabled    (2),
-      unknown    (3)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The position of the automatic operation switch on the front of the transfer switch."
-   ::= { xATSSwitchStatus 3 }
-
-xATSSwitchStatusEngineStartSignal OBJECT-TYPE
-   SYNTAX     INTEGER{
-      run     (1),
-      stop    (2),
-      unknown (3)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The position of the Start/Stop contact which signals the generator
-       engine to start/run. When the ATS is in automatic mode,
-       generator starting/stopping is under ATS control."
-   ::= { xATSSwitchStatus 4 }
-
--- The xATS Switch Setting group
-
-xATSSwitchSettingsLowVoltageTransferPoint OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The lowest acceptable voltage condition at source 1. 
-       When any phase of source 1 is lower than this voltage,
-       source quality is considered bad and the generator run signal
-       is asserted to begin generator operation. 
-       Specified in volts,  line-to-line for a 3-wire service or 
-       line-to-neutral for a 4-wire service.
-       -1 if not available."
-   ::= { xATSSwitchSettings 1 }
-
-xATSSwitchSettingsHighVoltageTransferPoint OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The highest acceptable voltage condition at source 1. 
-       When any phase of source 1 is greater than this voltage,
-       source quality is considered bad and the generator run signal
-       is asserted to begin generator operation. 
-       Specified in volts,  line-to-line for a 3-wire service or 
-       line-to-neutral for a 4-wire service.
-       -1 if not available."
-   ::= { xATSSwitchSettings 2 }
-
-xATSSwitchSettingsMaxFrequencyDeviation OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The maximum acceptable frequency deviation condition from nominal at source 1. 
-       When source 1 frequency is outside the specified range,
-       source quality is considered bad and the generator run signal
-       is asserted to begin generator operation. 
-       Specified in  tenths of Hertz above or below nominal.
-       A value of zero indicates that frequency is ignored when 
-       determining source quality.
-       -1 if not available."
-   ::= { xATSSwitchSettings 3 }
-
-xATSSwitchSettingsMinPhaseBalance OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The minimum required phase balance at source 1. 
-       When the percentage difference between the minimum and maximum 
-       phase voltage measurements at source 1 is greater than this value,
-       source quality is considered bad and the generator run signal
-       is asserted to begin generator operation.
-       Specified as a percentage. A value of zero indicates that phase balance
-        is ignored when determining source quality.
-       -1 if not available."
-   ::= { xATSSwitchSettings 4 }
-
-xATSSwitchSettingsNominalRotation OBJECT-TYPE
-   SYNTAX     INTEGER{
-      abc     (1),
-      cba     (2),
-      any     (3),
-      unknown (4)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The nominal phase rotation (or phase sequence) required by the load.
-       For certain types of equipment, such as rotating machinery, phase rotation
-       is critical for proper operation as it determines the direction which motors
-       will rotate (clockwise or counterclockwise).
-       Source quality will be seen as bad if the rotation measured at that
-       ATS input does not match this setting.
-       If this setting is set to any, phase rotation is ignored."
-   ::= { xATSSwitchSettings 5 }
-
-xATSSwitchSettingsAllowClosedTransfer OBJECT-TYPE
-   SYNTAX INTEGER{
-      yes     (1),
-      no      (2),
-      unknown (3)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "This setting enables seemless (closed) transfers between sources. 
-       When possible, both source 1 and source 2 are closed to the output 
-       for a brief time. If closed transfer is not possible within the amount
-       of time specified by the xATSSwitchSettingsMaxSyncTime OID,
-       an open transfer will be executed."
-   ::= { xATSSwitchSettings 6 }
-
-xATSSwitchSettingsMaxSyncTime OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "When attempting/seeking to perform a closed transfer, this setting defines
-       the maximum time allowed before the transfer switch will give up and perform
-       an open transfer. Specified in seconds.
-       -1 if not available."
-   ::= { xATSSwitchSettings 7 }
-
-xATSSwitchSettingsNeutralTransferTime OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "This setting defines how long both source 1 and source 2 will be 
-       disconnected from the output, during an open transfer. 
-       Specified in seconds.
-       -1 if not available."
-   ::= { xATSSwitchSettings 8 }
-
-xATSSwitchSettingsClearLatchedAlarms OBJECT-TYPE
-   SYNTAX INTEGER{
-      yes        (1),
-      no         (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Clears any latched alarm conditions."
-   ::= { xATSSwitchSettings 9 }
-   
-xATSSwitchSettingsSetToFactoryDefaults OBJECT-TYPE
-   SYNTAX INTEGER{
-      yes        (1),
-      no         (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Sets all transfer switch settings to factory default values."
-   ::= { xATSSwitchSettings 10 }
-
-
--- The xATSSwitchTimers group
-
-   xATSSwitchTimersTableSize OBJECT-TYPE
-     SYNTAX INTEGER
-     ACCESS read-only
-     STATUS mandatory
-     DESCRIPTION
-        "The number of transfer switch timer entries."
-     ::= { xATSSwitchTimers 1 }
-
-   xATSSwitchTimersTable OBJECT-TYPE
-     SYNTAX SEQUENCE OF XATSSwitchTimersEntry
-     ACCESS not-accessible
-     STATUS mandatory
-     DESCRIPTION
-        "A list of timers supported by ATS.
-         The number of entries is contained in the xATSSwitchTimersTableSize OID."
-     ::= { xATSSwitchTimers 2 }
-
-   xATSSwitchTimersEntry OBJECT-TYPE
-     SYNTAX XATSSwitchTimersEntry
-     ACCESS not-accessible
-     STATUS mandatory
-     DESCRIPTION
-        "An entry containing information about an individual ATS timer."
-     INDEX  { xATSSwitchTimersIndex }
-     ::= { xATSSwitchTimersTable 1 }
-
-   XATSSwitchTimersEntry ::=
-     SEQUENCE {
-        xATSSwitchTimersIndex                INTEGER,
-        xATSSwitchTimersName                 DisplayString,
-        xATSSwitchTimersAbort                INTEGER,
-        xATSSwitchTimersStatus               INTEGER,
-        xATSSwitchTimersRemainingTime        INTEGER,
-        xATSSwitchTimersDelaySetting         INTEGER
-     }
-
-xATSSwitchTimersIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Index of timer entries in the table."
-   ::= { xATSSwitchTimersEntry 1 }
-
-xATSSwitchTimersName OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Name of the individual timer.Refer to ATS operation manual,
-       or on-line help, for detailed descriptions of ATS timers."
-   ::= { xATSSwitchTimersEntry 2 }
-
-xATSSwitchTimersAbort OBJECT-TYPE
-   SYNTAX INTEGER{
-      yes  (1),
-      no   (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "This aborts the individual timer."
-   ::= { xATSSwitchTimersEntry 3 }
-
-xATSSwitchTimersStatus OBJECT-TYPE
-   SYNTAX INTEGER{
-      inactive  (1),
-      active    (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the individual timer. Designates whether this timer
-       entry is currently running or inactive."
-   ::= { xATSSwitchTimersEntry 4 }
-   
-xATSSwitchTimersRemainingTime OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The time remaining for this timer entry.
-       Specified in seconds."
-   ::= { xATSSwitchTimersEntry 5 }
-
-xATSSwitchTimersDelaySetting OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The delay settings associated with this timer entry.
-       When this timer entry is active, the timer value must exceed this setting
-       before the ATS behavior associated with this timer is executed.
-       Refer to ATS operation manual, or on-line help, for detailed 
-       descriptions of ATS timers."
-   ::= { xATSSwitchTimersEntry 6 }
-
--- The xATSSwitchBlockMap group
-
-   xATSSwitchBlockMapTableSize OBJECT-TYPE
-     SYNTAX INTEGER
-     ACCESS read-only
-     STATUS mandatory
-     DESCRIPTION
-        "The number of blocking map entries, or how many ATS actions can be blocked."
-     ::= { xATSSwitchBlockMap 1 }
-
-   xATSSwitchBlockMapTable OBJECT-TYPE
-     SYNTAX SEQUENCE OF XATSSwitchBlockMapEntry
-     ACCESS not-accessible
-     STATUS mandatory
-     DESCRIPTION
-        "A list of blocking maps supported by the ATS.
-         The number of entries is contained in the xATSSwitchBlockMapTableSize OID."
-     ::= { xATSSwitchBlockMap 2 }
-
-   xATSSwitchBlockMapEntry OBJECT-TYPE
-     SYNTAX XATSSwitchBlockMapEntry
-     ACCESS not-accessible
-     STATUS mandatory
-     DESCRIPTION
-        "An entry containing information about a specific ATS blocking map."
-     INDEX  { xATSSwitchBlockMapIndex }
-     ::= { xATSSwitchBlockMapTable 1 }
-
-   XATSSwitchBlockMapEntry ::=
-     SEQUENCE {
-        xATSSwitchBlockMapIndex            INTEGER,
-        xATSSwitchBlockMapName             DisplayString,
-        xATSSwitchBlockMapStatus           INTEGER,
-        xATSSwitchBlockMapSetting          INTEGER
-    }
-
-   xATSSwitchBlockMapIndex OBJECT-TYPE
-     SYNTAX INTEGER
-     ACCESS read-only
-     STATUS mandatory
-     DESCRIPTION
-        "Index of blocking map entries in the table."
-     ::= { xATSSwitchBlockMapEntry 1 }
-
-   xATSSwitchBlockMapName OBJECT-TYPE
-     SYNTAX DisplayString
-     ACCESS read-only
-     STATUS mandatory
-     DESCRIPTION
-        "A string describing the ATS action to be blocked."
-     ::= { xATSSwitchBlockMapEntry 2 }
-     
-   xATSSwitchBlockMapStatus OBJECT-TYPE
-     SYNTAX INTEGER
-     ACCESS read-only
-     STATUS mandatory
-     DESCRIPTION
-       "Represents the status of this blocking map entry, in bit-mapped format.
-        A non-zero value indicates that this entry's ATS action is currently being blocked.
-        The bit(s) set indicate which input(s) are causing the blocking (bit0, bit1, etc).
-
-        bit 0 - Contact 1
-        bit 1 - Contact 2
-        bit 2 - Contact 3
-        bit 3 - Contact 4."
-     ::= { xATSSwitchBlockMapEntry 3 }
-
-   xATSSwitchBlockMapSetting OBJECT-TYPE
-     SYNTAX INTEGER
-     ACCESS read-write
-     STATUS mandatory
-     DESCRIPTION
-       "This setting designates the inputs that block the ATS action
-        The mapping is specified as a bit-field, where each bit set indicates
-        the input that blocks the ATS action associated with the entry.
-
-        bit 0 - Contact 1
-        bit 1 - Contact 2
-        bit 2 - Contact 3
-        bit 3 - Contact 4."
-     ::= { xATSSwitchBlockMapEntry 4 }
-
--- The xATSSwitchStatistics group
-
-   xATSSwitchStatisticsTableSize OBJECT-TYPE
-     SYNTAX INTEGER
-     ACCESS read-only
-     STATUS mandatory
-     DESCRIPTION
-        "The number of transfer switch statistics entries."
-     ::= { xATSSwitchStatistics 1 }
-
-   xATSSwitchStatisticsTable OBJECT-TYPE
-     SYNTAX SEQUENCE OF XATSSwitchStatisticsEntry
-     ACCESS not-accessible
-     STATUS mandatory
-     DESCRIPTION
-        "A list of statistics supported by ATS.
-         The number of entries is contained in the xATSSwitchStatisticsTableSize OID."
-     ::= { xATSSwitchStatistics 2 }
-
-   xATSSwitchStatisticsEntry OBJECT-TYPE
-     SYNTAX XATSSwitchStatisticsEntry
-     ACCESS not-accessible
-     STATUS mandatory
-     DESCRIPTION
-        "An entry containing information about an individual ATS statistic."
-     INDEX  { xATSSwitchStatisticsIndex }
-     ::= { xATSSwitchStatisticsTable 1 }
-
-   XATSSwitchStatisticsEntry ::=
-     SEQUENCE {
-        xATSSwitchStatisticsIndex             INTEGER,
-        xATSSwitchStatisticsName              DisplayString,
-        xATSSwitchStatisticsValue             DisplayString,
-        xATSSwitchStatisticsReset             INTEGER
-     }
-
-   xATSSwitchStatisticsIndex OBJECT-TYPE
-     SYNTAX INTEGER
-     ACCESS read-only
-     STATUS mandatory
-     DESCRIPTION
-        "Index of ATS statistics entries in the table."
-     ::= { xATSSwitchStatisticsEntry 1 }
-
-   xATSSwitchStatisticsName OBJECT-TYPE
-     SYNTAX     DisplayString
-     ACCESS read-only
-     STATUS mandatory
-     DESCRIPTION
-       "This is the name of the ATS statistic associated with this entry."
-     ::= { xATSSwitchStatisticsEntry 2 }
-
-   xATSSwitchStatisticsValue OBJECT-TYPE
-     SYNTAX     DisplayString
-     ACCESS read-only
-     STATUS mandatory
-     DESCRIPTION
-       "This is the value of the ATS statistic associated with this entry."
-     ::= { xATSSwitchStatisticsEntry 3 }
-
-   xATSSwitchStatisticsReset OBJECT-TYPE
-     SYNTAX INTEGER{
-       yes   (1),
-       no    (2)
-     }
-     ACCESS read-write
-     STATUS mandatory
-     DESCRIPTION
-       "This will reset the individual ATS statistic associated with this entry."
-     ::= { xATSSwitchStatisticsEntry 4 }
-
--- The xATS Source 1 group
-
-xATSSource1Name OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "String used to identify source 1."
-   ::= { xATSSource1 1 }
-
-xATSSource1Position OBJECT-TYPE
-   SYNTAX INTEGER{
-      open     (1),
-      closed   (2),
-      tripped  (3),
-      unknown  (4)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The current position of the switch at source 1."
-   ::= { xATSSource1 2 }
-
-xATSSource1Frequency OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The frequency at source 1 in tenths of Hertz.
-       -1 if unavailable."
-   ::= { xATSSource1 3 }
-
-xATSSource1Quality OBJECT-TYPE
-   SYNTAX INTEGER{
-      sourceGood        (1),
-      lowVoltage        (2),
-      highVoltage       (3),
-      phaseImbalance    (4),
-      freqOutOfRange    (5),
-      badRotation       (6),
-      unknown           (7)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The current line quality of source 1."
-   ::= { xATSSource1 4 }
-
-xATSSource1Rotation OBJECT-TYPE
-   SYNTAX INTEGER{
-      abc     (1),
-      cba     (2),
-      unknown (3)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The phase rotation measured at the source 1 input of the ATS.
-       The sequence is a reference to the order in which the three phases 
-       pass the zero-crossing boundary in time."
-   ::= { xATSSource1 5 }
-
-xATSSource1TableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of input voltage entries at the source 1 input of the ATS."
-   ::= { xATSSource1 6 }
-
-   xATSSource1Table OBJECT-TYPE
-       SYNTAX     SEQUENCE OF XATSSource1PhaseEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-          "A list of voltage table entries for source 1. The number of 
-           entries are the phase entries. The number of entries is contained in the 
-           xATSSource1TableSize OID."
-       ::= { xATSSource1 7 }
-
-   xATSSource1PhaseEntry OBJECT-TYPE
-       SYNTAX     XATSSource1PhaseEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-          "An entry containing information applicable to a
-           particular input voltage phase at the source 1 input of the ATS."
-       INDEX { xATSSource1Index }
-       ::= { xATSSource1Table 1 }
-
-   XATSSource1PhaseEntry ::= SEQUENCE {
-       xATSSource1Index        INTEGER,
-       xATSSource1VoltageLtoL  INTEGER,
-       xATSSource1VoltageLtoN  INTEGER
-      }
-
-   xATSSource1Index OBJECT-TYPE
-       SYNTAX INTEGER{
-          phase1(1),
-          phase2(2),
-          phase3(3)
-         } 
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "Description of each phase utilized at source 1."
-       ::= { xATSSource1PhaseEntry 1 }
-
-   xATSSource1VoltageLtoL OBJECT-TYPE
-       SYNTAX INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "Source 1 line-to-line input voltage. 
-           Measured in tenths of Volts."
-       ::= { xATSSource1PhaseEntry 2 }
-
-   xATSSource1VoltageLtoN OBJECT-TYPE
-       SYNTAX INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "Source 1 line-to-neutral input voltage. 
-           Measured in tenths of Volts. -1 for a 3-wire service type."
-   ::= { xATSSource1PhaseEntry 3 }
-
--- The xATS Source 2 group
-
-xATSSource2Name OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "String used to identify source 2."
-   ::= { xATSSource2 1 }
-
-xATSSource2Position OBJECT-TYPE
-   SYNTAX INTEGER{
-      open     (1),
-      closed   (2),
-      tripped  (3),
-      unknown  (4)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The current position of the switch at source 2."
-   ::= { xATSSource2 2 }
-
-xATSSource2Frequency OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The frequency at source 2 in tenths of Hertz.
-       -1 if not available."
-   ::= { xATSSource2 3 }
-
-xATSSource2Quality OBJECT-TYPE
-   SYNTAX INTEGER{
-      sourceGood        (1),
-      lowVoltage        (2),
-      highVoltage       (3),
-      phaseImbalance    (4),
-      freqOutOfRange    (5),
-      badRotation       (6),
-      unknown           (7)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The current line quality of source 2."
-   ::= { xATSSource2 4 }
-
-xATSSource2Rotation OBJECT-TYPE
-   SYNTAX INTEGER{
-      abc     (1),
-      cba     (2),
-      unknown (3)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The phase rotation measured at the source 2 input of the ATS.
-       -1 if not available."
-   ::= { xATSSource2 5 }
-
-xATSSource2TableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of input voltage entries at the source 2 input of the ATS."
-   ::= { xATSSource2 6 }
-
-   xATSSource2Table OBJECT-TYPE
-       SYNTAX     SEQUENCE OF XATSSource2PhaseEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-          "A list of voltage table entries for the source 2. The number of
-           entries are the phase entries. The number of entries is contained in the
-           xATSSource2TableSize OID."
-       ::= { xATSSource2 7 }
-
-   xATSSource2PhaseEntry OBJECT-TYPE
-       SYNTAX     XATSSource2PhaseEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-          "An entry containing information applicable to a
-           particular input voltage phase at the source 2 input of the ATS."
-       INDEX { xATSSource2Index }
-       ::= { xATSSource2Table 1 }
-
-   XATSSource2PhaseEntry ::= SEQUENCE {
-       xATSSource2Index        INTEGER,
-       xATSSource2VoltageLtoL  INTEGER,
-       xATSSource2VoltageLtoN  INTEGER
-      }
-
-   xATSSource2Index OBJECT-TYPE
-       SYNTAX INTEGER{
-          phase1(1),
-          phase2(2),
-          phase3(3)
-         } 
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "Description of each phase utilized at the source 2."
-       ::= { xATSSource2PhaseEntry 1 }
-
-   xATSSource2VoltageLtoL OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "Source 2 line-to-line input voltage. 
-           Measured in tenths of Volts."
-       ::= { xATSSource2PhaseEntry 2 }
-
-   xATSSource2VoltageLtoN OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "Source 2 line-to-neutral input voltage. 
-           Measured in tenths of Volts. -1 for a 3-wire service type."
-   ::= { xATSSource2PhaseEntry 3 }
-
--- The xATSSystemOutput
-
-xATSSystemOutputFrequency OBJECT-TYPE
-   SYNTAX     INTEGER
-   ACCESS     read-only
-   STATUS     mandatory
-   DESCRIPTION
-      "The system output frequency in tenths of Hertz."
-   ::= { xATSSystemOutput 1 }
-
-xATSSystemOutputTotalPower OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Shows the total system output power in tenths of kW."
-   ::= { xATSSystemOutput 2 }
-
-xATSSystemOutputTotalApparentPower OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Shows the total system output power in tenths of kVA."
-   ::= { xATSSystemOutput 3 }
-
-xATSSystemOutputTotalPowerFactor OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Indicates the total power factor of the system output.
-       A value of 100 representing a unity power factor (1.00)
-       Specified in hundredths."
-   ::= { xATSSystemOutput 4 }
-
-xATSSystemOutputFrequencyTolerance OBJECT-TYPE
-   SYNTAX     INTEGER{
-      freqToleranceOff              (1),
-      freqTolerancePointTwo         (2),
-      freqTolerancePointFive        (3),
-      freqToleranceOne              (4),
-      freqToleranceOnePointFive     (5),
-      freqToleranceTwo              (6),
-      freqToleranceThree            (7),
-      freqToleranceFour             (8),
-      freqToleranceFive             (9),
-      freqToleranceNine             (10)
-
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Shows the panel output frequency tolerance in +/- Hertz."
-   ::= { xATSSystemOutput 5 }
-
-xATSSystemOutputOverVoltThreshold OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Threshold above which an output over voltage condition will be generated. 
-       Specified as tenths of percent deviation from nominal.
-       A value of zero indicates that the threshold is disabled."
-   ::= { xATSSystemOutput 6 }
-
-xATSSystemOutputUnderVoltThreshold OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Threshold below which an output under voltage condition will be generated. 
-       Specified as tenths of percent deviation from nominal.
-       A value of zero indicates that the threshold is disabled."
-   ::= { xATSSystemOutput 7 }
-
-xATSSystemOutputOverCurrentThreshold OBJECT-TYPE
-   SYNTAX INTEGER (0..100)                
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Threshold above which an over current condition will be generated. 
-       Specified as a percent of the transfer switch rating (xATSDeviceTransferSwitchRating OID).
-       A value of zero indicates that the threshold is disabled."
-   ::= { xATSSystemOutput 8 }
-
-xATSSystemOutputUnderCurrentThreshold OBJECT-TYPE
-   SYNTAX INTEGER (0..100)
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Threshold below which an under current condition will be generated. 
-       Specified as a percent of the transfer switch rating (xATSDeviceTransferSwitchRating OID).
-       A value of zero indicates that the threshold is disabled."
-   ::= { xATSSystemOutput 9 }
-
-xATSSystemOutputAlarmDelayThreshold OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Delay the generation of an output alarm.
-       Specified in seconds."
-   ::= { xATSSystemOutput 10 }
-
-xATSSystemOutputTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of system output phase entries."
-   ::= { xATSSystemOutput 11 }
-   
-xATSSystemOutputTable OBJECT-TYPE
-   SYNTAX     SEQUENCE OF XATSSystemOutputPhaseEntry
-   ACCESS     not-accessible
-   STATUS     mandatory
-   DESCRIPTION
-      "A list of system output table entries.
-       The number of entries is contained in the xATSSystemOutputTableSize OID."
-   ::= { xATSSystemOutput 12 }
-
-   xATSSystemOutputPhaseEntry OBJECT-TYPE
-       SYNTAX     XATSSystemOutputPhaseEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-          "An entry containing information applicable to a 
-           particular system output phase."
-       INDEX { xATSSystemOutputPhaseIndex }
-       ::= { xATSSystemOutputTable 1 }
-
-   XATSSystemOutputPhaseEntry ::= SEQUENCE {
-       xATSSystemOutputPhaseIndex      INTEGER,
-       xATSSystemOutputVoltageLtoL     INTEGER,
-       xATSSystemOutputVoltageLtoN     INTEGER,
-       xATSSystemOutputPhaseCurrent    INTEGER,
-       xATSSystemOutputPower           INTEGER,
-       xATSSystemOutputApparentPower   INTEGER,
-       xATSSystemOutputPowerFactor     INTEGER
-      }
-
-   xATSSystemOutputPhaseIndex OBJECT-TYPE
-       SYNTAX     INTEGER{
-          phase1(1),
-          phase2(2),
-          phase3(3)
-         } 
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "Description of each system output phase utilized in this device."
-       ::= { xATSSystemOutputPhaseEntry 1 }
-
-   xATSSystemOutputVoltageLtoL OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "Line-to-line system output voltage, measured in tenths of Volts, available at the circuit panel. 
-           -1 if not available."
-       ::= { xATSSystemOutputPhaseEntry 2 }
-
-   xATSSystemOutputVoltageLtoN OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "Line-to-neutral system output voltage, measured in tenths of Volts, available at the circuit panel. 
-           -1 for a 3-wire service type or if not available."
-       ::= { xATSSystemOutputPhaseEntry 3 }
-
-   xATSSystemOutputPhaseCurrent OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "System load current per phase. Measured in Amps.
-           -1 if not available."
-       ::= { xATSSystemOutputPhaseEntry 4 }
-
-   xATSSystemOutputPower OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "System output power per phase. Measured in tenths of kW."
-       ::= { xATSSystemOutputPhaseEntry 5 }
-
-   xATSSystemOutputApparentPower OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "system output power per phase. Measured in tenths of kVA."
-       ::= { xATSSystemOutputPhaseEntry 6 }
-
-   xATSSystemOutputPowerFactor OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "indicates the power factor of the system output per phase.
-           A value of 100 representing a unity power factor (1.00).
-           Measured in hundredths."
-       ::= { xATSSystemOutputPhaseEntry 7 }
-
--- xATS TestingStatus group
-
-xATSTestingStatusSelectTestProcess OBJECT-TYPE
-   SYNTAX INTEGER {
-      engineStartTest      (1),
-      systemLoadTest       (2),
-      generatorHoldTest    (3),
-      cancelTest           (4)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Type of tests that can be selected when no test has been scheduled.
-       engineStartTest and systemLoadTest may be selected when no tests 
-       are running.  Tests that are selected may be cancelled manually."
-   ::= { xATSTestingStatus 1 }
-   
-xATSTestingStatusTestStatus OBJECT-TYPE
-     SYNTAX INTEGER {
-        noTestInProcess           (1),
-        testPending               (2),
-        startingEngine            (3),
-        engineWarmingUp           (4),
-        awaitingTransferToS2      (5),
-        testingWithLoad           (6),
-        awaitingRetransferToS1    (7),
-        testingWithoutLoad        (8),
-        stoppingEngine            (9),
-        holdingOnGenerator        (10)
-     }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The present system test status/state."
-   ::= { xATSTestingStatus 2 }
-
-xATSTestingStatusProfileWarmupTime OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The amount of time that the generator will warm up during a test.
-       This is portion of the test when the xATSTestingStatusTestStatus 
-       OID returns the value engineWarmingUp.
-       Specified in seconds."
-   ::= { xATSTestingStatus 3 }
-
-xATSTestingStatusProfileLoadedTime OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The amount of time that ATS will apply the system load to the generator
-       during a system load test.
-       This is portion of the test when the xATSTestingStatusTestStatus 
-       OID returns the value testingWithLoad.
-       Specified in minutes."
-   ::= { xATSTestingStatus 4 }
-
-xATSTestingStatusProfileUnloadedTime OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The amount of time that the generator will run following the warm up 
-       portion of a start test, or the loaded portion of a load test.
-       This is portion of the test when the xATSTestingStatusTestStatus 
-       OID returns the value testingWithoutLoad.
-       Specified in seconds."
-   ::= { xATSTestingStatus 5 }
-
--- xATS TestingResults group
-
-xATSTestingResultsLastDateOfTest OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Date of the last test that was performed, either scheduled or manual.
-       Test results are available in the xATSTestingResultsLastResult OID.
-       Specified in the dd/mm/yyyy format, or 'none' if not available."
-   ::= { xATSTestingResults 1 }
-
-xATSTestingResultsLastResult OBJECT-TYPE
-   SYNTAX INTEGER {
-      startTestPassed           (1),
-      loadTestPassed            (2),
-      startSignalFailure        (3),
-      failedGenNotInAuto        (4),
-      failedGenEmerStop         (5),
-      failedGenShutdown         (6),
-      failedGenDidNotStart      (7),
-      failedS2NeverGood         (8),
-      genFailedDuringWarmup     (9),
-      failureOnXferToS1         (10),
-      genFailedLoaded           (11),
-      failureOnRexferToS2       (12),
-      genFailedToStop           (13),
-      failedAtsInternalFault    (14),
-      failedAtsNotInAuto        (15),
-      cancelledManualTest       (16),
-	  cancelledScheduledTest    (17)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The result of the last ATS/generator system test."
-   ::= { xATSTestingResults 2 }
-
-xATSTestingResultsTestLastTestTime OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Time of day at which the last test was performed, either scheduled or manual. 
-       Test results are available in the xATSTestingResultsLastResult OID.
-       Specified in the hh:mm:ss format, or 'none' if not available."
-   ::= { xATSTestingResults 3 }
-
-xATSTestingResultsLastCrankDuration OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The time spent cranking the generator before it started during the last test.
-       Specified in seconds, or -1 if not available."
-   ::= { xATSTestingResults 4 }
-   
-xATSTestingResultsLastWarmupDuration OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The time spent in the engineWarmingUp state during the last system test.
-       Specified in seconds, or -1 if not available."
-   ::= { xATSTestingResults 5 }
-
-xATSTestingResultsLastLoadedDuration OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The time spent in the testingWithLoad state during the last system test.
-       Specified in seconds, or -1 if not available."
-   ::= { xATSTestingResults 6 }
-
-xATSTestingResultsLastUnloadedDuration OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The time spent in the testingWithoutLoad state during the last system test.
-       Specified in seconds, or -1 if not available."
-   ::= { xATSTestingResults 7 }
-
--- xATS TestingSchedule group
-
-xATSTestingScheduleFrequency OBJECT-TYPE
-    SYNTAX INTEGER  {
-        never   (1),
-        daily   (2),
-        weekly  (3),
-        monthly (4)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The frequency of running scheduled tests."
-   ::= { xATSTestingSchedule 1 }
-
-xATSTestingScheduleTestDay OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The desired day for the scheduled test. This object applies only
-       when the xATSTestingScheduleFrequency OID is set to weekly or monthly.
-       For weekly test frequency, the string is the day the test will be run.
-       For monthly test frequency, the string indicates the day, 
-       and the instance within the month.
-       For example, for monthly frequency: 2nd sunday, 3rd monday, 4th tuesday,
-                    for weekly frequency: sunday, monday, tuesday."
-   ::= { xATSTestingSchedule 2 }
-
-xATSTestingScheduleTestTime OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The time of day that the scheduled test will occur.
-       Specified in the format hh:mm."
-   ::= { xATSTestingSchedule 3 }
-
-xATSTestingScheduleTestWithLoadInterval OBJECT-TYPE
-   SYNTAX INTEGER {
-      applyLoadEveryTest          (1),
-      neverApplyLoad              (2),
-      applyLoadMonthly            (3),
-      applyLoadMonthlyDetailed    (4)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "This setting specifies which system tests should include applying the
-       load to the generator. The applyLoadMonthlyDetailed entry
-       in the list will apply load once, for each month represented in the
-       xATSTestingScheduleTestWithLoadSelectMonth OID."
-   ::= { xATSTestingSchedule 4 }
-
-xATSTestingScheduleTestWithLoadSelectMonth OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The detailed selection for testing with load on a month-by-month basis.
-       This object is applicable when the xATSTestingScheduleTestWithLoadInterval
-       is set to applyLoadMonthlyDetailed. Otherwise this selection will be ignored.
-       Format for this string is a comma-separated entry of months.
-       For example: Jan,Mar,Dec.
-       The string will return 'No Months Scheduled' if no months have been selected."
-   ::= { xATSTestingSchedule 5 }
-
-xATSTestingScheduleNextTestDate OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The date of the next scheduled test, in the format dd-mmm-yyyy."
-   ::= { xATSTestingSchedule 6 }
-
--- xATSTestingSimulatePowerFail group
-
-xATSTestingSimulatePowerFailTest OBJECT-TYPE
-   SYNTAX     INTEGER{
-      cancelSimulation         (1),
-      fiveSecondsSimulation    (2),
-      tenSecondsSimulation     (3),
-      thirtySecondsSimulation  (4),
-      oneMinuteSimulation      (5),
-      threeMinutesSimulation   (6),
-      fiveMinutesSimulation    (7),
-      tenMinutesSimulation     (8)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "This object executes a simulated power failure for the duration indicated.
-       Simulation can be aborted by selecting cancelSimulation."
-   ::= { xATSTestingSimulatePowerFail 1 }
-
-xATSTestingSimulatePowerFailTimeRemaining OBJECT-TYPE
-   SYNTAX  INTEGER
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "Indicates the time remaining in seconds, for a simulated power failure.
-       a value of zero indicates that simulated power failure is not active."
-   ::= { xATSTestingSimulatePowerFail 2 }
-
--- The xATS Input Contact group
-
-xATSInputContactNumContacts OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of contacts supported by the ATS."
-   ::= { xATSInputContacts 1 }
-
-xATSInputContactTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of input contact entries."
-   ::= { xATSInputContacts 2 }
-
-xATSInputContactTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF XATSContactEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "A list of contacts supported by the ATS.
-       The number of entries is contained in the 
-       xATSInputContactTableSize OID."
-   ::= { xATSInputContacts 3 }
-
-   xATSInputContactEntry OBJECT-TYPE
-      SYNTAX XATSContactEntry
-      ACCESS not-accessible
-      STATUS mandatory
-      DESCRIPTION
-         "A contact entry containing information for a given contact."
-      INDEX  { xATSInputContactNumber }
-      ::= { xATSInputContactTable 1 }
-
-   XATSContactEntry ::=
-      SEQUENCE {
-         xATSInputContactNumber    INTEGER,
-         xATSInputContactName      DisplayString,
-         xATSInputContactNormalState           INTEGER,
-         xATSInputContactCurrentState          INTEGER
-      }
-
-   xATSInputContactNumber OBJECT-TYPE
-      SYNTAX INTEGER
-      ACCESS read-only
-      STATUS mandatory
-      DESCRIPTION
-         "An index identifying the contact on the ATS."
-      ::= { xATSInputContactEntry 1 }
-
-   xATSInputContactName OBJECT-TYPE
-     SYNTAX DisplayString
-     ACCESS read-write
-     STATUS mandatory
-     DESCRIPTION
-        "The description of the purpose/use of the contact."
-     ::= { xATSInputContactEntry 2 }
-
-   xATSInputContactNormalState OBJECT-TYPE
-     SYNTAX INTEGER {
-        open   (1),
-        closed (2)
-     }
-     ACCESS read-write
-     STATUS mandatory
-     DESCRIPTION
-        "The normal operating position of the contact."
-     ::= { xATSInputContactEntry 3 }
-
-   xATSInputContactCurrentState OBJECT-TYPE
-     SYNTAX INTEGER {
-        open   (1),
-        closed (2)
-     }
-     ACCESS read-only
-     STATUS mandatory
-     DESCRIPTION
-        "This value indicates the current state of the contact."
-     ::= { xATSInputContactEntry 4 }
-
--- the xATS OutputRelays group
-
-   xATSOutputRelayNumRelays OBJECT-TYPE
-     SYNTAX INTEGER
-     ACCESS read-only
-     STATUS mandatory
-     DESCRIPTION
-        "The number of output relays supported by the ATS."
-     ::= { xATSOutputRelays 1 }
-
-   xATSOutputRelayTableSize OBJECT-TYPE
-     SYNTAX INTEGER
-     ACCESS read-only
-     STATUS mandatory
-     DESCRIPTION
-        "The number of output relay entries."
-     ::= { xATSOutputRelays 2 }
-
-   xATSOutputRelayTable OBJECT-TYPE
-     SYNTAX SEQUENCE OF XATSOutputRelayEntry
-     ACCESS not-accessible
-     STATUS mandatory
-     DESCRIPTION
-        "A list of output relays supported by the ATS.
-        The number of entries is contained in the 
-        xATSOutputRelayTableSize OID."
-     ::= { xATSOutputRelays 3 }
-
-   xATSOutputRelayEntry OBJECT-TYPE
-     SYNTAX XATSOutputRelayEntry
-     ACCESS not-accessible
-     STATUS mandatory
-     DESCRIPTION
-        "A output relay entry containing information for a given contact."
-     INDEX  { xATSOutputRelayNumber }
-     ::= { xATSOutputRelayTable 1 }
-
-   XATSOutputRelayEntry ::=
-     SEQUENCE {
-        xATSOutputRelayNumber           INTEGER,
-        xATSOutputRelayName             DisplayString,
-        xATSOutputRelayNormalState      INTEGER,
-        xATSOutputRelayCurrentState     INTEGER
-     }
-
-   xATSOutputRelayNumber OBJECT-TYPE
-     SYNTAX INTEGER
-     ACCESS read-only
-     STATUS mandatory
-     DESCRIPTION
-        "An index identifying the output relay on the ATS."
-     ::= { xATSOutputRelayEntry 1 }
-
-   xATSOutputRelayName OBJECT-TYPE
-     SYNTAX DisplayString
-     ACCESS read-write
-     STATUS mandatory
-     DESCRIPTION
-       "The description of the purpose/use of the output relay."
-     ::= { xATSOutputRelayEntry 2 }
-
-   xATSOutputRelayNormalState OBJECT-TYPE
-     SYNTAX INTEGER {
-        open   (1),
-        closed (2)
-     }
-     ACCESS read-write
-     STATUS mandatory
-     DESCRIPTION
-       "The normal operating position of the output relay."
-     ::= { xATSOutputRelayEntry 3 }
-
-   xATSOutputRelayCurrentState OBJECT-TYPE
-     SYNTAX INTEGER {
-        open   (1),
-        closed (2)
-     }
-     ACCESS read-only
-     STATUS mandatory
-     DESCRIPTION
-       "This value indicates the current state of the output relay."
-     ::= { xATSOutputRelayEntry 4 }
-
--- The xATS Generator Ident group
-
-xATSGeneratorIdentModelNumber OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A character string identifying the model number of the generator. 
-       This value is set at the factory."
-   ::= { xATSGeneratorIdent 1 }
-
-xATSGeneratorIdentSerialNumber OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A character string identifying the serial number of the generator. 
-       This value is set at the factory."
-   ::= { xATSGeneratorIdent 2 }
-
-xATSGeneratorIdentDateofManufacture OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A character string identifying when the generator was manufactured in mm/dd/yyyy format. 
-       This value is set at the factory."
-   ::= { xATSGeneratorIdent 3 }
-
-xATSGeneratorIdentVoltageConfiguration OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The voltage for which the generator's alternator is designed.
-       Specified in Volts line-to-line."
-   ::= { xATSGeneratorIdent 4 }
-
-xATSGeneratorIdentMaxPowerRating OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The max power rating of the generator. Specified in kW."
-   ::= { xATSGeneratorIdent 5 }
-
-xATSGeneratorIdentAlternatorFrequency OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The frequency for which the generator's alternator is designed.
-       Specified in Hertz."
-   ::= { xATSGeneratorIdent 6 }
-
--- The xATS Generator Status group
-
-xATSGeneratorStatusGeneratorName OBJECT-TYPE
-   SYNTAX     DisplayString
-   ACCESS     read-write
-   STATUS     mandatory
-   DESCRIPTION
-       "The name or label for the generator connected to the source 2 of the ATS."
-   ::= { xATSGeneratorStatus 1 }
-   
-xATSGeneratorStatusOperational OBJECT-TYPE
-   SYNTAX     INTEGER{
-      nocomm         (1),
-      off            (2),
-      ready          (3),
-      starting       (4),
-      idle           (5),
-      running        (6),
-      normalStop     (7),
-      emergencyStop  (8),
-      notInAuto      (9),
-      shutdown       (10),
-      unknown        (11)
-   }
-   ACCESS     read-only
-   STATUS     mandatory
-   DESCRIPTION
-       "The operational status of the generator. unavailable when unrecognized status is received."
-   ::= { xATSGeneratorStatus 2 }
-
-xATSGeneratorStatusModeSwitchPosition OBJECT-TYPE
-   SYNTAX     INTEGER{
-      off        (1),
-      manual     (2),
-      automatic  (3),
-      unknown    (4)
-   }
-   ACCESS     read-only
-   STATUS     mandatory
-   DESCRIPTION
-       "The position of the generator's auto-mode switch.
-        In automatic mode, the generator is started and stopped via the
-        remote start contact, which has state indicated in the
-        xATSGeneratorStatusRemoteStart OID.
-        In manual mode generator start/stop control is via local command only.
-        Off prevents the generator from running."
-   ::= { xATSGeneratorStatus 3 }
-
-xATSGeneratorStatusRemoteStart OBJECT-TYPE
-   SYNTAX INTEGER{
-      stop     (1),
-      run      (2),
-      unknown  (3)
-   }
-   ACCESS     read-only
-   STATUS     mandatory
-   DESCRIPTION
-       "The status of the generator's remote start contact, which is 
-        provided as an output from the transfer switch to start/stop the 
-        generator when in automatic mode."
-   ::= { xATSGeneratorStatus 4 }
-
--- The xATS Generator Advanced Status group
-
-xATSGeneratorAdvStatusBatteryVoltage OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The voltage of the generator's starting battery.
-       Measured in tenths of VDC, or -1 if not available."
-   ::= { xATSGeneratorAdvStatus 1 }
-
-xATSGeneratorAdvStatusOilPressure OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The generator's engine oil pressure.
-       Measured in tenths of Psi or kPa, based on the
-       value of the xATSGeneratorSettingsMetricUnit OID,
-       or -1 if not available."
-   ::= { xATSGeneratorAdvStatus 2 }
-
-xATSGeneratorAdvStatusCoolantTemperature OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Current coolant temperature in the generator.
-       Measured in degrees Celsius or Fahrenheit, based on the
-       value of the xATSGeneratorSettingsMetricUnit OID,
-       or -1 if not available."
-   ::= { xATSGeneratorAdvStatus 3 }
-
-xATSGeneratorAdvStatusEngineRPM OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Current engine speed of the generator. 
-       Measured in RPM, or -1 if not available."
-   ::= { xATSGeneratorAdvStatus 4 }
-
-xATSGeneratorAdvStatusOilLevel OBJECT-TYPE
-   SYNTAX     INTEGER{
-      ok        (1),
-      low       (2),
-      unknown   (3)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Indicates adequate oil level in the generator."
-   ::= { xATSGeneratorAdvStatus 5 }
-
-xATSGeneratorAdvStatusCoolantLevel OBJECT-TYPE
-   SYNTAX     INTEGER{
-      ok         (1),
-      low        (2),
-      unknown    (3)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Indicates adequate coolant level in the generator."
-   ::= { xATSGeneratorAdvStatus 6 }
-
--- The xATS Generator Output group
-
-xATSGeneratorOutputFrequency OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The output frequency of the generator.
-       Measured in tenths of Hertz, or -1 if not avaialble."
-   ::= { xATSGeneratorOutput 1 }
-
-xATSGeneratorOutputTotalPower OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The total output power of the generator.
-       Measured in tenths of tenths of kW, or -1 if not avaialble."
-   ::= { xATSGeneratorOutput 2 }
-
-xATSGeneratorOutputTotalApparentPower OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The total output power of the generator.
-       Measured in tenths of kVA, or -1 if not avaialble."
-   ::= { xATSGeneratorOutput 3 }
-   
-xATSGeneratorOutputTotalPowerFactor OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-          "Indicates the total load power factor of the generator.
-           A value of 100 representing a unity power factor (1.00),
-           or -1 when if not avaialble."
-   ::= { xATSGeneratorOutput 4 }
-   
-xATSGeneratorOutputTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of generator output phase entries."
-   ::= { xATSGeneratorOutput 5 }
-
-   xATSGeneratorOutputTable OBJECT-TYPE
-       SYNTAX     SEQUENCE OF XATSGeneratorOutputPhaseEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-      "A list of generator output table entries.
-       The number of entries is contained in the xATSGeneratorOutputTableSize OID."
-       ::= { xATSGeneratorOutput 6 }
-
-   xATSGeneratorOutputPhaseEntry OBJECT-TYPE
-       SYNTAX     XATSGeneratorOutputPhaseEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-          "An entry containing information applicable to a 
-           particular generator output phase."
-       INDEX { xATSGeneratorOutputPhaseIndex }
-       ::= { xATSGeneratorOutputTable 1 }
-
-   XATSGeneratorOutputPhaseEntry ::= SEQUENCE {
-       xATSGeneratorOutputPhaseIndex      INTEGER,
-       xATSGeneratorOutputVoltageLtoL     INTEGER,
-       xATSGeneratorOutputVoltageLtoN     INTEGER,
-       xATSGeneratorOutputPhaseCurrent    INTEGER,
-       xATSGeneratorOutputPower           INTEGER,
-       xATSGeneratorOutputApparentPower   INTEGER,
-       xATSGeneratorOutputPowerFactor     INTEGER
-      }
-
-   xATSGeneratorOutputPhaseIndex OBJECT-TYPE
-       SYNTAX     INTEGER{
-          phase1(1),
-          phase2(2),
-          phase3(3)
-         } 
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "Description of each generator output phase utilized in this device."
-       ::= { xATSGeneratorOutputPhaseEntry 1 }
-
-   xATSGeneratorOutputVoltageLtoL OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "Line-to-line generator output voltage. 
-           Measured in Volts, or -1 if not available."
-       ::= { xATSGeneratorOutputPhaseEntry 2 }
-
-   xATSGeneratorOutputVoltageLtoN OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "Line-to-neutral generator output voltage. 
-           Measured in volts, or -1 if not avaialble."
-       ::= { xATSGeneratorOutputPhaseEntry 3 }
-
-   xATSGeneratorOutputPhaseCurrent OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "Generator load current per phase.
-           Measured in Amps, or -1 if not avaialble."
-       ::= { xATSGeneratorOutputPhaseEntry 4 }
-
-   xATSGeneratorOutputPower OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "Generator output power per phase. 
-           Measured in tenths of kW, or -1 if not avaialble."
-       ::= { xATSGeneratorOutputPhaseEntry 5 }
-
-   xATSGeneratorOutputApparentPower OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "Generator output power per phase. 
-           Measured in tenths of kVA, or -1 if not available."
-       ::= { xATSGeneratorOutputPhaseEntry 6 }
-
-   xATSGeneratorOutputPowerFactor OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-          "Indicates the load power factor of the generator output per phase.
-           A value of 100 representing a unity power factor (1.00),
-           or -1 if not avaialble."
-       ::= { xATSGeneratorOutputPhaseEntry 7 }
-
--- xATS Generator Settings group
-
-xATSGeneratorSettingsVoltageAdjust OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The voltage adjust of the generator.
-       Specified in volts line-to-line,
-       or -1 if not available."
-   ::= { xATSGeneratorSettings 1 }
-
-xATSGeneratorSettingsFrequencyAdjust OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The frequency adjust of the generator.
-       Specified in tenths of Hertz."
-   ::= { xATSGeneratorSettings 2 }
-
-xATSGeneratorSettingsStartDelay OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The delay, in seconds, after the remote run signal is activated
-       before the generator's engine will be cranked to start, 
-       or -1 if not available."
-   ::= { xATSGeneratorSettings 3 }
-
-xATSGeneratorSettingsStopDelay OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The delay, in seconds, before the generator will stop 
-       after the remote run signal is deactivated,
-       or -1 if not available."
-   ::= { xATSGeneratorSettings 4 }
-
-xATSGeneratorSettingsCrankCycleEnable OBJECT-TYPE
-   SYNTAX     INTEGER{
-      disabled        (1),
-      enabled         (2),
-      unknown         (3)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "When Crank Cycle is enabled, the engine will be cranked up to the time 
-       specified by the xATSGeneratorSettingsCrankTime OID. 
-       If the generator's engine does not start, there will be a pause as
-       specified by the xATSGeneratorSettingsCrankRestTime OID before the 
-       engine will be cranked again. This cycle is repeated as specified by
-       the xATSGeneratorSettingsNumberCrank OID.
-       When crank cycle is disabled, the generator's engine will be 
-       cranked continuously until it starts."
-   ::= { xATSGeneratorSettings 5 }
-
-xATSGeneratorSettingsCrankTime OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The duration of engine cranking, in seconds, when starting the generator. 
-       Applicable when the xATSGeneratorSettingsCrankCycleEnable OID is enabled.
-       -1 if not available."
-   ::= { xATSGeneratorSettings 6 }
-
-xATSGeneratorSettingsCrankRestTime OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The pause duration, in seconds, following an unsuccessful attempt to start the generator. 
-       Applicable when the xATSGeneratorSettingsCrankCycleEnable OID is enabled.
-       -1 if not available."
-   ::= { xATSGeneratorSettings 7 }
-
-xATSGeneratorSettingsNumberCrank OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of failed crank attempts before giving up on starting the generator. 
-       Applicable when the xATSGeneratorSettingsCrankCycleEnable OID is enabled.
-       -1 if not available."
-   ::= { xATSGeneratorSettings 8 }
-
-xATSGeneratorSettingsMetricUnit OBJECT-TYPE
-   SYNTAX INTEGER{
-      disabled (1),
-      enabled  (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Specifies the use of metric units in generator related OIDs, as well
-       as on all other interfaces including the generator's local interface."
-   ::= { xATSGeneratorSettings 9 }
-
--- xATS generator service group
-
-xATSGeneratorServiceTotalRunHoursLifetime OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Total time that the generator engine has been run,
-       over the life of the generator. Measured in hours.
-       -1 if not available."
-   ::= { xATSGeneratorService 1 }
-
-xATSGeneratorServiceEngineStartsLifetime OBJECT-TYPE
-   SYNTAX     INTEGER
-   ACCESS     read-only
-   STATUS     mandatory
-   DESCRIPTION
-      "Number of engine starts over the life of the generator.
-      -1 if not available."
-   ::= { xATSGeneratorService 2 }
-
-xATSGeneratorServiceTotalkWhLifetime OBJECT-TYPE
-   SYNTAX     INTEGER
-   ACCESS     read-only
-   STATUS     mandatory
-   DESCRIPTION
-      "Total kWh of operation over the life of the generator.
-       -1 if not available."
-   ::= { xATSGeneratorService 3 }
-
-xATSGeneratorServiceTotalRunHoursSinceMaintanence OBJECT-TYPE
-   SYNTAX     INTEGER
-   ACCESS     read-only
-   STATUS     mandatory
-   DESCRIPTION
-      "Total time that the generator engine has been run,
-       since last service maintenance. Measured in tenths of hours.
-       -1 if not available."
-   ::= { xATSGeneratorService 4 }
-
-xATSGeneratorServiceEngineStartsSinceMaintanence OBJECT-TYPE
-   SYNTAX     INTEGER
-   ACCESS     read-only
-   STATUS     mandatory
-   DESCRIPTION
-      "Number of engine starts since last service maintenance.
-       -1 if not available."
-   ::= { xATSGeneratorService 5 }
-
-xATSGeneratorServiceTotalkWhMaintanence OBJECT-TYPE
-   SYNTAX     INTEGER
-   ACCESS     read-only
-   STATUS     mandatory
-   DESCRIPTION
-      "Total kWh of operation since last service maintenance.
-       -1 if not available."
-   ::= { xATSGeneratorService 6 }
-
-xATSGeneratorServiceResetRecord OBJECT-TYPE
-   SYNTAX INTEGER{
-      yes        (1),
-      no         (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Resets the engine start counter, engine run-hours, and kWh values that have
-       accumulated in the generator since last maintenance.
-       Also, the last service date will be reset to the current system date, and 
-       any service alarms will be cleared."
-   ::= { xATSGeneratorService 7 }
-
-xATSGeneratorServiceRecordResetDate OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Date at which the generator's service record was reset, in dd-mmm-yyyy format."
-   ::= { xATSGeneratorService 8 }
-
-xATSGeneratorServiceNextServiceDate OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Date at which the next generator service is due in dd-mmm-yyyy format. 
-       Based on the xATSGeneratorServiceCalendarIntervalThreshold OID 
-       or '' if the calander-based threshold is set to off."
-   ::= { xATSGeneratorService 9 }
-   
-xATSGeneratorServiceRunHoursUntilServiceDate OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Runhours until the next generator service is due, in hours. 
-       Based on the xATSGeneratorServiceRunHoursThreshold OID 
-       or -1 if the runhour-based threshold is set to off."
-   ::= { xATSGeneratorService 10 }
-      
-xATSGeneratorServiceRunHoursThreshold OBJECT-TYPE
-   SYNTAX INTEGER{
-      disabled                 (1),
-      runThreshold100Hours     (2),
-      runThreshold150Hours     (3),
-      runThreshold200Hours     (4),
-      runThreshold250Hours     (5),
-      runThreshold300Hours     (6),
-      runThreshold400Hours     (7),
-      runThreshold500Hours     (8)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Runhour-based service interval. When the run-hours since
-       service surpasses this threshold, generator service is due."
-   ::= { xATSGeneratorService 11 }
-
-xATSGeneratorServiceCalendarIntervalThreshold OBJECT-TYPE
-   SYNTAX INTEGER{
-      disabled            (1),
-      interval1month      (2),
-      interval2month      (3),
-      interval3month      (4),
-      interval6month      (5),
-      intervalyearly      (6)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Calander-based service interval. When the next service date, 
-       as indicated by the xATSGeneratorServiceNextServiceDate OID
-       is in the past, generator is due for service."
-   ::= { xATSGeneratorService 12 }
-
--- The xATS Generator Fuel system group
-
-xATSGeneratorFuelSystemType OBJECT-TYPE
-   SYNTAX     INTEGER{
-      diesel      (1),
-      propane     (2),
-      naturalGas  (3),
-      unknown     (4)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The type of fuel used by the generator."
-   ::= { xATSGeneratorFuelSystem 1 }
-
-xATSGeneratorFuelSystemTankSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Size of the generator's fuel tank.
-       Specified in gallons or liters, based on the value of the
-       xATSGeneratorSettingsMetricUnit OID, or -1 if not available."
-   ::= { xATSGeneratorFuelSystem 2 }
-
-xATSGeneratorFuelSystemFuelLevel OBJECT-TYPE
-   SYNTAX  INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Fuel remaining in the generator tank.
-       Measured in percent of tank fill, or -1 if if not available."
-   ::= { xATSGeneratorFuelSystem 3 }
-
-xATSGeneratorFuelSystemRuntimePower OBJECT-TYPE
-   SYNTAX  INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The power value used in the runtime remaining calculation.
-       Measured in tenths of kW, or -1 if not available."
-   ::= { xATSGeneratorFuelSystem 4 }
-
-xATSGeneratorFuelSystemEstimatedRunTime OBJECT-TYPE
-   SYNTAX  INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "An estimate of available runtime for the generator, based on
-       available fuel as specified in the xATSGeneratorFuelSystemFuelLevel OID 
-       and kW load as specified in the xATSGeneratorFuelSystemRuntimePower OID.
-       Measured in tenths of hours, or -1 if not available."
-   ::= { xATSGeneratorFuelSystem 5 }
-   
-xATSGeneratorFuelSystemLowRunTimeThreshold OBJECT-TYPE
-   SYNTAX INTEGER{
-      disabled        (1),
-      oneHour         (2),
-      twoHours        (3),
-      threeHours      (4),
-      fourHours       (5),
-      fiveHours       (6),
-      sixHours        (7),
-      twelveHours     (8),
-      oneDay          (9),
-      twoDays         (10),
-      threeDays       (11),
-      fourDays        (12),
-      fiveDays        (13),
-      sixDays         (14),
-      sevenDays       (15)
-      
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Threshold below which a low runtime alarm will exist."
-   ::= { xATSGeneratorFuelSystem 6 }
-
-xATSGeneratorFuelSystemVeryLowRunTimeThreshold OBJECT-TYPE
-   SYNTAX INTEGER{
-      disabled        (1),
-      oneHour         (2),
-      twoHours        (3),
-      threeHours      (4),
-      fourHours       (5),
-      fiveHours       (6),
-      sixHours        (7),
-      twelveHours     (8),
-      oneDay          (9),
-      twoDays         (10),
-      threeDays       (11),
-      fourDays        (12),
-      fiveDays        (13),
-      sixDays         (14),
-      sevenDays       (15)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Threshold below which a very low runtime alarm will exist."
-   ::= { xATSGeneratorFuelSystem 7 }
-
-xATSGeneratorFuelSystemLowFuelLevelThreshold OBJECT-TYPE
-   SYNTAX INTEGER (0..100)
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Threshold below which a low fuel alarm will exist, with a value of 0 indicating disabled. 
-       Specified as percent of tank fill."
-   ::= { xATSGeneratorFuelSystem 8 }
-
-xATSGeneratorFuelSystemVeryLowFuelLevelThreshold OBJECT-TYPE
-   SYNTAX INTEGER (0..100)
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Threshold below which a very low fuel alarm will exist, with a value of 0 indicating disabled.
-       Specified as percent of tank fill."
-   ::= { xATSGeneratorFuelSystem 9 }
-
--- the software group
--- the powerNetSubAgent group
--- the powerNetSoftwareSystem group
-      
-powerNetSoftwareSystemDescription OBJECT-TYPE
-   SYNTAX  DisplayString (SIZE (0..79))
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "A brief description of the PowerNet sub-agent."
-   ::= { powerNetSoftwareSystem 1 }
-
-powerNetSoftwareOid  OBJECT-TYPE
-   SYNTAX  OBJECT IDENTIFIER
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The object identifier of the PowerNet sub-agent."
-   ::= { powerNetSoftwareSystem 2 }
-
--- powerNetSmuxPeer     OBJECT IDENTIFIER ::= { powerNetSoftwareOid 1 }
--- powerNetDPIPeer      OBJECT IDENTIFIER ::= { powerNetSoftwareOid 2 }
-
-powerNetSoftwareSystemUpTime  OBJECT-TYPE
-   SYNTAX  TimeTicks
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-         "The time that the sub-agent has been running."
-   ::= { powerNetSoftwareSystem 3 }
-
-
--- powerNetSoftwareConfig group
-
-powerNetSoftwareTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of software modules supporting the UPS."
-   ::= { powerNetSoftwareConfig 1 }
-
-powerNetSoftwareTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF SoftwareEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION 
-      "A list of the software monitoring the UPS."
-   ::= { powerNetSoftwareConfig 2 }
-
-powerNetSoftwareEntry OBJECT-TYPE
-   SYNTAX SoftwareEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "An entry containing information on a software module."
-   INDEX { moduleNumber }
-   ::= { powerNetSoftwareTable 1 }
-
-SoftwareEntry ::= 
-   SEQUENCE {
-      moduleNumber
-         INTEGER,
-      moduleName
-         DisplayString,
-      moduleVersion
-         DisplayString,
-      moduleDate
-         DisplayString
-   }
-
-moduleNumber OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index into the Software Entry Table"
-   ::= { powerNetSoftwareEntry 1 }
-
-moduleName OBJECT-TYPE
-   SYNTAX DisplayString (SIZE (0..79))
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The name of the software module."
-   ::= { powerNetSoftwareEntry 2 }
-
-moduleVersion OBJECT-TYPE
-   SYNTAX DisplayString (SIZE (0..8))
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The version of the software module." 
-   ::= { powerNetSoftwareEntry 3 }
-
-moduleDate OBJECT-TYPE
-   SYNTAX DisplayString (SIZE (0..9))
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The date of the software module represented as mm-dd-yy."
-   ::= { powerNetSoftwareEntry 4 }
-
-
--- the ups group
--- the upsIdent group
--- the upsBasicIdent
-
-upsBasicIdentModel OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The UPS model name (e.g. 'APC Smart-UPS 600')."
-   ::= { upsBasicIdent 1 }
-
-upsBasicIdentName OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "An 8 byte ID string identifying the UPS.  This object
-       can be set by the administrator."
-   ::= { upsBasicIdent 2 }
-
-
--- the upsAdvIdent group
-
-upsAdvIdentFirmwareRevision OBJECT-TYPE
-   SYNTAX DisplayString 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The firmware revision of the UPS system's microprocessor."
-   ::= { upsAdvIdent 1 }
-
-upsAdvIdentDateOfManufacture OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The date when the UPS was manufactured in mm/dd/yy format."
-   ::= { upsAdvIdent 2 }
-
-upsAdvIdentSerialNumber OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "An 8-character string identifying the serial number of 
-       the UPS internal microprocessor.  This number is set at
-       the factory.  NOTE: This number does NOT correspond to
-       the serial number on the rear of the UPS."
-   ::= { upsAdvIdent 3 }
-
-
-
--- the upsBattery group
--- the upsBasicBattery group
-
-upsBasicBatteryStatus OBJECT-TYPE
-   SYNTAX INTEGER  {
-      unknown(1),
-      batteryNormal(2),
-      batteryLow(3)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the UPS batteries.  A batteryLow(3) 
-       value indicates the UPS will be unable to sustain the 
-       current load, and its services will be lost if power is 
-       not restored.  The amount of run time in reserve at the 
-       time of low battery can be configured by the 
-       upsAdvConfigLowBatteryRunTime."
-   ::= { upsBasicBattery 1 }
-
-upsBasicBatteryTimeOnBattery OBJECT-TYPE
-   SYNTAX TimeTicks 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The elapsed time since the UPS has switched to battery 
-       power."
-   ::= { upsBasicBattery 2 }
-
-upsBasicBatteryLastReplaceDate OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The date when the UPS system's batteries were last replaced 
-       in mm/dd/yy format.   For Smart-UPS models, this value 
-       is originally set in the factory.  When the UPS batteries 
-       are replaced, this value should be reset by the administrator."
-   ::= { upsBasicBattery 3 }
-
-
-
--- the upsAdvBattery group
-
-upsAdvBatteryCapacity OBJECT-TYPE
-   SYNTAX Gauge
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The remaining battery capacity expressed in 
-       percent of full capacity."
-   ::= { upsAdvBattery 1 }
-
-upsAdvBatteryTemperature OBJECT-TYPE
-   SYNTAX Gauge
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The current internal UPS temperature expressed in 
-       Celsius."
-   ::= { upsAdvBattery 2 }
-
-upsAdvBatteryRunTimeRemaining OBJECT-TYPE
-   SYNTAX TimeTicks 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The UPS battery run time remaining before battery 
-       exhaustion."
-   ::= { upsAdvBattery 3 }
-
-upsAdvBatteryReplaceIndicator OBJECT-TYPE
-   SYNTAX INTEGER  {
-      noBatteryNeedsReplacing(1),
-      batteryNeedsReplacing(2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Indicates whether the UPS batteries need replacing."
-   ::= { upsAdvBattery 4 }
-
-upsAdvBatteryNumOfBattPacks OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of external battery packs connected to the UPS. If
-       the UPS does not use smart cells then the agent reports
-       ERROR_NO_SUCH_NAME."
-   ::= { upsAdvBattery 5 }
-
-upsAdvBatteryNumOfBadBattPacks OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of external battery packs connected to the UPS that 
-       are defective. If the UPS does not use smart cells then the
-       agent reports ERROR_NO_SUCH_NAME."
-   ::= { upsAdvBattery 6 }
-
-upsAdvBatteryNominalVoltage OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The nominal battery voltage in Volts."
-   ::= { upsAdvBattery 7 }
-
-upsAdvBatteryActualVoltage OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The actual battery bus voltage in Volts."
-   ::= { upsAdvBattery 8 }
-
-upsAdvBatteryCurrent OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The battery current in Amps."
-   ::= { upsAdvBattery 9 }
-
-upsAdvTotalDCCurrent OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The total DC current in Amps."
-   ::= { upsAdvBattery 10 }
-
-
--- the upsBasicInput group
-
-upsBasicInputPhase OBJECT-TYPE
-   SYNTAX INTEGER                  
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The current AC input phase."
-   ::= { upsBasicInput 1 }
-
-
--- the upsAdvInput group
-
-upsAdvInputLineVoltage OBJECT-TYPE
-   SYNTAX Gauge
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The current utility line voltage in VAC."
-   ::= { upsAdvInput 1 }
-
-upsAdvInputMaxLineVoltage OBJECT-TYPE
-   SYNTAX Gauge
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The maximum utility line voltage in VAC over the
-       previous 1 minute period."
-   ::= { upsAdvInput 2 }
-
-upsAdvInputMinLineVoltage OBJECT-TYPE
-   SYNTAX Gauge
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The minimum utility line voltage in VAC over the
-       previous 1 minute period."
-   ::= { upsAdvInput 3 }
-
-upsAdvInputFrequency OBJECT-TYPE
-   SYNTAX Gauge
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The current input frequency to the UPS system in Hz."
-   ::= { upsAdvInput 4 }
-
-
-upsAdvInputLineFailCause OBJECT-TYPE
-   SYNTAX INTEGER  {
-      noTransfer(1),
-      highLineVoltage(2),
-      brownout(3),
-      blackout(4),
-      smallMomentarySag(5),
-      deepMomentarySag(6),
-      smallMomentarySpike(7),
-      largeMomentarySpike(8),
-      selfTest(9),
-      rateOfVoltageChnage(10)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The reason for the occurrence of the last transfer to UPS
-       battery power.  The variable is set to:
-       - noTransfer(1) -- if there is no transfer yet.
-       - highLineVoltage(2) -- if the transfer to battery is caused
-       by an over voltage greater than the high transfer voltage.
-       - brownout(3) -- if the duration of the outage is greater than
-       five seconds and the line voltage is between 40% of the
-       rated output voltage and the low transfer voltage.
-       - blackout(4) -- if the duration of the outage is greater than five
-       seconds and the line voltage is between 40% of the rated 
-       output voltage and ground.
-       - smallMomentarySag(5) -- if the duration of the outage is less
-       than five seconds and the line voltage is between 40% of the
-       rated output voltage and the low transfer voltage.
-       - deepMomentarySag(6) -- if the duration of the outage is less 
-       than five seconds and the line voltage is between 40% of the 
-       rated output voltage and ground.  The variable is set to 
-       - smallMomentarySpike(7) -- if the line failure is caused by a
-       rate of change of input voltage less than ten volts per cycle.
-       - largeMomentarySpike(8) -- if the line failure is caused by 
-       a rate of change of input voltage greater than ten volts per cycle.
-       - selfTest(9) -- if the UPS was commanded to do a self test.
-       - rateOfVoltageChange(10) -- if the failure is due to the rate of change of
-       the line voltage."
-   ::= { upsAdvInput 5 }
-
-
--- the upsBasicOutput group
-
-upsBasicOutputStatus OBJECT-TYPE
-   SYNTAX INTEGER  {
-      unknown(1),
-      onLine(2),
-      onBattery(3),
-      onSmartBoost(4),
-      timedSleeping(5),
-      softwareBypass(6),
-      off(7),
-      rebooting(8),
-      switchedBypass(9),
-      hardwareFailureBypass(10),
-      sleepingUntilPowerReturn(11),
-      onSmartTrim(12)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The current state of the UPS.  If the UPS is unable 
-       to determine the state of the UPS this variable is set 
-       to unknown(1)."
-   ::= { upsBasicOutput 1 }
-
-upsBasicOutputPhase OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The current output phase."
-   ::= { upsBasicOutput 2 }
-
-
--- the upsAdvOutput group
-
-upsAdvOutputVoltage OBJECT-TYPE
-   SYNTAX Gauge
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The output voltage of the UPS system in VAC."
-   ::= { upsAdvOutput 1 }
-
-upsAdvOutputFrequency OBJECT-TYPE
-   SYNTAX Gauge
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The current output frequency of the UPS system in Hz."
-   ::= { upsAdvOutput 2 }
-
-upsAdvOutputLoad OBJECT-TYPE
-   SYNTAX Gauge
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The current UPS load expressed in percent 
-       of rated capacity."
-   ::= { upsAdvOutput 3 }
-
-upsAdvOutputCurrent OBJECT-TYPE
-   SYNTAX Gauge
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The current in amperes drawn by the load on the UPS."
-   ::= { upsAdvOutput 4 }
-
-
--- the upsBasicConfig group
-
-upsBasicConfigNumDevices OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of devices that are plugged into the UPS."
-   ::= { upsBasicConfig 1 }
-
-upsBasicConfigDeviceTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF UpsBasicConfigDeviceEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "A list of devices that are plugged into the UPS.
-       The number of entries is given by the value of
-       upsBasicConfigNumDevices."
-   ::= { upsBasicConfig 2 }
-
-upsBasicConfigDeviceEntry OBJECT-TYPE
-   SYNTAX UpsBasicConfigDeviceEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The devices plugged in to the UPS."
-   INDEX  { deviceIndex }
-   ::= { upsBasicConfigDeviceTable 1 }
-
-UpsBasicConfigDeviceEntry ::=
-   SEQUENCE {
-      deviceIndex 
-         INTEGER,
-      deviceName
-         DisplayString,
-      vaRating
-         INTEGER,
-      acceptThisDevice
-         INTEGER
-   }
-
-deviceIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index of the device that is plugged into the UPS."
-   ::= { upsBasicConfigDeviceEntry 1 }
-
-deviceName OBJECT-TYPE
-   SYNTAX DisplayString 
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The name/description of the device plugged into the UPS."
-   ::= { upsBasicConfigDeviceEntry 2 }
-
-vaRating OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The volt-amp rating of the device plugged into the UPS."
-   ::= { upsBasicConfigDeviceEntry 3 }
-
-acceptThisDevice OBJECT-TYPE
-   SYNTAX INTEGER   {
-      yes(1),
-      no(2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "An entry is added if yes, the entry is deleted if no."
-   ::= { upsBasicConfigDeviceEntry 4 }
-
-
-
-
--- the upsAdvConfig group
-
-upsAdvConfigRatedOutputVoltage OBJECT-TYPE
-   SYNTAX INTEGER  
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The nominal output voltage from the UPS in VAC. 
-
-       For a list of allowed values supported by your UPS model,
-       see the UPS User's Manual.
-      
-       If a value other than a supported value is provided in a 
-       set request, the UPS interprets it as the next lower
-       acceptable value.  If the provided value is lower than
-       the lowest acceptable value, the lowest acceptable 
-       value is used."
-   ::= { upsAdvConfig 1 }
-
-upsAdvConfigHighTransferVolt OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The maximum line voltage in VAC allowed before the
-       UPS system transfers to battery backup.
-
-       For a list of allowed values supported by your UPS model,
-       see the UPS User's Manual.
-
-       If a value other than a supported value is provided in a
-       set request, the UPS interprets it as a the next higher
-       acceptable value.  If the provided value is higher than
-       the highest acceptable value, the highest acceptable 
-       value is used."
-   ::= { upsAdvConfig 2 }
-
-upsAdvConfigLowTransferVolt OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The minimum line voltage in VAC allowed before the
-       UPS system transfers to battery backup.
-      
-       For a list of allowed values supported by your UPS model,
-       see the UPS User's Manual.
-
-       If a value other than a supported value is provided in a 
-       set request, the UPS interprets it as the next lower
-       acceptable value.  If the provided value is lower than
-       the lowest acceptable value, the lowest acceptable 
-       value is used."
-   ::= { upsAdvConfig 3 }
-
-upsAdvConfigAlarm OBJECT-TYPE
-   SYNTAX INTEGER  {
-      timed(1),
-      atLowBattery(2),
-      never(3),
-      mute(4)
-   } 
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "A flag indicating how the UPS should handle audible
-       line fail alarms:
-       timed(1): UPS alarm will sound after a preset timed duration starting
-       from the line fail condition (see OID upsAdvConfigAlarmTimer for the
-       alarm timer value)
-       atLowBattery(2): UPS alarm will sound when the UPS has reached a Low
-       Battery condition during a line fail
-       never(3): Disables the UPS audible alarm
-       mute(4): Mutes the current alarm for some UPSs only when it is in an
-       alarm state and will return to the previously configured option when
-       the UPS recovers from the alarm condition"
-   ::= { upsAdvConfig 4 }
-
-upsAdvConfigAlarmTimer OBJECT-TYPE
-   SYNTAX TimeTicks 
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The time after initial line failure at which the UPS
-       begins emitting audible alarms (beeping).  This timer is
-       observed only if the value of extControlAlarm is timed(2).
-       Allowed values are 0 or 30 seconds.
-
-       If a value other than a supported value is provided in a
-       set request, the UPS interprets it as a the next lower
-       acceptable value.  If the provided value is lower than
-       the lowest acceptable value, the lowest acceptable 
-       value is used."
-   ::= { upsAdvConfig 5 }
-
-upsAdvConfigMinReturnCapacity OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The minimum battery capacity required before the UPS will 
-       return from a low battery shutdown condition.  The capacity is
-       measured from 0% battery capacity (or Low Battery) as a percent
-       of full capacity (100%).   In other words, the UPS will not re-energize
-       the output until the battery has charged so that its' capacity is equal 
-       to this value.
-       
-       For a list of allowed values supported by your UPS model,
-       see the UPS User's Manual.
-
-       If a value other than a supported value is provided in a
-       set request, the UPS interprets it as a the next higher
-       acceptable value.  If the provided value is higher than
-       the highest acceptable value, the highest acceptable 
-       value is used."
-   ::= { upsAdvConfig 6 }
-
-upsAdvConfigSensitivity OBJECT-TYPE
-   SYNTAX INTEGER  {
-      auto(1),
-      low(2),
-      medium(3),
-      high(4)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The sensitivity of the UPS to utility line abnormalities
-       or noises."
-   ::= { upsAdvConfig 7 }
-
-upsAdvConfigLowBatteryRunTime OBJECT-TYPE
-   SYNTAX TimeTicks 
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The desired run time of the UPS, in seconds, once the 
-       low battery condition is reached. During this time the UPS will
-       produce a constant warning tone which can not be disabled.
-       
-       For a list of allowed values supported by your UPS model,
-       see the UPS User's Manual.
-
-       If a value other than a supported value is provided in a set
-       request, the UPS interprets the value as the next higher
-       acceptable value.  If the provided value is higher than the
-       highest acceptable value, the highest acceptable value is used."
-   ::= { upsAdvConfig 8 }
-
-upsAdvConfigReturnDelay OBJECT-TYPE
-   SYNTAX TimeTicks
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The delay in seconds after utility line power returns
-       before the UPS will turn on.  This value is also used 
-       when the UPS comes out of a reboot and before the UPS
-       wakes up from 'sleep' mode.
-
-       For a list of allowed values supported by your UPS model,
-       see the UPS User's Manual.
-      
-       If a value other than a supported value is provided in a
-       set request, the UPS interprets it as a the next higher
-       acceptable value.  If the provided value is higher than
-       the highest acceptable value, the highest acceptable 
-       value is used."
-   ::= { upsAdvConfig 9 }
-
-upsAdvConfigShutoffDelay OBJECT-TYPE
-   SYNTAX TimeTicks 
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The delay in seconds the UPS remains on after being told 
-       to turn off.
-
-       For a list of allowed values supported by your UPS model,
-       see the UPS User's Manual.
-
-       If a value other than a supported value is provided in a
-       set request, the UPS interprets it as a the next higher
-       acceptable value.  If the provided value is higher than
-       the highest acceptable value, the highest acceptable 
-       value is used."
-   ::= { upsAdvConfig 10 }
-
-upsAdvConfigUpsSleepTime OBJECT-TYPE
-   SYNTAX TimeTicks 
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The time in seconds for the UPS to go to 'sleep' when 
-       instructed.  When in sleep mode, the UPS will not provide
-       output power regardless of the input line state.  Once the
-       specified time has elapsed, output power will be restored.
-
-       This is a configuration setting.  The UPS will not go to
-       sleep until told to do so by the manager from a management
-       station.
-      
-       Any input value is allowed, however the UPS only recognizes
-       1/10 of an hour increments.  The provided value will be 
-       rounded to the closest 1/10 of an hour with one exception:
-       Any value entered between 1 and 540 seconds will be rounded 
-       to 360 seconds (or 6 minutes)."
-   ::= { upsAdvConfig 11 }
-
-
-upsAdvConfigSetEEPROMDefaults OBJECT-TYPE
-   SYNTAX INTEGER  {
-      noSetEEPROMDefaults(1),
-      setEEPROMDefaults(2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "WRITE: Resets the UPS EEPROM variables to default values.
-       READ: returns 0"
-   ::= { upsAdvConfig 12 }
-
-upsAdvConfigDipSwitchSetting OBJECT-TYPE
-   SYNTAX SEQUENCE OF UpsAdvConfigDipSwitchEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Current settings of UPS dip switches."
-   ::= { upsAdvConfig 13 }
-
-upsAdvConfigDipSwitchEntry OBJECT-TYPE
-   SYNTAX UpsAdvConfigDipSwitchEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The current setting of one dip switch."
-   INDEX  { dipSwitchIndex }
-   ::= { upsAdvConfigDipSwitchSetting 1 }
-
-UpsAdvConfigDipSwitchEntry ::=
-   SEQUENCE {
-      dipSwitchIndex 
-         INTEGER,
-      dipSwitchStatus
-         INTEGER
-   }
-
-dipSwitchIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index of a UPS dip switch."
-   ::= { upsAdvConfigDipSwitchEntry 1 }
-
-dipSwitchStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-      on(1),
-      off(2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The setting of a UPS dip switch."
-   ::= { upsAdvConfigDipSwitchEntry 2 }
-
-upsAdvConfigBattExhaustThresh OBJECT-TYPE
-   SYNTAX TimeTicks
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The number of seconds prior to battery exhaustion when the
-       UPS will switch off power to its load."
-   ::= { upsAdvConfig 14 }
-
-upsAdvConfigPassword OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The password entered at the UPS front panel to enable local
-       configuration of the EEProm. If the password is disabled or 
-       is not supported, then the agent returns a null string."
-   ::= { upsAdvConfig 15 }
-
-upsAdvConfigAllowedSetTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF ApcUpsConfigEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The table listing the allowed values for all discrete 
-       configurable UPS variables."
-   ::= { upsAdvConfig 16 }
-
-apcUpsConfigEntry OBJECT-TYPE
-   SYNTAX ApcUpsConfigEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The table entry for a configurable UPS variable."
-   INDEX  { apcUpsConfigFieldIndex }
-   ::= { upsAdvConfigAllowedSetTable 1 }
-
-ApcUpsConfigEntry ::= SEQUENCE {
-   apcUpsConfigFieldIndex        INTEGER,
-   apcUpsConfigFieldOID          OBJECT IDENTIFIER,
-   apcUpsConfigFieldValueRange   DisplayString
-   }
-
-apcUpsConfigFieldIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to an eeprom field entry."
-   ::= { apcUpsConfigEntry 1 }
-
-apcUpsConfigFieldOID OBJECT-TYPE
-   SYNTAX OBJECT IDENTIFIER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The OID of the current configurable value."
-   ::= { apcUpsConfigEntry 2 }
-
-apcUpsConfigFieldValueRange OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The discrete set of allowed values of a configurable 
-       register. Individual values are delimited by a comma."
-   ::= { apcUpsConfigEntry 3 }
-
-upsAdvConfigBattCabAmpHour OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Configure settings of UPS battery cabinet amp hour setting."
-   ::= { upsAdvConfig 17 }
-
-upsAdvConfigPositionSelector OBJECT-TYPE
-   SYNTAX INTEGER {
-     unknown  (1),
-     rack     (2),
-     tower    (3) 
-   }
-
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Configure UPS position selector.  If the UPS doesn't
-       support this configuration it will report unknown (1).
-       The positions are either rack (2) for rack mounted or
-       tower (3) for tower unit."
-   ::= { upsAdvConfig 18 }
-
-upsAdvConfigOutputFreqRange OBJECT-TYPE
-   SYNTAX INTEGER {
-     unknown          (1),
-     freqRangeAUTO    (2),
-     freqRange60Var1  (3),
-     freqRange60Var3  (4),
-     freqRange50Var1  (5),
-     freqRange50Var3  (6),
-     freqRange60Var10 (7),
-     freqRange50Var10 (8)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Configure the output frequency tolerance range.
-       unknown(1) indicates the output frequency is unknown.
-       freqRangeAUTO(2) configure the output frequency range for automatic.
-       freqRange60Var1(3) configure the output frequency range for 60 +/- 0.1 Hz
-       freqRange60Var3(4) configure the output frequency range for 60 +/- 3.0 Hz
-       freqRange50Var1(5) configure the output frequency range for 50 +/- 0.1 Hz
-       freqRange50Var3(6) configure the output frequency range for 50 +/- 3.0 Hz
-       freqRange60Var10(7) configure the output frequency range for 60 +/- 10 Hz
-       freqRange50Var10(8) configure the output frequency range for 50 +/- 10 Hz"
-   ::= { upsAdvConfig 19 }
-
-upsAdvConfigUPSFail OBJECT-TYPE
-   SYNTAX INTEGER {
-     unknown      (1),
-     gotoBypass   (2),
-     dropLoad     (3)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Configure the UPS fail action.  If UPS fails,
-      and frequency or voltage is out of range it will either
-      GotoBypass (2) or DropLoad (3).  This OID will report
-      unknown (1) if it is not supported feature or option."
-   ::= { upsAdvConfig 20 }
-
-upsAdvConfigAlarmRedundancy OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Configure settings of UPS alarm if the redundancy is
-      under the current redundancy.  Use -1 for never."
-   ::= { upsAdvConfig 21 }
-
-upsAdvConfigAlarmLoadOver OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Configure settings of UPS alarm if the load is
-      over the current load in kVA.  Use -1 for never."
-   ::= { upsAdvConfig 22 }
-
-upsAdvConfigAlarmRuntimeUnder OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Configure settings of UPS alarm if the runtime is
-      under the current time of minutes.  Use -1 for never."
-   ::= { upsAdvConfig 23 }
-
-upsAdvConfigVoutReporting OBJECT-TYPE
-   SYNTAX INTEGER {
-     unknown    (1),
-     voutAUTO   (2),
-     vout208    (3),
-     vout240    (4)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Configure the way the UPS scales its output voltage readings.
-       unknown(1) indicates the Vout Reporting is unknown.
-       voutAUTO(2) configure the Vout Reporting for automatic scalling.
-       vout208(3) configure the Vout Reporting for 208 Volts.
-       vout240(4) configure the Vout Reporting for 240 Volts."
-   ::= { upsAdvConfig 24 }
-
-upsAdvConfigNumExternalBatteries OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Configure the number of external batteries connected to the UPS."
-   ::= { upsAdvConfig 25 }
-
-upsAdvConfigSimpleSignalShutdowns OBJECT-TYPE
-   SYNTAX INTEGER {
-     unknown    (1),
-     disabled   (2),
-     enabled    (3)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Configure Simple Signal shutdown commands from the Simple Signal
-       port to be issued to the UPS.
-       unknown(1) indicates the Simple Signal Shutdown setting is unknown.
-       disabled(2) configure to disable Simple Signal Shutdowns.
-       enabled(3) configure to enable Simple Signal Shutdowns."
-   ::= { upsAdvConfig 26 }
-
-
--- the upsSyncCtrlGroupConfig group
-
-upsSCGMembershipGroupNumber OBJECT-TYPE
-   SYNTAX INTEGER  
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION       
-       "The SCG Membership Group number (MGN) is a 16-bit number allowing 
-       up to 65534 separate groups that can be identified and distinguished
-       per IP subnet. Zero and 65535 are not used. The MGN is used in all 
-       communication between members of the SCG and a Network Management Card
-       (NMC) will listen and only respond to commands sent to it using its 
-       configured SCG ID."         
-   ::= { upsSyncCtrlGroupConfig 1 }
-
-upsSCGActiveMembershipStatus OBJECT-TYPE
-    SYNTAX INTEGER  {
-      enabledSCG (1),
-      disabledSCG (2)
-    } 
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Membership in the configured SCG can be enabled and 
-      disabled.  If an NMC is configured for an SCG, but 
-      has its membership disabled, all synchronized control commands 
-      received will be ignored."
-   ::= { upsSyncCtrlGroupConfig 2 } 
-   
-upsSCGPowerSynchronizationDelayTime OBJECT-TYPE
-   SYNTAX INTEGER  
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION       
-        "The Power Synchronization Delay Time (PSD) setting is the maximum 
-         number of seconds an SCG Initiator will wait for all SCG members to 
-         recover utility power before completing the reboot sequence of a
-         reboot or sleep command. If all SCG members are ready to proceed, 
-         no additional delay is introduced."
-   ::= { upsSyncCtrlGroupConfig 3 }
-
-upsSCGReturnBatteryCapacityOffset OBJECT-TYPE
-   SYNTAX INTEGER  
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION       
-        "A reboot command uses the Initiator?s Return battery Capacity (RBC) to control
-        when the SCG completes this operation. In a Normal Control Operation (NCC) the 
-        UPS will only complete the reboot if RBC is reached.  Due to normal battery 
-        charge rate variations it may be desirable for the Followers to complete the 
-        reboot if they are within some range of the Initiator?s RBC when the Initiator 
-        is prepared (charged to RBC) to complete the reboot. The Return Battery 
-        Capacity Offset (RBCO) defines a percent battery capacity subtracted from an 
-        RBC above which a Follower?s battery must be charged for it to complete a 
-        reboot.  For example, if the Initiator?s RBC is 50% and the Initiator?s RBCO is
-        5% then a Follower?s battery capacity is within range if it is greater or equal 
-        to 45% (50% - 5%) at the time when the Initiator tries to complete the reboot 
-        command.  The default RBCO is 10%. "
-   ::= { upsSyncCtrlGroupConfig 4 }
-   
-upsSCGMultiCastIP OBJECT-TYPE
-       SYNTAX     IpAddress
-       ACCESS     read-write
-       STATUS     mandatory
-       DESCRIPTION
-               "The MultiCast IP address of the SCG Group."
-       ::= { upsSyncCtrlGroupConfig 5 } 
-         
--- the upsSyncCtrlGroupStatus group
-
-upsSCGNumOfGroupMembers OBJECT-TYPE
-   SYNTAX     INTEGER
-   ACCESS     read-only
-   STATUS     mandatory
-   DESCRIPTION
-       "The number of active, communicating members in the Sync Control Group (SCG).
-        This variable indicates the number of rows in the SCG Status Table."
-       ::= { upsSyncCtrlGroupStatus 1 }
-
--- Sync Control Group Status Table
-
-upsSCGStatusTable OBJECT-TYPE
-   SYNTAX     SEQUENCE OF UpsSCGStatusEntry
-   ACCESS     not-accessible
-   STATUS     mandatory
-   DESCRIPTION
-       "A list of SCG status table entries.  The number of entries
-        is given by the value of upsSCGNumOfGroupMembers."
-       ::= { upsSyncCtrlGroupStatus 2 }
-
-   upsSCGStatusEntry OBJECT-TYPE
-       SYNTAX     UpsSCGStatusEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-               "An entry containing information applicable to a
-               particular SCG Member."
-       INDEX { upsSCGStatusTableIndex }
-       ::= { upsSCGStatusTable 1 }
-
-   UpsSCGStatusEntry ::= SEQUENCE {
-       upsSCGStatusTableIndex           INTEGER,
-       upsSCGMemberIP                   IpAddress,
-       upsSCGACInputStatus              INTEGER,
-       upsSCGACOutputStatus             INTEGER
-   }
-
-   upsSCGStatusTableIndex OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The index of a status entry for an active, communicating SCG member."
-       ::= { upsSCGStatusEntry 1 }
-
-  upsSCGMemberIP OBJECT-TYPE
-       SYNTAX     IpAddress
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The IP address of an active, communicating SCG Member."
-       ::= { upsSCGStatusEntry 2 }
-
-   upsSCGACInputStatus OBJECT-TYPE
-        SYNTAX INTEGER {
-          acInGood(1),
-          acInBad(2)
-        }
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "This OID indicates the AC Input Status of the SCG Member.
-                acInGood(1) indicates the AC Input is within tolerance.
-                acInBad(2)  indicates the AC Input is not within tolerance."
-       ::= { upsSCGStatusEntry 3 }
-
-    upsSCGACOutputStatus OBJECT-TYPE
-        SYNTAX INTEGER {
-          acOutOn(1),
-          acOutOff(2)
-        }
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "This OID indicates the AC Output Status of the SCG Member.
-                acOutOn(1)  indicates the UPS output is providing power to the load.
-                acOutOff(2) indicates the UPS output is not providing power to the load. "
-       ::= { upsSCGStatusEntry 4 }
-
--- the upsBasicState group
-
-upsBasicStateOutputState OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "An ASCII string containing the 64 flags representing
-       the current state(s) of the UPS. If the Network Card
-       is unable to determine the state of the UPS, this
-       variable is set to ?UNKNOWN?.
-
-       The flags are numbered 1 to 64, read from left to
-       right. The flags are defined as follows:
-       
-       Flag  1: Abnormal Condition Present
-       Flag  2: On Battery
-       Flag  3: Low Battery
-       Flag  4: On Line
-            
-       Flag  5: Replace Battery
-       Flag  6: Serial Communication Established
-       Flag  7: AVR Boost Active*
-       Flag  8: AVR Trim Active*
-       
-       Flag  9: Overload
-       Flag 10: Runtime Calibration
-       Flag 11: Batteries Discharged
-       Flag 12: Manual Bypass
-
-       Flag 13: Software Bypass
-       Flag 14: In Bypass due to Internal Fault
-       Flag 15: In Bypass due to Supply Failure*
-       Flag 16: In Bypass due to Fan Failure*
-       
-       Flag 17: Sleeping on a Timer
-       Flag 18: Sleeping until Utility Power Returns
-       Flag 19: On
-       Flag 20: Rebooting
-       
-       Flag 21: Battery Communication Lost*
-       Flag 22: Graceful Shutdown Initiated
-       Flag 23: Smart Boost or Smart Trim Fault*
-       Flag 24: Bad Output Voltage*
-       
-       Flag 25: Battery Charger Failure*
-       Flag 26: High Battery Temperature
-       Flag 27: Self Test In Progress
-       Flag 28: Low Battery / On Battery
-       
-       Flag 29: Graceful Shutdown Issued by Upstream Device
-       Flag 30: Graceful Shutdown Issued by Downstream Device
-       Flag 31: No Batteries Attached*
-       Flag 32: Synchronized command is in progress
-       
-       Flag 33: <Not Used>
-       Flag 34: <Not Used>
-       Flag 35: <Not Used>
-       Flag 36: <Not Used>
-       
-       Flag 37: <Not Used>
-       Flag 38: <Not Used>
-       Flag 39: <Not Used>
-       Flag 40: <Not Used>
-       
-       Flag 41: <Not Used>
-       Flag 42: <Not Used>
-       Flag 43: <Not Used>
-       Flag 44: <Not Used>
-       
-       Flag 45: <Not Used>
-       Flag 46: <Not Used>
-       Flag 47: <Not Used>
-       Flag 48: <Not Used>
-       
-       Flag 49: <Not Used>
-       Flag 50: <Not Used>
-       Flag 51: <Not Used>
-       Flag 52: <Not Used>
-       
-       Flag 53: <Not Used>
-       Flag 54: <Not Used>
-       Flag 55: <Not Used>
-       Flag 56: <Not Used>
-       
-       Flag 57: <Not Used>
-       Flag 58: <Not Used>
-       Flag 59: <Not Used>
-       Flag 60: <Not Used>
-       
-       Flag 61: <Not Used>
-       Flag 62: <Not Used>
-       Flag 63: <Not Used>
-       Flag 64: <Not Used>"
-
-   ::= { upsBasicState 1 }
-
--- the upsAdvState group
-
-upsAdvStateAbnormalConditions OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "An ASCII string containing the 32 flags representing
-       the current active UPS faults. If the Network Card
-       is unable to determine the values of the flags, this
-       variable is set to ?UNKNOWN?. If this variable is not
-       supported by the connected UPS, this variable is set to
-       ?NOT SUPPORTED?.
-       
-       The flags are numbered from 1 to 32, and read from left to
-       right. The flags are defined as follows:
-
-       Flag  1: Power Module Failure
-       Flag  2: Main Intelligence Module Failure
-       Flag  3: Redundant Intelligence Module Failure
-       Flag  4: Battery Failure
-        
-       Flag  5: Load(kVA) Alarm Threshold Violation
-       Flag  6: Redundancy Lost
-       Flag  7: Redundancy Below Alarm Threshold
-       Flag  8: Bypass notin Range; Either Frequency or Voltage
-       
-       Flag  9: Bypass Contactor Stuck in Bypass Condition
-       Flag 10: Bypass Contactor Stuck in On-Line Condition
-       Flag 11: In Bypass due to an Internal Fault
-       Flag 12: In Bypass due to an Overload
-       
-       Flag 13: In Maintanence Bypass
-       Flag 14: Input Circuit Braker Tripped Open
-       Flag 15: System Level Fan Failure
-       Flag 16: Redundant Intelligent Module in Control
-       
-       Flag 17: IIC Inter-Module Communication Failure
-       Flag 18: No Working Power Modules
-       Flag 19: Load Shutdown From Bypass; Input Frequency
-       Flag 20: Runtime Below Alarm Threshold
-       
-       Flag 21: Extended Run Frame Fault
-       Flag 22: Output Voltage out of Range
-       Flag 23: UPS Not Synchronized
-       Flag 24: No Batteries Installed
-       
-       Flag 25: Battery Voltage High
-       Flag 26: UPS Specific Fault Detected
-       Flag 27: Site Wiring Fault
-       Flag 28: Backfeed Protection Relay Opened
-       
-       Flag 29: <Not Used>
-       Flag 30: <Not Used>
-       Flag 31: <Not Used>
-       Flag 32: <Not Used>"
-   ::= { upsAdvState 1 }
-
-upsAdvStateSymmetra3PhaseSpecificFaults OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "An ASCII string containing the 64 flags representing
-      the current active UPS specific faults for the Symmetra
-      3-Phase UPS models. If the Network Card is unable to
-      determine the values of the flags, this variable is set
-      to ?UNKNOWN?. If the connected UPS does not use this
-      variable, it is set to ?NOT SUPPORTED?.
-      
-      The flags are numbered from 1 to 64, and read from left
-      to right. The bits are defined as follows:
-      
-      Flag  1: External Switch Gear Failure
-      Flag  2: External Transformer Over Temperature
-      Flag  3: External DC Circuit Breaker Tripped
-      Flag  4: System Power Supply Failure
-        
-      Flag  5: Battery Monitor Card Failure
-      Flag  6: Battery Monitor Card Removed
-      Flag  7: XR Communication Card Failure
-      Flag  8: XR Communication Card Removed
-      
-      Flag  9: External Switch Gear Monitoring Card Failure
-      Flag 10: External Switch Gear Monitoring Card Removed
-      Flag 11: Internal DC Circiut Breaker Tripped
-      Flag 12: Static Bypass Switch Failure
-      
-      Flag 13: System EEPROM Removed
-      Flag 14: System EEPROM Failure
-      Flag 15: UPS in Forced Bypass
-      Flag 16: <Not Used>
-      
-      Flag 17: <Not Used>
-      Flag 18: <Not Used>
-      Flag 19: <Not Used>
-      Flag 20: <Not Used>
-      
-      Flag 21: <Not Used>
-      Flag 22: <Not Used>
-      Flag 23: <Not Used>
-      Flag 24: <Not Used>
-      
-      Flag 25: <Not Used>
-      Flag 26: <Not Used>
-      Flag 27: <Not Used>
-      Flag 28: <Not Used>
-      
-      Flag 29: <Not Used>
-      Flag 30: <Not Used>
-      Flag 31: <Not Used>
-      Flag 32: <Not Used>
-      
-      Flag 33: <Not Used>
-      Flag 34: <Not Used>
-      Flag 35: <Not Used>
-      Flag 36: <Not Used>
-      
-      Flag 37: <Not Used>
-      Flag 38: <Not Used>
-      Flag 39: <Not Used>
-      Flag 40: <Not Used>
-      
-      Flag 41: <Not Used>
-      Flag 42: <Not Used>
-      Flag 43: <Not Used>
-      Flag 44: <Not Used>
-      
-      Flag 45: <Not Used>
-      Flag 46: <Not Used>
-      Flag 47: <Not Used>
-      Flag 48: <Not Used>
-      
-      Flag 49: <Not Used>
-      Flag 50: <Not Used>
-      Flag 51: <Not Used>
-      Flag 52: <Not Used>
-      
-      Flag 53: <Not Used>
-      Flag 54: <Not Used>
-      Flag 55: <Not Used>
-      Flag 56: <Not Used>
-      
-      Flag 57: <Not Used>
-      Flag 58: <Not Used>
-      Flag 59: <Not Used>
-      Flag 60: <Not Used>
-      
-      Flag 61: <Not Used>
-      Flag 62: <Not Used>
-      Flag 63: <Not Used>
-      Flag 64: <Not Used>"
-   ::= { upsAdvState 2 }
-
-upsAdvStateDP300ESpecificFaults OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "An ASCII string containing the 64 flags representing
-      the current active UPS specific faults for the Silcon
-      DP300E UPS models. If the Network Card is unable to
-      determine the values of the flags, this variable is set
-      to ?UNKNOWN?. If the connected UPS does not use this
-      variable, it is set to ?NOT SUPPORTED?.
-      
-      The flags are numbered from 1 to 64, and read from left
-      to right. The bits are defined as follows:
-      
-      Flag  1: Peak Current Limiter Avtive
-      Flag  2: Bypass Power Supply Fault
-      Flag  3: Delta Current LImiter Active
-      Flag  4: Fan Fault
-        
-      Flag  5: High DC warning
-      Flag  6: Inverter Voltage Error
-      Flag  7: Parallel Synchronization Error
-      Flag  8: Second Power Supply Fault
-      
-      Flag  9: Internal Power Supply Fault
-      Flag 10: <Not Used>
-      Flag 11: <Not Used>
-      Flag 12: <Not Used>
-      
-      Flag 13: <Not Used>
-      Flag 14: Bypass Static Switch High Temperature
-      Flag 15: High Battery Temperature
-      Flag 16: Battery Weak
-      
-      Flag 17: <Not Used>
-      Flag 18: System Locked in Operation Mode
-      Flag 19: RAM1 Memory Write Error
-      Flag 20: Memory Write Error
-      
-      Flag 21: Communication to VQ Bypass Lost
-      Flag 22: Communication to VQ Output Lost
-      Flag 23: Communication to DMU Lost
-      Flag 24: Communication to Controller Lost
-      
-      Flag 25: Communication to Parallel IF Lost
-      Flag 26: External Shutdown Accepted
-      Flag 27: DC Capacitor Charge Error
-      Flag 28: Communication to VQ Mains Lost
-      
-      Flag 29: Bypass Synchronization Error
-      Flag 30: Charge Error
-      Flag 31: <Not Used>
-      Flag 32: <Not Used>
-      
-      Flag 33: <Not Used>
-      Flag 34: <Not Used>
-      Flag 35: <Not Used>
-      Flag 36: <Not Used>
-      
-      Flag 37: <Not Used>
-      Flag 38: <Not Used>
-      Flag 39: <Not Used>
-      Flag 40: <Not Used>
-      
-      Flag 41: <Not Used>
-      Flag 42: <Not Used>
-      Flag 43: <Not Used>
-      Flag 44: <Not Used>
-      
-      Flag 45: <Not Used>
-      Flag 46: <Not Used>
-      Flag 47: <Not Used>
-      Flag 48: <Not Used>
-      
-      Flag 49: <Not Used>
-      Flag 50: <Not Used>
-      Flag 51: <Not Used>
-      Flag 52: <Not Used>
-      
-      Flag 53: <Not Used>
-      Flag 54: <Not Used>
-      Flag 55: <Not Used>
-      Flag 56: <Not Used>
-      
-      Flag 57: <Not Used>
-      Flag 58: <Not Used>
-      Flag 59: <Not Used>
-      Flag 60: <Not Used>
-      
-      Flag 61: <Not Used>
-      Flag 62: <Not Used>
-      Flag 63: <Not Used>
-      Flag 64: <Not Used>"
-   ::= { upsAdvState 3 }
-
-
--- the upsBasicControl group
-
-upsBasicControlConserveBattery OBJECT-TYPE
-   SYNTAX INTEGER  {
-      noTurnOffUps(1),
-      turnOffUpsToConserveBattery(2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this variable to turnUpsOffToConserveBattery(2) 
-       causes a UPS on battery to be put into 'sleep' mode.  The 
-       UPS will turn back on when utility power is restored.  
-       Attempting to turn off a UPS that is not on battery will 
-       result in a badValue error.
-
-       Setting this value to noTurnOffUps(1) has no
-       effect.
-
-       The value noTurnOffUps(1) will always be returned
-       when the variable is read."
-::= { upsBasicControl 1 }
-
-
-
--- the upsAdvControl group
-
-upsAdvControlUpsOff OBJECT-TYPE
-   SYNTAX INTEGER  {
-      noTurnUpsOff(1),
-      turnUpsOff(2),
-      turnUpsOffGracefully(3),
-      turnUpsSyncGroupOff(4),
-      turnUpsSyncGroupOffAfterDelay(5),
-      turnUpsSyncGroupOffGracefully(6)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this variable to turnUpsOff(2) causes
-       the UPS to shut off.  When in this state, the UPS 
-       will not provide output power regardless of the input
-       line state.
-
-       Setting this variable to turnUpsOffGracefully(3) causes
-       the UPS to shut off after a delay period. This allows the
-       host to shut down in a graceful manner. When in this state,
-       the UPS will not provide output power regardless of the
-       input line state. 
-              
-       If this UPS is an active member of a Synchronized 
-       Control Group (SCG) the turnUpsSyncGroupOff(4) command 
-       will perform a Synchronized Turn Off of all active Group
-       members regardless of their current AC output status.    
-       
-       If this UPS is an active member of a Synchronized 
-       Control Group (SCG) the turnUpsSyncGroupOffAfterDelay(5)
-       command will perform a Synchronized Turn Off After Delay 
-       of all active Group members regardless of their current 
-       AC output status. This unit's Shutdown Delay will be used 
-       to execute the Turn Off After Delay command.  
-       
-       If this UPS is an active member of an SCG, the 
-       turnUpsSyncGroupOffGracefully(6) command will perform a 
-       Synchronized Turn Off Gracefully of all active Group 
-       members regardless of their current AC output status.  
-       This unit's Maximum Shutdown Time and Shutdown Delay will
-       be used to execute the Turn Off Gracefully command.  
-       
-       Setting this value to noTurnUpsOff(1) has no
-       effect.
-
-       The value noTurnUpsOff(1) will always be returned
-       when the variable is read."
-   ::= { upsAdvControl 1 }
-
-upsAdvControlRebootUps OBJECT-TYPE
-   SYNTAX INTEGER  {
-      noRebootUps(1),
-      rebootUps(2),
-      rebootUpsGracefully(3),
-      rebootSyncGroupUps(4),
-      rebootSyncGroupUpsGracefully(5)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this variable to rebootUps(2) causes the
-       UPS to shut off and turn back on.
-      
-       Setting this variable to rebootUpsGracefully(3) causes the
-       UPS to shut off and turn back on after a delay period. 
-       This allows the host to shut down in a graceful manner.
-       
-       If this UPS is an active member of a Synchronized Control 
-       Group (SCG) the rebootSyncGroupUps(4) command will perform
-       a Synchronized Reboot of all active Group members regardless
-       of their current AC output status.  This unit's Power 
-       Synchronization Delay, Shutdown Delay, Return Delay, 
-       Return Battery Capacity, and Return Battery Capacity Offset 
-       will be used to execute the Reboot command.  
-
-       If this UPS is an active member of a SCG the 
-       rebootSyncGroupUpsGracefully(5) command will perform a 
-       Synchronized Reboot of all active Group members regardless 
-       of their current AC output status.  This unit's Power 
-       Synchronization Delay, Maximum Shutdown Time, 
-       Shutdown Delay, Return Delay, Return Battery Capacity, and 
-       Return Battery Capacity Offset will be used
-       to execute the Reboot command.  
-              
-       Setting this value to noRebootUps(1) has no effect.
-      
-       The value noRebootUps(1) will always be returned
-       when the variable is read."
-   ::= { upsAdvControl 2 }
-
-upsAdvControlUpsSleep OBJECT-TYPE
-   SYNTAX INTEGER  {
-      noPutUpsToSleep(1),
-      putUpsToSleep(2),
-      putUpsToSleepGracefully(3),
-      putUpsSyncGroupToSleep(4),
-      putUpsSyncGroupToSleepGracefully(5)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this variable to putUpsToSleep(2) causes
-       the UPS to go to sleep for the time specified by
-       upsAdvConfigUpsSleepTime.
-      
-       Setting this variable to putUpsToSleepGracefully(3)
-       causes the UPS to go to sleep for the time specified 
-       by upsAdvConfigUpsSleepTime after a delay period. 
-       This allows the host to shut down in a graceful manner.
-
-       If this UPS is an active member of a Synchronized Control 
-       Group (SCG), the putUpsSyncGroupToSleep(4) command will perform
-       a Synchronized Sleep of all active Group members regardless 
-       of their current AC output status.  This unit's Power 
-       Synchronization Delay, Shutdown Delay, Sleep Time, 
-       and Return Delay will be used to execute the sleep command.  
-       
-       If this UPS is an active member of a SCG the 
-       putUpsSyncGroupToSleepGracefully(5) command will perform a 
-       Synchronized Sleep Gracefully of all active Group members 
-       regardless of their current AC output status.  This unit's 
-       Power Synchronization Delay, Maximum Shutdown Time, Shutdown 
-       Delay, Sleep Time, and Return Delay to execute the sleep 
-       command.  
-
-       When in sleep mode, the UPS will not provide output
-       power regardless of the input line state.  Once the
-       specified time has elapsed, output power will be
-       restored. 
-      
-       Setting this value to noPutUpsToSleep(1) has no
-       effect.
-      
-       The value noPutUpsToSleep(1) will always be returned
-       when the variable is read."
-   ::= { upsAdvControl 3 }
-
-
-upsAdvControlSimulatePowerFail OBJECT-TYPE
-   SYNTAX INTEGER  {
-      noSimulatePowerFailure(1),
-      simulatePowerFailure(2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this variable to simulatePowerFailure(2) causes
-       the UPS switch to battery power.
-
-       Setting this value to noSimulatePowerFailure(1) has no
-       effect.
-
-       The value noSimulatePowerFailure(1) will always be returned
-       when the variable is read."
-   ::= { upsAdvControl 4 }
-
-
-upsAdvControlFlashAndBeep OBJECT-TYPE
-   SYNTAX INTEGER  {
-      noFlashAndBeep(1),
-      flashAndBeep(2),
-      flashAndBeepSyncGroup(3)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this variable to flashAndBeep(2) causes the
-       UPS to beep and simultaneously turn on the UPS front
-       panel lights (Smart-UPS only).
-
-       If this UPS is an active member of a Synchronized Control 
-       Group (SCG), the flashAndBeepSyncGroup(3) command will 
-       Flash and Beep all active Group members regardless of 
-       current AC output status.
-         
-       Setting this value to noFlashAndBeep(1) has no
-       effect.
-
-       The value noFlashAndBeep(1) will always be returned
-       when the variable is read."
-   ::= { upsAdvControl 5 }
-
-
-upsAdvControlTurnOnUPS OBJECT-TYPE
-   SYNTAX INTEGER  {
-      noTurnOnUPS(1),
-      turnOnUPS(2),
-      turnOnUPSSyncGroup(3)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this variable to turnOnUPS(2) causes the
-       UPS to be turned on immediately.
-
-       If this UPS is an active member of a Synchronized Control 
-       Group (SCG), the turnOnUPSSyncGroup(3) command will perform 
-       a Synchronized Turn On of all active Group members 
-       regardless of their current AC output status.
-       
-       Setting this value to noTurnOnUPS(1) has no
-       effect.
-
-       The value noTurnOnUPS(1) will always be returned
-       when the variable is read."
-   ::= { upsAdvControl 6 }
-
-upsAdvControlBypassSwitch OBJECT-TYPE
-   SYNTAX INTEGER {
-      noBypassSwitch (1),
-      switchToBypass (2),
-      switchOutOfBypass(3)
-      }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "This switch puts the UPS in or out of bypass mode."
-   ::= { upsAdvControl 7 }
-
-
--- the upsTest group
-
--- the upsBasicTest group
-
--- the upsAdvTest group
-
-upsAdvTestDiagnosticSchedule OBJECT-TYPE
-   SYNTAX INTEGER  {
-      unknown(1),
-      biweekly(2),
-      weekly(3),
-      atTurnOn(4),
-      never(5)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The UPS system's automatic battery test schedule."
-   ::= { upsAdvTest 1 }
-
-
-upsAdvTestDiagnostics OBJECT-TYPE
-   SYNTAX INTEGER  {
-      noTestDiagnostics(1),
-      testDiagnostics(2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this variable to testDiagnostics(2) causes
-       the UPS to perform a diagnostic self test.
-      
-       Setting this value to noTestDiagnostics(1) has no
-       effect.
-      
-       The value noTestDiagnostics(1) will always be returned
-       when the variable is read."
-   ::= { upsAdvTest 2 }
-
-upsAdvTestDiagnosticsResults OBJECT-TYPE
-   SYNTAX INTEGER {
-      ok(1),
-      failed(2),
-      invalidTest(3),
-      testInProgress(4)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The results of the last UPS diagnostics test performed."
-   ::= { upsAdvTest 3 }
-
-upsAdvTestLastDiagnosticsDate OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The date the last UPS diagnostics test was performed in
-       mm/dd/yy format."
-   ::= { upsAdvTest 4 }
-
-upsAdvTestRuntimeCalibration OBJECT-TYPE
-   SYNTAX INTEGER  {
-      noPerformCalibration(1),
-      performCalibration(2),
-      cancelCurrentCalibration(3)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this variable to performCalibration(2) causes
-       the UPS to discharge to calibrate the UPS.
-       The test will only start if the battery capacity is 100%.
-       The test runs until capacity is less than 25%.
-      
-       Setting this variable to cancelCurrentCalibration(3)
-       after setting performCalibration(2) will cancel the 
-       current discharge.
-      
-       Setting this variable to noPerformCalibration(1) 
-       will have no effect.
-      
-       The value noPerformCalibration(1) will always be returned
-       when the variable is read.
-      
-       The result of the calibration will be saved in 
-       upsAdvTestCalibrationResult."
-   ::= { upsAdvTest 5 }
-
-upsAdvTestCalibrationResults OBJECT-TYPE
-   SYNTAX INTEGER {
-      ok(1),
-      invalidCalibration(2),
-      calibrationInProgress(3)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The results of the last runtime calibration.
-      
-       Value ok(1) means a successful runtime calibration.
-      
-       Value invalidCalibration(2) indicates last calibration did
-       not take place since the battery capacity was below
-       100%.
-      
-       Value calibrationInProgress(3) means a calibration 
-       is occurring now. "
-   ::= { upsAdvTest 6 }
-
-upsAdvTestCalibrationDate OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The date the last UPS runtime calibration was 
-       performed in mm/dd/yy format."
-   ::= { upsAdvTest 7 }
-
--- the upsComm group
-
-upsCommStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-      ok(1),
-      noComm(2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of agent's communication with UPS. "
-   ::= { upsComm 1 }
-
-
--- the measureUps group
--- the Environ group
-
-mUpsEnvironAmbientTemperature OBJECT-TYPE
-   SYNTAX Gauge
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The ambient temperature in Celsius for Probe 1."
-   ::= { mUpsEnviron 1 }
-
-mUpsEnvironRelativeHumidity OBJECT-TYPE
-   SYNTAX Gauge
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The relative humidity as a percentage for Probe 1."
-   ::= { mUpsEnviron 2 }
-
-
-mUpsEnvironAmbientTemperature2 OBJECT-TYPE
-   SYNTAX Gauge
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The ambient temperature in Celsius for Probe 2."
-   ::= { mUpsEnviron 3 }
-
-mUpsEnvironRelativeHumidity2 OBJECT-TYPE
-   SYNTAX Gauge
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The relative humidity as a percentage for Probe 2."
-   ::= { mUpsEnviron 4 }
-
--- the mUpsContact group
-
-mUpsContactNumContacts OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of contacts supported by the Measure-UPS."
-   ::= { mUpsContact 1 }
-
-mUpsContactTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF ContactEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "A list of contacts supported by the Measure-UPS."
-   ::= { mUpsContact 2 }
-
-mUpsContactEntry OBJECT-TYPE
-   SYNTAX ContactEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "A contact entry containing information for a given contact."
-   INDEX  { contactNumber }
-   ::= { mUpsContactTable 1 }
-
-ContactEntry ::=
-   SEQUENCE {
-      contactNumber
-         INTEGER,
-      normalState
-         INTEGER,
-      description
-         DisplayString,
-      monitoringStatus
-         INTEGER,
-      currentStatus
-         INTEGER
-   }
-
-contactNumber OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "An index identifying the contact on the Measure-UPS."
-   ::= { mUpsContactEntry 1 }
-
-normalState OBJECT-TYPE
-   SYNTAX INTEGER {
-      unknown(1),
-      open(2),
-      closed(3)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The normal operating position of the contact. If the normal
-       operating position cannot be set then it is controlled via the
-       dip switch on the Measure-UPS and is therefore read-only."
-   ::= { mUpsContactEntry 2 }
-
-description OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The description of the purpose/use of the contact."
-   ::= { mUpsContactEntry 3 }
-
-monitoringStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-      unknown(1),
-      enabled(2),
-      disabled(3)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "A flag indicating whether this contact is 
-       monitored, or not."
-   ::= { mUpsContactEntry 4 }
-
-currentStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-      unknown(1),
-      noFault(2),
-      fault(3)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This value indicates the current state of the contact.
-       If the contact is not in its normal state.  This value
-       is set to fault(2)."
-   ::= { mUpsContactEntry 5 }
-
--- Three Phase Group
-
---
--- Reset Max/Min Values Group
---
-
-   upsPhaseResetMaxMinValues OBJECT-TYPE
-       SYNTAX INTEGER {
-          none (1),
-          reset (2) 
-       }
-       ACCESS     read-write
-       STATUS     mandatory
-       DESCRIPTION
-               "Reset the maximum and minimum UPS values:
-                upsPhaseInputMaxVoltage, upsPhaseInputMinVoltage,
-                upsPhaseInputMaxCurrent, upsPhaseInputMinCurrent,
-                upsPhaseInputMaxPower, upsPhaseInputMinPower,
-                upsPhaseOutputMaxCurrent, upsPhaseOutputMinCurrent,
-                upsPhaseOutputMaxLoad, upsPhaseOutputMinLoad,
-                upsPhaseOutputMaxPercentLoad, upsPhaseOutputMinPercentLoad,
-                upsPhaseOutputMaxPower, upsPhaseOutputMinPower,
-                upsPhaseOutputMaxPercentPower, upsPhaseOutputMinPercentPower."
-       ::= { upsPhaseResetValues 1 }
-
---
--- Input Group
---
-
--- Number of Inputs
-
-   upsPhaseNumInputs OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The number of input feeds to this device.
-               This variable indicates the number of rows in the
-               input table."
-       ::= { upsPhaseInput 1 }
-
--- Input Table
-
-   upsPhaseInputTable OBJECT-TYPE
-       SYNTAX     SEQUENCE OF UpsPhaseInputEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-               "A list of input table entries.  The number of entries
-               is given by the value of upsPhaseNumInputs."
-       ::= { upsPhaseInput 2 }
-
-   upsPhaseInputEntry OBJECT-TYPE
-       SYNTAX     UpsPhaseInputEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-               "An entry containing information applicable to a
-               particular input."
-       INDEX { upsPhaseInputTableIndex }
-       ::= { upsPhaseInputTable 1 }
-
-   UpsPhaseInputEntry ::= SEQUENCE {
-       upsPhaseInputTableIndex         INTEGER,
-       upsPhaseNumInputPhases          INTEGER,
-       upsPhaseInputVoltageOrientation INTEGER,
-       upsPhaseInputFrequency          INTEGER,
-       upsPhaseInputType               INTEGER,
-       upsPhaseInputName               DisplayString
-   }
-
-   upsPhaseInputTableIndex OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The input identifier."
-       ::= { upsPhaseInputEntry 1 }
-
-   upsPhaseNumInputPhases OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The number of input phases utilized in this
-               device.  The sum of all the upsPhaseNumInputPhases
-               variable indicates the number of rows in the 
-               input phase table."
-       ::= { upsPhaseInputEntry 2 }
-
-   upsPhaseInputVoltageOrientation OBJECT-TYPE
-       SYNTAX INTEGER {
-          unknown(1),
-          singlePhase(2),
-          splitPhase(3),
-          threePhasePhaseToNeutral(4),
-          threePhasePhaseToPhase(5)
-       }
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The input voltage orientation: 
-               1: unknown for this UPS
-               2: singlePhase - phase 1 voltage is between Phase 1
-               and Neutral.
-               3: splitPhase - phase 1 voltage is between Phase 1 and 
-               Neutral; phase 2 voltage is between Phase 2 and Neutral; 
-               phase 3 voltage is between Phase 1 and Phase2.
-               4: threePhasePhaseToNeutral - phase 1 voltage is between
-               Phase 1 and Neutral; phase 2 voltage is between Phase 2 
-               and Neutral; phase 3 voltage is between Phase3 and
-               Neutral.
-               5: threePhasePhaseToPhase - phase 1 voltage is between 
-               Phase 1 and Phase 2; phase 2 voltage is between Phase 2
-               and Phase 3; phase 3 voltage is between Phase 3 and
-               Phase 1."
-       ::= { upsPhaseInputEntry 3 }
-
-   upsPhaseInputFrequency OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The input frequency in 0.1 Hertz, or -1 if it's unsupported
-               by this UPS."
-       ::= { upsPhaseInputEntry 4 }
-
-   upsPhaseInputType OBJECT-TYPE
-       SYNTAX     INTEGER {
-          unknown(1),
-          main(2),
-          bypass(3)
-       }
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The input type."
-       ::= { upsPhaseInputEntry 5 }
-
-   upsPhaseInputName OBJECT-TYPE
-       SYNTAX     DisplayString
-       ACCESS     read-write
-       STATUS     mandatory
-       DESCRIPTION
-               "A name given to a particular input."
-       ::= { upsPhaseInputEntry 6 }
-
--- Input Phase Table
-
-   upsPhaseInputPhaseTable OBJECT-TYPE
-       SYNTAX     SEQUENCE OF UpsPhaseInputPhaseEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-               "A list of input table entries.  The number of entries
-               is given by the sum of the upsPhaseNumInputPhases."
-       ::= { upsPhaseInput 3 }
-
-   upsPhaseInputPhaseEntry OBJECT-TYPE
-       SYNTAX     UpsPhaseInputPhaseEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-               "An entry containing information applicable to a
-               particular input phase."
-       INDEX { upsPhaseInputPhaseTableIndex, upsPhaseInputPhaseIndex }
-       ::= { upsPhaseInputPhaseTable 1 }
-
-   UpsPhaseInputPhaseEntry ::= SEQUENCE {
-       upsPhaseInputPhaseTableIndex    INTEGER,
-       upsPhaseInputPhaseIndex         INTEGER,
-       upsPhaseInputVoltage            INTEGER,
-       upsPhaseInputMaxVoltage         INTEGER,
-       upsPhaseInputMinVoltage         INTEGER,
-       upsPhaseInputCurrent            INTEGER,
-       upsPhaseInputMaxCurrent         INTEGER,
-       upsPhaseInputMinCurrent         INTEGER,
-       upsPhaseInputPower              INTEGER,
-       upsPhaseInputMaxPower           INTEGER,
-       upsPhaseInputMinPower           INTEGER
-   }
-
-   upsPhaseInputPhaseTableIndex OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The input identifier."
-       ::= { upsPhaseInputPhaseEntry 1 }
-
-   upsPhaseInputPhaseIndex OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The input phase identifier."
-       ::= { upsPhaseInputPhaseEntry 2 }
-
-   upsPhaseInputVoltage OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The input voltage in VAC, or -1 if it's unsupported
-               by this UPS."
-       ::= { upsPhaseInputPhaseEntry 3 }
-
-   upsPhaseInputMaxVoltage OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The maximum input voltage in VAC measured
-               since the last reset (upsPhaseResetMaxMinValues), or
-               -1 if it's unsupported by this UPS.
-               Sampled every 30 seconds."
-       ::= { upsPhaseInputPhaseEntry 4 }
-
-   upsPhaseInputMinVoltage OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The minimum input voltage in VAC measured
-               since the last reset (upsPhaseResetMaxMinValues), or
-               -1 if it's unsupported by this UPS.
-               Sampled every 30 seconds."
-       ::= { upsPhaseInputPhaseEntry 5 }
-
-   upsPhaseInputCurrent OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The input current in 0.1 amperes, or -1 if it's
-               unsupported by this UPS."
-       ::= { upsPhaseInputPhaseEntry 6 }
-
-   upsPhaseInputMaxCurrent OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The maximum input current in 0.1 amperes measured
-               since the last reset (upsPhaseResetMaxMinValues), or
-               -1 if it's unsupported by this UPS.
-               Sampled every 30 seconds."
-       ::= { upsPhaseInputPhaseEntry 7 }
-
-   upsPhaseInputMinCurrent OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The minimum input current in 0.1 amperes measured
-               since the last reset (upsPhaseResetMaxMinValues), or
-               -1 if it's unsupported by this UPS.
-               Sampled every 30 seconds."
-       ::= { upsPhaseInputPhaseEntry 8 }
-
-   upsPhaseInputPower OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The input power in Watts, or -1 if it's unsupported
-               by this UPS."
-       ::= { upsPhaseInputPhaseEntry 9 }
-
-   upsPhaseInputMaxPower OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The maximum input power in Watts measured
-               since the last reset (upsPhaseResetMaxMinValues), or
-               -1 if it's unsupported by this UPS.
-               Sampled every 30 seconds."
-       ::= { upsPhaseInputPhaseEntry 10 }
-
-   upsPhaseInputMinPower OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The minimum input power in Watts measured
-               since the last reset (upsPhaseResetMaxMinValues), or
-               -1 if it's unsupported by this UPS.
-               Sampled every 30 seconds."
-       ::= { upsPhaseInputPhaseEntry 11 }
-
-   --
-   -- The Output group.
-   --
-
-   -- Number of Outputs
-
-   upsPhaseNumOutputs OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The number of output feeds to this device.
-               This variable indicates the number of rows in the
-               output table."
-       ::= { upsPhaseOutput 1 }
-
-   -- Output Table
-
-   upsPhaseOutputTable OBJECT-TYPE
-       SYNTAX     SEQUENCE OF UpsPhaseOutputEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-               "A list of output table entries.  The number of entries
-               is given by the value of upsOutputNumPhases."
-       ::= { upsPhaseOutput 2 }
-
-   upsPhaseOutputEntry OBJECT-TYPE
-       SYNTAX     UpsPhaseOutputEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-               "An entry containing information applicable to a
-               particular output."
-       INDEX { upsPhaseOutputTableIndex }
-       ::= { upsPhaseOutputTable 1 }
-
-   UpsPhaseOutputEntry ::= SEQUENCE {
-       upsPhaseOutputTableIndex         INTEGER,
-       upsPhaseNumOutputPhases          INTEGER,
-       upsPhaseOutputVoltageOrientation INTEGER,
-       upsPhaseOutputFrequency          INTEGER
-   }
-
-   upsPhaseOutputTableIndex OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The output identifier."
-       ::= { upsPhaseOutputEntry 1 }
-
-   upsPhaseNumOutputPhases OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The number of output phases utilized in this
-               device.  The sum of all the upsPhaseNumOutputPhases
-               variable indicates the number of rows in the 
-               output phase table."
-       ::= { upsPhaseOutputEntry 2 }
-
-   upsPhaseOutputVoltageOrientation OBJECT-TYPE
-       SYNTAX INTEGER {
-          unknown(1),
-          singlePhase(2),
-          splitPhase(3),
-          threePhasePhaseToNeutral(4),
-          threePhasePhaseToPhase(5)
-       }
-       ACCESS read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The output voltage orientation: 
-               1: unknown for this UPS
-               2: singlePhase - phase 1 voltage is between Phase 1
-               and Neutral.
-               3: splitPhase - phase 1 voltage is between Phase 1 and 
-               Neutral; phase 2 voltage is between Phase 2 and Neutral; 
-               phase 3 voltage is between Phase 1 and Phase2.
-               4: threePhasePhaseToNeutral - phase 1 voltage is between
-               Phase 1 and Neutral; phase 2 voltage is between Phase 2 
-               and Neutral; phase 3 voltage is between Phase3 and
-               Neutral.
-               5: threePhasePhaseToPhase - phase 1 voltage is between 
-               Phase 1 and Phase 2; phase 2 voltage is between Phase 2
-               and Phase 3; phase 3 voltage is between Phase 3 and
-               Phase 1."
-       ::= { upsPhaseOutputEntry 3 }
-
-   upsPhaseOutputFrequency OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The output frequency in 0.1 Hertz, or -1 if it's
-               unsupported by this UPS."
-       ::= { upsPhaseOutputEntry 4 }
-
-   -- Output Phase Table
-
-   upsPhaseOutputPhaseTable OBJECT-TYPE
-       SYNTAX     SEQUENCE OF UpsPhaseOutputPhaseEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-               "A list of output table entries.  The number of
-               entries is given by the sum of the upsPhaseNumOutputPhases."
-       ::= { upsPhaseOutput 3 }
-
-   upsPhaseOutputPhaseEntry OBJECT-TYPE
-       SYNTAX     UpsPhaseOutputPhaseEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-               "An entry containing information applicable to a
-               particular output phase."
-       INDEX { upsPhaseOutputPhaseTableIndex, upsPhaseOutputPhaseIndex }
-       ::= { upsPhaseOutputPhaseTable 1 }
-
-   UpsPhaseOutputPhaseEntry ::= SEQUENCE {
-       upsPhaseOutputPhaseTableIndex INTEGER,
-       upsPhaseOutputPhaseIndex      INTEGER,
-       upsPhaseOutputVoltage         INTEGER,
-       upsPhaseOutputCurrent         INTEGER,
-       upsPhaseOutputMaxCurrent      INTEGER,
-       upsPhaseOutputMinCurrent      INTEGER,
-       upsPhaseOutputLoad            INTEGER,
-       upsPhaseOutputMaxLoad         INTEGER,
-       upsPhaseOutputMinLoad         INTEGER,
-       upsPhaseOutputPercentLoad     INTEGER,
-       upsPhaseOutputMaxPercentLoad  INTEGER,
-       upsPhaseOutputMinPercentLoad  INTEGER,      
-       upsPhaseOutputPower           INTEGER,
-       upsPhaseOutputMaxPower        INTEGER,
-       upsPhaseOutputMinPower        INTEGER,
-       upsPhaseOutputPercentPower    INTEGER,
-       upsPhaseOutputMaxPercentPower INTEGER,
-       upsPhaseOutputMinPercentPower INTEGER
-   }
-
-   upsPhaseOutputPhaseTableIndex OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The output identifier."
-       ::= { upsPhaseOutputPhaseEntry 1 }
-
-   upsPhaseOutputPhaseIndex OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The output phase identifier."
-       ::= { upsPhaseOutputPhaseEntry 2 }
-
-   upsPhaseOutputVoltage OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The output voltage in VAC, or -1 if it's unsupported
-               by this UPS."
-       ::= { upsPhaseOutputPhaseEntry 3 }
-
-   upsPhaseOutputCurrent OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The output current in 0.1 amperes drawn 
-               by the load on the UPS, or -1 if it's unsupported
-               by this UPS."
-       ::= { upsPhaseOutputPhaseEntry 4 }
-
-   upsPhaseOutputMaxCurrent OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The maximum output current in 0.1 amperes measured
-               since the last reset (upsPhaseResetMaxMinValues), or
-               -1 if it's unsupported by this UPS.
-               Sampled every 30 seconds."
-       ::= { upsPhaseOutputPhaseEntry 5 }
-
-   upsPhaseOutputMinCurrent OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The minimum output current in 0.1 amperes measured
-               since the last reset (upsPhaseResetMaxMinValues), or
-               -1 if it's unsupported by this UPS.
-               Sampled every 30 seconds."
-       ::= { upsPhaseOutputPhaseEntry 6 }
-
-   upsPhaseOutputLoad OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The output load in VA, or -1 if it's unsupported
-               by this UPS."
-       ::= { upsPhaseOutputPhaseEntry 7 }
-
-   upsPhaseOutputMaxLoad OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The maximum output load in VA measured
-               since the last reset (upsPhaseResetMaxMinValues), or
-               -1 if it's unsupported by this UPS.
-               Sampled every 30 seconds."
-       ::= { upsPhaseOutputPhaseEntry 8 }
-
-   upsPhaseOutputMinLoad OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The minimum output load in VA measured
-               since the last reset (upsPhaseResetMaxMinValues), or
-               -1 if it's unsupported by this UPS.
-               Sampled every 30 seconds."
-       ::= { upsPhaseOutputPhaseEntry 9 }
-
-   upsPhaseOutputPercentLoad OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The percentage of the UPS load capacity in VA at 
-               redundancy @ (n + x) presently being used on this 
-               output phase, or -1 if it's unsupported by this UPS."
-       ::= { upsPhaseOutputPhaseEntry 10 }
-
-   upsPhaseOutputMaxPercentLoad OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The maximum percentage of the UPS load capacity in 
-               VA measured at redundancy @ (n + x) presently 
-               being used on this output phase since the last reset
-               (upsPhaseResetMaxMinValues), or -1 if it's unsupported
-               by this UPS. Sampled every 30 seconds."
-       ::= { upsPhaseOutputPhaseEntry 11 }
-
-   upsPhaseOutputMinPercentLoad OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The minimum percentage of the UPS load capacity in 
-               VA measured at redundancy @ (n + x) presently 
-               being used on this output phase since the last reset
-               (upsPhaseResetMaxMinValues), or -1 if it's unsupported
-               by this UPS. Sampled every 30 seconds."
-       ::= { upsPhaseOutputPhaseEntry 12 }
-
-   upsPhaseOutputPower OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The output power in Watts, or -1 if it's
-               unsupported by this UPS."
-       ::= { upsPhaseOutputPhaseEntry 13 }
-
-   upsPhaseOutputMaxPower OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The maximum output power in Watts measured
-               since the last reset (upsPhaseResetMaxMinValues), or
-               -1 if it's unsupported by this UPS.
-               Sampled every 30 seconds."
-       ::= { upsPhaseOutputPhaseEntry 14 }
-
-   upsPhaseOutputMinPower OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The minimum output power in Watts measured
-               since the last reset (upsPhaseResetMaxMinValues), or
-               -1 if it's unsupported by this UPS.
-               Sampled every 30 seconds."
-       ::= { upsPhaseOutputPhaseEntry 15 }
-
-   upsPhaseOutputPercentPower OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The percentage of the UPS power capacity in Watts at 
-               redundancy @ (n + x) presently being used on this 
-               output phase, or -1 if it's unsupported by this UPS."
-       ::= { upsPhaseOutputPhaseEntry 16 }
-
-   upsPhaseOutputMaxPercentPower OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The maximum percentage of the UPS power capacity
-               in Watts measured at redundancy @ (n + x) presently
-               being used on this output phase since the last 
-               reset (upsPhaseResetMaxMinValues), or -1 if it's
-               unsupported by this UPS. Sampled every 30 seconds."
-       ::= { upsPhaseOutputPhaseEntry 17 }
-
-   upsPhaseOutputMinPercentPower OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The maximum percentage of the UPS power capacity
-               in Watts measured at redundancy @ (n + x) presently
-               being used on this output phase since the last 
-               reset (upsPhaseResetMaxMinValues), or -1 if it's
-               unsupported by this UPS. Sampled every 30 seconds."
-       ::= { upsPhaseOutputPhaseEntry 18 }
-
--- the upsOutletGroupStatus group
-
-upsOutletGroupStatusTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of outlet groups for the UPS."
-   ::= { upsOutletGroupStatus 1 }
-
-upsOutletGroupStatusTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF UpsOutletGroupStatusEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for getting status of the outlet groups. The number of
-       entries is contained in the upsOutletGroupStatusTableSize OID."
-   ::= { upsOutletGroupStatus 2 }
-
-upsOutletGroupStatusEntry OBJECT-TYPE
-   SYNTAX UpsOutletGroupStatusEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The outlet group status to get."
-   INDEX  { upsOutletGroupStatusIndex}
-   ::= { upsOutletGroupStatusTable 1 }
-
-UpsOutletGroupStatusEntry ::=
-   SEQUENCE {
-      upsOutletGroupStatusIndex          INTEGER,
-      upsOutletGroupStatusName           DisplayString,
-      upsOutletGroupStatusGroupState     INTEGER,
-      upsOutletGroupStatusCommandPending INTEGER
-   }      
-
-upsOutletGroupStatusIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the outlet group entry."
-   ::= { upsOutletGroupStatusEntry 1 }
-
-upsOutletGroupStatusName OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The name of the outlet group. This OID is provided
-       for informational purposes only. This value is set
-       by the upsOutletGroupConfigName OID."
-   ::= { upsOutletGroupStatusEntry  2 }
-
-upsOutletGroupStatusGroupState OBJECT-TYPE
-   SYNTAX INTEGER {
-        upsOutletGroupStatusOn      (1),
-        upsOutletGroupStatusOff     (2),
-        upsOutletGroupStatusUnknown (3)
-   }     
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this variable will return the outlet group state. If the outlet
-       group is on, the upsOutletGroupStatusOn (1) value will be returned. If
-       the outlet group is off, the upsOutletGroupStatusOff (2) value will be
-       returned. If the state of the outlet group cannot be determined, the
-       upsOutletGroupStatusUnknown (3) value will be returned."
-
-   ::= { upsOutletGroupStatusEntry 3 }
-
-upsOutletGroupStatusCommandPending OBJECT-TYPE
-   SYNTAX INTEGER {
-        upsOutletGroupCommandPending   (1),
-        upsOutletGroupNoCommandPending (2)
-   }     
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this variable will return the command pending
-       state of the outlet group. If a command is pending on the 
-       outlet group, the upsOutletGroupCommandPending (1) value
-       will be returned. If there is not a command pending
-       on the outlet group, the upsOutletGroupNoCommandPending (2)
-       will be returned."
-   ::= { upsOutletGroupStatusEntry 4 }  
-
--- the upsOutletGroupConfig group
-
-upsOutletGroupConfigTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of outlet groups for the UPS."
-   ::= { upsOutletGroupConfig 1 }
-
-upsOutletGroupConfigTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF UpsOutletGroupConfigEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The list of outlet groups to configure. The number of entries
-       is defined by the upsOutletGroupConfigTableSize OID."
-   ::= { upsOutletGroupConfig 2  }
-
-upsOutletGroupConfigEntry OBJECT-TYPE
-   SYNTAX UpsOutletGroupConfigEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The outlet groups to configure."
-   INDEX  { upsOutletGroupConfigIndex}
-   ::= { upsOutletGroupConfigTable 1 }
-
-UpsOutletGroupConfigEntry ::=
-   SEQUENCE {
-      upsOutletGroupConfigIndex          INTEGER,
-      upsOutletGroupConfigName           DisplayString,
-      upsOutletGroupConfigPowerOnDelay   INTEGER,
-      upsOutletGroupConfigPowerOffDelay  INTEGER,
-      upsOutletGroupConfigRebootDuration INTEGER
-   }      
-
-upsOutletGroupConfigIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the outlet group entry."
-   ::= { upsOutletGroupConfigEntry 1 }
-
-upsOutletGroupConfigName OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The name of the outlet group."
-   ::= { upsOutletGroupConfigEntry 2 }
-   
-upsOutletGroupConfigPowerOnDelay OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The amount of time (in seconds) the outlet group will delay 
-       powering on when the delayed on or reboot command is applied.
-       Allowed values are -1 (for Never) or 0 to 600 seconds."
-   ::= { upsOutletGroupConfigEntry 3 }
-   
-upsOutletGroupConfigPowerOffDelay OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The amount of time (in seconds) the outlet group will delay 
-       powering off when the delayed off command is applied.
-       Allowed values are 0 to 600 seconds."
-   ::= { upsOutletGroupConfigEntry 4 }
-
-upsOutletGroupConfigRebootDuration OBJECT-TYPE
-   SYNTAX INTEGER                
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "During a reboot sequence, power is turned off and then 
-       back on. This OID defines the amount of time to wait, 
-       in seconds, after turning the power off, at the start
-       of the sequence, before initiating the power on sequence.
-       Allowed values are 0 to 600 seconds."
-   ::= { upsOutletGroupConfigEntry 5 }
-
--- the upsOutletGroupControl group
-
-upsOutletGroupControlTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of outlet groups for the UPS."
-   ::= { upsOutletGroupControl 1 }
-
-upsOutletGroupControlTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF UpsOutletGroupControlEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for control of individual outlet groups. The number of
-       entries is contained in the upsOutletGroupControlTableSize OID."
-   ::= { upsOutletGroupControl 2 }
-
-upsOutletGroupControlEntry OBJECT-TYPE
-   SYNTAX UpsOutletGroupControlEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The outlet group to control."
-   INDEX  { upsOutletGroupControlIndex}
-   ::= { upsOutletGroupControlTable 1 }
-
-UpsOutletGroupControlEntry ::=
-   SEQUENCE {
-      upsOutletGroupControlIndex   INTEGER,
-      upsOutletGroupControlName    DisplayString,
-      upsOutletGroupControlCommand INTEGER
-   }      
-
-upsOutletGroupControlIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the outlet group entry."
-   ::= { upsOutletGroupControlEntry 1 }
-
-upsOutletGroupControlName OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The name of the outlet group. This OID is provided
-       for informational purposes only. This value is set
-       by the upsOutletGroupConfigName OID."
-   ::= { upsOutletGroupControlEntry  2 }
-   
-upsOutletGroupControlCommand OBJECT-TYPE
-   SYNTAX INTEGER {
-        upsOutletGroupImmediateOn          (1),
-        upsOutletGroupImmediateOff         (2),
-        upsOutletGroupImmediateReboot      (3),
-        upsOutletGroupDelayedOn            (4),
-        upsOutletGroupDelayedOff           (5),
-        upsOutletGroupDelayedReboot        (6),
-        upsOutletGroupCancelPendingCommand (7),
-        upsOutletGroupControlUnknown       (8)
-   }     
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this variable will return the outlet group state. If the outlet
-       group is on, the upsOutletGroupImmediateOn (1) value will be returned. If
-       the outlet group is off, the upsOutletGroupImmediateOff (2) value will be
-       returned. 
-       
-       If the state of the outlet group cannot be determined, the
-       upsOutletGroupControlUnknown (8) value will be returned.
-       
-       Setting this variable to upsOutletGroupImmediateOn (1) will turn the
-       outlet group on.
-       
-       Setting this variable to upsOutletGroupImmediateOff (2) will turn the
-       outlet group off. 
-
-       Setting this variable to upsOutletGroupImmediateReboot (3) will turn the outlet
-       group off, wait the upsOutletGroupConfigRebootDuration OID time, wait the
-       upsOutletGroupConfigPowerOnDelay OID, and then turn the outlet group on.
-      
-       Setting this variable to upsOutletGroupDelayedOn (4) will turn the outlet
-       group on after the upsOutletGroupConfigPowerOnDelay OID has elapsed.
-
-       Setting this variable to upsOutletGroupDelayedOff (5) will turn the outlet
-       group off after the upsOutletGroupConfigPowerOffDelay OID has elapsed.
-
-       Setting this variable to upsOutletGroupDelayedReboot (6) will turn the outlet
-       group off after the upsOutletGroupConfigPowerOffDelay OID has elapsed, wait the
-       upsOutletGroupConfigRebootDuration OID time, wait the
-       upsOutletGroupConfigPowerOnDelay OID, and then turn the outlet group on.
-      
-       Setting this variable to upsOutletGroupCancelPendingCommand (7) will
-       cause any pending command to this outlet group to be canceled."
-   ::= { upsOutletGroupControlEntry 3 }
-
--- the upsDiagnosticIM group
-
-upsDiagIMTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of Intelligence Modules in or attached to the UPS."
-   ::= { upsDiagnosticIM 1 }
-
-upsDiagIMTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF UpsDiagIMEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for diagnostics of individual Intelligence Modules. The number of
-       entries is contained in the upsDiagIMTableSize OID."
-   ::= { upsDiagnosticIM 2 }
-
-upsDiagIMEntry OBJECT-TYPE
-   SYNTAX UpsDiagIMEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The diagnostics and information of an Intelligence Module."
-   INDEX  { upsDiagIMIndex}
-   ::= { upsDiagIMTable 1 }
-
-UpsDiagIMEntry ::=
-   SEQUENCE {
-      upsDiagIMIndex             INTEGER,
-      upsDiagIMType              INTEGER,
-      upsDiagIMStatus            INTEGER,
-      upsDiagIMFirmwareRev       DisplayString,
-      upsDiagIMSlaveFirmwareRev  DisplayString,
-      upsDiagIMHardwareRev       DisplayString,
-      upsDiagIMSerialNum         DisplayString,
-      upsDiagIMManufactureDate   DisplayString
-   }      
-
-upsDiagIMIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the Intelligence Module entry."
-   ::= { upsDiagIMEntry 1 }
-
-upsDiagIMType OBJECT-TYPE
-   SYNTAX INTEGER {
-     imUnknown    (1),
-     imMIM        (2),
-     imRIM        (3) 
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The type of the Intelligence Module.
-       imUnknown(1) indicates the IM type is unknown.
-       imMIM(2) indicates the IM type is a Main Intelligence Module.
-       imRIM(3) indicates the IM type is Redundant Intelligence Module."
-   ::= { upsDiagIMEntry  2 }
-   
-upsDiagIMStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-     unknown         (1),
-     notInstalled    (2),
-     offOk           (3),
-     onOk            (4),
-     offFail         (5),
-     onFail          (6),
-     lostComm        (7)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the Intelligence Module.
-       unknown(1) indicates the device status is unknown.
-       notInstalled(2) indicates the device is not installed.
-       offOk(3) indicates the device status is off and OK.
-       onOk(4) indicates the device status is on and OK.
-       offFail(5) indicates the device status is off and failed.
-       onFail(6) indicates the device status is on and failed.
-       lostComm(7) indicates the device has lost communication."
-   ::= { upsDiagIMEntry  3 }
-   
-upsDiagIMFirmwareRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The firmware revision of the Intelligence Module."
-   ::= { upsDiagIMEntry  4 }
-   
-upsDiagIMSlaveFirmwareRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The slave firmware revision of the Intelligence Module."
-   ::= { upsDiagIMEntry  5 }
-   
-upsDiagIMHardwareRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The hardware revision of the Intelligence Module."
-   ::= { upsDiagIMEntry  6 }
-   
-upsDiagIMSerialNum OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The serial number of the Intelligence Module."
-   ::= { upsDiagIMEntry  7 }
-   
-upsDiagIMManufactureDate OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The manufacture date of the Intelligence Module."
-   ::= { upsDiagIMEntry  8 }
-   
--- the upsDiagnosticPowerModules group
-
-upsDiagPMTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of Power Modules in or attached to the UPS."
-   ::= { upsDiagnosticPowerModules 1 }
-
-upsDiagPMTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF UpsDiagPMEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for diagnostics of Individual Power modules. The number of
-       entries is contained in the upsDiagPMTableSize OID."
-   ::= { upsDiagnosticPowerModules 2 }
-
-upsDiagPMEntry OBJECT-TYPE
-   SYNTAX UpsDiagPMEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The diagnostics of an Power Module."
-   INDEX  { upsDiagPMIndex}
-   ::= { upsDiagPMTable 1 }
-
-UpsDiagPMEntry ::=
-   SEQUENCE {
-      upsDiagPMIndex           INTEGER,
-      upsDiagPMStatus          INTEGER,
-      upsDiagPMFirmwareRev     DisplayString,
-      upsDiagPMHardwareRev     DisplayString,
-      upsDiagPMSerialNum       DisplayString,
-      upsDiagPMManufactureDate DisplayString
-   }      
-
-upsDiagPMIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the Power Module entry."
-   ::= { upsDiagPMEntry 1 }
-   
-upsDiagPMStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-     unknown         (1),
-     notInstalled    (2),
-     offOk           (3),
-     onOk            (4),
-     offFail         (5),
-     onFail          (6),
-     lostComm        (7)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the Power Module.
-       unknown(1) indicates the device status is unknown.
-       notInstalled(2) indicates the device is not installed.
-       offOk(3) indicates the device status is off and OK.
-       onOk(4) indicates the device status is on and OK.
-       offFail(5) indicates the device status is off and failed.
-       onFail(6) indicates the device status is on and failed.
-       lostComm(7) indicates the device has lost communication."
-   ::= { upsDiagPMEntry  2 }
-   
-upsDiagPMFirmwareRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The firmware revision of the Power Module."
-   ::= { upsDiagPMEntry  3 }
-   
-upsDiagPMHardwareRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The hardware revision of the Power Module."
-   ::= { upsDiagPMEntry  4 }
-   
-upsDiagPMSerialNum OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The serial number of the Power Module."
-   ::= { upsDiagPMEntry  5 }
-   
-upsDiagPMManufactureDate OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The manufacture date of the Power Module."
-   ::= { upsDiagPMEntry  6 }
-
--- the upsDiagnosticBatteries group
-
-upsDiagBatteryTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of batteries in or attached to the UPS."
-   ::= { upsDiagnosticBatteries 1 }
-
-upsDiagBatteryTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF UpsDiagBatteryEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for diagnostics of individual batteries. The number of
-       entries is contained in the upsDiagBattTableSize OID."
-   ::= { upsDiagnosticBatteries 2 }
-
-upsDiagBatteryEntry OBJECT-TYPE
-   SYNTAX UpsDiagBatteryEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The diagnostics of a battery."
-   INDEX  { upsDiagBatteryIndex}
-   ::= { upsDiagBatteryTable 1 }
-
-UpsDiagBatteryEntry ::=
-   SEQUENCE {
-      upsDiagBatteryFrameIndex      INTEGER,
-      upsDiagBatteryIndex           INTEGER,
-      upsDiagBatteryStatus          INTEGER,
-      upsDiagBatterySerialNumber    DisplayString,
-      upsDiagBatteryFirmwareRev     DisplayString,
-      upsDiagBatteryManufactureDate DisplayString,
-      upsDiagBatteryType            DisplayString
-   }      
-
-upsDiagBatteryFrameIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the battery frame entry.
-       Frame 0 indicates the Main frame. Extended Run (XR) frames
-       start from index 1."
-   ::= { upsDiagBatteryEntry 1 }
-   
-upsDiagBatteryIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the battery entry."
-   ::= { upsDiagBatteryEntry 2 }
-   
-upsDiagBatteryStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-     unknown            (1),
-     notInstalled       (2),
-     ok                 (3),
-     failed             (4),
-     highTemperature    (5),
-     replaceImmediately (6),
-     lowCapacity        (7)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the battery.
-       unknown(1) indicates the device status is unknown.
-       notInstalled(2) indicates the device is not installed.
-       ok(3) indicates the battery status is OK.
-       failed(4) indicates the battery status is failed.
-       highTemperature(5) indicates the battery has a high temperature condition.
-       replaceImmediately(6) indicates the battery must be replaced immediately.
-       lowCapacity(7) indicates the battery has a low capacity."
-   ::= { upsDiagBatteryEntry  3 }
-   
-upsDiagBatterySerialNumber OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The serial number of the battery."
-   ::= { upsDiagBatteryEntry  4 }
-   
-upsDiagBatteryFirmwareRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The firmware revision of the battery."
-   ::= { upsDiagBatteryEntry  5 }
-   
-upsDiagBatteryManufactureDate OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The manufacture date of the battery."
-   ::= { upsDiagBatteryEntry  6 }
-   
-upsDiagBatteryType OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The battery type or rating for the battery."
-   ::= { upsDiagBatteryEntry  7 }
-   
--- the upsDiagnosticSubsystem group
-
-upsDiagSubSysFrameTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of frames attached to the UPS including the Main frame."
-   ::= { upsDiagnosticSubsystem 1 }
-
-upsDiagSubSysFrameTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF UpsDiagSubSysFrameEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for diagnostics of individual XR Frames."
-   ::= { upsDiagnosticSubsystem 2 }
-
-upsDiagSubSysFrameEntry OBJECT-TYPE
-   SYNTAX UpsDiagSubSysFrameEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The diagnostics of an XR Frame."
-   INDEX  { upsDiagSubSysFrameIndex}
-   ::= { upsDiagSubSysFrameTable 1 }
-
-UpsDiagSubSysFrameEntry ::=
-   SEQUENCE {
-      upsDiagSubSysFrameIndex                 INTEGER,
-      upsDiagSubSysFrameType                  INTEGER,
-      upsDiagSubSysFrameFirmwareRev           DisplayString,
-      upsDiagSubSysFrameHardwareRev           DisplayString,
-      upsDiagSubSysFrameSerialNum             DisplayString,
-      upsDiagSubSysFrameManufactureDate       DisplayString
-   }      
-
-upsDiagSubSysFrameIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The frame index entry."
-   ::= { upsDiagSubSysFrameEntry 1 }
-      
-upsDiagSubSysFrameType OBJECT-TYPE
-   SYNTAX INTEGER {
-     unknown            (1),
-     notInstalled       (2),
-     frameTypeMain      (3),
-     frameTypeXR        (4),
-     frameTypeLXR       (5)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The type of Frame.
-       unknown(1) indicates the device status is unknown.
-       notInstalled(2) indicates the device is not installed.
-       frameTypeMain(3) indicates the the frame type is the Main Frame.
-       frameTypeXR(4) indicates the frame type is an XR Frame.
-       frameTypeLXR(5) indicates the frame type is an LXR Frame."
-   ::= { upsDiagSubSysFrameEntry 2 }
-      
-upsDiagSubSysFrameFirmwareRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The firmware revision of the frame."
-   ::= { upsDiagSubSysFrameEntry 3 }
-      
-upsDiagSubSysFrameHardwareRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The hardware revision of the frame."
-   ::= { upsDiagSubSysFrameEntry 4 }
-      
-upsDiagSubSysFrameSerialNum OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The serial number of the frame."
-   ::= { upsDiagSubSysFrameEntry 5 }
-      
-upsDiagSubSysFrameManufactureDate OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The manufacture date of the frame."
-   ::= { upsDiagSubSysFrameEntry 6 }
-      
-upsDiagSubSysIntBypSwitchTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of Internal Bypass switches attached to the UPS."
-   ::= { upsDiagnosticSubsystem 3 }
-
-upsDiagSubSysIntBypSwitchTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF UpsDiagSubSysIntBypSwitchEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for diagnostics of the Internal Bypass Switch."
-   ::= { upsDiagnosticSubsystem 4 }
-
-upsDiagSubSysIntBypSwitchEntry OBJECT-TYPE
-   SYNTAX UpsDiagSubSysIntBypSwitchEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The diagnostics of the Internal Bypass Switch."
-   INDEX  { upsDiagSubSysIntBypSwitchIndex}
-   ::= { upsDiagSubSysIntBypSwitchTable 1 }
-
-UpsDiagSubSysIntBypSwitchEntry ::=
-   SEQUENCE {
-      upsDiagSubSysIntBypSwitchFrameIndex            INTEGER,
-      upsDiagSubSysIntBypSwitchIndex                 INTEGER,
-      upsDiagSubSysIntBypSwitchStatus                INTEGER,
-      upsDiagSubSysIntBypSwitchFirmwareRev           DisplayString,
-      upsDiagSubSysIntBypSwitchHardwareRev           DisplayString,
-      upsDiagSubSysIntBypSwitchSerialNum             DisplayString,
-      upsDiagSubSysIntBypSwitchManufactureDate       DisplayString
-   }      
-
-upsDiagSubSysIntBypSwitchFrameIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The frame index entry."
-   ::= { upsDiagSubSysIntBypSwitchEntry 1 }
-      
-upsDiagSubSysIntBypSwitchIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The Internal Bypass Switch index entry."
-   ::= { upsDiagSubSysIntBypSwitchEntry 2 }
-      
-upsDiagSubSysIntBypSwitchStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-     unknown         (1),
-     notInstalled    (2),
-     offOk           (3),
-     onOk            (4),
-     offFail         (5),
-     onFail          (6),
-     lostComm        (7)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The Internal Bypass Switch status.
-       unknown(1) indicates the device status is unknown.
-       notInstalled(2) indicates the device is not installed.
-       offOk(3) indicates the device status is off and OK.
-       onOk(4) indicates the device status is on and OK.
-       offFail(5) indicates the device status is off and failed.
-       onFail(6) indicates the device status is on and failed.
-       lostComm(7) indicates the device has lost communication."
-   ::= { upsDiagSubSysIntBypSwitchEntry 3 }
-      
-upsDiagSubSysIntBypSwitchFirmwareRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The firmware revision of the Internal Bypass Switch."
-   ::= { upsDiagSubSysIntBypSwitchEntry 4 }
-      
-upsDiagSubSysIntBypSwitchHardwareRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The hardware revision of the Internal Bypass Switch."
-   ::= { upsDiagSubSysIntBypSwitchEntry 5 }
-      
-upsDiagSubSysIntBypSwitchSerialNum OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The serial number of the Internal Bypass Switch."
-   ::= { upsDiagSubSysIntBypSwitchEntry 6 }
-      
-upsDiagSubSysIntBypSwitchManufactureDate OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The manufacture date of the Internal Bypass Switch."
-   ::= { upsDiagSubSysIntBypSwitchEntry 7 }
-      
-upsDiagSubSysBattMonitorTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of Battery Monitor Boards attached to the UPS."
-   ::= { upsDiagnosticSubsystem 5 }
-
-upsDiagSubSysBattMonitorTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF UpsDiagSubSysBattMonitorEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for diagnostics of the Battery Monitor Board."
-   ::= { upsDiagnosticSubsystem 6 }
-
-upsDiagSubSysBattMonitorEntry OBJECT-TYPE
-   SYNTAX UpsDiagSubSysBattMonitorEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The diagnostics of the Battery Monitor Board."
-   INDEX  { upsDiagSubSysBattMonitorIndex}
-   ::= { upsDiagSubSysBattMonitorTable 1 }
-
-UpsDiagSubSysBattMonitorEntry ::=
-   SEQUENCE {
-      upsDiagSubSysBattMonitorFrameIndex            INTEGER,
-      upsDiagSubSysBattMonitorIndex                 INTEGER,
-      upsDiagSubSysBattMonitorStatus                INTEGER,
-      upsDiagSubSysBattMonitorFirmwareRev           DisplayString,
-      upsDiagSubSysBattMonitorHardwareRev           DisplayString,
-      upsDiagSubSysBattMonitorSerialNum             DisplayString,
-      upsDiagSubSysBattMonitorManufactureDate       DisplayString
-   }      
-
-upsDiagSubSysBattMonitorFrameIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The frame index entry."
-   ::= { upsDiagSubSysBattMonitorEntry 1 }
-      
-upsDiagSubSysBattMonitorIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index of the Battery Monitor Board."
-   ::= { upsDiagSubSysBattMonitorEntry 2 }
-      
-upsDiagSubSysBattMonitorStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-     unknown         (1),
-     notInstalled    (2),
-     offOk           (3),
-     onOk            (4),
-     offFail         (5),
-     onFail          (6),
-     lostComm        (7)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the Battery Monitor Board.
-       unknown(1) indicates the device status is unknown.
-       notInstalled(2) indicates the device is not installed.
-       offOk(3) indicates the device status is off and OK.
-       onOk(4) indicates the device status is on and OK.
-       offFail(5) indicates the device status is off and failed.
-       onFail(6) indicates the device status is on and failed.
-       lostComm(7) indicates the device has lost communication."
-   ::= { upsDiagSubSysBattMonitorEntry 3 }
-      
-upsDiagSubSysBattMonitorFirmwareRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The firmware revision of the Battery Monitor Board."
-   ::= { upsDiagSubSysBattMonitorEntry 4 }
-      
-upsDiagSubSysBattMonitorHardwareRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The hardware revision of the Battery Monitor Board."
-   ::= { upsDiagSubSysBattMonitorEntry 5 }
-      
-upsDiagSubSysBattMonitorSerialNum OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The serial number of the Battery Monitor Board."
-   ::= { upsDiagSubSysBattMonitorEntry 6 }
-      
-upsDiagSubSysBattMonitorManufactureDate OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The date of the manufacture for the Battery Monitor Board."
-   ::= { upsDiagSubSysBattMonitorEntry  7 }
-         
-upsDiagSubSysExternalSwitchGearTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of External Switch Gears attached to the UPS."
-   ::= { upsDiagnosticSubsystem 7 }
-
-upsDiagSubSysExternalSwitchGearTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF UpsDiagSubSysExternalSwitchGearEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for diagnostics of the individual External Switch Gear."
-   ::= { upsDiagnosticSubsystem 8 }
-
-upsDiagSubSysExternalSwitchGearEntry OBJECT-TYPE
-   SYNTAX UpsDiagSubSysExternalSwitchGearEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The diagnostics of an individual External Switch Gear."
-   INDEX  { upsDiagSubSysExternalSwitchGearIndex}
-   ::= { upsDiagSubSysExternalSwitchGearTable 1 }
-
-UpsDiagSubSysExternalSwitchGearEntry ::=
-   SEQUENCE {
-      upsDiagSubSysExternalSwitchGearFrameIndex            INTEGER,
-      upsDiagSubSysExternalSwitchGearIndex                 INTEGER,
-      upsDiagSubSysExternalSwitchGearStatus                INTEGER,
-      upsDiagSubSysExternalSwitchGearFirmwareRev           DisplayString,
-      upsDiagSubSysExternalSwitchGearHardwareRev           DisplayString,
-      upsDiagSubSysExternalSwitchGearSerialNum             DisplayString,
-      upsDiagSubSysExternalSwitchGearManufactureDate       DisplayString
-   }      
-
-upsDiagSubSysExternalSwitchGearFrameIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The frame index entry."
-   ::= { upsDiagSubSysExternalSwitchGearEntry 1 }
-      
-upsDiagSubSysExternalSwitchGearIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index of the External Switch Gear."
-   ::= { upsDiagSubSysExternalSwitchGearEntry 2 }
-      
-upsDiagSubSysExternalSwitchGearStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-     unknown         (1),
-     notInstalled    (2),
-     offOk           (3),
-     onOk            (4),
-     offFail         (5),
-     onFail          (6),
-     lostComm        (7)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the External Switch Gear.
-       unknown(1) indicates the device status is unknown.
-       notInstalled(2) indicates the device is not installed.
-       offOk(3) indicates the device status is off and OK.
-       onOk(4) indicates the device status is on and OK.
-       offFail(5) indicates the device status is off and failed.
-       onFail(6) indicates the device status is on and failed.
-       lostComm(7) indicates the device has lost communication."
-   ::= { upsDiagSubSysExternalSwitchGearEntry 3 }
-      
-upsDiagSubSysExternalSwitchGearFirmwareRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The firmware revision of the External Switch Gear monitor card."
-   ::= { upsDiagSubSysExternalSwitchGearEntry 4 }
-      
-upsDiagSubSysExternalSwitchGearHardwareRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The hardware revision of the External Switch Gear monitor card."
-   ::= { upsDiagSubSysExternalSwitchGearEntry 5 }
-      
-upsDiagSubSysExternalSwitchGearSerialNum OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The serial number of the External Switch Gear monitor card."
-   ::= { upsDiagSubSysExternalSwitchGearEntry 6 }
-      
-upsDiagSubSysExternalSwitchGearManufactureDate OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The date of the manufacture for the External Switch Gear monitor card."
-   ::= { upsDiagSubSysExternalSwitchGearEntry  7 }
-
-upsDiagSubSysDisplayInterfaceCardTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of Display Interface Cards attached to the UPS."
-   ::= { upsDiagnosticSubsystem 9 }
-
-upsDiagSubSysDisplayInterfaceCardTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF UpsDiagSubSysDisplayInterfaceCardEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for diagnostics of individual Display Interface Cards."
-   ::= { upsDiagnosticSubsystem 10 }
-
-upsDiagSubSysDisplayInterfaceCardEntry OBJECT-TYPE
-   SYNTAX UpsDiagSubSysDisplayInterfaceCardEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The diagnostics of a Display Interface Card."
-   INDEX  { upsDiagSubSysDisplayInterfaceCardIndex}
-   ::= { upsDiagSubSysDisplayInterfaceCardTable 1 }
-
-UpsDiagSubSysDisplayInterfaceCardEntry ::=
-   SEQUENCE {
-      upsDiagSubSysDisplayInterfaceCardFrameIndex            INTEGER,
-      upsDiagSubSysDisplayInterfaceCardIndex                 INTEGER,
-      upsDiagSubSysDisplayInterfaceCardStatus                INTEGER
-   }      
-
-upsDiagSubSysDisplayInterfaceCardFrameIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The frame index entry."
-   ::= { upsDiagSubSysDisplayInterfaceCardEntry 1 }
-      
-upsDiagSubSysDisplayInterfaceCardIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index of the Display Interface Card."
-   ::= { upsDiagSubSysDisplayInterfaceCardEntry 2 }
-      
-upsDiagSubSysDisplayInterfaceCardStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-     unknown         (1),
-     notInstalled    (2),
-     offOk           (3),
-     onOk            (4),
-     offFail         (5),
-     onFail          (6),
-     lostComm        (7)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the Display Interface Card.
-       unknown(1) indicates the device status is unknown.
-       notInstalled(2) indicates the device is not installed.
-       offOk(3) indicates the device status is off and OK.
-       onOk(4) indicates the device status is on and OK.
-       offFail(5) indicates the device status is off and failed.
-       onFail(6) indicates the device status is on and failed.
-       lostComm(7) indicates the device has lost communication."
-   ::= { upsDiagSubSysDisplayInterfaceCardEntry 3 }
-      
-upsDiagSubSysDCCircuitBreakerTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of DC Circuit Breakers attached to the UPS."
-   ::= { upsDiagnosticSubsystem 11 }
-
-upsDiagSubSysDCCircuitBreakerTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF UpsDiagSubSysDCCircuitBreakerEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for diagnostics of individual DC Circuit Breakers."
-   ::= { upsDiagnosticSubsystem 12 }
-
-upsDiagSubSysDCCircuitBreakerEntry OBJECT-TYPE
-   SYNTAX UpsDiagSubSysDCCircuitBreakerEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The diagnostics of a DC Circuit Breaker."
-   INDEX  { upsDiagSubSysDCCircuitBreakerIndex}
-   ::= { upsDiagSubSysDCCircuitBreakerTable 1 }
-
-UpsDiagSubSysDCCircuitBreakerEntry ::=
-   SEQUENCE {
-      upsDiagSubSysDCCircuitBreakerFrameIndex            INTEGER,
-      upsDiagSubSysDCCircuitBreakerIndex                 INTEGER,
-      upsDiagSubSysDCCircuitBreakerStatus                INTEGER
-   }      
-
-upsDiagSubSysDCCircuitBreakerFrameIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The frame index entry."
-   ::= { upsDiagSubSysDCCircuitBreakerEntry 1 }
-      
-upsDiagSubSysDCCircuitBreakerIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index of the DC Circuit Breaker."
-   ::= { upsDiagSubSysDCCircuitBreakerEntry 2 }
-      
-upsDiagSubSysDCCircuitBreakerStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-     unknown         (1),
-     notInstalled    (2),
-     opened          (3),
-     closed          (4)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the DC Circuit Breaker.
-       unknown(1) indicates the circuit breaker status is unknown.
-       notInstalled(2) indicates the circuit breaker is not installed.
-       opened(3) indicates the circuit breaker is opened.
-       closed(4) indicates the circuit breaker is closed."
-   ::= { upsDiagSubSysDCCircuitBreakerEntry 3 }
-      
-upsDiagSubSysSystemPowerSupplyTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of System Power Supplies attached to the UPS."
-   ::= { upsDiagnosticSubsystem 13 }
-
-upsDiagSubSysSystemPowerSupplyTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF UpsDiagSubSysSystemPowerSupplyEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for diagnostics of individual System Power Supplies."
-   ::= { upsDiagnosticSubsystem 14 }
-
-upsDiagSubSysSystemPowerSupplyEntry OBJECT-TYPE
-   SYNTAX UpsDiagSubSysSystemPowerSupplyEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The diagnostics of a System Power Supply."
-   INDEX  { upsDiagSubSysSystemPowerSupplyIndex}
-   ::= { upsDiagSubSysSystemPowerSupplyTable 1 }
-
-UpsDiagSubSysSystemPowerSupplyEntry ::=
-   SEQUENCE {
-      upsDiagSubSysSystemPowerSupplyFrameIndex            INTEGER,
-      upsDiagSubSysSystemPowerSupplyIndex                 INTEGER,
-      upsDiagSubSysSystemPowerSupplyStatus                INTEGER
-   }      
-
-upsDiagSubSysSystemPowerSupplyFrameIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The frame index entry."
-   ::= { upsDiagSubSysSystemPowerSupplyEntry 1 }
-      
-upsDiagSubSysSystemPowerSupplyIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index of a System Power Supply."
-   ::= { upsDiagSubSysSystemPowerSupplyEntry 2 }
-      
-upsDiagSubSysSystemPowerSupplyStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-     unknown         (1),
-     notInstalled    (2),
-     offOk           (3),
-     onOk            (4),
-     offFail         (5),
-     onFail          (6),
-     lostComm        (7)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the System Power Supply.
-       unknown(1) indicates the device status is unknown.
-       notInstalled(2) indicates the device is not installed.
-       offOk(3) indicates the device status is off and OK.
-       onOk(4) indicates the device status is on and OK.
-       offFail(5) indicates the device status is off and failed.
-       onFail(6) indicates the device status is on and failed.
-       lostComm(7) indicates the device has lost communication."
-   ::= { upsDiagSubSysSystemPowerSupplyEntry 3 }
-      
-upsDiagSubSysXRCommunicationCardTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of XR Communication Cards attached to the UPS."
-   ::= { upsDiagnosticSubsystem 15 }
-
-upsDiagSubSysXRCommunicationCardTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF UpsDiagSubSysXRCommunicationCardEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for diagnostics of individual XR Communication Cards."
-   ::= { upsDiagnosticSubsystem 16 }
-
-upsDiagSubSysXRCommunicationCardEntry OBJECT-TYPE
-   SYNTAX UpsDiagSubSysXRCommunicationCardEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The diagnostics of an XR Communication Card."
-   INDEX  { upsDiagSubSysXRCommunicationCardIndex}
-   ::= { upsDiagSubSysXRCommunicationCardTable 1 }
-
-UpsDiagSubSysXRCommunicationCardEntry ::=
-   SEQUENCE {
-      upsDiagSubSysXRCommunicationCardFrameIndex            INTEGER,
-      upsDiagSubSysXRCommunicationCardIndex                 INTEGER,
-      upsDiagSubSysXRCommunicationCardStatus                INTEGER
-   }      
-
-upsDiagSubSysXRCommunicationCardFrameIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The frame index entry."
-   ::= { upsDiagSubSysXRCommunicationCardEntry 1 }
-      
-upsDiagSubSysXRCommunicationCardIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index of an XR Communication Card."
-   ::= { upsDiagSubSysXRCommunicationCardEntry 2 }
-      
-upsDiagSubSysXRCommunicationCardStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-     unknown         (1),
-     notInstalled    (2),
-     offOk           (3),
-     onOk            (4),
-     offFail         (5),
-     onFail          (6),
-     lostComm        (7)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the XR Communication Card.
-       unknown(1) indicates the device status is unknown.
-       notInstalled(2) indicates the device is not installed.
-       offOk(3) indicates the device status is off and OK.
-       onOk(4) indicates the device status is on and OK.
-       offFail(5) indicates the device status is off and failed.
-       onFail(6) indicates the device status is on and failed.
-       lostComm(7) indicates the device has lost communication."
-   ::= { upsDiagSubSysXRCommunicationCardEntry 3 }
-      
-upsDiagSubSysExternalPowerFrameBoardTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of External Power Frame Boards attached to the UPS."
-   ::= { upsDiagnosticSubsystem 17 }
-
-upsDiagSubSysExternalPowerFrameBoardTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF UpsDiagSubSysExternalPowerFrameBoardEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for diagnostics of individual External Power Frame Boards."
-   ::= { upsDiagnosticSubsystem 18 }
-
-upsDiagSubSysExternalPowerFrameBoardEntry OBJECT-TYPE
-   SYNTAX UpsDiagSubSysExternalPowerFrameBoardEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The diagnostics of an External Power Frame Board."
-   INDEX  { upsDiagSubSysExternalPowerFrameBoardIndex}
-   ::= { upsDiagSubSysExternalPowerFrameBoardTable 1 }
-
-UpsDiagSubSysExternalPowerFrameBoardEntry ::=
-   SEQUENCE {
-      upsDiagSubSysExternalPowerFrameBoardFrameIndex            INTEGER,
-      upsDiagSubSysExternalPowerFrameBoardIndex                 INTEGER,
-      upsDiagSubSysExternalPowerFrameBoardStatus                INTEGER
-   }      
-
-upsDiagSubSysExternalPowerFrameBoardFrameIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The frame index entry."
-   ::= { upsDiagSubSysExternalPowerFrameBoardEntry 1 }
-      
-upsDiagSubSysExternalPowerFrameBoardIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index of an External Power Frame Board."
-   ::= { upsDiagSubSysExternalPowerFrameBoardEntry 2 }
-      
-upsDiagSubSysExternalPowerFrameBoardStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-     unknown         (1),
-     notInstalled    (2),
-     offOk           (3),
-     onOk            (4),
-     offFail         (5),
-     onFail          (6),
-     lostComm        (7)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the External Power Frame Board.
-       unknown(1) indicates the device status is unknown.
-       notInstalled(2) indicates the device is not installed.
-       offOk(3) indicates the device status is off and OK.
-       onOk(4) indicates the device status is on and OK.
-       offFail(5) indicates the device status is off and failed.
-       onFail(6) indicates the device status is on and failed.
-       lostComm(7) indicates the device has lost communication."
-   ::= { upsDiagSubSysExternalPowerFrameBoardEntry 3 }
-      
-upsDiagSubSysChargerTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of Chargers attached to the UPS."
-   ::= { upsDiagnosticSubsystem 19 }
-
- upsDiagSubSysChargerTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF UpsDiagSubSysChargerEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for diagnostics of individual chargers."
-   ::= { upsDiagnosticSubsystem 20 }
-
-upsDiagSubSysChargerEntry OBJECT-TYPE
-   SYNTAX UpsDiagSubSysChargerEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The diagnostics of a charger."
-   INDEX  { upsDiagSubSysChargerIndex}
-   ::= { upsDiagSubSysChargerTable 1 }
-
-UpsDiagSubSysChargerEntry ::=
-   SEQUENCE {
-      upsDiagSubSysChargerFrameIndex            INTEGER,
-      upsDiagSubSysChargerIndex                 INTEGER,
-      upsDiagSubSysChargerStatus                INTEGER
-   }      
-
-upsDiagSubSysChargerFrameIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The frame index entry."
-   ::= { upsDiagSubSysChargerEntry 1 }
-      
-upsDiagSubSysChargerIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index of a charger."
-   ::= { upsDiagSubSysChargerEntry 2 }
-      
-upsDiagSubSysChargerStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-     unknown         (1),
-     notInstalled    (2),
-     offOk           (3),
-     onOk            (4),
-     offFail         (5),
-     onFail          (6),
-     lostComm        (7)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the Charger.
-       unknown(1) indicates the device status is unknown.
-       notInstalled(2) indicates the device is not installed.
-       offOk(3) indicates the device status is off and OK.
-       onOk(4) indicates the device status is on and OK.
-       offFail(5) indicates the device status is off and failed.
-       onFail(6) indicates the device status is on and failed.
-       lostComm(7) indicates the device has lost communication."
-   ::= { upsDiagSubSysChargerEntry 3 }
-      
--- the upsDiagnosticExternalDevices group
-
-upsDiagSwitchGearStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-     unknown         (1),
-     notInstalled    (2),
-     ok              (3),
-     fail            (4),
-     lostComm        (5),
-     overtemp        (6)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the Switch Gear.
-       unknown(1) indicates the device status is unknown.
-       notInstalled(2) indicates the device is not installed.
-       ok(3) indicates the device status is OK.
-       fail(4) indicates the device status has failed.
-       lostComm(5) indicates the device has lost communication.
-       overtemp(6) indicates the device has an over temperature condition."
-   ::= { upsDiagSwitchGear  1 }
-   
-upsDiagSwitchGearInputSwitchStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-     unknown         (1),
-     notInstalled    (2),
-     opened          (3),
-     closed          (4)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the Switch Gear Input Switch.
-       unknown(1) indicates the switch status is unknown.
-       notInstalled(2) indicates the switch is not installed.
-       opened(3) indicates the switch is opened.
-       closed(4) indicates the switch is closed."
-   ::= { upsDiagSwitchGear  2 }
-
-upsDiagSwitchGearOutputSwitchStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-     unknown         (1),
-     notInstalled    (2),
-     opened          (3),
-     closed          (4)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the Switch Gear Output Switch.
-       unknown(1) indicates the switch status is unknown.
-       notInstalled(2) indicates the switch is not installed.
-       opened(3) indicates the switch is opened.
-       closed(4) indicates the switch is closed."
-   ::= { upsDiagSwitchGear  3 }
-
-upsDiagSwitchGearBypassSwitchStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-     unknown         (1),
-     notInstalled    (2),
-     opened          (3),
-     closed          (4)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the Switch Gear Bypass Switch.
-       unknown(1) indicates the switch status is unknown.
-       notInstalled(2) indicates the switch is not installed.
-       opened(3) indicates the switch is opened.
-       closed(4) indicates the switch is closed."
-   ::= { upsDiagSwitchGear  4 }
-
-upsDiagMCCBBoxStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-     unknown         (1),
-     notInstalled    (2),
-     opened          (3),
-     closed          (4)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the MCCB Box (Molded Case Circuit Breaker Box) external device.
-       unknown(1) indicates the device status is unknown.
-       notInstalled(2) indicates the device is not installed.
-       opened(3) indicates the circuit is opened.
-       closed(4) indicates the circuit is closed."
-   ::= { upsDiagMCCBBox  1 }
-
-upsDiagTransformerStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-     unknown         (1),
-     notInstalled    (2),
-     ok              (3),
-     fail            (4),
-     lostComm        (5),
-     overtemp        (6),
-     opened          (7),
-     closed          (8)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the External Transformer.
-       unknown(1) indicates the device status is unknown.
-       notInstalled(2) indicates the device is not installed.
-       ok(3) indicates the device status is OK.
-       fail(4) indicates the device status has failed.
-       lostComm(5) indicates the device has lost communication.
-       overtemp(6) indicates the device has an over temperature condition.
-       opened(7) indicates the circuit is opened.
-       closed(8) indicates the circuit is closed."
-   ::= { upsDiagTransformer  1 }
-
--- the upsDiagnosticComBus group
-
-upsDiagComBusInternalMIMStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-     unknown         (1),
-     notInstalled    (2),
-     ok              (3),
-     lostComm        (4),
-     rxFailure       (5),
-     txFailure       (6)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the internal MIM communication bus.
-       unknown(1) indicates the device status is unknown.
-       notInstalled(2) indicates the device is not installed.
-       ok(3) indicates the device status is OK.
-       lostComm(4) indicates the device has lost communication.
-       rxFailure(5) indicates the device has a receive failure.
-       txFailure(6) indicates the device has a transmit failure."
-   ::= { upsDiagnosticComBus  1 }
-
-upsDiagComBusInternalRIMStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-     unknown         (1),
-     notInstalled    (2),
-     ok              (3),
-     lostComm        (4),
-     rxFailure       (5),
-     txFailure       (6)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the internal RIM communication bus.
-       unknown(1) indicates the device status is unknown.
-       notInstalled(2) indicates the device is not installed.
-       ok(3) indicates the device status is OK.
-       lostComm(4) indicates the device has lost communication.
-       rxFailure(5) indicates the device has a receive failure.
-       txFailure(6) indicates the device has a transmit failure."
-   ::= { upsDiagnosticComBus  2 }
-
-upsDiagComBusMIMtoRIMStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-     unknown         (1),
-     notInstalled    (2),
-     ok              (3),
-     lostComm        (4),
-     rxFailure       (5),
-     txFailure       (6)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the MIM to RIM communication bus.
-       unknown(1) indicates the device status is unknown.
-       notInstalled(2) indicates the device is not installed.
-       ok(3) indicates the device status is OK.
-       lostComm(4) indicates the device has lost communication.
-       rxFailure(5) indicates the device has a receive failure.
-       txFailure(6) indicates the device has a transmit failure."
-   ::= { upsDiagnosticComBus  3 }
-
-upsDiagComBusExternalMIMStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-     unknown         (1),
-     notInstalled    (2),
-     ok              (3),
-     lostComm        (4),
-     rxFailure       (5),
-     txFailure       (6)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the external MIM communication bus.
-       unknown(1) indicates the device status is unknown.
-       notInstalled(2) indicates the device is not installed.
-       ok(3) indicates the device status is OK.
-       lostComm(4) indicates the device has lost communication.
-       rxFailure(5) indicates the device has a receive failure.
-       txFailure(6) indicates the device has a transmit failure."
-   ::= { upsDiagnosticComBus  4 }
-
-upsDiagComBusExternalRIMStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-     unknown         (1),
-     notInstalled    (2),
-     ok              (3),
-     lostComm        (4),
-     rxFailure       (5),
-     txFailure       (6)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the external RIM communication bus.
-       unknown(1) indicates the device status is unknown.
-       notInstalled(2) indicates the device is not installed.
-       ok(3) indicates the device status is OK.
-       lostComm(4) indicates the device has lost communication.
-       rxFailure(5) indicates the device has a receive failure.
-       txFailure(6) indicates the device has a transmit failure."
-   ::= { upsDiagnosticComBus  5 }
-
--- the serialPort2Config group
-
-serialPort2Mode OBJECT-TYPE
-   SYNTAX INTEGER  {
-      localConsole(1),
-      passthrough(2)
-   }
-   ACCESS read-write
-   STATUS obsolete
-   DESCRIPTION
-      "Setting this variable to passthrough will enable mini's port2
-       behave like a UPS port. Choosing localConsole will enable the port
-       to be used as local console."
-      ::= { serialPort2Config 1 }
--- the serialPort2Control group
-
-setPulseOnTXD OBJECT-TYPE
-   SYNTAX INTEGER  {
-      noSetPulseOnTXD(1),
-      setPulseOnTXD(2),
-      setTXDLow(3),
-      setTXDHigh(4)
-
-   }
-   ACCESS read-write
-   STATUS obsolete
-   DESCRIPTION
-      "Setting this variable to setPulseOnTXD(2) 
-       causes adapter to generate a PULSE on TXD pin of serial port 2.
-       The duration in the prototype implementation will be 1 second.
-
-       Setting this value to noSetPulseOnTXD(1) has no
-       effect.
-      
-       The value noSetPulseOnTXD(1) will always be returned
-       when the variable is read.
-
-       Setting this value to setTXDLow(3), or setTXDHigh(4) will keep TXD
-       always low or high respectively."
-      ::= { serialPort2Control 1 }
-
--- the sPDUIdent group
-
-sPDUIdentHardwareRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The hardware revision of the PDU. This value 
-       is set at the factory."
-   ::= { sPDUIdent 1 }
-
-sPDUIdentFirmwareRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "An 8 byte ID string identifying the PDU firmware revision. 
-       This value is set at the factory." 
-   ::= {  sPDUIdent 2 }
-
-
-sPDUIdentDateOfManufacture OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The date when the PDU was manufactured in mm/dd/yy format.
-       This value is set at the factory. The year 2000 will be 
-       represented by 00." 
-   ::= { sPDUIdent 3 }
-   
-sPDUIdentModelNumber OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A 10-character string identifying the model number of 
-       the PDU internal. This value is set at the factory."
-   ::= { sPDUIdent 4 }
-
-sPDUIdentSerialNumber OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A 12-character string identifying the serial number of 
-       the PDU internal microprocessor. This value is set at
-       the factory."
-   ::= { sPDUIdent 5 }
-   
-
--- the sPDUMasterControl group
-
-sPDUMasterControlSwitch  OBJECT-TYPE
-  SYNTAX INTEGER       {
-      turnAllOnNow              (1),
-      turnAllOnSequence         (2),
-      turnAllOffNow             (3),
-      rebootAllNow              (4),
-      rebootAllSequence         (5),
-      noCommand                 (6),
-      turnAllOffSequence        (7)
-   }
-   
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this OID to turnAllOnNow (1) will turn all outlets
-       on immediately.
-       
-       Setting this OID to turnAllOnSequence (2) will turn all outlets
-       on as defined by each outlet's sPDUOutletPowerOnTime OID value.
-       
-       Setting this OID to turnAllOff (3) will turn all outlets
-       off immediately.
-       
-       Setting this OID to rebootAllNow (4) will reboot all outlets
-       immediately.
-       
-       For MasterSwitch firmware version 1.X, setting this OID to 
-       rebootAllSequence (5) reboots all outlets, with power returned 
-       to the outlets in the sequence defined by each outlet's 
-       sPDUOutletPowerOnTime OID value.
-       
-       For MasterSwitch firmware version 2.X, setting this OID to 
-       rebootAllSequence (5) will cause a turnAllOffSequence to be performed. 
-       Once all outlets are off, the MasterSwitch will then delay the 
-       sPDUMasterConfigReboot OID time, and then perform a turnAllOnSequence.    
-
-       For MasterSwitch firmware version 2.X, setting this OID to 
-       turnAllOffSequence (7) will turn all outlets off as defined by 
-       each outlet's sPDUOutletPowerOffTime OID value.
-       
-       For MasterSwitch firmware version 1.X, setting this OID to 
-       turnAllOffSequence (7) will have no effect.
-
-       Getting this OID will return the noCommand (6) value."
-              
-   ::= { sPDUMasterControl 1 }
-
-   
-sPDUMasterState  OBJECT-TYPE
-   SYNTAX DisplayString       
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-          "Getting this OID will cause the status of all outlets to be 
-          returned. This OID is provided for informational purposes only.
-          To change the outlet state, the user should use the sPDUOutletCtl
-          OID in the sPDUOutletControlTable.
-
-          The format of the data returned is a character string consisting
-          of the word 'On' if the outlet is on or 'Off' if the outlet is
-          off. At least one space will delimit each outlet entry in the 
-          string. 
-          
-          If the outlet states are unknown, the character string 'Unknown'
-          will be returned. This signifies that there is an inconsistancy 
-          in the PDU. In the rare case that this should happen, the user 
-          is advised to shut down all equipment powered by the PDU and 
-          then cycle the PDU's power. This will put the PDU in a consistent
-          state."
-           
-   ::= { sPDUMasterControl 2 }
-
-sPDUMasterPending    OBJECT-TYPE
-   SYNTAX DisplayString       
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-          "Getting this OID will cause the command pending status of all outlets to be returned.
-
-          The format of the data returned is a character string consisting
-          of the word 'Yes' if a command is pending for the outlet or 'No'
-          if there is no command pending for the outlet. At least one 
-          space will delimit each outlet entry in the string. 
-          
-          If the pending states are unknown, the character string 'Unknown'
-          will be returned. This signifies that there is an inconsistancy 
-          in the PDU. In the rare case that this should happen, the user 
-          is advised to shut down all equipment powered by the PDU and then
-          cycle the PDU's power. This will put the PDU in a consistent state."
-  ::= { sPDUMasterControl 3 }
-
-
--- the sPDUMasterConfig group
-   
-sPDUMasterConfigPowerOn  OBJECT-TYPE
-   SYNTAX INTEGER                
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      " The amount of delay, in seconds, between when
-        power is provided to the PDU and when the PDU
-        provides basic master power to the outlets.       
-       
-       Allowed values are:
-
-       -1 never apply power automatically.
-       0 apply power immediately.
-       15 apply power in 15 seconds.
-       30 apply power in 30 seconds.
-       45 apply power in 45 seconds.
-       60 apply power in 60 seconds  (1 minute).
-       120 apply power in 120 seconds (2 minutes).
-       300 apply power in 300 seconds (5 minutes).
-       
-       If a value other than a supported value is provided in a 
-       set request, the PDU interprets it as the next lower
-       acceptable value.  If the provided value is lower than
-       the lowest acceptable value, the lowest acceptable 
-       value is used."
-       
-   ::= { sPDUMasterConfig 1 }
-
-sPDUMasterConfigReboot   OBJECT-TYPE
-   SYNTAX INTEGER                
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "During a reboot sequence, power is turned off and then 
-       back on. This OID defines the amount of time to wait, 
-       in seconds, after turning the power off, at the start
-       of the sequence, before turning power back on, at the
-       end of the reboot sequence.       
-       
-       Allowed values are:
-       
-       5 wait 5 seconds between off/on.
-       10 wait 10 seconds between off/on.
-       15 wait 15 seconds between off/on.
-       20 wait 20 seconds between off/on.
-       30 wait 30 seconds between off/on.
-       45 wait 45 seconds between off/on.
-       60 wait 60 seconds (1 minute) between off/on.
-       
-       If a value other than a supported value is provided in a 
-       set request, the PDU interprets it as the next lower
-       acceptable value.  If the provided value is lower than
-       the lowest acceptable value, the lowest acceptable 
-       value is used.
-
-       This OID is read-only for the MasterSwitch version 2.X and is the 
-       maximum sPDUOutletRebootDuration OID of the individual outlets."
-       
-   ::= { sPDUMasterConfig 2 }
-   
-sPDUMasterConfigPDUName  OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-write
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the PDU. The maximum value is 20 characters."
-   ::= { sPDUMasterConfig 3 }
-
-
-
--- the sPDUOutletControl group
-sPDUOutletControlTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of outlets for the PDU."
-   ::= { sPDUOutletControl 1 }
-
-   
-sPDUOutletControlTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF OutletControlEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for control of individual outlet switches. The number of
-       entries is contained in the sPDUOutletControlTableSize OID."
-   ::= { sPDUOutletControl 2 }
-
-sPDUOutletControlEntry OBJECT-TYPE
-   SYNTAX OutletControlEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The outlets to control."
-   INDEX  { sPDUOutletControlIndex}
-   ::= { sPDUOutletControlTable 1 }
-
-OutletControlEntry ::=
-   SEQUENCE {
-      sPDUOutletControlIndex  INTEGER,
-      sPDUOutletPending       INTEGER,
-      sPDUOutletCtl           INTEGER,
-      sPDUOutletCtlName       DisplayString    
-   }      
-
-sPDUOutletControlIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the outlet entry."
-   ::= { sPDUOutletControlEntry 1 }
-   
-sPDUOutletPending OBJECT-TYPE
-   SYNTAX INTEGER{
-        commandPending        (1),
-        noCommandPending      (2),
-        commandPendingUnknown (3)
-   }    
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Reports whether the current outlet has a pending command.
-      
-       If the commandPendingUnknown (3) value is returned, all 
-       devices powered by the PDU should be shut down. The PDU's
-       power should then be cycled to clear this condition."
-       
-   ::= { sPDUOutletControlEntry 2 }
-   
-sPDUOutletCtl OBJECT-TYPE
-   SYNTAX INTEGER {
-        outletOn              (1),
-        outletOff             (2),
-        outletReboot          (3),
-        outletUnknown         (4),
-        outletOnWithDelay     (5),
-        outletOffWithDelay    (6),
-        outletRebootWithDelay (7)
-   }     
-
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-       "Getting this variable will return the outlet state. If 
-       the outlet is on, the outletOn (1) value will be returned.
-       If the outlet is off, the outletOff (2) value will be
-       returned. 
-       
-       If the state of the outlet cannot be determined, the 
-       outletUnknown (4) value will be returned. If the 
-       outletUnknown condition should occur, all devices 
-       powered by the PDU should be shut down. The PDU's power 
-       should then be cycled to clear this condition.
-       
-       Setting this variable to outletOn (1) will turn the outlet on.
-       
-       Setting this variable to outletOff (2) will turn the outlet off. 
-
-       Setting this variable to outletReboot (3) will reboot the outlet.
-      
-       Setting this variable to outletOnWithDelay (5) will turn the outlet on
-       after the sPDUOutletPowerOnTime OID has elapsed. This option is not
-       valid for MasterSwitch firmware version 1.X.
-
-       Setting this variable to outletOffWithDelay (6) will turn the outlet off
-       after the sPDUOutletPowerOffTime OID has elapsed. This option is not valid
-       for MasterSwitch firmware version 1.X.
-
-       Setting this variable to outletRebootWithDelay (7) will turn the outlet off
-       after the sPDUOutletPowerOffTime OID has elapsed, wait the sPDUOutletRebootDuration
-       OID time, then turn the outlet back on.  
-       This option is not valid for MasterSwitch firmware version 1.X."
-
-   ::= { sPDUOutletControlEntry 3 }
-
-sPDUOutletCtlName    OBJECT-TYPE
-   SYNTAX  DisplayString
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the outlet. Maximum size is 20 characters.
-       This OID is provided for informational purposes only.
-       This value is set by the sPDUOutletName OID."
-       
-   ::= { sPDUOutletControlEntry  4 }
-
--- the sPDUOutletConfig group
-sPDUOutletConfigTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of outlets for the PDU."
-   ::= { sPDUOutletConfig 1 }
-
-sPDUOutletConfigTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF SPDUOutletConfigEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The list of outlets to configure. The number of
-       entries is defined by the sPDUOutletConfigTableSize
-       OID."
-       
-   ::= { sPDUOutletConfig 2  }
-
-sPDUOutletConfigEntry OBJECT-TYPE
-   SYNTAX SPDUOutletConfigEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The outlets to control."
-   INDEX  { sPDUOutletConfigIndex}
-   ::= { sPDUOutletConfigTable 1 }
-
-SPDUOutletConfigEntry ::=
-   SEQUENCE {
-      sPDUOutletConfigIndex    INTEGER,
-      sPDUOutletPowerOnTime    INTEGER,
-      sPDUOutletName           DisplayString,
-      sPDUOutletPowerOffTime   INTEGER,
-      sPDUOutletRebootDuration INTEGER
-   }      
-
-sPDUOutletConfigIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the outlet entry."
-   ::= { sPDUOutletConfigEntry 1 }
-   
-sPDUOutletPowerOnTime OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The amount of time (in seconds) the outlet will delay 
-       powering on when the MasterSwitch is powered on.
-              
-       Allowed values are:
-       
-       -1 never power on automatically.
-       0  power on with the Master Switch.
-       15 power on 15 seconds after the MasterSwitch has power applied.
-       30 power on 30 seconds after the MasterSwitch has power applied.
-       45 power on 45 seconds after the MasterSwitch has power applied.
-       60 power on 60 seconds (1 minute) after the MasterSwitch has power applied.
-       120 power on 120 seconds (2 minutes) after the MasterSwitch has power applied.
-       300 power on 300 seconds (5 minutes) after the MasterSwitch has power applied.
-       
-       If a value other than a supported value is provided in a 
-       set request, the PDU interprets it as the next lower
-       acceptable value.  If the provided value is lower than
-       the lowest acceptable value, the lowest acceptable 
-       value is used."
-
-   ::= { sPDUOutletConfigEntry 2 }
-   
-sPDUOutletName   OBJECT-TYPE
-   SYNTAX  DisplayString    ACCESS  read-write
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the outlet. Maximum size is 20 characters."
-
-   ::= { sPDUOutletConfigEntry  3 }
-
-sPDUOutletPowerOffTime OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The amount of time (in seconds) the outlet will delay 
-       powering off.
-              
-       Allowed values are:
-       
-       -1 never power off automatically.
-       0  power off with the MasterSwitch.
-       15 power off 15 seconds after being commanded.
-       30 power off 30 seconds after being commanded.
-       45 power off 45 seconds after being commanded.
-       60 power off 60 seconds (1 minute) after being commanded.
-       120 power off 120 seconds (2 minutes) after being commanded.
-       300 power off 300 seconds (5 minutes) after being commanded.
-       
-       If a value other than a supported value is provided in a 
-       set request, the PDU interprets it as the next lower
-       acceptable value.  If the provided value is lower than
-       the lowest acceptable value, the lowest acceptable 
-       value is used.
-       
-       This OID is not available for MasterSwitch firmware version 1.X."
-
-   ::= { sPDUOutletConfigEntry 4 }
-
-sPDUOutletRebootDuration OBJECT-TYPE
-   SYNTAX INTEGER                
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "During a reboot sequence, power is turned off and then 
-       back on. This OID defines the amount of time to wait, 
-       in seconds, after turning the power off, at the start
-       of the sequence, before turning power back on, at the
-       end of the reboot sequence.       
-       
-       Allowed values are:
-       
-       5 wait 5 seconds between off/on.
-       10 wait 10 seconds between off/on.
-       15 wait 15 seconds between off/on.
-       20 wait 20 seconds between off/on.
-       30 wait 30 seconds between off/on.
-       45 wait 45 seconds between off/on.
-       60 wait 60 seconds (1 minute) between off/on.
-       
-       If a value other than a supported value is provided in a 
-       set request, the PDU interprets it as the next lower
-       acceptable value.  If the provided value is lower than
-       the lowest acceptable value, the lowest acceptable 
-       value is used.
-
-       This OID is not available for MasterSwitch firmware version 1.X."
-       
-   ::= { sPDUOutletConfigEntry 5 }
-
-
--- the sPDUIdentVM group
-
-sPDUIdentVMTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of MasterSwitch VMs controllable
-       by this IP address."
-   ::= { sPDUIdentVM 1 }
-
-   
-sPDUIdentVMTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF IdentVMEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for query of the individual MasterSwitch VMs. 
-       The number of entries is contained in the 
-       sPDUIdentVMTableSize OID."
-   ::= { sPDUIdentVM 2 }
-
-sPDUIdentVMEntry OBJECT-TYPE
-   SYNTAX IdentVMEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The MasterSwitch VMs to query."
-   INDEX  { sPDUIdentVMIndex}
-   ::= { sPDUIdentVMTable 1 }
-
-IdentVMEntry ::=
-   SEQUENCE {
-      sPDUIdentVMIndex                   INTEGER,
-      sPDUIdentNameVM                    DisplayString,
-      sPDUIdentHardwareRevVM             DisplayString,
-      sPDUIdentFirmwareRevVM             DisplayString,
-      sPDUIdentDateOfManufactureVM       DisplayString,
-      sPDUIdentModelNumberVM             DisplayString,
-      sPDUIdentSerialNumberVM            DisplayString
-   }      
-
-sPDUIdentVMIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the MasterSwitch VM entry."
-   ::= { sPDUIdentVMEntry 1 }
-
-sPDUIdentNameVM OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A 23-character string identifying the 
-       MasterSwitch VM. "
-   ::= { sPDUIdentVMEntry 2 }
-
-sPDUIdentHardwareRevVM OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The hardware version of the MasterSwitch VM. 
-       This value is set at the factory."
-   ::= { sPDUIdentVMEntry 3 }
-
-sPDUIdentFirmwareRevVM OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "An 6-character ID string identifying the MasterSwitch VM 
-       firmware version. This value is set at the factory." 
-   ::= {  sPDUIdentVMEntry 4 }
-
-
-sPDUIdentDateOfManufactureVM OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The date when the MasterSwitch VM was manufactured in mm/dd/yyyy format.
-       This value is set at the factory. " 
-   ::= { sPDUIdentVMEntry 5 }
-   
-sPDUIdentModelNumberVM OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A 17-character string identifying the model number of 
-       the MasterSwitch VM. This value is set at the factory."
-   ::= { sPDUIdentVMEntry 6 }
-
-sPDUIdentSerialNumberVM OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A 17-character string identifying the serial number of 
-       the MasterSwitch VM. This value is set at the factory."
-   ::= { sPDUIdentVMEntry 7 }
-   
-
--- the sPDUMasterControlVM group
-
-sPDUMasterControlVMTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of MasterSwitch VMs controllable
-       by this IP address."
-   ::= { sPDUMasterControlVM 1 }
-
-   
-sPDUMasterControlVMTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF MasterControlVMEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for control of the individual MasterSwitch VMs.
-       The number of entries is contained in the 
-       sPDUMasterControlVMTableSize OID."
-   ::= { sPDUMasterControlVM 2 }
-
-sPDUMasterControlVMEntry OBJECT-TYPE
-   SYNTAX MasterControlVMEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The MasterSwitch VMs to control."
-   INDEX  { sPDUMasterControlVMIndex}
-   ::= { sPDUMasterControlVMTable 1 }
-
-MasterControlVMEntry ::=
-   SEQUENCE {
-      sPDUMasterControlVMIndex           INTEGER,
-      sPDUMasterControlVMName            DisplayString,
-      sPDUMasterControlVMCommand         INTEGER
-   }      
-
-sPDUMasterControlVMIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the MasterSwitch VM entry."
-   ::= { sPDUMasterControlVMEntry 1 }
-
-sPDUMasterControlVMName  OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the MasterSwitch VM. The maximum 
-       value is 23 characters. The name is set by
-       using the sPDUMasterConfigVMName OID."
-   ::= { sPDUMasterControlVMEntry 2 }
-
-sPDUMasterControlVMCommand  OBJECT-TYPE
-  SYNTAX INTEGER       {
-      noCommandAllVM               (1),
-      immediateAllOnVM             (2),
-      immediateAllOffVM            (3),
-      immediateAllRebootVM         (4),
-      delayedAllOnVM               (5),
-      delayedAllOffVM              (6),
-      sequencedAllRebootVM         (7),
-      delayedAllRebootVM           (8),
-      delayedSequenceAllRebootVM   (9),
-      cancelAllPendingCommandsVM   (10),
-      audioAlarmMute               (11)
-   }
-   
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this OID to immediateAllOnVM (2) will turn all outlets
-       on immediately.
-       
-       Setting this OID to immediateAllOffVM (3) will turn all outlets
-       off immediately.
-       
-       Setting this OID to immediateAllRebootVM (4) will reboot all outlets
-       immediately.
-
-       Setting this OID to delayedAllOnVM (5) will turn all outlets on as 
-       defined by each outlet's sPDUOutletConfigVMPowerOnTime OID value. 
-             
-       Setting this OID to delayedAllOffVM (6) will turn all outlets 
-       off as defined by each outlet's sPDUOutletConfigVMPowerOffTime OID value.
-      
-       Setting this OID to sequencedAllRebootVM (7) will cause a 
-       immediateAllOffVM command to be performed. The MasterSwitch VM will 
-       then delay the sPDUMasterStatusVMRebootDuration OID time, and then 
-       perform a delayedAllOnVM command.    
-
-       Setting this OID to delayedAllRebootVM (8) will cause a delayedAllOffVM
-       command to be performed. Each outlet will then wait its 
-       sPDUOutletConfigVMRebootDuration before returning power to the outlet.
-       
-       Setting this OID to delayedSequenceAllRebootVM (9) will cause a 
-       delayedAllOffVM command to be performed. Once all outlets are off, 
-       the MasterSwitch VM will then delay the sPDUMasterStatusVMRebootDuration 
-       OID time, and then perform a delayedAllOnVM command.    
-       
-       Setting this OID to cancelAllPendingCommandsVM (10) will cause all pending
-       commands on the MasterSwitch VM to be canceled.
-       
-
-       Setting this OID to audioAlarmMute (11) will temporarily silence the audible
-       alarm for the duration of the current overload condition. The audible alarm
-       will be activated on subsequent overload alarms.
-
-       Getting this OID will return the noCommandAllVM (1) value."
-   ::= { sPDUMasterControlVMEntry 3 }
-
-
--- the sPDUMasterConfigVM group
-
-sPDUMasterConfigVMTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of MasterSwitch VMs configurable
-       by this IP address."
-   ::= { sPDUMasterConfigVM 1 }
-
-   
-sPDUMasterConfigVMTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF MasterConfigVMEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for configuration of the individual MasterSwitch VMs.
-       The number of entries is contained in the 
-       sPDUMasterConfigVMTableSize OID."
-   ::= { sPDUMasterConfigVM 2 }
-
-sPDUMasterConfigVMEntry OBJECT-TYPE
-   SYNTAX MasterConfigVMEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The MasterSwitch VMs to configure."
-   INDEX  { sPDUMasterConfigVMIndex}
-   ::= { sPDUMasterConfigVMTable 1 }
-
-MasterConfigVMEntry ::=
-   SEQUENCE {
-      sPDUMasterConfigVMIndex                     INTEGER,
-      sPDUMasterConfigVMName                      DisplayString,
-      sPDUMasterConfigVMColdstartDelay            INTEGER,
-      sPDUMasterConfigVMAudioAlarmActivated       INTEGER,
-      sPDUMasterConfigVMHighLoadWarningThreshold  INTEGER,
-      sPDUMasterConfigVMLowLoadWarningThreshold   INTEGER,
-      sPDUMasterConfigVMOverloadRestriction       INTEGER
-   }      
-   
-sPDUMasterConfigVMIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the MasterSwitch VM entry."
-   ::= { sPDUMasterConfigVMEntry 1 }
-
-
-sPDUMasterConfigVMName   OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-write
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the MasterSwitch VM. Maximum size is 23 characters."
-   ::= { sPDUMasterConfigVMEntry 2 }
-
-sPDUMasterConfigVMColdstartDelay  OBJECT-TYPE
-   SYNTAX INTEGER                
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      " The amount of delay, in seconds, between when
-        power is provided to the MasterSwitch VM and 
-        when the MasterSwitch VM provides basic master 
-        power to the outlets.       
-       
-       Allowed values are:
-
-       -1 never apply power automatically.
-       0 apply power immediately.
-       15 apply power in 15 seconds.
-       30 apply power in 30 seconds.
-       45 apply power in 45 seconds.
-       60 apply power in 60 seconds  (1 minute).
-       120 apply power in 120 seconds (2 minutes).
-       300 apply power in 300 seconds (5 minutes).
-       
-       If a value other than a supported value is provided in a 
-       set request, the MasterSwitch VM interprets it as the next lower
-       acceptable value.  If the provided value is lower than
-       the lowest acceptable value, the lowest acceptable 
-       value is used."
-   ::= { sPDUMasterConfigVMEntry 3 }
-
-sPDUMasterConfigVMAudioAlarmActivated  OBJECT-TYPE
-   SYNTAX INTEGER       {
-      audioAlarmActiveNever               (1),
-      audioAlarmActiveOnOverload          (2),
-      audioAlarmActiveOnOverloadImminent  (3)
-   }
-
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this OID to audioAlarmActiveNever (1) will disable
-       the audio alarm on the MasterSwitch VM.
-       
-       Setting this OID to audioAlarmActiveOnOverload (2) will 
-       activate the audio alarm on the MasterSwitch VM when an
-       overload condition is present.       
-
-       Setting this OID to audioAlarmActiveOnOverloadImminent (3) 
-       will activate the audio alarm on the MasterSwitch VM when
-       the load on the MasterSwitch VM has surpassed the
-       sPDUMasterConfigVMHighLoadWarningThreshold OID value."
-   ::= { sPDUMasterConfigVMEntry 4 }
-   
-sPDUMasterConfigVMHighLoadWarningThreshold OBJECT-TYPE
-   SYNTAX INTEGER (0..100)                
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "A threshold that indicates the power consumption of
-       the load is nearing an overload condition. It is 
-       represented as a percentage of full load."
-   ::= { sPDUMasterConfigVMEntry 5 }
-
-sPDUMasterConfigVMLowLoadWarningThreshold OBJECT-TYPE
-   SYNTAX INTEGER (0..100)               
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "A threshold that indicates the power consumption of
-       the load is nearing a low consumption condition. It is 
-       represented as a percentage of full load."
-   ::= { sPDUMasterConfigVMEntry 6 }
-
-sPDUMasterConfigVMOverloadRestriction OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alwaysAllowTurnON         (1),
-      restrictOnWarning         (2),
-      restrictOnOverload        (3)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "This OID controls the behavior of the MasterSwitch VM
-       when an overload condition is possible and additional 
-       outlets are requested to be turned on. 
-
-       Setting this OID to alwaysAllowTurnON (1) will always allow 
-       the outlets to turn on.
-       
-       Setting this OID to restrictOnWarning (2) will not allow 
-       outlets to turn on if the sPDUMasterConfigVMHighLoadWarningThreshold
-       OID is exceeded.
-              
-       Setting this OID to restrictOnOverload (3) will not allow
-       outlets to turn on if the MasterSwitch Vm is in an 
-       overload condition."
-   ::= { sPDUMasterConfigVMEntry 7 }
-
--- the sPDUMasterStatusVM group
-
-sPDUMasterStatusVMTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of MasterSwitch VMs at
-       this IP address."
-   ::= { sPDUMasterStatusVM 1 }
-
-   
-sPDUMasterStatusVMTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF MasterStatusVMEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for gathering of status from the individual 
-       MasterSwitch VMs. The number of entries is contained 
-       in the sPDUMasterStatusVMTableSize OID."
-   ::= { sPDUMasterStatusVM 2 }
-
-sPDUMasterStatusVMEntry OBJECT-TYPE
-   SYNTAX MasterStatusVMEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The MasterSwitch VMs to gather status from."
-   INDEX  { sPDUMasterStatusVMIndex}
-   ::= { sPDUMasterStatusVMTable 1 }
-
-MasterStatusVMEntry ::=
-   SEQUENCE {
-      sPDUMasterStatusVMIndex                     INTEGER,
-      sPDUMasterStatusVMName                      DisplayString,
-      sPDUMasterStatusVMCommandPending            INTEGER,
-      sPDUMasterStatusVMOverloadCondition         INTEGER,
-      sPDUMasterStatusVMLowLoadCondition          INTEGER,
-      sPDUMasterStatusVMCurrentLoad               INTEGER,
-      sPDUMasterStatusVMMaxLoad                   INTEGER,
-      sPDUMasterStatusVMOutletCount               INTEGER,
-      sPDUMasterStatusVMRebootDuration            INTEGER
-   }      
-   
-sPDUMasterStatusVMIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the MasterSwitch VM entry."
-   ::= { sPDUMasterStatusVMEntry 1 }
-
-sPDUMasterStatusVMName   OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the MasterSwitch VM. Maximum size is 23 characters."
-   ::= { sPDUMasterStatusVMEntry 2 }
-
-sPDUMasterStatusVMCommandPending OBJECT-TYPE
-   SYNTAX INTEGER       {
-      commandPendingMasterTrueVM      (1),
-      commandPendingMasterFalseVM     (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return commandPendingMasterTrueVM (1)
-       if the MasterSwitch VM has a pending command on any of its
-       outlets.
-
-       commandPendingMasterFalseVM (2) will be returned if there are
-       no pending commands." 
-   ::= { sPDUMasterStatusVMEntry 3 }
-
-sPDUMasterStatusVMOverloadCondition OBJECT-TYPE
-   SYNTAX INTEGER       {
-      overloadConditionTrueVM         (1),
-      overloadConditionFalseVM        (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return overloadConditionTrueVM (1)
-       if the sPDUMasterConfigVMHighLoadWarningThreshold OID is
-       violated.
-
-       overloadConditionFalseVM (2) will be returned if the 
-       sPDUMasterConfigVMHighLoadWarningThreshold OID is not
-       violated."
-   ::= { sPDUMasterStatusVMEntry 4 }
-
-sPDUMasterStatusVMLowLoadCondition OBJECT-TYPE
-   SYNTAX INTEGER       {
-      lowLoadConditionTrueVM            (1),
-      lowLoadConditionFalseVM           (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return lowLoadConditionTrueVM (1)
-       if the sPDUMasterConfigVMLowLoadWarningThreshold OID is
-       violated.
-
-       lowLoadConditionFalseVM (2) will be returned if the 
-       sPDUMasterConfigVMHighLoadWarningThreshold OID is not
-       violated. "
-   ::= { sPDUMasterStatusVMEntry 5 }
-
-sPDUMasterStatusVMCurrentLoad   OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return the total amount of power
-       being consumed by the load. It is represented as a 
-       percentage of full load."
-   ::= { sPDUMasterStatusVMEntry 6 }
-
-sPDUMasterStatusVMMaxLoad   OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return the total amount of power
-       that this MasterSwitch VM can provide. It is represented
-       in Amps."  
-   ::= { sPDUMasterStatusVMEntry 7 }
-
-sPDUMasterStatusVMOutletCount   OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return the number of controllable
-       outlets for this MasterSwitch VM."
-   ::= { sPDUMasterStatusVMEntry 8 }
-
-sPDUMasterStatusVMRebootDuration   OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return the largest
-       sPDUOutletConfigVMRebootDuration OID time 
-       for this MasterSwitch VM."
-   ::= { sPDUMasterStatusVMEntry 9 }
-
--- the sPDUOutletControlVM group
-
-   
-sPDUOutletControlVMTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF OutletControlVMEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for control of individual outlet switches. The number of
-       entries is contained in the sPDUMasterStatusOutletCount OID."
-   ::= { sPDUOutletControlVM 1 }
-
-sPDUOutletControlVMEntry OBJECT-TYPE
-   SYNTAX OutletControlVMEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The outlets to control."
-   INDEX  { sPDUOutletControlVMIndex, sPDUOutletControlVMOutletIndex }
-   ::= { sPDUOutletControlVMTable 1 }
-
-OutletControlVMEntry ::=
-   SEQUENCE {
-      sPDUOutletControlVMIndex         INTEGER,
-      sPDUOutletControlVMName          DisplayString,   
-      sPDUOutletControlVMOutletIndex   INTEGER,
-      sPDUOutletControlVMOutletName    DisplayString,
-      sPDUOutletControlVMOutletCommand INTEGER
-   }      
-
-sPDUOutletControlVMIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the MasterSwitch VM."
-   ::= { sPDUOutletControlVMEntry 1 }
-
-sPDUOutletControlVMName   OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the MasterSwitch VM. Maximum size is 23 characters.
-       This OID is provided for informational purposes only."
-   ::= { sPDUOutletControlVMEntry 2 }
-
-sPDUOutletControlVMOutletIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the outlet entry."
-   ::= { sPDUOutletControlVMEntry 3 }
-   
-sPDUOutletControlVMOutletName    OBJECT-TYPE
-   SYNTAX  DisplayString
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the outlet. Maximum size is 23 characters.
-       This OID is provided for informational purposes only."
-   ::= { sPDUOutletControlVMEntry 4 }
-
-sPDUOutletControlVMOutletCommand OBJECT-TYPE
-   SYNTAX INTEGER {
-      immediateOnVM             (1),
-      immediateOffVM            (2),
-      immediateRebootVM         (3),
-      delayedOnVM               (4),
-      delayedOffVM              (5),
-      delayedRebootVM           (6),
-      cancelPendingCommandVM    (7)
-
-   }     
-
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-       "Getting this variable will return the outlet state. If 
-       the outlet is on, the immediateOnVM (1) value will be returned.
-       If the outlet is off, the immediateOffVM (2) value will be
-       returned. 
-       
-       
-       Setting this variable to immediateOnVM (1) will immediately turn the outlet on.
-       
-       Setting this variable to immediateOffVM (2) will immediately turn the outlet off. 
-
-       Setting this variable to immediateRebootVM (3) will immediately reboot the outlet.
-      
-       Setting this variable to delayedOnVM (4) will turn the outlet on
-       after the sPDUOutletConfigVMPowerOnTime OID time has elapsed.   
-
-       Setting this variable to delayedOffVM (5) will turn the outlet off
-       after the sPDUOutletConfigVMPowerOffTime OID time has elapsed.
-
-       Setting this variable to delayedRebootVM  (6) will cause the 
-       MasterSwitch VM to perform a delayedOffVM command, wait the 
-       sPDUOutletConfigVMRebootDuration OID time, and then perform the
-       immediateOnVM command.
-       
-       Setting this variable to cancelPendingCommandVM (7) will cause any
-       pending command to this outlet to be canceled."
-   ::= { sPDUOutletControlVMEntry 5 }
-
--- the sPDUOutletConfigVM group
-  
-sPDUOutletConfigVMTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF OutletConfigVMEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for configuration of individual outlets. The number of
-       entries is contained in the sPDUMasterStatusOutletCount OID."
-   ::= { sPDUOutletConfigVM 1 }
-
-sPDUOutletConfigVMEntry OBJECT-TYPE
-   SYNTAX OutletConfigVMEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The outlets to configure."
-   INDEX  { sPDUOutletConfigVMIndex, sPDUOutletConfigVMOutletIndex }
-   ::= { sPDUOutletConfigVMTable 1 }
-
-OutletConfigVMEntry ::=
-   SEQUENCE {
-      sPDUOutletConfigVMIndex          INTEGER,
-      sPDUOutletConfigVMName           DisplayString,   
-      sPDUOutletConfigVMOutletIndex    INTEGER,
-      sPDUOutletConfigVMOutletName     DisplayString,
-      sPDUOutletConfigVMPowerOnTime    INTEGER,
-      sPDUOutletConfigVMPowerOffTime   INTEGER,
-      sPDUOutletConfigVMRebootDuration INTEGER
-   }      
-
-sPDUOutletConfigVMIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the MasterSwitch VM."
-   ::= { sPDUOutletConfigVMEntry 1 }
-
-sPDUOutletConfigVMName   OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the MasterSwitch VM. Maximum size is 23 characters."
-   ::= { sPDUOutletConfigVMEntry 2 }
-
-sPDUOutletConfigVMOutletIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the outlet entry."
-   ::= { sPDUOutletConfigVMEntry 3 }
-   
-
-sPDUOutletConfigVMOutletName   OBJECT-TYPE
-   SYNTAX  DisplayString    ACCESS  read-write
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the outlet. Maximum size is 23 characters."
-   ::= { sPDUOutletConfigVMEntry 4 }
-
-sPDUOutletConfigVMPowerOnTime OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The amount of time (in seconds) the outlet will delay 
-       powering on at coldstart or when a command that requires 
-       a turn-on delay is issued.
-              
-       Allowed values are:
-       
-       -1 never power on.
-       0  power on immediately.
-       15 power on 15 seconds after being commanded.
-       30 power on 30 seconds after being commanded.
-       45 power on 45 seconds after being commanded.
-       60 power on 60 seconds (1 minute) after being commanded.
-       120 power on 120 seconds (2 minutes) after being commanded.
-       300 power on 300 seconds (5 minutes) after being commanded.
-       
-       If a value other than a supported value is provided in a 
-       set request, the MasterSwitch VM interprets it as the next lower
-       acceptable value.  If the provided value is lower than
-       the lowest acceptable value, the lowest acceptable 
-       value is used."
-   ::= { sPDUOutletConfigVMEntry 5 }
-   
-
-sPDUOutletConfigVMPowerOffTime OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The amount of time (in seconds) the outlet will delay 
-       powering off when a command that requires 
-       a turn-off delay is issued.
-
-              
-       Allowed values are:
-       
-       -1 never power off automatically.
-       0  power off immediately.
-       15 power off 15 seconds after being commanded.
-       30 power off 30 seconds after being commanded.
-       45 power off 45 seconds after being commanded.
-       60 power off 60 seconds (1 minute) after being commanded.
-       120 power off 120 seconds (2 minutes) after being commanded.
-       300 power off 300 seconds (5 minutes) after being commanded.
-       
-       If a value other than a supported value is provided in a 
-       set request, the MasterSwitch VM interprets it as the next lower
-       acceptable value.  If the provided value is lower than
-       the lowest acceptable value, the lowest acceptable 
-       value is used."
-   ::= { sPDUOutletConfigVMEntry 6 }
-
-sPDUOutletConfigVMRebootDuration OBJECT-TYPE
-   SYNTAX INTEGER                
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "During a reboot sequence, power is turned off and then 
-       back on. This OID defines the amount of time to wait, 
-       in seconds, after turning the power off, at the start
-       of the sequence, before turning power back on, at the
-       end of the reboot sequence.       
-       
-       Allowed values are:
-       
-       5 wait 5 seconds between off/on.
-       10 wait 10 seconds between off/on.
-       15 wait 15 seconds between off/on.
-       20 wait 20 seconds between off/on.
-       30 wait 30 seconds between off/on.
-       45 wait 45 seconds between off/on.
-       60 wait 60 seconds (1 minute) between off/on.
-       
-       If a value other than a supported value is provided in a 
-       set request, the MasterSwitch VM interprets it as the next lower
-       acceptable value.  If the provided value is lower than
-       the lowest acceptable value, the lowest acceptable 
-       value is used."
-   ::= { sPDUOutletConfigVMEntry 7 }
-
--- the sPDUOutletStatusVM group
-  
-sPDUOutletStatusVMTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF OutletStatusVMEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for getting of status of individual outlets. The number of
-       entries is contained in the sPDUMasterStatusOutletCount OID."
-   ::= { sPDUOutletStatusVM 1 }
-
-sPDUOutletStatusVMEntry OBJECT-TYPE
-   SYNTAX OutletStatusVMEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The outlets to gather status from."
-   INDEX  { sPDUOutletStatusVMIndex, sPDUOutletStatusVMOutletIndex }
-   ::= { sPDUOutletStatusVMTable 1 }
-
-OutletStatusVMEntry ::=
-   SEQUENCE {
-      sPDUOutletStatusVMIndex          INTEGER,
-      sPDUOutletStatusVMName           DisplayString,   
-      sPDUOutletStatusVMOutletIndex    INTEGER,
-      sPDUOutletStatusVMOutletName     DisplayString,
-      sPDUOutletStatusVMOutletState    INTEGER,
-      sPDUOutletStatusVMCommandPending INTEGER
-   }      
-
-sPDUOutletStatusVMIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the MasterSwitch VM."
-   ::= { sPDUOutletStatusVMEntry 1 }
-
-sPDUOutletStatusVMName   OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the MasterSwitch VM. Maximum size is 23 characters."
-   ::= { sPDUOutletStatusVMEntry 2 }
-
-sPDUOutletStatusVMOutletIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the outlet entry."
-   ::= { sPDUOutletStatusVMEntry 3 }
-   
-sPDUOutletStatusVMOutletName    OBJECT-TYPE
-   SYNTAX  DisplayString
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the outlet. Maximum size is 23 characters."
-   ::= { sPDUOutletStatusVMEntry 4 }
-
-sPDUOutletStatusVMOutletState OBJECT-TYPE
-   SYNTAX INTEGER {
-        outletStatusVMOn              (1),
-        outletStatusVMOff             (2)
-   }     
-
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "Getting this variable will return the outlet state. If 
-       the outlet is on, the outletStatusOnVM (1) value will be returned.
-       If the outlet is off, the outletStatusOffVM (2) value will be
-       returned. "
-   ::= { sPDUOutletStatusVMEntry 5 }
-
-sPDUOutletStatusVMCommandPending    OBJECT-TYPE
-   SYNTAX INTEGER {
-        outletStatusVMCommandPending    (1),
-        outletStatusVMNoCommandPending  (2)
-   }     
-
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "Getting this variable will return the command pending
-        state of the outlet. If a command is pending on the 
-        outlet, the outletStatusVMCommandPending (1) value
-        will be returned. If there is not a command pending
-        on the outlet, the outletStatusVMNoCommandPending (2)
-        will be returned."
-   ::= { sPDUOutletStatusVMEntry 6 }
-
--- the sPDUIdentMSP group
-
-sPDUIdentMSPTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of MasterSwitch pluses controllable
-       by this IP address."
-   ::= { sPDUIdentMSP 1 }
-
-   
-sPDUIdentMSPTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF IdentMSPEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for query of the individual MasterSwitch pluses. 
-       The number of entries is contained in the 
-       sPDUIdentMSPTableSize OID."
-   ::= { sPDUIdentMSP 2 }
-
-sPDUIdentMSPEntry OBJECT-TYPE
-   SYNTAX IdentMSPEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The MasterSwitch pluses to query."
-   INDEX  { sPDUIdentMSPIndex}
-   ::= { sPDUIdentMSPTable 1 }
-
-IdentMSPEntry ::=
-   SEQUENCE {
-      sPDUIdentMSPIndex                   INTEGER,
-      sPDUIdentNameMSP                   DisplayString,
-      sPDUIdentHardwareRevMSP            DisplayString,
-      sPDUIdentFirmwareRevMSP            DisplayString,
-      sPDUIdentDateOfManufactureMSP      DisplayString,
-      sPDUIdentModelNumberMSP            DisplayString,
-      sPDUIdentSerialNumberMSP           DisplayString
-   }      
-
-sPDUIdentMSPIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the MasterSwitch plus entry."
-   ::= { sPDUIdentMSPEntry 1 }
-
-sPDUIdentNameMSP OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The name of the MasterSwitch plus. The maximum 
-       value is 23 characters. The name is set by
-       using the sPDUMasterConfigMSPName OID."
-   ::= { sPDUIdentMSPEntry 2 }
-
-sPDUIdentHardwareRevMSP OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The hardware version of the MasterSwitch plus. 
-       This value is set at the factory."
-   ::= { sPDUIdentMSPEntry 3 }
-
-sPDUIdentFirmwareRevMSP OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "An 6-character ID string identifying the MasterSwitch plus 
-       firmware version. This value is set at the factory." 
-   ::= {  sPDUIdentMSPEntry 4 }
-
-sPDUIdentDateOfManufactureMSP OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The date when the MasterSwitch plus was manufactured in mm/dd/yyyy format.
-       This value is set at the factory. " 
-   ::= { sPDUIdentMSPEntry 5 }
-   
-sPDUIdentModelNumberMSP OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A 17-character string identifying the model number of 
-       the MasterSwitch plus. This value is set at the factory."
-   ::= { sPDUIdentMSPEntry 6 }
-
-sPDUIdentSerialNumberMSP OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A 17-character string identifying the serial number of 
-       the MasterSwitch plus. This value is set at the factory."
-   ::= { sPDUIdentMSPEntry 7 }
-   
-
--- the sPDUMasterControlMSP group
-
-sPDUMasterControlMSPTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of MasterSwitch pluses controllable
-       by this IP address."
-   ::= { sPDUMasterControlMSP 1 }
-
-sPDUMasterControlMSPTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF MasterControlMSPEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for control of the individual MasterSwitch pluses.
-       The number of entries is contained in the 
-       sPDUMasterControlMSPTableSize OID."
-   ::= { sPDUMasterControlMSP 2 }
-
-sPDUMasterControlMSPEntry OBJECT-TYPE
-   SYNTAX MasterControlMSPEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The MasterSwitch pluses to control."
-   INDEX  { sPDUMasterControlMSPIndex}
-   ::= { sPDUMasterControlMSPTable 1 }
-
-MasterControlMSPEntry ::=
-   SEQUENCE {
-      sPDUMasterControlMSPIndex           INTEGER,
-      sPDUMasterControlMSPName            DisplayString,
-      sPDUMasterControlMSPCommand         INTEGER
-   }      
-
-sPDUMasterControlMSPIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the MasterSwitch plus entry."
-   ::= { sPDUMasterControlMSPEntry 1 }
-
-sPDUMasterControlMSPName  OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the MasterSwitch plus. The maximum 
-       value is 23 characters. The name is set by
-       using the sPDUMasterConfigMSPName OID."
-   ::= { sPDUMasterControlMSPEntry 2 }
-
-sPDUMasterControlMSPCommand  OBJECT-TYPE
-  SYNTAX INTEGER       {
-      noCommandAllMSP              (1),
-      immediateAllOnMSP            (2),
-      sequencedAllOnMSP            (3),
-      immediateAllOffMSP           (4),
-      gracefulAllRebootMSP         (5),
-      immediateAllRebootMSP        (6),
-      gracefulAllShutdownMSP       (7),
-      overrideAllBatCapThreshMSP   (8),
-      cancelAllPendingCommandsMSP  (9),
-      restoreFactoryDefaultsMSP   (10)
-   }
-   
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this OID to immediateAllOnMSP (2) will turn all outlets
-       on immediately.
-       
-       Setting this OID to sequencedAllOnMSP (3) will turn all outlets
-       on as defined by each outlet's sPDUOutletConfigMSPPowerOnDelay OID value.
-
-       Setting this OID to immediateAllOffMSP (4) will turn all outlets
-       off immediately.
-       
-       Setting this OID to gracefulAllRebootMSP (5) will reboot all outlets
-       (after the device running PowerChute confirms shutdown) as defined 
-       by each outlet's sPDUOutletConfigMSPRebootDuration OID time value.
-
-       Setting this OID to immediateAllRebootMSP (6) will reboot all outlets
-       immediately.
-
-       Setting this OID to gracefulAllShutdownMSP (7) will shutdown all outlets
-       (after the device running PowerChute confirms shutdown) as defined 
-       by each outlet's sPDUOutletConfigMSPPowerOffDelay OID time value.  Each 
-       outlet will then turn on after the sum of its 
-       sPDUOutletConfigMSPRestartDelay and sPDUOutletConfigMSPPowerOnDelay OID 
-       values.
-
-       Setting this OID to overrideAllBatCapThreshMSP (8) will cause the 
-       outlet to ignore the Battery Capacity Threshold and proceed turning on
-       the outlets as defined by each outlet's sPDUOutletConfigMSPPowerOnDelay 
-       OID value.
-                    
-       Setting this OID to cancelAllPendingCommandsMSP (9) will cause all pending
-       commands on the MasterSwitch plus to be canceled.
-
-       Setting this OID to restoreFactoryDefaultsMSP (10) will cause the settings of
-       the MasterSwitch plus to be restored to the factory defaults.
-
-       Getting this OID will return the noCommandAllMSP (1) value."
-   ::= { sPDUMasterControlMSPEntry 3 }
-
-
--- the sPDUMasterConfigMSP group
-
-sPDUMasterConfigMSPTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of MasterSwitch pluses configurable
-       by this IP address."
-   ::= { sPDUMasterConfigMSP 1 }
-   
-sPDUMasterConfigMSPTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF MasterConfigMSPEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for configuration of the individual MasterSwitch pluses.
-       The number of entries is contained in the 
-       sPDUMasterConfigMSPTableSize OID."
-   ::= { sPDUMasterConfigMSP 2 }
-
-sPDUMasterConfigMSPEntry OBJECT-TYPE
-   SYNTAX MasterConfigMSPEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The MasterSwitch pluses to configure."
-   INDEX  { sPDUMasterConfigMSPIndex}
-   ::= { sPDUMasterConfigMSPTable 1 }
-
-MasterConfigMSPEntry ::=
-   SEQUENCE {
-      sPDUMasterConfigMSPIndex                     INTEGER,
-      sPDUMasterConfigMSPName                      DisplayString,
-      sPDUMasterConfigMSPPowerOnTimeDelay          INTEGER,
-      sPDUMasterConfigMSPManualButton              INTEGER
-   }      
-   
-sPDUMasterConfigMSPIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the MasterSwitch plus entry."
-   ::= { sPDUMasterConfigMSPEntry 1 }
-
-sPDUMasterConfigMSPName   OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-write
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the MasterSwitch plus. Maximum size is 23 characters."
-   ::= { sPDUMasterConfigMSPEntry 2 }
-
-sPDUMasterConfigMSPPowerOnTimeDelay  OBJECT-TYPE
-   SYNTAX INTEGER (0..9999)                
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      " The amount of delay, in seconds, between when
-        power is provided to the MasterSwitch plus and 
-        when the MasterSwitch plus provides basic master 
-        power to the outlets.       
-       
-       Allowed values are:
-
-       0 - 9999 seconds (0 - 2hrs, 46 mins, 39 secs).
-       0 indicates to apply power immediately."
-   ::= { sPDUMasterConfigMSPEntry 3 }
-   
-
-sPDUMasterConfigMSPManualButton  OBJECT-TYPE
-   SYNTAX INTEGER       {
-      manualButtonDisabled              (1),
-      manualButtonEnabled               (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this OID to manualButtonDisabled (1) will disable
-       the manual button on the MasterSwitch plus.
-
-       Setting this OID to manualButtonEnabled (2) will enable
-       the manual button on the MasterSwitch plus."
-   ::= { sPDUMasterConfigMSPEntry 4 }
-   
--- the sPDUMasterStatusMSP group
-
-sPDUMasterStatusMSPTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of MasterSwitch pluses at
-       this IP address."
-   ::= { sPDUMasterStatusMSP 1 }
-
-   
-sPDUMasterStatusMSPTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF MasterStatusMSPEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for gathering of status from the individual 
-       MasterSwitch pluses. The number of entries is contained 
-       in the sPDUMasterStatusMSPTableSize OID."
-   ::= { sPDUMasterStatusMSP 2 }
-
-sPDUMasterStatusMSPEntry OBJECT-TYPE
-   SYNTAX MasterStatusMSPEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The MasterSwitch pluses to gather status from."
-   INDEX  { sPDUMasterStatusMSPIndex}
-   ::= { sPDUMasterStatusMSPTable 1 }
-
-MasterStatusMSPEntry ::=
-   SEQUENCE {
-      sPDUMasterStatusMSPIndex                     INTEGER,
-      sPDUMasterStatusMSPName                      DisplayString,
-      sPDUMasterStatusMSPOutletCount               INTEGER
-   }      
-   
-sPDUMasterStatusMSPIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the MasterSwitch plus entry."
-   ::= { sPDUMasterStatusMSPEntry 1 }
-
-sPDUMasterStatusMSPName   OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the MasterSwitch plus. The maximum 
-       value is 23 characters. The name is set by
-       using the sPDUMasterConfigMSPName OID."
-   ::= { sPDUMasterStatusMSPEntry 2 }
-
-sPDUMasterStatusMSPOutletCount   OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return the number of controllable
-       outlets for this MasterSwitch plus."
-   ::= { sPDUMasterStatusMSPEntry 3 }
-
--- the sPDUOutletControlMSP group
-   
-sPDUOutletControlMSPTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF OutletControlMSPEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for control of individual outlet switches. The number of
-       entries is contained in the sPDUMasterStatusMSPOutletCount OID."
-   ::= { sPDUOutletControlMSP 1 }
-
-sPDUOutletControlMSPEntry OBJECT-TYPE
-   SYNTAX OutletControlMSPEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The outlets to control."
-   INDEX  { sPDUOutletControlMSPIndex, sPDUOutletControlMSPOutletIndex }
-   ::= { sPDUOutletControlMSPTable 1 }
-
-OutletControlMSPEntry ::=
-   SEQUENCE {
-      sPDUOutletControlMSPIndex         INTEGER,
-      sPDUOutletControlMSPName          DisplayString,   
-      sPDUOutletControlMSPOutletIndex   INTEGER,
-      sPDUOutletControlMSPOutletName    DisplayString,
-      sPDUOutletControlMSPOutletCommand INTEGER
-   }      
-
-sPDUOutletControlMSPIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the MasterSwitch plus."
-   ::= { sPDUOutletControlMSPEntry 1 }
-
-sPDUOutletControlMSPName   OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the MasterSwitch plus. The maximum 
-       value is 23 characters. The name is set by
-       using the sPDUMasterConfigMSPName OID."
-   ::= { sPDUOutletControlMSPEntry 2 }
-
-sPDUOutletControlMSPOutletIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the outlet entry."
-   ::= { sPDUOutletControlMSPEntry 3 }
-   
-sPDUOutletControlMSPOutletName    OBJECT-TYPE
-   SYNTAX  DisplayString
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the outlet. The maximum size is 
-       23 characters. The name is set by using the 
-       sPDUOutletConfigMSPallOutletName OID.
-       This OID is provided for informational purposes only."       
-   ::= { sPDUOutletControlMSPEntry 4 }
-
-sPDUOutletControlMSPOutletCommand OBJECT-TYPE
-   SYNTAX INTEGER {
-      immediateOnMSP            (1),
-      delayedOnMSP              (2),
-      immediateOffMSP           (3),
-      gracefulRebootMSP         (4),
-      immediateRebootMSP        (5),
-      gracefulshutdownMSP       (6),
-      overrideBatCapThreshMSP   (7),
-      cancelPendingCommandMSP   (8)
-   }     
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-       "Getting this variable will return the outlet state. If 
-       the outlet is on, the immediateOnMSP (1) value will be returned.
-       If the outlet is off, the immediateOffMSP (3) value will be
-       returned.  
-       
-       Setting this variable to immediateOnMSP (1) will immediately turn the outlet on.
-       
-       Setting this variable to delayedOnMSP (2) will turn the outlet on
-       after the sPDUOutletConfigMSPPowerOnDelay OID time has elapsed. 
-
-       Setting this variable to immediateOffMSP (3) will immediately turn the outlet off. 
-
-       Setting this variable to gracefulRebootMSP (4) will cause the outlet to wait for
-       device confirmation (if applicable) and then turn the outlet off after the
-       sPDUOutletConfigMSPPowerOffDelay OID time has elapsed.  The outlet will then turn
-       on after the sPDUOutletConfigMSPRebootDuration OID time has elapsed. 
-
-       Setting this variable to immediateRebootMSP (5) will immediately reboot the outlet.
-
-       Setting this variable to gracefulshutdownMSP (6) will cause the outlet to wait for
-       device confirmation (if applicable) and then turn the outlet off after the
-       sPDUOutletConfigMSPPowerOffDelay OID time has elapsed.  The outlet will then turn
-       on after the sum of the sPDUOutletConfigMSPRestartTime OID time and the 
-       sPDUOutletConfigMSPPowerOnDelay OID time has elapsed. 
-      
-       Setting this variable to overrideBatCapThreshMSP (7) will cause the outlet to 
-       ignore the Battery Capacity Threshold and proceed waiting on the
-       sPDUOutletConfigMSPPowerOnDelay OID time before turning the outlet on.
-           
-       Setting this variable to cancelPendingCommandMSP (8) will cause any
-       pending command to this outlet to be canceled."
-   ::= { sPDUOutletControlMSPEntry 5 }
-
--- the sPDUOutletConfigMSPall group
-  
-sPDUOutletConfigMSPallTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF OutletConfigMSPallEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for configuration of individual outlets. The number of
-       entries is contained in the sPDUMasterStatusMSPOutletCount OID."
-   ::= { sPDUOutletConfigMSPall 1 }
-
-sPDUOutletConfigMSPallEntry OBJECT-TYPE
-   SYNTAX OutletConfigMSPallEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The outlets to configure."
-   INDEX  { sPDUOutletConfigMSPallIndex, sPDUOutletConfigMSPallOutletIndex }
-   ::= { sPDUOutletConfigMSPallTable 1 }
-
-OutletConfigMSPallEntry ::=
-   SEQUENCE {
-      sPDUOutletConfigMSPallIndex          INTEGER,
-      sPDUOutletConfigMSPallName           DisplayString,   
-      sPDUOutletConfigMSPallOutletIndex    INTEGER,
-      sPDUOutletConfigMSPallOutletName     DisplayString,
-      sPDUOutletConfigMSPallOutletCtrlMode INTEGER
-   }      
-
-sPDUOutletConfigMSPallIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the MasterSwitch plus."
-   ::= { sPDUOutletConfigMSPallEntry 1 }
-
-sPDUOutletConfigMSPallName   OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the MasterSwitch plus. The maximum 
-       value is 23 characters. The name is set by
-       using the sPDUMasterConfigMSPName OID."
-   ::= { sPDUOutletConfigMSPallEntry 2 }
-
-sPDUOutletConfigMSPallOutletIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the outlet entry."
-   ::= { sPDUOutletConfigMSPallEntry 3 }
-   
-sPDUOutletConfigMSPallOutletName   OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-write
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the outlet. Maximum size is 23 characters."
-   ::= { sPDUOutletConfigMSPallEntry 4 }
-
-sPDUOutletConfigMSPallOutletCtrlMode  OBJECT-TYPE
-   SYNTAX INTEGER       {
-      modeGracefulShutdown              (1),
-      modeAnnunciator                   (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this OID to modeGracefulShutdown (1) will put this
-       outlet into the Graceful Shutdown control mode.
-
-       Setting this OID to modeAnnunciator (2) will put this outlet
-       into the Annunciator control mode."
-   ::= { sPDUOutletConfigMSPallEntry 5 }
-
-
--- the sPDUOutConfigMSPgs group
-
-sPDUOutletConfigMSPgsTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF OutletConfigMSPgsEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for configuration of individual outlets. The number of
-       entries is contained in the sPDUMasterStatusMSPOutletCount OID."
-   ::= { sPDUOutletConfigMSPgs 1 }
-
-sPDUOutletConfigMSPgsEntry OBJECT-TYPE
-   SYNTAX OutletConfigMSPgsEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The outlets to configure."
-   INDEX  { sPDUOutletConfigMSPgsIndex, sPDUOutletConfigMSPgsOutletIndex }
-   ::= { sPDUOutletConfigMSPgsTable 1 }
-
-OutletConfigMSPgsEntry ::=
-   SEQUENCE {
-      sPDUOutletConfigMSPgsIndex          INTEGER,
-      sPDUOutletConfigMSPgsName           DisplayString,   
-      sPDUOutletConfigMSPgsOutletIndex    INTEGER,
-      sPDUOutletConfigMSPgsOutletName     DisplayString,
-      sPDUOutletConfigMSPgsOutletCtrlMode INTEGER,
-      sPDUOutletConfigMSPgsDeviceConfirm  INTEGER,
-      sPDUOutletConfigMSPgsLowBattWarning INTEGER,
-      sPDUOutletConfigMSPgsLowBattMult    INTEGER,
-      sPDUOutletConfigMSPgsRestartDelay   INTEGER,
-      sPDUOutletConfigMSPgsPowerOnDelay   INTEGER,
-      sPDUOutletConfigMSPgsPowerOffDelay  INTEGER,
-      sPDUOutletConfigMSPgsBattCapThresh  INTEGER,
-      sPDUOutletConfigMSPgsRebootDuration INTEGER
-   }      
-
-sPDUOutletConfigMSPgsIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the MasterSwitch plus."
-   ::= { sPDUOutletConfigMSPgsEntry 1 }
-
-sPDUOutletConfigMSPgsName   OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the MasterSwitch plus. The maximum 
-       value is 23 characters. The name is set by
-       using the sPDUMasterConfigMSPName OID."
-   ::= { sPDUOutletConfigMSPgsEntry 2 }
-
-sPDUOutletConfigMSPgsOutletIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the outlet entry."
-   ::= { sPDUOutletConfigMSPgsEntry 3 }
-
-sPDUOutletConfigMSPgsOutletName    OBJECT-TYPE
-   SYNTAX  DisplayString
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the outlet. The maximum size is 
-       23 characters. The name is set by using the 
-       sPDUOutletConfigMSPallOutletName OID.
-       This OID is provided for informational purposes only."       
-   ::= { sPDUOutletConfigMSPgsEntry 4 }
-
-sPDUOutletConfigMSPgsOutletCtrlMode  OBJECT-TYPE
-   SYNTAX INTEGER       {
-      modeGracefulShutdown              (1),
-      modeAnnunciator                   (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The Control Mode of the outlet.
-       This OID is provided for informational purposes only."
-   ::= { sPDUOutletConfigMSPgsEntry 5 }
-
-sPDUOutletConfigMSPgsDeviceConfirm  OBJECT-TYPE
-   SYNTAX INTEGER       {
-      deviceConfirmNo               (1),
-      deviceConfirmYes              (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this OID to deviceConfirmNo (1) cause the outlet to
-       NOT wait for device confirmation while performing graceful
-       operations.
-
-       Setting this OID to deviceConfirmYes (2) cause the outlet to
-       wait for device confirmation while performing graceful
-       operations."
-   ::= { sPDUOutletConfigMSPgsEntry 6 }
-
-sPDUOutletConfigMSPgsLowBattWarning  OBJECT-TYPE
-   SYNTAX INTEGER (-2..9999)                
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      " The amount of delay, in 6 second intervals, between 
-        when the UPS goes on battery and the power down sequence for
-        the outlet is initiated.     
-       
-       Allowed values are:
-
-       -2 - Never initiate the power down sequence on low battery warning.
-       -1 - Initiate power down sequence based on remaining runtime.
-       1 - 9999 six second intervals (6 secs - 16hrs, 39 mins, 54 secs).
-       0 indicates to immediately initiate power down sequence on low 
-         battery warning."
-   ::= { sPDUOutletConfigMSPgsEntry 7 }
-   
-sPDUOutletConfigMSPgsLowBattMult  OBJECT-TYPE
-   SYNTAX INTEGER     (1..7)
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-     " Only applicable if sPDUOutletConfigMSPgsLowBattWarning OID is 
-       set to -1 (On Runtime Remaining).
-        
-       Allows you to set the value to stagger the shutdown sequence of the outlets.
-       1 provides the longest delay (the outlet to shutoff first), and 7 would
-       provide the shortest delay (the outlet to shut off last).
-        
-       Allowed values are:
-       1 - 7."
-   ::= { sPDUOutletConfigMSPgsEntry 8 }
-
-sPDUOutletConfigMSPgsRestartDelay  OBJECT-TYPE
-   SYNTAX INTEGER (-1..9999)                
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      " The amount of delay, in 6 minute intervals, between 
-        when the outlet is turned off and the outlet is turned back on
-        when performing a Graceful Shutdown.    
-       
-       Allowed values are:
-
-       -1 - Never turn outlet back on after a Graceful shutdown.
-       0 - 9999 six minute intervals (0 - 999hrs, 54 mins)."
-   ::= { sPDUOutletConfigMSPgsEntry 9 }
-
-sPDUOutletConfigMSPgsPowerOnDelay  OBJECT-TYPE
-   SYNTAX INTEGER (-1..9999)                
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      " The amount of delay, in seconds, between the UPS entering
-        normal (on-line) state and the outlet being powered on.
-       
-       Allowed values are:
-
-       -1 - Remain Off when the UPS enters the on-line state.
-       0 - 9999 seconds (0 - 2 hrs, 46 mins, 39 secs)."
-   ::= { sPDUOutletConfigMSPgsEntry 10 }
-
-
-sPDUOutletConfigMSPgsPowerOffDelay  OBJECT-TYPE
-   SYNTAX INTEGER (0..9999)                
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      " The amount of delay, in seconds, between when the server
-        shuts down and the outlet is powered off.
-       
-       Allowed values are:
-
-       0 - 9999 seconds (0 - 2 hrs, 46 mins, 39 secs)."
-   ::= { sPDUOutletConfigMSPgsEntry 11 }
-   
-sPDUOutletConfigMSPgsBattCapThresh  OBJECT-TYPE
-   SYNTAX INTEGER (0..100)                
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      " The minimum battery capacity, as a percent (0-100%), required
-        of the UPS before an outlet will be allowed to power on.
-       
-       Allowed values are:
-
-       0 - 100 percent."
-   ::= { sPDUOutletConfigMSPgsEntry 12 }
-
-sPDUOutletConfigMSPgsRebootDuration  OBJECT-TYPE
-   SYNTAX INTEGER (0..9999)                
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      " The amount of delay, in seconds, from outlet off until
-        outlet on during a reboot.
-        
-       Allowed values are:
-
-       0 - 9999 seconds (0 - 2 hrs, 46 mins, 39 secs)."
-   ::= { sPDUOutletConfigMSPgsEntry 13 }
-
-
--- the sPDUOutConfigMSPannun group
-
-sPDUOutletConfigMSPannunTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF OutletConfigMSPannunEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for configuration of individual outlets. The number of
-       entries is contained in the sPDUMasterStatusMSPOutletCount OID."
-   ::= { sPDUOutletConfigMSPannun 1 }
-
-sPDUOutletConfigMSPannunEntry OBJECT-TYPE
-   SYNTAX OutletConfigMSPannunEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The outlets to configure."
-   INDEX  { sPDUOutletConfigMSPannunIndex, sPDUOutletConfigMSPannunOutletIndex }
-   ::= { sPDUOutletConfigMSPannunTable 1 }
-
-OutletConfigMSPannunEntry ::=
-   SEQUENCE {
-      sPDUOutletConfigMSPannunIndex          INTEGER,
-      sPDUOutletConfigMSPannunName           DisplayString,   
-      sPDUOutletConfigMSPannunOutletIndex    INTEGER,
-      sPDUOutletConfigMSPannunOutletName     DisplayString,
-      sPDUOutletConfigMSPannunOutletCtrlMode INTEGER,     
-      sPDUOutletConfigMSPannunInitialState   INTEGER,
-      sPDUOutletConfigMSPannunAlarmActionDly INTEGER
-   }      
-
-sPDUOutletConfigMSPannunIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the MasterSwitch plus."
-   ::= { sPDUOutletConfigMSPannunEntry 1 }
-
-sPDUOutletConfigMSPannunName   OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the MasterSwitch plus. The maximum 
-       value is 23 characters. The name is set by
-       using the sPDUMasterConfigMSPName OID."
-   ::= { sPDUOutletConfigMSPannunEntry 2 }
-
-sPDUOutletConfigMSPannunOutletIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the outlet entry."
-   ::= { sPDUOutletConfigMSPannunEntry 3 }
-
-sPDUOutletConfigMSPannunOutletName    OBJECT-TYPE
-   SYNTAX  DisplayString
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the outlet. The maximum size is 
-       23 characters. The name is set by using the 
-       sPDUOutletConfigMSPallOutletName OID.
-       This OID is provided for informational purposes only."       
-   ::= { sPDUOutletConfigMSPannunEntry 4 }
-
-sPDUOutletConfigMSPannunOutletCtrlMode  OBJECT-TYPE
-   SYNTAX INTEGER       {
-      modeGracefulShutdown              (1),
-      modeAnnunciator                   (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The Control Mode of the outlet.
-       This OID is provided for informational purposes only."
-   ::= { sPDUOutletConfigMSPannunEntry 5 }
-
-sPDUOutletConfigMSPannunInitialState  OBJECT-TYPE
-   SYNTAX INTEGER       {
-      initialStateOff              (1),
-      initialStateOn               (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this OID to initialStateOff (1) causes the outlet 
-       to default to off when in the non-alarmed condition.
-
-       Setting this OID to initialStateOn (2) causes the outlet 
-       to default to on when in the non-alarmed condition."
-   ::= { sPDUOutletConfigMSPannunEntry 6 }
-
-sPDUOutletConfigMSPannunAlarmActionDly  OBJECT-TYPE
-   SYNTAX INTEGER (0..9999)                
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      " The amount of time, in seconds, that an enabled Measure-UPS
-        alarm must be asserted before an alarm condition is recognized.
-       
-       Allowed values are:
-
-       0 - 9999 seconds (0 - 2 hrs, 46 mins, 39 secs)."
-   ::= { sPDUOutletConfigMSPannunEntry 7 }
-
-
--- the sPDUOutConfigMSPmups group
-
-sPDUOutletConfigMSPmupsTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF OutletConfigMSPmupsEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for configuration of individual outlets. The number of
-       entries is contained in the sPDUMasterStatusMSPOutletCount OID."
-   ::= { sPDUOutletConfigMSPmups 1 }
-
-sPDUOutletConfigMSPmupsEntry OBJECT-TYPE
-   SYNTAX OutletConfigMSPmupsEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The outlets to configure."
-   INDEX  { sPDUOutletConfigMSPmupsIndex, sPDUOutletConfigMSPmupsOutletIndex }
-   ::= { sPDUOutletConfigMSPmupsTable 1 }
-
-OutletConfigMSPmupsEntry ::=
-   SEQUENCE {
-      sPDUOutletConfigMSPmupsIndex          INTEGER,
-      sPDUOutletConfigMSPmupsName           DisplayString,   
-      sPDUOutletConfigMSPmupsOutletIndex    INTEGER,
-      sPDUOutletConfigMSPmupsOutletName     DisplayString,
-      sPDUOutletConfigMSPmupsZone1          INTEGER,
-      sPDUOutletConfigMSPmupsZone2          INTEGER,
-      sPDUOutletConfigMSPmupsZone3          INTEGER,
-      sPDUOutletConfigMSPmupsZone4          INTEGER,
-      sPDUOutletConfigMSPmupsP1LowHum       INTEGER,
-      sPDUOutletConfigMSPmupsP1HiHum        INTEGER,
-      sPDUOutletConfigMSPmupsP1LowTemp      INTEGER,
-      sPDUOutletConfigMSPmupsP1HiTemp       INTEGER,
-      sPDUOutletConfigMSPmupsP2LowHum       INTEGER,
-      sPDUOutletConfigMSPmupsP2HiHum        INTEGER,
-      sPDUOutletConfigMSPmupsP2LowTemp      INTEGER,
-      sPDUOutletConfigMSPmupsP2HiTemp       INTEGER
-   }      
-
-sPDUOutletConfigMSPmupsIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the MasterSwitch plus."
-   ::= { sPDUOutletConfigMSPmupsEntry 1 }
-
-sPDUOutletConfigMSPmupsName   OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the MasterSwitch plus. The maximum 
-       value is 23 characters. The name is set by
-       using the sPDUMasterConfigMSPName OID."
-   ::= { sPDUOutletConfigMSPmupsEntry 2 }
-
-sPDUOutletConfigMSPmupsOutletIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the outlet entry."
-   ::= { sPDUOutletConfigMSPmupsEntry 3 }
-
-sPDUOutletConfigMSPmupsOutletName    OBJECT-TYPE
-   SYNTAX  DisplayString
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the outlet. The maximum size is 
-       23 characters. The name is set by using the 
-       sPDUOutletConfigMSPallOutletName OID.
-       This OID is provided for informational purposes only."       
-   ::= { sPDUOutletConfigMSPmupsEntry 4 }
-
-sPDUOutletConfigMSPmupsZone1  OBJECT-TYPE
-   SYNTAX INTEGER       {
-      disableAlarm              (1),
-      enableAlarm               (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this OID to disableAlarm (1) disables the
-       Zone 1 alarm for this outlet.
-
-       Setting this OID to enableAlarm (2) enables the
-       Zone 1 alarm for this outlet."
-   ::= { sPDUOutletConfigMSPmupsEntry 5 }
-
-sPDUOutletConfigMSPmupsZone2  OBJECT-TYPE
-   SYNTAX INTEGER       {
-      disableAlarm              (1),
-      enableAlarm               (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this OID to disableAlarm (1) disables the
-       Zone 2 alarm for this outlet.
-
-       Setting this OID to enableAlarm (2) enables the
-       Zone 2 alarm for this outlet."
-   ::= { sPDUOutletConfigMSPmupsEntry 6 }
-
-sPDUOutletConfigMSPmupsZone3  OBJECT-TYPE
-   SYNTAX INTEGER       {
-      disableAlarm              (1),
-      enableAlarm               (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this OID to disableAlarm (1) disables the
-       Zone 3 alarm for this outlet.
-
-       Setting this OID to enableAlarm (2) enables the
-       Zone 3 alarm for this outlet."
-   ::= { sPDUOutletConfigMSPmupsEntry 7 }
-
-sPDUOutletConfigMSPmupsZone4  OBJECT-TYPE
-   SYNTAX INTEGER       {
-      disableAlarm              (1),
-      enableAlarm               (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this OID to disableAlarm (1) disables the
-       Zone 4 alarm for this outlet.
-
-       Setting this OID to enableAlarm (2) enables the
-       Zone 4 alarm for this outlet."
-   ::= { sPDUOutletConfigMSPmupsEntry 8 }
-
-sPDUOutletConfigMSPmupsP1LowHum  OBJECT-TYPE
-   SYNTAX INTEGER       {
-      disableAlarm              (1),
-      enableAlarm               (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this OID to disableAlarm (1) disables the
-       Probe 1 low humidity alarm for this outlet.
-
-       Setting this OID to enableAlarm (2) enables the
-       Probe 1 low humidity alarm for this outlet."
-   ::= { sPDUOutletConfigMSPmupsEntry 9 }
-
-sPDUOutletConfigMSPmupsP1HiHum  OBJECT-TYPE
-   SYNTAX INTEGER       {
-      disableAlarm              (1),
-      enableAlarm               (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this OID to disableAlarm (1) disables the
-       Probe 1 high humidity alarm for this outlet.
-
-       Setting this OID to enableAlarm (2) enables the
-       Probe 1 high humidity alarm for this outlet."
-   ::= { sPDUOutletConfigMSPmupsEntry 10 }
-
-sPDUOutletConfigMSPmupsP1LowTemp  OBJECT-TYPE
-   SYNTAX INTEGER       {
-      disableAlarm              (1),
-      enableAlarm               (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this OID to disableAlarm (1) disables the
-       Probe 1 low temperature alarm for this outlet.
-
-       Setting this OID to enableAlarm (2) enables the
-       Probe 1 low temperature alarm for this outlet."
-   ::= { sPDUOutletConfigMSPmupsEntry 11 }
-
-sPDUOutletConfigMSPmupsP1HiTemp  OBJECT-TYPE
-   SYNTAX INTEGER       {
-      disableAlarm              (1),
-      enableAlarm               (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this OID to disableAlarm (1) disables the
-       Probe 1 high temperature alarm for this outlet.
-
-       Setting this OID to enableAlarm (2) enables the
-       Probe 1 high temperature alarm for this outlet."
-   ::= { sPDUOutletConfigMSPmupsEntry 12 }
-
-sPDUOutletConfigMSPmupsP2LowHum  OBJECT-TYPE
-   SYNTAX INTEGER       {
-      disableAlarm              (1),
-      enableAlarm               (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this OID to disableAlarm (1) disables the
-       Probe 2 low humidity alarm for this outlet.
-
-       Setting this OID to enableAlarm (2) enables the
-       Probe 2 low humidity alarm for this outlet."
-   ::= { sPDUOutletConfigMSPmupsEntry 13 }
-
-sPDUOutletConfigMSPmupsP2HiHum  OBJECT-TYPE
-   SYNTAX INTEGER       {
-      disableAlarm              (1),
-      enableAlarm               (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this OID to disableAlarm (1) disables the
-       Probe 2 high humidity alarm for this outlet.
-
-       Setting this OID to enableAlarm (2) enables the
-       Probe 2 high humidity alarm for this outlet."
-   ::= { sPDUOutletConfigMSPmupsEntry 14 }
-
-sPDUOutletConfigMSPmupsP2LowTemp  OBJECT-TYPE
-   SYNTAX INTEGER       {
-      disableAlarm              (1),
-      enableAlarm               (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this OID to disableAlarm (1) disables the
-       Probe 2 low temperature alarm for this outlet.
-
-       Setting this OID to enableAlarm (2) enables the
-       Probe 2 low temperature alarm for this outlet."
-   ::= { sPDUOutletConfigMSPmupsEntry 15 }
-
-sPDUOutletConfigMSPmupsP2HiTemp  OBJECT-TYPE
-   SYNTAX INTEGER       {
-      disableAlarm              (1),
-      enableAlarm               (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this OID to disableAlarm (1) disables the
-       Probe 2 high temperature alarm for this outlet.
-
-       Setting this OID to enableAlarm (2) enables the
-       Probe 2 high temperature alarm for this outlet."
-   ::= { sPDUOutletConfigMSPmupsEntry 16 }
-
--- the sPDUOutletStatusMSP group
-  
-sPDUOutletStatusMSPTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF OutletStatusMSPEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for getting of status of individual outlets. The number of
-       entries is contained in the sPDUMasterStatusOutletCount OID."
-   ::= { sPDUOutletStatusMSP 1 }
-
-sPDUOutletStatusMSPEntry OBJECT-TYPE
-   SYNTAX OutletStatusMSPEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The outlets to gather status from."
-   INDEX  { sPDUOutletStatusMSPIndex, sPDUOutletStatusMSPOutletIndex }
-   ::= { sPDUOutletStatusMSPTable 1 }
-
-OutletStatusMSPEntry ::=
-   SEQUENCE {
-      sPDUOutletStatusMSPIndex          INTEGER,
-      sPDUOutletStatusMSPName           DisplayString,   
-      sPDUOutletStatusMSPOutletIndex    INTEGER,
-      sPDUOutletStatusMSPOutletName     DisplayString,
-      sPDUOutletStatusMSPOutletState    INTEGER,
-      sPDUOutletStatusMSPCommandPending INTEGER,
-      sPDUOutletStatusMSPOutletCtrlMode INTEGER
-   }      
-
-sPDUOutletStatusMSPIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the MasterSwitch MSP."
-   ::= { sPDUOutletStatusMSPEntry 1 }
-
-sPDUOutletStatusMSPName   OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the MasterSwitch plus. The maximum 
-       value is 23 characters. The name is set by
-       using the sPDUMasterConfigMSPName OID."
-   ::= { sPDUOutletStatusMSPEntry 2 }
-
-sPDUOutletStatusMSPOutletIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the outlet entry."
-   ::= { sPDUOutletStatusMSPEntry 3 }
-   
-sPDUOutletStatusMSPOutletName    OBJECT-TYPE
-   SYNTAX  DisplayString
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the outlet. The maximum size is 
-       23 characters. The name is set by using the 
-       sPDUOutletConfigMSPallOutletName OID.
-       This OID is provided for informational purposes only."       
-   ::= { sPDUOutletStatusMSPEntry 4 }
-
-sPDUOutletStatusMSPOutletState OBJECT-TYPE
-   SYNTAX INTEGER {
-        outletStatusMSPOn              (1),
-        outletStatusMSPOff             (2)
-   }     
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "Getting this variable will return the outlet state. If 
-       the outlet is on, the outletStatusMSPOn (1) value will be returned.
-       If the outlet is off, the outletStatusMSPOff (2) value will be
-       returned. "
-   ::= { sPDUOutletStatusMSPEntry 5 }
-
-sPDUOutletStatusMSPCommandPending    OBJECT-TYPE
-   SYNTAX INTEGER {
-        outletStatusMSPCommandPending    (1),
-        outletStatusMSPNoCommandPending  (2)
-   }     
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "Getting this variable will return the command pending
-        state of the outlet. If a command is pending on the 
-        outlet, the outletStatusMSPCommandPending (1) value
-        will be returned. If there is not a command pending
-        on the outlet, the outletStatusMSPNoCommandPending (2)
-        will be returned."
-   ::= { sPDUOutletStatusMSPEntry 6 }
-
-sPDUOutletStatusMSPOutletCtrlMode  OBJECT-TYPE
-   SYNTAX INTEGER       {
-      modeGracefulShutdown              (1),
-      modeAnnunciator                   (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The Control Mode of the outlet.
-       This OID is provided for informational purposes only."
-   ::= { sPDUOutletStatusMSPEntry 7 }
-
-
--- the rPDUIdent group
-
-rPDUIdentName OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-write
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the Rack PDU. 
-       The maximum string size is device dependent."
-   ::= { rPDUIdent 1 }
-
-rPDUIdentHardwareRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The hardware revision of the Rack PDU. 
-       This value is set at the factory."
-   ::= { rPDUIdent 2 }
-
-rPDUIdentFirmwareRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "An 8-byte ID string identifying the Rack PDU firmware revision. 
-       This value is set at the factory." 
-   ::= {  rPDUIdent 3 }
-
-
-rPDUIdentDateOfManufacture OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The date when the Rack PDU was manufactured in mm/dd/yy format.
-       This value is set at the factory. The year 2000 will be 
-       represented by 00." 
-   ::= { rPDUIdent 4 }
-   
-rPDUIdentModelNumber OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A 10-character string identifying the model number of 
-       the Rack PDU. This value is set at the factory."
-   ::= { rPDUIdent 5 }
-
-rPDUIdentSerialNumber OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A 12-character string identifying the serial number of 
-       the Rack PDU. This value is set at the factory."
-   ::= { rPDUIdent 6 }
-
-rPDUIdentDeviceRating OBJECT-TYPE
-   SYNTAX INTEGER      
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return the electrical rating of the device."
-
-   ::= { rPDUIdent 7 } 
-
-rPDUIdentDeviceNumOutlets OBJECT-TYPE
-   SYNTAX INTEGER      
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return the number of outlets contained in the device."
-
-   ::= { rPDUIdent 8 } 
-
-rPDUIdentDeviceNumPhases OBJECT-TYPE
-   SYNTAX INTEGER      
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return the number of phases supported by the device."
-
-   ::= { rPDUIdent 9 } 
-
-rPDUIdentDeviceNumBreakers OBJECT-TYPE
-   SYNTAX INTEGER      
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return the number of circuit breakers supported by the device.
-       This is the same as the number of banks of outlets."
-
-   ::= { rPDUIdent 10 } 
-
-rPDUIdentDeviceBreakerRating OBJECT-TYPE
-   SYNTAX INTEGER      
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return rating of the circuit breakers on the device if it has any."
-
-   ::= { rPDUIdent 11 } 
-
-rPDUIdentDeviceOrientation OBJECT-TYPE
-   SYNTAX INTEGER       {
-      orientHorizontal            (1),
-      orientVertical              (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return the intended physical orientation of the device.
-       
-       OrientHorizonatal(1) indicates Horizontal.
-       OrientVertical(2) indicates Vertical."
-
-   ::= { rPDUIdent 12 } 
-   
-rPDUIdentDeviceOutletLayout OBJECT-TYPE
-   SYNTAX INTEGER       {
-      seqPhaseToNeutral            (1),
-      seqPhaseToPhase              (2),
-      seqPhToNeu21PhToPh           (3),
-      seqPhToPhGrouped             (4)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return outlet layout for the device.
-       
-       SeqPhaseToNeutral(1) indicates outlet layout as follows:
-       1:1-N,2:2-N,3:3-N,4:1-N,5:2-N,...
-
-       SeqPhaseToPhase(2) indicates outlet layout as follows:
-       1:1-2,2:2-3,3:3-1,4:1-2,5:2-3,...
-
-       SeqPhToNeu21PhToPh(3) indicates outlet layout as follows:
-       1:1-N,2:2-N...21:3-N,22:1-2,23:2-3,24:3-1,...
-
-       SeqPhToPhGrouped(4) indicates outlet layout as follows:
-       Otlts1-8::(3-1),Otlts9-16::(2-3),Otlts17-24::(1-2)."
-   ::= { rPDUIdent 13 } 
-
-
-
--- the rPDULoadDevice group
-
-rPDULoadDevMaxPhaseLoad   OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return the maximum rated power
-       that each phase of the Rack PDU can provide. It is 
-       represented in Amps."  
-   ::= { rPDULoadDevice 1 }
-
-rPDULoadDevNumPhases OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of phases available with this Rack PDU."
-   ::= { rPDULoadDevice 2 }
-
-rPDULoadDevMaxBankLoad   OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return the maximum rated power
-       that each bank of the Rack PDU can provide. It is 
-       represented in Amps.
-       
-       0 will be returned if the device does not have any banks."
-       
-   ::= { rPDULoadDevice 3 }
-
-rPDULoadDevNumBanks OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of banks of outlets available with this Rack PDU.
-       A bank of outlets has a unique circuit breaker for a subset 
-       of the total number of outlets on the rPDU."
-   ::= { rPDULoadDevice 4 }
-
--- the rPDULoadPhaseConfig group
-
-rPDULoadPhaseConfigTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF LoadPhaseConfigEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for configuration of each Rack PDU phase.
-       The number of entries is contained in the 
-       rPDULoadDevNumPhases OID."
-   ::= { rPDULoadPhaseConfig 1 }
-
-rPDULoadPhaseConfigEntry OBJECT-TYPE
-   SYNTAX LoadPhaseConfigEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The Rack PDU phase to configure."
-   INDEX  { rPDULoadPhaseConfigIndex}
-   ::= { rPDULoadPhaseConfigTable 1 }
-
-LoadPhaseConfigEntry ::=
-   SEQUENCE {
-      rPDULoadPhaseConfigIndex                    INTEGER,
-      rPDULoadPhaseConfigLowLoadThreshold         INTEGER,
-      rPDULoadPhaseConfigNearOverloadThreshold    INTEGER,
-      rPDULoadPhaseConfigOverloadThreshold        INTEGER
-   }      
-
-rPDULoadPhaseConfigIndex OBJECT-TYPE
-   SYNTAX INTEGER {
-      phase1                     (1),
-      phase2                     (2),
-      phase3                     (3)
-   }        
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the Rack PDU phase entry."
-   ::= { rPDULoadPhaseConfigEntry 1 }
-
-rPDULoadPhaseConfigLowLoadThreshold OBJECT-TYPE
-   SYNTAX INTEGER                
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "A threshold that indicates the power consumption of
-       the load is nearing a low consumption condition. It is 
-       represented in amps.  A warning will be issued when the
-       load is less than the threshold value.  
-       
-       A threshold value of 0 amps effectively disables this 
-       warning.  
-       
-       Maximum value must be less than the value returned 
-       by the rPDULoadPhaseConfigNearOverloadThreshold OID."  
-   ::= { rPDULoadPhaseConfigEntry 2 }
-
-rPDULoadPhaseConfigNearOverloadThreshold OBJECT-TYPE
-   SYNTAX INTEGER                
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "A threshold that indicates the power consumption of
-       the load is nearing an overload condition. It is 
-       represented in amps.  A warning will be issued when the 
-       load is greater than or equal to the threshold value.
-       
-       Minimum value must be greater than the value returned by
-       the rPDULoadPhaseConfigLowLoadThreshold OID.
-       
-       Maximum value must be less than or equal to the value 
-       returned by the rPDULoadPhaseConfigOverloadThreshold OID."
-   ::= { rPDULoadPhaseConfigEntry 3 }
-
-rPDULoadPhaseConfigOverloadThreshold OBJECT-TYPE
-   SYNTAX INTEGER                
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "A threshold that indicates the power consumption of
-       the load has entered an overload condition. It is 
-       represented in amps.  A warning will be issued when the 
-       load is greater than or equal to the threshold value.
-       
-       Minimum value must be greater than or equal to the value 
-       returned by the rPDULoadPhaseConfigNearOverloadThreshold OID.
-       
-       Maximum value must be less than or equal to the value 
-       returned by the rPDULoadDevMaxPhaseLoad OID."
-   ::= { rPDULoadPhaseConfigEntry 4 }
-
-
--- the rPDULoadStatus group
-
-rPDULoadStatusTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF LoadStatusEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for getting of status of each Rack PDU phase/bank.
-       The number of entries is calculated by adding
-       the number of phases (rPDULoadDevNumPhases OID) and
-       the number of banks of outlets (rPDULoadDevNumBanks)
-       Number of entries = #phases + #banks.
-       NOTE: If a device has phase and bank information, all phase information
-       shall preceed the bank information."
-   ::= { rPDULoadStatus 1 }
-
-rPDULoadStatusEntry OBJECT-TYPE
-   SYNTAX LoadStatusEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The Rack PDU phase/bank to gather status from."
-   INDEX  { rPDULoadStatusIndex}
-   ::= { rPDULoadStatusTable 1 }
-
-LoadStatusEntry ::=
-   SEQUENCE {
-      rPDULoadStatusIndex                 INTEGER,
-      rPDULoadStatusLoad                  Gauge,
-      rPDULoadStatusLoadState             INTEGER,
-      rPDULoadStatusPhaseNumber           INTEGER,
-      rPDULoadStatusBankNumber            INTEGER
-   }      
-
-rPDULoadStatusIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the Rack PDU phase/bank entry. All phase information will preceed
-       any bank information"
-   ::= { rPDULoadStatusEntry 1 }
-
-rPDULoadStatusLoad OBJECT-TYPE
-   SYNTAX Gauge       
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return the phase/bank load measured
-       in tenths of amps."
-   ::= { rPDULoadStatusEntry 2 }
-
-rPDULoadStatusLoadState OBJECT-TYPE
-   SYNTAX INTEGER       {
-      phaseLoadNormal                 (1),
-      phaseLoadLow                    (2),
-      phaseLoadNearOverload           (3),
-      phaseLoadOverload               (4)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return the phase/bank load state.
-       
-       phaseLoadNormal(1) indicates that the phase/bank is 
-       operating properly within the rPDULoadConfigLowLoadThreshold 
-       and rPDULoadConfigNearOverloadThreshold OID values.
-       
-       phaseLoadLow(2) indicates that the phase/bank load has
-       dropped below the rPDULoadConfigLowLoadThreshold OID value.
-       An SNMP trap will occur when this state is entered or cleared.
-       
-       phaseLoadNearOverload(3) indicates that the phase/bank load
-       is greater than or equal to the 
-       rPDULoadConfigNearOverloadThreshold OID value.
-       An SNMP trap will occur when this state is entered or cleared.
-       
-       phaseLoadOverload(4) indicates that the phase/bank load is
-       greater than or equal to the rPDULoadConfigOverloadThreshold 
-       OID value.
-       An SNMP trap will occur when this state is entered or cleared."
-   ::= { rPDULoadStatusEntry 3 } 
-
-rPDULoadStatusPhaseNumber OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The phase number to which this record refers.  A value of 0 will be returned if
-       this is bank related information."
-   ::= { rPDULoadStatusEntry 4 }
-
-rPDULoadStatusBankNumber OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The bank number to which this record refers.  A value of 0 will be returned if
-       this is phase related information."
-   ::= { rPDULoadStatusEntry 5 }
-        
--- the rPDULoadBankConfig group
-
-rPDULoadBankConfigTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF LoadBankConfigEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for configuration of each Rack PDU bank.
-       The number of entries is contained in the 
-       rPDULoadDevNumBanks OID."
-   ::= { rPDULoadBankConfig 1 }
-
-rPDULoadBankConfigEntry OBJECT-TYPE
-   SYNTAX LoadBankConfigEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The Rack PDU bank to configure."
-   INDEX  { rPDULoadBankConfigIndex}
-   ::= { rPDULoadBankConfigTable 1 }
-
-LoadBankConfigEntry ::=
-   SEQUENCE {
-      rPDULoadBankConfigIndex                    INTEGER,
-      rPDULoadBankConfigLowLoadThreshold         INTEGER,
-      rPDULoadBankConfigNearOverloadThreshold    INTEGER,
-      rPDULoadBankConfigOverloadThreshold        INTEGER
-   }      
-
-rPDULoadBankConfigIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the Rack PDU bank entry."
-   ::= { rPDULoadBankConfigEntry 1 }
-
-rPDULoadBankConfigLowLoadThreshold OBJECT-TYPE
-   SYNTAX INTEGER                
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "A threshold that indicates the power consumption of
-       the load is nearing a low consumption condition. It is 
-       represented in amps.  A warning will be issued when the
-       load is less than the threshold value.  
-       
-       A threshold value of 0 amps effectively disables this 
-       warning.  
-       
-       Maximum value must be less than the value returned 
-       by the rPDULoadBankConfigNearOverloadThreshold OID.
-   
-       -1 will be returned if the device has no banks."
-
-   ::= { rPDULoadBankConfigEntry 2 }
-
-rPDULoadBankConfigNearOverloadThreshold OBJECT-TYPE
-   SYNTAX INTEGER                
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "A threshold that indicates the power consumption of
-       the load is nearing an overload condition. It is 
-       represented in amps.  A warning will be issued when the 
-       load is greater than or equal to the threshold value.
-       
-       Minimum value must be greater than the value returned by
-       the rPDULoadBankConfigLowLoadThreshold OID.
-       
-       Maximum value must be less than or equal to the value 
-       returned by the rPDULoadBankConfigOverloadThreshold OID.
-
-       -1 will be returned if the device has no banks."
-
-   ::= { rPDULoadBankConfigEntry 3 }
-
-rPDULoadBankConfigOverloadThreshold OBJECT-TYPE
-   SYNTAX INTEGER                
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "A threshold that indicates the power consumption of
-       the load has entered an overload condition. It is 
-       represented in amps.  A warning will be issued when the 
-       load is greater than or equal to the threshold value.
-       
-       Minimum value must be greater than or equal to the value 
-       returned by the rPDULoadBankConfigNearOverloadThreshold OID.
-       
-       Maximum value must be less than or equal to the value 
-       returned by the rPDULoadDevMaxBankLoad OID.
-
-       -1 will be returned if the device has no banks."
-
-   ::= { rPDULoadBankConfigEntry 4 }
-
-
--- the rPDUOutletDevice group
-
-rPDUOutletDevCommand  OBJECT-TYPE
-  SYNTAX INTEGER       {
-      noCommandAll               (1),
-      immediateAllOn             (2),
-      immediateAllOff            (3),
-      immediateAllReboot         (4),
-      delayedAllOn               (5),
-      delayedAllOff              (6),
-      delayedAllReboot           (7),
-      cancelAllPendingCommands   (8),
-      gracefulAllOff             (9),
-      gracefulAllReboot          (10)
-   }
-   
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this OID to immediateAllOn (2) will turn all outlets
-       on immediately.
-       
-       Setting this OID to immediateAllOff (3) will turn all outlets
-       off immediately.
-       
-       Setting this OID to immediateAllReboot (4) will reboot all outlets
-       immediately.
-
-       Setting this OID to delayedAllOn (5) will turn all outlets on as 
-       defined by each outlet's rPDUOutletConfigPowerOnTime OID value. 
-             
-       Setting this OID to delayedAllOff (6) will turn all outlets 
-       off as defined by each outlet's rPDUOutletConfigPowerOffTime OID value.
-      
-       Setting this OID to delayedAllReboot (7) will cause a 
-       delayedAllOff command to be performed. Once all outlets are off, 
-       the Switched Rack PDU will then delay the largest 
-       rPDUOutletConfigRebootDuration OID time, and then perform a 
-       delayedAllOn command.    
-       
-       Setting this OID to cancelAllPendingCommands (8) will cause all pending
-       commands on the Switched Rack PDU to be canceled.
-
-       Setting this variable to gracefulAllOff (9) will cause the
-       Switched Rack PDU to shut all outlets off after it waits the 
-       servers graceful shutdown time and each outlet's shutdown delay.
-
-       Setting this variable to gracefulAllReboot (10) will cause the
-       Switched Rack PDU to shut all outlets off after it waits the 
-       servers graceful shutdown time and each outlet's shutdown delay.
-       Once all outlet are off, it will wait until the UPS reaches the
-       configured minimum return battery capacity, then each outlet's 
-       return delay before it turns the outlet back on.
-
-       Getting this OID will return the noCommandAll (1) value."
-   ::= { rPDUOutletDevice 1 }
-
-rPDUOutletDevColdstartDelay  OBJECT-TYPE
-   SYNTAX INTEGER                
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The amount of delay, in seconds, between when
-       power is provided to the Switched Rack PDU and 
-       when the Switched Rack PDU provides basic master 
-       power to the outlets.       
-       
-       Allowed values are:
-
-       -1       - never apply power automatically.
-       0        - apply power immediately.
-       1 to 300 - delay up to 300 seconds (5 minutes)."
-   ::= { rPDUOutletDevice 2 }
-
-rPDUOutletDevNumCntrlOutlets OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of controlled outlets on this Switched Rack PDU."
-   ::= { rPDUOutletDevice 3 }
-
-rPDUOutletDevNumTotalOutlets OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The total number of outlets on this Rack PDU."
-   ::= { rPDUOutletDevice 4 }
-        
-
--- the rPDUOutletPhase group
-
-rPDUOutletPhaseTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF OutletPhaseEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for management of outlets on a per phase basis."
-   ::= { rPDUOutletPhase 1 }
-
-rPDUOutletPhaseEntry OBJECT-TYPE
-   SYNTAX OutletPhaseEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The phase to manage."
-   INDEX  { rPDUOutletPhaseIndex}
-   ::= { rPDUOutletPhaseTable 1 }
-
-OutletPhaseEntry ::=
-   SEQUENCE {
-      rPDUOutletPhaseIndex                INTEGER,
-      rPDUOutletPhaseOverloadRestriction  INTEGER
-   }      
-
-rPDUOutletPhaseIndex OBJECT-TYPE
-   SYNTAX INTEGER {
-      phase1                     (1),
-      phase2                     (2),
-      phase3                     (3)
-   }        
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the Switched Rack PDU phase entry."
-   ::= { rPDUOutletPhaseEntry 1 }
-
-rPDUOutletPhaseOverloadRestriction OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alwaysAllowTurnON         (1),
-      restrictOnNearOverload    (2),
-      restrictOnOverload        (3)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "This OID controls the behavior of a Switched Rack PDU 
-       phase when an overload condition is possible and 
-       additional outlets are requested to be turned on. 
-
-       Setting this OID to alwaysAllowTurnON (1) will always allow 
-       the outlets on the corresponding phase to turn on.
-       
-       Setting this OID to restrictOnNearOverload (2) will not allow 
-       outlets on the corresponding phase to turn on if the 
-       rPDULoadConfigNearOverloadThreshold OID is exceeded.
-              
-       Setting this OID to restrictOnOverload (3) will not allow
-       outlets on the corresponding phase to turn on if the 
-       rPDULoadConfigOverloadThreshold OID is exceeded."
-   ::= { rPDUOutletPhaseEntry 2 }
-
-
--- the rPDUOutletControl group
-
-rPDUOutletControlTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF RPDUOutletControlEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for control of the individual outlets.
-       The number of entries is contained in the 
-       rPDUOutletDevNumCntrlOutlets OID."
-   ::= { rPDUOutletControl 1 }
-
-rPDUOutletControlEntry OBJECT-TYPE
-   SYNTAX RPDUOutletControlEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The outlet to control."
-   INDEX  { rPDUOutletControlIndex}
-   ::= { rPDUOutletControlTable 1 }
-
-RPDUOutletControlEntry ::=
-   SEQUENCE {
-      rPDUOutletControlIndex         INTEGER,
-      rPDUOutletControlOutletName    DisplayString,
-      rPDUOutletControlOutletPhase   INTEGER,
-      rPDUOutletControlOutletCommand INTEGER,
-      rPDUOutletControlOutletBank    INTEGER
-   }      
-
-rPDUOutletControlIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the outlet entry."
-   ::= { rPDUOutletControlEntry 1 }
-   
-rPDUOutletControlOutletName    OBJECT-TYPE
-   SYNTAX  DisplayString
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the outlet. Maximum size is dependent on device.
-       An error will be returned if the set request exceeds the max size.
-       This OID is provided for informational purposes only."
-   ::= { rPDUOutletControlEntry 2 }
-
-rPDUOutletControlOutletPhase    OBJECT-TYPE
-   SYNTAX INTEGER {
-      phase1                     (1),
-      phase2                     (2),
-      phase3                     (3),
-      phase1-2                   (4),
-      phase2-3                   (5),
-      phase3-1                   (6)
-   }        
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The phase/s associated with this outlet.
-      
-       For single phase devices, this object will always 
-       return phase1(1).
-       
-       For 3-phase devices, this object will return phase1 (1), 
-       phase2 (2), or phase3 (3) for outlets tied to a single 
-       phase.  For outlets tied to two phases, this object will
-       return phase1-2 (4) for phases 1 and 2, phase2-3 (5) for 
-       phases 2 and 3, and phase3-1 (6) for phases 3 and 1."
-   ::= { rPDUOutletControlEntry 3 }
-
-rPDUOutletControlOutletCommand OBJECT-TYPE
-   SYNTAX INTEGER {
-      immediateOn             (1),
-      immediateOff            (2),
-      immediateReboot         (3),
-      delayedOn               (4),
-      delayedOff              (5),
-      delayedReboot           (6),
-      cancelPendingCommand    (7),
-      gracefulOff             (8),
-      gracefulReboot          (9)
-
-   }     
-
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-       "Getting this variable will return the outlet state. If 
-        the outlet is on, the immediateOn (1) value will be returned.
-        If the outlet is off, the immediateOff (2) value will be
-        returned. 
-       
-       
-        Setting this variable to immediateOn (1) will immediately turn 
-        the outlet on.
-       
-        Setting this variable to immediateOff (2) will immediately turn 
-        the outlet off. 
-
-        Setting this variable to immediateReboot (3) will immediately 
-        reboot the outlet.
-      
-        Setting this variable to delayedOn (4) will turn the outlet on
-        after the rPDUOutletConfigPowerOnTime OID time has elapsed.   
-
-        Setting this variable to delayedOff (5) will turn the outlet off
-        after the rPDUOutletConfigPowerOffTime OID time has elapsed.
-
-        Setting this variable to delayedReboot  (6) will cause the 
-        Switched Rack PDU to perform a delayedOff command, wait the 
-        rPDUOutletConfigRebootDuration OID time, and then perform a 
-        delayedOn command. 
-       
-        Setting this variable to cancelPendingCommand (7) will cause any
-        pending command to this outlet to be canceled.
-
-        Setting this variable to gracefulOff (8) will cause the
-        Switched Rack PDU to shut the outlet off after it waits the 
-        servers graceful shutdown time and the outlets shutdown delay.
-
-        Setting this variable to gracefulReboot (9) will cause the
-        Switched Rack PDU to shut the outlet off after it waits the 
-        servers graceful shutdown time and the outlets shutdown delay.
-        Once the outlet is off, it will wait until the UPS reaches the
-        configured minimum return battery capacity, then the outlets 
-        return delay before it turns the outlet back on."
-
-    ::= { rPDUOutletControlEntry 4 }
-
-rPDUOutletControlOutletBank    OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The bank associated with this outlet."
-   ::= { rPDUOutletControlEntry 5 }
-
-
--- the rPDUOutletConfig group
-
-rPDUOutletConfigTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF RPDUOutletConfigEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for configuration of individual outlets. The number of
-       entries is contained in the rPDUOutletDevNumCntrlOutlets OID."
-   ::= { rPDUOutletConfig 1 }
-
-rPDUOutletConfigEntry OBJECT-TYPE
-   SYNTAX RPDUOutletConfigEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The outlet to configure."
-   INDEX  { rPDUOutletConfigIndex}
-   ::= { rPDUOutletConfigTable 1 }
-
-RPDUOutletConfigEntry ::=
-   SEQUENCE {
-      rPDUOutletConfigIndex          INTEGER,
-      rPDUOutletConfigOutletName     DisplayString,
-      rPDUOutletConfigOutletPhase    INTEGER,
-      rPDUOutletConfigPowerOnTime    INTEGER,
-      rPDUOutletConfigPowerOffTime   INTEGER,
-      rPDUOutletConfigRebootDuration INTEGER,
-      rPDUOutletConfigOutletBank     INTEGER
-   }      
-
-rPDUOutletConfigIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the outlet entry."
-   ::= { rPDUOutletConfigEntry 1 }
-   
-rPDUOutletConfigOutletName    OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-write
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the outlet. Maximum size is dependent on device.
-       An error will be returned if the set request exceeds the max size."
-   ::= { rPDUOutletConfigEntry 2 }
-
-rPDUOutletConfigOutletPhase    OBJECT-TYPE
-   SYNTAX INTEGER {
-      phase1                     (1),
-      phase2                     (2),
-      phase3                     (3),
-      phase1-2                   (4),
-      phase2-3                   (5),
-      phase3-1                   (6)
-   }        
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The phase/s associated with this outlet.
-      
-       For single phase devices, this object will always 
-       return phase1(1).
-       
-       For 3-phase devices, this object will return phase1 (1), 
-       phase2 (2), or phase3 (3) for outlets tied to a single 
-       phase.  For outlets tied to two phases, this object will
-       return phase1-2 (4) for phases 1 and 2, phase2-3 (5) for 
-       phases 2 and 3, and phase3-1 (6) for phases 3 and 1."
-   ::= { rPDUOutletConfigEntry 3 }
-
-rPDUOutletConfigPowerOnTime OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The amount of time (in seconds) the outlet will delay 
-       powering on at coldstart or when a command that requires 
-       a turn-on delay is issued.
-              
-       Allowed values are:
-
-       -1       - never power on.
-       0        - power on immediately.
-       1 to 300 - power on up to 300 seconds (5 minutes) after being
-                  commanded."
-   ::= { rPDUOutletConfigEntry 4 }
-
-rPDUOutletConfigPowerOffTime OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The amount of time (in seconds) the outlet will delay 
-       powering off when a command that requires 
-       a turn-off delay is issued.
-
-       Allowed values are:
-
-       -1       - never power off.
-       0        - power off immediately.
-       1 to 300 - power off up to 300 seconds (5 minutes) after being
-                  commanded."
-   ::= { rPDUOutletConfigEntry 5 }
-
-rPDUOutletConfigRebootDuration OBJECT-TYPE
-   SYNTAX INTEGER                
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "During a reboot sequence, power is turned off and then 
-       back on. This OID defines the amount of time to wait, 
-       in seconds, after turning the power off, at the start
-       of the sequence, before turning power back on, at the
-       end of the reboot sequence.       
-       
-       Allowed range is any value between 5 and 60 seconds (1 minute)."
-   ::= { rPDUOutletConfigEntry 6 }
-
-rPDUOutletConfigOutletBank    OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The bank associated with this outlet."
-   ::= { rPDUOutletConfigEntry 7 }
-
-
--- the rPDUOutletStatus group
-
-rPDUOutletStatusTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF RPDUOutletStatusEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for getting of status of individual outlets. The number of
-       entries is contained in the rPDUOutletDevNumCntrlOutlets OID."
-   ::= { rPDUOutletStatus 1 }
-
-rPDUOutletStatusEntry OBJECT-TYPE
-   SYNTAX RPDUOutletStatusEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The outlet to gather status from."
-   INDEX  { rPDUOutletStatusIndex}
-   ::= { rPDUOutletStatusTable 1 }
-
-RPDUOutletStatusEntry ::=
-   SEQUENCE {
-      rPDUOutletStatusIndex          INTEGER,
-      rPDUOutletStatusOutletName     DisplayString,
-      rPDUOutletStatusOutletPhase    INTEGER,
-      rPDUOutletStatusOutletState    INTEGER,
-      rPDUOutletStatusCommandPending INTEGER,
-      rPDUOutletStatusOutletBank     INTEGER
-   }      
-
-rPDUOutletStatusIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the outlet entry."
-   ::= { rPDUOutletStatusEntry 1 }
-   
-rPDUOutletStatusOutletName    OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the outlet. Maximum size is dependent on device.
-       An error will be returned if the set request exceeds the max size.
-       This OID is provided for informational purposes only."
-   ::= { rPDUOutletStatusEntry 2 }
-
-rPDUOutletStatusOutletPhase    OBJECT-TYPE
-   SYNTAX INTEGER {
-      phase1                     (1),
-      phase2                     (2),
-      phase3                     (3),
-      phase1-2                   (4),
-      phase2-3                   (5),
-      phase3-1                   (6)
-   }        
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The phase/s associated with this outlet.
-      
-       For single phase devices, this object will always 
-       return phase1(1).
-       
-       For 3-phase devices, this object will return phase1 (1), 
-       phase2 (2), or phase3 (3) for outlets tied to a single 
-       phase.  For outlets tied to two phases, this object will
-       return phase1-2 (4) for phases 1 and 2, phase2-3 (5) for 
-       phases 2 and 3, and phase3-1 (6) for phases 3 and 1."
-   ::= { rPDUOutletStatusEntry 3 }
-
-rPDUOutletStatusOutletState OBJECT-TYPE
-   SYNTAX INTEGER {
-        outletStatusOn              (1),
-        outletStatusOff             (2)
-   }     
-
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "Getting this variable will return the outlet state. If 
-       the outlet is on, the outletStatusOn (1) value will be returned.
-       If the outlet is off, the outletStatusOff (2) value will be
-       returned. "
-   ::= { rPDUOutletStatusEntry 4 }
-
-rPDUOutletStatusCommandPending    OBJECT-TYPE
-   SYNTAX INTEGER {
-        outletStatusCommandPending    (1),
-        outletStatusNoCommandPending  (2)
-   }     
-
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "Getting this variable will return the command pending
-        state of the outlet. If a command is pending on the 
-        outlet, the outletStatusCommandPending (1) value
-        will be returned. If there is not a command pending
-        on the outlet, the outletStatusNoCommandPending (2)
-        will be returned."
-   ::= { rPDUOutletStatusEntry 5 }
-
-rPDUOutletStatusOutletBank    OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The bank associated with this outlet."
-   ::= { rPDUOutletStatusEntry 6 }
-
-
--- the rPDUOutletBank group
-
-rPDUOutletBankTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF OutletBankEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for management of outlets on a per bank basis."
-   ::= { rPDUOutletBank 1 }
-
-rPDUOutletBankEntry OBJECT-TYPE
-   SYNTAX OutletBankEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The bank to manage."
-   INDEX  { rPDUOutletBankIndex}
-   ::= { rPDUOutletBankTable 1 }
-
-OutletBankEntry ::=
-   SEQUENCE {
-      rPDUOutletBankIndex                INTEGER,
-      rPDUOutletBankOverloadRestriction  INTEGER
-   }      
-
-rPDUOutletBankIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the Switched Rack PDU bank entry."
-   ::= { rPDUOutletBankEntry 1 }
-
-rPDUOutletBankOverloadRestriction OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alwaysAllowTurnON         (1),
-      restrictOnNearOverload    (2),
-      restrictOnOverload        (3)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "This OID controls the behavior of a Switched Rack PDU 
-       bank when an overload condition is possible and 
-       additional outlets are requested to be turned on. 
-
-       Setting this OID to alwaysAllowTurnON (1) will always allow 
-       the outlets on the corresponding bank to turn on.
-       
-       Setting this OID to restrictOnNearOverload (2) will not allow 
-       outlets on the corresponding bank to turn on if the 
-       rPDULoadConfigNearOverloadThreshold OID is exceeded.
-              
-       Setting this OID to restrictOnOverload (3) will not allow
-       outlets on the corresponding bank to turn on if the 
-       rPDULoadConfigOverloadThreshold OID is exceeded."
-   ::= { rPDUOutletBankEntry 2 }
-
--- the rPDUPowerSupplyDevice group
-
-rPDUPowerSupply1Status   OBJECT-TYPE
-   SYNTAX INTEGER       {
-      powerSupply1Ok             (1),
-      powerSupply1Failed         (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return powerSupply1Ok(1) if power
-       supply 1 is functioning normally.  If not functioning normally, 
-       this OID will return powerSupply1Failed(2)."  
-   ::= { rPDUPowerSupplyDevice 1 }
-
-rPDUPowerSupply2Status   OBJECT-TYPE
-   SYNTAX INTEGER       {
-      powerSupply2Ok             (1),
-      powerSupply2Failed         (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return powerSupply2Ok(1) if power
-       supply 2 is functioning normally.  If not functioning normally, 
-       this OID will return powerSupply2Failed(2)."  
-   ::= { rPDUPowerSupplyDevice 2 }
-
-
-
--- the dm3IdentSystem group
- 
-dm3IdentSysDescriptionTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of DC description records."
-   ::= { dm3IdentSystem 1 }
-
-dm3IdentSysDescriptionTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF IdentSysDescriptionEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for accessing description records of the powerplant. The number of
-       entries is contained in the dm3IdentSysDescriptionTableSize OID."
-   ::= { dm3IdentSystem 2 }    
-
-dm3IdentSysDescriptionEntry OBJECT-TYPE
-   SYNTAX IdentSysDescriptionEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The powerplant description record to reference."
-   INDEX { dm3IdentSysDescriptionIndex }
-   ::= { dm3IdentSysDescriptionTable 1 }
-   
-IdentSysDescriptionEntry ::=
-   SEQUENCE {
-      dm3IdentSysDescriptionIndex   INTEGER,
-      dm3IdentSysDescriptionText    DisplayString
-   }
-
-dm3IdentSysDescriptionIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the DC powerplant description record."
-   ::= { dm3IdentSysDescriptionEntry 1 }
-
-dm3IdentSysDescriptionText OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A 16 character text field describing the DC power plant device.
-      This field can be configured from the dm3ConfigSysDescriptionText OID."
-   ::= { dm3IdentSysDescriptionEntry 2 }
-
-dm3IdentSysModel OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Model type of the DC power plant."
-   ::= { dm3IdentSystem 3 }
-
-dm3IdentSysCntrlRev OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Integer representation of the hardware revision of the Master Controller board."
-   ::= { dm3IdentSystem 4 }
-
-dm3IdentSysFWVersion OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Integer representation of the power plant Master Controller firmware revision."
-   ::= { dm3IdentSystem 5 }
-   
--- the dm3ConfigSystem group
-
-dm3ConfigSysDescriptionTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of DC description records."
-   ::= { dm3ConfigSystem 1 }
-
-dm3ConfigSysDescriptionTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF ConfigSysDescriptionEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for accessing description records of the powerplant. The number of
-       entries is contained in the dm3ConfigSysDescriptionTableSize OID."
-   ::= { dm3ConfigSystem 2 }       
-
-dm3ConfigSysDescriptionEntry OBJECT-TYPE
-   SYNTAX ConfigSysDescriptionEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The powerplant description record to reference."
-   INDEX { dm3ConfigSysDescriptionIndex }
-   ::= { dm3ConfigSysDescriptionTable 1 }
-   
-ConfigSysDescriptionEntry ::=
-   SEQUENCE {
-      dm3ConfigSysDescriptionIndex   INTEGER,
-      dm3ConfigSysDescriptionText    DisplayString
-   }
-
-dm3ConfigSysDescriptionIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the DC powerplant description record."
-
-   ::= { dm3ConfigSysDescriptionEntry 1 }
-
-dm3ConfigSysDescriptionText OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "16 character text field describing the DC power plant device."
-
-   ::= { dm3ConfigSysDescriptionEntry 2 }
-
-dm3ConfigSysHighTempThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Ambient high temperature threshold.  Temperature sensor located on Master
-      Controller board.
-
-      Values are represented in thousandths of a degree.
-      Units are displayed in the scale shown in
-      the 'dm3StatusSysTempUnits' OID (Celsius or Fahrenheit).
-      
-      Attempts to set the value above or below the acceptable range of the powerplant
-       will cause the value to be set at the high or low point of the range respectively."
-   ::= { dm3ConfigSystem 3 }
-
-dm3ConfigSysHighTempAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the System High Temperature Alarm;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition."
-   ::= { dm3ConfigSystem 4 }
-   
-dm3ConfigSysLowTempThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Ambient low temperature threshold.  Temperature sensor located on Master
-      Controller board.
-      
-      Values are represented in thousandths of a degree.
-      Units are displayed in the scale shown in
-      the 'dm3StatusSysTempUnits' OID (Celsius or Fahrenheit).
-
-      Attempts to set the value above or below the acceptable range of the powerplant
-       will cause the value to be set at the high or low point of the range respectively."
-   ::= { dm3ConfigSystem 5 }
-   
-dm3ConfigSysLowTempAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the System Low Temperature Alarm;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition."
-   ::= { dm3ConfigSystem 6 }
-
-dm3ConfigSysHardwareTempAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the System Hardware Temperature Alarm;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition."
-   ::= { dm3ConfigSystem 7 }
-
-dm3ConfigSysRemoteAccess OBJECT-TYPE
-   SYNTAX INTEGER       {
-      accessEnabled               (1),
-      accessDisabled              (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "
-      This OID is used to disable remote write access to the power plant.
-      Setting this OID to accessEnabled (1) will have no affect.
-      Setting this OID to accessDisabled (2) will disable the ability to 
-      remotely configure the DC powerplant.
-      
-      Once remote access is disabled, it can only be restored from the front
-      panel of the DC power plant."
-   ::= { dm3ConfigSystem 8 }
-    
-
--- the dm3ConfigLVD group
-
-dm3ConfigLVDTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of DC powerplant LVDs controllable
-       by this IP address."
-   ::= { dm3ConfigLVD 1 }
-
-dm3ConfigLVDTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF ConfigLVDEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for accessing settings of the LVDs. The number of
-       entries is contained in the dm3ConfigLVDTableSize OID."
-   ::= { dm3ConfigLVD 2 }      
-
-dm3ConfigLVDEntry OBJECT-TYPE
-   SYNTAX ConfigLVDEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The LVD to configure."
-   INDEX { dm3ConfigLVDIndex }
-   ::= { dm3ConfigLVDTable 1 }
-   
-ConfigLVDEntry ::=
-   SEQUENCE {
-      dm3ConfigLVDIndex               INTEGER,
-      dm3ConfigLVDName                DisplayString,
-      dm3ConfigLVDEnable              INTEGER,
-      dm3ConfigLVDTripThresh          INTEGER,
-      dm3ConfigLVDResetThresh         INTEGER,
-      dm3ConfigLVDOpenAlarm           INTEGER,
-      dm3ConfigLVDHWAlarm             INTEGER
-   }
-   
-dm3ConfigLVDIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the DC powerplant LVD."
-   ::= { dm3ConfigLVDEntry 1 }
-
-dm3ConfigLVDName OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-write
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the LVD. The maximum value is 16 characters."
-   ::= { dm3ConfigLVDEntry 2 }
-   
-dm3ConfigLVDEnable OBJECT-TYPE
-   SYNTAX INTEGER       {
-      enabledYes               (1),
-      enabledNo                (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "This OID is used to control and indicate if the LVD is on or off.
-      Setting this OID to enabledYes (1) will enable (turn on) the LVD.
-      Setting this OID to enabledNo (2) will disable (turn off) the LVD."
-   ::= { dm3ConfigLVDEntry 3 }
-
-dm3ConfigLVDTripThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "LVD Trip threshold.  If voltage exceeds threshold, the LVD will trip.
-      
-      Values are represented in thousandths of Volts (mV).
-      Attempts to set the value above or below the acceptable range of the powerplant
-       will cause the value to be set at the high or low point of the range respectively."
-   ::= { dm3ConfigLVDEntry 4 }
-
-dm3ConfigLVDResetThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "LVD Reset threshold.  If voltage exceeds threshold, the LVD will reset.
-      
-      Values are represented in thousandths of Volts (mV).
-      Attempts to set the value above or below the acceptable range of the powerplant
-       will cause the value to be set at the high or low point of the range respectively."
-   ::= { dm3ConfigLVDEntry 5 }
-   
-dm3ConfigLVDOpenAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the LVD Open Alarm;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition."
-   ::= { dm3ConfigLVDEntry 6 }
-   
-dm3ConfigLVDHWAlarm OBJECT-TYPE   
-SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the LVD Hardware Alarm;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition."
-   ::= { dm3ConfigLVDEntry 7 }
-
-
--- the dm3ConfigBattery group
-
-dm3ConfigBattFloatVolt OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Battery Float Voltage.  This setting controls the power plant voltage.
-      
-      Values are represented in thousandths of Volts (mV).
-      Attempts to set the value above or below the acceptable range of the powerplant
-       will cause the value to be set at the high or low point of the range respectively."
-   ::= { dm3ConfigBattery 1 }
-
-dm3ConfigBattMaxRecharge OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Battery Maximum Recharge Rate.  This setting controls the battery max
-      recharge rate.  The value is based on C/20 for 240 AHr battery string.
-      
-      Values are represented in thousandths of Amps (mA).
-      Attempts to set the value above or below the acceptable range of the powerplant
-       will cause the value to be set at the high or low point of the range respectively."
-   ::= { dm3ConfigBattery 2 }
-
-dm3ConfigBattDischargeThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Battery discharge threshold.  If battery output current exceeds threshold
-      a battery discharge alarm will occur.
-      
-      Values are represented in thousandths of Amps (mA).
-      Attempts to set the value above or below the acceptable range of the powerplant
-       will cause the value to be set at the high or low point of the range respectively."
-   ::= { dm3ConfigBattery 3 }
-   
-dm3ConfigBattDischargeAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the Battery Discharge Alarm;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition."
-
-   ::= { dm3ConfigBattery 4 }
-
-dm3ConfigBattHighVoltThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Battery high voltage threshold.  If system battery voltage exceeds threshold
-      a battery high voltage alarm will occur.
-      
-      Values are represented in thousandths of Volts (mV).
-      Attempts to set the value above or below the acceptable range of the powerplant
-       will cause the value to be set at the high or low point of the range respectively."
-   ::= { dm3ConfigBattery 5 }
-   
-dm3ConfigBattHighVoltAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the Battery High Voltage Alarm;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition."
-
-   ::= { dm3ConfigBattery 6 }
-   
-dm3ConfigBattLowVoltThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Battery low voltage threshold.  If system battery voltage is under threshold
-      a battery low voltage alarm will occur.
-      
-      Values are represented in thousandths of Volts (mV).
-      Attempts to set the value above or below the acceptable range of the powerplant
-       will cause the value to be set at the high or low point of the range respectively."
-   ::= { dm3ConfigBattery 7 }
-   
-dm3ConfigBattLowVoltAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the Battery Low Voltage Alarm;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition."
-
-   ::= { dm3ConfigBattery 8 }
-   
-dm3ConfigBattHighTempThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Battery high temperature threshold.  If system battery temperature exceeds threshold
-      a battery high temperature alarm will occur.
-      
-      Values are represented in thousandths of a degree.
-      Units are displayed in the scale shown in
-      the 'dm3StatusSysTempUnits' OID (Celsius or Fahrenheit).
-
-      Attempts to set the value above or below the acceptable range of the powerplant
-       will cause the value to be set at the high or low point of the range respectively."
-      
-   ::= { dm3ConfigBattery 9 }
-   
-dm3ConfigBattHighTempAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the Battery High Temperature Alarm;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition."
-
-   ::= { dm3ConfigBattery 10 }
-   
-dm3ConfigBattLowTempThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Battery low temperature threshold.  If system battery temperature is under threshold
-      a battery low temperature alarm will occur.
-      
-      Values are represented in thousandths of a degree.
-      Units are displayed in the scale shown in
-      the 'dm3StatusSysTempUnits' OID (Celsius or Fahrenheit).
-
-      Attempts to set the value above or below the acceptable range of the powerplant
-       will cause the value to be set at the high or low point of the range respectively."
-      
-   ::= { dm3ConfigBattery 11 }
-   
-dm3ConfigBattLowTempAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the Battery Low Temperature Alarm;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition."
-
-   ::= { dm3ConfigBattery 12 }
-
-dm3ConfigBattAmpHour OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Battery Amp-Hour Size.  Units are thousandths of Amp hours (mAHr).
-
-      Attempts to set the value above or below the acceptable range of the powerplant
-       will cause the value to be set at the high or low point of the range respectively."
-   ::= { dm3ConfigBattery 13 }
-
-dm3ConfigCompMethod OBJECT-TYPE
-   SYNTAX INTEGER       {
-      tempcompOn          (1),
-      tempcompOff         (2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "This OID is used to configure and get the state of the battery
-      temperature compensation.
-      
-      Setting this OID to tempcompOn (1) will enable/turn on the battery temperature compensation.
-      Setting this OID to tempcompOff (2) will disable/turn off the battery temperature compensation."
-   ::= { dm3ConfigBattery 14 }
-
-dm3ConfigCompTempCoeff OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Compensation Temperature Coefficient. (uV/degC/cell).
-      
-      Units are presented in microvolts.
-      Attempts to set the value above or below the acceptable range of the powerplant
-       will cause the value to be set at the high or low point of the range respectively."
-   ::= { dm3ConfigBattery 15 }
-
-dm3ConfigHighKneeTemp OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "High Knee for temperature compensation:  Compensation temperature coefficient 
-      becomes 0mV/degC/cell.
-      
-      Values are represented in thousandths of degrees Celcius.
-      Attempts to set the value above or below the acceptable range of the powerplant
-       will cause the value to be set at the high or low point of the range respectively."
-   ::= { dm3ConfigBattery 16 }
-
-dm3ConfigLowKneeTemp OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Low Knee for temperature compensation:  Compensation temperature coefficient 
-      becomes 0mV/degC/cell.
-      
-      Values are represented in thousandths of degrees Celcius.
-      Attempts to set the value above or below the acceptable range of the powerplant
-       will cause the value to be set at the high or low point of the range respectively."
-   ::= { dm3ConfigBattery 17 }
-   
-dm3ConfigBattHwCurrentAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the Battery Current Hardware Alarm (indicating current is outside realistic
-       limits, or a possible measurement fault;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition."
-
-   ::= { dm3ConfigBattery 18 }
-   
-dm3ConfigBattHwTempAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the Battery Temperature Hardware Alarm (indicating temperature is outside realistic
-       limits, or a possible measurement fault;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition."
-
-   ::= { dm3ConfigBattery 19 }
-
-
--- the dm3ConfigRectThresh group
-dm3ConfigRectHighVoltThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Rectifier high voltage threshold.  If rectifier voltage exceeds threshold
-      a rectifier high voltage alarm will occur.
-      
-      Values are represented in thousandths of Volts (mV).
-      Attempts to set the value above or below the acceptable range of the powerplant
-       will cause the value to be set at the high or low point of the range respectively."
-   ::= { dm3ConfigRectThresh 1 }
-
-
-dm3ConfigRectLowVoltThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Rectifier low voltage threshold.  If rectifier voltage is under threshold
-      a rectifier low voltage alarm will occur.
-      
-      Values are represented in thousandths of Volts (mV).
-      Attempts to set the value above or below the acceptable range of the powerplant
-       will cause the value to be set at the high or low point of the range respectively."
-   ::= { dm3ConfigRectThresh 2 }
-
-dm3ConfigRectFailSafe OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Rectifier Fail Safe point.  This OID represents the value sent to rectifier controllers
-      to use in the event of communications loss with the Master Controller or Master Controller
-      board failure.
-      
-      Values are represented in thousandths of Volts (mV).
-      Attempts to set the value above or below the acceptable range of the powerplant
-       will cause the value to be set at the high or low point of the range respectively."
-   ::= { dm3ConfigRectThresh 3 }
-
-dm3ConfigRectFailComm OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Rectifier Communication Fail timeout.  This OID represents the time interval in which there is no 
-      communication between the rectifier and the master controller at which the rectifier will reset 
-      all its values to default.
-      
-      Values are represented in hundredths of Seconds.
-      Attempts to set the value above or below the acceptable range of the powerplant
-       will cause the value to be set at the high or low point of the range respectively."
-   ::= { dm3ConfigRectThresh 4 }
-
--- the dm3ConfigRectAlarms group
-
-dm3ConfigRectHighVoltAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the Rectifier High Voltage Alarm;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition."
-
-   ::= { dm3ConfigRectAlarms 1 }
-
-dm3ConfigRectLowVoltAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the Rectifier Low Voltage Alarm;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition."
-
-   ::= { dm3ConfigRectAlarms 2 }
-   
-dm3ConfigRectConfigAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "This alarm is activated when a new rectifier is detected;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition."
-
-   ::= { dm3ConfigRectAlarms 3 }
-   
-dm3ConfigRect1ofNAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "This setting indicates the action if ONE rectifier of a N+1 system has failed;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition."
-
-   ::= { dm3ConfigRectAlarms 4 }
-
-dm3ConfigRect2ofNAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "This setting indicates the action if TWO OR MORE rectifiers of a N+1 system have failed;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition."
-
-   ::= { dm3ConfigRectAlarms 5 }
-
-dm3ConfigRectDiagAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9),
-      alarmNofN                (10)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the Rectifier Controller Diagnostics Alarm;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmNofN (10) causes the alarm specified in the dm3ConfigRect1ofNAlarm OID
-      to be activated if ONE rectifier fails in an N+1 system.  It causes the alarm specified in the 
-      dm3ConfigRect2ofNAlarm OID to be activated if TWO OR MORE rectifiers fail in an N+1 system."
-
-   ::= { dm3ConfigRectAlarms 6 }
-
-dm3ConfigRectImbalanceAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the Rectifier Imbalance Alarm;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition."
-
-   ::= { dm3ConfigRectAlarms 7 }
-
-dm3ConfigRectCurrLimitAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9),
-      alarmNofN                (10)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the Rectifier Current Limit Alarm (indicating rectifier in the Current Limit state);
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmNofN (10) causes the alarm specified in the dm3ConfigRect1ofNAlarm OID
-      to be activated if ONE rectifier fails in an N+1 system.  It causes the alarm specified in the 
-      dm3ConfigRect2ofNAlarm OID to be activated if TWO OR MORE rectifiers fail in an N+1 system."
-
-   ::= { dm3ConfigRectAlarms 8 }
-
-dm3ConfigRectStandbyAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9),
-      alarmNofN                (10)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the Rectifier Standby Alarm (indicating output DC has been turned off);
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmNofN (10) causes the alarm specified in the dm3ConfigRect1ofNAlarm OID
-      to be activated if ONE rectifier fails in an N+1 system.  It causes the alarm specified in the 
-      dm3ConfigRect2ofNAlarm OID to be activated if TWO OR MORE rectifiers fail in an N+1 system."
-
-   ::= { dm3ConfigRectAlarms 9 }
-   
-dm3ConfigRectFanFailAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9),
-      alarmNofN                (10)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the Rectifier Fan Fail Alarm;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmNofN (10) causes the alarm specified in the dm3ConfigRect1ofNAlarm OID
-      to be activated if ONE rectifier fails in an N+1 system.  It causes the alarm specified in the 
-      dm3ConfigRect2ofNAlarm OID to be activated if TWO OR MORE rectifiers fail in an N+1 system."
-
-   ::= { dm3ConfigRectAlarms 10 }
-
-dm3ConfigRectFailAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9),
-      alarmNofN                (10)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the Rectifier Fail Alarm;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmNofN (10) causes the alarm specified in the dm3ConfigRect1ofNAlarm OID
-      to be activated if ONE rectifier fails in an N+1 system.  It causes the alarm specified in the 
-      dm3ConfigRect2ofNAlarm OID to be activated if TWO OR MORE rectifiers fail in an N+1 system."
-
-   ::= { dm3ConfigRectAlarms 11 }
-
-dm3ConfigRectHwVoltAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the Rectifier Hardware Voltage Alarm (indicating voltage outside realistic limits,
-      or a possible measurement fault);
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition."
-
-   ::= { dm3ConfigRectAlarms 12 }
-
-
--- the dm3ConfigConvThresh group
-
-dm3ConfigConvHighVoltThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Converter high voltage threshold.  If converter voltage exceeds threshold
-      a converter high voltage alarm will occur.
-      
-      Values are represented in thousandths of Volts (mV).
-      Attempts to set the value above or below the acceptable range of the powerplant
-       will cause the value to be set at the high or low point of the range respectively."
-
-   ::= { dm3ConfigConvThresh 1 }
-   
-dm3ConfigConvLowVoltThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Converter low voltage threshold.  If converter voltage exceeds threshold
-      a converter low voltage alarm will occur.
-      
-      Values are represented in thousandths of Volts (mV).
-      Attempts to set the value above or below the acceptable range of the powerplant
-       will cause the value to be set at the high or low point of the range respectively."
-   ::= { dm3ConfigConvThresh 2 }
-
-dm3ConfigConvFailSafe OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Converter Fail Safe point.  This OID represents the value sent to converter controllers
-      to use in the event of communications loss with the Master Controller or Master Controller
-      board failure.
-      
-      Values are represented in thousandths of Volts (mV).
-      Attempts to set the value above or below the acceptable range of the powerplant
-       will cause the value to be set at the high or low point of the range respectively."
-   ::= { dm3ConfigConvThresh 3 }
-
-dm3ConfigConvSetPoint OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Converter Set point.  This OID represents the initial set point used in the
-      voltage control loop.
-      
-      Units are thousandths of Volts (mV).
-      Attempts to set the value above or below the acceptable range of the powerplant
-       will cause the value to be set at the high or low point of the range respectively."
-   ::= { dm3ConfigConvThresh 4 }
-
-dm3ConfigConvFailMax OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Converter Fail Maximum limit.  This OID represents the value sent to the converter
-      controllers to define the maximum set point allowed.
-      
-      Units are thousandths of Volts (mV).
-      Attempts to set the value above or below the acceptable range of the powerplant
-       will cause the value to be set at the high or low point of the range respectively."
-   ::= { dm3ConfigConvThresh 5 }
-
-dm3ConfigConvFailMin OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Converter Fail Minimum limit.  This OID represents the value sent to the converter
-      controllers to define the minimum set point allowed.
-      
-      Units are thousandths of Volts (mV).
-      Attempts to set the value above or below the acceptable range of the powerplant
-       will cause the value to be set at the high or low point of the range respectively."
-   ::= { dm3ConfigConvThresh 6 }
-
-dm3ConfigConvFailComm OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Converter Communication Fail timeout.  This OID represents the time interval in which there is no 
-      communication between the converter and the master controller at which the converter will reset 
-      all its values to default.
-      
-      Values are represented in hundredths of Seconds.
-      Attempts to set the value above or below the acceptable range of the powerplant
-       will cause the value to be set at the high or low point of the range respectively."
-   ::= { dm3ConfigConvThresh 7 }
-
--- the dm3ConfigConvAlarms group
-dm3ConfigConvHighVoltAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the Converter High Voltage Alarm;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition."
-
-   ::= { dm3ConfigConvAlarms 1 }
-
-dm3ConfigConvLowVoltAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the Converter Low Voltage Alarm;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition."
-
-   ::= { dm3ConfigConvAlarms 2 }
-
-dm3ConfigConvConfigAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the Converter Configuration Alarm (indicating a new converter has been detected);
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition."
-
-   ::= { dm3ConfigConvAlarms 3 }
-
-dm3ConfigConv1ofNAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the Converter 1ofN Alarm (indicating action if ONE converter of a N+1 system has failed);
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition."
-
-   ::= { dm3ConfigConvAlarms 4 }
-
-dm3ConfigConv2ofNAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the Converter 2ofN Alarm (indicating action if TWO OR MORE converters of a N+1 system has failed);
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition."
-
-   ::= { dm3ConfigConvAlarms 5 }
-
-dm3ConfigConvDiagAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9),
-      alarmNofN                (10)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the Converter Diagnostics Alarm;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmNofN (10) causes the alarm specified in the dm3ConfigConv1ofNAlarm OID
-      to be activated if ONE converter fails in an N+1 system.  It causes the alarm specified in the 
-      dm3ConfigConv2ofNAlarm OID to be activated if TWO OR MORE converters fail in an N+1 system."
-
-   ::= { dm3ConfigConvAlarms 6 }
-
-dm3ConfigConvImbalanceAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9),
-      alarmNofN                (10)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the Converter Imbalance Alarm;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmNofN (10) causes the alarm specified in the dm3ConfigConv1ofNAlarm OID
-      to be activated if ONE converter fails in an N+1 system.  It causes the alarm specified in the 
-      dm3ConfigConv2ofNAlarm OID to be activated if TWO OR MORE converters fail in an N+1 system."
-
-   ::= { dm3ConfigConvAlarms 7 }
-
-dm3ConfigConvCurrLimitAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9),
-      alarmNofN                (10)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the Converter Current Limit Alarm (indicating the converter is in the Current Limit state);
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmNofN (10) causes the alarm specified in the dm3ConfigConv1ofNAlarm OID
-      to be activated if ONE converter fails in an N+1 system.  It causes the alarm specified in the 
-      dm3ConfigConv2ofNAlarm OID to be activated if TWO OR MORE converters fail in an N+1 system."
-
-   ::= { dm3ConfigConvAlarms 8 }
-
-dm3ConfigConvStandbyAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9),
-      alarmNofN                (10)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the Converter Standby Alarm (indicating the converter is in the Standby state);
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmNofN (10) causes the alarm specified in the dm3ConfigConv1ofNAlarm OID
-      to be activated if ONE converter fails in an N+1 system.  It causes the alarm specified in the 
-      dm3ConfigConv2ofNAlarm OID to be activated if TWO OR MORE converters fail in an N+1 system."
-
-   ::= { dm3ConfigConvAlarms 9 }
-
-dm3ConfigConvFanFailAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9),
-      alarmNofN                (10)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the Converter Fan Fail Alarm;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmNofN (10) causes the alarm specified in the dm3ConfigConv1ofNAlarm OID
-      to be activated if ONE converter fails in an N+1 system.  It causes the alarm specified in the 
-      dm3ConfigConv2ofNAlarm OID to be activated if TWO OR MORE converters fail in an N+1 system."
-
-   ::= { dm3ConfigConvAlarms 10 }
-   
-dm3ConfigConvFailAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9),
-      alarmNofN                (10)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the Converter Fail Alarm;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmNofN (10) causes the alarm specified in the dm3ConfigConv1ofNAlarm OID
-      to be activated if ONE converter fails in an N+1 system.  It causes the alarm specified in the 
-      dm3ConfigConv2ofNAlarm OID to be activated if TWO OR MORE converters fail in an N+1 system."
-
-   ::= { dm3ConfigConvAlarms 11 }
-   
-dm3ConfigConvHwVoltAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9),
-      alarmNofN                (10)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "For the Converter Voltage Alarm (indicating voltage outside realistic limits, or a
-      possible measurement fault);
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmNofN (10) causes the alarm specified in the dm3ConfigConv1ofNAlarm OID
-      to be activated if ONE converter fails in an N+1 system.  It causes the alarm specified in the 
-      dm3ConfigConv2ofNAlarm OID to be activated if TWO OR MORE converters fail in an N+1 system."
-
-   ::= { dm3ConfigConvAlarms 12 }
-
-
--- the dm3ConfigOutputRelays group
-
-dm3ConfigOutRlyTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of DC powerplant Output Relays controllable
-       by this IP address."
-   ::= { dm3ConfigOutputRelays 1 }
-
-dm3ConfigOutRlyTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF ConfigOutRlyEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for accessing settings of the Output Relays. The number of
-       entries is contained in the dm3ConfigOutRlyTableSize OID."
-   ::= { dm3ConfigOutputRelays 2 }     
- 
-dm3ConfigOutRlyEntry OBJECT-TYPE
-   SYNTAX ConfigOutRlyEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The output relay to configure."
-   INDEX { dm3ConfigOutRlyIndex }
-   ::= { dm3ConfigOutRlyTable 1 }
-   
-ConfigOutRlyEntry ::=
-   SEQUENCE {
-      dm3ConfigOutRlyIndex            INTEGER,
-      dm3ConfigOutRlyName             DisplayString,
-      dm3ConfigOutRlyDelay            INTEGER,
-      dm3ConfigOutRlyAlarm            INTEGER
-   }
-   
-dm3ConfigOutRlyIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the DC powerplant output relay."
-   ::= { dm3ConfigOutRlyEntry 1 }
-   
-dm3ConfigOutRlyName OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-write
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the output relay. The maximum value is 16 characters."
-   ::= { dm3ConfigOutRlyEntry 2 }
-   
-dm3ConfigOutRlyDelay OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Output Relay Delay.  This OID represents the time delay from the initiation of an
-      output relay action to when the output relay action does occur.  If the alarm condition
-      disappears before the end of the delay, no action will occur.  Delay for Major 
-      and Minor alarms is not configurable and is always set to 0.
-      
-      Values are represented in hundredths of seconds.
-      Attempts to set the value above or below the acceptable range of the powerplant
-       will cause the value to be set at the high or low point of the range respectively."
-   ::= { dm3ConfigOutRlyEntry 3 }
-   
-dm3ConfigOutRlyAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Output Relay Alarm.  This setting indicates what action to perform in the event of
-      an output relay alarm condition;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition.
-      
-      Relay Alarm for Major and Minor alarms is not configurable and is always set to 
-      alarmMajor and alarmMinor respectively."
-
-   ::= { dm3ConfigOutRlyEntry 4 }
-
-
--- the dm3ConfigInputRelays group
-
-dm3ConfigInRlyTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of DC powerplant Input Relays controllable
-       by this IP address."
-   ::= { dm3ConfigInputRelays 1 }
-
-dm3ConfigInRlyTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF ConfigInRlyEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for accessing settings of the Input Relays. The number of
-       entries is contained in the dm3ConfigInRlyTableSize OID."
-   ::= { dm3ConfigInputRelays 2 }      
-
-dm3ConfigInRlyEntry OBJECT-TYPE
-   SYNTAX ConfigInRlyEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The input relay to configure."
-   INDEX { dm3ConfigInRlyIndex }
-   ::= { dm3ConfigInRlyTable 1 }
-   
-ConfigInRlyEntry ::=
-   SEQUENCE { 
-      dm3ConfigInRlyIndex             INTEGER,
-      dm3ConfigInRlyName              DisplayString,
-      dm3ConfigInRlyDelay             INTEGER,
-      dm3ConfigInRlyAlarm             INTEGER
-   }
-   
-dm3ConfigInRlyIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the DC powerplant input relay."
-   ::= { dm3ConfigInRlyEntry 1 }
-   
-dm3ConfigInRlyName OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-write
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the input relay. The maximum value is 16 characters."
-
-   ::= { dm3ConfigInRlyEntry 2 }
-   
-dm3ConfigInRlyDelay OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Input Relay Delay.  This OID represents the time delay from the initiation of an
-      input relay action to when the input relay action does occur.   If the alarm condition
-      disappears before the end of the delay, no action will occur.
-      
-      Values are represented in hundredths of seconds.
-
-      Attempts to set the value above or below the acceptable range of the powerplant
-       will cause the value to be set at the high or low point of the range respectively."
-   ::= { dm3ConfigInRlyEntry 3 }
-   
-dm3ConfigInRlyAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Input Relay Alarm.  This setting indicates what action to perform in the event of
-      an input relay alarm condition;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition."
-
-   ::= { dm3ConfigInRlyEntry 4 }
-
--- the dm3ConfigBreakers group
-
-dm3ConfigBreakersTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of DC powerplant circuit breakers controllable
-       by this IP address."
-   ::= { dm3ConfigBreakers 1 }
-
-dm3ConfigBreakersTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF ConfigBreakersEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for accessing settings of the circuit breakers. The number of
-       entries is contained in the dm3ConfigBreakersTableSize OID."
-   ::= { dm3ConfigBreakers 2 }     
-
-dm3ConfigBreakersEntry OBJECT-TYPE
-   SYNTAX ConfigBreakersEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The circuit breaker to configure."
-   INDEX { dm3ConfigBreakersIndex }
-   ::= { dm3ConfigBreakersTable 1 }
-   
-ConfigBreakersEntry ::=
-   SEQUENCE {
-      dm3ConfigBreakersIndex         INTEGER,
-      dm3ConfigBreakersName          DisplayString,
-      dm3ConfigBreakersAlarm         INTEGER
-   }
-   
-dm3ConfigBreakersIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the DC powerplant circuit breaker."
-   ::= { dm3ConfigBreakersEntry 1 }
-   
-dm3ConfigBreakersName OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-write
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the circuit breaker. The maximum value is 16 characters."
-   ::= { dm3ConfigBreakersEntry 2 }
-   
-dm3ConfigBreakersAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Circuit Breaker Alarm.  This setting indicates what action to perform in the event of
-      a circuit breaker alarm condition;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition."
-
-   ::= { dm3ConfigBreakersEntry 3 }
-
--- the dm3ConfigFuses group
-
-dm3ConfigFusesTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of DC powerplant Fuses controllable
-       by this IP address."
-   ::= { dm3ConfigFuses 1 }
-
-dm3ConfigFusesTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF ConfigFusesEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for accessing settings of the Fuses. The number of
-       entries is contained in the dm3ConfigFusesTableSize OID."
-   ::= { dm3ConfigFuses 2 }    
-   
-dm3ConfigFusesEntry OBJECT-TYPE
-   SYNTAX ConfigFusesEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The fuse to configure."
-   INDEX { dm3ConfigFusesIndex }
-   ::= { dm3ConfigFusesTable 1 }
-   
-ConfigFusesEntry ::=
-   SEQUENCE {
-      dm3ConfigFusesIndex              INTEGER,
-      dm3ConfigFusesName               DisplayString,
-      dm3ConfigFusesAlarm              INTEGER
-   }
-   
-dm3ConfigFusesIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the DC powerplant fuse."
-   ::= { dm3ConfigFusesEntry 1 }
-   
-dm3ConfigFusesName OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-write
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the fuse. The maximum value is 16 characters."
-   ::= { dm3ConfigFusesEntry 2 }
-   
-dm3ConfigFusesAlarm OBJECT-TYPE
-   SYNTAX INTEGER       {
-      alarmIgnore               (1),
-      alarmRelay1               (2),
-      alarmRelay2               (3),
-      alarmRelay3               (4),
-      alarmRelay4               (5),
-      alarmRelay5               (6),
-      alarmRelay6               (7),
-      alarmMinor                (8),
-      alarmMajor                (9)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Fuses Alarm.  This setting indicates what action to perform in the event of
-      a Fuse alarm condition;
-      Setting this OID to alarmIgnore (1) results in the alarm condition being ignored.
-      Setting this OID to alarmRelay1 (2) causes relay 1 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay2 (3) causes relay 2 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay3 (4) causes relay 3 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay4 (5) causes relay 4 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay5 (6) causes relay 5 to be activated for an
-      alarm condition.
-      Setting this OID to alarmRelay6 (7) causes relay 6 to be activated for an
-      alarm condition.
-      Setting this OID to alarmMinor (8) causes the Minor relay to be activated for an
-      alarm condition.
-      Setting this OID to alarmMajor (9) causes the Major relay to be activated for an
-      alarm condition."
-
-   ::= { dm3ConfigFusesEntry 3 }
-
--- the dm3StatusSystem group
-
-dm3StatusSystemTemp OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "System temperature based on sensor on Master Controller PCB.
-
-      Values are represented in thousandths of a degree.
-      Units are displayed in the scale shown in
-      the 'dm3StatusSysTempUnits' OID (Celsius or Fahrenheit)."
-
-   ::= { dm3StatusSystem 1 }
-
-dm3StatusSystemStart OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Time stamp at DC powerplant initialization.
-       The time is represented as MMM,DD,YYYY,HH:MM:SS."
-   ::= { dm3StatusSystem 2 }
-
-dm3StatusSysRemoteAccess OBJECT-TYPE
-   SYNTAX INTEGER       {
-      accessEnabled              (1),
-      accessDisabled             (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Remote Access indicator
-      This setting indicates if configuration (write) access to the powerplant is enabled or 
-      disabled at the powerplant level.
-      This value will be accessEnabled (1) if remote configuration is enabled, and 
-      accessDisabled (2) if remote configuration is disabled."
-   ::= { dm3StatusSystem 3 }
-
-dm3StatusSysSecurityLevel OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This variable shows the current active security access level of controller.  This
-      can only be changed directly from the front panel."
-   ::= { dm3StatusSystem 4 }
-
-dm3StatusSysTempSanity OBJECT-TYPE
-   SYNTAX INTEGER{
-      saneYES              (1),
-      saneNO               (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "System temperature sanity indicator.  Indicates if the system temperature is 
-      reasonable.  Reasonable is defined based on powerplant type.  A value of saneYes (1)
-      indicates temperature is reasonable, a value of saneNo (2) indicates it is not."
-   ::= { dm3StatusSystem 5 }
-
-dm3StatusSysAlarmState OBJECT-TYPE
-   SYNTAX INTEGER{
-      alarmMinor           (1),
-      alarmMajor           (2),
-      alarmBoth            (3),
-      alarmNone            (4)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "System Alarm State.  Reflects the alarm status of the overall DC system.
-      If a minor alarm is present, the value will be alarmMinor(1).
-      If a major alarm is present, the value will be alarmMajor(2).
-      If both minor and a major alarm is present, the value will be alarmBoth(3).
-      If no alarm is present, the value will be alarmNone(4)."
-   ::= { dm3StatusSystem 6 }
-
-dm3StatusSysTempUnits OBJECT-TYPE
-   SYNTAX INTEGER {
-      celsius(1),
-      fahrenheit(2)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The temperature scale used to display the temperature
-       in the DC system, Celsius(1) or Fahrenheit(2).
-       This setting is based on the system preferences
-       configuration in the agent."
-   ::= { dm3StatusSystem 7 }
-
-
--- the dm3StatusAlarms group
-
-dm3StatusAlarmsTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of DC powerplant alarms viewable
-       by this IP address."
-   ::= { dm3StatusAlarms 1 }
-
-dm3StatusAlarmsTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF StatusAlarmsEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for accessing system alarms. The number of
-       entries is contained in the dm3StatusAlarmsTableSize OID."
-   ::= { dm3StatusAlarms 2 }       
-
-dm3StatusAlarmsEntry OBJECT-TYPE
-   SYNTAX StatusAlarmsEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The alarm to display."
-   INDEX { dm3StatusAlarmsIndex }
-   ::= { dm3StatusAlarmsTable 1 }
-   
-StatusAlarmsEntry ::=
-   SEQUENCE {   
-      dm3StatusAlarmsIndex               INTEGER,
-      dm3StatusAlarmsText                DisplayString
-   }
-
-dm3StatusAlarmsIndex OBJECT-TYPE
-   SYNTAX  INTEGER
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The index of the system alarm."       
-   ::= { dm3StatusAlarmsEntry 1 }
-   
-dm3StatusAlarmsText OBJECT-TYPE
-   SYNTAX  DisplayString
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The 16 character text describing the active alarm condition."
-   ::= { dm3StatusAlarmsEntry 2 }
-   
--- the dm3StatusBattery group
-
-dm3StatusBattCurrent OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Battery Current:  This OID shows the battery current in thousandths of Amps (mA)."
-   ::= { dm3StatusBattery 1 }
-
-dm3StatusBattTemp OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Battery Temperature:
-      
-      Values are represented in thousandths of a degree.
-      Units are displayed in the scale shown in
-      the 'dm3StatusSysTempUnits' OID (Celsius or Fahrenheit)."
-
-   ::= { dm3StatusBattery 2 }
-
-dm3StatusBattCurrentSanity OBJECT-TYPE
-   SYNTAX INTEGER{
-      saneYES              (1),
-      saneNO               (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Battery current sanity indicator.  Indicates if the battery current is 
-      reasonable.  Reasonable is defined based on powerplant type.  A value of saneYes (1)
-      indicates current is reasonable, a value of saneNo (2) indicates it is not."
-   ::= { dm3StatusBattery 3 }
-
-dm3StatusBattTempSanity OBJECT-TYPE
-   SYNTAX INTEGER{
-      saneYES              (1),
-      saneNO               (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Battery temperature sanity indicator.  Indicates if the battery temperature is 
-      reasonable.  Reasonable is defined based on powerplant type.  A value of saneYes (1)
-      indicates temperature is reasonable, a value of saneNo (2) indicates it is not."
-   ::= { dm3StatusBattery 4 }
-
--- the dm3StatusOEM group
-
-dm3StatusOEMrectOffset OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the rectifier offset value in thousandths of Volts (mV)."
-   ::= { dm3StatusOEM 1 }
-
-dm3StatusOEMrectGain OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the rectifier gain value in thousandths of Volts (mV/V)."
-   ::= { dm3StatusOEM 2 }
-
-dm3StatusOEMconvOffset OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the converter offset value in thousandths of Volts (mV)."
-   ::= { dm3StatusOEM 3 }
-
-dm3StatusOEMconvGain OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the converter gain value in thousandths of Volts (mV/V)."
-   ::= { dm3StatusOEM 4 }
-
-dm3StatusOEMshuntOffset OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the shunt offset value in thousandths of Amps (mA)."
-   ::= { dm3StatusOEM 5 }
-
-dm3StatusOEMshuntGain OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the shunt gain value in thousandths of Amps (mA/A)."
-   ::= { dm3StatusOEM 6 }
-
--- the dm3StatusLVD group
-
-dm3StatusLVDTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of DC powerplant LVDs viewable
-       by this IP address."
-   ::= { dm3StatusLVD 1 }
-
-dm3StatusLVDTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF StatusLVDEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for accessing settings of the LVDs. The number of
-       entries is contained in the dm3StatusLVDTableSize OID."
-   ::= { dm3StatusLVD 2 }      
-   
-dm3StatusLVDEntry OBJECT-TYPE
-   SYNTAX StatusLVDEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The LVD to gather status from."
-   INDEX { dm3StatusLVDIndex }
-   ::= { dm3StatusLVDTable 1 }
-   
-StatusLVDEntry ::=
-   SEQUENCE {
-      dm3StatusLVDIndex               INTEGER,
-      dm3StatusLVDName                DisplayString,
-      dm3StatusLVDState               INTEGER,
-      dm3StatusLVDHwFault             INTEGER
-   }
-   
-dm3StatusLVDIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the DC powerplant LVD."
-   ::= { dm3StatusLVDEntry 1 }
-   
-dm3StatusLVDName OBJECT-TYPE
-   SYNTAX  DisplayString
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the LVD. The maximum size is 
-       16 characters. The name is set by using the 
-       dm3ConfigLVDName OID.
-       This OID is provided for informational purposes only."       
-   ::= { dm3StatusLVDEntry 2 }
-   
-dm3StatusLVDState OBJECT-TYPE
-   SYNTAX INTEGER       {
-      statusClosed             (1),
-      statusOpened             (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return statusClosed (1) if the LVD is closed.
-       statusOpened (2) will be returned if the LVD is opened." 
-   ::= { dm3StatusLVDEntry 3 }
-
-dm3StatusLVDHwFault OBJECT-TYPE
-   SYNTAX INTEGER       {
-      statusFault               (1),
-      statusNofault             (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return statusFault (1) if the LVD is faulted.
-       statusNofault (2) will be returned if the LVD is not faulted." 
-   ::= { dm3StatusLVDEntry 4 }
-
--- the dm3StatusRectifier group
-
-dm3StatusRectTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of DC powerplant rectifiers viewable
-       by this IP address."
-   ::= { dm3StatusRectifier 1 }
-
-dm3StatusRectTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF StatusRectEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for accessing settings of the rectifiers. The number of
-       entries is contained in the dm3StatusRectTableSize OID."
-   ::= { dm3StatusRectifier 2 }    
-
-dm3StatusRectEntry OBJECT-TYPE
-   SYNTAX StatusRectEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The rectifier to gather status from."
-   INDEX { dm3StatusRectIndex }
-   ::= { dm3StatusRectTable 1 }
-   
-StatusRectEntry ::=
-   SEQUENCE {
-      dm3StatusRectIndex            INTEGER,
-      dm3StatusRectID               INTEGER,
-      dm3StatusRectDesc             DisplayString,
-      dm3StatusRectCurrent          INTEGER,
-      dm3StatusRectCurrentLimit     INTEGER,
-      dm3StatusRectStandby          INTEGER,
-      dm3StatusRectFanFail          INTEGER,
-      dm3StatusRectFail             INTEGER,
-      dm3StatusRectDevType          INTEGER,
-      dm3StatusRectPhyAddr          INTEGER,
-      dm3StatusRectCfg              INTEGER,
-      dm3StatusRectPcbRev           INTEGER,
-      dm3StatusRectFwVer            INTEGER,
-      dm3StatusRectPresent          INTEGER,
-      dm3StatusRectDiagPass         INTEGER,
-      dm3StatusRectState            INTEGER
-   }
-
-dm3StatusRectIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the DC powerplant rectifier."
-   ::= { dm3StatusRectEntry 1 }
-
-dm3StatusRectID OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the rectifier ID.  This enumerates the number of the rectifier within 
-       a group of rectifiers."
-   ::= { dm3StatusRectEntry 2 }
-
-dm3StatusRectDesc OBJECT-TYPE
-   SYNTAX DisplayString 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the 16-character rectifier description."
-   ::= { dm3StatusRectEntry 3 }
-
-dm3StatusRectCurrent OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the rectifier current in thousandths of Amps (mA)."
-   ::= { dm3StatusRectEntry 4 }
-
-dm3StatusRectCurrentLimit OBJECT-TYPE
-   SYNTAX INTEGER       {
-      statusTrue          (1),
-      statusFalse         (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return statusTrue (1) if the rectifier is in the Current Limit state.
-       statusFalse (2) will be returned if the rectifier is not in the Current Limit state." 
-   ::= { dm3StatusRectEntry 5 }
-
-dm3StatusRectStandby OBJECT-TYPE
-   SYNTAX INTEGER       {
-      statusTrue          (1),
-      statusFalse         (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return statusTrue (1) if the rectifier is in the Standby state.
-       statusFalse (2) will be returned if the rectifier is not in the Standby state." 
-   ::= { dm3StatusRectEntry 6 }
-
-dm3StatusRectFanFail OBJECT-TYPE
-   SYNTAX INTEGER       {
-      statusTrue          (1),
-      statusFalse         (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return statusTrue (1) if the rectifier Fan has failed.
-       statusFalse (2) will be returned if the rectifier Fan has not failed." 
-   ::= { dm3StatusRectEntry 7 }
-
-dm3StatusRectFail    OBJECT-TYPE
-   SYNTAX INTEGER       {
-      statusTrue          (1),
-      statusFalse         (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return statusTrue (1) if the rectifier has failed.
-       statusFalse (2) will be returned if the rectifier has not failed." 
-   ::= { dm3StatusRectEntry 8 }
-
-dm3StatusRectDevType OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the rectifier device type."
-   ::= { dm3StatusRectEntry 9 }
-
-dm3StatusRectPhyAddr OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the rectifier physical address (the address on the bus)."
-   ::= { dm3StatusRectEntry 10 }
-
-dm3StatusRectCfg OBJECT-TYPE
-   SYNTAX INTEGER       {
-      statusTrue          (1),
-      statusFalse         (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return statusTrue (1) if the rectifier is present after
-      power-up or set-configuration.
-       statusFalse (2) will be returned if the rectifier is not configured." 
-   ::= { dm3StatusRectEntry 11 }
-
-dm3StatusRectPcbRev OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the rectifier device PCB serial number."
-   ::= { dm3StatusRectEntry 12 }
-
-dm3StatusRectFwVer OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the rectifier device firmware revision."
-   ::= { dm3StatusRectEntry 13 }
-
-dm3StatusRectPresent OBJECT-TYPE
-   SYNTAX INTEGER       {
-      statusTrue          (1),
-      statusFalse         (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return statusTrue (1) if the rectifier is present.
-       statusFalse (2) will be returned if the rectifier is not present." 
-   ::= { dm3StatusRectEntry 14 }
-
-dm3StatusRectDiagPass OBJECT-TYPE
-   SYNTAX INTEGER       {
-      statusTrue          (1),
-      statusFalse         (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return statusTrue (1) if the rectifier diagnostics have passed.
-       statusFalse (2) will be returned if the rectifier diagnostics have not passed." 
-   ::= { dm3StatusRectEntry 15 }
-
-dm3StatusRectState OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the rectifier device state as defined by the device status register."
-   ::= { dm3StatusRectEntry 16 }
-
-dm3StatusSysRectVoltSanity OBJECT-TYPE
-   SYNTAX INTEGER {
-      saneYES              (1),
-      saneNO               (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Rectifier voltage sanity indicator.  Indicates if the rectifier voltage is 
-      reasonable.  Reasonable is defined based on powerplant type.  A value of saneYes (1)
-      indicates voltage is reasonable, a value of saneNo (2) indicates it is not."
-   ::= { dm3StatusRectifier 3 }
-
-dm3StatusSysRectAvailable OBJECT-TYPE
-   SYNTAX INTEGER       {
-      statusTrue          (1),
-      statusFalse         (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return statusTrue (1) if the rectifier is available.
-       statusFalse (2) will be returned if the rectifier is not available." 
-   ::= { dm3StatusRectifier 4 }
-
-dm3StatusSysRectType OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the type of rectifier the system has.  There can only be a single type of
-      rectifier in the power plant"
-   ::= { dm3StatusRectifier 5 }
-
-dm3StatusSysRectVoltage OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the system level rectifier voltage in thousandths of Volts (mV)."
-   ::= { dm3StatusRectifier 6 }
-
-dm3StatusSysRectCurrent OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the system level rectifier current in thousandths of Amps (mA)."
-   ::= { dm3StatusRectifier 7 }
-
-
--- the dm3StatusConverter group
-
-dm3StatusConvTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of DC powerplant converters viewable
-       by this IP address."
-   ::= { dm3StatusConverter 1 }
-
-dm3StatusConvTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF StatusConvEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for viewing status of the converters. The number of
-       entries is contained in the dm3StatusConvTableSize OID."
-   ::= { dm3StatusConverter 2 }    
- 
-dm3StatusConvEntry OBJECT-TYPE
-   SYNTAX StatusConvEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The converter to gather status from."
-   INDEX { dm3StatusConvIndex }
-   ::= { dm3StatusConvTable 1 }
-   
-StatusConvEntry ::=
-   SEQUENCE {
-      dm3StatusConvIndex            INTEGER,
-      dm3StatusConvID               INTEGER,
-      dm3StatusConvDesc             DisplayString,
-      dm3StatusConvCurrent          INTEGER,
-      dm3StatusConvCurrentLimit     INTEGER,
-      dm3StatusConvStandby          INTEGER,
-      dm3StatusConvFanFail          INTEGER,
-      dm3StatusConvFail             INTEGER,
-      dm3StatusConvDevType          INTEGER,
-      dm3StatusConvPhyAddr          INTEGER,
-      dm3StatusConvCfg              INTEGER,
-      dm3StatusConvPcbRev           INTEGER,
-      dm3StatusConvFwVer            INTEGER,
-      dm3StatusConvPresent          INTEGER,
-      dm3StatusConvDiagPass         INTEGER,
-      dm3StatusConvState            INTEGER
-   }
-
-dm3StatusConvIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the DC powerplant converter."
-   ::= { dm3StatusConvEntry 1 }
-   
-dm3StatusConvID OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the converter ID.  This enumerates the number of the converter within 
-       a group of converters."
-   ::= { dm3StatusConvEntry 2 }
-
-dm3StatusConvDesc OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the 16 character converter description."
-   ::= { dm3StatusConvEntry 3 }
-
-dm3StatusConvCurrent OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the converter current in thousandths of Amps (mA)."
-   ::= { dm3StatusConvEntry 4 }
-
-dm3StatusConvCurrentLimit OBJECT-TYPE
-   SYNTAX INTEGER       {
-      statusTrue          (1),
-      statusFalse         (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return statusTrue (1) if the converter is in the Current Limit state.
-       statusFalse (2) will be returned if the converter is not in the Current Limit state." 
-   ::= { dm3StatusConvEntry 5 }
-
-dm3StatusConvStandby OBJECT-TYPE
-   SYNTAX INTEGER       {
-      statusTrue          (1),
-      statusFalse         (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return statusTrue (1) if the converter is in the Standby state.
-       statusFalse (2) will be returned if the converter is not in the Standby state." 
-   ::= { dm3StatusConvEntry 6 }
-
-dm3StatusConvFanFail OBJECT-TYPE
-   SYNTAX INTEGER       {
-      statusTrue          (1),
-      statusFalse         (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return statusTrue (1) if the converter Fan has failed.
-       statusFalse (2) will be returned if the converter Fan has not failed." 
-   ::= { dm3StatusConvEntry 7 }
-
-dm3StatusConvFail OBJECT-TYPE
-   SYNTAX INTEGER       {
-      statusTrue          (1),
-      statusFalse         (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return statusTrue (1) if the converter has failed.
-       statusFalse (2) will be returned if the converter has not failed." 
-   ::= { dm3StatusConvEntry 8 }
-
-dm3StatusConvDevType OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the converter device type."
-   ::= { dm3StatusConvEntry 9 }
-
-dm3StatusConvPhyAddr OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the converter physical address (the address on the bus)."
-   ::= { dm3StatusConvEntry 10 }
-
-dm3StatusConvCfg OBJECT-TYPE
-   SYNTAX INTEGER       {
-      statusTrue          (1),
-      statusFalse         (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return statusTrue (1) if the converter is present after
-      power-up or set-configuration.
-       statusFalse (2) will be returned if the converter is not configured." 
-   ::= { dm3StatusConvEntry 11 }
-
-dm3StatusConvPcbRev OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the converter device PCB serial number."
-   ::= { dm3StatusConvEntry 12 }
-
-dm3StatusConvFwVer OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the converter device firmware version."
-   ::= { dm3StatusConvEntry 13 }
-
-dm3StatusConvPresent OBJECT-TYPE
-   SYNTAX INTEGER       {
-      statusTrue          (1),
-      statusFalse         (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return statusTrue (1) if the converter is present.
-       statusFalse (2) will be returned if the converter is not present." 
-   ::= { dm3StatusConvEntry 14 }
-
-dm3StatusConvDiagPass OBJECT-TYPE
-   SYNTAX INTEGER       {
-      statusTrue          (1),
-      statusFalse         (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return statusTrue (1) if the converter diagnostics have passed.
-       statusFalse (2) will be returned if the converter diagnostics have not passed." 
-   ::= { dm3StatusConvEntry 15 }
-
-dm3StatusConvState OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the converter state as defined by the device status register."
-   ::= { dm3StatusConvEntry 16 }
-
-dm3StatusSysConvVoltSanity OBJECT-TYPE
-   SYNTAX INTEGER{
-      saneYES              (1),
-      saneNO               (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Converter voltage sanity indicator.  Indicates if the converter voltage is 
-      reasonable.  Reasonable is defined based on powerplant type.  A value of saneYes (1)
-      indicates voltage is reasonable, a value of saneNo (2) indicates it is not."
-   ::= { dm3StatusConverter 3 }
-   
-dm3StatusSysConvAvailable OBJECT-TYPE
-   SYNTAX INTEGER       {
-      statusTrue          (1),
-      statusFalse         (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return statusTrue (1) if the converter is available.
-       statusFalse (2) will be returned if the converter is not available." 
-   ::= { dm3StatusConverter 4 }
-   
-dm3StatusSysConvType OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the converter type."
-   ::= { dm3StatusConverter 5 }
-   
-dm3StatusSysConvVoltage OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the system level converter voltage in thousandths of volts (mV)."
-   ::= { dm3StatusConverter 6 }
-   
-dm3StatusSysConvCurrent OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the system level converter current in thousandths of Amps (mA)."
-   ::= { dm3StatusConverter 7 }
-
--- the dm3StatusOutputRelays group
-
-dm3StatusOutRlyTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of DC powerplant output relays viewable
-       by this IP address."
-   ::= { dm3StatusOutputRelays 1 }
-
-dm3StatusOutRlyTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF StatusOutRlyEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for viewing status of the output relays. The number of
-       entries is contained in the dm3StatusOutRlyTableSize OID."
-   ::= { dm3StatusOutputRelays 2 }     
-   
-dm3StatusOutRlyEntry OBJECT-TYPE
-   SYNTAX StatusOutRlyEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The output relay to gather status from."
-   INDEX { dm3StatusOutRlyIndex }
-   ::= { dm3StatusOutRlyTable 1 }
-
-StatusOutRlyEntry ::=
-   SEQUENCE {
-      dm3StatusOutRlyIndex            INTEGER,
-      dm3StatusOutRlyName             DisplayString,
-      dm3StatusOutRlyStatus           INTEGER
-   }
-   
-dm3StatusOutRlyIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the DC powerplant output relay."
-   ::= { dm3StatusOutRlyEntry 1 }
-   
-dm3StatusOutRlyName OBJECT-TYPE
-   SYNTAX  DisplayString
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the output relay. The maximum size is 
-       16 characters. The name is set by using the 
-       dm3ConfigOutRlyName OID.
-       This OID is provided for informational purposes only."       
-   ::= { dm3StatusOutRlyEntry 2 }
-   
-dm3StatusOutRlyStatus OBJECT-TYPE
-   SYNTAX INTEGER       {
-      statusOn          (1),
-      statusOff         (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return statusOn (1) if the output relay is enabled/on.
-       statusOff (2) will be returned if the output relay is disabled/off." 
-   ::= { dm3StatusOutRlyEntry 3 }
-
-
--- the dm3StatusInputRelays group
-
-dm3StatusInRlyTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of DC powerplant input relays viewable
-       by this IP address."
-   ::= { dm3StatusInputRelays 1 }
-
-dm3StatusInRlyTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF StatusInRlyEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for viewing status of the input relays. The number of
-       entries is contained in the dm3StatusInRlyTableSize OID."
-   ::= { dm3StatusInputRelays 2 }      
-
-   
-dm3StatusInRlyEntry OBJECT-TYPE
-   SYNTAX StatusInRlyEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The input relays to gather status from."
-   INDEX { dm3StatusInRlyIndex }
-   ::= { dm3StatusInRlyTable 1 }
-   
-StatusInRlyEntry ::=
-   SEQUENCE {
-      dm3StatusInRlyIndex           INTEGER,
-      dm3StatusInRlyName            DisplayString,
-      dm3StatusInRlyStatus          INTEGER
-   }
-   
-dm3StatusInRlyIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the DC powerplant input relay."
-   ::= { dm3StatusInRlyEntry 1 }
-   
-dm3StatusInRlyName OBJECT-TYPE
-   SYNTAX  DisplayString
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the input relay. The maximum size is 
-       16 characters. The name is set by using the 
-       dm3ConfigInRlyName OID.
-       This OID is provided for informational purposes only."       
-   ::= { dm3StatusInRlyEntry 2 }
-   
-dm3StatusInRlyStatus OBJECT-TYPE
-   SYNTAX INTEGER       {
-      statusOn          (1),
-      statusOff         (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return statusOn (1) if the input relay is enabled/on.
-       statusOff (2) will be returned if the input relay is disabled/off." 
-   ::= { dm3StatusInRlyEntry 3 }
-
--- the dm3StatusBreakers group
-
-dm3StatusBreakersTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of DC powerplant circuit breakers viewable
-       by this IP address."
-   ::= { dm3StatusBreakers 1 }
-
-dm3StatusBreakersTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF StatusBreakersEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for viewing status of the circuit breakers. The number of
-       entries is contained in the dm3StatusBreakersTableSize OID."
-   ::= { dm3StatusBreakers 2 }     
-
-dm3StatusBreakersEntry OBJECT-TYPE
-   SYNTAX StatusBreakersEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The circuit breaker to gather status from."
-   INDEX { dm3StatusBreakersIndex }
-   ::= { dm3StatusBreakersTable 1 }
-
-StatusBreakersEntry ::=
-   SEQUENCE {
-      dm3StatusBreakersIndex               INTEGER,
-      dm3StatusBreakersName                DisplayString,
-      dm3StatusBreakersStatus              INTEGER
-   }
-   
-dm3StatusBreakersIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the DC powerplant circuit breaker."
-   ::= { dm3StatusBreakersEntry 1 }
-   
-dm3StatusBreakersName OBJECT-TYPE
-   SYNTAX  DisplayString
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the circuit breaker. The maximum size is 
-       16 characters. The name is set by using the 
-       dm3ConfigBreakersName OID.
-       This OID is provided for informational purposes only."       
-   ::= { dm3StatusBreakersEntry 2 }
-   
-dm3StatusBreakersStatus OBJECT-TYPE
-   SYNTAX INTEGER       {
-      statusClosed          (1),
-      statusOpen            (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return statusClosed (1) if the circuit breaker is closed.
-       statusOpen (2) will be returned if the circuit breaker is open." 
-   ::= { dm3StatusBreakersEntry 3 }
-   
--- the dm3StatusFuses group
-
-dm3StatusFusesTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of DC powerplant fuses controllable
-       by this IP address."
-   ::= { dm3StatusFuses 1 }
-
-dm3StatusFusesTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF StatusFusesEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for viewing status of the fuses. The number of
-       entries is contained in the dm3StatusFusesTableSize OID."
-   ::= { dm3StatusFuses 2 }    
-   
-dm3StatusFusesEntry OBJECT-TYPE
-   SYNTAX StatusFusesEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The fuse to gather status from."
-   INDEX { dm3StatusFusesIndex }
-   ::= { dm3StatusFusesTable 1 }
-   
-StatusFusesEntry ::=
-   SEQUENCE {
-      dm3StatusFusesIndex               INTEGER,
-      dm3StatusFusesName                DisplayString,
-      dm3StatusFusesStatus              INTEGER
-   }
-
-dm3StatusFusesIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the DC powerplant fuse."
-   ::= { dm3StatusFusesEntry 1 }
-   
-dm3StatusFusesName OBJECT-TYPE
-   SYNTAX  DisplayString
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the fuse. The maximum size is 
-       16 characters. The name is set by using the 
-       dm3ConfigFuseName OID.
-       This OID is provided for informational purposes only."       
-   ::= { dm3StatusFusesEntry 2 }
-
-dm3StatusFusesStatus OBJECT-TYPE
-   SYNTAX INTEGER       {
-      statusClosed          (1),
-      statusOpen            (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return statusClosed (1) if the fuse is closed.
-       statusOpen (2) will be returned if the fuse is open." 
-   ::= { dm3StatusFusesEntry 3 }
-
--- the atsIdent group
-
-atsIdentHardwareRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The hardware version of the Automatic Transfer Switch. 
-       This value is set at the factory."
-   ::= { atsIdent 1 }
-
-atsIdentFirmwareRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A string identifying the Automatic Transfer Switch 
-       firmware version." 
-   ::= {  atsIdent 2 }
-
-atsIdentFirmwareDate OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The date of release for this Automatic Transfer Switch 
-       firmware version. " 
-   ::= {  atsIdent 3 }
-
-atsIdentDateOfManufacture OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The date when the Automatic Transfer Switch was manufactured in mm/dd/yyyy format.
-       This value is set at the factory. " 
-   ::= { atsIdent 4 }
-   
-atsIdentModelNumber OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A string identifying the model number of the Automatic Transfer Switch. 
-       This value is set at the factory."
-   ::= { atsIdent 5 }
-
-atsIdentSerialNumber OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A string identifying the serial number of 
-       the Automatic Transfer Switch. This value is set at the factory."
-   ::= { atsIdent 6 }
-
-atsIdentNominalLineVoltage OBJECT-TYPE
-       SYNTAX     INTEGER 
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-         "RMS Utility Voltage measured in V."
-       ::= { atsIdent 7 }
-
-atsIdentNominalLineFrequency OBJECT-TYPE
-       SYNTAX     INTEGER 
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "Utility Power Frequency measured in Hz."
-       ::= { atsIdent 8 }
-
---  the atsCalibration group  
- 
--- Input Voltage Calibration Factor table
-
-   atsCalibrationNumInputs OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The number of inputs to this device."
-       ::= { atsCalibrationInput 1 }
-
-   atsCalibrationNumInputPhases OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The number of phases per input for this device."
-       ::= { atsCalibrationInput 2 }
-
-   atsCalibrationInputTable OBJECT-TYPE
-       SYNTAX     SEQUENCE OF ATSCalibrationInputPhaseEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-               "The number of phases per input line to this device."
-       ::= { atsCalibrationInput 3 }
-
-   atsCalibrationInputPhaseEntry OBJECT-TYPE
-       SYNTAX     ATSCalibrationInputPhaseEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-               "An entry containing calibration information applicable to a
-               particular input phase."
-       INDEX { atsCalibrationInputTableIndex, atsCalibrationInputPhaseTableIndex }
-       ::= { atsCalibrationInputTable 1 }
-
-   ATSCalibrationInputPhaseEntry ::= SEQUENCE {
-       atsCalibrationInputTableIndex         INTEGER,
-       atsCalibrationInputPhaseTableIndex    INTEGER,
-       atsLineVoltageCalibrationFactor       INTEGER
-   }
-
-   atsCalibrationInputTableIndex OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The input identifier."
-       ::= { atsCalibrationInputPhaseEntry 1 }
-
-   atsCalibrationInputPhaseTableIndex OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The input phase identifier."
-       ::= { atsCalibrationInputPhaseEntry 2 }
-
-   atsLineVoltageCalibrationFactor  OBJECT-TYPE
-       SYNTAX INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The Line Voltage Calibration factor.
-                This value is set at the factory."
-       ::= { atsCalibrationInputPhaseEntry 3 }
-
--- Power Supply Voltage Calibration table
-
-   atsCalibrationPowerSupplyVoltages OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The number of power supply voltages supported by this device.
-                This variable indicates the number of rows in the
-                atsCalibrationPowerSupplyTable. There is one entry per
-                supported voltage: 24V, 12V and 5V"
-       ::= { atsCalibrationPowerSupply 1 }
-
-   atsCalibrationPowerSupplyVoltageTable OBJECT-TYPE
-       SYNTAX     SEQUENCE OF ATSCalibrationPowerSupplyVoltageEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-               "A list of Power Supply table entries."
-       ::= { atsCalibrationPowerSupply 2 }
-
-   atsCalibrationPowerSupplyVoltageEntry OBJECT-TYPE
-       SYNTAX     ATSCalibrationPowerSupplyVoltageEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-               "An entry containing information applicable to a
-               particular Power Supply Voltage."
-       INDEX { atsCalibrationPowerSupplyVoltageTableIndex }
-       ::= { atsCalibrationPowerSupplyVoltageTable 1 }
-
-   ATSCalibrationPowerSupplyVoltageEntry ::= SEQUENCE {
-       atsCalibrationPowerSupplyVoltageTableIndex     INTEGER,
-       atsCalibrationPowerSupplyVoltage               INTEGER,
-       atsPowerSupplyVoltageCalibrationFactor         INTEGER
-   }
-
-   atsCalibrationPowerSupplyVoltageTableIndex OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-           "The power supply voltage identifier.
-            Three power supply voltages are supported by the ATS:
-             24V , 12V and 5V .
-            The value of this index indicates the power supply voltage:
-             1 = 24V
-             2 = 12V
-             3 = 5V"
-       ::= { atsCalibrationPowerSupplyVoltageEntry 1 }
-
-  atsCalibrationPowerSupplyVoltage OBJECT-TYPE
-    SYNTAX INTEGER  {
-      powerSupply24V(1),
-      powerSupply12V(2),
-      powerSupply(3)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This value describes the power supply voltage."
-   ::= { atsCalibrationPowerSupplyVoltageEntry 2 } 
-
-   atsPowerSupplyVoltageCalibrationFactor  OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The Line Voltage Calibration factor.
-                This value is set at the factory."
-       ::= { atsCalibrationPowerSupplyVoltageEntry 3 }
-
--- Output Current Calibration table
-
-   atsCalibrationNumOutputs OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The number of output lines from this device.
-               This variable indicates the number of rows in the
-               atsCalibrationOutputTable."
-       ::= { atsCalibrationOutput 1 }
-
-   atsCalibrationNumOutputPhases OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The number of output phases utilized in this
-               device."
-       ::= { atsCalibrationOutput 2 }
-
-   atsCalibrationOutputTable OBJECT-TYPE
-       SYNTAX     SEQUENCE OF ATSCalibrationOutputEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-               "A list of output table entries."
-       ::= { atsCalibrationOutput 3 }
-
-   atsCalibrationOutputEntry OBJECT-TYPE
-       SYNTAX     ATSCalibrationOutputEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-               "An entry containing information applicable to a
-                particular output."
-       INDEX { atsCalibrationOutputTableIndex, atsCalibrationOutputPhasesTableIndex }
-       ::= { atsCalibrationOutputTable 1 }
-
-   ATSCalibrationOutputEntry ::= SEQUENCE {
-       atsCalibrationOutputTableIndex       INTEGER,
-       atsCalibrationOutputPhasesTableIndex INTEGER,
-       atsOutputCurrentCalibrationFactor    INTEGER
-   }
-
-   atsCalibrationOutputTableIndex OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The output identifier."
-       ::= { atsCalibrationOutputEntry 1 }
-
-   atsCalibrationOutputPhasesTableIndex OBJECT-TYPE
-       SYNTAX     INTEGER{
-          phase1(1),
-          phase2(2),
-          phase3(3),
-          neutral(4)
-         } 
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "Description of each calibration factor for each 
-                output phase utilized in this device and one for neutral. "
-       ::= { atsCalibrationOutputEntry 2 }
-
-   atsOutputCurrentCalibrationFactor OBJECT-TYPE
-       SYNTAX     INTEGER 
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The output current calibration factor measured in Amps."
-       ::= { atsCalibrationOutputEntry 3 }
-
-
---  the atsControl group  
-           
-atsControlResetATS OBJECT-TYPE
-    SYNTAX INTEGER  {
-          none(1),
-          reset(2) 
-   } 
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this variable will cause the Automatic Transfer Switch to 
-       perform a power-on reset."
-   ::= { atsControl 1 }
-
-atsControlClearAllAlarms OBJECT-TYPE
-    SYNTAX INTEGER  {
-          none(1),
-          clear(2) 
-   } 
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this variable will clear all alarms in the Automatic Transfer Switch."
-   ::= { atsControl 2 }  
-
---  the atsConfig group
-  
-atsConfigProductName OBJECT-TYPE
-       SYNTAX     DisplayString
-       ACCESS     read-write
-       STATUS     mandatory
-       DESCRIPTION
-               "A configurable character string."
-       ::= { atsConfig 1 }
-           
-atsConfigPreferredSource OBJECT-TYPE
-    SYNTAX INTEGER  {
-      sourceA(1),
-      sourceB(2),
-      none(3)
-   } 
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "This variable returns the preferred source of power when both sources are OK."
-   ::= { atsConfig 2 } 
-
-atsConfigFrontPanelLockout OBJECT-TYPE
-   SYNTAX INTEGER  {
-      disableFrontPanel(1),
-      enableFrontPanel(2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Setting this variable to disableFrontPanel(1) will disallow source 
-       preference configuration of the Automatic Transfer Switch via the
-       Front Panel. Once this value is set, it can only be re-enabled through
-       the serial interface of the ATS.
-       When this variable is set to enableFrontPanel(2), source preference 
-       configuration of the Automatic Transfer Switch via the Front Panel
-       is allowed."
-   ::= { atsConfig 3 }
-
-atsConfigVoltageSensitivity OBJECT-TYPE
-   SYNTAX INTEGER {
-      high(1),
-      low(2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "This variable defines the sensitivity to changes in voltage: 
-       high(1) for best protection, low(2) for frequent small line 
-       voltage changes."
-   ::= { atsConfig 4 }
-
-atsConfigTransferVoltageRange OBJECT-TYPE
-   SYNTAX INTEGER {
-      wide(1),
-      medium(2),
-      narrow(3)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "This variable defines the range of acceptable voltage from a power source.
-       If the voltage measured from the selected input source is not within this
-       range, the Automatic Transfer Switch will switch over (transfer) to the 
-       alternate power source."
-
-   ::= { atsConfig 5 }
-
-atsConfigCurrentLimit OBJECT-TYPE
-   SYNTAX INTEGER (0..20)
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The threshold (in Amps) at which an Over Current Alarm will be generated."
-      
-   ::= { atsConfig 6 }
-
-
-atsConfigResetValues OBJECT-TYPE
-   SYNTAX INTEGER {
-      none(1),
-      reset(2) 
-   }
-   ACCESS     read-write
-   STATUS     mandatory
-   DESCRIPTION
-      "Resets the ATS configuration to its default values."
-
-   ::= { atsConfig 7 }
-
--- the atsStatus  group
-
-   atsStatusCommStatus OBJECT-TYPE
-    SYNTAX INTEGER  {
-      atsNeverDiscovered(1),
-      atsCommEstablished(2),
-      atsCommLost(3)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This variable returns the current communication status
-       of the Automatic Transfer Switch. "
-   ::= { atsStatusDeviceStatus 1 }
-
-   atsStatusSelectedSource OBJECT-TYPE
-    SYNTAX INTEGER  {
-      sourceA(1),
-      sourceB(2)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This variable returns the current source of power. "
-   ::= { atsStatusDeviceStatus 2 }
-
-   atsStatusRedundancyState OBJECT-TYPE
-    SYNTAX INTEGER  {
-       atsRedundancyLost(1),
-       atsFullyRedundant(2)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This variable returns the current redundancy state of the ATS.
-       atsRedundancyLost(1) indicates that the ATS is unable to
-       switch over to the alternate power source if the current source fails.
-       atsFullyRedundant(2) indicates that the ATS will switch over to 
-       the alternate power source if the current source fails."
-   ::= { atsStatusDeviceStatus 3 }
-
-  atsStatusOverCurrentState OBJECT-TYPE
-    SYNTAX INTEGER  {
-        atsOverCurrent(1),
-        atsCurrentOK(2)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This variable returns the output current state of the ATS.
-      atsOverCurrent(1) indicates that the ATS has exceeded the output 
-      current threshold and will not allow a switch over to the alternate power
-      source if the current source fails.
-      atsCurrentOK(2) indicates that the output current is below the 
-      output current threshold."
-   ::= { atsStatusDeviceStatus 4 }
-
-  atsStatus5VPowerSupply OBJECT-TYPE
-    SYNTAX INTEGER {
-        atsPowerSupplyFailure(1), 
-        atsPowerSupplyOK(2)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This variable returns the current state of the ATS 5-volt power supply.
-       atsPowerSupplyFailure(1) indicates the 5-volt power supply has failed
-       and that the ATS serial port Configuration Menu is not accessible .
-       atsPowerSupplyOK(2) indicates that the ATS 5-volt power supply
-       is operating within tolerance."
-   ::= { atsStatusDeviceStatus 5 }
-
-  atsStatus24VPowerSupply OBJECT-TYPE
-    SYNTAX INTEGER  {
-        atsPowerSupplyFailure(1),
-        atsPowerSupplyOK(2)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This variable returns the current state of the ATS 24-volt power supply.
-       atsPowerSupplyFailure(1) indicates the 24-volt power supply has failed
-       and the ATS is unable to switch over to the alternate power source if 
-       the current source fails.
-       atsPowerSupplyOK(2) indicates that the ATS 24-volt power supply
-       is operating within tolerance."
-   ::= { atsStatusDeviceStatus 6 }
-
-   atsStatusResetMaxMinValues OBJECT-TYPE
-       SYNTAX INTEGER {
-          none(1),
-          reset(2) 
-       }
-       ACCESS     read-write
-       STATUS     mandatory
-       DESCRIPTION
-               "Resets the maximum and minimum ATS values:
-                atsInputMaxVoltage,       atsInputMinVoltage,
-                atsInputMaxCurrent,       atsInputMinCurrent,
-                atsInputMaxPower,         atsInputMinPower,
-                atsOutputMaxCurrent,      atsOutputMinCurrent,
-                atsOutputMaxLoad,         atsOutputMinLoad,
-                atsOutputMaxPercentLoad,  atsOutputMinPercentLoad,
-                atsOutputMaxPower,        atsOutputMinPower,
-                atsOutputMaxPercentPower, atsOutputMinPercentPower.
-                These variables represent the maximum and minimum ATS values
-                since the last time they were read or reset by this OID.
-                Values unsupported by this ATS will return (-1)."
-       ::= { atsStatusResetValues 1 }
-
---
--- Input Group
---
-
--- Number of Inputs
-
-   atsNumInputs OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The number of input feeds to this device.
-               This variable indicates the number of rows in the
-               input table."
-       ::= { atsStatusInput 1 }
-
--- Input Table
-
-   atsInputTable OBJECT-TYPE
-       SYNTAX     SEQUENCE OF ATSPhaseInputEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-               "A list of input table entries.  The number of entries
-               is given by the value of atsNumInputs."
-       ::= { atsStatusInput 2 }
-
-   atsInputEntry OBJECT-TYPE
-       SYNTAX     ATSPhaseInputEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-               "An entry containing information applicable to a
-               particular input."
-       INDEX { atsInputTableIndex }
-       ::= { atsInputTable 1 }
-
-   ATSPhaseInputEntry ::= SEQUENCE {
-       atsInputTableIndex         INTEGER,
-       atsNumInputPhases          INTEGER,
-       atsInputVoltageOrientation INTEGER,
-       atsInputFrequency          INTEGER,
-       atsInputType               INTEGER,
-       atsInputName               DisplayString
-   }
-
-   atsInputTableIndex OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The input identifier."
-       ::= { atsInputEntry 1 }
-
-   atsNumInputPhases OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The number of input phases utilized in this
-               device.  The sum of all the atsNumInputPhases
-               variable indicates the number of rows in the 
-               input phase table."
-       ::= { atsInputEntry 2 }
-
-   atsInputVoltageOrientation OBJECT-TYPE
-       SYNTAX INTEGER {
-          unknown(1),
-          singlePhase(2),
-          splitPhase(3),
-          threePhasePhaseToNeutral(4),
-          threePhasePhaseToPhase(5)
-       }
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The input voltage orientation: 
-               1: unknown for this Source
-               2: singlePhase - phase 1 voltage is between Phase 1
-               and Neutral.
-               3: splitPhase - phase 1 voltage is between Phase 1 and 
-               Neutral; phase 2 voltage is between Phase 2 and Neutral; 
-               phase 3 voltage is between Phase 1 and Phase2.
-               4: threePhasePhaseToNeutral - phase 1 voltage is between
-               Phase 1 and Neutral; phase 2 voltage is between Phase 2 
-               and Neutral; phase 3 voltage is between Phase3 and
-               Neutral.
-               5: threePhasePhaseToPhase - phase 1 voltage is between 
-               Phase 1 and Phase 2; phase 2 voltage is between Phase 2
-               and Phase 3; phase 3 voltage is between Phase 3 and
-               Phase 1."
-       ::= { atsInputEntry 3 }
-
-   atsInputFrequency OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The input frequency in Hertz, or -1 if it's unsupported
-               by this Source."
-       ::= { atsInputEntry 4 }
-
-   atsInputType OBJECT-TYPE
-       SYNTAX     INTEGER {
-          unknown(1),
-          main(2),
-          bypass(3)
-       }
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The input type."
-       ::= { atsInputEntry 5 }
-
-   atsInputName OBJECT-TYPE
-       SYNTAX     DisplayString
-       ACCESS     read-write
-       STATUS     mandatory
-       DESCRIPTION
-               "A name given to a particular input."
-       ::= { atsInputEntry 6 }
-
--- Input Phase Table
-
-   atsInputPhaseTable OBJECT-TYPE
-       SYNTAX     SEQUENCE OF ATSPhaseInputPhaseEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-               "A list of input table entries.  The number of entries
-               is given by the sum of the atsNumInputPhases."
-       ::= { atsStatusInput 3 }
-
-   atsInputPhaseEntry OBJECT-TYPE
-       SYNTAX     ATSPhaseInputPhaseEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-               "An entry containing information applicable to a
-               particular input phase."
-       INDEX { atsInputPhaseTableIndex, atsInputPhaseIndex }
-       ::= { atsInputPhaseTable 1 }
-
-   ATSPhaseInputPhaseEntry ::= SEQUENCE {
-       atsInputPhaseTableIndex    INTEGER,
-       atsInputPhaseIndex         INTEGER,
-       atsInputVoltage            INTEGER,
-       atsInputMaxVoltage         INTEGER,
-       atsInputMinVoltage         INTEGER,
-       atsInputCurrent            INTEGER,
-       atsInputMaxCurrent         INTEGER,
-       atsInputMinCurrent         INTEGER,
-       atsInputPower              INTEGER,
-       atsInputMaxPower           INTEGER,
-       atsInputMinPower           INTEGER
-   }
-
-   atsInputPhaseTableIndex OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The input identifier."
-       ::= { atsInputPhaseEntry 1 }
-
-   atsInputPhaseIndex OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The input phase identifier."
-       ::= { atsInputPhaseEntry 2 }
-
-   atsInputVoltage OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The input voltage in VAC, or -1 if it's unsupported
-               by this Source."
-       ::= { atsInputPhaseEntry 3 }
-
-   atsInputMaxVoltage OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The maximum input voltage in VAC measured
-                since the last time this variable was read 
-                or reset (atsStatusResetMaxMinValues).
-                Returns (-1) if unsupported."
-       ::= { atsInputPhaseEntry 4 }
-
-   atsInputMinVoltage OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The minimum input voltage in VAC measured
-                since the last time this variable was read 
-                or reset (atsStatusResetMaxMinValues).
-                Returns (-1) if unsupported."
-       ::= { atsInputPhaseEntry 5 }
-
-   atsInputCurrent OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The input current in amperes, or -1 if it's
-               unsupported by this Source."
-       ::= { atsInputPhaseEntry 6 }
-
-   atsInputMaxCurrent OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The maximum input current in amperes measured
-                 since the last time this variable was read 
-                or reset (atsStatusResetMaxMinValues).
-                Returns (-1) if unsupported."
-       ::= { atsInputPhaseEntry 7 }
-
-   atsInputMinCurrent OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The minimum input current in amperes measured
-                since the last time this variable was read 
-                or reset (atsStatusResetMaxMinValues).
-                Returns (-1) if unsupported."
-       ::= { atsInputPhaseEntry 8 }
-
-   atsInputPower OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The input power in Watts, or -1 if it's unsupported
-               by this Source."
-       ::= { atsInputPhaseEntry 9 }
-
-   atsInputMaxPower OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The maximum input power in Watts measured
-                since the last time this variable was read 
-                or reset (atsStatusResetMaxMinValues).
-                Returns (-1) if unsupported."
-       ::= { atsInputPhaseEntry 10 }
-
-   atsInputMinPower OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The minimum input power in Watts measured
-                since the last time this variable was read 
-                or reset (atsStatusResetMaxMinValues).
-                Returns (-1) if unsupported."
-       ::= { atsInputPhaseEntry 11 }
-
-   --
-   -- The Output group.
-   --
-
-   -- Number of Outputs
-
-   atsNumOutputs OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The number of output feeds to this device.
-               This variable indicates the number of rows in the
-               output table."
-       ::= { atsStatusOutput 1 }
-
-   -- Output Table
-
-   atsOutputTable OBJECT-TYPE
-       SYNTAX     SEQUENCE OF ATSPhaseOutputEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-               "A list of output table entries.  The number of entries
-               is given by the value of atsOutputNumPhases."
-       ::= { atsStatusOutput 2 }
-
-   atsOutputEntry OBJECT-TYPE
-       SYNTAX     ATSPhaseOutputEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-               "An entry containing information applicable to a
-               particular output."
-       INDEX { atsOutputTableIndex }
-       ::= { atsOutputTable 1 }
-
-   ATSPhaseOutputEntry ::= SEQUENCE {
-       atsOutputTableIndex         INTEGER,
-       atsNumOutputPhases          INTEGER,
-       atsOutputVoltageOrientation INTEGER,
-       atsOutputFrequency          INTEGER
-   }
-
-   atsOutputTableIndex OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The output identifier."
-       ::= { atsOutputEntry 1 }
-
-   atsNumOutputPhases OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The number of output phases utilized in this
-               device.  The sum of all the atsNumOutputPhases
-               variable indicates the number of rows in the 
-               output phase table."
-       ::= { atsOutputEntry 2 }
-
-   atsOutputVoltageOrientation OBJECT-TYPE
-       SYNTAX INTEGER {
-          unknown(1),
-          singlePhase(2),
-          splitPhase(3),
-          threePhasePhaseToNeutral(4),
-          threePhasePhaseToPhase(5)
-       }
-       ACCESS read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The output voltage orientation: 
-               1: unknown for this ATS
-               2: singlePhase - phase 1 voltage is between Phase 1
-               and Neutral.
-               3: splitPhase - phase 1 voltage is between Phase 1 and 
-               Neutral; phase 2 voltage is between Phase 2 and Neutral; 
-               phase 3 voltage is between Phase 1 and Phase2.
-               4: threePhasePhaseToNeutral - phase 1 voltage is between
-               Phase 1 and Neutral; phase 2 voltage is between Phase 2 
-               and Neutral; phase 3 voltage is between Phase3 and
-               Neutral.
-               5: threePhasePhaseToPhase - phase 1 voltage is between 
-               Phase 1 and Phase 2; phase 2 voltage is between Phase 2
-               and Phase 3; phase 3 voltage is between Phase 3 and
-               Phase 1."
-       ::= { atsOutputEntry 3 }
-
-   atsOutputFrequency OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The output frequency in Hertz, or -1 if it's
-               unsupported by this ATS."
-       ::= { atsOutputEntry 4 }
-
-   -- Output Phase Table
-
-   atsOutputPhaseTable OBJECT-TYPE
-       SYNTAX     SEQUENCE OF ATSPhaseOutputPhaseEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-               "A list of output table entries.  The number of
-               entries is given by the sum of the atsNumOutputPhases."
-       ::= { atsStatusOutput 3 }
-
-   atsOutputPhaseEntry OBJECT-TYPE
-       SYNTAX     ATSPhaseOutputPhaseEntry
-       ACCESS     not-accessible
-       STATUS     mandatory
-       DESCRIPTION
-               "An entry containing information applicable to a
-               particular output phase."
-       INDEX { atsOutputPhaseTableIndex, atsOutputPhaseIndex }
-       ::= { atsOutputPhaseTable 1 }
-
-   ATSPhaseOutputPhaseEntry ::= SEQUENCE {
-       atsOutputPhaseTableIndex INTEGER,
-       atsOutputPhaseIndex      INTEGER,
-       atsOutputVoltage         INTEGER,
-       atsOutputCurrent         INTEGER,
-       atsOutputMaxCurrent      INTEGER,
-       atsOutputMinCurrent      INTEGER,
-       atsOutputLoad            INTEGER,
-       atsOutputMaxLoad         INTEGER,
-       atsOutputMinLoad         INTEGER,
-       atsOutputPercentLoad     INTEGER,
-       atsOutputMaxPercentLoad  INTEGER,
-       atsOutputMinPercentLoad  INTEGER,       
-       atsOutputPower           INTEGER,
-       atsOutputMaxPower        INTEGER,
-       atsOutputMinPower        INTEGER,
-       atsOutputPercentPower    INTEGER,
-       atsOutputMaxPercentPower INTEGER,
-       atsOutputMinPercentPower INTEGER
-   }
-
-   atsOutputPhaseTableIndex OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The output identifier."
-       ::= { atsOutputPhaseEntry 1 }
-
-   atsOutputPhaseIndex OBJECT-TYPE
-       SYNTAX     INTEGER{
-          phase1(1),
-          phase2(2),
-          phase3(3),
-          neutral(4)
-         } 
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-              "Description of each output phase utilized in 
-               this device and one for neutral. "
-       ::= { atsOutputPhaseEntry 2 }
-
-   atsOutputVoltage OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The output voltage in VAC, or -1 if it's unsupported
-               by this ATS."
-       ::= { atsOutputPhaseEntry 3 }
-
-   atsOutputCurrent OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The output current in 0.1 amperes drawn 
-               by the load on the ATS, or -1 if it's unsupported
-               by this ATS."
-       ::= { atsOutputPhaseEntry 4 }
-
-   atsOutputMaxCurrent OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The maximum output current in 0.1 amperes measured
-                since the last time this variable was read 
-                or reset (atsStatusResetMaxMinValues).
-                Returns (-1) if unsupported."
-       ::= { atsOutputPhaseEntry 5 }
-
-   atsOutputMinCurrent OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The minimum output current in 0.1 amperes measured
-                since the last time this variable was read 
-                or reset (atsStatusResetMaxMinValues).
-                Returns (-1) if unsupported."
-       ::= { atsOutputPhaseEntry 6 }
-
-   atsOutputLoad OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The output load in VA, or -1 if it's unsupported
-               by this ATS."
-       ::= { atsOutputPhaseEntry 7 }
-
-   atsOutputMaxLoad OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The maximum output load in VA measured
-                since the last time this variable was read 
-                or reset (atsStatusResetMaxMinValues).
-                Returns (-1)  if unsupported."
-       ::= { atsOutputPhaseEntry 8 }
-
-   atsOutputMinLoad OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The minimum output load in VA measured
-                since the last time this variable was read 
-                or reset (atsStatusResetMaxMinValues).
-                Returns (-1) if unsupported."
-       ::= { atsOutputPhaseEntry 9 }
-
-   atsOutputPercentLoad OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The percentage of the ATS load capacity in VA at 
-               redundancy @ (n + x) presently being used on this 
-               output phase, or -1 if it's unsupported by this ATS."
-       ::= { atsOutputPhaseEntry 10 }
-
-   atsOutputMaxPercentLoad OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The maximum percentage of the ATS load capacity in 
-               VA measured at redundancy @ (n + x) presently 
-               being used on this output phase since the last time
-               this variable was read or reset (atsStatusResetMaxMinValues).
-               Returns (-1) if unsupported."
-       ::= { atsOutputPhaseEntry 11 }
-
-   atsOutputMinPercentLoad OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The minimum percentage of the ATS load capacity in 
-               VA measured at redundancy @ (n + x) presently 
-               being used on this output phase since the last time
-               this variable was read or reset (atsStatusResetMaxMinValues).
-               Returns (-1) if unsupported."
-       ::= { atsOutputPhaseEntry 12 }
-
-   atsOutputPower OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The output power in Watts, or -1 if it's
-               unsupported by this ATS."
-       ::= { atsOutputPhaseEntry 13 }
-
-   atsOutputMaxPower OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The maximum output power in Watts measured
-                since the last time this variable was read 
-                or reset (atsStatusResetMaxMinValues).
-                Returns (-1) if unsupported."
-       ::= { atsOutputPhaseEntry 14 }
-
-   atsOutputMinPower OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The minimum output power in Watts measured
-                since the last time this variable was read 
-                or reset (atsStatusResetMaxMinValues).
-                Returns (-1) if unsupported."
-       ::= { atsOutputPhaseEntry 15 }
-
-   atsOutputPercentPower OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The percentage of the ATSpower capacity in Watts at 
-               redundancy @ (n + x) presently being used on this 
-               output phase, or -1 if it's unsupported by this ATS."
-       ::= { atsOutputPhaseEntry 16 }
-
-   atsOutputMaxPercentPower OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The maximum percentage of the ATSpower capacity
-               in Watts measured at redundancy @ (n + x) presently
-               being used on this output phase since the last time
-               this variable was read or reset (atsStatusResetMaxMinValues).
-               Returns (-1) if unsupported."
-       ::= { atsOutputPhaseEntry 17 }
-
-   atsOutputMinPercentPower OBJECT-TYPE
-       SYNTAX     INTEGER
-       ACCESS     read-only
-       STATUS     mandatory
-       DESCRIPTION
-               "The minimum percentage of the ATSpower capacity
-               in Watts measured at redundancy @ (n + x) presently
-               being used on this output phase since the last time
-               this variable was read or reset (atsStatusResetMaxMinValues).
-               Returns (-1) if unsupported."
-       ::= { atsOutputPhaseEntry 18 }
-
--- the dcmim2IdentSystem group
- 
-dcmim2IdentSysFWVersion OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Integer representation of the power plant Master Controller firmware revision."
-   ::= { dcmim2IdentSystem 1 }
-
-
--- the dcmim2ControlSystem group
-
-dcmim2ControlRunFunctBatteryTest OBJECT-TYPE
-   SYNTAX INTEGER {
-      battTestOff             (1),
-      battTestOn              (2)
-}     
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-       "Getting this OID will return the battery functional test state. If 
-       the test is off, the battTestOff (1) value will be returned.
-       If the test is on, the battTestOn (2) value will be
-       returned.  
-       
-       Setting this OID to battTestOff (1) will turn the battery functional test off.
-       Setting this OID to battTestOn (2) will turn the battery functional test on."
-
-   ::= { dcmim2ControlSystem 1 }
-
-dcmim2ControlRunCapacityBatteryTest OBJECT-TYPE
-   SYNTAX INTEGER {
-      battTestOff             (1),
-      battTestOn              (2)
-}     
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-       "Getting this OID will return the battery capacity test state. If 
-       the test is off, the battTestOff (1) value will be returned.
-       If the test is on, the battTestOn (2) value will be
-       returned.  
-       
-       Setting this OID to battTestOff (1) will turn the battery capacity test off.
-       Setting this OID to battTestOn (2) will turn the battery capacity test on."
-
-   ::= { dcmim2ControlSystem 2 }
-
-
--- the dcmim2ConfigSystem group
-
-dcmim2ConfigSysHighTempTrip OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Trip level (threshold) at which System High Temp alarm condition is created. 
-       Range 28 to 100 (degC).
-
-       Values are represented in thousandths of a degree.
-       Units are displayed in the scale shown in
-       the 'dcmim2StatusSysTempUnits' OID (Celsius or Fahrenheit)."
-       
-      
-   ::= { dcmim2ConfigSystem 1 }
-
-dcmim2ConfigSysHighTempReset OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Level at which System High Temp alarm condition is reset (cleared). 
-       Range 25 to (upper temp - 3) (degC).
-       
-       Values are represented in thousandths of a degree.
-       Units are displayed in the scale shown in
-       the 'dcmim2StatusSysTempUnits' OID (Celsius or Fahrenheit)."
-       
-   ::= { dcmim2ConfigSystem 2 }
-      
-dcmim2ConfigSysLowTempTrip OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Trip level (threshold) at which System Low Temp alarm condition is created. 
-       Range -100 to 10 (degC).
-       Values are represented in thousandths of a degree.
-       Units are displayed in the scale shown in
-       the 'dcmim2StatusSysTempUnits' OID (Celsius or Fahrenheit)."
-      
-   ::= { dcmim2ConfigSystem 3 }
-
-dcmim2ConfigSysLowTempReset OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Level at which System Low Temp alarm condition is reset (cleared). 
-       Range (lower temp + 3) to 13 (degC).
-       Values are represented in thousandths of a degree.
-       Units are displayed in the scale shown in
-       the 'dcmim2StatusSysTempUnits' OID (Celsius or Fahrenheit)."
-      
-   ::= { dcmim2ConfigSystem 4 }
-
--- the dcmim2ConfigBattery group
-
-dcmim2ConfigBattFloatVolt OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Battery Float Voltage defined at 25 degrees Celsius.
-      
-      Values are represented in thousandths of Volts (mV)."
-      
-   ::= { dcmim2ConfigBattery 1 }
-
-dcmim2ConfigBattMaxRecharge OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Battery Maximum Recharge Rate.  This is the maximum current used
-       during battery charging.  
-      
-      Values are represented in thousandths of Amps (mA)."
-      
-   ::= { dcmim2ConfigBattery 2 }
-
-dcmim2ConfigBattMfgCapacity OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Battery capacity (Amp-Hour Size) as specified by the battery manufacturer.
-  
-      Values are represented in thousandths of Amp hours (mAHr)."
-      
-   ::= { dcmim2ConfigBattery 3 }
-   
-dcmim2ConfigBattType OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Type of battery in the powerplant
-      
-      Valid values range from 0 to 254."
-      
-   ::= { dcmim2ConfigBattery 4 }
-   
-dcmim2ConfigBattFunctTestDuration OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Duration of the battery functional test.
-      
-      Values are represented in thousandths of seconds (mSecs)."
-      
-   ::= { dcmim2ConfigBattery 5 }
-   
-dcmim2ConfigBattFunctTestThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Threshold the battery voltage of the system must remain above
-       in order to pass the battery functional test.
-      
-      Values are represented in thousandths of Volts (mV)."
-      
-   ::= { dcmim2ConfigBattery 6 }
-   
-dcmim2ConfigBattCapacityTestPercent OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Threshold for good battery capacity test results.
-      
-      Values range from 0 to 100 percent."
-      
-   ::= { dcmim2ConfigBattery 7 }
-   
-dcmim2ConfigBattCapacityTestEndThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Safeguard voltage at which battery capacity test will end 
-       if there is a battery problem.
-      
-      Values are represented in thousandths of Volts (mV)."
-      
-   ::= { dcmim2ConfigBattery 8 }
-   
-dcmim2ConfigBattCapacityTestCurrent OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Constant current value used during battery capacity testing.
-      
-      Values are represented in thousandths of Amps (mA)."
-      
-   ::= { dcmim2ConfigBattery 9 }
-
-
--- the dcmim2ConfigLVD group
-
-dcmim2ConfigLVDTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of DC powerplant LVDs controllable
-       by this IP address."
-   ::= { dcmim2ConfigLVD 1 }
-
-dcmim2ConfigLVDTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF DC2ConfigLVDEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for accessing settings of the LVDs. The number of
-       entries is contained in the dcmim2ConfigLVDTableSize OID."
-   ::= { dcmim2ConfigLVD 2 }      
-
-dcmim2ConfigLVDEntry OBJECT-TYPE
-   SYNTAX DC2ConfigLVDEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The LVD to configure."
-   INDEX { dcmim2ConfigLVDIndex }
-   ::= { dcmim2ConfigLVDTable 1 }
-   
-DC2ConfigLVDEntry ::=
-   SEQUENCE {
-      dcmim2ConfigLVDIndex               INTEGER,
-      dcmim2ConfigLVDTrip                INTEGER,
-      dcmim2ConfigLVDReset               INTEGER,
-      dcmim2ConfigLVDState               INTEGER
-   }
-   
-dcmim2ConfigLVDIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the DC powerplant LVD."
-   ::= { dcmim2ConfigLVDEntry 1 }
-
-dcmim2ConfigLVDTrip OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "LVD Trip threshold.  System bus voltage at which LVD will trip (open)
-       during a battery backup operation.
-      
-      Values are represented in thousandths of Volts (mV)."
-   ::= { dcmim2ConfigLVDEntry 2 }
-
-dcmim2ConfigLVDReset OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "LVD Reset threshold.  System bus voltage at which LVD will reset (close)
-       after AC power has been restored.
-      
-      Values are represented in thousandths of Volts (mV)."
-   ::= { dcmim2ConfigLVDEntry 3 }
-   
-dcmim2ConfigLVDState OBJECT-TYPE
-   SYNTAX INTEGER       {
-      statusClosed             (1),
-      statusOpened             (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return statusClosed (1) if the LVD is closed.
-       statusOpened (2) will be returned if the LVD is opened." 
-   ::= { dcmim2ConfigLVDEntry 4 }
-
-
--- the dcmim2StatusSystem group
-
-dcmim2StatusSysRectCurrent OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "System (Total Rectifier) current in thousandths of Amps (mA)."
-   ::= { dcmim2StatusSystem 1 }
-
-dcmim2StatusSysLoadCurrent OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Load current in thousandths of Amps (mA)."
-   ::= { dcmim2StatusSystem 2 }
-
-dcmim2StatusSysBusVoltage OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "System bus voltage in thousandths of Volts (mV)."
-   ::= { dcmim2StatusSystem 3 }
-
-dcmim2StatusSysAmbientTemp OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "System temperature based on sensor on Master Controller PCB.
-      
-      Values are represented in thousandths of a degree.
-      Units are displayed in the scale shown in
-      the 'dcmim2StatusSysTempUnits' OID (Celsius or Fahrenheit)."
-   ::= { dcmim2StatusSystem 4 }
-
-dcmim2StatusSysUpTime OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Length of time since the DC Powerplant controller has been powered up."
-   ::= { dcmim2StatusSystem 5 }
-
-dcmim2StatusSysTempUnits OBJECT-TYPE
-   SYNTAX INTEGER {
-      celsius(1),
-      fahrenheit(2)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The temperature scale used to display the temperature
-       in the DC system, Celsius(1) or Fahrenheit(2).
-       This setting is based on the system preferences
-       configuration in the agent."
-   ::= { dcmim2StatusSystem 6 }
-
-
--- the dcmim2StatusRectifier group
-
-dcmim2StatusRectTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of DC powerplant rectifiers viewable
-       by this IP address."
-   ::= { dcmim2StatusRectifier 1 }
-
-dcmim2StatusRectTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF DC2StatusRectEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for accessing settings of the rectifiers. The number of
-       entries is contained in the dcmim2StatusRectTableSize OID."
-   ::= { dcmim2StatusRectifier 2 }    
-
-dcmim2StatusRectEntry OBJECT-TYPE
-   SYNTAX DC2StatusRectEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The rectifier to gather status from."
-   INDEX { dcmim2StatusRectIndex }
-   ::= { dcmim2StatusRectTable 1 }
-   
-DC2StatusRectEntry ::=
-   SEQUENCE {
-      dcmim2StatusRectIndex            INTEGER,
-      dcmim2StatusRectDevType          INTEGER,
-      dcmim2StatusRectID               INTEGER,
-      dcmim2StatusRectPhyAddr          INTEGER,
-      dcmim2StatusRectFail             INTEGER,
-      dcmim2StatusRectCurrent          INTEGER
-   }
-
-dcmim2StatusRectIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the DC powerplant rectifier."
-   ::= { dcmim2StatusRectEntry 1 }
-
-dcmim2StatusRectDevType OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the rectifier device type."
-   ::= { dcmim2StatusRectEntry 2 }
-
-dcmim2StatusRectID OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the rectifier ID.  This enumerates the number of the rectifier within 
-       a group of rectifiers."
-   ::= { dcmim2StatusRectEntry 3 }
-
-dcmim2StatusRectPhyAddr OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the rectifier physical address (the address on the bus)."
-   ::= { dcmim2StatusRectEntry 4 }
-
-dcmim2StatusRectFail    OBJECT-TYPE
-   SYNTAX INTEGER       {
-      statusTrue          (1),
-      statusFalse         (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return statusTrue (1) if the rectifier has failed.
-       statusFalse (2) will be returned if the rectifier has not failed." 
-   ::= { dcmim2StatusRectEntry 5 }
-
-dcmim2StatusRectCurrent OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID shows the individual rectifier current in thousandths of Amps (mA)."
-   ::= { dcmim2StatusRectEntry 6 }
-
-
--- the dcmim2StatusBattery group
-
-dcmim2StatusBattFloatVolt OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Battery Float Voltage represented in thousandths of Volts (mV)."   
-   ::= { dcmim2StatusBattery 1 }
-
-dcmim2StatusBattCurrent OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Battery Current:  This OID shows the battery current in thousandths of Amps (mA)."
-   ::= { dcmim2StatusBattery 2 }
-
-dcmim2StatusBattTemp OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Battery Temperature:  
-      
-       Values are represented in thousandths of a degree.
-       Units are displayed in the scale shown in
-       the 'dcmim2StatusSysTempUnits' OID (Celsius or Fahrenheit)."
-   ::= { dcmim2StatusBattery 3 }
-
-dcmim2StatusBattMfgCapacity OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Battery capacity (Amp-Hour Size) as specified by the battery manufacturer.
-      Values are represented in thousandths of Amp hours (mAHr)."
-   ::= { dcmim2StatusBattery 4 }
-
-dcmim2StatusBattTestCapacity OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Battery capacity (Amp-Hour Size) as determined by the battery capacity test.  
-      Values are represented in thousandths of Amp hours (mAHr)."     
-   ::= { dcmim2StatusBattery 5 }
-
-dcmim2StatusBattFunctTestResult OBJECT-TYPE
-   SYNTAX INTEGER{
-      functTestNotPerformed   (1),
-      functTestInProcess      (2),
-      functTestInterrupted    (3),
-      functTestPass           (4),
-      functTestFail           (5)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Results of the last battery functional test that was run."
-   ::= { dcmim2StatusBattery 6 }
-
-dcmim2StatusBattCapacityTestResult OBJECT-TYPE
-   SYNTAX INTEGER{
-      capacityTestNotPerformed   (1),
-      capacityTestInProcess      (2),
-      capacityTestInterrupted    (3),
-      capacityTestPass           (4),
-      capacityTestFail            (5)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Results of the last battery capacity test that was run."
-   ::= { dcmim2StatusBattery 7 }
-
-
--- the dcmim2StatusLVD group
-
-dcmim2StatusLVDTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of DC powerplant LVDs accessible
-       by this IP address."
-   ::= { dcmim2StatusLVD 1 }
-
-dcmim2StatusLVDTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF DC2StatusLVDEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for accessing the LVDs. The number of
-       entries is contained in the dcmim2StatusLVDTableSize OID."
-   ::= { dcmim2StatusLVD 2 }      
-
-dcmim2StatusLVDEntry OBJECT-TYPE
-   SYNTAX DC2StatusLVDEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The LVD to access."
-   INDEX { dcmim2StatusLVDIndex }
-   ::= { dcmim2StatusLVDTable 1 }
-   
-DC2StatusLVDEntry ::=
-   SEQUENCE {
-      dcmim2StatusLVDIndex               INTEGER,
-      dcmim2StatusLVDState               INTEGER
-   }
-   
-dcmim2StatusLVDIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the DC powerplant LVD."
-   ::= { dcmim2StatusLVDEntry 1 }
-  
-dcmim2StatusLVDState OBJECT-TYPE
-   SYNTAX INTEGER       {
-      statusClosed             (1),
-      statusOpened             (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Getting this OID will return statusClosed (1) if the LVD is closed.
-       statusOpened (2) will be returned if the LVD is opened." 
-   ::= { dcmim2StatusLVDEntry 2 }
-
-
--- the dcmim2StatusAlarms group
-
-dcmim2StatusAlarmsTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of DC powerplant alarms viewable
-       by this IP address."
-   ::= { dcmim2StatusAlarms 1 }
-
-dcmim2StatusAlarmsTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF DC2StatusAlarmsEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for accessing system alarms. The number of
-       entries is contained in the dcmim2StatusAlarmsTableSize OID."
-   ::= { dcmim2StatusAlarms 2 }       
-
-dcmim2StatusAlarmsEntry OBJECT-TYPE
-   SYNTAX DC2StatusAlarmsEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The alarm to display."
-   INDEX { dcmim2StatusAlarmsIndex }
-   ::= { dcmim2StatusAlarmsTable 1 }
-   
-DC2StatusAlarmsEntry ::=
-   SEQUENCE {   
-      dcmim2StatusAlarmsIndex               INTEGER,
-      dcmim2StatusAlarmsText                DisplayString
-   }
-
-dcmim2StatusAlarmsIndex OBJECT-TYPE
-   SYNTAX  INTEGER
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The index of the system alarm."       
-   ::= { dcmim2StatusAlarmsEntry 1 }
-   
-dcmim2StatusAlarmsText OBJECT-TYPE
-   SYNTAX  DisplayString
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The 16 character text describing the active alarm condition."
-   ::= { dcmim2StatusAlarmsEntry 2 }
-
--- External Environmental Monitor
-
-emIdentFirmwareRevision OBJECT-TYPE
-   SYNTAX DisplayString 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The firmware revision of the Environmental Monitor."
-   ::= { emIdent 1 }
-
-emConfigProbesNumProbes OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of temperature and humidity probes available."
-   ::= { emConfig 1 }
-
-emConfigProbesTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF EmConfigProbesEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "A list of probes supported by the Environmental Monitor
-       and their configurations."
-   ::= { emConfig 2 }
-
-emConfigProbesEntry OBJECT-TYPE
-   SYNTAX EmConfigProbesEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The Environmental Monitor probe configurations."
-   INDEX  { emConfigProbeNumber }
-   ::= { emConfigProbesTable 1 }
-
-EmConfigProbesEntry ::=
-   SEQUENCE {
-      emConfigProbeNumber
-         INTEGER,
-      emConfigProbeName
-         DisplayString,
-      emConfigProbeHighTempThreshold
-         INTEGER,
-      emConfigProbeLowTempThreshold
-         INTEGER,
-      emConfigProbeTempUnits
-         INTEGER,
-      emConfigProbeHighHumidThreshold
-         INTEGER,
-      emConfigProbeLowHumidThreshold
-         INTEGER,
-      emConfigProbeHighTempEnable
-         INTEGER,
-      emConfigProbeLowTempEnable
-         INTEGER,
-      emConfigProbeHighHumidEnable
-         INTEGER,
-      emConfigProbeLowHumidEnable
-         INTEGER
-   }
-
-emConfigProbeNumber OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index into an Environmental Monitor probe entry."
-   ::= { emConfigProbesEntry 1 }
-
-emConfigProbeName OBJECT-TYPE
-   SYNTAX DisplayString 
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "A descriptive name of the probe set by the user,
-       possibly denoting its location or purpose."
-   ::= { emConfigProbesEntry 2 }
-
-emConfigProbeHighTempThreshold OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The high temperature alarm threshold for the probe.
-       Units are displayed in the scale selected in
-       the 'emConfigProbeTempUnits' OID (Celsius or Fahrenheit)."
-   ::= { emConfigProbesEntry 3 }
-
-emConfigProbeLowTempThreshold OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The low temperature alarm threshold for the probe.
-       Units are displayed in the scale selected in
-       the 'emConfigProbeTempUnits' OID (Celsius or Fahrenheit)."
-   ::= { emConfigProbesEntry 4 }
-
-emConfigProbeTempUnits OBJECT-TYPE
-   SYNTAX INTEGER {
-      celsius(1),
-      fahrenheit(2)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The temperature scale used to display the temperature
-       thresholds of the probe, Celsius(1) or Fahrenheit(2).
-       This setting is based on the system preferences
-       configuration in the agent."
-   ::= { emConfigProbesEntry 5 }
-
-emConfigProbeHighHumidThreshold OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The high humidity alarm threshold for the probe in
-      percent relative humidity."
-   ::= { emConfigProbesEntry 6 }
-
-emConfigProbeLowHumidThreshold OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The low humidity alarm threshold for the probe in
-      percent relative humidity."
-   ::= { emConfigProbesEntry 7 }
-
-emConfigProbeHighTempEnable OBJECT-TYPE
-   SYNTAX INTEGER {
-      disabled(1),
-      enabled(2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The high temperature alarm enable/disable for the
-       probe. No alarm will be generated if this value
-       is set to disabled(1). The alarm will be 
-       generated if this value is set to enabled(2) and
-       the threshold has been violated."
-   ::= { emConfigProbesEntry 8 }
-
-emConfigProbeLowTempEnable OBJECT-TYPE
-   SYNTAX INTEGER {
-      disabled(1),
-      enabled(2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The low temperature alarm enable/disable for the
-       probe. No alarm will be generated if this value
-       is set to disabled(1). The alarm will be 
-       generated if this value is set to enabled(2) and
-       the threshold has been violated."
-   ::= { emConfigProbesEntry 9 }
-
-emConfigProbeHighHumidEnable OBJECT-TYPE
-   SYNTAX INTEGER {
-      disabled(1),
-      enabled(2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The high humidity alarm enable/disable for the
-       probe. No alarm will be generated if this value
-       is set to disabled(1). The alarm will be 
-       generated if this value is set to enabled(2) and
-       the threshold has been violated."
-   ::= { emConfigProbesEntry 10 }
-
-emConfigProbeLowHumidEnable OBJECT-TYPE
-   SYNTAX INTEGER {
-      disabled(1),
-      enabled(2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The low humidity alarm enable/disable for the
-       probe. No alarm will be generated if this value
-       is set to disabled(1). The alarm will be 
-       generated if this value is set to enabled(2) and
-       the threshold has been violated."
-   ::= { emConfigProbesEntry 11 }
-
-emConfigContactsNumContacts OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of contacts supported by the Environmental
-       Monitor."
-   ::= { emConfig 3 }
-
-emConfigContactsTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF EmConfigContactsEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "A list of contacts supported by the Environmental Monitor
-       and their configurations."
-   ::= { emConfig 4 }
-
-emConfigContactsEntry OBJECT-TYPE
-   SYNTAX EmConfigContactsEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The Environmental Monitor contact configurations."
-   INDEX  { emConfigContactNumber }
-   ::= { emConfigContactsTable 1 }
-
-EmConfigContactsEntry ::=
-   SEQUENCE {
-       emConfigContactNumber
-           INTEGER,
-       emConfigContactName
-           DisplayString,
-       emConfigContactEnable
-           INTEGER
-   }
-
-emConfigContactNumber OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index of an Environmental Monitor contact."
-   ::= { emConfigContactsEntry 1 }
-
-emConfigContactName OBJECT-TYPE
-   SYNTAX DisplayString 
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "A descriptive name for an Environmental Monitor
-      contact set by the user, possibly denoting its
-      location or purpose."
-   ::= { emConfigContactsEntry 2 }
-
-emConfigContactEnable OBJECT-TYPE
-   SYNTAX INTEGER {
-      disabled(1),
-      enabled(2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "An Environmental Monitor contact alarm enable/disable.
-       No alarm will be generated if the contact is disabled(1).
-       An alarm will be generated if the contact is enabled(2)
-       and the contact has been faulted."
-   ::= { emConfigContactsEntry 3 }
-
-emStatusCommStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-      noComm(1),
-      comm(2),
-      commLost(3)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The communication status between the agent
-       and the Environmental Monitor.
-       
-       noComm(1),   Communication has never been established.
-       comm(2),     Communication has been established.
-       commLost(3), Communication was established, but was lost."
-   ::= { emStatus 1 }
-
-emStatusProbesNumProbes OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of available probes on the Environmental
-       Monitor."
-   ::= { emStatus 2 }
-
-emStatusProbesTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF EmStatusProbesEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "A list of probes supported by the Environmental Monitor
-       and their status."
-   ::= { emStatus 3 }
-
-emStatusProbesEntry OBJECT-TYPE
-   SYNTAX EmStatusProbesEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the probe."
-   INDEX  { emStatusProbeNumber }
-   ::= { emStatusProbesTable 1 }
-
-EmStatusProbesEntry ::=
-   SEQUENCE {
-      emStatusProbeNumber
-         INTEGER,
-      emStatusProbeName
-         DisplayString,
-      emStatusProbeStatus
-         INTEGER,
-      emStatusProbeCurrentTemp
-         INTEGER,
-      emStatusProbeTempUnits
-         INTEGER,
-      emStatusProbeCurrentHumid
-         INTEGER,
-      emStatusProbeHighTempViolation
-         INTEGER,
-      emStatusProbeLowTempViolation
-         INTEGER,
-      emStatusProbeHighHumidViolation
-         INTEGER,
-      emStatusProbeLowHumidViolation
-         INTEGER
-   }
-
-emStatusProbeNumber OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index of the probe."
-   ::= { emStatusProbesEntry 1 }
-
-emStatusProbeName OBJECT-TYPE
-   SYNTAX DisplayString 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A descriptive name for the probe set by the user,
-       possibly denoting its location or purpose."
-   ::= { emStatusProbesEntry 2 }
-
-emStatusProbeStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-      disconnected(1),
-      connected(2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The connected status of the probe, either      
-      disconnected(1) or connected(2)."
-   ::= { emStatusProbesEntry 3 }
-
-emStatusProbeCurrentTemp OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The current temperature reading from the probe displayed
-       in the units shown in the 'emStatusProbeTempUnits' OID
-       (Celsius or Fahrenheit)."
-   ::= { emStatusProbesEntry 4 }
-
-emStatusProbeTempUnits OBJECT-TYPE
-   SYNTAX INTEGER {
-      celsius(1),
-      fahrenheit(2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The temperature scale used to display the temperature
-       thresholds of the probe, Celsius(1) or Fahrenheit(2).
-       This setting is based on the system preferences
-       configuration in the agent."
-   ::= { emStatusProbesEntry 5 }
-
-emStatusProbeCurrentHumid OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The current humidity reading from the probe in
-       percent relative humidity."
-   ::= { emStatusProbesEntry 6 }
-
-emStatusProbeHighTempViolation OBJECT-TYPE
-   SYNTAX INTEGER {
-      noViolation(1),
-      highTempViolation(2),
-      disabled(3)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The high temperature violation status of the probe
-       temperature reading. This OID will show a highTempViolation(2)
-       if the current temperature reading shown in the
-       'emStatusProbeCurrentTemp' OID is greater than or equal to
-       the high temperature threshold value, the 
-       'emConfigProbeHighTempThreshold' OID, and the value of the
-       'emConfigProbeHighTempEnable' OID is enabled. Otherwise it will show
-       noViolation(1). If the 'emConfigProbeHighTempEnable' OID is disabled,
-       this OID will show disabled(3)."
-   ::= { emStatusProbesEntry 7 }
-
-emStatusProbeLowTempViolation OBJECT-TYPE
-   SYNTAX INTEGER {
-      noViolation(1),
-      lowTempViolation(2),
-      disabled(3)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The high temperature violation status of the probe
-       temperature reading. This OID will show a lowTempViolation(2)
-       if the current temperature reading shown in the
-       'emStatusProbeCurrentTemp' OID is less than or equal to
-       the low temperature threshold value, the 
-       'emConfigProbeLowTempThreshold' OID, and the value of the
-       'emConfigProbeLowTempEnable' OID is enabled. Otherwise it will show
-       noViolation(1). If the 'emConfigProbeLowTempEnable' OID is disabled,
-       this OID will show disabled(3)."
-   ::= { emStatusProbesEntry 8 }
-
-emStatusProbeHighHumidViolation OBJECT-TYPE
-   SYNTAX INTEGER {
-      noViolation(1),
-      highHumidViolation(2),
-      disabled(3)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The high humidity violation status of the probe humidity
-       reading. This OID will show a highTempViolation(2)
-       if the current humidity reading shown in the
-       'emStatusProbeCurrentHumid' OID is greater than or equal to
-       the high humidity threshold value, the 
-       'emConfigProbeHighHumidThreshold' OID, and the value of the
-       'emConfigProbeHighHumidEnable' OID is enabled. Otherwise it will
-       show noViolation(1).  If the 'emConfigProbeHighHumidEnable' OID is
-       disabled, this OID will show disabled(3)"
-   ::= { emStatusProbesEntry 9 }
-
-emStatusProbeLowHumidViolation OBJECT-TYPE
-   SYNTAX INTEGER {
-      noViolation(1),
-      lowHumidViolation(2),
-      disabled(3)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The low humidity violation status of the probe humidity
-       reading. This OID will show a lowTempViolation(2)
-       if the current humidity reading shown in the
-       'emStatusProbeCurrentHumid' OID is less than or equal to
-       the low humidity threshold value, the 
-       'emConfigProbeLowHumidThreshold' OID, and the value of the
-       'emConfigProbeLowHumidEnable' OID is enabled. Otherwise it will
-       show noViolation(1). If the 'emConfigProbeLowHumidEnable' OID is
-       disabled, this OID will show disabled(3)."
-   ::= { emStatusProbesEntry 10 }
-
-emStatusContactsNumContacts OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of contacts supported by the
-       Environmental Monitor."
-   ::= { emStatus 4 }
-
-emStatusContactsTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF EmStatusContactsEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "A list of contacts supported by the Environmental Monitor
-       and their status."
-   ::= { emStatus 5 }
-
-emStatusContactsEntry OBJECT-TYPE
-   SYNTAX EmStatusContactsEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the contact."
-   INDEX  { emStatusContactNumber }
-   ::= { emStatusContactsTable 1 }
-
-EmStatusContactsEntry ::=
-   SEQUENCE {
-      emStatusContactNumber
-         INTEGER,
-      emStatusContactName
-         DisplayString,
-      emStatusContactStatus
-         INTEGER
-   }
-
-emStatusContactNumber OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index of the Environmental Monitor contact."
-   ::= { emStatusContactsEntry 1 }
-
-emStatusContactName OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A descriptive name for the Environmental Monitor contact
-       set by the user, possibly denoting its location or purpose."
-   ::= { emStatusContactsEntry 2 }
-
-emStatusContactStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-      noFault(1),
-      fault(2),
-      disabled(3)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the Environmental Monitor contact. The status
-       will show noFault(1) if the contact is in the normal state
-       and the 'emConfigContactEnable' OID is enabled. The status will
-       show a fault(2) if the contact is faulted and the 
-       'emContactEnable' OID is enabled. If the 'emConfigContactEnable'
-       OID is disabled, the status will show disabled(3)."
-   ::= { emStatusContactsEntry 3 }
-
--- Integrated Environmental Monitor (IEM)
-
-iemIdentHardwareRevision OBJECT-TYPE
-   SYNTAX DisplayString 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The hardware revision of the Integrated Environmental
-       Monitor."
-   ::= { iemIdent 1 }
-
-iemConfigProbesNumProbes OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of temperature and humidity probes available."
-   ::= { iemConfig 1 }
-
-iemConfigProbesTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF IemConfigProbesEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "A list of probes supported by the Environmental Monitor
-       and their configurations."
-   ::= { iemConfig 2 }
-
-iemConfigProbesEntry OBJECT-TYPE
-   SYNTAX IemConfigProbesEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The Environmental Monitor probe configurations."
-   INDEX  { iemConfigProbeNumber }
-   ::= { iemConfigProbesTable 1 }
-
-IemConfigProbesEntry ::=
-   SEQUENCE {
-      iemConfigProbeNumber
-         INTEGER,
-      iemConfigProbeName
-         DisplayString,
-      iemConfigProbeHighTempThreshold
-         INTEGER,
-      iemConfigProbeLowTempThreshold
-         INTEGER,
-      iemConfigProbeTempUnits
-         INTEGER,
-      iemConfigProbeHighHumidThreshold
-         INTEGER,
-      iemConfigProbeLowHumidThreshold
-         INTEGER,
-      iemConfigProbeHighTempEnable
-         INTEGER,
-      iemConfigProbeLowTempEnable
-         INTEGER,
-      iemConfigProbeHighHumidEnable
-         INTEGER,
-      iemConfigProbeLowHumidEnable
-         INTEGER
-   }
-
-iemConfigProbeNumber OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to a Environmental Monitor probe entry."
-   ::= { iemConfigProbesEntry 1 }
-
-iemConfigProbeName OBJECT-TYPE
-   SYNTAX DisplayString 
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "A descriptive name for the probe set by the user,
-       possibly denoting its location or purpose."
-   ::= { iemConfigProbesEntry 2 }
-
-iemConfigProbeHighTempThreshold OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The high temperature alarm threshold for the probe.
-       Units are displayed in the scale selected in the
-       'iemConfigProbeTempUnits' OID (Celsius or Fahrenheit)."
-   ::= { iemConfigProbesEntry 3 }
-
-iemConfigProbeLowTempThreshold OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The low temperature alarm threshold for the probe.
-       Units are displayed in the scale selected in the
-       'iemConfigProbeTempUnits' OID (Celsius or Fahrenheit)."
-   ::= { iemConfigProbesEntry 4 }
-
-iemConfigProbeTempUnits OBJECT-TYPE
-   SYNTAX INTEGER {
-      celsius(1),
-      fahrenheit(2)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The temperature scale used to display the temperature
-       thresholds of the probe, Celsius(1) or Fahrenheit(2).
-       This setting is based on the system preferences
-       configuration in the agent."
-   ::= { iemConfigProbesEntry 5 }
-
-iemConfigProbeHighHumidThreshold OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The high humidity alarm threshold for the probe in
-      percent relative humidity."
-   ::= { iemConfigProbesEntry 6 }
-
-iemConfigProbeLowHumidThreshold OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The low humidity alarm threshold for the probe in
-      percent relative humidity."
-   ::= { iemConfigProbesEntry 7 }
-
-iemConfigProbeHighTempEnable OBJECT-TYPE
-   SYNTAX INTEGER {
-      disabled(1),
-      enabled(2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The high temperature alarm enable/disable for the
-       probe. No alarm will be generated if this value
-       is set to disabled(1). The alarm will be 
-       generated if this value is set to enabled(2) and
-       the threshold has been violated."
-   ::= { iemConfigProbesEntry 8 }
-
-iemConfigProbeLowTempEnable OBJECT-TYPE
-   SYNTAX INTEGER {
-      disabled(1),
-      enabled(2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The low temperature alarm enable/disable for the
-       probe. No alarm will be generated if this value
-       is set to disabled(1). The alarm will be 
-       generated if this value is set to enabled(2) and
-       the threshold has been violated."
-   ::= { iemConfigProbesEntry 9 }
-
-iemConfigProbeHighHumidEnable OBJECT-TYPE
-   SYNTAX INTEGER {
-      disabled(1),
-      enabled(2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The high humidity alarm enable/disable for the
-       probe. No alarm will be generated if this value
-       is set to disabled(1). The alarm will be 
-       generated if this value is set to enabled(2) and
-       the threshold has been violated."
-   ::= { iemConfigProbesEntry 10 }
-
-iemConfigProbeLowHumidEnable OBJECT-TYPE
-   SYNTAX INTEGER {
-      disabled(1),
-      enabled(2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The low humidity alarm enable/disable for the
-       probe. No alarm will be generated if this value
-       is set to disabled(1). The alarm will be 
-       generated if this value is set to enabled(2) and
-       the threshold has been violated."
-   ::= { iemConfigProbesEntry 11 }
-
-iemConfigContactsNumContacts OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of contacts available on the Environmental
-       Monitor."
-   ::= { iemConfig 3 }
-
-iemConfigContactsTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF IemConfigContactsEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "A list of contacts supported by the Environmental Monitor
-       and their configurations."
-   ::= { iemConfig 4 }
-
-iemConfigContactsEntry OBJECT-TYPE
-   SYNTAX IemConfigContactsEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The Environmental Monitor contact configurations."
-   INDEX  { iemConfigContactNumber }
-   ::= { iemConfigContactsTable 1 }
-
-IemConfigContactsEntry ::=
-   SEQUENCE {
-       iemConfigContactNumber
-           INTEGER,
-       iemConfigContactName
-           DisplayString,
-       iemConfigContactEnable
-           INTEGER
-   }
-
-iemConfigContactNumber OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index of an Environmental Monitor contact."
-   ::= { iemConfigContactsEntry 1 }
-
-iemConfigContactName OBJECT-TYPE
-   SYNTAX DisplayString 
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "A descriptive name for the Environmental Monitor contact
-       set by the user, possibly denoting its location or purpose."
-   ::= { iemConfigContactsEntry 2 }
-
-iemConfigContactEnable OBJECT-TYPE
-   SYNTAX INTEGER {
-      disabled(1),
-      enabled(2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "An Environmental Monitor contact alarm enable/disable."
-   ::= { iemConfigContactsEntry 3 }
-
-
-iemStatusProbesNumProbes OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of available probes on the Environmental
-       Monitor."
-   ::= { iemStatus 1 }
-
-iemStatusProbesTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF IemStatusProbesEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "A list of probes supported by the Environmental Monitor
-       and their status."
-   ::= { iemStatus 2 }
-
-iemStatusProbesEntry OBJECT-TYPE
-   SYNTAX IemStatusProbesEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the probe."
-   INDEX  { iemStatusProbeNumber }
-   ::= { iemStatusProbesTable 1 }
-
-IemStatusProbesEntry ::=
-   SEQUENCE {
-      iemStatusProbeNumber
-         INTEGER,
-      iemStatusProbeName
-         DisplayString,
-      iemStatusProbeStatus
-         INTEGER,
-      iemStatusProbeCurrentTemp
-         INTEGER,
-      iemStatusProbeTempUnits
-         INTEGER,
-      iemStatusProbeCurrentHumid
-         INTEGER,
-      iemStatusProbeHighTempViolation
-         INTEGER,
-      iemStatusProbeLowTempViolation
-         INTEGER,
-      iemStatusProbeHighHumidViolation
-         INTEGER,
-      iemStatusProbeLowHumidViolation
-         INTEGER
-   }
-
-iemStatusProbeNumber OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index of the probe."
-   ::= { iemStatusProbesEntry 1 }
-
-iemStatusProbeName OBJECT-TYPE
-   SYNTAX DisplayString 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A descriptive name for the probe set by the user,
-       denoting its location or purpose."
-   ::= { iemStatusProbesEntry 2 }
-
-iemStatusProbeStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-      disconnected(1),
-      connected(2)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The connected status of the probe, either      
-      disconnected(1) or connected(2)."
-   ::= { iemStatusProbesEntry 3 }
-
-iemStatusProbeCurrentTemp OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The current temperature reading from the probe displayed
-       in the units shown in the 'iemStatusProbeTempUnits' OID
-       (Celsius or Fahrenheit)."
-   ::= { iemStatusProbesEntry 4 }
-
-iemStatusProbeTempUnits OBJECT-TYPE
-   SYNTAX INTEGER {
-      celsius(1),
-      fahrenheit(2)     
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The temperature scale used to display the temperature
-       thresholds of the probe, Celsius(1) or Fahrenheit(2).
-       This setting is based on the system preferences
-       configuration in the agent."
-   ::= { iemStatusProbesEntry 5 }
-
-iemStatusProbeCurrentHumid OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The current humidity reading from the probe in percent
-      relative humidity."
-   ::= { iemStatusProbesEntry 6 }
-
-iemStatusProbeHighTempViolation OBJECT-TYPE
-   SYNTAX INTEGER {
-      noViolation(1),
-      highTempViolation(2),
-      disabled(3)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The high temperature violation status of the probe
-       temperature reading. This OID will show a highTempViolation(2)
-       if the current temperature reading shown in the
-       'iemStatusProbeCurrentTemp' OID is greater than or equal to
-       the high temperature threshold value, the 
-       'iemConfigProbeHighTempThreshold' OID, and the value of the
-       'iemConfigProbeHighTempEnable' OID is enabled. Otherwise it will show
-       noViolation(1). If the 'iemConfigProbeHighTempEnable' OID is disabled,
-       this OID will show disabled(3)."
-   ::= { iemStatusProbesEntry 7 }
-
-iemStatusProbeLowTempViolation OBJECT-TYPE
-   SYNTAX INTEGER {
-      noViolation(1),
-      lowTempViolation(2),
-      disabled(3)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The high temperature violation status of the probe
-       temperature reading. This OID will show a lowTempViolation(2)
-       if the current temperature reading shown in the
-       'iemStatusProbeCurrentTemp' OID is less than or equal to
-       the low temperature threshold value, the 
-       'iemConfigProbeLowTempThreshold' OID, and the value of the
-       'iemPConfigrobeLowTempEnable' OID is enabled. Otherwise it will show
-       noViolation(1). If the 'iemConfigProbeLowTempEnable' OID is disabled,
-       this OID will show disabled(3)."
-   ::= { iemStatusProbesEntry 8 }
-
-iemStatusProbeHighHumidViolation OBJECT-TYPE
-   SYNTAX INTEGER {
-      noViolation(1),
-      highHumidViolation(2),
-      disabled(3)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The high humidity violation status of the probe humidity
-       reading. This OID will show a highTempViolation(2)
-       if the current humidity reading shown in the
-       'iemStatusProbeCurrentHumid' OID is greater than or equal to
-       the high humidity threshold value, the 
-       'iemConfigProbeHighHumidThreshold' OID, and the value of the
-       'iemConfigProbeHighHumidEnable' OID is enabled. Otherwise it will
-       show noViolation(1). If the 'iemConfigProbeHighHumidEnable' OID is
-       disabled, this OID will show disabled(3)."
-   ::= { iemStatusProbesEntry 9 }
-
-iemStatusProbeLowHumidViolation OBJECT-TYPE
-   SYNTAX INTEGER {
-      noViolation(1),
-      lowHumidViolation(2),
-      disabled(3)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The low humidity violation status of the probe humidity
-       reading. This OID will show a lowTempViolation(2)
-       if the current humidity reading shown in the
-       'iemStatusProbeCurrentHumid' OID is less than or equal to
-       the low humidity threshold value, the 
-       'iemConfigProbeLowHumidThreshold' OID, and the value of the
-       'iemConfigProbeLowHumidEnable' OID is enabled. Otherwise it will
-       show noViolation(1). If the 'iemConfigProbeLowHumidEnable' OID is
-       disabled, this OID will show disabled(3)."
-   ::= { iemStatusProbesEntry 10 }
-
-iemStatusContactsNumContacts OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of contacts supported on the
-       Environmental Monitor."
-   ::= { iemStatus 3 }
-
-iemStatusContactsTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF IemStatusContactsEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "A list of contacts supported by the Environmental Monitor
-       and their status."
-   ::= { iemStatus 4 }
-
-iemStatusContactsEntry OBJECT-TYPE
-   SYNTAX IemStatusContactsEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the contact."
-   INDEX  { iemStatusContactNumber }
-   ::= { iemStatusContactsTable 1 }
-
-IemStatusContactsEntry ::=
-   SEQUENCE {
-      iemStatusContactNumber
-         INTEGER,
-      iemStatusContactName
-         DisplayString,
-      iemStatusContactStatus
-         INTEGER
-   }
-
-iemStatusContactNumber OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index of the Environmental Monitor contact."
-   ::= { iemStatusContactsEntry 1 }
-
-iemStatusContactName OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A descriptive name for the Environmental Monitor contact
-       set by the user, denoting its location or purpose."
-   ::= { iemStatusContactsEntry 2 }
-
-iemStatusContactStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-      noFault(1),
-      fault(2),
-      disabled(3)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the Environmental Monitor contact. The status
-       will show noFault(1) if the contact is in the normal state
-       and the 'iemConfigContactEnable' OID is enabled. The status will
-       show a fault(2) if the contact is faulted and the 
-       'iemConfigContactEnable' OID is enabled. If the
-       'iemConfigContactEnable' OID is disabled, the status will show
-       disabled(3)."
-   ::= { iemStatusContactsEntry 3 }
-
-iemStatusRelaysNumRelays OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of output relays supported on the
-       Environmental Monitor."
-   ::= { iemStatus 6 }
-
-iemStatusRelaysTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF IemStatusRelaysEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "A list of output relays supported by the
-       Environmental Monitor and their status."
-   ::= { iemStatus 7 }
-
-iemStatusRelaysEntry OBJECT-TYPE
-   SYNTAX IemStatusRelaysEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the relay."
-   INDEX  { iemStatusRelayNumber }
-   ::= { iemStatusRelaysTable 1 }
-
-IemStatusRelaysEntry ::=
-   SEQUENCE {
-      iemStatusRelayNumber
-         INTEGER,
-      iemStatusRelayName
-         DisplayString,
-      iemStatusRelayStatus
-         INTEGER
-   }
-
-iemStatusRelayNumber OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index of the output relay."
-   ::= { iemStatusRelaysEntry 1 }
-
-iemStatusRelayName OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A descriptive name for the output relay set by the
-       user, denoting its location or purpose."
-   ::= { iemStatusRelaysEntry 2 }
-
-iemStatusRelayStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-      faultState(1),
-      normalState(2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the output relay, either faultState(1) or
-      normalState(2)."
-   ::= { iemStatusRelaysEntry 3 }
-
--- Environmental Management System (EMS)
-
---  EMS IDENT
-
-emsIdentEMSName OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A character string identifying the 
-       device. "
-   ::= { emsIdent 1 }
-
-emsIdentProductNumber OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A character string identifying the model number of 
-       the device. This value is set at the factory."
-   ::= { emsIdent 2 }
-
-emsIdentFirmwareRev OBJECT-TYPE
-   SYNTAX DisplayString 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The firmware revision of the device."
-   ::= { emsIdent 3 }
-
-emsIdentHardwareRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The hardware revision of the device. 
-       This value is set at the factory."
-   ::= { emsIdent 4 }
-
-emsIdentDateOfManufacture OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The date when the device was manufactured in mm/dd/yyyy format.
-       This value is set at the factory. " 
-   ::= { emsIdent 5 }
-   
-emsIdentSerialNumber OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A character string identifying the serial number of 
-       the device. This value is set at the factory."
-   ::= { emsIdent 6 }
-
---  EMS CONTROL
-
--- EMS OUTPUT RELAY CONTROL STATUS TABLE
-
-emsOutputRelayControlTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF OutputRelayControlEMSEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for control of individual output relays. The number of
-       entries is contained in the emsStatusOutputRelayCount OID."
-   ::= { emsOutputRelayControl 1 }
-
-emsOutputRelayControlEntry OBJECT-TYPE
-   SYNTAX OutputRelayControlEMSEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The output relays to control."
-   INDEX  { emsOutputRelayControlOutputRelayIndex }
-   ::= { emsOutputRelayControlTable 1 }
-
-OutputRelayControlEMSEntry ::=
-   SEQUENCE {
-      emsOutputRelayControlOutputRelayIndex   INTEGER,
-      emsOutputRelayControlOutputRelayName    DisplayString,
-      emsOutputRelayControlOutputRelayCommand INTEGER
-   }      
-
-emsOutputRelayControlOutputRelayIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the output relay entry."
-   ::= { emsOutputRelayControlEntry 1 }
-   
-emsOutputRelayControlOutputRelayName    OBJECT-TYPE
-   SYNTAX  DisplayString
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the output relay.
-       This OID is provided for informational purposes only."
-   ::= { emsOutputRelayControlEntry 2 }
-
-emsOutputRelayControlOutputRelayCommand OBJECT-TYPE
-   SYNTAX INTEGER {
-      immediateCloseEMS           (1),
-      immediateOpenEMS            (2)
-   }     
-
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-       "Getting this variable will return the output relay state. If 
-       the output relay is closed, the immediateCloseEMS (1) value will be returned.
-       If the output relay is open, the immediateOpenEMS (2) value will be
-       returned. 
-              
-       Setting this variable to immediateCloseEMS (1) will immediately close the relay.
-       
-       Setting this variable to immediateOpenEMS (2) will immediately open the relay."
-   ::= { emsOutputRelayControlEntry 3 }
-
--- EMS OUTLET CONTROL TABLE
- 
-emsOutletControlTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF OutletControlEMSEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for control of individual outlet switches. The number of
-       entries is contained in the emsStatusOutletCount OID."
-   ::= { emsOutletControl 1 }
-
-emsOutletControlEntry OBJECT-TYPE
-   SYNTAX OutletControlEMSEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The outlets to control."
-   INDEX  { emsOutletControlOutletIndex }
-   ::= { emsOutletControlTable 1 }
-
-OutletControlEMSEntry ::=
-   SEQUENCE {
-      emsOutletControlOutletIndex   INTEGER,
-      emsOutletControlOutletName    DisplayString,
-      emsOutletControlOutletCommand INTEGER
-   }      
-
-emsOutletControlOutletIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the outlet entry."
-   ::= { emsOutletControlEntry 1 }
-   
-emsOutletControlOutletName    OBJECT-TYPE
-   SYNTAX  DisplayString
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the outlet.
-       This OID is provided for informational purposes only."
-   ::= { emsOutletControlEntry 2 }
-
-emsOutletControlOutletCommand OBJECT-TYPE
-   SYNTAX INTEGER {
-      immediateOnEMS             (1),
-      immediateOffEMS            (2)
-   }     
-
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-       "Getting this variable will return the outlet state. If 
-       the outlet is on, the immediateOnEMS (1) value will be returned.
-       If the outlet is off, the immediateOffEMS (2) value will be
-       returned. 
-       
-       Setting this variable to immediateOnEMS (1) will immediately turn the outlet on.
-       
-       Setting this variable to immediateOffEMS (2) will immediately turn the outlet off."
-   ::= { emsOutletControlEntry 3 }
-
--- EMS SENSOR CONTROL TABLE
-
-emsSensorControlTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF EMSSensorControlEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for control/reset of individual sensors. The number of
-       entries is contained in the emsStatusSensorCount OID."
-   ::= { emsSensorControl 1 }
-
-emsSensorControlEntry OBJECT-TYPE
-   SYNTAX EMSSensorControlEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The sensors to control/reset."
-   INDEX  { emsSensorControlSensorIndex }
-   ::= { emsSensorControlTable 1 }
-
-EMSSensorControlEntry ::=
-   SEQUENCE {
-      emsSensorControlSensorIndex         INTEGER,
-      emsSensorControlSensorSystemName    DisplayString,
-      emsSensorControlSensorUserName      DisplayString,
-      emsSensorControlSensorCommand       INTEGER
-   }      
-
-emsSensorControlSensorIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the sensor entry."
-   ::= { emsSensorControlEntry 1 }
-   
-emsSensorControlSensorSystemName   OBJECT-TYPE
-   SYNTAX  DisplayString 
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The system name of the sensor.  This describes the hardware system
-       intent of this sensor."
-   ::= { emsSensorControlEntry 2 }
-
-emsSensorControlSensorUserName   OBJECT-TYPE
-   SYNTAX  DisplayString 
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the sensor as given by the system user."
-   ::= { emsSensorControlEntry 3 }
-   
-emsSensorControlSensorCommand OBJECT-TYPE
-   SYNTAX INTEGER {
-      noCommandEMS        (1),
-      resetCommandEMS     (2)
-   }     
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-       "Getting this variable will return noCommandEMS(1).  
-              
-       Setting this variable to resetCommandEMS(2) will issue a reset command to the
-       sensor.  Some sensors cannot be manually reset and will not be affected 
-       by this command."
-   ::= { emsSensorControlEntry 4 }
-
--- EMS ALARM DEVICE CONTROL TABLE
- 
-emsAlarmDeviceControlTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF AlarmDeviceControlEMSEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for control of individual alarm devices. 
-       Note: Some alarm devices are not controllable.  The number of
-       entries is contained in the emsStatusAlarmDeviceCount OID."
-   ::= { emsAlarmDeviceControl 1 }
-
-emsAlarmDeviceControlEntry OBJECT-TYPE
-   SYNTAX AlarmDeviceControlEMSEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The alarm devices to control."
-   INDEX  { emsAlarmDeviceControlDeviceIndex }
-   ::= { emsAlarmDeviceControlTable 1 }
-
-AlarmDeviceControlEMSEntry ::=
-   SEQUENCE {
-      emsAlarmDeviceControlDeviceIndex   INTEGER,
-      emsAlarmDeviceControlDeviceName    DisplayString,
-      emsAlarmDeviceControlDeviceCommand INTEGER
-   }      
-
-emsAlarmDeviceControlDeviceIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the alarm device entry."
-   ::= { emsAlarmDeviceControlEntry 1 }
-   
-emsAlarmDeviceControlDeviceName    OBJECT-TYPE
-   SYNTAX  DisplayString
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the alarm device.
-       This OID is provided for informational purposes only."
-   ::= { emsAlarmDeviceControlEntry 2 }
-
-emsAlarmDeviceControlDeviceCommand OBJECT-TYPE
-   SYNTAX INTEGER {
-      alarmDeviceOnEMS             (1),
-      alarmDeviceOffEMS            (2),
-      alarmDeviceNotInstalledEMS   (3)
-   }     
-
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-       "Getting this variable will return the device state. If 
-       the device is active, the alarmDeviceOnEMS (1) value will be returned.
-       If the device is inactive, the alarmDeviceOffEMS (2) value will be
-       returned. If the device is not installed, the 
-       alarmDeviceNotInstalledEMS (3) value will be returned.
-       
-       Actions resulting from setting this variable are device-dependent.
-
-       Setting this variable to alarmDeviceOnEMS (1) will turn that device (ex. Beacon) on.       
-       Setting this variable to alarmDeviceOffEMS (2) will turn that device off."
-
-   ::= { emsAlarmDeviceControlEntry 3 }
-
-
---  EMS CONFIG
-
-emsConfigName   OBJECT-TYPE
-   SYNTAX  DisplayString    
-   ACCESS  read-write
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the device."
-   ::= { emsConfig 1 }
-
-emsConfigCheckLogLight   OBJECT-TYPE
-   SYNTAX INTEGER       {
-      lightDisabled          (1),
-      lightOnInformational   (2),
-      lightOnWarning         (3),
-      lightOnSevere          (4)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "The setting of this OID determines the level of event that will
-       trigger the check-log light on the EMS. This is not available on the EMU2.
-
-      lightDisabled (1) disables the check-log light.
-      lightOnInformational (2) lights check-log for any event of 
-        informational severity or above.
-      lightOnWarning (3) lights check-log for any event of 
-        warning severity or above.
-      lightOnSevere (4) lights check-log for any event of severe severity."
-
-   ::= { emsConfig 2 }
-   
--- EMS PROBE CONFIG TABLE
-
-emsProbeConfigTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF EMSProbeConfigEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for configuration of individual probes. The number of
-       entries is contained in the emsStatusProbeCount OID."
-   ::= { emsProbeConfig 1 }
-
-emsProbeConfigEntry OBJECT-TYPE
-   SYNTAX EMSProbeConfigEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The probes to configure."
-   INDEX  { emsProbeConfigProbeIndex }
-   ::= { emsProbeConfigTable 1 }
-
-EMSProbeConfigEntry ::=
-   SEQUENCE {
-      emsProbeConfigProbeIndex                INTEGER,
-      emsProbeConfigProbeName                 DisplayString,
-      emsProbeConfigProbeHighTempThresh       INTEGER,
-      emsProbeConfigProbeLowTempThresh        INTEGER,
-      emsProbeConfigProbeHighHumidityThresh   INTEGER,
-      emsProbeConfigProbeLowHumidityThresh    INTEGER,
-      emsProbeConfigProbeMaxTempThresh        INTEGER,
-      emsProbeConfigProbeMinTempThresh        INTEGER,
-      emsProbeConfigProbeDeltaTemp            INTEGER,
-      emsProbeConfigProbeMaxHumidityThresh    INTEGER,
-      emsProbeConfigProbeMinHumidityThresh    INTEGER,
-      emsProbeConfigProbeDeltaHumidity        INTEGER,
-      emsProbeConfigProbeSTIncTempVariance    INTEGER,
-      emsProbeConfigProbeSTIncTempTime        INTEGER,
-      emsProbeConfigProbeSTDecTempVariance    INTEGER,
-      emsProbeConfigProbeSTDecTempTime        INTEGER,
-      emsProbeConfigProbeLTIncTempVariance    INTEGER,
-      emsProbeConfigProbeLTIncTempTime        INTEGER,
-      emsProbeConfigProbeLTDecTempVariance    INTEGER,
-      emsProbeConfigProbeLTDecTempTime        INTEGER
-   }      
-
-emsProbeConfigProbeIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the probe entry."
-   ::= { emsProbeConfigEntry 1 }
-   
-emsProbeConfigProbeName   OBJECT-TYPE
-   SYNTAX  DisplayString 
-   ACCESS  read-write
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the probe."
-   ::= { emsProbeConfigEntry 2 }
-
-emsProbeConfigProbeHighTempThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Probe high temperature threshold. 
-
-      Values are represented in whole number degrees.
-      Units are displayed in the scale shown in
-      the emsStatusSysTempUnits OID (Celsius or Fahrenheit)."
-   ::= { emsProbeConfigEntry 3 }
-   
-emsProbeConfigProbeLowTempThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Probe low temperature threshold. 
-
-      Values are represented in whole number degrees.
-      Units are displayed in the scale shown in
-      the emsStatusSysTempUnits OID (Celsius or Fahrenheit)."
-   ::= { emsProbeConfigEntry 4 }
-   
-emsProbeConfigProbeHighHumidityThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Probe high humidity threshold. 
-
-      Values are represented in whole number percentage."
-   ::= { emsProbeConfigEntry 5 }
-   
-emsProbeConfigProbeLowHumidityThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Probe low humidity threshold. 
-
-      Values are represented in whole number percentage."
-   ::= { emsProbeConfigEntry 6 }
-
-emsProbeConfigProbeMaxTempThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Probe maximum temperature threshold. 
-
-      Values are represented in whole number degrees.
-      Units are displayed in the scale shown in
-      the emsStatusSysTempUnits OID (Celsius or Fahrenheit)."
-   ::= { emsProbeConfigEntry 7 }
-   
-emsProbeConfigProbeMinTempThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Probe minimum temperature threshold. 
-
-      Values are represented in whole number degrees.
-      Units are displayed in the scale shown in
-      the emsStatusSysTempUnits OID (Celsius or Fahrenheit)."
-   ::= { emsProbeConfigEntry 8 }
-   
-emsProbeConfigProbeDeltaTemp OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Probe delta temperature. 
-
-      Values are represented in whole number degrees.
-      Units are displayed in the scale shown in
-      the emsStatusSysTempUnits OID (Celsius or Fahrenheit)."
-   ::= { emsProbeConfigEntry 9 }
-   
-emsProbeConfigProbeMaxHumidityThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Probe maximum humidity threshold. 
-
-      Values are represented in whole number percentage."
-   ::= { emsProbeConfigEntry 10 }
-   
-emsProbeConfigProbeMinHumidityThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Probe minimum humidity threshold. 
-
-      Values are represented in whole number percentage."
-   ::= { emsProbeConfigEntry 11 }
-   
-emsProbeConfigProbeDeltaHumidity OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Probe delta humidity. 
-
-      Values are represented in whole number percentage."
-   ::= { emsProbeConfigEntry 12 }
-   
-emsProbeConfigProbeSTIncTempVariance OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Probe short-term increasing temperature variance used for rate of change alarms. 
-
-      Values are represented in whole number degrees.
-      Units are displayed in the scale shown in
-      the emsStatusSysTempUnits OID (Celsius or Fahrenheit)."
-   ::= { emsProbeConfigEntry 13 }
-   
-emsProbeConfigProbeSTIncTempTime OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Probe short-term increasing temperature time used for rate of change alarms. 
-
-      Values are represented in whole number minutes."
-   ::= { emsProbeConfigEntry 14 }
-   
-emsProbeConfigProbeSTDecTempVariance OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Probe short-term decreasing temperature variance used for rate of change alarms. 
-
-      Values are represented in whole number degrees.
-      Units are displayed in the scale shown in
-      the emsStatusSysTempUnits OID (Celsius or Fahrenheit)."
-   ::= { emsProbeConfigEntry 15 }
-   
-emsProbeConfigProbeSTDecTempTime OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Probe short-term decreasing temperature time used for rate of change alarms. 
-
-      Values are represented in whole number minutes."
-   ::= { emsProbeConfigEntry 16 }
-   
-emsProbeConfigProbeLTIncTempVariance OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Probe long-term increasing temperature variance used for rate of change alarms. 
-
-      Values are represented in whole number degrees.
-      Units are displayed in the scale shown in
-      the emsStatusSysTempUnits OID (Celsius or Fahrenheit)."
-   ::= { emsProbeConfigEntry 17 }
-   
-emsProbeConfigProbeLTIncTempTime OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Probe long-term increasing temperature time used for rate of change alarms. 
-
-      Values are represented in whole number hours."
-   ::= { emsProbeConfigEntry 18 }
-   
-emsProbeConfigProbeLTDecTempVariance OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Probe long-term decreasing temperature variance used for rate of change alarms. 
-
-      Values are represented in whole number degrees.
-      Units are displayed in the scale shown in
-      the emsStatusSysTempUnits OID (Celsius or Fahrenheit)."
-   ::= { emsProbeConfigEntry 19 }
-   
-emsProbeConfigProbeLTDecTempTime OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "Probe long-term decreasing temperature time used for rate of change alarms. 
-
-      Values are represented in whole number hours."
-   ::= { emsProbeConfigEntry 20 }
-   
-
--- EMS INPUT CONTACT CONFIG STATUS TABLE
-
-emsInputContactConfigTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF EMSInputContactConfigEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for configuration of individual input contacts. The number of
-       entries is contained in the emsStatusInputContactCount OID."
-   ::= { emsInputContactConfig 1 }
-
-emsInputContactConfigEntry OBJECT-TYPE
-   SYNTAX EMSInputContactConfigEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The input contacts to configure."
-   INDEX  { emsInputContactConfigInputContactIndex }
-   ::= { emsInputContactConfigTable 1 }
-
-EMSInputContactConfigEntry ::=
-   SEQUENCE {
-      emsInputContactConfigInputContactIndex         INTEGER,
-      emsInputContactConfigInputContactName          DisplayString,
-      emsInputContactConfigInputContactNormalState   INTEGER
-   }      
-
-emsInputContactConfigInputContactIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the input contact entry."
-   ::= { emsInputContactConfigEntry 1 }
-   
-emsInputContactConfigInputContactName   OBJECT-TYPE
-   SYNTAX  DisplayString 
-   ACCESS  read-write
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the input contact."
-   ::= { emsInputContactConfigEntry 2 }
-
-emsInputContactConfigInputContactNormalState OBJECT-TYPE
-   SYNTAX INTEGER {
-      normallyClosedEMS        (1),
-      normallyOpenEMS          (2)
-   }     
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-       "Getting this variable will return the normal state of the input contact. If 
-       the normal state is closed, the normallyClosedEMS (1) value will be returned.
-       If the normal state is closed, the normallyOpenEMS (2) value will be
-       returned.
-       
-       Setting this variable will change the normal state of the input contact"
-   ::= { emsInputContactConfigEntry 3 }
-   
--- EMS OUTPUT RELAY CONFIG STATUS TABLE
-
-emsOutputRelayConfigTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF EMSOutputRelayConfigEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for configuration of individual output relays. The number of
-       entries is contained in the emsStatusOutputRelayCount OID."
-   ::= { emsOutputRelayConfig 1 }
-
-emsOutputRelayConfigEntry OBJECT-TYPE
-   SYNTAX EMSOutputRelayConfigEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The output relays to configure."
-   INDEX  { emsOutputRelayConfigOutputRelayIndex }
-   ::= { emsOutputRelayConfigTable 1 }
-
-EMSOutputRelayConfigEntry ::=
-   SEQUENCE {
-      emsOutputRelayConfigOutputRelayIndex          INTEGER,
-      emsOutputRelayConfigOutputRelayName           DisplayString,
-      emsOutputRelayConfigOutputRelayNormalState    INTEGER
-   }      
-
-emsOutputRelayConfigOutputRelayIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the output relay entry."
-   ::= { emsOutputRelayConfigEntry 1 }
-   
-emsOutputRelayConfigOutputRelayName   OBJECT-TYPE
-   SYNTAX  DisplayString 
-   ACCESS  read-write
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the output relay."
-   ::= { emsOutputRelayConfigEntry 2 }
-
-emsOutputRelayConfigOutputRelayNormalState OBJECT-TYPE
-   SYNTAX INTEGER {
-      normallyClosedEMS        (1),
-      normallyOpenEMS          (2)
-   }     
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-       "Getting this variable will return the normal state of the output relay. If 
-       the normal state is closed, the normallyClosedEMS (1) value will be returned.
-       If the normal state is closed, the normallyOpenEMS (2) value will be
-       returned.
-              
-       Setting this variable will change the normal state of the output relay"
-   ::= { emsOutputRelayConfigEntry 3 }
-   
--- EMS OUTLET CONFIG TABLE
-  
-emsOutletConfigTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF EMSOutletConfigEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for configuration of individual outlets. The number of
-       entries is contained in the emsStatusOutletCount OID."
-   ::= { emsOutletConfig 1 }
-
-emsOutletConfigEntry OBJECT-TYPE
-   SYNTAX EMSOutletConfigEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The outlets to configure."
-   INDEX  { emsOutletConfigOutletIndex }
-   ::= { emsOutletConfigTable 1 }
-
-EMSOutletConfigEntry ::=
-   SEQUENCE {
-      emsOutletConfigOutletIndex          INTEGER,
-      emsOutletConfigOutletName           DisplayString,
-      emsOutletConfigOutletNormalState    INTEGER
-   }      
-
-emsOutletConfigOutletIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the outlet entry."
-   ::= { emsOutletConfigEntry 1 }
-   
-emsOutletConfigOutletName   OBJECT-TYPE
-   SYNTAX  DisplayString    ACCESS  read-write
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the outlet."
-   ::= { emsOutletConfigEntry 2 }
-
-emsOutletConfigOutletNormalState OBJECT-TYPE
-   SYNTAX INTEGER {
-      normallyOnEMS             (1),
-      normallyOffEMS            (2)
-   }     
-
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-       "Getting this variable will return the normal state of the outlet. If 
-       the normal state is on, the normallyOnEMS (1) value will be returned.
-       If the normal state is off, the normallyOffEMS (2) value will be
-       returned. 
-       
-       Setting this variable will change the normal state of the outlet"
-   ::= { emsOutletConfigEntry 3 }
-   
--- EMS SENSOR CONFIG TABLE
-
-emsSensorConfigTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF EMSSensorConfigEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for configuration of individual sensors. The number of
-       entries is contained in the emsStatusSensorCount OID."
-   ::= { emsSensorConfig 1 }
-
-emsSensorConfigEntry OBJECT-TYPE
-   SYNTAX EMSSensorConfigEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The sensors to configure."
-   INDEX  { emsSensorConfigSensorIndex }
-   ::= { emsSensorConfigTable 1 }
-
-EMSSensorConfigEntry ::=
-   SEQUENCE {
-      emsSensorConfigSensorIndex         INTEGER,
-      emsSensorConfigSensorSystemName    DisplayString,
-      emsSensorConfigSensorUserName      DisplayString,
-      emsSensorConfigSensorNormalState   INTEGER,
-      emsSensorConfigSensorAlarmDelay    INTEGER
-   }      
-
-emsSensorConfigSensorIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the sensor entry."
-   ::= { emsSensorConfigEntry 1 }
-   
-emsSensorConfigSensorSystemName   OBJECT-TYPE
-   SYNTAX  DisplayString 
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The system name of the sensor.  This describes the hardware system
-       intent of this sensor."
-   ::= { emsSensorConfigEntry 2 }
-
-emsSensorConfigSensorUserName   OBJECT-TYPE
-   SYNTAX  DisplayString 
-   ACCESS  read-write
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the sensor as given by the system user."
-   ::= { emsSensorConfigEntry 3 }
-   
-emsSensorConfigSensorNormalState OBJECT-TYPE
-   SYNTAX INTEGER {
-      normallyClosedEMS        (1),
-      normallyOpenEMS          (2)
-   }     
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-       "Getting this variable will return the normal state of the sensor. If 
-       the normal state is closed, the normallyClosedEMS (1) value will be returned.
-       If the normal state is closed, the normallyOpenEMS (2) value will be
-       returned.
-       
-       Setting this variable will change the normal state of the sensor.  Note:
-       Only the AUX sensor in the EMS has a configurable Normal State"
-   ::= { emsSensorConfigEntry 4 }
-
-emsSensorConfigSensorAlarmDelay   OBJECT-TYPE
-   SYNTAX  INTEGER 
-   ACCESS  read-write
-   STATUS  mandatory
-   DESCRIPTION
-      "The delay (in seconds) after a sensor detects an alarm condition before the
-       condition is reported."
-   ::= { emsSensorConfigEntry 5 }
-
---  EMS STATUS
---- EMS MASTER status
-
-emsStatusEMSName OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A character string identifying the 
-       device. "
-   ::= { emsStatus 1 }
-
-emsStatusCommStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-      noComm(1),
-      comm(2),
-      commLost(3)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The communication status between the agent
-       and the device.
-       
-       noComm(1),   Communication has never been established.
-       comm(2),     Communication has been established.
-       commLost(3), Communication was established, but was lost."
-   ::= { emsStatus 2 }
-
-emsStatusProbeCount OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The total number of T/H probes (both local and remote) that
-       is supported by this device."
-   ::= { emsStatus 3 }
-
-emsStatusInputContactCount OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The total number of Input Contacts that
-       is supported by this device."
-   ::= { emsStatus 4 }
-
-emsStatusOutputRelayCount OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The total number of Output Relays that
-       is supported by this device."
-   ::= { emsStatus 5 }
-
-emsStatusOutletCount OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The total number of  AC Outlets that
-       is supported by this device."
-   ::= { emsStatus 6 }
-
-emsStatusSensorCount OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The total number of Sensors that
-       is supported by this device."
-   ::= { emsStatus 7 }
-   
-emsStatusAlinkAruDeviceCount OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The total number of remote Aru's supported by this device."
-   ::= { emsStatus 8 }
-
-emsStatusAlinkProbeDeviceCount OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The total number of remote T/H probes supported by this device."
-   ::= { emsStatus 9 }
-
-emsStatusAlarmDeviceCount OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of alarm devices supported by this device."
-   ::= { emsStatus 10 }
-
-emsStatusSysTempUnits OBJECT-TYPE
-   SYNTAX INTEGER {
-      celsius(1),
-      fahrenheit(2)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The temperature scale used to display the temperature
-       in the system, Celsius(1) or Fahrenheit(2).
-       This setting is based on the system preferences
-       configuration in the agent."
-   ::= { emsStatus 11 }
-
-emsStatusCheckLogLight   OBJECT-TYPE
-   SYNTAX INTEGER       {
-      lightOff         (1),
-      lightOn          (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the check-log light on the device.
-      For the EMU2, this will always indicate lightOff(1).
-
-      lightOff (1) indicates the light is off (no new log entries).
-      lightOn (2) indicates the light is on (new log entries present)."
-
-   ::= { emsStatus 12 }
-
-emsStatusHardwareStatus   OBJECT-TYPE
-   SYNTAX INTEGER       
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the EMS hardware.  This integer should be interpreted
-       as a bit map, with each bit representing the presence or absence of
-       a specific hardware error condition.
-       
-       0 indicates there are no error conditions detected in the EMS hardware.
-       1 indicates a Current Limit error condition related to the Alink port.
-       2 indicates incorrect hardware is plugged into an EMS port.
-       3 indicates that both of these error conditions are present."
-
-   ::= { emsStatus 13 }
-
--- EMS PROBE STATUS TABLE
-
-emsProbeStatusTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF EMSProbeStatusEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for access of individual probes. The number of
-       entries is contained in the emsStatusProbeCount OID."
-   ::= { emsProbeStatus 1 }
-
-emsProbeStatusEntry OBJECT-TYPE
-   SYNTAX EMSProbeStatusEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The probes to access."
-   INDEX  { emsProbeStatusProbeIndex }
-   ::= { emsProbeStatusTable 1 }
-
-EMSProbeStatusEntry ::=
-   SEQUENCE {
-      emsProbeStatusProbeIndex                INTEGER,
-      emsProbeStatusProbeName                 DisplayString,
-      emsProbeStatusProbeTemperature          INTEGER,
-      emsProbeStatusProbeHighTempThresh       INTEGER,
-      emsProbeStatusProbeLowTempThresh        INTEGER,
-      emsProbeStatusProbeHumidity             INTEGER,
-      emsProbeStatusProbeHighHumidityThresh   INTEGER,
-      emsProbeStatusProbeLowHumidityThresh    INTEGER,
-      emsProbeStatusProbeSerialNumber         DisplayString,
-      emsProbeStatusProbeCommStatus           INTEGER,
-      emsProbeStatusProbeAlarmStatus          INTEGER,
-      emsProbeStatusProbeMaxTempThresh        INTEGER,
-      emsProbeStatusProbeMinTempThresh        INTEGER,
-      emsProbeStatusProbeMaxHumidityThresh    INTEGER,
-      emsProbeStatusProbeMinHumidityThresh    INTEGER
-   }      
-
-emsProbeStatusProbeIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the probe entry."
-   ::= { emsProbeStatusEntry 1 }
-   
-emsProbeStatusProbeName   OBJECT-TYPE
-   SYNTAX  DisplayString 
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the probe."
-   ::= { emsProbeStatusEntry 2 }
-
-emsProbeStatusProbeTemperature OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Probe temperature reading. 
-
-      Values are represented in whole number degrees.
-      Units are displayed in the scale shown in
-      the emsStatusSysTempUnits OID (Celsius or Fahrenheit)."
-   ::= { emsProbeStatusEntry 3 }
-
-emsProbeStatusProbeHighTempThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Probe high temperature threshold. 
-
-      Values are represented in whole number degrees.
-      Units are displayed in the scale shown in
-      the emsStatusSysTempUnits OID (Celsius or Fahrenheit)."
-   ::= { emsProbeStatusEntry 4 }
-   
-emsProbeStatusProbeLowTempThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Probe low temperature threshold. 
-
-      Values are represented in whole number degrees.
-      Units are displayed in the scale shown in
-      the emsStatusSysTempUnits OID (Celsius or Fahrenheit)."
-   ::= { emsProbeStatusEntry 5 }
-   
-emsProbeStatusProbeHumidity OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Probe humidity reading. 
-
-      Values are represented in whole number percentage."
-   ::= { emsProbeStatusEntry 6 }
-
-emsProbeStatusProbeHighHumidityThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Probe high humidity threshold. 
-
-      Values are represented in whole number percentage."
-   ::= { emsProbeStatusEntry 7 }
-   
-emsProbeStatusProbeLowHumidityThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Probe low humidity threshold. 
-
-      Values are represented in whole number percentage."
-   ::= { emsProbeStatusEntry 8 }
-
-emsProbeStatusProbeSerialNumber   OBJECT-TYPE
-   SYNTAX  DisplayString 
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "A label indicating the type (Local[L] or Remote[R]) and Number
-       of the probe.  For example, the first local probe would be L1 and
-       the third remote probe would be R3."
-   ::= { emsProbeStatusEntry 9 }
-
-emsProbeStatusProbeCommStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-      commsNeverDiscovered(1),
-      commsEstablished(2),
-      commsLost(3)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      " The state of communications to the probe.
-      commNeverDiscovered(1) indicates there has never been communications with this device.
-      commsEstablished(2) indicates communication is normal and active with this device.
-      commsLost(3) indicates communication had been established, but is no longer."
-   ::= { emsProbeStatusEntry 10 }
-
-emsProbeStatusProbeAlarmStatus   OBJECT-TYPE
-   SYNTAX INTEGER       
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The alarm status of the probe.  This integer should be interpreted
-       as a bit map, with each bit representing the presence or absence of
-       the specific alarm conditions listed below.  The bit will be '1' if
-       the condition is present, and '0' if the condition is not present.
-       
-       Bit  Hex. Value  Description
-       1    0x0001      Maximum temperature exceeded.
-       2    0x0002      High temperature exceeded.
-       3    0x0004      Low temperature exceeded.
-       4    0x0008      Minimum temperature exceeded.
-       5    0x0010      Short-term increasing temperature rate exceeded.
-       6    0x0020      Short-term decreasing temperature rate exceeded.
-       7    0x0040      Long-term increasing temperature rate exceeded.
-       8    0x0080      Long-term decreasing temperature rate exceeded.
-       9    0x0100      Maximum humidity exceeded.
-       10   0x0200      High humidity exceeded.
-       11   0x0400      Low humidity exceeded.
-       12   0x0800      Minimum humidity exceeded."
-   ::= { emsProbeStatusEntry 11 }
-
-emsProbeStatusProbeMaxTempThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Probe maximum temperature threshold. 
-
-      Values are represented in whole number degrees.
-      Units are displayed in the scale shown in
-      the emsStatusSysTempUnits OID (Celsius or Fahrenheit)."
-   ::= { emsProbeStatusEntry 12 }
-   
-emsProbeStatusProbeMinTempThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Probe minimum temperature threshold. 
-
-      Values are represented in whole number degrees.
-      Units are displayed in the scale shown in
-      the emsStatusSysTempUnits OID (Celsius or Fahrenheit)."
-   ::= { emsProbeStatusEntry 13 }
-   
-emsProbeStatusProbeMaxHumidityThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Probe maximum humidity threshold. 
-
-      Values are represented in whole number percentage."
-   ::= { emsProbeStatusEntry 14 }
-   
-emsProbeStatusProbeMinHumidityThresh OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "Probe minimum humidity threshold. 
-
-      Values are represented in whole number percentage."
-   ::= { emsProbeStatusEntry 15 }
-   
-
--- EMS INPUT CONTACT STATUS TABLE
-
-emsInputContactStatusTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF EMSInputContactStatusEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for access of individual input contacts. The number of
-       entries is contained in the emsStatusInputContactCount OID."
-   ::= { emsInputContactStatus 1 }
-
-emsInputContactStatusEntry OBJECT-TYPE
-   SYNTAX EMSInputContactStatusEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The input contacts to access."
-   INDEX  { emsInputContactStatusInputContactIndex }
-   ::= { emsInputContactStatusTable 1 }
-
-EMSInputContactStatusEntry ::=
-   SEQUENCE {
-      emsInputContactStatusInputContactIndex         INTEGER,
-      emsInputContactStatusInputContactName          DisplayString,
-      emsInputContactStatusInputContactState         INTEGER,
-      emsInputContactStatusInputContactNormalState   INTEGER
-   }      
-
-emsInputContactStatusInputContactIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the input contact entry."
-   ::= { emsInputContactStatusEntry 1 }
-   
-emsInputContactStatusInputContactName   OBJECT-TYPE
-   SYNTAX  DisplayString 
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the input contact."
-   ::= { emsInputContactStatusEntry 2 }
-   
-emsInputContactStatusInputContactState OBJECT-TYPE
-   SYNTAX INTEGER {
-      contactClosedEMS         (1),
-      contactOpenEMS           (2)
-   }     
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "Getting this variable will return the state of the input contact. If 
-       the input contact is closed, the contactClosedEMS (1) value will be returned.
-       If the input contact state is open, the contactOpenEMS (2) value will be
-       returned. "
-       
-   ::= { emsInputContactStatusEntry 3 }
-
-emsInputContactStatusInputContactNormalState OBJECT-TYPE
-   SYNTAX INTEGER {
-      normallyClosedEMS         (1),
-      normallyOpenEMS           (2)
-   }     
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "Getting this variable will return the normal state of the input contact. If 
-       the normal state is closed, the normallyClosedEMS (1) value will be returned.
-       If the normal state is open, the normallyOpenEMS (2) value will be
-       returned. "
-       
-   ::= { emsInputContactStatusEntry 4 }
-
-
--- EMS OUTPUT RELAY STATUS TABLE
-
-emsOutputRelayStatusTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF EMSOutputRelayStatusEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for access of individual output relays. The number of
-       entries is contained in the emsStatusOutputRelayCount OID."
-   ::= { emsOutputRelayStatus 1 }
-
-emsOutputRelayStatusEntry OBJECT-TYPE
-   SYNTAX EMSOutputRelayStatusEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The output relays to access."
-   INDEX  { emsOutputRelayStatusOutputRelayIndex }
-   ::= { emsOutputRelayStatusTable 1 }
-
-EMSOutputRelayStatusEntry ::=
-   SEQUENCE {
-      emsOutputRelayStatusOutputRelayIndex          INTEGER,
-      emsOutputRelayStatusOutputRelayName           DisplayString,
-      emsOutputRelayStatusOutputRelayState          INTEGER,
-      emsOutputRelayStatusOutputRelayNormalState    INTEGER
-   }      
-
-emsOutputRelayStatusOutputRelayIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the output relay entry."
-   ::= { emsOutputRelayStatusEntry 1 }
-   
-emsOutputRelayStatusOutputRelayName   OBJECT-TYPE
-   SYNTAX  DisplayString 
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the output relay."
-   ::= { emsOutputRelayStatusEntry 2 }
-
-emsOutputRelayStatusOutputRelayState OBJECT-TYPE
-   SYNTAX INTEGER {
-      relayClosedEMS         (1),
-      relayOpenEMS           (2)
-   }     
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "Getting this variable will return the state of the output relay. If 
-       the output relay is closed, the relayClosedEMS (1) value will be returned.
-       If the output relay is open, the relayOpenEMS (2) value will be
-       returned. "
-       
-   ::= { emsOutputRelayStatusEntry 3 }
-
-emsOutputRelayStatusOutputRelayNormalState OBJECT-TYPE
-   SYNTAX INTEGER {
-      normallyClosedEMS         (1),
-      normallyOpenEMS           (2)
-   }     
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "Getting this variable will return the normal state of the output relay. If 
-       the normal state is closed, the normallyClosedEMS (1) value will be returned.
-       If the normal state is open, the normallyOpenEMS (2) value will be
-       returned. "
-       
-   ::= { emsOutputRelayStatusEntry 4 }
-   
--- EMS OUTLET STATUS TABLE
-  
-emsOutletStatusTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF EMSOutletStatusEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for access of individual outlets. The number of
-       entries is contained in the emsStatusOutletCount OID."
-   ::= { emsOutletStatus 1 }
-
-emsOutletStatusEntry OBJECT-TYPE
-   SYNTAX EMSOutletStatusEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The outlets to access."
-   INDEX  { emsOutletStatusOutletIndex }
-   ::= { emsOutletStatusTable 1 }
-
-EMSOutletStatusEntry ::=
-   SEQUENCE {
-      emsOutletStatusOutletIndex          INTEGER,
-      emsOutletStatusOutletName           DisplayString,
-      emsOutletStatusOutletState          INTEGER,
-      emsOutletStatusOutletNormalState    INTEGER
-   }      
-
-emsOutletStatusOutletIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the outlet entry."
-   ::= { emsOutletStatusEntry 1 }
-   
-emsOutletStatusOutletName   OBJECT-TYPE
-   SYNTAX  DisplayString    ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the outlet."
-   ::= { emsOutletStatusEntry 2 }
-
-emsOutletStatusOutletState OBJECT-TYPE
-   SYNTAX INTEGER {
-      outletOnEMS             (1),
-      outletOffEMS            (2)
-   }     
-
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "Getting this variable will return the state of the outlet. If 
-       the outlet is on, the outletOnEMS (1) value will be returned.
-       If the outlet is off, the outletOffEMS (2) value will be
-       returned. "
-       
-   ::= { emsOutletStatusEntry 3 }
-
-emsOutletStatusOutletNormalState OBJECT-TYPE
-   SYNTAX INTEGER {
-      normallyOnEMS             (1),
-      normallyOffEMS            (2)
-   }     
-
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "Getting this variable will return the normal state of the outlet. If 
-       the normal state is on, the normallyOnEMS (1) value will be returned.
-       If the normal state is off, the normallyOffEMS (2) value will be
-       returned. "
-       
-   ::= { emsOutletStatusEntry 4 }
-
--- EMS ALARM DEVICE STATUS TABLE
- 
-emsAlarmDeviceStatusTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF EMSAlarmDeviceStatusEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for access of individual alarm devices. The number of
-       entries is contained in the emsStatusAlarmDeviceCount OID."
-   ::= { emsAlarmDeviceStatus 1 }
-
-emsAlarmDeviceStatusEntry OBJECT-TYPE
-   SYNTAX EMSAlarmDeviceStatusEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The alarm devices to access."
-   INDEX  { emsAlarmDeviceStatusDeviceIndex }
-   ::= { emsAlarmDeviceStatusTable 1 }
-
-EMSAlarmDeviceStatusEntry ::=
-   SEQUENCE {
-      emsAlarmDeviceStatusDeviceIndex   INTEGER,
-      emsAlarmDeviceStatusDeviceName    DisplayString,
-      emsAlarmDeviceStatusDeviceState   INTEGER
-   }      
-
-emsAlarmDeviceStatusDeviceIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the alarm device entry."
-   ::= { emsAlarmDeviceStatusEntry 1 }
-   
-emsAlarmDeviceStatusDeviceName    OBJECT-TYPE
-   SYNTAX  DisplayString
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the alarm device.
-       This OID is provided for informational purposes only."
-   ::= { emsAlarmDeviceStatusEntry 2 }
-
-emsAlarmDeviceStatusDeviceState OBJECT-TYPE
-   SYNTAX INTEGER {
-      alarmDeviceOnEMS             (1),
-      alarmDeviceOffEMS            (2),
-      alarmDeviceNotInstalledEMS   (3)   
-   }     
-
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "Getting this variable will return the device state. If 
-       the device is active, the alarmDeviceOnEMS (1) value will be returned.
-       If the device is inactive, the alarmDeviceOffEMS (2) value will be
-       returned.  If the device is not installed, the 
-       alarmDeviceNotInstalledEMS (3) value will be returned."
-
-   ::= { emsAlarmDeviceStatusEntry 3 }
-
-   
--- EMS SENSOR STATUS TABLE
-
-emsSensorStatusTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF EMSSensorStatusEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for access of individual sensors. The number of
-       entries is contained in the emsStatusSensorCount OID."
-   ::= { emsSensorStatus 1 }
-
-emsSensorStatusEntry OBJECT-TYPE
-   SYNTAX EMSSensorStatusEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The sensors to access."
-   INDEX  { emsSensorStatusSensorIndex }
-   ::= { emsSensorStatusTable 1 }
-
-EMSSensorStatusEntry ::=
-   SEQUENCE {
-      emsSensorStatusSensorIndex         INTEGER,
-      emsSensorStatusSensorSystemName    DisplayString,
-      emsSensorStatusSensorName          DisplayString,
-      emsSensorStatusSensorState         INTEGER,
-      emsSensorStatusSensorNormalState   INTEGER,
-      emsSensorStatusSensorAlarmDelay    INTEGER
-   }      
-
-emsSensorStatusSensorIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the sensor entry."
-   ::= { emsSensorStatusEntry 1 }
- 
-emsSensorStatusSensorSystemName   OBJECT-TYPE
-   SYNTAX  DisplayString 
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The system name of the sensor.  This describes the hardware system
-       intent of this sensor."
-   ::= { emsSensorStatusEntry 2 }
-  
-emsSensorStatusSensorName   OBJECT-TYPE
-   SYNTAX  DisplayString 
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the sensor as given by the system user."
-   ::= { emsSensorStatusEntry 3 }
-
-emsSensorStatusSensorState OBJECT-TYPE
-   SYNTAX INTEGER {
-      sensorFaultedEMS       (1),
-      sensorOKEMS            (2),
-      sensorNotInstalledEMS  (3)   
-   }     
-
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "Getting this variable will return the sensor state. If the sensor is faulted, 
-       the sensorFaultedEMS (1) value will be returned.
-       If the sensor is not faulted, the sensorOKEMS (2) value will be
-       returned. If the sensor is not installed, the  sensorNotInstalledEMS (3) 
-       value will be returned."
-   ::= { emsSensorStatusEntry 4 }
- 
-emsSensorStatusSensorNormalState OBJECT-TYPE
-   SYNTAX INTEGER {
-      normallyClosedEMS        (1),
-      normallyOpenEMS          (2)
-   }     
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-       "Getting this variable will return the normal state of the sensor. If 
-       the normal state is closed, the normallyClosedEMS (1) value will be returned.
-       If the normal state is closed, the normallyOpenEMS (2) value will be
-       returned."
-   ::= { emsSensorStatusEntry 5 }
-
-emsSensorStatusSensorAlarmDelay   OBJECT-TYPE
-   SYNTAX  INTEGER 
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The delay (in seconds) after a sensor detects an alarm condition before the
-       condition is reported."
-   ::= { emsSensorStatusEntry 6 }
-   
-
-
---  airFM AIR CONDITIONER IDENT
-
-airFMIdentName OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A character string identifying the 
-       device. "
-   ::= { airFMIdent 1 }
-   
-airFMIdentTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of entries in the airFMIdentTable. "   
-   ::= { airFMIdent 2 } 
-
-airFMIdentTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF AirFMIdentTableEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for getting identification information 
-       from each module in the system. "    
-   ::= { airFMIdent 3 }
-
-airFMIdentTableEntry OBJECT-TYPE
-   SYNTAX AirFMIdentTableEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The module to get information from."
-   INDEX  { airFMIdentModuleIndex }
-   ::= { airFMIdentTable 1 }
-
-AirFMIdentTableEntry ::=
-   SEQUENCE {
-      airFMIdentModuleIndex            INTEGER,
-      airFMIdentModuleModelNumber      DisplayString,
-      airFMIdentModuleDateOfMfg        DisplayString,
-      airFMIdentModuleSerialNumber     DisplayString,
-      airFMIdentModuleFirmwareRev      DisplayString,
-      airFMIdentModuleHardwareRev      DisplayString
-   }
-   
-airFMIdentModuleIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index of the module information."
-   ::= { airFMIdentTableEntry 1 }
-
-airFMIdentModuleModelNumber OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A character string identifying the 
-       model number. "
-   ::= { airFMIdentTableEntry 2 }
-   
-airFMIdentModuleDateOfMfg OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A character string identifying the 
-       manufacture date. "
-   ::= { airFMIdentTableEntry 3 }
-   
-airFMIdentModuleSerialNumber OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A character string identifying the 
-       unit serial number. "
-   ::= { airFMIdentTableEntry 4 }
-   
-airFMIdentModuleFirmwareRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A character string identifying the 
-       firmware revision. "
-   ::= { airFMIdentTableEntry 5 }
-   
-airFMIdentModuleHardwareRev OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A character string identifying the 
-       hardware revision. "
-   ::= { airFMIdentTableEntry 6 }
-   
---  airFM AIR CONDITIONER STATUS
-
-airFMStatusSystemOn OBJECT-TYPE
-   SYNTAX INTEGER   {
-      statusOn      (1),
-      statusOff     (2)
-   }    
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The operating state of the system. "
-   ::= { airFMStatus 1 }
-   
-airFMStatusSystemAverageRetTempC OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The system average return air 
-       temperature in tenths of degrees Celsius. "
-   ::= { airFMStatus 2 }
-   
-airFMStatusSystemAverageRetTempF OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The system average return air 
-       temperature in tenths of degrees Fahrenheit. "
-   ::= { airFMStatus 3 }
-   
-airFMStatusSystemAverageRetHum OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The system average return air 
-       humidity. "
-   ::= { airFMStatus 4 }
-   
-airFMStatusSystemActionTempC OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The system action air 
-       temperature in tenths of degrees Celsius. "
-   ::= { airFMStatus 5 }
-   
-airFMStatusSystemActionTempF OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The system action air 
-       temperature in tenths of degrees Fahrenheit. "
-   ::= { airFMStatus 6 }
-   
-airFMStatusSystemActionHum OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The system action air humidity. "
-   ::= { airFMStatus 7 }
-   
-airFMStatusSystemRemoteHighTempC OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The system remote high air 
-       temperature in tenths of degrees Celsius. "
-   ::= { airFMStatus 8 }
-   
-airFMStatusSystemRemoteHighTempF OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The system remote high air 
-       temperature in tenths of degrees Fahrenheit. "
-   ::= { airFMStatus 9 }
-   
-airFMStatusSystemRemoteAvgTempC OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The system remote average air 
-       temperature in tenths of degrees Celsius. "
-   ::= { airFMStatus 10 }
-   
-airFMStatusSystemRemoteAvgTempF OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The system remote average air 
-       temperature in tenths of degrees Fahrenheit. "
-   ::= { airFMStatus 11 }
-   
-airFMStatusSystemRemoteAvgHum OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The system remote average air 
-       humidity. "
-   ::= { airFMStatus 12 }
-   
-airFMStatusSystemRemoteLowTempC OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The system remote low air 
-       temperature in tenths of degrees Celsius. "
-   ::= { airFMStatus 13 }
-   
-airFMStatusSystemRemoteLowTempF OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The system remote low air 
-       temperature in tenths of degrees Fahrenheit. "
-   ::= { airFMStatus 14 }
-   
-airFMStatusSystemCoolingEnabled OBJECT-TYPE
-   SYNTAX INTEGER   {
-      enabledYes    (1),
-      enabledNo     (2)
-   }    
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The state of the system cooling
-       function enable. "
-   ::= { airFMStatus 15 }
-   
-airFMStatusSystemReheatingEnabled OBJECT-TYPE
-   SYNTAX INTEGER   {
-      enabledYes    (1),
-      enabledNo     (2)
-   }    
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The state of the system reheating
-       function enable. "
-   ::= { airFMStatus 16 }
-   
-airFMStatusSystemHumidifyEnabled OBJECT-TYPE
-   SYNTAX INTEGER   {
-      enabledYes    (1),
-      enabledNo     (2)
-   }    
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The state of the system humidify
-       function enable. "
-   ::= { airFMStatus 17 }
-   
-airFMStatusSystemDehumidifyEnabled OBJECT-TYPE
-   SYNTAX INTEGER   {
-      enabledYes    (1),
-      enabledNo     (2)
-   }    
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The state of the system dehumidify
-       function enable. "
-   ::= { airFMStatus 18 }
-   
-airFMStatusModuleTableSize OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of entries in the airFMStatusModuleTable. "   
-   ::= { airFMStatus 19 }   
-
-airFMStatusModuleTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF AirFMStatusModuleEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for getting information from each module
-       in the system. " 
-   ::= { airFMStatus 20 }
-
-airFMStatusModuleEntry OBJECT-TYPE
-   SYNTAX AirFMStatusModuleEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The module to get status from."
-   INDEX  { airFMStatusModuleIndex }
-   ::= { airFMStatusModuleTable 1 }
-
-AirFMStatusModuleEntry ::=
-   SEQUENCE {
-      airFMStatusModuleIndex               INTEGER,
-      airFMStatusModuleOutputCapacity      INTEGER,
-      airFMStatusModuleSupplyTempC         INTEGER,
-      airFMStatusModuleSupplyTempF         INTEGER,
-      airFMStatusModuleSupplyHum           INTEGER,
-      airFMStatusModuleReturnTempC         INTEGER, 
-      airFMStatusModuleReturnTempF         INTEGER, 
-      airFMStatusModuleReturnHum           INTEGER
-   }
-   
-airFMStatusModuleIndex OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index of the module information."
-   ::= { airFMStatusModuleEntry 1 }
-
-airFMStatusModuleOutputCapacity OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The module output capacity in kilowatts."
-   ::= { airFMStatusModuleEntry 2 }
-   
-airFMStatusModuleSupplyTempC OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The module supply air temperature in 
-       tenths of degrees Celsius. "
-   ::= { airFMStatusModuleEntry 3 }
-   
-airFMStatusModuleSupplyTempF OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The module supply air temperature in 
-       tenths of degrees Fahrenheit. "
-   ::= { airFMStatusModuleEntry 4 }
-   
-airFMStatusModuleSupplyHum OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The module supply air humidity. "
-   ::= { airFMStatusModuleEntry 5 }
-   
-airFMStatusModuleReturnTempC OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The module return air temperature in 
-       tenths of degrees Celsius. "
-   ::= { airFMStatusModuleEntry 6 }
-   
-airFMStatusModuleReturnTempF OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The module return air temperature in 
-       tenths of degrees Fahrenheit. "
-   ::= { airFMStatusModuleEntry 7 }
-   
-airFMStatusModuleReturnHum OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The module return air humidity. "
-   ::= { airFMStatusModuleEntry 8 }
-   
--- airFM AIR CONDITIONER GROUP DATA
-
-airFMGroupSysStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-        statusOnLine    (1),
-        statusIdle      (2),
-        statusLoadShare (3),
-        statusOffLine   (4),
-        statusFailed    (5)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of this system within the group. "
-   ::= { airFMGroup 1 }
-   
-airFMGroupSysRuntime OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The number of hours the system has been running. "
-   ::= { airFMGroup 2 }
-
-airFMGroupSysRole OBJECT-TYPE
-   SYNTAX INTEGER {
-        rolePrimary     (1),
-        roleBackup      (2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The role of this system within the group. "
-   ::= { airFMGroup 3 }
-
--- airPA Portable Air Conditioner Ident
-
-airPAIdentName OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A character string identifying the device name. "
-   ::= { airPAIdent 1 }
-   
-airPAModelNumber OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A character string identifying the device model number. "
-   ::= { airPAIdent 2 }
-   
-airPADateOfManufacture OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A character string identifying when the device was produced. "
-   ::= { airPAIdent 3 }
-   
-airPASerialNumber OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A character string identifying the device serial number. "
-   ::= { airPAIdent 4 }
-
-airPAFirmwareRevision OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A character string identifying the device firmware revision. "
-   ::= { airPAIdent 5 }
-
-airPAHardwareRevision OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A character string identifying the device hardware revision. "
-   ::= { airPAIdent 6 }
-
--- airPA Portable Air Conditioner Status
-
-airPASystemPower OBJECT-TYPE
-   SYNTAX INTEGER   {
-      powerON   (1),
-      powerOFF  (2)
-   }    
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The status of the unit's system power setting.
-      
-        ON(1)   The system power is turned on.
-        OFF(2)  The system power is turned off. "
-   ::= { airPAStatus 1 }
-
-airPAOperatingMode OBJECT-TYPE
-   SYNTAX INTEGER   {
-      modeOFF       (1),
-      modeVENTING   (2),
-      modeCOOLING   (3)
-   }    
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The current operating mode of the unit.
-
-        OFF(1)      The system is off.
-        VENTING(2)  The system's venting function is active.
-        COOLING(3)  The system's cooling function is active. "
-   ::= { airPAStatus 2 }
-
-airPASetpointTempF OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The temperature setpoint in Fahrenheit to which the unit is controlling. "
-   ::= { airPAStatus 3 }
-
-airPASetpointTempC OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The temperature setpoint in Celsius to which the unity is controlling. "
-   ::= { airPAStatus 4 }
-
-airPABlowerSpeed OBJECT-TYPE
-   SYNTAX INTEGER   {
-        speedLOW    (1),
-        speedHIGH   (2)
-    }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The unit's blower speed setting.
-
-        LOW(1)      The blower speed is low.
-        HIGH(2)     The blower speed is high. "
-   ::= { airPAStatus 5 }
-
-airPACompressor OBJECT-TYPE
-   SYNTAX INTEGER   {
-        statusON    (1),
-        statusOFF   (2)
-    }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The unit's compressor status.
-
-        ON(1)   The compressor is turned on.
-        OFF(2)  The compressor is turned off. "
-   ::= { airPAStatus 6 }
-
-airPACondenserFan OBJECT-TYPE
-   SYNTAX INTEGER   {
-        statusON    (1),
-        statusOFF   (2)
-    }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The unit's condenser fan status.
-
-        ON(1)   The condenser fan is turned on.
-        OFF(2)  The condenser fan is turned off. "
-   ::= { airPAStatus 7 }
-
-airPACondensatePump OBJECT-TYPE
-   SYNTAX INTEGER   {
-        statusON    (1),
-        statusOFF   (2)
-    }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The unit's condensate pump status.
-      
-        ON(1)   The condensate pump is turned on.
-        OFF(2)  The condensate pump is turned off. "
-   ::= { airPAStatus 8 }
-
-airPASupplyTempF OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The supply temperature in degrees Fahrenheit. "
-   ::= { airPAStatus 9 }
-
-airPASupplyTempC OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The supply temperature in degrees Celsius. "
-   ::= { airPAStatus 10 }
-
-airPAReturnTempF OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The return temperature in degrees Fahrenheit. "
-   ::= { airPAStatus 11 }
-
-airPAReturnTempC OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The return temperature in degrees Celsius. "
-   ::= { airPAStatus 12 }
-
-airPARemoteTempF OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The remote temperature in degrees Fahrenheit. "
-   ::= { airPAStatus 13 }
-
-airPARemoteTempC OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The remote temperature in degrees Celsius. "
-   ::= { airPAStatus 14 }
-
-airPARemoteHumidity OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The remote humidity. "
-   ::= { airPAStatus 15 }
-
---  RACK AIR REMOVAL UNIT IDENT
-
-rARUIdentTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF IdentRARUEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for query of the individual devices. 
-       The number of entries is contained in the 
-       rARUStatusAruDeviceCount OID."
-   ::= { rARUIdent 1 }
-
-rARUIdentEntry OBJECT-TYPE
-   SYNTAX IdentRARUEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The device to query."
-   INDEX  { rARUIdentIndex}
-   ::= { rARUIdentTable 1 }
-
-IdentRARUEntry ::=
-   SEQUENCE {
-      rARUIdentIndex                 INTEGER,
-      rARUIdentName                  DisplayString
-   }      
-
-rARUIdentIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the device entry."
-   ::= { rARUIdentEntry 1 }
-
-rARUIdentName OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "A character string identifying the 
-       device. "
-   ::= { rARUIdentEntry 2 }
-
-
--- RACK AIR REMOVAL UNIT CONFIGURATION
-
-rARUConfigTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF ConfigRARUEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for configuration of individual ARUs. The number of
-       entries is contained in the rARUStatusAruDeviceCount OID."
-   ::= { rARUConfig 1 }
-
-rARUConfigEntry OBJECT-TYPE
-   SYNTAX ConfigRARUEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The ARUs to configure."
-   INDEX  { rARUConfigAruIndex }
-   ::= { rARUConfigTable 1 }
-
-ConfigRARUEntry ::=
-   SEQUENCE {
-      rARUConfigAruIndex                  INTEGER,
-      rARUConfigAruName                   DisplayString,
-      rARUConfigAruRemoteSetpoint         INTEGER,
-      rARUConfigAruTempOvrdEnableDisable  INTEGER,
-      rARUConfigAruTempOvrdSetpoint       INTEGER
-   }      
-
-rARUConfigAruIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the device entry."
-   ::= { rARUConfigEntry 1 }
-   
-rARUConfigAruName   OBJECT-TYPE
-   SYNTAX  DisplayString 
-   ACCESS  read-write
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the ARU."
-   ::= { rARUConfigEntry 2 }
-
-rARUConfigAruRemoteSetpoint OBJECT-TYPE
-   SYNTAX INTEGER       {
-      aruOff          (1),
-      aru85F-29C      (2),
-      aru90F-32C      (3),
-      aru95F-35C      (4),
-      aru100F-38C     (5),
-      aru7kW          (6),
-      aru5kW          (7),
-      aru3kW          (8),
-      aru2kW          (9)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "This OID is the Remote setpoint of the ARU.
-       NOTE: -1 will be returned if the ARU is not communicating."
-
-   ::= { rARUConfigEntry 3 }
-
-rARUConfigAruTempOvrdEnableDisable OBJECT-TYPE
-   SYNTAX INTEGER       {
-      disabled(1),
-      enabled(2)
-   }
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "This OID is used to enable/disable the remote temperature override setting of the ARU.
-  
-       If this OID is set to 1, the remote setting for temperature override is disabled.
-       If this OID is set to 2, the remote setting for temperature override is enabled."
-   ::= { rARUConfigEntry 4 }
-
-rARUConfigAruTempOvrdSetpoint OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-write
-   STATUS mandatory
-   DESCRIPTION
-      "This OID is the Temperature Override setpoint of the ARU.
-       NOTE: -1 will be returned if the ARU is not communicating."
-
-   ::= { rARUConfigEntry 5 }
-   
--- RACK AIR REMOVAL UNIT STATUS
-
-rARUStatusAruDeviceCount OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The total number of ARUs accessible from this IP."
-   ::= { rARUStatus 1 }
-
-rARUStatusSysTempUnits OBJECT-TYPE
-   SYNTAX INTEGER {
-      celsius(1),
-      fahrenheit(2)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The temperature scale used to display the temperature
-       in the system, Celsius(1) or Fahrenheit(2).
-       This setting is based on the system preferences
-       configuration in the agent."
-   ::= { rARUStatus 2 }
-
-rARUStatusTable OBJECT-TYPE
-   SYNTAX SEQUENCE OF StatusRARUEntry
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "Allows for access of individual ARUs. The number of
-       entries is contained in the rARUStatusAruDeviceCount OID."
-   ::= { rARUStatus 3 }
-
-rARUStatusEntry OBJECT-TYPE
-   SYNTAX StatusRARUEntry  
-   ACCESS not-accessible
-   STATUS mandatory
-   DESCRIPTION
-      "The ARUs to access."
-   INDEX  { rARUStatusAruIndex }
-   ::= { rARUStatusTable 1 }
-
-StatusRARUEntry ::=
-   SEQUENCE {
-      rARUStatusAruIndex                 INTEGER,
-      rARUStatusAruName                  DisplayString,
-      rARUStatusAruRemoteSetpoint        INTEGER,      
-      rARUStatusAruManualSetpoint        INTEGER,      
-      rARUStatusAruTemp1                 INTEGER,      
-      rARUStatusAruTemp2                 INTEGER,      
-      rARUStatusAruTemp3                 INTEGER,      
-      rARUStatusAruTempOvrdEnableDisable INTEGER,      
-      rARUStatusAruTempOvrdSetpoint      INTEGER,      
-      rARUStatusAruAlarmState            DisplayString,
-      rARUStatusAruCommStatus            INTEGER
-   }
-
-rARUStatusAruIndex OBJECT-TYPE
-   SYNTAX INTEGER 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The index to the ARU entry."
-   ::= { rARUStatusEntry 1 }
-   
-rARUStatusAruName   OBJECT-TYPE
-   SYNTAX  DisplayString 
-   ACCESS  read-only
-   STATUS  mandatory
-   DESCRIPTION
-      "The name of the ARU."
-   ::= { rARUStatusEntry 2 }
-
-rARUStatusAruRemoteSetpoint OBJECT-TYPE
-   SYNTAX INTEGER       {
-      aruOff          (1),
-      aru85F-29C      (2),
-      aru90F-32C      (3),
-      aru95F-35C      (4),
-      aru100F-38C     (5),
-      aru7kW          (6),
-      aru5kW          (7),
-      aru3kW          (8),
-      aru2kW          (9)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "ARU remote setpoint temperature setting.
-
-      NOTE: -1 will be returned if the ARU is not communicating.
-
-      Values are represented in whole number degrees.
-      Units are displayed in the scale shown in
-      the rARUStatusSysTempUnits OID (Celsius or Fahrenheit)."
-   ::= { rARUStatusEntry 3 }
-
-rARUStatusAruManualSetpoint OBJECT-TYPE
-   SYNTAX INTEGER       {
-      aruOff          (1),
-      aru85F-29C      (2),
-      aru90F-32C      (3),
-      aru95F-35C      (4),
-      aru100F-38C     (5),
-      aru7kW          (6),
-      aru5kW          (7),
-      aru3kW          (8),
-      aru2kW          (9),
-      aruRem          (10)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "ARU manual setpoint temperature setting. 
-
-      NOTE: -1 will be returned if the ARU is not communicating.
-
-      Values are represented in whole number degrees.
-      If the manual setpoint is set to Remote, this OID will return 0.
-      Units are displayed in the scale shown in
-      the rARUStatusSysTempUnits OID (Celsius or Fahrenheit)."
-   ::= { rARUStatusEntry 4 }
-
-rARUStatusAruTemp1 OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "ARU temperature probe #1 reading. 
-
-      NOTE: -1 will be returned if the ARU is not communicating.
-
-      Values are represented in whole number degrees.
-      Units are displayed in the scale shown in
-      the rARUStatusSysTempUnits OID (Celsius or Fahrenheit)."
-   ::= { rARUStatusEntry 5 }
-
-rARUStatusAruTemp2 OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "ARU temperature probe #2 reading. 
-
-      NOTE: -1 will be returned if the ARU is not communicating.
-
-      Values are represented in whole number degrees.
-      Units are displayed in the scale shown in
-      the rARUStatusSysTempUnits OID (Celsius or Fahrenheit)."
-   ::= { rARUStatusEntry 6 }
-
-rARUStatusAruTemp3 OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "ARU temperature probe #3 reading. 
-
-      NOTE: -1 will be returned if the ARU is not communicating.
-
-      Values are represented in whole number degrees.
-      Units are displayed in the scale shown in
-      the rARUStatusSysTempUnits OID (Celsius or Fahrenheit)."
-   ::= { rARUStatusEntry 7 }
-
-rARUStatusAruTempOvrdEnableDisable OBJECT-TYPE
-   SYNTAX INTEGER       {
-      disabled(1),
-      enabled(2)
-   }
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "This OID indicates whether the ARU remote temperature override is enabled or disabled.
-       If this OID is a 1, the remote setting for temperature override is disabled.
-       If this OID is a 2, the remote setting for temperature override is enabled."
-   ::= { rARUStatusEntry 8 }
-
-rARUStatusAruTempOvrdSetpoint OBJECT-TYPE
-   SYNTAX INTEGER
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "ARU remote temperature override setpoint setting. 
-
-      NOTE: -1 will be returned if the ARU is not communicating.
-
-      Values are represented in whole number degrees.
-      Units are displayed in the scale shown in
-      the rARUStatusSysTempUnits OID (Celsius or Fahrenheit)."
-   ::= { rARUStatusEntry 9 }
-
-rARUStatusAruAlarmState OBJECT-TYPE
-   SYNTAX DisplayString
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "An ASCII string containing the 8 flags representing
-       the current alarm state of the ARU. If the state of 
-       the ARU is unknown, this variable is set to ?UNKNOWN?.
-
-       The flags are numbered 1 to 8, read from left to
-       right. The flags are defined as follows:
-       
-       Flag  1: Fan Fail 1
-       Flag  2: Fan Fail 2
-       Flag  3: Fan Fail 3
-       Flag  4: Smoke
-            
-       Flag  5: High Temp (Out of Thermal Control)
-       Flag  6: Over Temp (Exhaust Temp. Exceeds Override Setpoint)
-       Flag  7: Reserved
-       Flag  8: Reserved"
-   ::= { rARUStatusEntry 10 }
-
-rARUStatusAruCommStatus OBJECT-TYPE
-   SYNTAX INTEGER {
-      commsNeverDiscovered(1),
-      commsEstablished(2),
-      commsLost(3)
-   } 
-   ACCESS read-only
-   STATUS mandatory
-   DESCRIPTION
-      "The state of communications to the device.
-      commNeverDiscovered(1) indicates there has never been communications with this device.
-      commsEstablished(2) indicates communication is normal and active with this device.
-      commsLost(3) indicates communication had been established, but is no device."
-   ::= { rARUStatusEntry 11 }
-
--- Traps
--- Annotations are provided for Novell's NMS product
---
--- Each trap has at least one variable (mtrapargsString) which always appears
--- as the last variable in the list. This variable contains either a static
--- or dynamically-constructed string which provides an enhanced description of
--- the trap's purpose and any pertinent information about the trap.
-
-communicationLost TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-       "SEVERE: Communication to the UPS has been lost.  Steps
-        to reestablish communication are in progress."
-   --#TYPE "APC UPS: Communication lost"
-   --#SUMMARY "Communication lost between the agent and the UPS."
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 1
-
-upsOverload TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The UPS has sensed a load greater than 100 percent
-       of its rated capacity."
-   --#TYPE "APC UPS: Overload"
-   --#SUMMARY "The UPS has sensed a load greater than 100 percent of its rated capacity."
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 2
-
-upsDiagnosticsFailed TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The UPS failed its internal diagnostic self-test."
-   --#TYPE "APC UPS: Failed self-test"
-   --#SUMMARY "The UPS has failed its internal self-test."
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 3
-
-upsDischarged TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The UPS batteries are discharged; if utility power fails
-       an immediate low battery condition will exist.  Sufficient runtime 
-       for necessary action cannot be guaranteed."
-   --#TYPE "APC UPS: batteries are discharged"
-   --#SUMMARY "The UPS batteries are discharged."
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 4
-
-upsOnBattery TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "WARNING: The UPS has switched to battery backup power."
-   --#TYPE "APC UPS: On battery"
-   --#SUMMARY "The UPS has switched to battery backup power."
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 5
-
-smartBoostOn TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "WARNING: The UPS has enabled SmartBoost(TM)."
-   --#TYPE "APC UPS: SmartBoost(TM)"
-   --#SUMMARY "The UPS has enabled SmartBoost(TM); low incoming line voltage."
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 6
-
-lowBattery TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The UPS batteries are low and will soon be exhausted.
-       If utility power is not restored the UPS will put itself 
-       to 'sleep' and immediately cut power to the load."
-   --#TYPE "APC UPS: Low battery"
-   --#SUMMARY "The UPS system's batteries are low and will soon be exhausted."
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 7
-
-communicationEstablished TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Communication with the UPS has been established."
-   --#TYPE "APC UPS: Communication established"
-   --#SUMMARY "UPS communication has been established."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 8
-
-powerRestored TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Utility power has been restored."
-   --#TYPE "APC UPS: Utility power restored"
-   --#SUMMARY "Returned from battery backup power; utility power restored."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 9
-
-upsDiagnosticsPassed TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The UPS passed its internal self-test."
-   --#TYPE "APC UPS: Passed self-test"
-   --#SUMMARY "The UPS passed internal self-test."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 10
-
-returnFromLowBattery TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The UPS has returned from a low battery
-       condition."
-   --#TYPE "APC UPS: Returned from Low-Battery condition"
-   --#SUMMARY "The UPS has returned from a Low-Battery condition."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 11
-
-upsTurnedOff TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "WARNING: The UPS has been turned 'off' by the management station."
-   --#TYPE "APC UPS: Turned off"
-   --#SUMMARY "The UPS has been switched off by a management station."
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE NONOPERATIONAL
-   ::= 12
-
-upsSleeping   TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "WARNING: The UPS is entering 'sleep' mode.  Power 
-       to the load will be cut off."
-   --#TYPE "APC UPS: Entered sleep mode"
-   --#SUMMARY "The UPS entered sleep mode. Power to the load will be cut off."
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE NONOPERATIONAL
-   ::= 13
-
-upsWokeUp TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATION: The UPS has returned from 'sleep' mode.  Power 
-       to the load has been restored."
-   --#TYPE "APC UPS: Wake up"
-   --#SUMMARY "The UPS has returned from sleep mode. Power to the load has been restored."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 14
-
-upsRebootStarted TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "WARNING: The UPS has started its reboot sequence.
-       The UPS will reboot itself at this time."
-   --#TYPE "APC UPS: Starting reboot"
-   --#SUMMARY "The UPS has started its reboot sequence."
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE NONOPERATIONAL
-   ::= 15 
-
-upsDipSwitchChanged TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "WARNING: The dip switch settings on the UPS have been
-       changed, possibly altering UPS performance."
-   --#TYPE "APC UPS: DIP switch altered"
-   --#SUMMARY "The DIP switch settings on the UPS have been changed."
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 16
-
-upsBatteryNeedsReplacement TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The batteries of the UPS need immediate replacement." 
-   --#TYPE "APC UPS: UPS batteries need replacement"
-   --#SUMMARY "The UPS batteries require immediate replacement."
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 17
-
-
--- the Environmental Monitor traps
-
-contactFault TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: One of the contacts on the Environmental Monitor has 
-       changed from its default position. The first variable is
-       the contact number that is faulted."
-   --#TYPE "APC Environment: Contact fault"
-   --#SUMMARY "An Environment contact closure has faulted."
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 18
-
-contactFaultResolved TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A fault on one of the Environmental Monitor contacts
-       has been resolved. The first variable is
-       the contact number that has been resolved."
-   --#TYPE "APC Environment: Contact fault cleared."
-   --#SUMMARY "A Environment contact closure has returned to it's default state."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 19
-
--- the Matrix-UPS traps
-
-hardwareFailureBypass TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "SEVERE: UPS on bypass due to internal fault"
-   --#TYPE "APC UPS: On bypass due to internal fault"
-   --#SUMMARY "The UPS is on bypass due to an internal fault."
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 20
-
-softwareBypass TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "WARNING: UPS on bypass - user set via software or panel"
-   --#TYPE "APC UPS: On bypass by user via software or panel"
-   --#SUMMARY "UPS put on bypass by user via software or front UPS panel."
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 21
-
-switchedBypass TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "WARNING: UPS on bypass - initiated by user"
-   --#TYPE "APC UPS: On bypass initiated by user"
-   --#SUMMARY "UPS put on bypass by user."
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 22
-
-returnFromBypass TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: UPS has returned from bypass"
-   --#TYPE "APC UPS: UPS has returned from bypass"
-   --#SUMMARY "The UPS has returned from bypass mode."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 23
-
-bypassPowerSupplyFailure TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Base module bypass power supply needs repair"
-   --#TYPE "APC UPS: Base module bypass power supply needs repair"
-   --#SUMMARY "The base module bypass power supply needs repair."
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE NONOPERATIONAL
-   ::= 24
-
-baseFanFailure TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Base module fan needs repair"
-   --#TYPE "APC UPS: Base module fan needs repair"
-   --#SUMMARY "The base module fan needs repair."
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE NONOPERATIONAL
-   ::= 25
-
-batteryPackCommLost TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Check installation of external battery packs signal cable"
-   --#TYPE "APC UPS: Communication lost with battery packs"
-   --#SUMMARY "Communication lost with external battery packs, check battery signal cable."
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 26
-
-batteryPackCommEstablished TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: UPS is communicating with the external battery packs."
-   --#TYPE "APC UPS: Communication established with battery packs"
-   --#SUMMARY "Communication established with external battery packs."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 27
-
-calibrationStart TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A battery calibration test has been initiated on the UPS."
-   --#TYPE "APC UPS: Calibration initiated"
-   --#SUMMARY "A battery run time calibration test has been initiated."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 28
-
--- Misc. Traps
-
-restartAgent TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Agent restarting as commanded by manager."
-   --#TYPE "APC SNMP Agent: Agent restarting"
-   --#SUMMARY "Agent restarting as commanded by manager."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 29
-
-upsTurnedOn TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A UPS is turned on."
-   --#TYPE "APC UPS: A UPS is turned on."
-   --#SUMMARY " A UPS is turned on."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 30
-
-smartAvrReducing TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "WARNING: The UPS is reducing the line voltage via SmartTrim(TM)."
-   --#TYPE "APC UPS: SmartTrim(TM) reducing"
-   --#SUMMARY "The UPS has enabled SmartTrim(TM) voltage reduction."
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 31
-
-codeAuthenticationDone TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES   { mconfigTFTPServerIP, newCodeAuthentViaTFTP }
-   DESCRIPTION
-      "INFORMATIONAL: Authentication on agent code image is done."
-   --#TYPE "APC CODE: Authentication on agent code image is done."
-   --#SUMMARY "Authentication on agent code image is done."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 32
-
-upsOverloadCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The overload condition has been cleared."
-   --#TYPE "APC UPS: Overload cleared."
-   --#SUMMARY "The overload condition has been cleared. ."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 33
-
-smartBoostOff TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The UPS has returned from SmartBoost(TM)."
-   --#TYPE "APC UPS: SmartBoost(TM) off."
-   --#SUMMARY "The UPS has returned from SmartBoost(TM)."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 34
-
-smartAvrReducingOff TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The UPS has returned from SmartTrim(TM)."
-   --#TYPE "APC UPS: SmartTrim(TM) reducing off"
-   --#SUMMARY "The UPS has returned from SmartTrim(TM) voltage reduction."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 35
-   
-upsBatteryReplaced TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A bad battery fault has been cleared."
-   --#TYPE "APC UPS: Bad battery replaced"
-   --#SUMMARY "The UPS has returned from a bad battery fault."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 36
-
-calibrationEnd TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The UPS has finished calibrating."
-   --#TYPE "APC UPS: Calibration end"
-   --#SUMMARY "The UPS has finished calibrating"
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 37
-
-dischargeCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A UPS discharge condition has been cleared."
-   --#TYPE "APC UPS: Discharge cleared."
-   --#SUMMARY "The UPS discharge condition has been cleared."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 38
-
-gracefullShutdown TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A graceful shutdown has been initiated."
-   --#TYPE "APC UPS: A graceful shutdown has been initiated."
-   --#SUMMARY "A graceful shutdown has been initiated."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 39
-
-   
-outletOn TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { sPDUOutletControlIndex }
-   DESCRIPTION
-       "WARNING: The specified PDU outlet has turned on.
-       If sPDUOutletControlIndex equals zero, then all outlets have 
-       turned on."
-   --#TYPE "APC PDU: Outlet has been turned on."
-   --#SUMMARY "Outlet has been turned on"
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 41
-   
-
-outletOff TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { sPDUOutletControlIndex }
-   DESCRIPTION
-       "WARNING: The specified PDU outlet has turned off.
-       If sPDUOutletControlIndex equals zero, then all outlets 
-       have turned off."
-   --#TYPE "APC PDU: Outlet has turned off."
-   --#SUMMARY "Outlet has turned off."
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 42
-   
-outletReboot TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { sPDUOutletControlIndex }
-   DESCRIPTION
-       "WARNING: The specified PDU outlet has rebooted.
-       If sPDUOutletControlIndex equals zero, then all outlets 
-       have rebooted."
-   --#TYPE "APC PDU: Outlet has rebooted."
-   --#SUMMARY "Outlet has rebooted."
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 43
-
-configChangeSNMP TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-       "WARNING: The SNMP configuration has been changed."
-   --#TYPE "APC: The SNMP configuration has been changed."
-   --#SUMMARY "The SNMP configuration has been changed."
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 44
-   
-   
-configChangeOutlet TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { sPDUOutletConfigIndex }
-   DESCRIPTION
-       "WARNING: The specified PDU outlet has changed configuration.
-       If sPDUOutletConfigIndex equals zero, then the Master outlet 
-       has changed configuration."
-   --#TYPE "APC PDU: Outlet configuration has been changed."
-   --#SUMMARY "Outlet configuration has been changed."
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 45
-
-accessViolationConsole TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-       "WARNING: Someone has attempted to login via the console with the incorrect password."
-   --#TYPE "APC: Access violation via the console."
-   --#SUMMARY "Three unsuccessful logins have been attempted via the console."
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 46
-
-accessViolationHTTP TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-       "WARNING: Someone has attempted to login via HTTP with the incorrect password."
-   --#TYPE "APC: Access violation via HTTP."
-   --#SUMMARY "An unsuccessful attempt to login via HTTP."
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 47
-   
-passwordChange TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-       "WARNING: The password for the device has been changed."
-   --#TYPE "APC: Password change for the device."
-   --#SUMMARY "Someone has changed the password on the device."
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 48
-
-badVoltage TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-       "WARNING: The output voltage is not within acceptable range."
-   --#TYPE "APC UPS: Bad output voltage."
-   --#SUMMARY "The output voltage is not within acceptable range."
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 49
-   
-badVoltageCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The output voltage has returned to an acceptable level."
-   --#TYPE "APC UPS: The bad voltage output condition has been cleared."
-   --#SUMMARY "The output voltage has returned to an acceptable level."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 50
-   
-chargerFailure TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-       "WARNING: The battery charger has failed."
-   --#TYPE "APC UPS: The battery charger has failed."
-   --#SUMMARY "The battery charger has failed."
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 51
-
-chargerFailureCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-       "INFORMATIONAL: The battery charger failure condition has been cleared."
-   --#TYPE "APC UPS: The battery charger failure condition cleared"
-   --#SUMMARY "The battery charger failure condition has been cleared."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 52
-
-batteryOverTemperature TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-       "WARNING: The battery temperature threshold has been violated."
-   --#TYPE "APC UPS: The battery temperature threshold has been violated."
-   --#SUMMARY "The battery temperature threshold has been violated."
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 53
-
-batteryOverTemperatureCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-       "INFORMATIONAL: The battery over temperature has been cleared."
-   --#TYPE "APC UPS: The battery over temperature has been cleared."
-   --#SUMMARY "The battery over temperature has been cleared."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 54
-   
- smartRelayFault TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-       "WARNING: SmartBoost(TM) or SmartTrim(TM) relay fault."
-   --#TYPE "APC UPS: SmartBoost(TM) or SmartTrim(TM) relay fault."
-   --#SUMMARY "SmartBoost(TM) or SmartTrim(TM) relay fault."
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 55
-
-smartRelayFaultCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-       "INFORMATIONAL: SmartBoost(TM) or SmartTrim(TM) relay fault has been cleared."
-   --#TYPE "APC UPS: SmartBoost(TM) or SmartTrim(TM) relay fault cleared."
-   --#SUMMARY "SmartBoost(TM) or SmartTrim(TM) relay fault has been cleared."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 56
-   
-humidityThresholdViolation1 TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-       "SEVERE: Probe 1 humidity threshold violated. The
-       first variable is the current humidity."
-   --#TYPE "APC Environmental Monitor: Probe 1 humidity threshold violation"
-   --#SUMMARY "A humidity threshold has been violated on probe 1."
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 57
-
-humidityThresholdViolationCleared1 TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: An Environmental Monitor humidity threshold violation has been cleared on probe 1."
-   --#TYPE "APC Environmental Monitor: Probe 1 humidity violation cleared"
-   --#SUMMARY "A humidity threshold violation has been cleared on probe 1."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 58
-
-temperatureThresholdViolation1 TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: An Environmental Monitor temperature threshold has been violated on probe 1.
-      The first variable is the current temperature."
-   --#TYPE "APC Environmental Monitor: Probe 1 temperature violation"
-   --#SUMMARY "A temperature threshold has been violated on probe 1."
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 59
-   
-temperatureThresholdViolationCleared1 TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: An Environmental Monitor temperature threshold violation has been cleared on probe 1."
-   --#TYPE "APC Environmental Monitor: Probe 1 temperature violation cleared"
-   --#SUMMARY "A temperature threshold violation has been cleared on probe 1."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 60
-   
-humidityThresholdViolation2 TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: An Environmental Monitor humidity threshold has been violated on probe 2.
-      The first variable is the current humidity."
-   --#TYPE "APC Environmental Monitor: Probe 2 humidity violation"
-   --#SUMMARY "A humidity threshold has been violated on probe 2."
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 61
-   
-humidityThresholdViolationCleared2 TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: An Environmental Monitor humidity threshold violation has been cleared on probe 2."
-   --#TYPE "APC Environmental Monitor: Probe 2 humidity violation cleared"
-   --#SUMMARY "A humidity threshold violation has been cleared on probe 2."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 62
-
-temperatureThresholdViolation2 TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: An Environmental Monitor temperature threshold has been violated on probe 2.
-       The first variable is the current temperature."
-   --#TYPE "APC Environmental Monitor: Probe 2 temperature violation"
-   --#SUMMARY "A temperature threshold has been violated on probe 2."
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 63
-   
-temperatureThresholdViolationCleared2 TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: An Environmental Monitor temperature threshold violation has been cleared on probe 2."
-   --#TYPE "APC Environmental Monitor: Probe 2 temperature violation cleared"
-   --#SUMMARY "A temperature threshold violation has been cleared on probe 2."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 64
-
-mupsCommunicationEstablished TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Communication with the Environmental Monitor has been established."
-   --#TYPE "APC Environmental Monitor: Communication established"
-   --#SUMMARY "Communication established between the agent and the Environmental Monitor."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 65
-
-mupsCommunicationLost TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-       "SEVERE: Communication to the Environmental Monitor has been lost.  Steps
-        to reestablish communication are in progress."
-   --#TYPE "APC Environmental Monitor: Communication failure"
-   --#SUMMARY "Communication lost between the agent and the Environmental Monitor."
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 66
-
-batteryIncrease TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The number of batteries has increased."
-   --#TYPE "APC UPS: The number of batteries has increased."
-   --#SUMMARY "The number of batteries has increased."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 67
-   
-batteryDecrease TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The number of batteries has decreased."
-   --#TYPE "APC UPS: The number of batteries has decreased."
-   --#SUMMARY "The number of batteries has decreased."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 68
-   
-powerModuleIncrease TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The number of power modules has increased."
-   --#TYPE "APC UPS: The number of power modules has increased."
-   --#SUMMARY "The number of power modules has increased."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 69
-
-powerModuleDecrease TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The number of power modules has decreased."
-   --#TYPE "APC UPS: The number of power modules has decreased."
-   --#SUMMARY "The number of power modules has decreased."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 70
-   
-intelligenceModuleInserted TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: An intelligence module has been inserted."
-   --#TYPE "APC UPS: An intelligence module has been inserted."
-   --#SUMMARY "An intelligence module has been inserted."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 71
-
-intelligenceModuleRemoved TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: An intelligence module has been removed."
-   --#TYPE "APC UPS: An intelligence module has been removed."
-   --#SUMMARY "An intelligence module has been removed."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 72
-   
-rintelligenceModuleInserted TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A redundant intelligence module has been inserted."
-   --#TYPE "APC UPS: A redundant intelligence module has been inserted."
-   --#SUMMARY "A redundant intelligence module has been inserted."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 73
-
-rintelligenceModuleRemoved TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A redundant intelligence module has been removed."
-   --#TYPE "APC UPS: A redundant intelligence module has been removed."
-   --#SUMMARY "A redundant intelligence module has been removed."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 74
-   
-extBatteryFrameIncease TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: An external battery frame has been added."
-   --#TYPE "APC UPS: An external battery frame has been added."
-   --#SUMMARY "An external battery frame has been added."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 75
-
-extBatteryFrameDecrease TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: An external battery frame has been removed."
-   --#TYPE "APC UPS: An external battery frame has been removed."
-   --#SUMMARY "An external battery frame has been removed."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 76
-   
-abnormalCondition TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: An abnormal condition has been detected.
-       The first variable is the fault condition."
-   --#TYPE "APC: An abnormal condition has been detected."
-   --#SUMMARY "An abnormal condition has been detected."
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 77
-
-abnormalConditionCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: An abnormal condition has been cleared.
-      The first variable is the fault condition."
-   --#TYPE "APC: An abnormal condition has been cleared."
-   --#SUMMARY "An abnormal condition has been cleared."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 78
-
-deviceStatusChange TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString}
-   DESCRIPTION
-      "INFORMATIONAL: The status of the device being monitored has changed."
-   --#TYPE "APC : The status of the device being monitored has changed."
-   --#SUMMARY "The status of the device being monitored has changed."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 79
-   
-noBatteries TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-       "WARNING: The UPS has no batteries attached."
-   --#TYPE "APC UPS: No batteries attached."
-   --#SUMMARY "The UPS has no batteries attached."
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 80
-   
-noBatteriesCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The UPS's batteries have been attached."
-   --#TYPE "APC UPS: The no batteries attached condition has been cleared."
-   --#SUMMARY "The UPS's batteries have been attached."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 81
-   
-userAdded TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A new user has been added."
-   --#TYPE "APC: A new user has been added."
-   --#SUMMARY "A new user has been added."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 82
-
-userDeleted TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A user has been deleted."
-   --#TYPE "APC: A user has been deleted."
-   --#SUMMARY "A user has been deleted."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 83
-
-userModified TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A user has been modified."
-   --#TYPE "APC: A user has been modified."
-   --#SUMMARY "A user has been modified."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 84
-
--- MasterSwitch Vm Traps
-
-msvmCommunicationEstablished TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { sPDUMasterControlVMIndex, sPDUMasterControlVMName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Communications with the MasterSwitch VM has been established."
-   --#TYPE "APC: Communications established with the MasterSwitch VM."
-   --#SUMMARY "Communications with the MasterSwitch VM has been established."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 85
-
-msvmCommunicationLost TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { sPDUMasterControlVMIndex, sPDUMasterControlVMName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Communications with the MasterSwitch VM has been lost."
-   --#TYPE "APC: Communications lost with the MasterSwitch VM."
-   --#SUMMARY "Communications with the MasterSwitch VM has been lost."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 86
-
-msvmOverload TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { sPDUMasterControlVMIndex, sPDUMasterControlVMName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The MasterSwitch VM in an overload condition."
-   --#TYPE "APC: The MasterSwitch VM is near or at an overload condition."
-   --#SUMMARY "The MasterSwitch VM is near or at an overload condition."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 87
-
-msvmOverloadCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { sPDUMasterControlVMIndex, sPDUMasterControlVMName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The overload condition on the MasterSwitch VM has been cleared."
-   --#TYPE "APC: The overload condition cleared on the MasterSwitch VM."
-   --#SUMMARY "The overload condition on the MasterSwitch VM has been cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 88
-
-msvmOutletOn TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { sPDUMasterControlVMIndex, sPDUMasterControlVMName, 
-               sPDUOutletControlVMOutletIndex, sPDUOutletControlVMOutletName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: An outlet on the MasterSwitch VM has turned on."
-   --#TYPE "APC: An outlet on the MasterSwitch VM has turned on."
-   --#SUMMARY "An outlet on the MasterSwitch VM has turned on."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 89
-
-msvmOutletOff TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { sPDUMasterControlVMIndex, sPDUMasterControlVMName, 
-               sPDUOutletControlVMOutletIndex, sPDUOutletControlVMOutletName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: An outlet on the MasterSwitch VM has turned off."
-   --#TYPE "APC: An outlet on the MasterSwitch VM has turned off."
-   --#SUMMARY "An outlet on the MasterSwitch VM has turned off."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 90
-
-msvmDeviceConfigChange TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { sPDUMasterControlVMIndex, sPDUMasterControlVMName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A device configuration change has been made on a MasterSwitch VM."
-   --#TYPE "APC: A device configuration change on a MasterSwitch VM."
-   --#SUMMARY "A device configuration change has been made on a MasterSwitch VM."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 91
-
-msvmOutletConfigChange TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { sPDUMasterControlVMIndex, sPDUMasterControlVMName, 
-               sPDUOutletControlVMOutletIndex, sPDUOutletControlVMOutletName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: An outlet configuration change has been made on a MasterSwitch VM."
-   --#TYPE "APC: An outlet configuration change on a MasterSwitch VM."
-   --#SUMMARY "An outlet configuration change has been made on a MasterSwitch VM."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 92
-
-msvmLowLoad TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { sPDUMasterControlVMIndex, sPDUMasterControlVMName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The MasterSwitch VM has violated the low load threshold."
-   --#TYPE "APC: The MasterSwitch VM has violated the low load threshold."
-   --#SUMMARY "The MasterSwitch VM has violated the low load threshold."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 93
-
-msvmLowLoadCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { sPDUMasterControlVMIndex, sPDUMasterControlVMName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The low load condition on the MasterSwitch VM has been cleared."
-   --#TYPE "APC: The low load condition cleared on the MasterSwitch VM."
-   --#SUMMARY "The low load condition on the MasterSwitch VM has been cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 94
-
-msvmNearOverload TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { sPDUMasterControlVMIndex, sPDUMasterControlVMName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The MasterSwitch VM is approaching an overload condition."
-   --#TYPE "APC: The MasterSwitch VM is near or at an overload condition."
-   --#SUMMARY "The MasterSwitch VM is near or at an overload condition."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 95
-
-msvmNearOverloadCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { sPDUMasterControlVMIndex, sPDUMasterControlVMName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The near overload condition on the MasterSwitch VM has been cleared."
-   --#TYPE "APC: The overload condition cleared on the MasterSwitch VM."
-   --#SUMMARY "The overload condition on the MasterSwitch VM has been cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 96
-
-msvmPowerSupplyStatusChange TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { sPDUMasterControlVMIndex, sPDUMasterControlVMName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "WARNING: The power supply status of the MasterSwitch VM has changed."
-   --#TYPE "APC: The power supply status changed on MasterSwitch VM"
-   --#SUMMARY "The power supply status of the MasterSwitch VM has changed."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 97
-
--- MasterSwitch plus (MSP) Traps
-
-mspCommunicationEstablished TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { sPDUMasterControlMSPIndex, sPDUMasterControlMSPName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Communications with the MasterSwitch plus has been established."
-   --#TYPE "APC: Communications established with the MasterSwitch plus."
-   --#SUMMARY "Communications with the MasterSwitch plus has been established."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 98
-
-mspCommunicationLost TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { sPDUMasterControlMSPIndex, sPDUMasterControlMSPName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Communications with the MasterSwitch plus has been lost."
-   --#TYPE "APC: Communications lost with the MasterSwitch plus."
-   --#SUMMARY "Communications with the MasterSwitch plus has been lost."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 99
-
-mspOutletOn TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { sPDUMasterControlMSPIndex, sPDUMasterControlMSPName, 
-               sPDUOutletControlMSPOutletIndex, sPDUOutletControlMSPOutletName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: An outlet on the MasterSwitch plus has turned on."
-   --#TYPE "APC: An outlet on the MasterSwitch plus has turned on."
-   --#SUMMARY "An outlet on the MasterSwitch plus has turned on."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 100
-
-mspOutletOff TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { sPDUMasterControlMSPIndex, sPDUMasterControlMSPName, 
-               sPDUOutletControlMSPOutletIndex, sPDUOutletControlMSPOutletName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: An outlet on the MasterSwitch plus has turned off."
-   --#TYPE "APC: An outlet on the MasterSwitch plus has turned off."
-   --#SUMMARY "An outlet on the MasterSwitch plus has turned off."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 101
-
-mspDeviceConfigChange TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { sPDUMasterControlMSPIndex, sPDUMasterControlMSPName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A device configuration change has been made on a MasterSwitch plus."
-   --#TYPE "APC: A device configuration change on a MasterSwitch plus."
-   --#SUMMARY "A device configuration change has been made on a MasterSwitch plus."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 102
-
-mspOutletConfigChange TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { sPDUMasterControlMSPIndex, sPDUMasterControlMSPName, sPDUOutletControlMSPOutletIndex, sPDUOutletControlMSPOutletName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: An outlet configuration change has been made on a MasterSwitch plus."
-   --#TYPE "APC: An outlet configuration change on a MasterSwitch plus."
-   --#SUMMARY "An outlet configuration change has been made on a MasterSwitch plus."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 103
-
-rsSourceSwitched TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsInteger02, mtrapargsString03, mtrapargsInteger, mtrapargsString02, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The Redundant Switch has switched source.
-       The first variable is an integer representing the current source: 0=A, 1=B.
-       The second variable is the 32-character name of the current source.
-       The third variable is an integer representing the transfer cause:
-        0=No Transfers Recorded, 1=Due to user action or preferred switching,
-        3=Due to line notch or spike, 5=Due to low line voltage,
-        7=Transfer due to high line voltage,
-        9=Transfer due to frequency out of range.
-       The fourth variable is a character string listing the transfer cause."
-   --#TYPE "APC Redundant Switch: The Redundant Switch has switched source"
-   --#SUMMARY "The Redundant Switch has switched source."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 104
-
-rsLostRedundancy TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsInteger, mtrapargsString02, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The Redundant Switch has lost redundancy.
-       The first variable is an integer representing the source which is no longer available: 0=A, 1=B.
-       The second variable is the 32-character name of the source which is no longer available."
-   --#TYPE "APC Redundant Switch: The Redundant Switch has lost redundancy"
-   --#SUMMARY "The Redundant Switch has has lost redundancy."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 105
-
-rsRedundancyRestored TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsInteger, mtrapargsString02,  mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Redundancy has been restored to the Redundant Switch .
-       The first variable is an integer representing the source which has been restored: 0=A, 1=B.
-       The second variable is the 32-character name of the source which has been restored."
-   --#TYPE "APC Redundant Switch: Redundancy has been restored."
-   --#SUMMARY "Redundancy has been restored to the Redundant Switch ."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 106
-
-rsConfigChange TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A configuration change has been made on a Redundant Switch."
-   --#TYPE "APC: A configuration change on a Redundant Switch."
-   --#SUMMARY "A configuration change has been made on a Redundant Switch."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 107
-
-rsCommunicationEstablished TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Communications with the Redundant Switch has been established."
-   --#TYPE "APC: Communications established with the Redundant Switch."
-   --#SUMMARY "Communications with the Redundant Switch has been established."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 108
-
-rsCommunicationLost TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Communications with the Redundant Switch has been lost."
-   --#TYPE "APC: Communications lost with the Redundant Switch."
-   --#SUMMARY "Communications with the Redundant Switch has been lost."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 109
-
-dcCommunicationEstablished TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Communications with the DC power plant has been established."
-   --#TYPE "APC: Communications established with the DC power plant."
-   --#SUMMARY "Communications with the DC power plant has been established."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 110
-
-dcCommunicationLost TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Communications with the DC power plant has been lost."
-   --#TYPE "APC: Communications lost with the DC power plant."
-   --#SUMMARY "Communications with the DC power plant has been lost."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 111
-
-dcPINChanged TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The active PIN on the DC controller has been changed."
-   --#TYPE "APC: The active PIN on the DC controller has been changed."
-   --#SUMMARY "The active PIN on the DC controller has been changed."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 112
-
-dcMajorAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "SEVERE: A Major alarm is active in the DC power plant."
-   --#TYPE "APC: A Major alarm is active in the DC power plant."
-   --#SUMMARY "A Major alarm is active in the DC power plant."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 113
-   
-dcMajorAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A Major alarm is no longer active in the DC power plant."
-   --#TYPE "APC: A Major alarm is no longer active in the DC power plant."
-   --#SUMMARY "A Major alarm is no longer active in the DC power plant."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 114
-
-dcMinorAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "WARNING: A Minor alarm is active in the DC power plant."
-   --#TYPE "APC: A Minor alarm is active in the DC power plant."
-   --#SUMMARY "A Minor alarm is active in the DC power plant."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 115
-   
-dcMinorAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A Minor alarm is no longer active in the DC power plant."
-   --#TYPE "APC: A Minor alarm is no longer active in the DC power plant."
-   --#SUMMARY "A Minor alarm is no longer active in the DC power plant."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 116
-
-dcOutputRelayOn TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES {  dm3StatusOutRlyIndex, dm3StatusOutRlyName, mtrapargsString }
-   DESCRIPTION
-      "WARNING: An output relay for the powerplant has been activated (state changed to on).
-       The first variable is an integer representing the output relay number that has gone on.
-       The second variable is the 16-character name of the output relay."
-   --#TYPE "APC: An output relay has gone on."
-   --#SUMMARY "An output relay has gone on in the DC power plant."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 117
-
-dcOutputRelayOff TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES {  dm3StatusOutRlyIndex, dm3StatusOutRlyName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: An output relay for the powerplant has been deactivated (state changed to off).
-       The first variable is an integer representing the output relay number that has gone off.
-       The second variable is the 16-character name of the output relay."
-   --#TYPE "APC: An output relay has gone off."
-   --#SUMMARY "An output relay has gone off in the DC power plant."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 118
-
-dcInputRelayOn TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES {  dm3StatusInRlyIndex, dm3StatusInRlyName, mtrapargsString }
-   DESCRIPTION
-      "WARNING: An input relay for the powerplant has been activated (state changed to on).
-       The first variable is an integer representing the input relay number that has gone on.
-       The second variable is the 16-character name of the input relay."
-   --#TYPE "APC: An input relay has gone on."
-   --#SUMMARY "An input relay has gone on in the DC power plant."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 119
-
-dcInputRelayOff TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES {  dm3StatusInRlyIndex, dm3StatusInRlyName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: An input relay for the powerplant has been deactivated (state changed to off).
-       The first variable is an integer representing the input relay number that has gone off.
-       The second variable is the 16-character name of the input relay."
-   --#TYPE "APC: An input relay has gone off."
-   --#SUMMARY "An input relay has gone off in the DC power plant."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 120
-
-logicPowerSuppliesIncreased TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The number of system power supplies has increased."
-   --#TYPE "APC UPS: The number of system power supplies has increased."
-   --#SUMMARY "The number of system power supplies has increased."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 121
-
-logicPowerSuppliesDecreased TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The number of system power supplies has decreased."
-   --#TYPE "APC UPS: The number of system power supplies has decreased."
-   --#SUMMARY "The number of system power supplies has decreased."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 122
-
-externalSwitchGearClosed TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString02, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: External Switch Gear closed."
-   --#TYPE "APC UPS: External Switch Gear closed."
-   --#SUMMARY "External Switch Gear closed."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 123
-
-externalSwitchGearOpened TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString02, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: External Switch Gear opened."
-   --#TYPE "APC UPS: External Switch Gear opened."
-   --#SUMMARY "External Switch Gear opened."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 124
-
-generalDeviceEvent TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: APC Device event."
-   --#TYPE "APC Device event"
-   --#SUMMARY "APC Device event."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 125
-
-atsSourceSwitched TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsInteger, mtrapargsString02, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The Automatic Transfer Switch has switched source.
-       The first variable is an integer representing the current source: 0=A, 1=B.
-       The second variable is the 32-character name of the current source."
-   --#TYPE "APC Automatic Transfer Switch: The ATS has switched source"
-   --#SUMMARY "The Automatic Transfer Switch has switched source."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-  ::= 126
-
-atsLostRedundancy TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsInteger, mtrapargsString02, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The Automatic Transfer Switch has lost redundancy.
-       The first variable is an integer representing the source which is no longer available: 0=A, 1=B.
-       The second variable is the 32-character name of the source which is no longer available."
-   --#TYPE "APC Automatic Transfer Switch: The ATS has lost redundancy. "
-   --#SUMMARY "The Automatic Transfer Switch has has lost redundancy."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 127
-
-atsRedundancyRestored TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsInteger, mtrapargsString02,  mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Redundancy has been restored to the Automatic Transfer Switch .
-       The first variable is an integer representing the source which has been restored: 0=A, 1=B.
-       The second variable is the 32-character name of the source which has been restored."
-   --#TYPE "APC Automatic Transfer Switch: Redundancy has been restored."
-   --#SUMMARY "Redundancy has been restored to the Automatic Transfer Switch ."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 128
-
-atsConfigChange TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A configuration change has been made on the Automatic Transfer Switch.
-       The first variable is an integer representing the configuration setting which changed:
-           0=Transfer Voltage Range, 1=Sensitivity 2=Preferred Source
-           3=Front Panel Lockout 4=Current Limit"
-   --#TYPE "APC Automatic Transfer Switch: ATS configuration changed."
-   --#SUMMARY "A configuration change has been made on a Automatic Transfer Switch."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 129
-
-atsCommunicationEstablished TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Communications with the Automatic Transfer Switch has been established."
-   --#TYPE "APC Automatic Transfer Switch: Communications established."
-   --#SUMMARY "Communications with the Automatic Transfer Switch has been established."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 130
-
-atsCommunicationLost TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Communications with the Automatic Transfer Switch has been lost."
-   --#TYPE "APC Automatic Transfer Switch: Communications lost."
-   --#SUMMARY "Communications with the Automatic Transfer Switch has been lost."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 131
-
-atsOverCurrent TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Output Current has exceeded threshold."
-   --#TYPE "APC Automatic Transfer Switch: Output Current exceeded threshold"
-   --#SUMMARY "Output Current has exceeded Threshold. "
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 132
-
-atsOverCurrentCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Output Current has returned below threshold."
-   --#TYPE "APC Automatic Transfer Switch: Output Current below threshold."
-   --#SUMMARY "Output Current has returned below threshold."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 133
-
-atsPowerSupplyFailure TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The Automatic Transfer Switch Power Supply has failed.
-      The first variable is an integer representing the Power Supply which 
-      has failed: 0=24V, 1=12V 2=5V."
-   --#TYPE "APC Automatic Transfer Switch: The ATS Power Supply has failed."
-   --#SUMMARY "The Automatic Transfer Switch Power Supply has failed."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 134
-
-atsPowerSupplyFailureCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The Automatic Transfer Power Supply Failure Cleared.
-       The first variable is an integer representing the Power Supply which 
-       has cleared: 0=24V, 1=12V 2=5V."
-   --#TYPE "APC Automatic Transfer Switch: Power Supply Failure Cleared."
-   --#SUMMARY "The Automatic Transfer Switch Power Supply Failure Cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 135
-
-dcMainsFailAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "WARNING: A Mains Fail alarm is active in the DC power plant."
-   --#TYPE "APC: A Mains Fail alarm is active in the DC power plant."
-   --#SUMMARY "A Mains Fail alarm is active in the DC power plant."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 136
-   
-dcMainsFailAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Mains Fail alarm is no longer active in the DC power plant."
-   --#TYPE "APC: Mains Fail alarm is no longer active in the DC power plant."
-   --#SUMMARY "Mains Fail alarm is no longer active in the DC power plant."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 137
-
-dcFanFailAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "WARNING: A Fan Fail alarm is active in the DC power plant."
-   --#TYPE "APC: A Fan Fail alarm is active in the DC power plant."
-   --#SUMMARY "A Fan Fail alarm is active in the DC power plant."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 138
-   
-dcFanFailAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A Fan Fail alarm is no longer active in the DC power plant."
-   --#TYPE "APC: A Fan Fail alarm is no longer active in the DC power plant."
-   --#SUMMARY "A Fan Fail alarm is no longer active in the DC power plant."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 139
-
-dcRectifierOvertempAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "WARNING: Rect. Overtemp alarm is active in the power plant."
-   --#TYPE "APC: Rect. Overtemp alarm is active in the power plant."
-   --#SUMMARY "Rect. Overtemp alarm is active in the power plant."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 140
-   
-dcRectifierOvertempAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Rect. Overtemp alarm is no longer active in the power plant."
-   --#TYPE "APC: Rect. Overtmp alarm is no longer active in the power plant."
-   --#SUMMARY "Rect. Overtmp alarm is no longer active in the power plant."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 141
-
-dcCurrentLimitAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "WARNING: A Current Limit alarm is active in the power plant."
-   --#TYPE "APC: A Current Limit alarm is active in the power plant."
-   --#SUMMARY "A Current Limit alarm is active in the power plant."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 142
-   
-dcCurrentLimitAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Current Limit alarm is no longer active in the power plant."
-   --#TYPE "APC: Current Limit alarm is no longer active in the power plant."
-   --#SUMMARY "Current Limit alarm is no longer active in the power plant."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 143
-
-dcRectifierFailAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "WARNING: A Rect. Fail alarm is active in the power plant."
-   --#TYPE "APC: A Rect. Fail alarm is active in the power plant."
-   --#SUMMARY "A Rect. Fail alarm is active in the power plant."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 144
-   
-dcRectifierFailAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Rect. Fail alarm is no longer active in the power plant."
-   --#TYPE "APC: Rect. Fail alarm is no longer active in the power plant."
-   --#SUMMARY "Rect. Fail alarm is no longer active in the power plant."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 145
-
-dcMultRectFailAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "WARNING: Multiple Rect. Fail alarm is active in the powerplant."
-   --#TYPE "APC: Multiple Rect. Fail alarm is active in the powerplant."
-   --#SUMMARY "Multiple Rect. Fail alarm is active in the powerplant."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 146
-   
-dcMultRectFailAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Mult Rect Fail alarm is no longer active in the powerplant."
-   --#TYPE "APC: Mult Rect Fail alarm is no longer active in the powerplant."
-   --#SUMMARY "Mult Rect Fail alarm is no longer active in the powerplant."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 147
-
-dcBatteryBreakerAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "WARNING: Batt. Breaker alarm is active in the power plant."
-   --#TYPE "APC: Batt. Breaker alarm is active in the power plant."
-   --#SUMMARY "Batt. Breaker alarm is active in the power plant."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 148
-   
-dcBatteryBreakerAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Batt. Breaker alarm is no longer active in the power plant."
-   --#TYPE "APC: Batt. Breaker alarm is no longer active in the power plant."
-   --#SUMMARY "Batt. Breaker alarm is no longer active in the power plant."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 149
-
-dcRectifierOVPAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "WARNING: A Rect. OVP alarm is active in the power plant."
-   --#TYPE "APC: A Rect. OVP alarm is active in the power plant."
-   --#SUMMARY "A Rect. OVP alarm is active in the power plant."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 150
-   
-dcRectifierOVPAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A Rect. OVP alarm is no longer active in the power plant."
-   --#TYPE "APC: A Rect. OVP alarm is no longer active in the power plant."
-   --#SUMMARY "A Rect. OVP alarm is no longer active in the power plant."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 151
-
-dcLVDImminentAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "WARNING: A LVD Imminent alarm is active in the powerplant."
-   --#TYPE "APC: A LVD Imminent alarm is active in the powerplant."
-   --#SUMMARY "A LVD Imminent alarm is active in the powerplant."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 152
-   
-dcLVDImminentAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A LVD Imminent alarm is no longer active in the powerplant."
-   --#TYPE "APC: A LVD Imminent alarm is no longer active in the powerplant."
-   --#SUMMARY "A LVD Imminent alarm is no longer active in the powerplant."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 153
-
-dcFuseCBAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "WARNING: A Fuse/CB alarm is active in the DC power plant."
-   --#TYPE "APC: A Fuse/CB alarm alarm is active in the DC power plant."
-   --#SUMMARY "A Fuse/CB alarm is active in the DC power plant."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 154
-   
-dcFuseCBAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A Fuse/CB alarm is no longer active in the DC power plant."
-   --#TYPE "APC: A Fuse/CB alarm is no longer active in the DC power plant."
-   --#SUMMARY "A Fuse/CB alarm is no longer active in the DC power plant."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 155
-
-dcBatteryTestFail TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "WARNING: A Battery Test failed in the DC power plant."
-   --#TYPE "APC: A Battery Test failed in the DC power plant."
-   --#SUMMARY "A Battery Test failed in the DC power plant."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 156
-
-dcTemperatureAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "WARNING: A Temperature is active in the power plant."
-   --#TYPE "APC: A Temperature alarm is active in the power plant."
-   --#SUMMARY "A Temperature alarm is active in the power plant."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 157
-   
-dcTemperatureAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A Temperature alarm is no longer active in the power plant."
-   --#TYPE "APC: A Temperature alarm is no longer active in the power plant."
-   --#SUMMARY "A Temperature alarm is no longer active in the power plant."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 158
-
-dcHumidityAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "WARNING: A Humidity alarm is active in the DC power plant."
-   --#TYPE "APC: A Humidity alarm is active in the DC power plant."
-   --#SUMMARY "A Humidity alarm is active in the DC power plant."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 159
-   
-dcHumidityAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A Humidity alarm is no longer active in the DC power plant."
-   --#TYPE "APC: A Humidity alarm is no longer active in the DC power plant."
-   --#SUMMARY "A Humidity alarm is no longer active in the DC power plant."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 160
-
-dcBBCommunicationEstablished TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Power plant bridging board communications established."
-   --#TYPE "APC: Power plant bridging board communications established."
-   --#SUMMARY "Power plant bridging board communications established."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 161
-
-dcBBCommunicationLost TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Power plant bridging board communications lost."
-   --#TYPE "APC: Power plant bridging board communications lost."
-   --#SUMMARY "Power plant bridging board communications lost."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 162
-
-iemHighTempThresholdViolation TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { iemStatusProbeCurrentTemp, iemStatusProbeTempUnits, iemStatusProbeNumber,
-               iemStatusProbeName, mtrapargsString }
-   DESCRIPTION
-       "SEVERE: High temperature threshold violated on Integrated
-        Environmental Monitor probe. The first variable is the
-        current temperature. The second variable is the temperature
-        scale. The third variable is the probe number. The fourth
-        variable is the probe name."
-   --#TYPE "APC IEM: High temperature threshold violation."
-   --#SUMMARY "High temperature threshold violation."
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 163
-
-iemHighTempThresholdViolationCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { iemStatusProbeNumber, iemStatusProbeName, mtrapargsString }
-   DESCRIPTION
-       "INFORMATIONAL: High temperature threshold violated on Integrated
-        Environmental Monitor probe has been cleared. The first variable
-        is the probe number. The second variable is the probe name."
-   --#TYPE "APC IEM: High temperature threshold violation cleared."
-   --#SUMMARY "High temperature threshold violation has been cleared."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 164
-
-iemLowTempThresholdViolation TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { iemStatusProbeCurrentTemp, iemStatusProbeTempUnits, iemStatusProbeNumber,
-               iemStatusProbeName, mtrapargsString }
-   DESCRIPTION
-       "SEVERE: Low temperature threshold violated on integrated
-        probe. The first variable is the current temperature. The
-        second variable is the temperature scale. The third
-        variable is the probe number. The fourth variable is the
-        probe name."
-   --#TYPE "APC IEM: Low temperature threshold violation."
-   --#SUMMARY "Low temperature threshold violation."
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 165
-
-iemLowTempThresholdViolationCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { iemStatusProbeNumber, iemStatusProbeName, mtrapargsString }
-   DESCRIPTION
-       "INFORMATIONAL: Low temperature threshold violated on integrated
-        probe has been cleared. The first variable is the probe number.
-        The second variable is the probe name."
-   --#TYPE "APC IEM: Low temperature threshold violation cleared."
-   --#SUMMARY "Low temperature threshold violation has been cleared."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 166
-
-iemHighHumidThresholdViolation TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { iemStatusProbeCurrentHumid, iemStatusProbeNumber, iemStatusProbeName,
-               mtrapargsString }
-   DESCRIPTION
-       "SEVERE: High humidity threshold violated on integrated
-        probe. The first variable is the current humidity. The
-        second variable is the probe number. The third variable
-        is the probe name."
-   --#TYPE "APC IEM: High humidity threshold violation."
-   --#SUMMARY "High humidity threshold violation."
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 167
-
-iemHighHumidThresholdViolationCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { iemStatusProbeNumber, iemStatusProbeName, mtrapargsString }
-   DESCRIPTION
-       "INFORMATIONAL: High humidity threshold violated on integrated
-        probe cleared. The first variable is the probe number. The second
-        variable is the probe name."
-   --#TYPE "APC IEM: High humidity threshold violation cleared."
-   --#SUMMARY "High humidity threshold violation has been cleared."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 168
-
-iemLowHumidThresholdViolation TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { iemStatusProbeCurrentHumid, iemStatusProbeNumber, iemStatusProbeName,
-               mtrapargsString }
-   DESCRIPTION
-       "SEVERE: Low humidity threshold violated on integrated
-        probe. The first variable is the current humidity. The
-        second variable is the probe number. The third variable
-        is the probe name."
-   --#TYPE "APC IEM: Low humidity threshold violation."
-   --#SUMMARY "Low humidity threshold violation."
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 169
-
-iemLowHumidThresholdViolationCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { iemStatusProbeNumber, iemStatusProbeName, mtrapargsString }
-   DESCRIPTION
-       "INFORMATIONAL: Low humidity threshold violated on integrated
-        probe cleared. The first variable is the probe number. The second
-        variable is the probe name."
-   --#TYPE "APC IEM: Low humidity threshold violation cleared."
-   --#SUMMARY "Low humidity threshold violation has been cleared."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 170
-
-iemProbeDisconnected TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "WARNING: The temperature/humidity probe on the Integrated
-       Environmental Monitor has been disconnected. This trap is
-       generated when a probe that has been in communication with
-       the Environmental Monitor has been disconnected or can no
-       longer communicate."
-   --#TYPE "APC IEM: Probe disconnected."
-   --#SUMMARY "Probe has been disconnected."
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 171
-
-iemProbeConnected TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The temperature/humidity probe on the Integrated
-       Environmental Monitor has been connected. This trap is generated
-       when the Environmental Monitor establishes communication with a
-       probe that had previously not been connected."
-   --#TYPE "APC IEM: Probe Connected."
-   --#SUMMARY "Probe has been connected."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 172
-
-iemContactFault TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { iemStatusContactNumber, iemStatusContactName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: There is a contact fault on the Integrated
-       Environmental Monitor. The first argument is the number
-       of the contact. The second argument is the name of the
-       contact."
-   --#TYPE "APC IEM: Contact fault."
-   --#SUMMARY "Contact fault."
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 173
-
-iemContactFaultCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { iemStatusContactNumber, iemStatusContactName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The contact fault on the Integrated
-       Environmental Monitor has been cleared. The first
-       argument is the number of the contact. The second
-       argument is the name of the contact."
-   --#TYPE "APC IEM: Contact fault."
-   --#SUMMARY "Contact fault cleared."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 174
-
-iemRelayFault TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { iemStatusRelayNumber, iemStatusRelayName, mtrapargsString02, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The output relay on the Integrated Environmental
-       Monitor has switched to the fault state. The first
-       argument is the number of the output relay. The second
-       argument is the name of the output relay. The third
-       argument is the event that caused the fault."
-   --#TYPE "APC IEM: Output relay fault."
-   --#SUMMARY "Output relay has faulted."
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 175
-
-iemRelayFaultCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { iemStatusRelayNumber, iemStatusRelayName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The fault condition on the output relay on the
-       Integrated Environmental Monitor has cleared. The first
-       argument is the number of the output relay. The second
-       argument is the name of the output relay."
-   --#TYPE "APC IEM: Output relay fault condition cleared."
-   --#SUMMARY "Output relay fault cleared."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 176
-
-bmBatManCommEstab TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Serial Communications Established with Battery Manager."
-   --#TYPE "BatMan : Communications Established."
-   --#SUMMARY "Communications Established."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 177
-
-bmBatManCommLost TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Serial Communications Lost with Battery Manager."
-   --#TYPE "BatMan : Communications Lost."
-   --#SUMMARY "Communications Lost."
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 178
-
-bmBatManKneeAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Battery Voltage Knee Threshold Alarm Detected."
-   --#TYPE "BatMan : Knee Alarm Detected."
-   --#SUMMARY "Knee Alarm Detected."
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 179
-
-bmBatManKneeAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Battery Voltage Knee Threshold Alarm Cleared."
-   --#TYPE "BatMan : Knee Alarm Cleared."
-   --#SUMMARY "Knee Alarm Cleared."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 180
-
-bmBatManChargerAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "WARNING: Charger Alarm Detected."
-   --#TYPE "BatMan : Charger Alarm Detected."
-   --#SUMMARY "Charger Alarm Detected."
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 181
-
-bmBatManChargerAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Charger Alarm Cleared."
-   --#TYPE "BatMan : Charger Alarm Cleared."
-   --#SUMMARY "Charger Alarm Cleared."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 182
-
-bmBatManBatteryAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "WARNING: Battery Alarm Detected."
-   --#TYPE "BatMan : Battery Alarm Detected."
-   --#SUMMARY "Battery Alarm Detected."
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 183
-
-bmBatManBatteryAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Battery Alarm Cleared."
-   --#TYPE "BatMan : Battery Alarm Cleared."
-   --#SUMMARY "Battery Alarm Cleared."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 184
-
-bmBatManEnvironmentAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "WARNING: Environment Alarm Detected."
-   --#TYPE "BatMan : Environment Alarm Detected."
-   --#SUMMARY "Environment Alarm Detected."
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 185
-
-bmBatManEnvironmentAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Environment Alarm Cleared."
-   --#TYPE "BatMan : Environment Alarm Cleared."
-   --#SUMMARY "Environment Alarm Cleared."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 186
-
-bmBatManMaintenanceAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Maintenance Alarm Detected."
-   --#TYPE "BatMan : Maintenance Due Alarm Detected."
-   --#SUMMARY "Maintenance Due Alarm Detected."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 187
-
-bmBatManMaintenanceAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Maintenance Alarm Cleared."
-   --#TYPE "BatMan : Maintenance Due Alarm Cleared."
-   --#SUMMARY "Maintenance Due Alarm Cleared."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 188
-
-pduCommunicationEstablished TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Communication Established.
-       The first argument is the serial number.
-       The second argument is the device name."
-   --#TYPE "APC PDU: Communication Established."
-   --#SUMMARY "Communication Established."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 189
-
-pduCommunicationLost TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Communication Lost.
-       The first argument is the serial number.
-       The second argument is the device name."
-   --#TYPE "APC PDU: Communication Lost."
-   --#SUMMARY "Communication Lost."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 190
-
-pduUtilityLineUndervoltage TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Utility Line Undervoltage. 
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the phase number."
-   --#TYPE "APC PDU: Utility Line Undervoltage."
-   --#SUMMARY "Utility Line Undervoltage."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 191
-
-pduUtilityLineUndervoltageCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Utility Line Undervoltage Cleared.
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the phase number."
-   --#TYPE "APC PDU: Utility Line Undervoltage Cleared."
-   --#SUMMARY "Utility Line Undervoltage Cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 192
-
-pduUtilityLineOvervoltage TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Utility Line Overvoltage.
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the phase number."
-   --#TYPE "APC PDU: Utility Line Overvoltage."
-   --#SUMMARY "Utility Line Overvoltage."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 193
-
-pduUtilityLineOvervoltageCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Utility Line Overvoltage Cleared.
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the phase number."
-   --#TYPE "APC PDU: Utility Line Overvoltage Cleared."
-   --#SUMMARY "Utility Line Overvoltage Cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 194
-
-pduGroundOvercurrent TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Ground Overcurrent.
-       The first argument is the serial number.
-       The second argument is the device name."
-   --#TYPE "APC PDU: Ground Overcurrent."
-   --#SUMMARY "Ground Overcurrent."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 195
-
-pduGroundOvercurrentCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Ground Overcurrent Cleared.
-       The first argument is the serial number.
-       The second argument is the device name."
-   --#TYPE "APC PDU: Ground Overcurrent Cleared."
-   --#SUMMARY "Ground Overcurrent Cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 196
-
-pduCircuitPanelInputUndervoltage TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Circuit Panel Input Undervoltage.
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the phase number."
-   --#TYPE "APC PDU: Circuit Panel Input Undervoltage."
-   --#SUMMARY "Circuit Panel Input Undervoltage."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 197
-
-pduCircuitPanelInputUndervoltageCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Circuit Panel Input Undervoltage Cleared.
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the phase number."
-   --#TYPE "APC PDU: Circuit Panel Input Undervoltage Cleared."
-   --#SUMMARY "Circuit Panel Input Undervoltage Cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 198
-
-pduCircuitPanelInputOvervoltage TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Circuit Panel Input Overvoltage.
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the phase number."
-   --#TYPE "APC PDU: Circuit Panel Input Overvoltage."
-   --#SUMMARY "Circuit Panel Input Overvoltage."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 199
-
-pduCircuitPanelInputOvervoltageCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Circuit Panel Input Overvoltage Cleared.
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the phase number."
-   --#TYPE "APC PDU: Circuit Panel Input Overvoltage Cleared."
-   --#SUMMARY "Circuit Panel Input Overvoltage Cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 200
-
-pduCircuitPanelInputUndercurrent TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Circuit Panel Input Undercurrent.
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the phase number."
-   --#TYPE "APC PDU: Circuit Panel Input Undercurrent."
-   --#SUMMARY "Circuit Panel Input Undercurrent."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 201
-
-pduCircuitPanelInputUndercurrentCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Circuit Panel Input Undercurrent Cleared.
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the phase number."
-   --#TYPE "APC PDU: Circuit Panel Input Undercurrent Cleared."
-   --#SUMMARY "Circuit Panel Input Undercurrent Cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 202
-
-pduCircuitPanelInputOvercurrent TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Circuit Panel Input Overcurrent.
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the phase number."
-   --#TYPE "APC PDU: Circuit Panel Input Overcurrent."
-   --#SUMMARY "Circuit Panel Input Overcurrent."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 203
-
-pduCircuitPanelInputOvercurrentCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Circuit Panel Input Overcurrent Cleared.
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the phase number."
-   --#TYPE "APC PDU: Circuit Panel Input Overcurrent Cleared."
-   --#SUMMARY "Circuit Panel Input Overcurrent Cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 204
-
-pduCircuitPanelFrequencyOutOfRange TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Circuit Panel Input Frequency Out Of Range.
-       The first argument is the serial number.
-       The second argument is the device name."
-   --#TYPE "APC PDU: Circuit Panel Input Frequency Out Of Range."
-   --#SUMMARY "Circuit Panel Input Frequency Out Of Range."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 205
-
-pduCircuitPanelFrequencyOutofRangeCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Circuit Panel Input Frequency No Longer Out Of Range.
-       The first argument is the serial number.
-       The second argument is the device name."
-   --#TYPE "APC PDU: Circuit Panel Input Frequency No Longer Out Of Range."
-   --#SUMMARY "Circuit Panel Input Frequency No Longer Out Of Range."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 206
-
-pduCircuitPanelNeutralOvercurrent TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Circuit Panel Input Neutral Overcurrent.
-       The first argument is the serial number.
-       The second argument is the device name."
-   --#TYPE "APC PDU: Circuit Panel Input Neutral Overcurrent."
-   --#SUMMARY "Circuit Panel Input Neutral Overcurrent."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 207
-
-pduCircuitPanelNeutralOvercurrentCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Circuit Panel Input Neutral Overcurrent Cleared.
-       The first argument is the serial number.
-       The second argument is the device name."
-   --#TYPE "APC PDU: Circuit Panel Input Neutral Overcurrent Cleared."
-   --#SUMMARY "Circuit Panel Input Neutral Overcurrent Cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 208
-
-pduSystemOff TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: PDU System Off.
-       The first argument is the serial number.
-       The second argument is the device name."
-   --#TYPE "APC PDU: System Off."
-   --#SUMMARY "PDU System Off."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 209
-
-pduOnBatteryMode TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: PDU is in On Battery Mode.
-       The first argument is the serial number.
-       The second argument is the device name."
-   --#TYPE "APC PDU: On Battery Mode."
-   --#SUMMARY "PDU is in On Battery Mode."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 210
-
-pduMaintenanceBypassMode TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: PDU is in Maintenance Bypass Mode.
-       The first argument is the serial number.
-       The second argument is the device name."
-   --#TYPE "APC PDU: Maintenance Bypass Mode."
-   --#SUMMARY "PDU is in Maintenance Bypass Mode."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 211
-
-pduAtypicalBypassMode TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsString }
-   DESCRIPTION
-      "WARNING: PDU is in Atypical Bypass Mode.
-       The first argument is the serial number.
-       The second argument is the device name."
-   --#TYPE "APC PDU: Atypical Bypass Mode."
-   --#SUMMARY "PDU is in Atypical Bypass Mode."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 212
-
-pduNoPanelFeedMode TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: PDU is in No Panel Feed Mode.
-       The first argument is the serial number.
-       The second argument is the device name."
-   --#TYPE "APC PDU: No Panel Feed Mode."
-   --#SUMMARY "PDU is in No Panel Feed Mode."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 213
-
-pduUpsOperationMode TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: PDU is in Ups Operation Mode.
-       The first argument is the serial number.
-       The second argument is the device name."
-   --#TYPE "APC PDU: Ups Operation Mode."
-   --#SUMMARY "PDU is in Ups Operation Mode."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 214
-
-pduForcedBypassMode TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsString }
-   DESCRIPTION
-      "WARNING: PDU is in Forced Bypass Mode.
-       The first argument is the serial number.
-       The second argument is the device name."
-   --#TYPE "APC PDU: Forced Bypass Mode."
-   --#SUMMARY "PDU is in Forced Bypass Mode."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 215
-
-pduInputTransformerOverTemperature TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Input Transformer Over Temperature.
-       The first argument is the serial number.
-       The second argument is the device name."
-   --#TYPE "APC PDU: Input Transformer Over Temperature."
-   --#SUMMARY "Input Transformer Over Temperature."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 216
-
-pduInputTransformerOverTemperatureCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Input Transformer Over Temperature Cleared.
-       The first argument is the serial number.
-       The second argument is the device name."
-   --#TYPE "APC PDU: Input Transformer Over Temperature Cleared."
-   --#SUMMARY "Input Transformer Over Temperature Cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 217
-
-pduUPSInputVoltageLost TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: UPS Input Voltage phase-N Lost.
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the phase number."
-   --#TYPE "APC PDU: UPS Input Voltage phase-N Lost."
-   --#SUMMARY "UPS Input Voltage phase-N Lost."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 218
-
-pduUPSInputVoltageRestored TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: UPS Input Voltage phase-N Restored.
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the phase number."
-   --#TYPE "APC PDU: UPS Input Voltage phase-N Restored."
-   --#SUMMARY "UPS Input Voltage phase-N Restored."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 219
-
-pduContactFault TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: A contact closure in the PDU is in an abnormal position. 
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the number of the contact."
-   --#TYPE "APC PDU: Contact Abnormal."
-   --#SUMMARY "Contact Abnormal."
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 220
-
-pduContactFaultCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A contact closure in the PDU is in a normal position. 
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the number of the contact."
-   --#TYPE "APC PDU: Contact Normal."
-   --#SUMMARY "Contact Normal."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 221
-
-rPDUBankPhaseLowLoad TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { rPDUIdentSerialNumber, rPDUIdentName, 
-               rPDULoadStatusBankNumber, rPDULoadStatusPhaseNumber, mtrapargsString }
-   DESCRIPTION
-      "WARNING: A bank or phase on the Rack PDU has violated the low load threshold.
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the bank number (0 if this is phase data).
-       The fourth argument is the phase number (0 if this is bank data)."
-   --#TYPE "APC Rack PDU: Violation of bank or phase low load threshold."
-   --#SUMMARY "A bank or phase on the Rack PDU has violated the low load threshold."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 222
-
-rPDUBankPhaseLowLoadCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { rPDUIdentSerialNumber, rPDUIdentName, 
-               rPDULoadStatusBankNumber, rPDULoadStatusPhaseNumber, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The bank or phase low load condition on a Rack PDU has been 
-       cleared.
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the bank number (0 if this is phase data).
-       The fourth argument is the phase number (0 if this is bank data)."
-   --#TYPE "APC Rack PDU: Bank or phase low load condition cleared."
-   --#SUMMARY "The bank or phase low load condition on a Rack PDU has been cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 223
-
-rPDUBankPhaseNearOverload TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { rPDUIdentSerialNumber, rPDUIdentName, 
-               rPDULoadStatusBankNumber, rPDULoadStatusPhaseNumber, mtrapargsString }
-   DESCRIPTION
-      "WARNING: A bank or phase of the Rack PDU is near an overload condition.
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the bank number (0 if this is phase data).
-       The fourth argument is the phase number (0 if this is bank data)."
-   --#TYPE "APC Rack PDU: Bank or phase near an overload condition."
-   --#SUMMARY "A bank or phase of the Rack PDU is near an overload condition."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 224
-
-rPDUBankPhaseNearOverloadCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { rPDUIdentSerialNumber, rPDUIdentName, 
-               rPDULoadStatusBankNumber, rPDULoadStatusPhaseNumber, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The bank or phase near overload condition on a Rack PDU has 
-       been cleared.
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the bank number (0 if this is phase data).
-       The fourth argument is the phase number (0 if this is bank data)."
-   --#TYPE "APC Rack PDU: Bank or phase near overload condition has cleared."
-   --#SUMMARY "Rack PDU bank or phase near overload condition has cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 225
-
-rPDUBankPhaseOverload TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { rPDUIdentSerialNumber, rPDUIdentName, 
-               rPDULoadStatusBankNumber, rPDULoadStatusPhaseNumber, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: A bank or phase of the Rack PDU is in an overload condition.
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the phase number.
-       The third argument is the bank number (0 if this is phase data).
-       The fourth argument is the phase number (0 if this is bank data)."
-   --#TYPE "APC Rack PDU: Bank or phase overload condition."
-   --#SUMMARY "A bank or phase of the Rack PDU is in an overload condition."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 226
-
-rPDUBankPhaseOverloadCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { rPDUIdentSerialNumber, rPDUIdentName, 
-               rPDULoadStatusBankNumber, rPDULoadStatusPhaseNumber, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The bank or phase overload condition on a Rack PDU has been 
-       cleared.
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the bank number (0 if this is phase data).
-       The fourth argument is the phase number (0 if this is bank data)."
-   --#TYPE "APC Rack PDU: Bank or phase overload condition has cleared."
-   --#SUMMARY "The bank or phase overload condition on a Rack PDU has cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 227
-
-aruDeviceConfigChange TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, 
-               rARUStatusAruIndex, rARUStatusAruName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Remote ARU Device Configurtion change.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the ARU number. 
-        The fourth argument is the ARU name."
-   --#TYPE "APC ARU: ARU Device configuration change."
-   --#SUMMARY "ARU device configuration change."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 228
-
-rmPDUCommunicationLost TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString03, mtrapargsString02, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Communication Lost.
-       The first argument is the serial number.
-       The second argument is the device name."
-   --#TYPE "APC RM PDU: Communication Lost."
-   --#SUMMARY "Communication Lost."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 229
-
-emsCommunicationEstablished TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Communication Established.
-       The first argument is the serial number.
-       The second argument is the device name."
-   --#TYPE "APC EMS: Communication Established."
-   --#SUMMARY "Communication Established."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 230
-
-emsCommunicationLost TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Communication Lost.
-       The first argument is the serial number.
-       The second argument is the device name."
-   --#TYPE "APC EMS: Communication Lost."
-   --#SUMMARY "Communication Lost."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 231
-
-emsProbeConnected TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, 
-               emsProbeStatusProbeIndex, emsProbeStatusProbeName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A probe has been connected to the EMS.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the probe number. 
-        The fourth argument is the probe name."
-   --#TYPE "APC EMS: Probe Connected."
-   --#SUMMARY "Probe Connected."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 232
-
-emsProbeDisconnected TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, 
-               emsProbeStatusProbeIndex, emsProbeStatusProbeName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: A probe has been disconnected from the EMS.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the probe number. 
-        The fourth argument is the probe name."
-   --#TYPE "APC EMS: Probe Disconnected."
-   --#SUMMARY "Probe Disconnected."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 233
-
-emsSensorConnected TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, 
-               emsSensorStatusSensorIndex, emsSensorStatusSensorName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A sensor has been connected to the EMS.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the sensor number. 
-        The fourth argument is the sensor name."
-   --#TYPE "APC EMS: Sensor Connected."
-   --#SUMMARY "Sensor Connected."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 234
-
-emsSensorDisconnected TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, 
-               emsSensorStatusSensorIndex, emsSensorStatusSensorName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: A sensor has been disconnected from the EMS.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the sensor number. 
-        The fourth argument is the sensor name."
-   --#TYPE "APC EMS: Sensor Disconnected."
-   --#SUMMARY "Sensor Disconnected."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 235
-
-emsSensorFault TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, 
-               emsSensorStatusSensorIndex, emsSensorStatusSensorName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: A EMS sensor is in the fault condition.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the sensor number. 
-        The fourth argument is the sensor name."
-   --#TYPE "APC EMS: Sensor Fault."
-   --#SUMMARY "Sensor Fault."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 236
-
-emsSensorFaultCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, 
-               emsSensorStatusSensorIndex, emsSensorStatusSensorName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A EMS sensor fault condition has cleared.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the sensor number. 
-        The fourth argument is the sensor name."
-   --#TYPE "APC EMS: Sensor Fault Cleared."
-   --#SUMMARY "Sensor Fault Cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 237
-
-emsBeaconConnected TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A beacon has been connected to the EMS.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC EMS: Beacon Connected."
-   --#SUMMARY "Beacon Connected."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 238
-
-emsBeaconDisconnected TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: A beacon has been disconnected from the EMS.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC EMS: Beacon Disconnected."
-   --#SUMMARY "Beacon Disconnected."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 239
-
-emsBeaconOn TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A EMS beacon has gone on.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC EMS: Beacon On."
-   --#SUMMARY "Beacon On."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 240
-
-emsBeaconOff TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A EMS beacon has gone off.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC EMS: Beacon Off."
-   --#SUMMARY "Beacon Off."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 241
-
-emsMajorAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: A Major Alarm is present in the EMS.
-        The first argument is the EMS serial number.
-        The second argument is the EMS name."
-   --#TYPE "APC EMS: Major Alarm."
-   --#SUMMARY "Major Alarm."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 242
-
-emsMajorAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A Major Alarm condition has been cleared in the EMS.
-        The first argument is the EMS serial number.
-        The second argument is the EMS name."
-   --#TYPE "APC EMS: Major Alarm Cleared."
-   --#SUMMARY "Major Alarm Cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 243
-
-emsMinorAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: A Minor Alarm is present in the EMS.
-        The first argument is the EMS serial number.
-        The second argument is the EMS name."
-   --#TYPE "APC EMS: Minor Alarm."
-   --#SUMMARY "Minor Alarm."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 244
-
-emsMinorAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A Minor Alarm condition has been cleared in the EMS.
-        The first argument is the EMS serial number.
-        The second argument is the EMS name."
-   --#TYPE "APC EMS: Minor Alarm Cleared."
-   --#SUMMARY "Minor Alarm Cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 245
-
-emsOutletStateAbnormal TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, emsOutletStatusOutletIndex, emsOutletStatusOutletName, 
-               emsOutletStatusOutletState, emsOutletStatusOutletNormalState, mtrapargsString }
-   DESCRIPTION
-      "WARNING: An outlet on the EMS has changed to its abnormal state.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the outlet number. 
-        The fourth argument is the outlet name.
-        The fifth argument is the current outlet state (1=ON, 2=OFF).
-        The sixth argument is the configured normal outlet state (1=ON, 2=OFF)."
-   --#TYPE "APC EMS: Outlet has changed to its abnormal state."
-   --#SUMMARY "Outlet has changed to its abnormal state."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 246
-
-emsOutletStateNormal TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, emsOutletStatusOutletIndex, emsOutletStatusOutletName, 
-               emsOutletStatusOutletState, emsOutletStatusOutletNormalState, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: An outlet on the EMS has changed to its normal state.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the outlet number. 
-        The fourth argument is the outlet name.
-        The fifth argument is the current outlet state (1=ON, 2=OFF).
-        The sixth argument is the configured normal outlet state (1=ON, 2=OFF)."
-   --#TYPE "APC EMS: Outlet has changed to its normal state."
-   --#SUMMARY "Outlet has changed to its normal state."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 247
-
-emsInputContactStateAbnormal TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, emsInputContactStatusInputContactIndex, 
-               emsInputContactStatusInputContactName, emsInputContactStatusInputContactState, 
-               emsInputContactStatusInputContactNormalState, mtrapargsString }
-   DESCRIPTION
-      "WARNING: An input contact on the EMS has changed to its abnormal state.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the input contact number. 
-        The fourth argument is the input contact name.
-        The fifth argument is the input contact state (1=CLOSED, 2=OPEN).
-        The sixth argument is the configured normal input contact state (1=CLOSED, 2=OPEN)."
-   --#TYPE "APC EMS: Input contact has changed to its abnormal state."
-   --#SUMMARY "Input contact has changed to its abnormal state."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 248
-
-emsInputContactStateNormal TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, emsInputContactStatusInputContactIndex, 
-               emsInputContactStatusInputContactName, emsInputContactStatusInputContactState, 
-               emsInputContactStatusInputContactNormalState, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: An input contact on the EMS has changed to its normal state.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the input contact number. 
-        The fourth argument is the input contact name.
-        The fifth argument is the input contact state (1=CLOSED, 2=OPEN).
-        The sixth argument is the configured normal input contact state (1=CLOSED, 2=OPEN)."
-   --#TYPE "APC EMS: Input contact has changed to its normal state."
-   --#SUMMARY "Input contact has changed to its normal state."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 249
-
-emsOutputRelayStateAbnormal TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, emsOutputRelayStatusOutputRelayIndex, 
-               emsOutputRelayStatusOutputRelayName, emsOutputRelayStatusOutputRelayState, 
-               emsOutputRelayStatusOutputRelayNormalState, mtrapargsString }
-   DESCRIPTION
-      "WARNING: An output relay on the EMS has changed to its abnormal state.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the output relay number. 
-        The fourth argument is the output relay name.
-        The fifth argument is the current output relay state (1=CLOSED, 2=OPEN).
-        The sixth argument is the configured normal output relay state (1=CLOSED, 2=OPEN)."
-   --#TYPE "APC EMS: Output Relay has changed to its abnormal state."
-   --#SUMMARY "Output Relay has changed to its abnormal state."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 250
-
-emsOutputRelayStateNormal TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, emsOutputRelayStatusOutputRelayIndex, 
-               emsOutputRelayStatusOutputRelayName, emsOutputRelayStatusOutputRelayState, 
-               emsOutputRelayStatusOutputRelayNormalState, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: An output relay on the EMS has changed to its normal state.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the output relay number. 
-        The fourth argument is the output relay name.
-        The fifth argument is the current output relay state (1=CLOSED, 2=OPEN).
-        The sixth argument is the configured normal output relay state (1=CLOSED, 2=OPEN)."
-   --#TYPE "APC EMS: Output Relay has changed to its normal state."
-   --#SUMMARY "Output Relay has changed to its normal state."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 251
-
-emsDeviceConfigChange TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A device configuration change has been made on the EMS.
-        The first argument is the EMS serial number.
-        The second argument is the EMS name."
-   --#TYPE "APC: A device configuration change on a EMS."
-   --#SUMMARY "A device configuration change has been made on a EMS."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 252
-
-envHighTempThresholdViolation TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, emsProbeStatusProbeTemperature, emsStatusSysTempUnits, 
-               emsProbeStatusProbeIndex, emsProbeStatusProbeName, mtrapargsString }
-   DESCRIPTION
-       "SEVERE: High temperature threshold violated on the probe. 
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the current temperature. 
-        The fourth argument is the temperature scale. 
-        The fifth argument is the probe number. 
-        The sixth argument is the probe name."
-   --#TYPE "APC ENV: High temperature threshold violation."
-   --#SUMMARY "High temperature threshold violation."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 253
-
-envHighTempThresholdViolationCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, emsProbeStatusProbeTemperature, emsStatusSysTempUnits, 
-               emsProbeStatusProbeIndex, emsProbeStatusProbeName, mtrapargsString }
-   DESCRIPTION
-       "INFORMATIONAL: High temperature threshold violation cleared on the probe. 
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the current temperature. 
-        The fourth argument is the temperature scale. 
-        The fifth argument is the probe number. 
-        The sixth argument is the probe name."
-   --#TYPE "APC ENV: High temperature threshold violation cleared."
-   --#SUMMARY "High temperature threshold violation cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 254
-
-envLowTempThresholdViolation TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, emsProbeStatusProbeTemperature, emsStatusSysTempUnits, 
-               emsProbeStatusProbeIndex, emsProbeStatusProbeName, mtrapargsString }
-   DESCRIPTION
-       "SEVERE: Low temperature threshold violated on the probe. 
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the current temperature. 
-        The fourth argument is the temperature scale. 
-        The fifth argument is the probe number. 
-        The sixth argument is the probe name."
-   --#TYPE "APC ENV: Low temperature threshold violation."
-   --#SUMMARY "Low temperature threshold violation."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 255
-
-envLowTempThresholdViolationCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, emsProbeStatusProbeTemperature, emsStatusSysTempUnits, 
-               emsProbeStatusProbeIndex, emsProbeStatusProbeName, mtrapargsString }
-   DESCRIPTION
-       "INFORMATIONAL: Low temperature threshold violation cleared on the probe. 
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the current temperature. 
-        The fourth argument is the temperature scale. 
-        The fifth argument is the probe number. 
-        The sixth argument is the probe name."
-   --#TYPE "APC ENV: Low temperature threshold violation cleared."
-   --#SUMMARY "Low temperature threshold violation cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 256
-
-envHighHumidityThresholdViolation TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, emsProbeStatusProbeHumidity, 
-               emsProbeStatusProbeIndex, emsProbeStatusProbeName, mtrapargsString }
-   DESCRIPTION
-       "SEVERE: High humidity threshold violated on the probe. 
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the current humidity
-        The fourth argument is the probe number. 
-        The fifth argument is the probe name."
-   --#TYPE "APC ENV: High humidity threshold violation."
-   --#SUMMARY "High humidity threshold violation."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 257
-
-envHighHumidityThresholdViolationCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, emsProbeStatusProbeHumidity, 
-               emsProbeStatusProbeIndex, emsProbeStatusProbeName, mtrapargsString }
-   DESCRIPTION
-       "INFORMATIONAL: High humidity threshold violation cleared on the probe. 
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the current humidity. 
-        The fourth argument is the probe number. 
-        The fifth argument is the probe name."
-   --#TYPE "APC ENV: High humidity threshold violation cleared."
-   --#SUMMARY "High humidity threshold violation cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 258
-
-envLowHumidityThresholdViolation TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, emsProbeStatusProbeHumidity, 
-               emsProbeStatusProbeIndex, emsProbeStatusProbeName, mtrapargsString }
-   DESCRIPTION
-       "SEVERE: Low humidity threshold violated on the probe. 
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the current humidity
-        The fourth argument is the probe number. 
-        The fifth argument is the probe name."
-   --#TYPE "APC ENV: Low humidity threshold violation."
-   --#SUMMARY "Low humidity threshold violation."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 259
-
-envLowHumidityThresholdViolationCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, emsProbeStatusProbeHumidity, 
-               emsProbeStatusProbeIndex, emsProbeStatusProbeName, mtrapargsString }
-   DESCRIPTION
-       "INFORMATIONAL: Low humidity threshold violation cleared on the probe. 
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the current humidity. 
-        The fourth argument is the probe number. 
-        The fifth argument is the probe name."
-   --#TYPE "APC ENV: Low humidity threshold violation cleared."
-   --#SUMMARY "Low humidity threshold violation cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 260
-
-
--- Switched and Metered Rack PDU Traps
-
-rPDUCommunicationEstablished TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { rPDUIdentSerialNumber, rPDUIdentName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Communication with a Rack PDU has been established.
-       The first argument is the serial number.
-       The second argument is the device name."
-   --#TYPE "APC Rack PDU: Communication established."
-   --#SUMMARY "Communication with a Rack PDU established."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 266
-
-rPDUCommunicationLost TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { rPDUIdentSerialNumber, rPDUIdentName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Communication with a Rack PDU has been lost.
-       The first argument is the serial number.
-       The second argument is the device name."
-   --#TYPE "APC Rack PDU: Communication lost."
-   --#SUMMARY "Communication with a Rack PDU has been lost."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 267
-
-rPDUOutletOn TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { rPDUIdentSerialNumber, rPDUIdentName, 
-               rPDUOutletControlIndex, rPDUOutletControlOutletName, 
-               mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: An outlet on a Switched Rack PDU has turned on.
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the outlet index number.
-       The fourth argument is the outlet name."
-   --#TYPE "APC Switched Rack PDU: An outlet has turned on."
-   --#SUMMARY "An outlet on a Switched Rack PDU has turned on."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 268
-
-rPDUOutletOff TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { rPDUIdentSerialNumber, rPDUIdentName, 
-               rPDUOutletControlIndex, rPDUOutletControlOutletName, 
-               mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: An outlet on a Switched Rack PDU has turned off.
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the outlet index number.
-       The fourth argument is the outlet name."
-   --#TYPE "APC Switched Rack PDU: An outlet has turned off."
-   --#SUMMARY "An outlet on a Switched Rack PDU has turned off."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 269
-
-rPDUDeviceConfigChange TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { rPDUIdentSerialNumber, rPDUIdentName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A device configuration change has been made on a 
-       Rack PDU.
-       The first argument is the serial number.
-       The second argument is the device name."
-   --#TYPE "APC Rack PDU: Device configuration change made."
-   --#SUMMARY "Device configuration change has been made on a Rack PDU."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 270
-
-rPDUOutletConfigChange TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { rPDUIdentSerialNumber, rPDUIdentName, 
-               rPDUOutletControlIndex, rPDUOutletControlOutletName, 
-               mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: An outlet configuration change has been made on a 
-       Switched Rack PDU.
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the outlet index number.
-       The fourth argument is the outlet name."
-   --#TYPE "APC Switched Rack PDU: Outlet configuration change made."
-   --#SUMMARY "Outlet configuration change has been made on a Switched Rack PDU."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 271
-
-rPDULowLoad TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { rPDUIdentSerialNumber, rPDUIdentName, 
-               rPDULoadStatusPhaseNumber, mtrapargsString }
-   DESCRIPTION
-      "WARNING: A Rack PDU has violated the low load threshold.
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the phase number."
-   --#TYPE "APC Rack PDU: Violation of low load threshold."
-   --#SUMMARY "A Rack PDU has violated the low load threshold."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 272
-
-rPDULowLoadCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { rPDUIdentSerialNumber, rPDUIdentName, 
-               rPDULoadStatusPhaseNumber, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The low load condition on a Rack PDU has been 
-       cleared.
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the phase number."
-   --#TYPE "APC Rack PDU: Low load condition cleared."
-   --#SUMMARY "The low load condition on a Rack PDU has been cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 273
-
-rPDUNearOverload TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { rPDUIdentSerialNumber, rPDUIdentName, 
-               rPDULoadStatusPhaseNumber, mtrapargsString }
-   DESCRIPTION
-      "WARNING: A Rack PDU is near an overload condition.
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the phase number."
-   --#TYPE "APC Rack PDU: Near an overload condition."
-   --#SUMMARY "A Rack PDU is near an overload condition."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 274
-
-rPDUNearOverloadCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { rPDUIdentSerialNumber, rPDUIdentName, 
-               rPDULoadStatusPhaseNumber, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The near overload condition on a Rack PDU has 
-       been cleared.
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the phase number."
-   --#TYPE "APC Rack PDU: Near overload condition has cleared."
-   --#SUMMARY "Rack PDU near overload condition has cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 275
-
-rPDUOverload TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { rPDUIdentSerialNumber, rPDUIdentName, 
-               rPDULoadStatusPhaseNumber, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: A Rack PDU is in an overload condition.
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the phase number."
-   --#TYPE "APC Rack PDU: Overload condition."
-   --#SUMMARY "A Rack PDU is in an overload condition."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 276
-
-rPDUOverloadCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { rPDUIdentSerialNumber, rPDUIdentName, 
-               rPDULoadStatusPhaseNumber, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The overload condition on a Rack PDU has been 
-       cleared.
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the phase number."
-   --#TYPE "APC Rack PDU: Overload condition has cleared."
-   --#SUMMARY "The overload condition on a Rack PDU has cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 277
-
-rPDUPowerSupply1Fail TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { rPDUIdentSerialNumber, rPDUIdentName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Power Supply 1 on Rack PDU is in FAIL state.
-       The first argument is the serial number.
-       The second argument is the device name."
-   --#TYPE "APC Rack PDU: Power Supply 1 is in FAIL state."
-   --#SUMMARY "Power Supply 1 on Rack PDU is in FAIL state."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 278
-
-rPDUPowerSupply1Ok TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { rPDUIdentSerialNumber, rPDUIdentName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Power Supply 1 on Rack PDU is operating normally.
-       The first argument is the serial number.
-       The second argument is the device name."
-   --#TYPE "APC Rack PDU: Power Supply 1 is operating normally."
-   --#SUMMARY "Power Supply 1 on Rack PDU is operating normally."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 279
-
-rPDUPowerSupply2Fail TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { rPDUIdentSerialNumber, rPDUIdentName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Power Supply 2 on Rack PDU is in FAIL state.
-       The first argument is the serial number.
-       The second argument is the device name."
-   --#TYPE "APC Rack PDU: Power Supply 2 is in FAIL state."
-   --#SUMMARY "Power Supply 2 on Rack PDU is in FAIL state."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 280
-
-rPDUPowerSupply2Ok TRAP-TYPE
-   ENTERPRISE apc             
-   VARIABLES { rPDUIdentSerialNumber, rPDUIdentName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Power Supply 2 on Rack PDU is operating normally.
-       The first argument is the serial number.
-       The second argument is the device name."
-   --#TYPE "APC Rack PDU: Power Supply 2 is operating normally."
-   --#SUMMARY "Power Supply 2 on Rack PDU is operating normally."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 281
-
-rPDUPhaseConfigChange TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { rPDUIdentSerialNumber, rPDUIdentName, 
-               rPDULoadPhaseConfigIndex, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A phase configuration change has been made on a 
-       Rack PDU.
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the phase index number."
-   --#TYPE "APC Rack PDU: Phase configuration change made."
-   --#SUMMARY "Phase configuration change has been made on a Rack PDU."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 282
-
-rPDUCancelPendingCommand TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { rPDUIdentSerialNumber, rPDUIdentName, 
-               rPDUOutletControlIndex, rPDUOutletControlOutletName,
-               mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A cancel pending command has been made on a 
-       Switched Rack PDU.
-       The first argument is the serial number.
-       The second argument is the device name.
-       The third argument is the outlet index number (0 indicates all outlets).
-       The fourth argument is the outlet name (or device name if all outlets)."
-   --#TYPE "APC Switched Rack PDU: Cancel Pending Command made."
-   --#SUMMARY "A Cancel Pending Command has been made on a Switched Rack PDU."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 283
-
-aruAlinkCommunicationEstablished TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, 
-               rARUStatusAruIndex, rARUStatusAruName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Remote ARU Communication Established.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the ARU number. 
-        The fourth argument is the ARU name."
-   --#TYPE "APC ARU: Communication Established."
-   --#SUMMARY "Communication Established."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 284
-
-aruAlinkCommunicationLost TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, 
-               rARUStatusAruIndex, rARUStatusAruName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Remote ARU Communication Lost.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the ARU number. 
-        The fourth argument is the ARU name."
-   --#TYPE "APC ARU: Communication Lost."
-   --#SUMMARY "Communication Lost."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 285
-
-aruFanFail TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, 
-               rARUStatusAruIndex, rARUStatusAruName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Remote ARU Fan Fail.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the ARU number. 
-        The fourth argument is the ARU name."
-   --#TYPE "APC ARU: Fan Fail."
-   --#SUMMARY "Fan Fail."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 286
-
-aruFanFailCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, 
-               rARUStatusAruIndex, rARUStatusAruName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Remote ARU Fan Fail Cleared.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the ARU number. 
-        The fourth argument is the ARU name."
-   --#TYPE "APC ARU: Fan Fail Cleared."
-   --#SUMMARY "Fan Fail Cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 287
-
-aruSmokeAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, 
-               rARUStatusAruIndex, rARUStatusAruName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Remote ARU Smoke Alarm.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the ARU number. 
-        The fourth argument is the ARU name."
-   --#TYPE "APC ARU: Smoke Alarm."
-   --#SUMMARY "Smoke Alarm."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 288
-
-aruSmokeAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, 
-               rARUStatusAruIndex, rARUStatusAruName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Remote ARU Smoke Alarm Cleared.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the ARU number. 
-        The fourth argument is the ARU name."
-   --#TYPE "APC ARU: Smoke Alarm Cleared."
-   --#SUMMARY "Smoke Alarm Cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 289
-
-aruHighTemperatureAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, 
-               rARUStatusAruIndex, rARUStatusAruName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Remote ARU High Temperature Alarm.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the ARU number. 
-        The fourth argument is the ARU name."
-   --#TYPE "APC ARU: High Temperature Alarm."
-   --#SUMMARY "High Temperature Alarm."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 290
-
-aruHighTemperatureAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, 
-               rARUStatusAruIndex, rARUStatusAruName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Remote ARU High Temperature Alarm Cleared.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the ARU number. 
-        The fourth argument is the ARU name."
-   --#TYPE "APC ARU: High Temperature Alarm Cleared."
-   --#SUMMARY "High Temperature Alarm Cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 291
-
-aruExhaustTemperatureAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, 
-               rARUStatusAruIndex, rARUStatusAruName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Remote ARU Exhaust Temperature Alarm.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the ARU number. 
-        The fourth argument is the ARU name."
-   --#TYPE "APC ARU: Exhaust Temperature Alarm."
-   --#SUMMARY "Exhaust Temperature Alarm."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 292
-
-aruExhaustTemperatureAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, 
-               rARUStatusAruIndex, rARUStatusAruName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Remote ARU Exhaust Temperature Alarm Cleared.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the ARU number. 
-        The fourth argument is the ARU name."
-   --#TYPE "APC ARU: Exhaust Temperature Alarm Cleared."
-   --#SUMMARY "Exhaust Temperature Alarm Cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 293
-
-envAlinkCommunicationEstablished TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, 
-               emsProbeStatusProbeIndex, emsProbeStatusProbeName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Remote Probe Communication Established.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the probe number. 
-        The fourth argument is the probe name."
-   --#TYPE "APC ENV: Communication Established."
-   --#SUMMARY "Communication Established."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 294
-
-envAlinkCommunicationLost TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, 
-               emsProbeStatusProbeIndex, emsProbeStatusProbeName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Remote Probe Communication Lost.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the probe number. 
-        The fourth argument is the probe name."
-   --#TYPE "APC ENV: Communication Lost."
-   --#SUMMARY "Communication Lost."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 295
-
-emsAlinkPowerOverload TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Alink Power Overload.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC EMS: Alink Power Overload."
-   --#SUMMARY "Alink Power Overload."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 296
-
-emsAlinkPowerOverloadCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Alink Power Overload Cleared.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC EMS: Alink Power Overload Cleared."
-   --#SUMMARY "Alink Power Overload Cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 297
-
-upsOutletGroupTurnedOn TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { upsOutletGroupControlIndex, mtrapargsString }
-   DESCRIPTION
-       "INFORMATIONAL: The specified Outlet Group turned on."
-   --#TYPE "APC UPS: Outlet Group turned on."
-   --#SUMMARY "Outlet Group turned on"
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 298   
-
-upsOutletGroupTurnedOff TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { upsOutletGroupControlIndex, mtrapargsString }
-   DESCRIPTION
-       "WARNING: The specified Outlet Group turned off."
-   --#TYPE "APC UPS: Outlet Group turned off."
-   --#SUMMARY "Outlet Group turned off."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 299  
-
-smwCriticalCondition TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsGauge, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: A Symmetra MW UPS critical condition has been detected.
-       The first variable is the fault condition."
-   --#TYPE "APC Symmetra MW UPS: A critical condition has been detected."
-   --#SUMMARY "A critical condition has been detected."
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 300
-
-smwCriticalConditionCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsGauge, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A Symmetra MW UPS critical condition has been cleared.
-      The first variable is the fault condition."
-   --#TYPE "APC Symmetra MW UPS: A critical condition has been cleared."
-   --#SUMMARY "A critical condition has been cleared."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 301
-
-smwWarningCondition TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsGauge, mtrapargsString }
-   DESCRIPTION
-      "WARNING: A Symmetra MW UPS warning condition has been detected.
-       The first variable is the fault condition."
-   --#TYPE "APC Symmetra MW UPS: A warning condition has been detected."
-   --#SUMMARY "A warning condition has been detected."
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 302
-
-smwWarningConditionCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsGauge, mtrapargsString }
-   DESCRIPTION
-      "WARNING: A Symmetra MW UPS warning condition has been cleared.
-      The first variable is the fault condition."
-   --#TYPE "APC Symmetra MW UPS: A warning condition has been cleared."
-   --#SUMMARY "A warning condition has been cleared."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 303
-
-smwInformationalCondition TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsGauge, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A Symmetra MW UPS informational condition has been detected.
-       The first variable is the fault condition."
-   --#TYPE "APC Symmetra MW UPS: Informational condition detected."
-   --#SUMMARY "An informational condition has been detected."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 304
-
-smwInformationalConditionCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsGauge, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A Symmetra MW UPS informational condition has been cleared.
-      The first variable is the fault condition."
-   --#TYPE "APC Symmetra MW UPS: Informational condition cleared."
-   --#SUMMARY "An informational condition has been cleared."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 305
-
-airCriticalCondition TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: An Air critical condition was detected.
-       The first variable is the error condition text message.
-       The second variable is the error number."
-   --#TYPE "APC Air: A critical condition was detected. "
-   --#SUMMARY "A critical condition was detected. "
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 306
-
-airCriticalConditionCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: An Air critical condition was cleared.
-       The first variable is the error condition text message.
-       The second variable is the error number."
-   --#TYPE "APC Air: A critical condition was cleared. "
-   --#SUMMARY "A critical condition was cleared. "
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 307
-
-airWarningCondition TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "WARNING: An Air warning condition was detected.
-       The first variable is the error condition text message.
-       The second variable is the error number."
-   --#TYPE "APC Air: A warning condition was detected. "
-   --#SUMMARY "A warning condition was detected. "
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 308
-
-airWarningConditionCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "WARNING: An Air warning condition was cleared.
-       The first variable is the error condition text message.
-       The second variable is the error number."
-   --#TYPE "APC Air: A warning condition was cleared. "
-   --#SUMMARY "A warning condition was cleared. "
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 309
-
-airInformationalCondition TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: An Air informational condition was detected.
-       The first variable is the error condition text message.
-       The second variable is the error number."
-   --#TYPE "APC Air: Informational condition detected. "
-   --#SUMMARY "An informational condition was detected. "
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 310
-
-airInformationalConditionCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: An Air informational condition was cleared.
-       The first variable is the error condition text message.
-       The second variable is the error number."
-   --#TYPE "APC Air: Informational condition was cleared. "
-   --#SUMMARY "An informational condition was cleared. "
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 311
-
--- xPDU Traps (part 1)
-
-xPDUInputVoltageLowAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsInteger, 
-               mtrapargsInteger02, mtrapargsInteger03, mtrapargsString }
-   DESCRIPTION
-      "WARNING: Three-phase input voltage to the device is outside the specified limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the phase
-        (1=L1-N, 2=L2-N, 3=L3-N, 4=unused, 5=L1-L2, 6=L2-L3, 7=L3-L1).
-        The fourth argument is the measured voltage in tenths of Volts.
-        The fifth argument is the threshold, in tenths of Volts, from which the alarm was generated."
-   --#TYPE "APC XPDU: Main input voltage out-of-range alarm."
-   --#SUMMARY "Input voltage is out-of-range."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 312
-
-xPDUInputVoltageLowAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsInteger, 
-               mtrapargsInteger02, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Three-phase input voltage to the device is back within the specified limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the phase (1=L1-N, 2=L2-N, 3=L3-N, 4=unused, 5=L1-L2, 6=L2-L3, 7=L3-L1).
-        The fourth argument is the measured voltage in tenths of Volts."
-   --#TYPE "APC XPDU: Main input voltage back in range."
-   --#SUMMARY "Input voltage in range."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 313
-
-
-xPDUInputVoltageHighAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsInteger, 
-               mtrapargsInteger02, mtrapargsInteger03, mtrapargsString }
-   DESCRIPTION
-      "WARNING: Three-phase input voltage to the device is outside the specified limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the phase
-        (1=L1-N, 2=L2-N, 3=L3-N, 4=unused, 5=L1-L2, 6=L2-L3, 7=L3-L1).
-        The fourth argument is the measured voltage in tenths of Volts.
-        The fifth argument is the threshold, in tenths of Volts, above which the alarm was generated."
-   --#TYPE "APC XPDU: Main input voltage out-of-range alarm."
-   --#SUMMARY "Input voltage is out-of-range."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 314
-
-xPDUInputVoltageHighAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsInteger, 
-               mtrapargsInteger02, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Three-phase input voltage to the device is back within the specified limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the phase (1=L1-N, 2=L2-N, 3=L3-N, 4=unused, 5=L1-L2, 6=L2-L3, 7=L3-L1).
-        The fourth argument is the measured voltage in tenths of Volts."
-   --#TYPE "APC XPDU: Main input voltage back in range."
-   --#SUMMARY "Input voltage in range."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 315
-
-xPDUBypassVoltageLowAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsInteger, 
-               mtrapargsInteger02, mtrapargsInteger03, mtrapargsString }
-   DESCRIPTION
-      "WARNING: Three-phase bypass input voltage to the device is outside the specified limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the phase (1=L1-N, 2=L2-N, 3=L3-N).
-        The fourth argument is the measured voltage in tenths of Volts.
-        The fifth argument is the threshold, in tenths of Volts, from which the alarm was generated."
-   --#TYPE "APC XPDU: Bypass input voltage out-of-range alarm."
-   --#SUMMARY "Bypass input voltage is out-of-range."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 316
-
-xPDUBypassVoltageLowAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsInteger, 
-               mtrapargsInteger02, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Three-phase bypass input voltage to the device is back within the specified limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the phase (1=L1-N, 2=L2-N, 3=L3-N).
-        The fourth argument is the measured voltage in tenths of Volts."
-   --#TYPE "APC XPDU: Bypass input voltage back in range."
-   --#SUMMARY "Bypass input voltage in range."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 317
-
-xPDUBypassVoltageHighAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsInteger, 
-               mtrapargsInteger02, mtrapargsInteger03, mtrapargsString }
-   DESCRIPTION
-      "WARNING: Three-phase bypass input voltage to the device is outside the specified limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the phase (1=L1-N, 2=L2-N, 3=L3-N).
-        The fourth argument is the measured voltage in tenths of Volts.
-        The fifth argument is the threshold, in tenths of Volts, above which the alarm was generated."
-   --#TYPE "APC XPDU: Bypass input voltage out-of-range alarm."
-   --#SUMMARY "Bypass input voltage is out-of-range."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 318
-
-xPDUBypassVoltageHighAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsInteger, 
-               mtrapargsInteger02, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Three-phase bypass input voltage to the device is back within the specified limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the phase (1=L1-N, 2=L2-N, 3=L3-N).
-        The fourth argument is the measured voltage in tenths of Volts."
-   --#TYPE "APC XPDU: Bypass input voltage back in range."
-   --#SUMMARY "Bypass input voltage in range."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 319
-
-xPDUOutputVoltageLowAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsInteger, 
-               mtrapargsInteger02, mtrapargsInteger03, mtrapargsString }
-   DESCRIPTION
-      "WARNING: The device three-phase output voltage of the device is outside the specified limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the phase (1=L1-N, 2=L2-N, 3=L3-N).
-        The fourth argument is the measured voltage in tenths of Volts.
-        The fifth argument is the threshold, in tenths of Volts, from which the alarm was generated."
-   --#TYPE "APC XPDU:  Output voltage out-of-range alarm."
-   --#SUMMARY "Output voltage is out-of-range."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 320
-
-xPDUOutputVoltageLowAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsInteger, 
-               mtrapargsInteger02, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The devices three-phase output voltage is back within the specified limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the phase (1=L1-N, 2=L2-N, 3=L3-N).
-        The fourth argument is the measured voltage in tenths of Volts."
-   --#TYPE "APC XPDU: Output voltage back in range."
-   --#SUMMARY "Output voltage in range."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 321
-
-xPDUOutputVoltageHighAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsInteger, 
-               mtrapargsInteger02, mtrapargsInteger03, mtrapargsString }
-   DESCRIPTION
-      "WARNING: The device three-phase output voltage of the device is outside the specified limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the phase (1=L1-N, 2=L2-N, 3=L3-N).
-        The fourth argument is the measured voltage in tenths of Volts.
-        The fifth argument is the threshold, in tenths of Volts, above which the alarm was generated."
-   --#TYPE "APC XPDU:  Output voltage out-of-range alarm."
-   --#SUMMARY "Output voltage is out-of-range."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 322
-
-xPDUOutputVoltageHighAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsInteger, 
-               mtrapargsInteger02, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The devices three-phase output voltage is back within the specified limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the phase (1=L1-N, 2=L2-N, 3=L3-N).
-        The fourth argument is the measured voltage in tenths of Volts."
-   --#TYPE "APC XPDU: Output voltage back in range."
-   --#SUMMARY "Output voltage in range."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 323
-
-xPDUOutputCurrentLowAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsInteger, 
-               mtrapargsInteger02, mtrapargsInteger03, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The devices three-phase load current is outside the specified limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the phase (1=L1, 2=L2, 3=L3).
-        The fourth argument is the measured current in tenths of Amps.
-        The fifth argument is the threshold, in Amps, from which the alarm was generated."
-   --#TYPE "APC XPDU: Output (load) current out-of-range alarm."
-   --#SUMMARY "Output current is out-of-range."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 324
-
-xPDUOutputCurrentLowAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsInteger, 
-               mtrapargsInteger02, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The devices three-phase output current is back within the specified limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the phase (1=L1, 2=L2, 3=L3).
-        The fourth argument is the measured current in tenths of Amps."
-   --#TYPE "APC XPDU: Output (load) current back in range."
-   --#SUMMARY "Output current in range."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 325
-
-xPDUOutputCurrentHighAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsInteger, 
-               mtrapargsInteger02, mtrapargsInteger03, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The devices three-phase load current is outside the specified limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the phase (1=L1, 2=L2, 3=L3).
-        The fourth argument is the measured current in tenths of Amps.
-        The fifth argument is the threshold, in Amps, above which the alarm was generated."
-   --#TYPE "APC XPDU: Output (load) current out-of-range alarm."
-   --#SUMMARY "Output current is out-of-range."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 326
-
-xPDUOutputCurrentHighAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsInteger, 
-               mtrapargsInteger02, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The devices three-phase output current is back within the specified limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the phase (1=L1, 2=L2, 3=L3).
-        The fourth argument is the measured current in tenths of Amps."
-   --#TYPE "APC XPDU: Output (load) current back in range."
-   --#SUMMARY "Output current in range."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 327
-
-xPDUOutputFrequencyAlarm TRAP-TYPE
-  ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The devices output frequency is outside the specified limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the frequency deviation from the nominal in tenths of Hertz."
-   --#TYPE "APC XPDU: Output frequency out-of-range alarm."
-   --#SUMMARY "Output frequency is out-of-range."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 328
-
-xPDUOutputFrequencyAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The devices output frequency is back within the specified limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XPDU: Output frequency back in range."
-   --#SUMMARY "Output frequency in range."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 329
-
-xPDUSystemGroundCurrentAlarm TRAP-TYPE
-  ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The devices earth ground current is over the specified limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the measured current in tenths of Amps."
-   --#TYPE "APC XPDU: Earth ground current over range alarm."
-   --#SUMMARY "Earth ground current is over limit."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 330
-
-xPDUSystemGroundCurrentAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The devices earth ground current is back within the specified limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the measured current in tenths of Amps."
-   --#TYPE "APC XPDU: Earth ground current back in range."
-   --#SUMMARY "Earth ground current in range."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 331
-
-xPDUInputContactStateAbnormal TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsInteger, 
-               mtrapargsString02, mtrapargsInteger02, mtrapargsInteger03, mtrapargsString }
-   DESCRIPTION
-      "WARNING: A user input contact on the device has changed to its abnormal state.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the input contact number. 
-        The fourth argument is the input contact name.
-        The fifth argument is the input contact state (1=OPEN, 2=CLOSED).
-        The sixth argument is the configured normal input contact state (1=OPEN, 2=CLOSED)."
-   --#TYPE "APC XPDU: Input contact has changed to its abnormal state."
-   --#SUMMARY "Input contact has changed to its abnormal state."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 332
-
-xPDUInputContactStateNormal TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsInteger, 
-               mtrapargsString02, mtrapargsInteger02, mtrapargsInteger03, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A user input contact on the device has changed to its normal state.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the input contact number. 
-        The fourth argument is the input contact name.
-        The fifth argument is the input contact state (1=CLOSED, 2=OPEN).
-        The sixth argument is the configured normal input contact state (1=OPEN, 2=CLOSED)."
-   --#TYPE "APC XPDU: Input contact has changed to its normal state."
-   --#SUMMARY "Input contact has changed to its normal state."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 333
-
-xPDUOutputRelayStateAbnormal TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsInteger, 
-               mtrapargsString02, mtrapargsInteger02, mtrapargsInteger03, mtrapargsString }
-   DESCRIPTION
-      "WARNING: An Output Relay on the device has changed to its abnormal state.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the Output Relay number. 
-        The fourth argument is the Output Relay name.
-        The fifth argument is the current Output Relay state (1=OPEN, 2=CLOSED).
-        The sixth argument is the configured normal Output Relay state (1=OPEN, 2=CLOSED)."
-   --#TYPE "APC XPDU: Output Relay has changed to its abnormal state."
-   --#SUMMARY "Output Relay has changed to its abnormal state."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 334
-
-xPDUOutputRelayStateNormal TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsInteger, 
-               mtrapargsString02, mtrapargsInteger02, mtrapargsInteger03, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: An Output Relay on the device has changed to its normal state.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the Output Relay number. 
-        The fourth argument is the Output Relay name.
-        The fifth argument is the current Output Relay state (1=OPEN, 2=CLOSED).
-        The sixth argument is the configured normal Output Relay state (1=OPEN, 2=CLOSED)."
-   --#TYPE "APC XPDU: Output Relay has changed to its normal state."
-   --#SUMMARY "Output Relay has changed to its normal state."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 335
-
-xPDUCoolingFanAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The device's internal cooling fans have failed.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XPDU: Cooling fan failure alarm."
-   --#SUMMARY "Cooling fan failure."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 336
-
-xPDUCoolingFanAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The device's cooling fans are now functioning properly.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XPDU: Cooling fan alarm cleared."
-   --#SUMMARY "Cooling fan alarm cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 337
-
-xPDUTransformerTempAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The device's isolation transformer is over temperature.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XPDU: Isolation transformer over temperature alarm."
-   --#SUMMARY "Transformer temp alarm."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 338
-
-xPDUTransformerTempAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The device's isolation transformer is no longer over temperature.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XPDU: Isolation transformer over temperature alarm cleared."
-   --#SUMMARY "Transformer temp alarm cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 339
-
-xPDUBranchCurrentLowAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsInteger, 
-               mtrapargsInteger02, mtrapargsInteger03, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The current in a branch circuit is outside the limits specified for that
-        branch circuit.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the panel position of the branch circuit (1-based index).
-        The fourth argument is the measured current in tenths of Amps.
-        The fifth argument is the threshold, in tenth of Amps, from which the alarm was generated."
-   --#TYPE "APC XPDU: Branch circuit current out-of-range alarm."
-   --#SUMMARY "Branch circuit current is out-of-range."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 340
-
-xPDUBranchCurrentLowAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsInteger, 
-               mtrapargsInteger02, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The current in a branch circuit is back within the limits 
-        specified for that branch circuit.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the panel position of the branch circuit (1-based index).
-        The fourth argument is the measured current in tenths of Amps."
-   --#TYPE "APC XPDU: Branch circuit current back in range."
-   --#SUMMARY "Branch circuit current in range."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 341
-
-xPDUBranchCurrentHighAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsInteger, 
-               mtrapargsInteger02, mtrapargsInteger03, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The current in a branch circuit is outside the limits specified for that
-        branch circuit.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the panel position of the branch circuit (1-based index).
-        The fourth argument is the measured current in tenths of Amps.
-        The fifth argument is the threshold, in tenth of Amps, above which the alarm was generated."
-   --#TYPE "APC XPDU: Branch circuit current out-of-range alarm."
-   --#SUMMARY "Branch circuit current is out-of-range."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 342
-
-xPDUBranchCurrentHighAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsInteger, 
-               mtrapargsInteger02, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The current in a branch circuit is back within the limits 
-        specified for that branch circuit.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the panel position of the branch circuit (1-based index).
-        The fourth argument is the measured current in tenths of Amps."
-   --#TYPE "APC XPDU: Branch circuit current back in range."
-   --#SUMMARY "Branch circuit current in range."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 343
-
-
-xPDUInternalCommError TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: There is an internal communication error in the device.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XPDU: Internal communication error."
-   --#SUMMARY "Internal communication error."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 344
-
-emsHardwareStateAbnormal TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The device's hardware is improperly configured and operating outside
-        normal bounds for the hardware.  This can be caused by improper devices being
-        connected to the EMS ports or Alink Current limit detection."
-   --#TYPE "APC EMS: Hardware is in an abnormal state."
-   --#SUMMARY "Hardware is in an abnormal state."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 345
-
-emsHardwareStateNormal TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The device's hardware is in its normal operational state.
-        The first argument is the host device serial number."
-   --#TYPE "APC EMS: Hardware is in a normal state."
-   --#SUMMARY "Hardware is in its normal state."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 346
-   
-ceSevereCondition TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: A Custom Event severe condition was detected.
-       The first variable is the custom event text message.
-       The second variable is the custom event number."
-   --#TYPE "APC CustomEvent: A severe condition was detected. "
-   --#SUMMARY "A severe condition was detected. "
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 347
-
-ceSevereConditionCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A Custom Event severe condition was cleared.
-       The first variable is the custom event text message.
-       The second variable is the custom event number."
-   --#TYPE "APC CustomEvent: A severe condition was cleared. "
-   --#SUMMARY "A severe condition was cleared. "
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 348
-
-ceWarningCondition TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "WARNING: A Custom Event warning condition was detected.
-       The first variable is the custom event text message.
-       The second variable is the custom event number."
-   --#TYPE "APC CustomEvent: A warning condition was detected. "
-   --#SUMMARY "A warning condition was detected. "
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 349
-
-ceWarningConditionCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A Custom Event warning condition was cleared.
-       The first variable is the custom event text message.
-       The second variable is the custom event number."
-   --#TYPE "APC CustomEvent: A warning condition was cleared. "
-   --#SUMMARY "A warning condition was cleared. "
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 350
-
-ceInformationalCondition TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A Custom Event informational condition was detected.
-       The first variable is the custom event text message.
-       The second variable is the custom event number."
-   --#TYPE "APC CustomEvent: Informational condition detected. "
-   --#SUMMARY "An informational condition was detected. "
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 351
-
-ceInformationalConditionCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A Custom Event informational condition was cleared.
-       The first variable is the custom event text message.
-       The second variable is the custom event number."
-   --#TYPE "APC CustomEvent: Informational condition was cleared. "
-   --#SUMMARY "An informational condition was cleared. "
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 352
-     
-upsInternalOverTemperature TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-       "WARNING: The internal over temperature condition exists."
-   --#TYPE "APC UPS: The internal over temperature condition exists."
-   --#SUMMARY "The internal over temperature condition exists."
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 353
-
-upsInternalOverTemperatureCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-       "INFORMATIONAL: The internal over temperature condition cleared."
-   --#TYPE "APC UPS: The internal over temperature condition cleared."
-   --#SUMMARY "The internal over temperature condition cleared."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 354
-   
-upsMpuReset TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-       "INFORMATIONAL: The MPU has been reset."
-   --#TYPE "APC UPS: The MPU has been reset."
-   --#SUMMARY "The MPU has been reset."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 355
-
-upsOutputSwitchClosed TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-       "INFORMATIONAL: The Output Switch is closed."
-   --#TYPE "APC UPS: The Output Switch is closed."
-   --#SUMMARY "The Output Switch is closed."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 356
-
-upsOutputSwitchOpened TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-       "INFORMATIONAL: The Output Switch is open."
-   --#TYPE "APC UPS: The Output Switch is open."
-   --#SUMMARY "The Output Switch is open."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 357
-
-upsCalibrationStackChanged TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString }
-   DESCRIPTION
-       "INFORMATIONAL: A calibration value in the stack was changed."
-   --#TYPE "APC UPS: A calibration value in the stack was changed."
-   --#SUMMARY "A calibration value in the stack was changed."
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 358
-
-   
--- Upgraded EMS now has more env traps
-
-envMaxTempThresholdViolation TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, emsProbeStatusProbeTemperature, emsStatusSysTempUnits, 
-               emsProbeStatusProbeIndex, emsProbeStatusProbeName, mtrapargsString }
-   DESCRIPTION
-       "SEVERE: Max temperature threshold violated on the probe. 
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the current temperature. 
-        The fourth argument is the temperature scale. 
-        The fifth argument is the probe number. 
-        The sixth argument is the probe name."
-   --#TYPE "APC ENV: Max temperature threshold violation."
-   --#SUMMARY "Max temperature threshold violation."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 359
-
-envMaxTempThresholdViolationCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, emsProbeStatusProbeTemperature, emsStatusSysTempUnits, 
-               emsProbeStatusProbeIndex, emsProbeStatusProbeName, mtrapargsString }
-   DESCRIPTION
-       "INFORMATIONAL: Max temperature threshold violation cleared on the probe. 
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the current temperature. 
-        The fourth argument is the temperature scale. 
-        The fifth argument is the probe number. 
-        The sixth argument is the probe name."
-   --#TYPE "APC ENV: Max temperature threshold violation cleared."
-   --#SUMMARY "Max temperature threshold violation cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 360
-
-envMinTempThresholdViolation TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, emsProbeStatusProbeTemperature, emsStatusSysTempUnits, 
-               emsProbeStatusProbeIndex, emsProbeStatusProbeName, mtrapargsString }
-   DESCRIPTION
-       "SEVERE: Min temperature threshold violated on the probe. 
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the current temperature. 
-        The fourth argument is the temperature scale. 
-        The fifth argument is the probe number. 
-        The sixth argument is the probe name."
-   --#TYPE "APC ENV: Min temperature threshold violation."
-   --#SUMMARY "Min temperature threshold violation."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 361
-
-envMinTempThresholdViolationCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, emsProbeStatusProbeTemperature, emsStatusSysTempUnits, 
-               emsProbeStatusProbeIndex, emsProbeStatusProbeName, mtrapargsString }
-   DESCRIPTION
-       "INFORMATIONAL: Min temperature threshold violation cleared on the probe. 
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the current temperature. 
-        The fourth argument is the temperature scale. 
-        The fifth argument is the probe number. 
-        The sixth argument is the probe name."
-   --#TYPE "APC ENV: Min temperature threshold violation cleared."
-   --#SUMMARY "Min temperature threshold violation cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 362
-
-envMaxHumidityThresholdViolation TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, emsProbeStatusProbeHumidity, 
-               emsProbeStatusProbeIndex, emsProbeStatusProbeName, mtrapargsString }
-   DESCRIPTION
-       "SEVERE: Max humidity threshold violated on the probe. 
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the current humidity
-        The fourth argument is the probe number. 
-        The fifth argument is the probe name."
-   --#TYPE "APC ENV: Max humidity threshold violation."
-   --#SUMMARY "Max humidity threshold violation."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 363
-
-envMaxHumidityThresholdViolationCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, emsProbeStatusProbeHumidity, 
-               emsProbeStatusProbeIndex, emsProbeStatusProbeName, mtrapargsString }
-   DESCRIPTION
-       "INFORMATIONAL: Max humidity threshold violation cleared on the probe. 
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the current humidity. 
-        The fourth argument is the probe number. 
-        The fifth argument is the probe name."
-   --#TYPE "APC ENV: Max humidity threshold violation cleared."
-   --#SUMMARY "Max humidity threshold violation cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 364
-
-envMinHumidityThresholdViolation TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, emsProbeStatusProbeHumidity, 
-               emsProbeStatusProbeIndex, emsProbeStatusProbeName, mtrapargsString }
-   DESCRIPTION
-       "SEVERE: Min humidity threshold violated on the probe. 
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the current humidity
-        The fourth argument is the probe number. 
-        The fifth argument is the probe name."
-   --#TYPE "APC ENV: Min humidity threshold violation."
-   --#SUMMARY "Min humidity threshold violation."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 365
-
-envMinHumidityThresholdViolationCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, emsProbeStatusProbeHumidity, 
-               emsProbeStatusProbeIndex, emsProbeStatusProbeName, mtrapargsString }
-   DESCRIPTION
-       "INFORMATIONAL: Min humidity threshold violation cleared on the probe. 
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the current humidity. 
-        The fourth argument is the probe number. 
-        The fifth argument is the probe name."
-   --#TYPE "APC ENV: Min humidity threshold violation cleared."
-   --#SUMMARY "Min humidity threshold violation cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 366
-
-envSTIncTempRateViolation TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, emsProbeStatusProbeTemperature, emsStatusSysTempUnits, 
-               emsProbeStatusProbeIndex, emsProbeStatusProbeName, mtrapargsString }
-   DESCRIPTION
-       "SEVERE: Short-term increasing temperature rate violated on the probe. 
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the current temperature. 
-        The fourth argument is the temperature scale. 
-        The fifth argument is the probe number. 
-        The sixth argument is the probe name."
-   --#TYPE "APC ENV: Short-term inc. temp rate violation."
-   --#SUMMARY "Short-term inc. temp rate violation."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 367
-
-envSTIncTempRateViolationCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, emsProbeStatusProbeTemperature, emsStatusSysTempUnits, 
-               emsProbeStatusProbeIndex, emsProbeStatusProbeName, mtrapargsString }
-   DESCRIPTION
-       "INFORMATIONAL: Short-term increasing temperature rate cleared on the probe. 
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the current temperature. 
-        The fourth argument is the temperature scale. 
-        The fifth argument is the probe number. 
-        The sixth argument is the probe name."
-   --#TYPE "APC ENV: Short-term inc. temp rate violation cleared."
-   --#SUMMARY "Short-term inc. temp rate violation cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 368
-
-envSTDecTempRateViolation TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, emsProbeStatusProbeTemperature, emsStatusSysTempUnits, 
-               emsProbeStatusProbeIndex, emsProbeStatusProbeName, mtrapargsString }
-   DESCRIPTION
-       "SEVERE: Short-term decreasing temperature rate violated on the probe. 
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the current temperature. 
-        The fourth argument is the temperature scale. 
-        The fifth argument is the probe number. 
-        The sixth argument is the probe name."
-   --#TYPE "APC ENV: Short-term dec. temp rate violation."
-   --#SUMMARY "Short-term dec. temp rate violation."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 369
-
-envSTDecTempRateViolationCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, emsProbeStatusProbeTemperature, emsStatusSysTempUnits, 
-               emsProbeStatusProbeIndex, emsProbeStatusProbeName, mtrapargsString }
-   DESCRIPTION
-       "INFORMATIONAL: Short-term decreasing temperature rate cleared on the probe. 
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the current temperature. 
-        The fourth argument is the temperature scale. 
-        The fifth argument is the probe number. 
-        The sixth argument is the probe name."
-   --#TYPE "APC ENV: Short-term dec. temp rate violation cleared."
-   --#SUMMARY "Short-term dec. temp rate violation cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 370
-
-envLTIncTempRateViolation TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, emsProbeStatusProbeTemperature, emsStatusSysTempUnits, 
-               emsProbeStatusProbeIndex, emsProbeStatusProbeName, mtrapargsString }
-   DESCRIPTION
-       "SEVERE: Long-term increasing temperature rate violated on the probe. 
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the current temperature. 
-        The fourth argument is the temperature scale. 
-        The fifth argument is the probe number. 
-        The sixth argument is the probe name."
-   --#TYPE "APC ENV: Long-term inc. temp rate violation."
-   --#SUMMARY "Long-term inc. temp rate violation."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 371
-
-envLTIncTempRateViolationCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, emsProbeStatusProbeTemperature, emsStatusSysTempUnits, 
-               emsProbeStatusProbeIndex, emsProbeStatusProbeName, mtrapargsString }
-   DESCRIPTION
-       "INFORMATIONAL: Long-term increasing temperature rate cleared on the probe. 
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the current temperature. 
-        The fourth argument is the temperature scale. 
-        The fifth argument is the probe number. 
-        The sixth argument is the probe name."
-   --#TYPE "APC ENV: Long-term inc. temp rate violation cleared."
-   --#SUMMARY "Long-term inc. temp rate violation cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 372
-
-envLTDecTempRateViolation TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, emsProbeStatusProbeTemperature, emsStatusSysTempUnits, 
-               emsProbeStatusProbeIndex, emsProbeStatusProbeName, mtrapargsString }
-   DESCRIPTION
-       "SEVERE: Long-term decreasing temperature rate violated on the probe. 
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the current temperature. 
-        The fourth argument is the temperature scale. 
-        The fifth argument is the probe number. 
-        The sixth argument is the probe name."
-   --#TYPE "APC ENV: Long-term dec. temp rate violation."
-   --#SUMMARY "Long-term dec. temp rate violation."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 373
-
-envLTDecTempRateViolationCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { emsIdentSerialNumber, emsIdentEMSName, emsProbeStatusProbeTemperature, emsStatusSysTempUnits, 
-               emsProbeStatusProbeIndex, emsProbeStatusProbeName, mtrapargsString }
-   DESCRIPTION
-       "INFORMATIONAL: Long-term decreasing temperature rate cleared on the probe. 
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the current temperature. 
-        The fourth argument is the temperature scale. 
-        The fifth argument is the probe number. 
-        The sixth argument is the probe name."
-   --#TYPE "APC ENV: Long-term dec. temp rate violation cleared."
-   --#SUMMARY "Long-term dec. temp rate violation cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 374
-
--- Battery Management System Traps
-
-bmsCriticalCondition TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: A Battery Management System critical condition was detected.
-       The first variable is the error condition text message.
-       The second variable is the error number."
-   --#TYPE "APC BMS: A critical condition was detected. "
-   --#SUMMARY "A critical condition was detected. "
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 375
-
-bmsCriticalConditionCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A Battery Management System critical condition was cleared.
-       The first variable is the error condition text message.
-       The second variable is the error number."
-   --#TYPE "APC BMS: A critical condition was cleared. "
-   --#SUMMARY "A critical condition was cleared. "
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 376
-
-bmsWarningCondition TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "WARNING: A Battery Management System warning condition was detected.
-       The first variable is the error condition text message.
-       The second variable is the error number."
-   --#TYPE "APC BMS: A warning condition was detected. "
-   --#SUMMARY "A warning condition was detected. "
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 377
-
-bmsWarningConditionCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "WARNING: A Battery Management System warning condition was cleared.
-       The first variable is the error condition text message.
-       The second variable is the error number."
-   --#TYPE "APC BMS: A warning condition was cleared. "
-   --#SUMMARY "A warning condition was cleared. "
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 378
-
-bmsInformationalCondition TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A Battery Management System informational condition was detected.
-       The first variable is the error condition text message.
-       The second variable is the error number."
-   --#TYPE "APC BMS: Informational condition detected. "
-   --#SUMMARY "An informational condition was detected. "
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 379
-
-bmsInformationalConditionCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsString02, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A Battery Management System informational condition was cleared.
-       The first variable is the error condition text message.
-       The second variable is the error number."
-   --#TYPE "APC BMS: Informational condition was cleared. "
-   --#SUMMARY "An informational condition was cleared. "
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 380
-
--- xATS Traps
-
-xATSOutputVoltageLowAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, 
-               mtrapargsInteger02, mtrapargsInteger03, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The device three-phase output voltage of the device is outside the specified limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the phase (1=L1-N, 2=L2-N, 3=L3-N, 4=unused, 5=L1-L2, 6=L2-L3, 7=L3-L1).
-        The fourth argument is the measured voltage in tenths of Volts.
-        The fifth argument is the threshold, in tenths of Volts, from which the alarm was generated."
-   --#TYPE "APC XATS:  Output voltage out-of-range alarm."
-   --#SUMMARY "Output voltage is out-of-range."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 381
-
-xATSOutputVoltageLowAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, 
-               mtrapargsInteger02, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The devices three-phase output voltage is back within the specified limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the phase (1=L1-N, 2=L2-N, 3=L3-N, 4=unused, 5=L1-L2, 6=L2-L3, 7=L3-L1).
-        The fourth argument is the measured voltage in tenths of Volts."
-   --#TYPE "APC XATS: Output voltage back in range."
-   --#SUMMARY "Output voltage in range."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 382
-
-xATSOutputVoltageHighAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, 
-               mtrapargsInteger02, mtrapargsInteger03, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The device three-phase output voltage of the device is outside the specified limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the phase (1=L1-N, 2=L2-N, 3=L3-N, 4=unused, 5=L1-L2, 6=L2-L3, 7=L3-L1).
-        The fourth argument is the measured voltage in tenths of Volts.
-        The fifth argument is the threshold, in tenths of Volts, above which the alarm is generated."
-   --#TYPE "APC XATS: Output voltage out-of-range alarm."
-   --#SUMMARY "Output voltage is out-of-range."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 383
-
-xATSOutputVoltageHighAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, 
-               mtrapargsInteger02, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The devices three-phase output voltage is back within the specified limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the phase (1=L1-N, 2=L2-N, 3=L3-N, 4=unused, 5=L1-L2, 6=L2-L3, 7=L3-L1).
-        The fourth argument is the measured voltage in tenths of Volts."
-   --#TYPE "APC XATS: Output voltage back in range."
-   --#SUMMARY "Output voltage in range."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 384
-
-xATSOutputCurrentLowAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, 
-               mtrapargsInteger02, mtrapargsInteger03, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The devices three-phase load current is outside the specified limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the phase (1=L1, 2=L2, 3=L3, 4=Neutral, 5=L1-2, 6=L2-3, 7=L3-1).
-        The fourth argument is the measured current in Amps.
-        The fifth argument is the threshold, in Amps, from which the alarm was generated."
-   --#TYPE "APC XATS: Output (load) current out-of-range alarm."
-   --#SUMMARY "Output current is out-of-range."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 385
-
-xATSOutputCurrentLowAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, 
-               mtrapargsInteger02, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The devices three-phase output current is back within the specified limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the phase (1=L1, 2=L2, 3=L3, 4=Neutral).
-        The fourth argument is the measured current in Amps."
-   --#TYPE "APC XATS: Output (load) current back in range."
-   --#SUMMARY "Output current in range."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 386
-
-xATSOutputCurrentHighAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, 
-               mtrapargsInteger02, mtrapargsInteger03, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The devices three-phase load current is outside the specified limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the phase (1=L1, 2=L2, 3=L3, 4=Neutral).
-        The fourth argument is the measured current in Amps.
-        The fifth argument is the threshold, in Amps, from which the alarm was generated."
-   --#TYPE "APC XATS: Output (load) current out-of-range alarm."
-   --#SUMMARY "Output current is out-of-range."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 387
-
-xATSOutputCurrentHighAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, 
-               mtrapargsInteger02, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The devices three-phase output current is back within the specified limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the phase (1=L1, 2=L2, 3=L3, 4=Neutral).
-        The fourth argument is the measured current in Amps."
-   --#TYPE "APC XATS: Output (load) current back in range."
-   --#SUMMARY "Output current in range."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 388
-
-
-xATSOutputFrequencyAlarm TRAP-TYPE
-  ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, 
-               mtrapargsInteger02, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The devices output frequency is outside the specified limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the frequency deviation from the nominal in tenths of Hertz.
-        The fourth argument is the frequency deviation threshold in tenths of Hertz, 
-        from which the alarm was generated."
-   --#TYPE "APC XATS: Output frequency out-of-range alarm."
-   --#SUMMARY "Output frequency is out-of-range."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 389
-
-xATSOutputFrequencyAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The devices output frequency is back within the specified limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XATS: Output frequency back in range."
-   --#SUMMARY "Output frequency in range."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 390
-
-xATSInternalCommError TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: There is an internal communication error in the device.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XATS: Internal communication error."
-   --#SUMMARY "Internal communication error."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 391
-
-xATSInternalCommErrorCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Internal communication has been restored.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XATS: Internal Communication error cleared."
-   --#SUMMARY "ATS Communication error cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 392
-
-xATSDataCommMismatchError TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: A data incompatibility exists within the device.  This
-        is typically the result of mismatches between firmware revisions
-        of the transfer switch controller and the Network Management interface.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XATS: Data mismatch error."
-   --#SUMMARY "ATS data mismatch error."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 393
-
-xATSDataCommMismatchErrorCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The internal data incompatibility has been resolved.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XATS: data mismatch error cleared."
-   --#SUMMARY "ATS data mismatch error cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 394
-
-xATSGenCommLost TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "WARNING: The XATS cannot communicate with the generator.
-        This will make unavailable all the xATSGenerator OIDs.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XATS: No communication with generator."
-   --#SUMMARY "ATS/Generator communication lost."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 395
-
-xATSGenCommEstablished TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The XATS has established communication with the generator.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XATS: Communication with generator established."
-   --#SUMMARY "ATS/generator communication established."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 396
-   
-xATSNeutralPosition TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger,
-                mtrapargsString }
-   DESCRIPTION
-      "WARNING: XATS has transferred to neutral position.
-        In this position neither Source 1 nor Source 2 is selected,
-        and the XATS will have no output voltage.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the mode in which the switch is operating
-        (1=Auto, 2=Not-in-Auto, Abnormal Condition  3=Not-in-Auto, manual)."
-   --#TYPE "APC XATS: Transferred to the neutral (no output power) position."
-   --#SUMMARY "Transferred to neutral."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 397
-
-xATSSwitchTransferEvent TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger,
-                mtrapargsInteger02, mtrapargsInteger03, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: XATS has transferred from one source to the other.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the mode in which the switch is operating.
-        (1=Auto, 2=Not-in-Auto, Abnormal Condition  3=Not-in-Auto, manual).
-        The fourth argument is the input source selected (1=Source 1, 2=Source 2).
-        The fifth argument is type of transfer that took place. (1=Closed, 2=Open, 3=Unknown)"
-   --#TYPE "APC XATS: Transferred from Source-X to Source-Y."
-   --#SUMMARY "Source-to-Source transfer."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 398
-
-xATSInternalATSFault TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: An internal XATS fault has been detected.
-        The XATS may have forced itself to not-in-auto mode (abnormal condition),
-        as indicated by the xATSSwitchStatusAutoSwitchOperationalMode OID.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument indicates the detected fault.
-
-           1=Cannot Close S1
-           2=Cannot Close S2
-           3=Cannot Open S1
-           4=Cannot Open S2
-           5=Cannot Trip Open S1 
-           6=Cannot Trip Open S2 
-           7=Start Contact Failure
-           8=Voltage Sensing Failure"
-
-   --#TYPE "APC XATS: Internal fault detected."
-   --#SUMMARY "ATS internal fault detected."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 399
-
-xATSInternalATSFaultCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The detected internal XATS fault has been cleared.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument indicates the detected fault.
-
-           1=Cannot Close S1
-           2=Cannot Close S2
-           3=Cannot Open S1
-           4=Cannot Open S2
-           5=Cannot Trip Open S1 
-           6=Cannot Trip Open S2 
-           7=Start Contact Failure
-           8=Voltage Sensing Failure"
-
-   --#TYPE "APC XATS: Internal fault cleared."
-   --#SUMMARY "ATS internal fault cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 400
-
-xATSEngineStartAsserted TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The XATS has asserted the Engine Start contact.
-        This should result in the generator producing output voltage.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument indicates the reason that the start signal was asserted
-        1=Unknown, 2=S1 Low Voltage, 3=S1 High Voltage, 4=S1 Line Imbalance,
-        5=S1 Freq Range, 6=S1 Bad Rotation."
-   --#TYPE "APC XATS: Engine Start signal asserted."
-   --#SUMMARY "Engine Start asserted."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 401
-
-xATSEngineStopAsserted TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The XATS has de-asserted the Engine Start contact.
-        This should result in the generator shutting down, and producing no output voltage.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XATS: Engine Stop signal asserted."
-   --#SUMMARY "Engine Stop asserted."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 402
-
-xATSStartFailure TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The generator failed to start. After assertion of the
-        Engine Start signal, the quality of Source 2 was not seen as good.
-        This alarm can be cleared using the xATSSwitchStatusClearLatchedAlarms OID.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument indicates the line quality at S2
-         1=Unknown, 2=S2 Low Voltage, 3=S2 High Voltage, 4=S2 Line Imbalance,
-         4=S2 Freq Range, 5=S2 Bad Rotation."
-   --#TYPE "APC XATS: Generator failed to start alarm."
-   --#SUMMARY "Generator failed to start."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 403
-
-xATSStopFailure TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "WARNING: The generator failed to stop. After de-assertion of the
-        Engine Start signal, the quality of Source 2 continued to be seen as good.
-        This alarm can be cleared using the xATSSwitchStatusClearLatchedAlarms OID.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XATS: Generator failed to stop alarm."
-   --#SUMMARY "Generator failed to stop."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 404
-
-xATSNotInAutomaticMode TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Automatic Transfer Switch is not in automatic mode.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The xATSSwitchStatusAutoSwitchStatus OID and the
-        xATSSwitchStatusAutoSwitchOperationalMode OID
-        can provide more information about the state of the XATS."
-   --#TYPE "APC XATS: XATS is not-in-automatic mode."
-   --#SUMMARY "ATS not in auto."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 405
-
-xATSNotInAutomaticModeCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Automatic Transfer Switch is in automatic mode.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XATS: XATS in auto mode."
-   --#SUMMARY "ATS in auto mode."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 406
-
-xATSEpoTripped TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The device's Emergency Power Off (EPO) circuit is tripped.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XATS: Emergency Power Off (EPO) tripped."
-   --#SUMMARY "EPO tripped."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 407
-
-xATSEpoReset TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The device's Emergency Power Off (EPO) circuit has been
-        reset to the armed position.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XATS: Emergency Power Off (EPO) reset."
-   --#SUMMARY "EPO armed."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 408
-
-xATSEpoTestMode TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "WARNING: The device's Emergency Power Off (EPO) circuit has been
-        switched back to the test position.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XATS: Emergency Power Off (EPO) in test mode."
-   --#SUMMARY "EPO disabled."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 409
-
-xATSEpoArmed TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The device's Emergency Power Off (EPO) circuit has been
-        switched back to the armed position.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XATS: Emergency Power Off (EPO) enabled."
-   --#SUMMARY "EPO armed."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 410
-
-xATSTestInitiated TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A scheduled test has been initiated.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the type of test initiated (1=scheduled, 2=manual)."
-   --#TYPE "APC XATS: Test initiated."
-   --#SUMMARY "Test initiated."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 411
-
-xATSTestCancelled TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The scheduled test has been canceled
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the type of test initiated (1=scheduled, 2=manual)."
-   --#TYPE "APC XATS: Test cancelled."
-   --#SUMMARY "Test cancelled."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 412
-
-xATSTestFailed TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The initiated test has failed.
-        This alarm can be cleared using the xATSSwitchStatusClearLatchedAlarms OID.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XATS: Initiated test failed."
-   --#SUMMARY "Initiated test failed."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 413
-
-xATSTestPassed TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The initiated test has passed
-        switched back to the armed position.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XATS: Initiated test passed."
-   --#SUMMARY "Initiated test passed."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 414
-
-xATSInputContactStateAbnormal TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, 
-               mtrapargsString02, mtrapargsInteger02, mtrapargsInteger03, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: A user input contact on the device has changed to its abnormal state.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the input contact number. 
-        The fourth argument is the input contact name.
-        The fifth argument is the input contact state (1=OPEN, 2=CLOSED).
-        The sixth argument is the configured normal input contact state (1=OPEN, 2=CLOSED)."
-   --#TYPE "APC XATS: Input contact has changed to its abnormal state."
-   --#SUMMARY "Input contact has changed to its abnormal state."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 415
-
-xATSInputContactStateNormal TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, 
-               mtrapargsString02, mtrapargsInteger02, mtrapargsInteger03, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A user input contact on the device has changed to its normal state.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the input contact number. 
-        The fourth argument is the input contact name.
-        The fifth argument is the input contact state (1=OPEN, 2=CLOSED).
-        The sixth argument is the configured normal input contact state (1=OPEN, 2=CLOSED)."
-   --#TYPE "APC XATS: Input contact has changed to its normal state."
-   --#SUMMARY "Input contact has changed to its normal state."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 416
-
-xATSRemoteStartContactMismatch TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The state of the generator's Remote Start input
-        and the ATS's Engine Start output do not match. 
-        This indicates something wrong in the Engine Start wiring,
-        which must be corrected. This condition will prevent the 
-        generator from being started when needed.
-
-          (See also: xATSGeneratorStatusRemoteStart 
-           and xATSSwitchStatusEngineStartSignal OIDs)
-
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XATS: Generator/ATS start contact mismatch."
-   --#SUMMARY "Generator/ATS start contact mismatch."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 417
-
-xATSRemoteStartContactMismatchCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Mismatch in the state of the generator's 
-        Remote Start input and the ATS's Engine Start output as been resolved. 
-        This indicates something wrong in the Engine Start wiring,
-        which must be corrected. This condition will prevent the 
-        generator from being started when needed.
-
-          (See also: xATSGeneratorStatusRemoteStart 
-           and xATSSwitchStatusEngineStartSignal OIDs)
-
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XATS: Generator/ATS start contact mismatch cleared."
-   --#SUMMARY "Generator/ATS start contact mismatch cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 418
-
-xATSDoorOpenAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "WARNING: The XATS exterior panel door is open.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XATS: Panel door is open alarm."
-   --#SUMMARY "Panel door open alarm."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 419
-
-xATSDoorOpenAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The external door to the device is closed.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XATS: Panel door open alarm cleared."
-   --#SUMMARY "Panel door open alarm cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 420
-
-xATSDCBackupAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "WARNING: The XATS's DC backup has been lost. The XATS will lose power
-        on Source 1 failure, causing the Engine Start signal to be asserted.
-        The XATS will then restart from Source 2.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XATS: DC backup failure."
-   --#SUMMARY "ATS DC backup failure."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 421
-
-xATSDCBackupAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: DC backup alarm has been cleared in the device.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XATS: DC backup alarm cleared."
-   --#SUMMARY "DC backup alarm cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 422
-
--- xATS Generator Traps
-
-xATSGeneratorLowCoolantLevelAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName,  mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Low coolant level has been detected in the generator.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator low coolant level alarm."
-   --#SUMMARY "Generator low coolant level alarm."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 423
-
-xATSGeneratorLowCoolantLevelAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The detected low coolant level has been cleared in the generator.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator low coolant level alarm cleared."
-   --#SUMMARY "Generator low coolant level alarm cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 424
-
-xATSGeneratorVeryLowCoolantLevelAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Very low coolant level has been detected in the generator.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator very low coolant level alarm."
-   --#SUMMARY "Generator very low coolant level alarm."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 425
-
-xATSGeneratorVeryLowCoolantLevelAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The detected Very low coolant level has been cleared in the generator.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator very low coolant level alarm cleared."
-   --#SUMMARY "Generator very low coolant level alarm cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 426
-
-xATSGeneratorHighCoolantTempAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: High coolant temperature has been detected in the generator.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator high coolant temperature alarm."
-   --#SUMMARY "Generator high coolant temperature alarm."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 427
-
-xATSGeneratorHighCoolantTempAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The detected high coolant temperature has been cleared in the generator.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator high coolant temperature alarm cleared."
-   --#SUMMARY "Generator high coolant temperature alarm cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 428
-
-xATSGeneratorVeryHighCoolantTempAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Very high coolant temperature has been detected in the generator.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator very high coolant temperature alarm."
-   --#SUMMARY "Generator very high coolant temperature alarm."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 429
-
-xATSGeneratorVeryHighCoolantTempAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The Very high coolant temperature condition has been cleared in the generator.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator very high coolant temperature alarm cleared."
-   --#SUMMARY "Generator very high coolant temperature alarm cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 430
-
-xATSGeneratorLowCoolantTempAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "WARNING: Low coolant temperature has been detected in the generator.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator low coolant temperature alarm."
-   --#SUMMARY "Generator low coolant temperature alarm."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 431
-
-xATSGeneratorLowCoolantTempAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The low coolant temperature condition has been cleared in the generator.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator low coolant temperature alarm cleared."
-   --#SUMMARY "Generator low coolant temperature alarm cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 432
-
-xATSGeneratorLowOilLevelAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Low oil level has been detected in the generator.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator low oil level alarm."
-   --#SUMMARY "Generator low oil level alarm."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 433
-
-xATSGeneratorLowOilLevelAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Low oil level alarm has been cleared in the generator.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator low oil level alarm cleared."
-   --#SUMMARY "Generator low oil level alarm cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 434
-   
-xATSGeneratorLowBatteryVoltDuringCrankAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The generator's battery voltage has been detected 
-        as low while cranking the engine.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Low batt. voltage while cranking alarm."
-   --#SUMMARY "Generator low battery volts while cranking alarm."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 435
-
-xATSGeneratorLowBatteryVoltDuringCrankAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The generator's low battery voltage while
-        cranking condition has been cleared.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "XGEN: Generator low batt. voltage while cranking alarm cleared."
-   --#SUMMARY "Generator low battery volts while cranking alarm cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 436
-
-xATSGeneratorVeryLowBatteryVoltDuringCrankAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The generator's battery voltage has been detected 
-        as very low while cranking the engine.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "XGEN: Generator v.low battery voltage while cranking alarm."
-   --#SUMMARY "Generator v.low battery volts while cranking alarm."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 437
-
-xATSGeneratorVeryLowBatteryVoltDuringCrankAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The generator's high battery voltage while
-        cranking condition has been cleared.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "XGEN: Generator v.low batt volt, while cranking alarm cleared."
-   --#SUMMARY "Generator v.low battery volts while cranking alarm cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 438
-
-xATSGeneratorEStop TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsInteger02, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The generator's emergency stop input has been activated.
-        After the emergency stop signal has been removed, the E-Stop condition  
-        must be cleared before the generator can be started again.
-        E-Stop conditions can only be cleared via the generator front panel.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code.
-        The fourth argument is the type of E-Stop (1=LOCAL, 2=REMOTE)."
-   --#TYPE "APC XGEN: Generator emergency stop engaged."
-   --#SUMMARY "Generator emergency stop engaged."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE NONOPERATIONAL
-   ::= 439
-
-xATSGeneratorEStopCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsInteger02, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The generator's emergency stop condition has been cleared.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code.
-        The fourth argument is the type of E-Stop (1=LOCAL, 2=REMOTE)."
-   --#TYPE "APC XGEN: Generator emergency stop condition cleared."
-   --#SUMMARY "Generator emergency stop condition cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 440
-
-xATSGeneratorHighBatteryVolt TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName,  mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "WARNING: The generator's battery voltage has been detected as high.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator high battery voltage."
-   --#SUMMARY "Generator high battery volts."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 441
-
-xATSGeneratorHighBatteryVoltCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The detected high battery voltage has been cleared, on the generator.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator high battery voltage condition cleared."
-   --#SUMMARY "Generator high battery volts condition cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 442
-
-xATSGeneratorLowBatteryVolt TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName,  mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The generator's battery voltage has been detected as low.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator low battery voltage."
-   --#SUMMARY "Generator low battery volts."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 443
-
-xATSGeneratorLowBatteryVoltCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The detected low battery voltage has been cleared, on the generator.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator low battery voltage condition cleared."
-   --#SUMMARY "Generator low battery volts condition cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 444
-
-xATSGeneratorControlSwitchNotAuto TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The control switch on the generator is not in auto position.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator not-in-automatic mode."
-   --#SUMMARY "Generator not-in-auto."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 445
-
-xATSGeneratorControlSwitchNotAutoCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The control switch on the generator is in auto position.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator automatic mode restored."
-   --#SUMMARY "Generator not-in-auto cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 446
-
-xATSGeneratorLowOilPressure TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName,  mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The generator's oil pressure has been detected as low.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator low oil pressure."
-   --#SUMMARY "Generator low oil pressure."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 447
-
-xATSGeneratorLowOilPressureCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The detected low oil pressure has been cleared, on the generator.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator low oil pressure condition cleared."
-   --#SUMMARY "Generator low oil pressure condition cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 448
-
-xATSGeneratorVeryLowOilPressure TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName,  mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The generator's oil pressure has been detected as very low.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator v.low oil pressure."
-   --#SUMMARY "Generator v.low oil pressure."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 449
-
-xATSGeneratorVeryLowOilPressureCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The detected v.low oil pressure has been cleared, on the generator.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator v.low oil pressure condition cleared."
-   --#SUMMARY "Generator v.low oil pressure condition cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 450
-
-xATSGeneratorOverload TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The generator is overloaded.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator is in overload event."
-   --#SUMMARY "Generator on overload event."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 451
-
-xATSGeneratorOverloadCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The generator is running within loading limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator is in overload event cleared."
-   --#SUMMARY "Generator on overload event cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 452
-
-xATSGeneratorLowACVEvent TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The generator AC voltage is outside the acceptable bounds.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: State of the Generator ac voltage."
-   --#SUMMARY " State of the Generator ac voltage."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 453
-
-xATSGeneratorLowACVEventCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The generator AC voltage is within normal bounds.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: State of the Generator ac voltage cleared."
-   --#SUMMARY "State of the Generator ac voltage cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 454
-
-xATSGeneratorHighACVEvent TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The generator AC voltage is outside the acceptable bounds.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: State of the Generator ac voltage."
-   --#SUMMARY " State of the Generator ac voltage."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 455
-
-xATSGeneratorHighACVEventCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The generator AC voltage is within normal bounds.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: State of the Generator ac voltage cleared."
-   --#SUMMARY "State of the Generator ac voltage cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 456
-
-xATSGeneratorOverspeed TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The generator is running over the acceptable RPM.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator overspeed condition."
-   --#SUMMARY "Generator overspeed condition."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 457
-
-xATSGeneratorOverspeedCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The generator overspeed shutdown has been cleared.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator overspeed condition cleared."
-   --#SUMMARY "Generator overspeed condition cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 458
-
-xATSGeneratorEngineCold TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The generator engine is cold, may not start.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator engine is cold, may not start."
-   --#SUMMARY "Generator engine is cold."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 459
-
-xATSGeneratorEngineColdCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The engine is not cold to start.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Engine is cold to start condition cleared."
-   --#SUMMARY "Engine is cold to start condition cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 460
-
-xATSGeneratorOutputBreakerOpen TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The generators output breaker has been detected as open.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator output breaker open alarm."
-   --#SUMMARY "Generator output breaker open."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE NONOPERATIONAL
-   ::= 461
-
-xATSGeneratorOutputBreakerOpenCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The engine is not cold to start.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator output breaker open alarm cleared."
-   --#SUMMARY "Generator output breaker open cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 462
-
-xATSGeneratorLowFuelLevelAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "WARNING: The tank fuel level is below the limits specified
-        in the xATSGeneratorFuelSystemLowFuelLevelThreshold OID.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the measured fuel level in percent of full."
-   --#TYPE "APC XGEN: Low fuel level alarm."
-   --#SUMMARY "Generator low fuel level alarm."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 463
-
-xATSGeneratorLowFuelLevelAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The tank fuel level is back above the specified limit.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XGEN: Low fuel level alarm cleared."
-   --#SUMMARY "Generator low fuel level alarm cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 464
-
-xATSGeneratorVeryLowFuelLevelAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The tank fuel level is below the low threshold limits.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the measured tank fuel level in percent of full."
-   --#TYPE "APC XGEN: Very Low fuel level alarm."
-   --#SUMMARY "Generator very low fuel level alarm."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 465
-
-xATSGeneratorVeryLowFuelLevelAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The detected low tank level has been cleared in the device.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XGEN: Very low fuel level alarm cleared."
-   --#SUMMARY "Generator very low fuel level alarm cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 466
-
-xATSGeneratorLowRunTimeAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "WARNING: The estimated runtime is below the limits specified.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the estimated runtime in hours."
-   --#TYPE "APC XGEN: Low run time alarm."
-   --#SUMMARY "Generator low run time alarm."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 467
-
-xATSGeneratorLowRunTimeAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The detected low runtime has been cleared in the device.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XGEN: Low run time alarm cleared."
-   --#SUMMARY "Generator low run time alarm."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 468
-
-xATSGeneratorVeryLowRunTimeAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The estimated runtime is below the limits specified
-        in the xATSGeneratorFuelSystemVeryLowRunTimeThreshold OID.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the estimated runtime in hours."
-   --#TYPE "APC XGEN: Very low run time alarm."
-   --#SUMMARY "Generator very low run time alarm."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 469
-
-xATSGeneratorVeryLowRunTimeAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The detected low runtime has been cleared in the device.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XGEN: Very low run time alarm cleared."
-   --#SUMMARY "Generator very low run time alarm."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 470
-
-xATSGeneratorServiceDueAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "WARNING: The generator is due for scheduled service.
-        Generation of this alarm is based on calender days since 
-        and/or actual generator run-hours since last service.
-        This alarm is cleared using the xATSGeneratorServiceResetRecord OID.
-
-          (See also: xATSGeneratorServiceCalendarIntervalThreshold
-           and xATSGeneratorServiceRunHoursThreshold OIDs)
-
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XATS: Generator scheduled maintenance is due."
-   --#SUMMARY "Generator maintenance due."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 471
-
-xATSGeneratorServiceDueAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The generator's service registers have been reset.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XATS: Generator service due alarm is cleared."
-   --#SUMMARY "Generator service alarm is cleard."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 472
-
-xATSGeneratorShutdown TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The generator is shutdown.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator shutdown."
-   --#SUMMARY "Generator shutdown"
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 473
-
-xATSGeneratorShutdownCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The generator shutdown alarm is cleared.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator shutdown is cleared."
-   --#SUMMARY "Generator shutdown is cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 474
-
-xATSGeneratorBatteryCharger TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: The generator battery charger is nonfunctional.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator batt. charger is nonfunctional."
-   --#SUMMARY "Generator battery charger is nonfunctional"
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 475
-
-xATSGeneratorBatteryChargerCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName, mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: nonfunctionality of the generator battery is cleared.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: " Nonfunctionality of battery charger is cleared."
-   --#SUMMARY "non-functionality of Generator battery charger is cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 476
-
-xATSGeneratorGenericEvent TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName,  mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "WARNING: Any generic generator event.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generator generic event."
-   --#SUMMARY "Generator generic event."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 477
-
-xATSGeneratorGenericEventCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xATSIdentSerialNumber, xATSIdentProductName,  mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Generated generic generator event is cleared.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the OEM's fault/event code."
-   --#TYPE "APC XGEN: Generic generator event is cleared."
-   --#SUMMARY "Generic generator event is cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 478
-
--- xPDU Traps (part 2)
-
-xPDUInternalCommErrorCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Internal communication has been restored.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XPDU: Internal Communication error cleared."
-   --#SUMMARY "Communication error cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 479
-
-xPDUSystemStateAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName,
-               mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "WARNING: The PDU's breakers (Q1, Q2 & Q3) are in a configuration that might lead
-        to system unavailability.  it may signify a temporary condition, when the breakers
-		are placed in an atypical manner as the user transitions to (UPS OPERATION or MAINTENANCE BYPASS)
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the type of alarm
-        (1=NO UPS INPUT, 2=NO PANEL FEED, 3=ATYPICAL BYPASS MODE)."
-   --#TYPE "APC XPDU: System state alarm ."
-   --#SUMMARY "PDU state alarm."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 480
-
-xPDUSystemStateNormal TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, 
-               mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The PDU's breakers (Q1, Q2 & Q3) are set in a configuration
-        that is a non-alarm state.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the type of alarm (1=UPS OPERATION, 2=MAINTENANCE BYPASS)."
-   --#TYPE "APC XPDU: System state returned to normal."
-   --#SUMMARY "PDU state normal."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 481
-
-xPDUEpoTestMode TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "WARNING: The device's Emergency Power Off (EPO) circuit has been
-        switched back to the test position.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XPDU: Emergency Power Off (EPO) in test mode."
-   --#SUMMARY "EPO disabled."
-   --#ARGUMENTS { }
-   --#SEVERITY WARNING
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 482
-
-xPDUEpoArmed TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: The device's Emergency Power Off (EPO) circuit has been
-        switched back to the armed position.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XPDU: Emergency Power Off (EPO) enabled."
-   --#SUMMARY "EPO armed."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 483
-
-xPDUFuseBlownAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName,
-               mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: One or more fuses in this PDU have been detected as open.
-        These fuses are in the feed to the UPS associated with this PDU.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the phase (1=L1, 2=L2, 3=L3)."
-   --#TYPE "APC XPDU: Check fuse alarm."
-   --#SUMMARY "Fuse detected opened."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 484
-
-xPDUFuseBlownAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName,
-               mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A previous check fuse alarm in this PDU has cleared.
-        These fuses are in the feed to the UPS associated with this PDU.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the phase (1=L1, 2=L2, 3=L3)."
-   --#TYPE "APC XPDU: Check fuse alarm cleared."
-   --#SUMMARY "Fuse alarm cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 485
-
-xPDUBreakerPositionAlarm TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, 
-               mtrapargsInteger, mtrapargsInteger02, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: A PDU breaker is in a state that compromises system availability.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the breaker (1=MAIN INPUT, 2=BYPASS INPUT, 3=CROSS TIE).
-        The fourth argument is the breaker position (1=OPEN, 2=CLOSED)."
-   --#TYPE "APC XPDU: Breaker position alarm."
-   --#SUMMARY "Breaker position alarm."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 486
-
-xPDUBreakerPositionAlarmCleared TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName,
-               mtrapargsInteger, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A PDU breaker is no longer in a state that compromises system availability.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the breaker (1=MAIN INPUT, 2=BYPASS INPUT, 3=CROSS TIE)."
-   --#TYPE "APC XPDU: Breaker position alarm cleared."
-   --#SUMMARY "Breaker alarm cleared."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 487
-
-xPDUBreakerChangeEvent TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsInteger,
-               mtrapargsInteger02, mtrapargsInteger03, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: A system breaker or switch within the device has changed state.
-	    They are generated when any of the Q1, Q2 or Q3 breakers have changed states.
-        The first argument is the host device serial number.
-        The second argument is the host device name.
-        The third argument is the breaker that has changed
-        (1=UPS FEED (Q1), 2=UPS OUTPUT(Q2), 3=MAINTENANCE BYPASS (Q3).
-        The fourth argument is the state of the breaker that has changed (1=OPEN, 2=CLOSED).
-        The fifth argument is a 8-bit field representing the state of all breakers in the system,
-		when any of one of the Q1, Q2 or Q3 breakers have changed state.
-
-        The bit map is represented in the following manner (b7, b6 ... b0)
-		b0 - UPS FEED (Q1)
-		b1 - MAINTENANCE BYPASS (Q3)
-		b2 - UPS OUTPUT (Q2)
-        b3 - MAIN INPUT
-		b4 - BYPASS INPUT
-		b5 - CROSS-TIE OUTPUT
-
-        Example:  value of 60 (0x3C) indicates that the CROSS_TIE, BYPASS and MAIN INPUT, and Q2 breakers 
-        are CLOSED and Q2, Q1 breakers are OPEN." 
-   --#TYPE "APC XPDU: Breaker/switch change event."
-   --#SUMMARY "Breaker/switch change event."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 488
-
-xPDUControllerFirmwareUpdateTransferStart TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Start Controller firmware transfer in the device.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XPDU: Start controller firmware transfer."
-   --#SUMMARY "Start controller firmware transfer."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 489
-
-xPDUControllerFirmwareUpdateTransferComplete TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Transfer of Controller firmware was completed in the device.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XPDU: Controller firmware transfer completed."
-   --#SUMMARY "Controller firmware transfer completed."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 490
-
-xPDUControllerFirmwareUpdateTransferFailed TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Transfer of Controller firmware has failed in the PDU.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XPDU: Controller firmware transfer failed."
-   --#SUMMARY "Controller firmware transfer failed."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 491
-
-xATSControllerFirmwareUpdateTransferStart TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Start Controller firmware transfer in the device.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XATS: Start controller firmware transfer."
-   --#SUMMARY "Start controller firmware transfer."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 492
-
-xATSControllerFirmwareUpdateTransferComplete TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "INFORMATIONAL: Transfer of Controller firmware was completed in the device.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XATS: Controller firmware transfer completed."
-   --#SUMMARY "Controller firmware transfer completed."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 493
-
-xATSControllerFirmwareUpdateTransferFailed TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { xPDUIdentSerialNumber, xPDUIdentProductName, mtrapargsString }
-   DESCRIPTION
-      "SEVERE: Transfer of Controller firmware has failed in the device.
-        The first argument is the host device serial number.
-        The second argument is the host device name."
-   --#TYPE "APC XATS: Controller firmware transfer failed."
-   --#SUMMARY "Controller firmware transfer failed."
-   --#ARGUMENTS { }
-   --#SEVERITY SEVERE
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE DEGRADED
-   ::= 494
-
-apcDeviceShutdownHeartbeat TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { mtrapargsInteger, mtrapargsTimeTicks, mtrapargsString}
-   DESCRIPTION
-      "INFORMATIONAL: "
-   --#TYPE "APC X:"
-   --#SUMMARY "."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 999
-
-apcDiscoveryAlarmStateTableUpdate TRAP-TYPE
-   ENTERPRISE apc
-   VARIABLES { apcDiscoveryDeviceAlarmStateChangeCount }
-   DESCRIPTION
-      "INTERNAL: A Discovery Alarm State Table Update trap is sent
-       when any data alarm state is added, removed, or its parameters
-       are changed in the condition table.  This trap is
-       only for machine-to-machine communication. "
-   --#TYPE "APC X:"
-   --#SUMMARY "."
-   --#ARGUMENTS { }
-   --#SEVERITY INFORMATIONAL
-   --#TIMEINDEX 1
-   --#HELP ""
-   --#HELPTAG 0
-   --#STATE OPERATIONAL
-   ::= 1000
-   
-END
diff --git a/fence/agents/baytech/Makefile b/fence/agents/baytech/Makefile
deleted file mode 100644
index 2acfe58..0000000
--- a/fence/agents/baytech/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-TARGET= fence_baytech
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/baytech/fence_baytech.pl b/fence/agents/baytech/fence_baytech.pl
deleted file mode 100644
index 3b07a3c..0000000
--- a/fence/agents/baytech/fence_baytech.pl
+++ /dev/null
@@ -1,668 +0,0 @@
-#!/usr/bin/perl
-
-# This fencing agent is written for the Baytech RPC27-20nc in conjunction with
-# a Cyclades terminal server.  The Cyclades TS exports the RPC's serial port
-# via a Telnet interface.  Other interfaces, such as SSH, are possible.  
-# However, this script relys upon the assumption that Telnet is used.  Future
-# features to this agent would allow the agent to work with a mulitude of 
-# different communication protocols such as Telnet, SSH or Kermit.
-#
-# The other assumption that is made is that Outlet names do not end in space.
-# The name "Foo" and "Foo    " are identical when the RPC prints them with
-# the status command.
-
-use Net::Telnet;
-use Getopt::Std;
-
-# WARNING!! Do not add code bewteen "#BEGIN_VERSION_GENERATION" and 
-# "#END_VERSION_GENERATION"  It is generated by the Makefile
-
-#BEGIN_VERSION_GENERATION
-$RELEASE_VERSION="";
-$REDHAT_COPYRIGHT="";
-$BUILD_DATE="";
-#END_VERSION_GENERATION
-
-# Get the program name from $0 and strip directory names
-$_=$0;
-s/.*\///;
-my $pname = $_;
-
-
-sub rpc_error 
-{
-	if (defined $error_message && $error_message ne "")
-	{
-		chomp $error_message;
-		die "$error_message\n";
-	}
-	else
-	{
-		die "read timed-out\n"
-	}
-}
-
-sub usage 
-{
-
-    print "Usage:\n";
-    print "\n";
-    print "$pname [options]\n";
-    print "\n";
-    print "Options:\n";
-    print " -a host        host to connect to\n";
-    print " -D             debugging output\n";
-    print " -h             usage\n";
-    print " -l string      user name\n";
-    print " -o string      action: on,off,status or reboot (default)\n";
-    print " -n string      outlet name\n";
-    print " -p string      password\n";
-    print " -S path        script to run to retrieve password\n";
-    print " -V             version\n";
-
-    exit 0;
-}
-
-sub fail
-{
-  ($msg)=@_;
-  print $msg."\n" unless defined $quiet;
-  $t->close if defined $t;
-  exit 1;
-}
-
-sub fail_usage
-{
-  ($msg)=@_;
-  print STDERR $msg."\n" if $msg;
-  print STDERR "Please use '-h' for usage.\n";
-  exit 1;
-}
-
-sub version
-{
-  print "$pname $RELEASE_VERSION $BUILD_DATE\n";
-  print "$REDHAT_COPYRIGHT\n" if ( $REDHAT_COPYRIGHT );
-
-  exit 0;
-}
-
-# Get operating paramters, either with getopts or from STDIN
-sub get_options
-{
-   $action = "Reboot";
-   if (@ARGV > 0) {
-      getopts("n:l:p:S:o:a:VhD") || fail_usage ;
-
-      usage if defined $opt_h;
-      version if defined $opt_V;
-
-      fail_usage "Unkown parameter." if (@ARGV > 0);
-
-   } else {
-      get_options_stdin();
-   } 
-
-   fail "failed: must specify hostname" unless defined $opt_a;
-   $host=$opt_a;
-   $port=23 unless ($opt_a =~ /:/);
-
-   $action = $opt_o if defined $opt_o;
-   fail "failed: unrecognised action: $action"
-         unless $action=~ /^(Off|On|Reboot|status)$/i;
-   
-   fail "failed: no outletname" unless defined $opt_n;
-   $outlet = $opt_n;
-
-   $debug=$opt_D if defined $opt_D;
-   $quiet=$opt_q if defined $opt_q;
-   $user=$opt_l if defined $opt_l;
-   $passwd=$opt_p if defined $opt_p;
-   if (defined $opt_S) {
-     $pwd_script_out = `$opt_S`;
-     chomp($pwd_script_out);
-     if ($pwd_script_out) {
-       $passwd=$pwd_script_out;
-     }
-   }
-
-   if(defined $passwd && !defined $user)
-   {
-      fail "failed: password given without username";
-   }
-}
-
-# Get options from STDIN
-sub get_options_stdin
-{
-    my $opt;
-    my $line = 0;
-    while( defined($in = <>) )
-    {
-	$_ = $in;
-        chomp;
-
-	# strip leading and trailing whitespace
-        s/^\s*//;
-        s/\s*$//;
-
-	# skip comments
-	next if /^#/;
-
-        $line+=1;
-        $opt=$_;
-	next unless $opt;
-
-	($name,$val)=split /\s*=\s*/, $opt;
-
-	if ( $name eq "" )
-	{
-	   print STDERR "parse error: illegal name in option $line\n";
-	   exit 2;
-	} 
-
-        # DO NOTHING -- this field is used by fenced 
-	elsif ($name eq "agent" ) { } 
-
-	elsif ($name eq "host" ) 
-	{
-	    $opt_a = $val;
-	} 
-
-	elsif ($name eq "login" ) 
-	{
-	    $opt_l = $val;
-	} 
-
-	elsif ($name eq "passwd" ) 
-	{
-	    $opt_p = $val;
-	} 
-
-    elsif ($name eq "passwd_script") {
-        $opt_S = $val;
-    }
-
-	elsif ($name eq "action" ) 
-	{
-	    $opt_o = $val;
-	} 
-
-	elsif ($name eq "outlet" ) 
-	{
-	    $opt_n = $val;
-	} 
-
-    }
-}
-
-# Get a bunch of lines.  The newlines must terminate complete lines.
-sub getlines
-{
-	my $data=$t->get();
-	return undef unless defined $data;
-	my @chars = split //,$data;
-	my @lines;
-	my $line="";
-
-	for (my $i=0;$i<@chars;$i++)
-	{
-		$line = $line.$chars[$i];
-		next unless $chars[$i] eq "\n";
-		$lines[@lines] = $line;
-		$line = "";
-	}
-	$lines[@lines] = $line unless $line eq "";
-
-	return @lines;
-}
-
-# Fill the global input buffer of lines read.  All lines are terminated with
-# a newline.  If a line is not terminated, the next call to fill buffer will
-# append the last line of the input buffer with the first line that it gets from
-# getlines()
-sub fill_buffer
-{
-	my @lines = getlines();
-	return undef unless @lines;
-
-	if(@buffer)
-	{
-		if ( $buffer[$#buffer]=~/\n/) { }
-		else
-		{
-			$buffer[$#buffer] = $buffer[$#buffer].$lines[0];
-			shift @lines;
-		}
-	}
-
-	foreach (@lines) 
-	{ 
-		push @buffer,$_;
-	}
-}
-
-
-
-#
-# ($p_index,@data) = get_match @patterns;
-#
-# searches the input buffers for the patterns specified by the regeps in 
-# @patterns, when a match is found, all the lines through the matched 
-# pattern line are removed from the global input buffer and returned in the
-# array @data.  The index into @patterns for the matching pattern is also
-# returned.
-sub get_match
-{
-	my (@patterns) = @_;
-	$b_index = 0 unless defined $b_index;
-
-	fill_buffer() unless defined @buffer;
-
-	for(;;)
-	{
-		for(my $bi=$b_index; $bi<@buffer; $bi++)
-		{
-			for(my $pat=0; $pat<@patterns; $pat++)
-			{
-				if($buffer[$bi] =~ /$patterns[$pat]/)
-				{
-					$b_index = 0;
-					my @rtrn = splice(@buffer,0,$bi);
-					shift @buffer;
-				
-					if($debug)
-					{
-						foreach (@rtrn) { print $_ }
-						print "$patterns[$pat] ";
-					}
-					
-					return ($pat,@rtrn);
-				}
-			}
-			$b_index = $bi;
-		}
-
-		fill_buffer();
-	}
-}
-
-#
-# ($bt_num,$bt_name,$bt_state,$bt_locked) = parse_status $outlet,@data;
-#
-# This parses the data @data and searches for an outlet named $outlet.
-# The data will be in the form:
-# 
-#   Average Power:    0 Watts        Apparent Power:   17 VA
-# 
-#   True RMS Voltage: 120.0 Volts
-# 
-#   True RMS Current:   0.1 Amps     Maximum Detected:   0.2 Amps     
-# 
-#   Internal Temperature:  19.5 C
-# 
-#   Outlet Circuit Breaker: Good
-# 
-#    1)...Outlet  1       : Off           2)...Outlet  2       : Off          
-#    3)...Outlet  3       : On            4)...Outlet  4       : On           
-#    5)...Outlet  5       : On            6)...Outlet  6       : On           
-#    7)...Outlet  7       : On            8)...Outlet  8       : On           
-#    9)...Outlet  9       : On           10)...Outlet 10       : On           
-#   11)...Outlet 11       : On           12)...Outlet 12       : On           
-#   13)...Outlet 13       : On           14)...Outlet 14       : On           
-#   15)...Outlet 15       : On           16)...Outlet 16       : On           
-#   17)...Outlet 17       : On           18)...Outlet 18       : On           
-#   19)...Outlet 19       : On           20)...Outlet 20       : On    Locked 
-#
-sub parse_status
-{
-	my $outlet = shift;
-	my @data = @_;
-
-	my $bt_num="";
-	my $bt_name="";
-	my $bt_state="";
-	my $bt_locked="";
-
-	# Verify that the Outlet name exists
-	foreach my $line (@data)
-	{
-		next unless $line =~ /^[ 12][0-9]\)\.\.\./;
-
-		my @entries = split /([ 12][0-9])\)\.\.\./,$line;
-	
-		foreach my $entry (@entries)
-		{
-			next if $entry eq "";
-			
-			if($entry =~ /^([ 12][0-9])$/)
-			{
-				$bt_num = $1;
-			}
-			elsif($entry =~ /^(.{15}) : (On|Off)(.*)/)
-			{
-	
-				$bt_name = $1;
-				$bt_state = $2;
-				$bt_locked = $3;
-	
-				$_ = $bt_name;
-				s/\s*$//;
-				$bt_name = $_;
-	
-				$_ = $bt_locked;
-				s/\s*$//;
-				$bt_locked = $_;
-	
-				last if ($bt_name eq $outlet);
-	
-				$bt_name = "";
-				next;
-			}
-			else
-			{
-				die "parse error: $entry";
-			}
-		}
-		last if ($bt_name ne "");
-	}
-	
-	if ($bt_name eq "")
-	{
-		$bt_num=undef;
-		$bt_name=undef;
-		$bt_state=undef;
-		$bt_locked=undef;
-	}
-
-	return ($bt_num,$bt_name,$bt_state,$bt_locked);
-}
-
-##########################################################################
-#
-# Main
-
-get_options;
-
-
-if (defined $port)
-{
-	$t = new Net::Telnet(Host=>$host, Port=>$port) or 
-		die "Unable to connect to $host:$port: ".($!?$!:$_)."\n";
-}
-else
-{
-	$t = new Net::Telnet(Host=>$host) or 
-		die "Unable to connect to $host: ".($!?$!:$_)."\n";
-}
-
-
-
-#> DEBUG $t->dump_log("LOG");
-
-$t->print("\n");
-
-my @patterns;
-$prompt_user="^Enter user name:";
-$prompt_pass="^Enter Password:";
-$prompt_cmd="^RPC-27>";
-$prompt_confirm_yn="^.*\\(Y/N\\)\\?";
-
-$patterns[0]=$prompt_user;
-$patterns[1]=$prompt_pass;
-$patterns[2]=$prompt_cmd;
-$patterns[3]=$prompt_confirm_yn;
-
-my $p_index;
-my @data;
-
-my $bt_num="";
-my $bt_name="";
-my $bt_state="";
-my $bt_locked="";
-my $exit=1;
-
-($p_index,@data) = get_match @patterns;
-
-#
-# Set errmode after first get_match.  This allows for more descriptive errors
-# when handling unexpected error conditions
-#
-$t->errmode(\&rpc_error);
-
-# At this point, the username is unknown.  We'll just
-# pass in an empty passwd so that we can get back to the 
-# login prompt.  
-#
-# FIXME
-# If this is the third login failure for this switch, an
-# additional newline will need to be made sent.  This script
-# does not handle that case at this time.  This will cause
-# a timeout on read and cause this to fail.  Rerunning the
-# script ought to work though.
-if ($patterns[$p_index] eq $prompt_pass)
-{
-	$t->print("\n");
-	($p_index,@data) = get_match @patterns;
-}
-
-# Enter user name:
-#
-# Depending how the RPC is configured, a user name may not be required.
-# We will only deal with usernames if prompted.  
-#
-# If there is no user/passwd given as a parameter, but the switch
-# expects one, rather than just fail, we will first try to
-# get the switch in a known state 
-my $warn_user="yes";
-my $warn_passwd="yes";
-
-$error_message = "Invalid user/password";
-
-for (my $retrys=0; $patterns[$p_index] eq $prompt_user ; $retrys++)
-{
-	$warn_passwd = "yes";
-	if(defined $user)
-	{
-		$t->print("$user\n");
-		$warn_user = "no";
-	}
-	else
-	{
-		$t->print("\n");
-
-	}
-	($p_index,@data) = get_match @patterns;
-
-	# Enter Password:
-	#
-	# Users don't have to have passwords either.  We will only check
-	# that the user specified a password if we were prompted by the
-	# RPC.
-	if ($patterns[$p_index] eq $prompt_pass)
-	{
-		if(defined $passwd)
-		{
-			$t->print("$passwd\n");
-			$warn_passwd = "no";
-		}
-		else
-		{
-			$t->print("\n");
-		}
-
-		($p_index,@data) = get_match @patterns;
-	}
-
-
-	#
-	# If a valid user name is given, but not a valid password, we
-	# will loop forever unless we limit the number of retries
-	#
-	# set the user to "" so we stop entering a valid username and
-	# force the login proccess to fail
-	#
-	if ($retrys>2)
-	{
-		$user = "";
-	}
-	elsif ($retrys>10)
-	{
-		die "maximum retry count exceeded\n";
-	}
-}
-
-#
-# reset errmode to die()
-#
-$t->errmode("die");
-
-# all through with the login/passwd.  If we see any other prompt it is an 
-# error.
-if ($patterns[$p_index] ne $prompt_cmd)
-{
-	$t->print("\n");
-	die "bad state: '$patterns[$p_index]'";
-}
-
-if (defined $user && ($warn_user eq "yes"))
-{
-	warn "warning: user parameter ignored\n";
-}
-
-if (defined $passwd && ($warn_passwd eq "yes"))
-{
-	warn "warning: passwd parameter ignored\n";
-}
-
-
-
-
-# We are now logged in, no need for these patterns.  We'll strip these
-# so that we don't have to keep searching for patterns that shouldn't
-# appear.
-shift @patterns;
-shift @patterns;
-
-# Get the current status of a particular outlet.  Explicitly pass
-# the status command in case the RPC is not configured to report the
-# status on each command completion.
-$t->print("status\n");
-($p_index,@data) = get_match @patterns;
-($bt_num,$bt_name,$bt_state,$bt_locked) = parse_status $outlet,@data;
-
-if (!defined $bt_name )
-{
-	# We have problems if there is not outlet named $outlet
-	print "Outlet \'$outlet\' not found\n";
-	$exit=1;
-}
-elsif ($action =~ /status/i)
-{
-	print "Outlet '$bt_name' is $bt_state and is ".
-		(($bt_locked eq "")?"not ":"")."Locked\n";
-	$exit=0;
-}
-elsif ($bt_locked ne "")
-{
-	# Report an error if an outlet is locked since we can't actually 
-	# issue commands on a Locked outlet.  This will prevent false
-	# successes.
-	print "Outlet '$bt_name' is Locked\n";
-	$exit=1;
-}
-elsif (($action =~ /on/i && $bt_state eq "On") ||
-	($action =~ /off/i && $bt_state eq "Off") )
-{
-	# No need to issue the on/off command since we are already in 
-	# the desired state
-	print "Outlet '$bt_name' is already $bt_state\n";
-	$exit=0;
-}
-elsif ($action =~ /o(n|ff)/i)
-{
-	# On/Off command
-	$t->print("$action $bt_num\n");
-	($p_index,@data) = get_match @patterns;
-	
-	# Confirmation prompting maybe enabled in the switch.  If it is,
-	# we enter 'Y' for yes.
-	if ($patterns[$p_index] eq $prompt_confirm_yn)
-	{
-		$t->print("y\n");
-		($p_index,@data) = get_match @patterns;
-	}
-
-	$t->print("status\n");
-	($p_index,@data) = get_match @patterns;
-
-	($bt_num,$bt_name,$bt_state,$bt_locked) = parse_status $outlet,@data;
-	
-	if ($bt_state =~ /$action/i)
-	{
-		print "success: outlet='$outlet' action='$action'\n";
-		$exit=0;
-	}
-	else
-	{	
-		print "fail: outlet='$outlet' action='$action'\n";
-		$exit=1;
-	}
-}
-elsif ($action =~ /reboot/i)
-{
-	# Reboot command
-	$t->print("$action $bt_num\n");
-	($p_index,@data) = get_match @patterns;
-	
-	# Confirmation prompting maybe enabled in the switch.  If it is,
-	# we enter 'Y' for yes.
-	if ($patterns[$p_index] eq $prompt_confirm_yn)
-	{
-		$t->print("y\n");
-		($p_index,@data) = get_match @patterns;
-	}
-
-	# The reboot command is annoying.  It reports that the outlet will
- 	# reboot in 9 seconds.  Then it has a countdown timer.  We first
-	# look for the "Rebooting... 9" message, then we parse the remaining
-	# output to verify that it reaches 0 without skipping anything.
-	my $pass=0;
-	foreach (@data)
-	{
-		chomp;
-		my $line = $_;
-
-		# There is a countdown timer that prints a number, then sleeps a 
-		# second, then prints a backspace and then another number
-		#
-		# /^Rebooting\.\.\. 9\b8\b7\b6\b5\b4\b3\b2\b1\b0\b$/
-		if($line =~/^Rebooting\.\.\..*0[\b]$/)
-		{
-			$pass=1;
-			last;
-		}
-	}
-
-	if ($pass)
-	{
-		print "success: outlet='$outlet' action='$action'\n";
-		$exit=0;
-	}
-	else
-	{
-		print "fail: outlet='$outlet' action='$action'\n";
-		$exit=1;
-	}
-}
-else
-{
-	die "bad state";
-}
-
-# Clean up.  If we don't tell it to logout, then anybody else can log onto 
-# the serial port and have access to the switch without authentication (when 
-# enabled)
-$t->print("logout\n");
-$t->close;
-exit $exit;
diff --git a/fence/agents/bladecenter/Makefile b/fence/agents/bladecenter/Makefile
deleted file mode 100644
index a123a15..0000000
--- a/fence/agents/bladecenter/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-include ../../../make/defines.mk
-
-TARGET= fence_bladecenter
-
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/bladecenter/fence_bladecenter.py b/fence/agents/bladecenter/fence_bladecenter.py
deleted file mode 100644
index 3d68717..0000000
--- a/fence/agents/bladecenter/fence_bladecenter.py
+++ /dev/null
@@ -1,113 +0,0 @@
-#!/usr/bin/python
-
-#####
-##
-## The Following Agent Has Been Tested On:
-##
-##  Model                 Firmware
-## +--------------------+---------------------------+
-## (1) Main application	  BRET85K, rev 16  
-##     Boot ROM           BRBR67D, rev 16
-##     Remote Control     BRRG67D, rev 16
-##
-#####
-
-import sys, re, pexpect
-sys.path.append("@FENCEAGENTSLIBDIR@")
-from fencing import *
-
-#BEGIN_VERSION_GENERATION
-RELEASE_VERSION="New Bladecenter Agent - test release on steroids"
-REDHAT_COPYRIGHT=""
-BUILD_DATE="March, 2008"
-#END_VERSION_GENERATION
-
-def get_power_status(conn, options):
-	try:
-		node_cmd = "system:blade\[" + options["-n"] + "\]>"
-
-		conn.send("env -T system:blade[" + options["-n"] + "]\r\n")
-		conn.log_expect(options, node_cmd, SHELL_TIMEOUT)
-		conn.send("power -state\r\n")
-		conn.log_expect(options, node_cmd, SHELL_TIMEOUT)
-		status = conn.before.splitlines()[-1]
-		conn.send("env -T system\r\n")
-		conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
-	except pexpect.EOF:
-		fail(EC_CONNECTION_LOST)
-	except pexpect.TIMEOUT:
-		fail(EC_TIMED_OUT)
-
-	return status.lower().strip()
-
-def set_power_status(conn, options):
-	action = {
-		'on' : "powerup",
-		'off': "powerdown"
-	}[options["-o"]]
-
-	try:
-		node_cmd = "system:blade\[" + options["-n"] + "\]>"
-
-		conn.send("env -T system:blade[" + options["-n"] + "]\r\n")
-		conn.log_expect(options, node_cmd, SHELL_TIMEOUT)
-		conn.send("power -"+options["-o"]+"\r\n")
-		conn.log_expect(options, node_cmd, SHELL_TIMEOUT)
-		conn.send("env -T system\r\n")
-		conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
-	except pexpect.EOF:
-		fail(EC_CONNECTION_LOST)
-	except pexpect.TIMEOUT:
-		fail(EC_TIMED_OUT)
-
-def get_blades_list(conn, options):
-	outlets = { }
-	try:
-		node_cmd = "system>"
-
-		conn.send("env -T system\r\n")
-		conn.log_expect(options, node_cmd, SHELL_TIMEOUT)
-		conn.send("list -l 2\r\n")
-		conn.log_expect(options, node_cmd, SHELL_TIMEOUT)
-
-		lines = conn.before.split("\r\n")
-		filter_re = re.compile("^\s*blade\[(\d+)\]\s+(.*?)\s*$")
-		for x in lines:
-			res = filter_re.search(x)
-			if res != None:
-				outlets[res.group(1)] = (res.group(2), "")
-
-	except pexpect.EOF:
-		fail(EC_CONNECTION_LOST)
-	except pexpect.TIMEOUT:
-		fail(EC_TIMED_OUT)
-
-	return outlets
-
-def main():
-	device_opt = [  "help", "version", "agent", "quiet", "verbose", "debug",
-			"action", "ipaddr", "login", "passwd", "passwd_script",
-			"cmd_prompt", "secure", "port", "identity_file" ]
-
-	options = check_input(device_opt, process_input(device_opt))
-
-	## 
-	## Fence agent specific defaults
-	#####
-	if 0 == options.has_key("-c"):
-		options["-c"] = "system>"
-
-	##
-	## Operate the fencing device
-	######
-	conn = fence_login(options)
-	fence_action(conn, options, set_power_status, get_power_status, get_blades_list)
-
-	##
-	## Logout from system
-	######
-	conn.send("exit\r\n")
-	conn.close()
-
-if __name__ == "__main__":
-	main()
diff --git a/fence/agents/brocade/Makefile b/fence/agents/brocade/Makefile
deleted file mode 100644
index 74e96cc..0000000
--- a/fence/agents/brocade/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-TARGET= fence_brocade
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/brocade/fence_brocade.pl b/fence/agents/brocade/fence_brocade.pl
deleted file mode 100644
index 30a6250..0000000
--- a/fence/agents/brocade/fence_brocade.pl
+++ /dev/null
@@ -1,246 +0,0 @@
-#!/usr/bin/perl
-
-use Getopt::Std;
-use Net::Telnet ();
-
-# Get the program name from $0 and strip directory names
-$_=$0;
-s/.*\///;
-my $pname = $_;
-
-$opt_o = 'disable';        # Default fence action
-
-# WARNING!! Do not add code bewteen "#BEGIN_VERSION_GENERATION" and 
-# "#END_VERSION_GENERATION"  It is generated by the Makefile
-
-#BEGIN_VERSION_GENERATION
-$RELEASE_VERSION="";
-$REDHAT_COPYRIGHT="";
-$BUILD_DATE="";
-#END_VERSION_GENERATION
-
-
-sub usage
-{
-    print "Usage:\n";
-    print "\n";
-    print "$pname [options]\n";
-    print "\n";
-    print "Options:\n";
-    print "  -a <ip>          IP address or hostname of switch\n";
-    print "  -h               usage\n";
-    print "  -l <name>        Login name\n";
-    print "  -n <num>         Port number to operate on\n";
-    print "  -o <string>      Action:  disable (default) or enable\n";
-    print "  -p <string>      Password for login\n";
-    print "  -S <path>        Script to run to retrieve password\n";
-    print "  -q               quiet mode\n";
-    print "  -V               version\n";
-
-    exit 0;
-}
-
-sub fail
-{
-  ($msg) = @_;
-  print $msg."\n" unless defined $opt_q;
-  $t->close if defined $t;
-  exit 1;
-}
-
-sub fail_usage
-{
-  ($msg)=@_;
-  print STDERR $msg."\n" if $msg;
-  print STDERR "Please use '-h' for usage.\n";
-  exit 1;
-}
-
-sub version
-{
-  print "$pname $RELEASE_VERSION $BUILD_DATE\n";
-  print "$REDHAT_COPYRIGHT\n" if ( $REDHAT_COPYRIGHT );
-
-  exit 0;
-}
-
-
-if (@ARGV > 0) {
-   getopts("a:hl:n:o:p:S:qV") || fail_usage ;
-
-   usage if defined $opt_h;
-   version if defined $opt_V;
-
-   fail_usage "Unknown parameter." if (@ARGV > 0);
-
-   if (defined $opt_S) {
-     $pwd_script_out = `$opt_S`;
-     chomp($pwd_script_out);
-     if ($pwd_script_out) {
-       $opt_p = $pwd_script_out;
-     }
-   }
-
-   fail_usage "No '-a' flag specified." unless defined $opt_a;
-   fail_usage "No '-n' flag specified." unless defined $opt_n;
-   fail_usage "No '-l' flag specified." unless defined $opt_l;
-   fail_usage "No '-p' or '-S' flag specified." unless defined $opt_p;
-   fail_usage "Unrecognised action '$opt_o' for '-o' flag"
-      unless $opt_o =~ /^(disable|enable)$/i;
-
-} else {
-   get_options_stdin();
-
-   fail "failed: no IP address" unless defined $opt_a;
-   fail "failed: no plug number" unless defined $opt_n;
-   fail "failed: no login name" unless defined $opt_l;
-
-   if (defined $opt_S) {
-     $pwd_script_out = `$opt_S`;
-     chomp($pwd_script_out);
-     if ($pwd_script_out) {
-       $opt_p = $pwd_script_out;
-     }
-   }
-
-   fail "failed: no password" unless defined $opt_p;
-   fail "failed: unrecognised action: $opt_o"
-      unless $opt_o =~ /^(disable|enable)$/i;
-}
-
-if ( $opt_o =~ /^(disable|enable)$/i )
-{
-  $opt_o = "port".$1;
-}
-
-
-#
-# Set up and log in
-#
-
-$t = new Net::Telnet;
-
-$t->open($opt_a);
-
-$t->waitfor('/login:/');
-
-$t->print($opt_l);
-
-$t->waitfor('/assword:/');
-
-$t->print($opt_p);
-
-$t->waitfor('/\>/');
-
-
-
-#
-# Do the command
-#
-
-$cmd = "$opt_o $opt_n";
-$t->print($cmd);
-
-
-#
-# Assume here that the word "error" will appear after errors (bad assumption! see next check)
-#
-
-($text, $match) = $t->waitfor('/\>/');
-if ($text =~ /error/)
-{
-  fail "failed: error from switch\n";
-}
-
-
-#
-# Do a portshow on the port and look for the DISABLED string to verify success
-#
-
-$t->print("portshow $opt_n");
-($text, $match) = $t->waitfor('/\>/');
-
-if ( $opt_o eq "portdisable" && !($text =~ /DISABLED/) )
-{
-  fail "failed: portshow $opt_n does not show DISABLED\n";
-}
-elsif ( $opt_o eq "portenable" && ($text =~ /DISABLED/) )
-{
-  fail "failed: portshow $opt_n shows DISABLED\n";
-}
-
-
-print "success: $opt_o $opt_n\n" unless defined $opt_q;
-exit 0;
-
-sub get_options_stdin
-{
-    my $opt;
-    my $line = 0;
-    while( defined($in = <>) )
-    {
-        $_ = $in;
-        chomp;
-
-	# strip leading and trailing whitespace
-        s/^\s*//;
-        s/\s*$//;
-
-	# skip comments
-        next if /^#/;
-
-        $line+=1;
-        $opt=$_;
-        next unless $opt;
-
-        ($name,$val)=split /\s*=\s*/, $opt;
-
-        if ( $name eq "" )
-        {  
-           print STDERR "parse error: illegal name in option $line\n";
-           exit 2;
-	}
-	
-        # DO NOTHING -- this field is used by fenced
-	elsif ($name eq "agent" ) { } 
-
-	# FIXME -- depricated.  use "port" instead.
-        elsif ($name eq "fm" ) 
-	{
-            (my $dummy,$opt_n) = split /\s+/,$val;
-	    print STDERR "Depricated \"fm\" entry detected.  refer to man page.\n";
-	}
-
-        elsif ($name eq "ipaddr" ) 
-	{
-            $opt_a = $val;
-        } 
-	elsif ($name eq "login" ) 
-	{
-            $opt_l = $val;
-        } 
-
-	# FIXME -- depreicated residue of old fencing system
-	elsif ($name eq "name" ) { } 
-
-        elsif ($name eq "option" )
-        {
-            $opt_o = $val;
-        }
-	elsif ($name eq "passwd" ) 
-	{
-            $opt_p = $val;
-        } 
-	elsif ($name eq "passwd_script") {
-		$opt_S = $val;
-	}
-	elsif ($name eq "port" ) 
-	{
-            $opt_n = $val;
-        } 
-	# elsif ($name eq "test" ) 
-	# {
-        #    $opt_T = $val;
-        # } 
-    }
-}
diff --git a/fence/agents/bullpap/Makefile b/fence/agents/bullpap/Makefile
deleted file mode 100644
index ac2754f..0000000
--- a/fence/agents/bullpap/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-TARGET= fence_bullpap
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/bullpap/fence_bullpap.pl b/fence/agents/bullpap/fence_bullpap.pl
deleted file mode 100644
index 1013326..0000000
--- a/fence/agents/bullpap/fence_bullpap.pl
+++ /dev/null
@@ -1,357 +0,0 @@
-#!/usr/bin/perl
-
-use Getopt::Std;
-use POSIX;
-
-# Get the program name from $0 and strip directory names
-$_=$0;
-s/.*\///;
-my $pname = $_;
-
-$action = "reboot"; # Default fence action
-my $bulldir = "/usr/local/bull/NSMasterHW/bin";
-
-stat($bulldir);
-die "NSMasterHW not installed correctly" if ! -d _;
-
-# WARNING!! Do not add code bewteen "#BEGIN_VERSION_GENERATION" and 
-# "#END_VERSION_GENERATION"  It is generated by the Makefile
-
-#BEGIN_VERSION_GENERATION
-$RELEASE_VERSION="";
-$REDHAT_COPYRIGHT="";
-$BUILD_DATE="";
-#END_VERSION_GENERATION
-
-
-sub usage
-{
-	print "Usage:\n";
-	print "\n";
-	print "$pname [options]\n";
-	print "\n";
-	print "Options:\n";
-	print "  -a <ip>          IP address or hostname of PAP console\n";
-	print "  -h               usage\n";
-	print "  -l <name>        Login name\n";
-	print "  -d <domain>      Domain to operate on\n";
-	print "  -o <string>      Action:  on, off, reboot (default) or status\n";
-	print "  -p <string>      Password for login\n";
-	print "  -S <path>        Script to run to retrieve password\n";
-	print "  -q               quiet mode\n";
-	print "  -V               version\n";
-	print "\n";
-	print "When run with no arguments, $pname takes arguments from ";
-	print "standard\ninput, one line per option.  They are as follows:\n";
-	print "\n";
-	print "  ipaddr=<ip>          Same as -a command line option\n";
-	print "  login=<name>         Same as -l command line option\n";
-	print "  domain=<domain>      Same as -d command line option\n";
-	print "  option=<string>      Same as -o command line option\n";
-	print "  passwd=<string>      Same as -p command line option\n";
-	print "  passwd_script=<path> Same as -S command line option\n\n";
-
-	exit 0;
-}
-
-sub fail
-{
-	($msg) = @_;
-	print $msg."\n" unless defined $quiet;
-	exit 1;
-}
-
-sub fail_usage
-{
-	($msg)=@_;
-	print STDERR $msg."\n" if $msg;
-	print STDERR "Please use '-h' for usage.\n";
-	exit 1;
-}
-
-sub version
-{
-	print "$pname $RELEASE_VERSION $BUILD_DATE\n";
-	print "$REDHAT_COPYRIGHT\n" if ( $REDHAT_COPYRIGHT );
-
-	exit 0;
-}
-
-sub get_options_stdin
-{
-	my $opt;
-	my $line = 0;
-	while( defined($in = <>) )
-	{
-		$_ = $in;
-		chomp;
-
-		# strip leading and trailing whitespace
-		s/^\s*//;
-		s/\s*$//;
-	
-		# skip comments
-		next if /^#/;
-
-		$line+=1;
-		$opt=$_;
-		next unless $opt;
-
-		($name,$val)=split /\s*=\s*/, $opt;
-
-		if ( $name eq "" )
-		{  
-			print STDERR "parse error: illegal name in option $line\n";
-			exit 2;
-		}
-	
-		# DO NOTHING -- this field is used by fenced
-		elsif ($name eq "agent" ) { } 
-
-		elsif ($name eq "ipaddr" ) 
-		{
-			$host = $val;
-		} 
-		elsif ($name eq "login" ) 
-		{
-			$login = $val;
-		} 
-		elsif ($name eq "option" )
-		{
-			$action = $val;
-		}
-		elsif ($name eq "passwd" ) 
-		{
-			$passwd = $val;
-		} 
-		elsif ($name eq "password" ) 
-		{
-			$passwd = $val;
-		} 
-		elsif ($name eq "passwd_script" ) {
-			$passwd_script = $val;
-		}
-		elsif ($name eq "domain" ) 
-		{
-			$domain = $val;
-		} 
-		elsif ($name eq "debuglog" ) 
-		{
-			$verbose = $val;
-		} 
-		else 
-		{
-			fail "parse error: unknown option \"$opt\"";
-		}
-	}
-}
-
-sub get_power_state
-{
-	my ($ip,$dom,$user,$pass,$junk) = @_;
-	fail "missing IP address in get_power_state()" unless defined $ip;
-	fail "missing domain to get_power_state()" unless defined $dom;
-	fail "illegal argument to get_power_state()" if defined $junk;
-
-	my $state="";
-	my $cmd = $bulldir . "/pampower.pl";
-	
-	$cmd = $cmd . " -a status";
-	$cmd = $cmd . " -M $ip -D $dom";
-	if (defined $user) {
-		$cmd = $cmd . "	-u $user";
-	}
-	if (defined $pass) {
-		$cmd = $cmd . " -p $pass";
-	}
-
-	$state=system($cmd);
-	WIFEXITED($state) || die "child killed abnormally";
-
-	$state=WEXITSTATUS($state);
-	if ($state == 0) {
-		$state = "ON";
-	} elsif ($state == 1) {
-		$state = "OFF";
-	} else {
-		$state = "$state TRANSITION";
-	}
-
-	$_=$state;
-}
-
-sub set_power_state
-{
-	my ($ip,$dom,$set,$user,$pass,$junk) = @_;
-	fail "missing action to set_power_state()" unless defined $set;
-	fail "missing IP address in set_power_state()" unless defined $ip;
-	fail "missing domain to set_power_state()" unless defined $dom;
-	fail "illegal argument to set_power_state()" if defined $junk;
-
-	my $state="";
-	my $cmd = $bulldir . "/pampower.pl";
-	
-	if ($set =~ /on/) {
-		$cmd = $cmd . " -a on";
-	} else {
-		$cmd = $cmd . " -a off_force";
-	}
-	
-	$cmd = $cmd . " -M $ip -D $dom";
-	if (defined $user) {
-		$cmd = $cmd . "	-u $user";
-	}
-	if (defined $pass) {
-		$cmd = $cmd . " -p $pass";
-	}
-
-	$state=system "$cmd";
-
-	$_=$state;
-}
-
-# MAIN
-
-if (@ARGV > 0) 
-{
-	getopts("a:hl:d:o:p:S:qv:V") || fail_usage ;
-
-	usage if defined $opt_h;
-	version if defined $opt_V;
-
-	$host     = $opt_a if defined $opt_a;
-	$login    = $opt_l if defined $opt_l;
-	$passwd   = $opt_p if defined $opt_p;
-	$action   = $opt_o if defined $opt_o;
-	$domain	  = $opt_d if defined $opt_d;
-	$verbose  = $opt_v if defined $opt_v;
-	$quiet    = $opt_q if defined $opt_q;
-
-	if (defined $opt_S) {
-		$pwd_script_out = `$opt_S`;
-		chomp($pwd_script_out);
-		if ($pwd_script_out) {
-			$passwd = $pwd_script_out;
-		}
-	}
-
-	fail_usage "Unknown parameter." if (@ARGV > 0);
-
-	fail_usage "No '-a' flag specified." unless defined $host;
-	fail_usage "No '-d' flag specified." unless defined $domain;
-	fail_usage "No '-l' flag specified." unless defined $login;
-	fail_usage "No '-p' or '-S' flag specified." unless defined $passwd;
-	fail_usage "Unrecognised action '$action' for '-o' flag"
-		unless $action =~ /^(on|off|reboot|status)$/i;
-} 
-else 
-{
-	get_options_stdin();
-
-	fail "failed: no IP address" unless defined $host;
-	fail "failed: no domain" unless defined $domain;
-	fail "failed: no login name" unless defined $login;
-	fail "failed: unrecognized action: $action"
-		unless $action =~ /^(on|off|reboot|status)$/i;
-
-	if (defined $passwd_script) {
-		$pwd_script_out = `$passwd_script`;
-		chomp($pwd_script_out);
-		if ($pwd_script_out) {
-			$passwd = $pwd_script_out;
-		}
-	}
-	fail "failed: no password" unless defined $passwd;
-}
-
-# convert $action to lower case 
-$_=$action;
-if    (/^on$/i)     { $action = "on"; }
-elsif (/^off$/i)    { $action = "off"; }
-elsif (/^reboot$/i) { $action = "reboot"; }
-elsif (/^status$/i) { $action = "status"; }
-
-#
-# If if pampower / pamreset don't exist, we're done.
-#
-# -M -- the maintenance port on the NovaScale Windows 2000 master server
-# -D -- the Domain to reboot
-# -u -- User name
-# -p -- Password
-#
-#/usr/local/bull/NSMasterHW/bin/pamreset.pl 
-#    -M 192.168.78.169 -D Domaine2-8CPU -u Administrator -p administrator
-#
-#/usr/local/bull/NSMasterHW/bin/pampower.pl -a off_force 
-#    -M 192.168.78.169 -D Domaine2-8CPU -u Administrator -p administrator
-#
-#/usr/local/bull/NSMasterHW/bin/pampower.pl -a on 
-#    -M 192.168.78.169 -D Domaine2-8CPU -u Administrator -p administrator
-#
-# Do the command
-#
-$success=0;
-$_ = $action;
-if (/(on|off)/)
-{
-	my $timeout = 120; # 120 = max of (60, 120).  Max timeout for "on"
-			   # on 32-way bull machines
-
-	set_power_state $host,$domain,$action,$login,$passwd;
-	do {
-		sleep 5;
-		$state=get_power_state $host,$domain,$login,$passwd;
-		$timeout -= 5;
-	} while ($timeout > 0 && !($state =~ /^$action$/i));
-
-	$success = 1 if ($state=~/^$action$/i);
-}
-elsif (/reboot/)
-{
-	my $timeout = 60; # 60 seconds for "off" for 32-way bull machines
-
-	set_power_state $host,$domain,"off",$login,$passwd;
-	do {
-		sleep 5;
-		$state=get_power_state $host,$domain,$login,$passwd;
-		$timeout -= 5;
-	} while ($timeout > 0 && $state != 0);
-
-	if ($timeout <= 0) {
-		$success = 0;
-	} else  {
-		$timeout = 120; # 120 seconds for on, for 32-way bull machines
-		set_power_state $host,$domain,"on",$login,$passwd;
-		do {
-			sleep 5;
-			$state=get_power_state $host,$domain,$login,$passwd;
-			$timeout -= 5;
-		} while ($timeout > 0 && $state != 0);
-
-		$success = 1 if ($state == 0);
-	}
-}
-elsif (/status/)
-{
-	get_power_state $host,$domain,$login,$passwd;
-	$state=$_;
-	$success = 1 if defined $state;
-}
-else
-{
-	fail "fail: illegal action";
-}
-
-if ($success)
-{
-	print "success: domain $domain $action". ((defined $state) ? ": $state":"")
-		."\n" unless defined $quiet;
-	exit 0;
-}
-else
-{
-	fail "fail: domain $domain $action";	
-	exit 1
-}
-
-
diff --git a/fence/agents/cpint/Makefile b/fence/agents/cpint/Makefile
deleted file mode 100644
index 0591ea8..0000000
--- a/fence/agents/cpint/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-TARGET= fence_cpint
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/cpint/fence_cpint.pl b/fence/agents/cpint/fence_cpint.pl
deleted file mode 100644
index 77d6a54..0000000
--- a/fence/agents/cpint/fence_cpint.pl
+++ /dev/null
@@ -1,134 +0,0 @@
-#!/usr/bin/perl
-
-use Getopt::Std;
-
-# Get the program name from $0 and strip directory names
-$_=$0;
-s/.*\///;
-my $pname = $_;
-
-$comm_prog = "hcp";
-
-# WARNING!! Do not add code bewteen "#BEGIN_VERSION_GENERATION" and
-# "#END_VERSION_GENERATION"  It is generated by the Makefile
-
-#BEGIN_VERSION_GENERATION
-$RELEASE_VERSION="";
-$REDHAT_COPYRIGHT="";
-$BUILD_DATE="";
-#END_VERSION_GENERATION
-
-
-sub usage
-{
-    print "Usage:\n";  
-    print "\n";
-    print "$pname [options]\n";
-    print "\n";
-    print "Options:\n";
-    print "  -h               usage\n";
-    print "  -u <string>      userid of the virtual machine to fence\n";
-    print "  -q               quiet mode\n";
-    print "  -V               Version\n";
-
-    exit 0;
-}
-
-sub fail
-{
-  ($msg)=@_;
-  print "failed: " . $msg . "\n" unless defined $opt_q;
-  exit 1;
-}
-
-sub fail_usage
-{
-  ($msg)=@_q;
-  print stderr $msg."\n" if $msg;
-  print stderr "Please use '-h' for usage.\n";
-  exit 1;
-}
-
-sub version
-{
-  print "$pname $RELEASE_VERSION $BUILD_DATE\n";
-  print "$REDHAT_COPYRIGHT\n" if ( $REDHAT_COPYRIGHT );
-
-  exit 0;
-}
-
-sub get_options_stdin
-{
-    my $opt;
-    my $line = 0;
-    while( defined($in = <>) )
-    {
-        $_ = $in;
-	      chomp;
-
-        # strip leading and trailing whitespace
-        s/^\s*//;
-        s/\s*$//;
-
-        # skip comments
-        next if /^#/;
-
-	      $line+=1;
-        $opt=$_;
-        next unless $opt;
-
-	      ($name,$val)=split /\s*=\s*/, $opt;
-
-	      if ( $name eq "" )
-        {
-           print stderr "parse error: illegal name in option $line\n";
-           exit 2;
-        }
-
-	      # DO NOTHING -- this field is used by fenced or stomithd
-        elsif ($name eq "agent" ) { }
-
-	      # FIXME -- depricated.  use "userid" and "password" instead.
-        elsif ($name eq "fm" )
-        {
-            (my $dummy,$opt_u,$opt_p) = split /\s+/,$val;
-	          print STDERR "Depricated \"fm\" entry detected.  refer to man page.\n";
-        }
-
-        # FIXME -- depreicated residue of old fencing system
-      	elsif ($name eq "name" ) { }
-
-	      elsif ($name eq "userid" )
-        {
-            $opt_u = $val;
-        }
-
-	else
-        {
-           print stderr "parse error: unknown option \"$opt\"\n";
-           #> exit 2;
-        }
-    }
-}
-
-if (@ARGV > 0){
-    getopts("hqu:V") || fail_usage;
-    usage if defined $opt_h;
-    version if defined $opt_V;
-
-    fail_usage "Unkown parameter." if (@ARGV > 0);
-
-    fail_usage "No '-u' flag specified." unless defined $opt_u;
-} else {
-    get_options_stdin();
-
-    fail "no userid" unless defined $opt_u;
-}
-
-$ret_val = system("$comm_prog send cp $opt_u logoff > /dev/null 2>&1") >> 8;
-fail "$comm_prog failed ($ret_val)" unless ($ret_val == 0 || $ret_val == 45);
-$ret_val = system("$comm_prog send cp $opt_u > /dev/null 2>&1") >> 8;
-fail "$userid isn't logged off. $comm_prog return ($ret_val)" unless ($ret_val == 45);
-
-print "success: booted userid $opt_u\n" unless defined $opt_q;
-exit 0;
diff --git a/fence/agents/drac/Makefile b/fence/agents/drac/Makefile
deleted file mode 100644
index 9a752ae..0000000
--- a/fence/agents/drac/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-include ../../../make/defines.mk
-
-TARGET= fence_drac fence_drac5
-
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/drac/fence_drac.pl b/fence/agents/drac/fence_drac.pl
deleted file mode 100644
index f199814..0000000
--- a/fence/agents/drac/fence_drac.pl
+++ /dev/null
@@ -1,656 +0,0 @@
-#!/usr/bin/perl
-
-# The following agent has been tested on:
-#
-#  Model 		DRAC Version	Firmware
-#  -------------------	--------------	----------------------
-#  PowerEdge 750	DRAC III/XT	3.20 (Build 10.25)
-#  Dell Remote Access Controller - ERA and DRAC III/XT, v.3.20, A00
-#  
-#  PowerEdge 1855	DRAC/MC		1.1  (Build 03.03)
-#  PowerEdge 1855	DRAC/MC		1.2  (Build 03.03)
-#  PowerEdge 1855	DRAC/MC		1.3  (Build 06.12)
-#  PowerEdge 1850	DRAC 4/I	1.35 (Build 09.27)
-#  PowerEdge 1850	DRAC 4/I	1.40 (Build 08.24)
-#  PowerEdge 1950	DRAC 5		1.0  (Build 06.05.12)
-#
-
-use Getopt::Std;
-use Net::Telnet ();
-
-# Get the program name from $0 and strip directory names
-$_=$0;
-s/.*\///;
-my $pname = $_;
-
-my $telnet_timeout = 10;      # Seconds to wait for matching telent response
-my $power_timeout = 20;      # time to wait in seconds for power state changes
-$action = 'reboot';          # Default fence action.  
-
-my $logged_in = 0;
-my $quiet = 0;
-
-my $t = new Net::Telnet;
-
-my $DRAC_VERSION_UNKNOWN	= '__unknown__';
-my $DRAC_VERSION_III_XT		= 'DRAC III/XT';
-my $DRAC_VERSION_MC			= 'DRAC/MC';
-my $DRAC_VERSION_4I			= 'DRAC 4/I';
-my $DRAC_VERSION_4P			= 'DRAC 4/P';
-my $DRAC_VERSION_5			= 'DRAC 5';
-
-my $PWR_CMD_SUCCESS			= "/^OK/";
-my $PWR_CMD_SUCCESS_DRAC5	= "/^Server power operation successful$/";
-
-# WARNING!! Do not add code bewteen "#BEGIN_VERSION_GENERATION" and 
-# "#END_VERSION_GENERATION"  It is generated by the Makefile
-
-#BEGIN_VERSION_GENERATION
-$RELEASE_VERSION="";
-$REDHAT_COPYRIGHT="";
-$BUILD_DATE="";
-#END_VERSION_GENERATION
-
-sub usage 
-{
-	print "Usage:\n";
-	print "\n";
-	print "$pname [options]\n";
-	print "\n";
-	print "Options:\n";
-	print "  -a <ip>          IP address or hostname of DRAC\n";
-	print "  -c <cmd_prompt>  force DRAC command prompt\n";
-	print "  -d <dracversion> force DRAC version to use\n";
-	print "  -D <debugfile>   debugging output file\n";
-	print "  -h               usage\n";
-	print "  -l <name>        Login name\n";
-	print "  -m <modulename>  DRAC/MC module name\n";
-	print "  -o <string>      Action: reboot (default), off or on\n";
-	print "  -p <string>      Login password\n";
-	print "  -S <path>        Script to run to retrieve password\n";
-	print "  -q               quiet mode\n";
-	print "  -V               version\n";
-	print "\n";
-	print "CCS Options:\n";
-	print "  action = \"string\"      Action: reboot (default), off or on\n";
-	print "  debug  = \"debugfile\"   debugging output file\n";
-	print "  ipaddr = \"ip\"          IP address or hostname of DRAC\n";
-	print "  login  = \"name\"        Login name\n";
-	print "  passwd = \"string\"      Login password\n";
-	print "  passwd_script = \"path\" Script to run to retrieve password\n";
-
-	exit 0;
-}
-
-sub msg
-{
-	($msg)=@_;
-	print $msg."\n" unless $quiet;
-}
-
-sub fail
-{
-	($msg)=@_;
-	print $msg."\n" unless $quiet;
-
-	if (defined $t)
-	{
-		# make sure we don't get stuck in a loop due to errors
-		$t->errmode('return');  
-
-		logout() if $logged_in;
-		$t->close 
-	}
-	exit 1;
-}
-
-sub fail_usage
-{
-	($msg)=@_;
-	print STDERR $msg."\n" if $msg;
-	print STDERR "Please use '-h' for usage.\n";
-	exit 1;
-}
-
-sub version
-{
-	print "$pname $RELEASE_VERSION $BUILD_DATE\n";
-	print "$REDHAT_COPYRIGHT\n" if ( $REDHAT_COPYRIGHT );
-	exit 0;
-}
-
-
-sub login
-{
-	$t->open($address) or 
-		fail "failed: telnet open failed: ". $t->errmsg."\n";
-  
-	# Expect 'Login: ' 
-	($_) = $t->waitfor(Match => "/[Ll]ogin: /", Timeout=>15) or
-		fail "failed: telnet failed: ". $t->errmsg."\n" ;
-
-	# Determine DRAC version
-  if (/Dell Embedded Remote Access Controller \(ERA\)\nFirmware Version/m)
-  {
-    $drac_version = $DRAC_VERSION_III_XT;
-  } else {
-	if (/.*\((DRAC[^)]*)\)/m)
-	{
-		print "detected drac version '$1'\n" if $verbose;
-		$drac_version = $1 unless defined $drac_version;
-		
-		print "WARNING: detected drac version '$1' but using "
-			. "user defined version '$drac_version'\n"
-			if ($drac_version ne $1);
-	}
-	else
-	{
-		$drac_version = $DRAC_VERSION_UNKNOWN;
-	}
-  }
-
-	# Setup prompt
-	if ($drac_version =~ /$DRAC_VERSION_III_XT/)
-	{
-		$cmd_prompt = "/\\[$login\\]# /" 
-			unless defined $cmd_prompt;
-	}
-	elsif ($drac_version =~ /$DRAC_VERSION_MC/)
-	{
-		$cmd_prompt = "/DRAC\\/MC:/" 
-			unless defined $cmd_prompt;
-	}	
-	elsif ($drac_version =~ /$DRAC_VERSION_4I/)
-	{
-		$cmd_prompt = "/\\[$login\\]# /" 
-			unless defined $cmd_prompt;
-	}
-  elsif ($drac_version =~ /$DRAC_VERSION_4P/)
-  {
-        $cmd_prompt = "/\\[$login\\]# /"
-          unless defined $cmd_prompt;
-  } 
-	else
-	{
-		$drac_version = $DRAC_VERSION_UNKNOWN;
-	}
-
-	# Take a guess as to what the prompt might be if not already defined
-	$cmd_prompt="/(\\[$login\\]# |DRAC\\/MC:|\\\$ )/" unless defined $cmd_prompt;
-	
-
-	# Send login
-	$t->print($login);
-
-	# Expect 'Password: ' 
-	$t->waitfor("/Password: /") or 
-		fail "failed: timeout waiting for password";
-
-	# Send password
-	$t->print($passwd);  
-
-	# DRAC5 prints version controller version info
-	# only after you've logged in.
-	if ($drac_version eq $DRAC_VERSION_UNKNOWN) {
-		if ($t->waitfor(Match => "/.*\($DRAC_VERSION_5\)/m")) {
-			$drac_version = $DRAC_VERSION_5;
-			$cmd_prompt = "/\\\$ /";
-			$PWR_CMD_SUCCESS = $PWR_CMD_SUCCESS_DRAC5;
-		} else {
-			print "WARNING: unable to detect DRAC version '$_'\n";
-		}
-	}
-
-	$t->waitfor($cmd_prompt) or
-		fail "failed: invalid username or password";
-
-	if ($drac_version eq $DRAC_VERSION_UNKNOWN) {
-		print "WARNING: unsupported DRAC version '$drac_version'\n";
-	}
-
-	$logged_in = 1;
-}
-
-#
-# Set the power status of the node 
-#
-sub set_power_status
-{
-	my ($state,$dummy) = @_;
-	my $cmd,$svr_action;
-
-	if   ( $state =~ /^on$/)  { $svr_action = "powerup"   }
-	elsif( $state =~ /^off$/) { $svr_action = "powerdown" }
-
-	if ($drac_version eq $DRAC_VERSION_MC)
-	{
-		$cmd = "serveraction -m $modulename  -d 0 $svr_action";
-	}
-	elsif ($drac_version eq $DRAC_VERSION_5) {
-		$cmd = "racadm serveraction $svr_action";
-	} else
-	{
-		$cmd = "serveraction -d 0 $svr_action";
-	}
-
-	$t->print($cmd);
-
-	# Expect /$cmd_prompt/
-	($_) = $t->waitfor($cmd_prompt) or
-		fail "failed: unexpected serveraction response"; 
-
-	my @cmd_out = split /\n/;
-
-	# discard command sent to DRAC
-	$_ = shift @cmd_out;
-        s/\e\[(([0-9]+;)*[0-9]+)*[ABCDfHJKmsu]//g; #strip ansi chars
-        s/^.*\x0D//;
-
-	fail "failed: unkown dialog exception: '$_'" unless (/^$cmd$/);
-
-	# Additional lines of output probably means an error.  
-	# Aborting to be safe.  Note: additional user debugging will be 
-	# necessary,  run with -D and -v flags
-	my $err;
-	while (@cmd_out)
-	{
-		$_ = shift @cmd_out;
-                #firmware vers 1.2 on DRAC/MC sends ansi chars - evil
-                s/\e\[(([0-9]+;)*[0-9]+)*[ABCDfHJKmsu]//g;
-                s/^.*\x0D//;
-
-		next if (/^\s*$/); # skip empty lines
-		if (defined $err)
-		{
-			$err = $err."\n$_";
-		}
-		else
-		{
-			next if ($PWR_CMD_SUCCESS);
-			$err = $_;
-		}
-	}
-	fail "failed: unexpected response: '$err'" if defined $err;
-}
-
-
-#
-# get the power status of the node and return it in $status and $_
-#
-sub get_power_status
-{
-	my $status; 
-	my $modname = $modulename;
-	my $cmd;
-
-	if ($drac_version eq $DRAC_VERSION_5) {
-		$cmd = "racadm serveraction powerstatus";
-	} else {
-		$cmd = "getmodinfo";
-	}
-
-	$t->print($cmd);
-
-	($_) = $t->waitfor($cmd_prompt);
-
-	my $found_header = 0;
-	my $found_module = 0;
-
-	my @cmd_out = split /\n/;
-
-	# discard command sent to DRAC
-	$_ = shift @cmd_out;
-        #strip ansi control chars
-        s/\e\[(([0-9]+;)*[0-9]+)*[ABCDfHJKmsu]//g;
-        s/^.*\x0D//;
-
-	fail "failed: unkown dialog exception: '$_'" unless (/^$cmd$/);
-
-	if ($drac_version ne $DRAC_VERSION_5) {
-		#Expect:
-		#  #<group>     <module>    <presence>  <pwrState>  <health>  <svcTag>
-		#   1  ---->     chassis    Present         ON      Normal    CQXYV61
-		#
-		#  Note: DRAC/MC has many entries in the table whereas DRAC III has only
-		#  a single table entry.
-
-		while (1)
-		{
-			$_ = shift @cmd_out;
-			if (/^#<group>\s*<module>\s*<presence>\s*<pwrState>\s*<health>\s*<svcTag>/)
-			{
-				$found_header = 1;
-				last;
-			}
-		}
-		fail "failed: invalid 'getmodinfo' header: '$_'" unless $found_header;
-	}
-
-	foreach (@cmd_out)
-	{ 
-		s/^\s+//g; #strip leading space
-		s/\s+$//g; #strip training space
-
-		if ($drac_version eq $DRAC_VERSION_5) {
-			if(m/^Server power status: (\w+)/) {
-				$status = lc($1);
-			}
-		} else {
-			my ($group,$arrow,$module,$presence,$pwrstate,$health,
-				$svctag,$junk) = split /\s+/;
-
-			if ($drac_version eq  $DRAC_VERSION_III_XT || $drac_version eq $DRAC_VERSION_4I || $drac_version eq $DRAC_VERSION_4P)
-			{
-				fail "failed: extraneous output detected from 'getmodinfo'" if $found_module;
-				$found_module = 1;
-				$modname = $module;
-			}
-
-			if ($modname eq $module)
-			{
-				fail "failed: duplicate module names detected" if $status;
-				$found_module = 1;
-
-				fail "failed: module not reported present" unless ($presence =~ /Present/);
-				$status = $pwrstate;
-			}
-
-		}
-	}
-
-	if ($drac_version eq $DRAC_VERSION_MC)
-	{
-		fail "failed: module '$modulename' not detected" unless $found_module;
-	}
-
-	$_=$status;
-	if(/^(on|off)$/i)
-	{
-		# valid power states 
-	}
-	elsif ($status) 
-	{
-		fail "failed: unknown power state '$status'";
-	}
-	else
-	{
-		fail "failed: unable to determine power state";
-	}
-}
-
-
-# Wait upto $power_timeout seconds for node power state to change to 
-# $state before erroring out.
-#
-# return 1 on success
-# return 0 on failure
-#
-sub wait_power_status
-{
-	my ($state,$dummy) = @_;
-	my $status;
-
-	$state = lc $state;
-
-	for (my $i=0; $i<$power_timeout ; $i++)
-	{
-		get_power_status;
-		$status = $_;
-		my $check = lc $status;
-
-		if ($state eq $check ) { return 1 }
-		sleep 1;
-	}
-	$_ = "timed out waiting to power $state";
-	return 0;
-}
-
-#
-# logout of the telnet session
-#
-sub logout 
-{
-	$t->print("");
-	$t->print("exit");
-}
-
-#
-# error routine for Net::Telnet instance
-#
-sub telnet_error
-{
-	fail "failed: telnet returned: ".$t->errmsg."\n";
-}
-
-#
-# execute the action.  Valid actions are 'on' 'off' 'reboot' and 'status'.
-# TODO: add 'configure' that uses racadm rpm to enable telnet on the drac
-#
-sub do_action
-{
-	get_power_status;
-	my $status = $_;
-
-	if ($action =~ /^on$/i)
-	{
-		if ($status =~ /^on$/i)
-		{
-			msg "success: already on";
-			return;
-		}
-			
-		set_power_status on;
-		fail "failed: $_" unless wait_power_status on;
-
-		msg "success: powered on";
-	}
-	elsif ($action =~ /^off$/i)
-	{
-		if ($status =~ /^off$/i)
-		{
-			msg "success: already off";
-			return;
-		}
-
-		set_power_status off;
-		fail "failed: $_" unless wait_power_status off;
-	
-		msg "success: powered off";
-	}
-	elsif ($action =~ /^reboot$/i)
-	{
-		if ( !($status =~ /^off$/i) )
-		{
-			set_power_status off;
-		}
-		fail "failed: $_" unless wait_power_status off;
-
-		set_power_status on;
-		fail "failed: $_" unless wait_power_status on;
-
-		msg "success: rebooted";
-	}
-	elsif ($action =~ /^status$/i)
-	{
-		msg "status: $status";
-		return;
-	}
-	else 
-	{
-		fail "failed: unrecognised action: '$action'";
-	}
-}
-
-#
-# Decipher STDIN parameters
-#
-sub get_options_stdin
-{
-	my $opt;
-	my $line = 0;
-	while( defined($in = <>) )
-	{
-		$_ = $in;
-		chomp;
-
-		# strip leading and trailing whitespace
-		s/^\s*//;
-		s/\s*$//;
-
-		# skip comments
-		next if /^#/;
-	
-		$line+=1;
-		$opt=$_;
-		next unless $opt;
-
-		($name,$val)=split /\s*=\s*/, $opt;
-
-		if ( $name eq "" )
-		{
-			print STDERR "parse error: illegal name in option $line\n";
-			exit 2;
-		} 
-		# DO NOTHING -- this field is used by fenced 
-		elsif ($name eq "agent" ) 
-		{
-		} 
-		elsif ($name eq "ipaddr" ) 
-		{
-			$address = $val;
-		} 
-		elsif ($name eq "login" ) 
-		{
-			$login = $val;
-		} 
-		elsif ($name eq "action" ) 
-		{
-			$action = $val;
-		} 
-		elsif ($name eq "passwd" ) 
-		{
-			$passwd = $val;
-		}
-		elsif ($name eq "passwd_script" )
-		{
-			$passwd_script = $val;
-		}
-		elsif ($name eq "debug" ) 
-		{
-			$debug = $val;
-		} 
-		elsif ($name eq "modulename" ) 
-		{
-			$modulename = $val;
-		} 
-		elsif ($name eq "drac_version" ) 
-		{
-			$drac_version = $val;
-		} 
-		elsif ($name eq "cmd_prompt" ) 
-		{
-			$cmd_prompt = $val;
-		} 
-		# Excess name/vals will fail
-		else 
-		{
-			fail "parse error: unknown option \"$opt\"";
-		}
-	}
-}
-
-
-### MAIN #######################################################
-
-#
-# Check parameters
-#
-if (@ARGV > 0) {
-	getopts("a:c:d:D:hl:m:o:p:S:qVv") || fail_usage ;
-	
-	usage if defined $opt_h;
-	version if defined $opt_V;
-	
-	$quiet = 1 if defined $opt_q;
-	$debug = $opt_D; 
-
-	fail_usage "Unknown parameter." if (@ARGV > 0);
-
-	fail_usage "No '-a' flag specified." unless defined $opt_a;
-	$address = $opt_a;
-
-	fail_usage "No '-l' flag specified." unless defined $opt_l;
-	$login = $opt_l;
-
-	$modulename = $opt_m if defined $opt_m;
-
-	if (defined $opt_S) {
-		$pwd_script_out = `$opt_S`;
-		chomp($pwd_script_out);
-		if ($pwd_script_out) {
-			$opt_p = $pwd_script_out;
-		}
-	}
-
-	fail_usage "No '-p' or '-S' flag specified." unless defined $opt_p;
-	$passwd = $opt_p;
-
-	$verbose = $opt_v if defined $opt_v;
-
-	$cmd_prompt = $opt_c if defined $opt_c;
-	$drac_version = $opt_d if defined $opt_d;
-
-	if ($opt_o)
-	{
-		fail_usage "Unrecognised action '$opt_o' for '-o' flag"
-		unless $opt_o =~ /^(Off|On|Reboot|status)$/i;
-		$action = $opt_o;
-	}
-
-} else {
-	get_options_stdin();
-
-	fail "failed: no IP address" unless defined $address;
-	fail "failed: no login name" unless defined $login;
-
-	if (defined $passwd_script) {
-		$pwd_script_out = `$passwd_script`;
-		chomp($pwd_script_out);
-		if ($pwd_script_out) {
-			$passwd = $pwd_script_out;
-		}
-	}
-
-	fail "failed: no password" unless defined $passwd;
-	fail "failed: unrecognised action: $action"
-		unless $action =~ /^(Off|On|Reboot|status)$/i;
-} 
-
-
-$t->timeout($telnet_timeout);
-$t->input_log($debug) if $debug;
-$t->errmode('return');  
-
-login;
-
-# Abort on failure beyond here
-$t->errmode(\&telnet_error);  
-
-if ($drac_version eq $DRAC_VERSION_III_XT)
-{
-	fail "failed: option 'modulename' not compatilble with DRAC version '$drac_version'" 
-		if defined $modulename;
-}
-elsif ($drac_version eq $DRAC_VERSION_MC)
-{
-	fail "failed: option 'modulename' required for DRAC version '$drac_version'"
-		unless  defined $modulename;
-}
-
-do_action;
-
-logout;
-
-exit 0;
-
-
diff --git a/fence/agents/drac/fence_drac5.py b/fence/agents/drac/fence_drac5.py
deleted file mode 100755
index 41bd1d0..0000000
--- a/fence/agents/drac/fence_drac5.py
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/usr/bin/python
-
-#####
-##
-## The Following Agent Has Been Tested On:
-##
-##  DRAC Version       Firmware
-## +-----------------+---------------------------+
-##  DRAC 5             1.0  (Build 06.05.12)
-##  DRAC 5             1.21 (Build 07.05.04)
-##
-## @note: drac_version, modulename were removed
-#####
-
-import sys, re, pexpect
-sys.path.append("@FENCEAGENTSLIBDIR@")
-from fencing import *
-
-#BEGIN_VERSION_GENERATION
-RELEASE_VERSION="New Drac5 Agent - test release on steroids"
-REDHAT_COPYRIGHT=""
-BUILD_DATE="March, 2008"
-#END_VERSION_GENERATION
-
-def get_power_status(conn, options):
-	try:
-		conn.sendline("racadm serveraction powerstatus")
-		conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
-	except pexpect.EOF:
-		fail(EC_CONNECTION_LOST)
-	except pexpect.TIMEOUT:
-		fail(EC_TIMED_OUT)
-				
-	status = re.compile("Server power status: (.*)", re.IGNORECASE).search(conn.before).group(1)
-	return status.lower().strip()
-
-def set_power_status(conn, options):
-	action = {
-		'on' : "powerup",
-		'off': "powerdown"
-	}[options["-o"]]
-
-	try:
-		conn.sendline("racadm serveraction " + action)
-		conn.log_expect(options, options["-c"], POWER_TIMEOUT)
-	except pexpect.EOF:
-		fail(EC_CONNECTION_LOST)
-	except pexpect.TIMEOUT:
-		fail(EC_TIMED_OUT)
-
-def main():
-	device_opt = [  "help", "version", "agent", "quiet", "verbose", "debug",
-			"action", "ipaddr", "login", "passwd", "passwd_script",
-			"cmd_prompt", "secure",
-			"drac_version", "module_name" ]
-
-	options = check_input(device_opt, process_input(device_opt))
-
-	## 
-	## Fence agent specific defaults
-	#####
-	if 0 == options.has_key("-c"):
-		options["-c"] = "\$"
-
-	##
-	## Operate the fencing device
-	######
-	conn = fence_login(options)
-	fence_action(conn, options, set_power_status, get_power_status, None)
-
-	##
-	## Logout from system
-	######
-	conn.sendline("exit")
-	conn.close()
-
-if __name__ == "__main__":
-	main()
diff --git a/fence/agents/drac/test_drac.sh b/fence/agents/drac/test_drac.sh
deleted file mode 100644
index 55ebc4d..0000000
--- a/fence/agents/drac/test_drac.sh
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/bin/bash
-
-verbose="-D /dev/stdout -v "
-passwd="calvin"
-login="root"
-
-drac="drac.localhost.localdomain"
-modulename=" -m Server-1 "
-
-
-fence_drac="./fence_drac.pl"
-i=0
-
-cmd()
-{
-	echo $*
-	out=$(echo $*; $*)
-	out_exit=$?
-
-	echo "$out" > out.log.$i
-	echo "Exit $out_exit" >> out.log.$i
-
-	if [ $out_exit -ne 0 ]
-	then
-		echo "ASSERTION FAILURE: command failed: see out.log.$i" >&2
-		exit 1
-	fi
-
-	: $((i++))
-}
-
-pause()
-{
-	echo "press ENTER to continue"
-	read
-}
-
-assert()
-{
-	get_status
-	if [ "$status" != "$1" ]
-	then
-		echo "ASSERTION FAILURE: power status is '$status' not '$1'" >&2
-		exit 1
-	fi
-}
-
-get_status()
-{
-	cmd $fence_drac -o status -a $drac -l $login -p $passwd $modulename $verbose
-	status=$(echo "$out" | awk '($1 == "status:") { print tolower($2)}')
-	echo "status -> $status"
-}
-
-get_status
-pause
-
-cmd $fence_drac -o off -a $drac -l $login -p $passwd $modulename $verbose 
-assert off
-
-cmd $fence_drac -o on -a $drac -l $login -p $passwd $modulename $verbose 
-assert on
-
-cmd $fence_drac -o off -a $drac -l $login -p $passwd $modulename $verbose 
-assert off
-
-cmd $fence_drac -o reboot -a $drac -l $login -p $passwd $modulename $verbose 
-assert on
-
-cmd $fence_drac -o on -a $drac -l $login -p $passwd $modulename $verbose 
-assert on
-
-cmd $fence_drac -o reboot -a $drac -l $login -p $passwd $modulename $verbose 
-assert on
-
-cmd $fence_drac -o off -a $drac -l $login -p $passwd $modulename $verbose 
-assert off
-
-cmd $fence_drac -o off -a $drac -l $login -p $passwd $modulename $verbose 
-assert off
-
-echo SUCCESS
-exit 0
diff --git a/fence/agents/egenera/Makefile b/fence/agents/egenera/Makefile
deleted file mode 100644
index 655cc0c..0000000
--- a/fence/agents/egenera/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-TARGET= fence_egenera
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/egenera/fence_egenera.pl b/fence/agents/egenera/fence_egenera.pl
deleted file mode 100644
index 67d1d83..0000000
--- a/fence/agents/egenera/fence_egenera.pl
+++ /dev/null
@@ -1,422 +0,0 @@
-#!/usr/bin/perl
-
-use Getopt::Std;
-use IPC::Open3;
-
-# WARNING!! Do not add code bewteen "#BEGIN_VERSION_GENERATION" and 
-# "#END_VERSION_GENERATION"  It is generated by the Makefile
-
-#BEGIN_VERSION_GENERATION
-$RELEASE_VERSION="";
-$REDHAT_COPYRIGHT="";
-$BUILD_DATE="";
-#END_VERSION_GENERATION
-
-# Get the program name from $0 and strip directory names
-$_=$0;
-$|=1;
-s/.*\///;
-my $pname = $_;
-
-$esh="/opt/panmgr/bin/esh";
-
-sub usage 
-{
-	print "Usage:\n";
-	print "\n";
-	print "$pname [options]\n";
-	print "\n";
-	print "Options:\n";
-	print "  -c <string>      cserver\n";
-	print "  -h               help\n";
-	print "  -l <string>      lpan\n";
-	print "  -o <string>      Action: reboot (default), off, on or status\n";
-	print "  -p <string>      pserver\n";
-	print "  -q               quiet mode\n";
-	print "  -V               version\n";
-	
-	exit 0;
-}
-
-sub fail
-{
-	($msg)=@_;
-	print $msg."\n" unless defined $opt_q;
-	$t->close if defined $t;
-	exit 1;
-}
-
-sub fail_usage
-{
-	($msg)=@_;
-	print STDERR $msg."\n" if $msg;
-	print STDERR "Please use '-h' for usage.\n";
-	exit 1;
-}
-
-
-sub version
-{
-	print "$pname $RELEASE_VERSION $BUILD_DATE\n";
-	print "$REDHAT_COPYRIGHT\n" if ( $REDHAT_COPYRIGHT );
-
-	exit 0;
-}
-
-if (@ARGV > 0) 
-{
-	getopts("c:hl:o:p:qV") || fail_usage ;
-
-	usage if defined $opt_h;
-	version if defined $opt_V;
-
-	fail_usage "Unkown parameter." if (@ARGV > 0);
-
-	$cserv  = $opt_c if defined $opt_c;
-	$lpan   = $opt_l if defined $opt_l;
-	$pserv  = $opt_p if defined $opt_p;
-	$action = $opt_o if defined $opt_o;
-} 
-else 
-{
-	get_options_stdin();
-} 
-
-$action = "reboot" unless defined $action;
-
-fail "failed: no cserver defined" unless defined $cserv;
-fail "failed: no lpan defined" unless defined $lpan;
-fail "failed: no pserver defined" unless defined $pserv;
-
-fail "failed: unrecognised action: $action"
-	unless $action =~ /^(off|on|reboot|status|pblade)$/i;
-
-sub get_options_stdin
-{
-	my $opt;
-	my $line = 0;
-	while( defined($in = <>) )
-	{
-		$_ = $in;
-		chomp;
-
-		# strip leading and trailing whitespace
-		s/^\s*//;
-		s/\s*$//;
-
-		# skip comments
-		next if /^#/;
-
-	        $line+=1;
-		$opt=$_;
-		next unless $opt;
-
-		($name,$val)=split /\s*=\s*/, $opt;
-
-		if ( $name eq "" )
-		{
-			print STDERR "parse error: illegal name in option $line\n";
-			exit 2;
-		} 
-
-		elsif ($name eq "agent" )
-		{
-			# DO NOTHING -- this field is used by fenced 
-		}
-
-		elsif ($name eq "cserver" ) 
-		{
-			$cserv = $val;
-		} 
-
-		elsif ($name eq "lpan" ) 
-		{
-			$lpan = $val;
-		} 
-
-		elsif ($name eq "pserver" ) 
-		{
-			$pserv = $val;
-		} 
-
-		elsif ($name eq "action" ) 
-		{
-			$action = $val;
-		} 
-
-		elsif ($name eq "esh" ) 
-		{
-			$esh = $val;
-		} 
-
-		# FIXME should we do more error checking?  
-		# Excess name/vals will be eaten for now
-		else 
-		{
-			fail "parse error: unknown option \"$opt\"";
-		}
-	}
-}
-
-# _pserver_query_field -- query the state of the pBlade or Status field
-# and return it's value in $_.  
-# Return 0 on success, or non-zero on error
-sub _pserver_query_field
-{
-	my ($field,$junk) = @_;
-
-	if ($field ne "pBlade" && $field ne "Status")
-	{
-		$_="Error _pserver_query_field: unknown field of type '$field'";
-		return 1;
-	}
-
-	my $val;
-
-	my $cmd = "ssh $cserv $esh pserver $lpan/$pserv";
-	my $pid = open3 (\*WTR, \*RDR,\*RDR, $cmd)
-		or die "error open3(): $!";
-
-	while(<RDR>)
-	{
-		chomp;
-		my $line = $_;
-		my @fields = split /\s+/,$line;
-
-		if ($fields[0] eq "Error:")
-		{
-			$val=$line;
-			print "Debug ERROR: $val\n";
-			last;
-		}
-		elsif ($fields[0] eq $pserv)
-		{
-			if ( $field eq "Status" ) 
-			{
-				$val=$fields[1];
-			}
-			elsif ($field eq "pBlade" )
-			{
-				# grrr... Status can be "Shutting down"
-				if ($fields[1] ne "Shutting")
-				{
-					$val=$fields[3];
-				}
-				else
-				{
-					$val=$fields[4];
-				}
-			}
-		}
-	}
-
-	close WTR;
-	close RDR;
-	
-	waitpid $pid,0;
-	my $rtrn = $?>>8;
-	$_=$val if defined $val;
-	return $rtrn;
-}
-
-# return the pBlade of an lpan/pserver in $_.  
-# Return 0 on success or non=zero on error
-sub pserver_pblade
-{
-	_pserver_query_field "pBlade";
-}
-
-# return the Status of an lpan/pserver in $_.  
-# Return 0 on success or non=zero on error
-sub pserver_status
-{
-	_pserver_query_field "Status";
-}
-
-# boot an lpan/pserver.  
-# Return 0  if the status is "Booted" or "Booting" or non-zero on failure.
-# Continue checking the value until the status is "Boot" or "Booting" or
-# until a timeout of 120 seconds has been reached.
-sub pserver_boot
-{
-	my $rtrn=1;
-
-	# It seems it can take a while for a pBlade to 
-	# boot sometimes.  We shall wait for 120 seconds
-	# before giving up on a node returning failure
-	for (my $trys=0; $trys<120; $trys++)
-	{
-		last if (pserver_status != 0);
-
-		my $status = $_;
-		if ( $status eq "Booted"  || $status eq "Booting")
-		{
-			$rtrn=0;
-			last;
-		}
-
-		if(pserver_pblade)
-		{
-			die "error getting pBlade info";
-		}
-
-		# Is there any harm in sending this command multiple times?
-		my $cmd = "ssh $cserv $esh pserver -b $lpan/$pserv";
-		my $pid = open3 (\*WTR, \*RDR,\*RDR, $cmd)
-			or die "error open3(): $!";
-
-		close WTR;
-		close RDR;
-
-		waitpid $pid,0;
-		$rtrn = $?>>8;
-
-		sleep 1;
-	}
-	return $rtrn;
-}
-
-# boot an lpan/pserver.  
-# Return 0  if the status is "Shutdown" or non-zero on failure.
-# Continue checking the value until the status is "Shutdown" or
-# until a timeout of 20 seconds has been reached.
-sub pserver_shutdown
-{
-	my $rtrn=1;
-        local *egen_log;
-	open(egen_log,">>@LOGDIR@/fence_egenera.log");
-  print egen_log "Attempting shutdown at ".`date`."\n";
-	for (my $trys=0; $trys<20; $trys++)
-	{
-		last if (pserver_status != 0);
-
-
-		my $status = $_;
-                print egen_log "shutdown: $trys    $status\n";
-		if (/^Shutdown/)
-		{
-			$rtrn=0;
-			last;
-		}
-		elsif (/^Shutting/)
-		{
-			# We are already in the process of shutting down.
-			# do I need to do anything here?  
-			# We'll just wait for now
-		}
-    elsif (/^Booting/)
-    {
-       # Server is already on the way back up. Do nothing
-       $rtrn=0;
-       last;
-    }
-		elsif (/^Booted\(KDB\)/ || /^Debugging/ )
-		{
-			print egen_log "shutdown: crash dump being performed. Waiting\n";
-			$rtrn=0;
-			last;
-		}
-		else
-		{
-			if (pserver_pblade)
-			{
-				die "error getting pBlade info: $_";
-			}
-
-			# is there any harm in sending this command multiple 
-			# times?
-			my $cmd = "ssh $cserv $esh blade -s $_";
-                        print egen_log "shutdown: $cmd  being called, before open3\n";
-			my $pid = open3 (\*WTR, \*RDR,\*RDR, $cmd)
-				or die "error open3(): $!";
-                        print egen_log "shutdown: after calling open3\n";
-                        @outlines = <RDR>;
-                        print egen_log "shutdown: Open3 result: ", @outlines, "\n";
-
-			close WTR;
-			close RDR;
-
-			waitpid $pid,0;
-			$rtrn = $?>>8;
-		}
-
-		sleep 1;
-	}
-        print egen_log "shutdown: Returning from pserver_shutdown with return code $rtrn\n";
-	return $rtrn;
-}
-
-
-$_=$action;
-if (/^status$/i)
-{
-	if (pserver_status==0)
-	{
-		print "$lpan/$pserv is $_\n" unless defined $opt_q;
-		exit 0;
-	}
-	else
-	{
-		fail "failed to get status of $lpan/$pserv: $_";
-	}
-}
-elsif (/^pblade$/i)
-{
-	if (pserver_pblade==0)
-	{
-		print "$lpan/$pserv is $_\n" unless defined $opt_q;
-		exit 0;
-	}
-	else
-	{
-		fail "failed to get pblade of $lpan/$pserv: $_";
-	}
-}
-elsif (/^off$/i)
-{
-	if (pserver_shutdown==0)
-	{
-		print "success: $lpan/$pserv has been shutdown\n" 
-			unless defined $opt_q;
-		exit 0;
-	}
-	else
-	{
-		fail "failed to shutdown $lpan/$pserv";
-	}
-}
-elsif (/^on$/i)
-{
-	if (pserver_boot==0)
-	{
-		print "success: $lpan/$pserv has been turned on\n" 
-			unless defined $opt_q;
-		exit 0;
-	}
-	else
-	{
-		fail "failed to turn on $lpan/$pserv";
-	}
-}
-elsif (/^reboot$/i)
-{
-	if (pserver_shutdown!=0)
-	{
-		fail "failed to shutdown $lpan/$pserv";
-	}
-
-	if (pserver_boot==0)
-	{
-		print "success: $lpan/$pserv has been rebooted\n" 
-			unless defined $opt_q;
-		exit 0;
-	}
-	else
-	{
-		fail "failed to turn on $lpan/$pserv";
-	}
-}
-else
-{
-	die "unknown action: $action";
-}
diff --git a/fence/agents/eps/Makefile b/fence/agents/eps/Makefile
deleted file mode 100644
index fc665bc..0000000
--- a/fence/agents/eps/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-include ../../../make/defines.mk
-
-TARGET= fence_eps
-
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/eps/fence_eps.py b/fence/agents/eps/fence_eps.py
deleted file mode 100644
index 921487b..0000000
--- a/fence/agents/eps/fence_eps.py
+++ /dev/null
@@ -1,112 +0,0 @@
-#!/usr/bin/python
-
-# The Following Agent Has Been Tested On:
-# ePowerSwitch 8M+ version 1.0.0.4
-
-import sys, re, time
-import httplib, base64, string,socket
-sys.path.append("@FENCEAGENTSLIBDIR@")
-from fencing import *
-
-#BEGIN_VERSION_GENERATION
-RELEASE_VERSION="ePowerSwitch 8M+ (eps)"
-REDHAT_COPYRIGHT=""
-BUILD_DATE=""
-#END_VERSION_GENERATION
-
-# Log actions and results from EPS device
-def eps_log(options,str):
-	if options["log"]>=LOG_MODE_VERBOSE:
-		options["debug_fh"].write(str)
-
-# Run command on EPS device.
-# @param options Device options
-# @param params HTTP GET parameters (without ?)
-def eps_run_command(options, params):
-	try:
-		# New http connection
-		conn = httplib.HTTPConnection(options["-a"])
-
-		request_str="/"+options["-c"]
-
-		if (params!=""):
-			request_str+="?"+params
-
-		eps_log(options,"GET "+request_str+"\n")
-		conn.putrequest('GET', request_str)
-
-		if (options.has_key("-l")):
-			if (not options.has_key("-p")):
-				options["-p"]="" # Default is empty password
-				
-			# String for Authorization header
-			auth_str = 'Basic ' + string.strip(base64.encodestring(options["-l"]+':'+options["-p"]))
-			eps_log(options,"Authorization:"+auth_str+"\n")
-			conn.putheader('Authorization',auth_str)
-
-		conn.endheaders()
-
-		response = conn.getresponse()
-
-		eps_log(options,"%d %s\n"%(response.status,response.reason))
-
-		#Response != OK -> couldn't login
-		if (response.status!=200):
-			fail(EC_LOGIN_DENIED)
-
-		result=response.read()
-		eps_log(options,result+"\n")
-		conn.close()
-
-	except socket.timeout:
-		fail(EC_TIMED_OUT)
-	except socket.error:
-		fail(EC_LOGIN_DENIED)
-
-	return result
-
-def get_power_status(conn, options):
-	ret_val=eps_run_command(options,"")
-
-	result={}
-	status=re.findall("p(\d{2})=(0|1)\s*\<br\>",ret_val.lower())
-	for out_num,out_stat in status:
-		result[out_num]=("",(out_stat=="1" and "on" or "off"))
-
-	if (not (options["-o"] in ['monitor','list'])):
-		if (not (options["-n"] in result)):
-			fail_usage("Failed: You have to enter existing physical plug!")
-		else:
-			return result[options["-n"]][1]
-	else:
-		return result
-
-def set_power_status(conn, options):
-	ret_val=eps_run_command(options,"P%s=%s"%(options["-n"],(options["-o"]=="on" and "1" or "0")))
-
-# Define new option
-def eps_define_new_opts():
-	all_opt["hidden_page"]={
-		"getopt":"c:",
-		"help":"-c <page>      Name of hidden page (default hidden.htm)",
-		"order": 1}
-
-# Starting point of fence agent
-def main():
-	device_opt = [  "help", "version", "agent", "quiet", "verbose", "debug",
-			"action", "ipaddr", "login", "passwd", "passwd_script",
-			"test", "port", "hidden_page", "no_login", "no_password",
-			"separator" ]
-
-	eps_define_new_opts()
-
-	options = check_input(device_opt,process_input(device_opt))
-
-	if (not options.has_key("-c")):
-		options["-c"]="hidden.htm"
-
-	#Run fence action. Conn is None, beacause we always need open new http connection
-	fence_action(None, options, set_power_status, get_power_status,get_power_status)
-
-if __name__ == "__main__":
-	main()
diff --git a/fence/agents/ibmblade/Makefile b/fence/agents/ibmblade/Makefile
deleted file mode 100644
index 522a24a..0000000
--- a/fence/agents/ibmblade/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-TARGET= fence_ibmblade
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/ibmblade/fence_ibmblade.pl b/fence/agents/ibmblade/fence_ibmblade.pl
deleted file mode 100644
index e2618a7..0000000
--- a/fence/agents/ibmblade/fence_ibmblade.pl
+++ /dev/null
@@ -1,264 +0,0 @@
-#!/usr/bin/perl
-
-use Getopt::Std;
-use Net::SNMP; 
-
-# Get the program name from $0 and strip directory names
-$_=$0;
-s/.*\///;
-my $pname = $_;
-
-my $sleep_time = 5; 
-my $snmp_timeout = 10;
-$opt_o = "reboot";
-$opt_u = 161;
-
-my $oid_powerState =  ".1.3.6.1.4.1.2.3.51.2.22.1.5.1.1.4";    # remoteControlBladePowerState
-my $oid_powerChange = ".1.3.6.1.4.1.2.3.51.2.22.1.6.1.1.7";    # powerOnOffBlade
-my $oid_resetPower =  ".1.3.6.1.4.1.2.3.51.2.22.1.6.1.1.8";    # restartBlade
-
-# WARNING!! Do not add code bewteen "#BEGIN_VERSION_GENERATION" and
-# "#END_VERSION_GENERATION"  It is generated by the Makefile
-
-#BEGIN_VERSION_GENERATION
-$RELEASE_VERSION="";
-$REDHAT_COPYRIGHT="";
-$BUILD_DATE="";
-#END_VERSION_GENERATION
-
-sub usage
-{
-    print "Usage:\n";
-    print "\n";
-    print "$pname [options]\n";
-    print "\n";
-    print "Options:\n";
-    print "  -a <ip>          IP address or hostname of BladeCenter\n";
-    print "  -h               usage\n";
-    print "  -c <community>   SNMP Community\n";
-    print "  -n <num>         Port number to disable\n";
-    print "  -o <string>      Action:  Reboot (default), On or Off\n";
-    print "  -u <udpport>     UDP port to use (default: 161)\n"; 
-    print "  -q               quiet mode\n";
-    print "  -t               test power state\n"; 
-    print "  -V               version\n";
-
-    exit 0;
-}
-
-sub fail_usage
-{
-  ($msg)=@_;
-  print STDERR $msg."\n" if $msg;
-  print STDERR "Please use '-h' for usage.\n";
-  exit 1;
-}
-
-sub fail
-{
-  ($msg) = @_;
-  print $msg."\n" unless defined $opt_q;
-  $t->close if defined $t;
-  exit 1;
-}
-
-sub version
-{
-  print "$pname $RELEASE_VERSION $BUILD_DATE\n";
-  print "$REDHAT_COPYRIGHT\n" if ( $REDHAT_COPYRIGHT );
-
-  exit 0;
-}
-
-sub get_options_stdin
-{
-    my $opt;
-    my $line = 0;
-    while( defined($in = <>) )
-    {
-        $_ = $in;
-        chomp;
-
-	# strip leading and trailing whitespace
-        s/^\s*//;
-        s/\s*$//;
-
-	# skip comments
-        next if /^#/;
-
-        $line+=1;
-        $opt=$_;
-        next unless $opt;
-
-        ($name,$val)=split /\s*=\s*/, $opt;
-
-        if ( $name eq "" )
-        {  
-           print STDERR "parse error: illegal name in option $line\n";
-           exit 2;
-	}
-	
-        # DO NOTHING -- this field is used by fenced
-	elsif ($name eq "agent" ) { } 
-
-        elsif ($name eq "ipaddr" ) 
-	{
-            $opt_a = $val;
-        } 
-	elsif ($name eq "community" ) 
-	{
-            $opt_c = $val;
-        } 
-
-        elsif ($name eq "option" )
-        {
-            $opt_o = $val;
-        }
-	elsif ($name eq "port" ) 
-	{
-            $opt_n = $val;
-        }
-	elsif ($name eq "udpport" )
-	{
-	    $opt_u = $val; 
-	}
-
-        # FIXME should we do more error checking?  
-        # Excess name/vals will be eaten for now
-	else 
-	{
-           fail "parse error: unknown option \"$opt\"";
-        }
-    }
-}
-
-# ---------------------------- MAIN --------------------------------
-
-if (@ARGV > 0) {
-   getopts("a:hc:n:o:qu:tV") || fail_usage ;
-
-   usage if defined $opt_h;
-   version if defined $opt_V;
-
-   fail_usage "Unknown parameter." if (@ARGV > 0);
-
-   fail_usage "No '-a' flag specified." unless defined $opt_a;
-   fail_usage "No '-n' flag specified." unless defined $opt_n;
-   fail_usage "No '-c' flag specified." unless defined $opt_c;
-   fail_usage "Unrecognised action '$opt_o' for '-o' flag"
-      unless $opt_o =~ /^(reboot|on|off)$/i;
-
-} else {
-   get_options_stdin();
-
-   fail "failed: no IP address" unless defined $opt_a;
-   fail "failed: no plug number" unless defined $opt_n;
-   fail "failed: no SNMP community" unless defined $opt_c;
-   fail "failed: unrecognised action: $opt_o"
-      unless $opt_o =~ /^(reboot|on|off)$/i;
-}
-
-my ($snmpsess, $error) = Net::SNMP->session ( 
-	-hostname   => $opt_a, 
-	-version    => "snmpv1", 
-	-port       => $opt_u, 
-	-community  => $opt_c,
-	-timeout    => $snmp_timeout); 
-
-if (!defined ($snmpsess)) { 
-	printf("$RELEASE_VERSION ERROR: %s.\n", $error);
-	exit 1; 
-};
-
-# first check in what state are we now
-my $oid = $oid_powerState . "." . $opt_n;
-my $oid_val = ""; 
-my $result = $snmpsess->get_request ( 
-	-varbindlist => [$oid]
-);
-if (!defined($result)) {
-	printf("$RELEASE_VERSION ERROR: %s.\n", $snmpsess->error);
-	$snmpsess->close;
-	exit 1;
-}
-
-if (defined ($opt_t)) { 
-	printf ("$RELEASE_VERSION STATE: Port %d on %s returned %d\n", $opt_n, $opt_a, $result->{$oid}); 
-	exit 1; 
-};
-
-if ($opt_o =~ /^(reboot|off)$/i) { 
-	if ($result->{$oid} == "0") { 
-		printf ("$RELEASE_VERSION WARNING: Port %d on %s already down.\n", $opt_n, $opt_a); 
-		$snmpsess->close; 
-		exit 0; 
-	}; 
-} else { 
-	if ($result->{$oid} == "1") { 
-		printf ("$RELEASE_VERSION WARNING: Port %d on %s already up.\n", $opt_n, $opt_a); 
-		$snmpsess->close; 
-		exit 0; 
-	};
-};
-
-# excellent, now change the state 
-if ($opt_o =~ /^reboot$/i) { 
-	# reboot
-	$oid = $oid_resetPower . "." . $opt_n;
-	$oid_val = "1"; 
-} elsif ($opt_o =~ /^on$/i) { 
-	# power on
-	$oid = $oid_powerChange . "." . $opt_n; 
-	$oid_val = "1"; 
-} else { 
-	# power down
-	$oid = $oid_powerChange . "." . $opt_n; 
-	$oid_val = "0"; 
-};
-
-$result = $snmpsess->set_request (
-	-varbindlist => [$oid, INTEGER, $oid_val]
-); 
-
-if (!defined ($result)) { 
-	# ignore this for now, seems like IBM BladeCenter has a broken SNMPd
-	# it almost always timeouts
-}; 
-
-# now, wait a bit and see if we have done it
-sleep($sleep_time); 
-
-$oid = $oid_powerState . "." . $opt_n;
-
-undef $result; 
-$result = $snmpsess->get_request ( 
-	-varbindlist => [$oid]
-);
-
-if (!defined($result)) {
-	# this is a real error
-	printf("$RELEASE_VERSION ERROR: %s.\n", $snmpsess->error);
-	$snmpsess->close;
-	exit 1;
-}; 
-
-if ($opt_o =~ /^(off)$/i) { 
-	if ($result->{$oid} == "1") { 
-		printf ("$RELEASE_VERSION ERROR: Port %d on %s still up.\n", $opt_n, $opt_a); 
-		$snmpsess->close; 
-		exit 1; 
-	}; 
-} else { 
-	if ($result->{$oid} == "0") { 
-		printf ("$RELEASE_VERSION ERROR: Port %d on %s still down.\n", $opt_n, $opt_a); 
-		$snmpsess->close; 
-		exit 1; 
-	};
-};
-
-# everything's a ok :) 
-$snmpsess->close; 
-
-printf ("$RELEASE_VERSION SUCCESS: Port %d on %s changed state to %s\n", $opt_n, $opt_a, $opt_o) unless defined $opt_q;
-exit 0; 
-
diff --git a/fence/agents/ifmib/Makefile b/fence/agents/ifmib/Makefile
deleted file mode 100644
index 32a5657..0000000
--- a/fence/agents/ifmib/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-include ../../../make/defines.mk
-
-TARGET= fence_ifmib
-
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/ifmib/README b/fence/agents/ifmib/README
deleted file mode 100644
index b6e7123..0000000
--- a/fence/agents/ifmib/README
+++ /dev/null
@@ -1,45 +0,0 @@
-Intro:
-------
-This is an SNMP-based fencing agent for RHCS.  It was designed with the use-case
-of disabling ethernet ports on an iSCSI SAN, but could be used to disable any
-port on any SNMP v2c device that implementes the IF-MIB.
-
-The script requires PySNMP version 2 to be installed and working on all nodes
-in the cluster.  There are no requirements for any MIBs to be setup --- all of
-the required OIDs are hard-coded into the script.  Since the IF-MIB is an IETF
-standard, these identifiers are very widely supported and will not change.
-
-
-Typical usage:
---------------
-To use this agen with the switch used on the iSCSI network, you'll require:
-   1) A managed switch running SNMP.
-   2) An SNMP community with write privileges.
-   3) Permission to send SNMP through any ACLs or firewalls from the nodes.
-   4) The ifIndex associated with the ports being used by the cluster nodes.
-
-Consider a three-node cluster composed of A, B, and C.  Each node has two
-network interfaces - one used for network and cluster communication, the second
-used for iSCSI traffic.  If A needs to be fenced, B and C will run this script
-to administratively disable the switchport for A's connection to the iSCSI
-storage.
-
-If you are using a single interface for cluster and iSCSI traffic, this will
-still work, but you will lose network connectivity to the fenced host.
-
-
-cluster.conf:
--------------
-There is no GUI support for this fence agent at this time.  To use it, you will
-need something like this cluster.conf
-
-<fencedevice agent="fence_ifmib" name="myswitch" comm="fencing" ipaddr="sw1"/>
-
-In a node's fencing methods, you'll include a line like this:
-
-<device name="myswitch" ifindex="43" option="off"/>
-
-This node will be fenced by disabling the port with ifIndex 43 on the host sw1.
-In SNMP speak, we set IF-MIB::ifAdminStatus.43 = down(2).
-
-
diff --git a/fence/agents/ifmib/fence_ifmib.py b/fence/agents/ifmib/fence_ifmib.py
deleted file mode 100644
index 48f1187..0000000
--- a/fence/agents/ifmib/fence_ifmib.py
+++ /dev/null
@@ -1,221 +0,0 @@
-#!/usr/bin/python
-# fence_ifmib.py: fabric fencing for RHCS based on setting a network interface
-# to admin down.  Intended to be used for iSCSI connections, can be used with
-# anything that supports the IF-MIB and SNMP v2c.
-#
-# Written by Ross Vandegrift <ross@kallisti.us>
-# Copyright (C) 2008 Ross Vandegrift
-#  This copyrighted material is made available to anyone wishing to use,
-#  modify, copy, or redistribute it subject to the terms and conditions
-#  of the GNU General Public License v.2.
-
-# this is a ugly hack to make the build system happy. The original
-# author and copyright are the one on the file header right above.
-#BEGIN_VERSION_GENERATION
-RELEASE_VERSION="New fence_ifmib"
-REDHAT_COPYRIGHT=""
-BUILD_DATE="March, 2008"
-#END_VERSION_GENERATION
-
-import os
-os.environ['PYSNMP_API_VERSION'] = 'v2'
-import sys, getopt, random, socket
-from pysnmp import role, v2c, asn1
-
-ifAdminStatus = '.1.3.6.1.2.1.2.2.1.7.'
-up = 1
-down = 2
-testing = 3
-
-def usage():
-    line = '\t%s\t%s'
-    print ''
-    print 'This script fences a node by sending a command via SNMP to set'
-    print 'ifAdminStatus to down.  It is designed to kill node access'
-    print 'to the shared storage.  It only supports SNMP v2c.'
-    print ''
-    print 'Usage: fence_ifmib [options]'
-    print line % ('-h', '\tPrint usage')
-    print line % ('-V', '\tRun verbosely')
-    print line % ('-c [private]', 'Write community string to use')
-    print line % ('-a [hostname]', 'IP/hostname of SNMP agent')
-    print line % ('-i [index]', 'ifIndex entry of the port ')
-    print line % ('-o [action]', 'One of down, up, or status')
-
-
-def vprint(v, s):
-    if v:
-        print s
-
-
-def parseargs():
-    try:
-        opt, arg = getopt.getopt (sys.argv[1:], 'hVc:v:a:i:o:')
-    except getopt.GetoptError, e:
-        print str (e)
-        usage ()
-        sys.exit (-1)
-
-    comm = ipaddr = ifindex = option = verbose = None
-
-    for o, a in opt:
-        if o == '-h':
-            usage ()
-            sys.exit (-1)
-        if o == '-V':
-            verbose = True
-        if o == '-c':
-            comm = a
-        if o == '-a':
-            ipaddr = a
-        if o == '-i':
-            try:
-                ifindex = int(a)
-            except:
-                sys.stderr.write ('fence_ifmib: ifIndex must be an integer\n')
-                usage ()
-                sys.exit (-1)
-        if o == '-o':
-            option = a
-            if option not in ('on', 'off', 'status'):
-                sys.stderr.write ('fence_ifmib: option must be one of on, off, or status\n')
-                usage ()
-                sys.exit (-1)
-
-    if comm == None or ipaddr == None or ifindex == None \
-            or option == None:
-        sts.stderr.write ('All args are madatory!\n')
-        usage ()
-        sys.exit (-1)
-
-    return (comm, ipaddr, ifindex, option, verbose)
-
-
-def parsestdin():
-    params = {}
-    for line in sys.stdin:
-        val = line.split('=')
-        if len (val) == 2:
-            params[val[0].strip ()] = val[1].strip ()
-
-    try:
-        comm = params['comm']
-    except:
-        sys.stdout.write ('fence_ifmib: Error reading community string\n')
-        sys.exit (1)
-
-    try:
-        ipaddr = params['ipaddr']
-    except:
-        sys.stdout.write ('fence_ifmib: Error reading destination IP/host\n')
-        sys.exit (1)
-
-    try:
-        ifindex = params['ifindex']
-    except:
-        sys.stdout.write ('fence_ifmib: Error reading ifindex\n')
-        sys.exit (1)
-
-    try:
-        option = params['option']
-    except:
-        option = 'off'
-
-    return (comm, ipaddr, ifindex, option)
-            
-
-def snmpget (host, comm, oid):
-    req = v2c.GETREQUEST ()
-    encoded_oids = map (asn1.OBJECTID().encode, [oid,])
-    req['community'] = comm
-    tr = role.manager ((host, 161))
-    rsp = v2c.RESPONSE ()
-    (rawrsp, src) = tr.send_and_receive (req.encode (encoded_oids=encoded_oids))
-    rsp.decode (rawrsp)
-    if rsp['error_status']:
-        raise IOError('SNMP error while reading')
-    oids = map (lambda x: x[0], map(asn1.OBJECTID ().decode, rsp['encoded_oids']))
-    vals = map (lambda x: x[0] (), map(asn1.decode, rsp['encoded_vals']))
-    return vals[0]
-
-
-def snmpset (host, comm, oid, type, value):
-    req = v2c.SETREQUEST (request_id=random.randint (1,2**16-1))
-    req['community'] = comm
-    tr = role.manager ((host, 161))
-    rsp = v2c.RESPONSE ()
-    encoded_oids = map (asn1.OBJECTID ().encode, [oid,])
-    encoded_vals = []
-    encoded_vals.append (eval ('asn1.' + type + '()').encode (value))
-    (rawrsp, src) = tr.send_and_receive (req.encode (encoded_oids=encoded_oids, encoded_vals=encoded_vals))
-    rsp.decode(rawrsp)
-    if rsp['error_status']:
-        raise IOError('SNMP error while setting')
-    oids = map (lambda x: x[0], map (asn1.OBJECTID().decode, rsp['encoded_oids']))
-    vals = map (lambda x: x[0] (), map (asn1.decode, rsp['encoded_vals']))
-    if vals[0] == value:
-        return vals[0]
-    else:
-        raise IOError('SNMP error while setting')
-
-
-def main():
-    if len (sys.argv) > 1:
-        (comm, host, index, option, verbose) = parseargs ()
-    else:
-        verbose = False
-        (comm, host, index, option) = parsestdin ()
-
-    try:
-        switch = socket.gethostbyname (host)
-    except socket.gaierror, err:
-        vprint (verbose, 'fence_ifmib: %s' % str (err[1]))
-        sys.exit(1)
-
-    if option == 'on':
-        value = up
-    elif option == 'off':
-        value = down
-    elif option == 'status':
-        value = None
-
-    if value:
-        # For option in (on, off) - write and verify
-        try:
-            r = snmpset (switch, comm, ifAdminStatus + str (index), 'INTEGER', value)
-        except:
-            sys.stderr.write ('fence_ifmib: Error during snmp write\n')
-            sys.exit (1)
-        
-        try:
-            s = int (snmpget (switch, comm, ifAdminStatus + str (index)))
-        except:
-            sys.stderr.write ('fence_ifmib: Error during fence verification\n')
-            sys.exit (1)
-
-        if s == value:
-            vprint (verbose, 'fence_ifmib: action %s sucessful' % option)
-            sys.exit (0)
-        else:
-            vprint (verbose, 'fence_ifmib: action %s failed' % option)
-            sys.exit (1)
-    else: # status
-        try: 
-            r = int (snmpget (switch, comm, ifAdminStatus + str (index)))
-        except:
-            sys.stderr.write ('fence_ifmib: Error during snmp read\n')
-            sys.exit (1)
-
-        if r == up:
-            vprint (verbose, 'fence_ifmib: Port is admin up')
-            sys.exit (0)
-        elif r == down:
-            vprint (verbose, 'fence_ifmib: Port is admin down')
-            sys.exit (2)
-        elif r == testing:
-            vprint (verbose, 'fence_ifmib: Port is admin testing')
-            sys.exit (2)
-
-
-if __name__ == '__main__':
-    main()
diff --git a/fence/agents/ilo/Makefile b/fence/agents/ilo/Makefile
deleted file mode 100644
index 66420ab..0000000
--- a/fence/agents/ilo/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-include ../../../make/defines.mk
-
-TARGET= fence_ilo
-
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/ilo/fence_ilo.py b/fence/agents/ilo/fence_ilo.py
deleted file mode 100755
index 0cf416e..0000000
--- a/fence/agents/ilo/fence_ilo.py
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/usr/bin/python
-
-#####
-##
-## The Following Agent Has Been Tested On:
-##
-##  iLO Version
-## +---------------------------------------------+
-##  iLO  / firmware 1.91 / RIBCL 2.22
-##  iLO2 / firmware 1.22 / RIBCL 2.22 
-##  iLO2 / firmware 1.50 / RIBCL 2.22
-#####
-
-import sys, re, pexpect, socket
-sys.path.append("@FENCEAGENTSLIBDIR@")
-from fencing import *
-from OpenSSL import SSL
-
-#BEGIN_VERSION_GENERATION
-RELEASE_VERSION="New ILO Agent - test release on steroids"
-REDHAT_COPYRIGHT=""
-BUILD_DATE="March, 2008"
-#END_VERSION_GENERATION
-
-def get_power_status(conn, options):
-	conn.send("<LOGIN USER_LOGIN = \"" + options["-l"] + "\"" + \
-		" PASSWORD = \"" + options["-p"] + "\">\r\n")
-	conn.send("<SERVER_INFO MODE = \"read\"><GET_HOST_POWER_STATUS/>\r\n")
-	conn.send("</SERVER_INFO></LOGIN>\r\n")
-	conn.log_expect(options, "HOST_POWER=\"(.*?)\"", POWER_TIMEOUT)
-
-	status = conn.match.group(1)
-	return status.lower().strip()
-
-def set_power_status(conn, options):
-	conn.send("<LOGIN USER_LOGIN = \"" + options["-l"] + "\"" + \
-		" PASSWORD = \"" + options["-p"] + "\">\r\n")
-	conn.send("<SERVER_INFO MODE = \"write\">")
-
-	if options.has_key("fw_processor") and options["fw_processor"] == "iLO2":
-		if options["fw_version"] > 1.29:
-			conn.send("<HOLD_PWR_BTN TOGGLE=\"yes\" />\r\n")
-		else:
-			conn.send("<HOLD_PWR_BTN />\r\n")
-	elif options["-r"] < 2.21:
-		conn.send("<SET_HOST_POWER HOST_POWER = \"" + options["-o"] + "\" />\r\n")
-	else:
-		if options["-o"] == "off":
-			conn.send("<HOLD_PWR_BTN/>\r\n")
-		else:
-			conn.send("<PRESS_PWR_BTN/>\r\n")
-	conn.send("</SERVER_INFO></LOGIN>\r\n")
-
-	return
-
-def main():
-	device_opt = [  "help", "version", "agent", "quiet", "verbose", "debug",
-			"action", "ipaddr", "login", "passwd", "passwd_script",
-			"ssl", "ribcl" ]
-
-	options = check_input(device_opt, process_input(device_opt))
-
-	options["-z"] = 1
-	LOGIN_TIMEOUT = 10
-
-	##
-	## Login and get version number
-	####
-	conn = fence_login(options)
-	try:
-		conn.send("<?xml version=\"1.0\"?>\r\n")
-		conn.log_expect(options, [ "</RIBCL>", "<END_RIBCL/>" ], LOGIN_TIMEOUT)
-		version = re.compile("<RIBCL VERSION=\"(.*?)\"", re.IGNORECASE).search(conn.before).group(1)
-		if options.has_key("-r") == 0:
-			options["-r"] = float(version)
-
-		if options["-r"] >= 2:
-			conn.send("<RIBCL VERSION=\"2.0\">\r\n")
-		else:
-			conn.send("<RIBCL VERSION=\"1.2\">\r\n")
-
-		conn.send("<LOGIN USER_LOGIN = \"" + options["-l"] + "\"" + \
-			" PASSWORD = \"" + options["-p"] + "\">\r\n")
-		if options["-r"] >= 2:
-			conn.send("<RIB_INFO MODE=\"read\"><GET_FW_VERSION />\r\n")
-			conn.send("</RIB_INFO>\r\n")
-			conn.log_expect(options, "<GET_FW_VERSION\s*\n", SHELL_TIMEOUT)
-			conn.log_expect(options, "/>", SHELL_TIMEOUT)
-			options["fw_version"] = float(re.compile("FIRMWARE_VERSION\s*=\s*\"(.*?)\"", re.IGNORECASE).search(conn.before).group(1))
-			options["fw_processor"] = re.compile("MANAGEMENT_PROCESSOR\s*=\s*\"(.*?)\"", re.IGNORECASE).search(conn.before).group(1)
-		conn.send("</LOGIN>\r\n")
-	except pexpect.TIMEOUT:
-		fail(EC_LOGIN_DENIED)
-
-	##
-	## Fence operations
-	####
-	fence_action(conn, options, set_power_status, get_power_status, None)
-
-if __name__ == "__main__":
-	main()
diff --git a/fence/agents/ipmilan/Makefile b/fence/agents/ipmilan/Makefile
deleted file mode 100644
index 1c2e9e9..0000000
--- a/fence/agents/ipmilan/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-TARGET= fence_ipmilan
-
-SBINDIRT=$(TARGET)
-
-all: ${TARGET}
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-OBJS=	expect.o \
-	ipmilan.o
-
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${libdir}
-
-${TARGET}: ${OBJS}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-clean: generalclean
-
--include $(OBJS:.o=.d)
diff --git a/fence/agents/ipmilan/expect.c b/fence/agents/ipmilan/expect.c
deleted file mode 100644
index fa85bd8..0000000
--- a/fence/agents/ipmilan/expect.c
+++ /dev/null
@@ -1,342 +0,0 @@
-/** @file
- * Simple expect module for the STONITH library.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <signal.h>
-#include <string.h>
-#include <errno.h>
-#include <syslog.h>
-#include <libintl.h>
-#include <sys/wait.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <stdarg.h>
-#include <string.h>
-#include <unistd.h>
-#include <signal.h>
-#include <errno.h>
-#include <time.h>
-#include <sys/time.h>
-#include <sys/times.h>
-#ifdef _POSIX_PRIORITY_SCHEDULING
-#	include <sched.h>
-#endif
-
-#include "expect.h"
-
-#ifndef EOS
-#	define	EOS '\0'
-#endif
-
-
-/* 
- * Just incase we are on an out of date system 
- */
-#ifndef CLOCKS_PER_SEC
-#  ifndef CLK_TCK
-#    error Neither CLOCKS_PER_SEC nor CLK_TCK (obsolete) are defined
-#  endif /* CLK_TCK */
-#  define CLOCKS_PER_SEC CLK_TCK
-#endif /* CLOCKS_PER_SEC */
-
-
-void close_all_files (void);
-
-/**
- * Look for ('expect') any of a series of tokens in the input
- * Return the token type for the given token or -1 on error.
- *
- * @param fd		The file descriptor to watch.
- * @param toklist	The series of tokens to look for.
- * @param to_secs	Timeout (in seconds).
- * @param buf		Receive buffer (preallocated).
- * @param maxline	Length of receive buffer.
- */
-int
-ExpectToken(int	fd, struct Etoken * toklist, int to_secs, char * buf
-,	int maxline)
-{
-	clock_t		starttime;
-	clock_t		endtime;
-	int		wraparound=0;
-	int		tickstousec = (1000000/CLOCKS_PER_SEC);
-	clock_t		now;
-	clock_t		ticks;
-	int		nchars = 1; /* reserve space for an EOS */
-	struct timeval	tv;
-
-	struct Etoken *	this;
-
-	/* Figure out when to give up.  Handle lbolt wraparound */
-	if (fd < 0) {
-		errno = EINVAL;
-		return -1;
-	}
-	
-	starttime = times(NULL);
-	ticks = (to_secs*CLOCKS_PER_SEC);
-	endtime = starttime + ticks;
-
-	if (endtime < starttime) {
-		wraparound = 1;
-	}
-
-	if (buf) {
-		*buf = EOS;
-	}
-
-	for (this=toklist; this->string; ++this) {
-		this->matchto = 0;
-	}
-
-
-	while (now = times(NULL),
-		(wraparound && (now > starttime || now <= endtime))
-		||	(!wraparound && now <= endtime)) {
-
-		fd_set infds;
-		char	ch;
-		clock_t		timeleft;
-		int		retval;
-
-		timeleft = endtime - now;
-
-		tv.tv_sec = timeleft / CLOCKS_PER_SEC;
-		tv.tv_usec = (timeleft % CLOCKS_PER_SEC) * tickstousec;
-
-		if (tv.tv_sec == 0 && tv.tv_usec < tickstousec) {
-			/* Give 'em a little chance */
-			tv.tv_usec = tickstousec;
-		}
-
-		/* Watch our FD to see when it has input. */
-           	FD_ZERO(&infds);
-           	FD_SET(fd, &infds);
-
-		retval = select(fd+1, &infds, NULL, NULL, &tv); 
-		if (retval <= 0) {
-			errno = ETIMEDOUT;
-			return(-1);
-		}
-		/* Whew!  All that work just to read one character! */
-		
-		if (read(fd, &ch, sizeof(ch)) <= 0) {
-			return(-1);
-		}
-		/* Save the text, if we can */
-		if (buf && nchars < maxline-1) {
-			*buf = ch;
-			++buf;
-			*buf = EOS;
-			++nchars;
-		}
-#if 0
-		fprintf(stderr, "%c", ch);
-#endif
-
-		/* See how this character matches our expect strings */
-
-		for (this=toklist; this->string; ++this) {
-
-			if (ch == this->string[this->matchto]) {
-
-				/* It matches the current token */
-
-			 	++this->matchto;
-				if (this->string[this->matchto] == EOS){
-					/* Hallelujah! We matched */
-					return(this->toktype);
-				}
-			}else{
-
-				/* It doesn't appear to match this token */
-
-				int	curlen;
-				int	nomatch=1;
-				/*
-				 * If we already had a match (matchto is
-				 * greater than zero), we look for a match
-				 * of the tail of the pattern matched so far
-				 * (with the current character) against the
-				 * head of the pattern.
-				 */
-
-				/*
-				 * This is to make the string "aab" match
-				 * the pattern "ab" correctly 
-				 * Painful, but nice to do it right.
-				 */
-
-				for (curlen = (this->matchto)
-				;	nomatch && curlen >= 0
-				;	--curlen) 			{
-					const char *	tail;
-					tail=(this->string)
-					+	this->matchto
-					-	curlen;
-
-					if (strncmp(this->string, tail
-					,	curlen) == 0
-					&&	this->string[curlen] == ch)  {
-						
-						if (this->string[curlen+1]==EOS){
-							/* We matched!  */
-							/* (can't happen?) */
-							return(this->toktype);
-						}
-						this->matchto = curlen+1;
-						nomatch=0;
-					}
-				}
-				if (nomatch) {
-					this->matchto = 0;
-				}
-			}
-		}
-	}
-	errno = ETIMEDOUT;
-	return(-1);
-}
-
-/**
- * Start a process with its stdin and stdout redirected to pipes
- * so the parent process can talk to it.
- *
- * @param cmd		Command line to run.
- * @param readfd	Filled with a pipe to the the output of the
- *			new child.
- * @param writefd	Filled with a pipe to the input of the new
- *			child.
- * @param redir_err	0, 1 = stderr, 2 = setsid, 3 = both
- * @return		-1 on failure (with errno set appropriately) or
- *			or the PID of the new child process.
- */
-int
-StartProcess(const char * cmd, int * readfd, int * writefd, int flags)
-{
-	pid_t	pid;
-	int	wrpipe[2];	/* The pipe the parent process writes to */
-				/* (which the child process reads from) */
-	int	rdpipe[2];	/* The pipe the parent process reads from */
-				/* (which the child process writes to) */
-
-	if (pipe(wrpipe) < 0) {
-		perror("cannot create pipe\n");
-		return(-1);
-	}
-	if (pipe(rdpipe) < 0) {
-		perror("cannot create pipe\n");
-		close(wrpipe[0]);
-		close(wrpipe[1]);
-		return(-1);
-	}
-	switch(pid=fork()) {
-	case -1:	
-		perror("cannot StartProcess cmd");
-		close(rdpipe[0]);
-		close(rdpipe[1]);
-		close(wrpipe[0]);
-		close(wrpipe[1]);
-		return(-1);
-
-	case 0:
-		/* We are the child */
-		/* Redirect stdin */
-		if (wrpipe[0] != 0) {
-			close(0);
-			if(dup2(wrpipe[0], 0) < 0) {
-			    syslog(LOG_CRIT,
-			    	   "StartProcess: dup2(%d,0) failed: %s\n",
-			    	   wrpipe[0],
-			    	   strerror(errno));
-			    exit(1);
-			}
-			close(wrpipe[0]);
-		}
-		close(wrpipe[1]);
-
-		/* Redirect stdout */
-		if (rdpipe[1] != 1) {
-			close(1);
-			if(dup2(rdpipe[1], 1) < 0) {
-			    syslog(LOG_CRIT,
-			    	   "StartProcess: dup2(%d,1) failed: %s\n",
-			    	   rdpipe[1],
-			    	   strerror(errno));
-			    exit(1);
-			}
-			close(rdpipe[1]);
-		}
-		close(rdpipe[0]);
-		
-		if (flags & EXP_STDERR) {
-			/* Redirect stderr */
-			close(2);
-			if(dup2(1, 2) < 0) {
-				syslog(LOG_CRIT,
-				       "StartProcess: dup2(1,2) failed: %s\n",
-				       strerror(errno));
-				exit(1);
-			}
-		}
-		
-		if (flags & EXP_NOCTTY)
-			setsid();
-		close_all_files(); /* Workaround telnet bugs */
-#if defined(SCHED_OTHER)
-		{
-			/*
-			 * Try and (re)set our scheduling to "normal"
-			 * Sometimes our callers run in soft
-			 * real-time mode.  The program we exec might
-			 * not be very well behaved - this is bad for
-			 * operation in high-priority (soft real-time)
-			 * mode.  In particular, telnet is prone to
-			 * going into infinite loops when killed.
-			 */
-			struct sched_param	sp;
-			memset(&sp, 0, sizeof(sp));
-			sp.sched_priority = 0;
-			sched_setscheduler(0, SCHED_OTHER, &sp);
-		}
-#endif
-		execlp("/bin/bash", "bash", "-c", cmd, NULL);
-		perror("cannot exec shell!");
-		exit(1);
-
-	default:	/* We are the parent */
-		*readfd = rdpipe[0];
-		close(rdpipe[1]);
-		*writefd = wrpipe[1];
-		close(wrpipe[0]);
-		return(pid);
-	}
-	/*NOTREACHED*/
-	return(-1);
-}
-
-/**
- * Close all file descriptors in a child process.
- *
- * Open fd's are inherited across exec unless they are
- * marked close on exec, which must be done explicitly
- * with fcntl().  While this should not affect the operation of
- * telnet, it was found that in some cases it did.  Its easier to
- * just fix it this way than to fix telnet.
- */
-void
-close_all_files (void)
-{
-	register int i, fd_table_size;
-
-	fd_table_size = getdtablesize ();
-	if (fd_table_size > 256)/* clamp to a reasonable value */
-		fd_table_size = 256;
-	
-	for (i = 3; i < fd_table_size; i++)
-		close (i);
-}
diff --git a/fence/agents/ipmilan/expect.h b/fence/agents/ipmilan/expect.h
deleted file mode 100644
index 41d398a..0000000
--- a/fence/agents/ipmilan/expect.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/** @file
- * Header for expect.c.
- *
- * Expect simple tokens.  Simple expect infrastructure for STONITH API
- *
- */
-
-#ifndef __EXPECT_H
-#	define __EXPECT_H
-/*
- *	If we find any of the given tokens in the input stream,
- *	we return it's "toktype", so we can tell which one was
- *	found.
- *
- */
-
-/**
- * A token we pass to ExpectToken()
- */
-struct Etoken {
-	const char *	string;		/**< The token to look for */
-	int		toktype;	/**< The type to return on match */
-	int		matchto;	/**< Modified during matches */
-};
-
-int ExpectToken(int fd
-,	struct Etoken * toklist	/* List of tokens to match against */
-				/* Final token has NULL string */
-,	int to_secs		/* Timeout value in seconds */
-,	char * buf		/* If non-NULL, then all the text
-				 * matched/skipped over by this match */
-,	int maxline);		/* Size of 'buf' area in bytes */
-
-
-/*
- *	A handy little routine.  It runs the given process
- *	with it's standard output redirected into our *readfd, and
- *	its standard input redirected from our *writefd
- *
- *	Doing this with all the pipes, etc. required for doing this
- *	is harder than it sounds :-)
- */
-
-int StartProcess(const char * cmd, int* readfd, int* writefd, int redir_err);
-
-#define EXP_STDERR 1
-#define EXP_NOCTTY 2
-
-#ifndef EOS
-#	define	EOS '\0'
-#endif
-#endif /*__EXPECT_H*/
diff --git a/fence/agents/ipmilan/ipmilan.c b/fence/agents/ipmilan/ipmilan.c
deleted file mode 100644
index 85de949..0000000
--- a/fence/agents/ipmilan/ipmilan.c
+++ /dev/null
@@ -1,945 +0,0 @@
-/** @file
- * clumanager 1.2.x linux-cluster fence and/or GFS fence
- * module for Intel/Bull/Dell Tiger4 machines via IPMI over lan.
- * (Probably works with anything ipmitool can control, though.)
- *
- * Note: REQUIRES ipmitool to operate.  On certain machines, the hardware
- * manufacturer provides this tool for you.  Otherwise, check:
- *
- *  http://ipmitool.sourceforge.net
- *
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <signal.h>
-#include <string.h>
-#include <errno.h>
-#include <limits.h>
-#include <sys/wait.h>
-#include <sys/stat.h>
-#include <libintl.h>
-
-/* fenced doesn't use the remote calls */
-#define ST_STATUS 0
-#define ST_POWERON 1
-#define ST_POWEROFF 2
-#define ST_GENERIC_RESET 3
-
-#define DEFAULT_TIMEOUT 10
-
-#define log(lvl, fmt, args...) fprintf(stderr, fmt, ##args)
-#include <libgen.h>
-#include "copyright.cf"
-
-#include "expect.h"
-
-#define IPMIID "IPMI over LAN driver"
-#define NOTIPMI "Destroyed IPMI over LAN driver"
-
-
-#define dbg_printf(i, lvl, fmt, args...) \
-do { \
-	if ( (i)->i_verbose >= lvl) { \
-		printf(fmt, ##args); \
-		fflush(stdout); \
-	} \
-} while (0)
-
-
-
-struct ipmi {
-	char *i_id;
-	const char *i_ipmitool;
-	char *i_host;
-	char *i_user;
-	char *i_authtype;
-	char *i_password;
-	int i_rdfd;
-	int i_wrfd;
-	pid_t i_pid;
-	int i_config;
-	int i_verbose;
-	int i_lanplus;
-	int i_timeout;
-	int i_cipher;
-};
-
-
-/*
-   Supported installation paths
- */
-const char *ipmitool_paths[] = {
-	"/usr/local/bull/NSMasterHW/bin/ipmitool",
-	"/usr/bin/ipmitool",
-	"/usr/sbin/ipmitool",
-	"/bin/ipmitool",
-	"/sbin/ipmitool",
-	"/usr/local/bin/ipmitool",
-	"/usr/local/sbin/ipmitool",
-	NULL
-};
-
-
-#define ECIPHER 2048
-
-static struct Etoken power_on_complete[] = {
-	{"Password:", EPERM, 0},
-	{"Unable to establish LAN", EAGAIN, 0},	/* Retry */
-	{"IPMI mutex", EFAULT, 0},	/* Death */
-	{"Unsupported cipher suite ID", ECIPHER,0},
-	{"read_rakp2_message: no support for", ECIPHER,0},
-	{"Up/On", 0, 0},
-	{NULL, 0, 0}
-};
-
-static struct Etoken power_off_complete[] = {
-	{"Password:", EPERM, 0},
-	{"Unable to establish LAN", EAGAIN, 0},	/* Retry */
-	{"IPMI mutex", EFAULT, 0},	/* Death */
-	{"Unsupported cipher suite ID", ECIPHER,0},
-	{"read_rakp2_message: no support for", ECIPHER,0},
-	{"Down/Off", 0, 0},
-	{NULL, 0, 0}
-};
-
-
-#define STATE_OFF 4096
-#define STATE_ON  8192
-static struct Etoken power_status[] = {
-	{"Password:", EPERM, 0},
-	{"Unable to establish LAN", EAGAIN, 0},	/* Retry */
-	{"IPMI mutex", EFAULT, 0},	/* Death */
-	{"Unsupported cipher suite ID", ECIPHER,0},
-	{"read_rakp2_message: no support for", ECIPHER,0},
-	{"Chassis Power is off", STATE_OFF, 0},
-	{"Chassis Power is on", STATE_ON, 0},
-	{NULL, 0, 0}
-};
-
-
-/*
-   Search for ipmitool
- */
-static const char *
-ipmitool_path(void)
-{
-	char *p;
-	int x = 0;
-	struct stat sb;
-
-	for (x = 0; ipmitool_paths[x]; x++) {
-		p = (char *)ipmitool_paths[x];
-		if (stat(p, &sb) != 0)
-			continue;
-
-		if (!S_ISREG(sb.st_mode))
-			continue;
-
-		/* executable? */
-		if ((sb.st_mode & S_IXUSR) == 0)
-			continue;
-
-		return (const char *)p;
-	}
-
-	return NULL;
-}
-
-
-/** Prepare string for use in sh style environment. This function take source
-  string and prepend/append quote (') to start/end of source string to dest
-  string. Any occurence of quote in source string is replaced by '\'' sequence.
-  Dest string must be preallocated.
-
-  @param dest Destination string
-  @param source Source string
-  @param max_len Maximum length of data written to dest string (including end 0)
-  @return Pointer to start of destination string.
-*/
-char *str_prepare_for_sh(char *dest,char *source,int max_len) {
-  char *dest_p=dest;
-  char *max_dest=dest+max_len;
-
-  if (dest_p+1>=max_dest) {*dest_p=0;return dest;}
-  *dest_p++='\'';
-
-  while (*source) {
-    if (*source=='\'') {
-      if (dest_p+4>=max_dest) {*dest_p=0;return dest;}
-
-      memcpy(dest_p,"'\\''",4);dest_p+=4;
-    } else {
-      if (dest_p+1>=max_dest) {*dest_p=0;return dest;}
-
-      *dest_p++=*source;
-    }
-    source++;
-  }
-
-  if (dest_p+2>=max_dest) {*dest_p=0;return dest;}
-
-  *dest_p++='\'';*dest_p=0;
-
-  return dest;
-}
-
-static int
-build_cmd(char *command, size_t cmdlen, struct ipmi *ipmi, int op)
-{
-	char cmd[2048];
-	char arg[2048];
-	char tmp[2048];
-	int x;
-
-	/* Store path */
-	if (ipmi->i_lanplus) {
-		snprintf(cmd, sizeof(cmd), "%s -I lanplus -H %s",
-				ipmi->i_ipmitool,
-				str_prepare_for_sh(tmp,ipmi->i_host,sizeof(tmp)));
-	} else {
-		snprintf(cmd, sizeof(cmd), "%s -I lan -H %s", ipmi->i_ipmitool,
-				str_prepare_for_sh(tmp,ipmi->i_host,sizeof(tmp)));
-	}
-
-	if (ipmi->i_user) {
-		snprintf(arg, sizeof(arg), " -U %s", str_prepare_for_sh(tmp,ipmi->i_user,sizeof(tmp)));
-		strncat(cmd, arg, sizeof(cmd) - strlen(arg));
-	}
-
-	if (ipmi->i_authtype) {
-		snprintf(arg, sizeof(arg), " -A %s", str_prepare_for_sh(tmp,ipmi->i_authtype,sizeof(tmp)));
-		strncat(cmd, arg, sizeof(cmd) - strlen(arg));
-	}
-
-	if (ipmi->i_cipher>=0) {
-		snprintf(arg, sizeof(arg), " -C %d", ipmi->i_cipher);
-		strncat(cmd, arg, sizeof(cmd) - strlen(arg));
-	}
-
-	if (ipmi->i_password) {
-		snprintf(arg, sizeof(arg), " -P %s", str_prepare_for_sh(tmp,ipmi->i_password,sizeof(tmp)));
-		strncat(cmd, arg, sizeof(cmd) - strlen(arg));
-	} else {
-		snprintf(arg, sizeof(arg), " -P ''");
-		strncat(cmd, arg, sizeof(cmd) - strlen(arg));
-	}
-
-	/* Tack on the -v flags for ipmitool; in most cases, i_verbose
-	   will be 0 */
-	for (x = 0; x < ipmi->i_verbose; x++) {
-		snprintf(arg, sizeof(arg), " -v");
-		strncat(cmd, arg, sizeof(cmd) - strlen(arg));
-	}
-
-	switch(op) {
-	case ST_POWERON:
-		snprintf(arg, sizeof(arg),
-			 "%s chassis power on", cmd);
-		break;
-	case ST_POWEROFF:
-		snprintf(arg, sizeof(arg),
-			 "%s chassis power off", cmd);
-		break;
-	case ST_STATUS:
-		snprintf(arg, sizeof(arg),
-			 "%s chassis power status", cmd);
-		break;
-	}
-
-	strncpy(command, arg, cmdlen);
-	return 0;
-}
-
-
-static int
-ipmi_spawn(struct ipmi *ipmi, const char *cmd)
-{
-	dbg_printf(ipmi, 1, "Spawning: '%s'...\n", cmd);
-	if (!ipmi) {
-		errno = EINVAL;
-		return -1;
-	}
-
-	if (ipmi->i_pid != -1)  {
-		dbg_printf(ipmi, 1, "Can't spawn: PID %d running\n",
-			   (int)ipmi->i_pid);
-		errno = EINPROGRESS;
-		return -1;
-	}
-
-	if ((ipmi->i_pid = StartProcess(cmd, &ipmi->i_rdfd,
-					&ipmi->i_wrfd,
-					EXP_STDERR|EXP_NOCTTY)) >= 0) {
-		dbg_printf(ipmi, 2, "Spawned: '%s' - PID %d\n", cmd,
-			   (int)ipmi->i_pid);
-		return 0;
-	}
-	return -1;
-}
-
-
-static int
-ipmi_reap(struct ipmi *ipmi)
-{
-	if (ipmi->i_pid >= 0) {
-		dbg_printf(ipmi, 2, "Reaping pid %d\n", ipmi->i_pid);
-		kill(ipmi->i_pid, 9);
-		waitpid(ipmi->i_pid, NULL, 0);
-	}
-	ipmi->i_pid = -1;
-	if (ipmi->i_rdfd >= 0) {
-		close(ipmi->i_rdfd);
-		ipmi->i_rdfd = -1;
-	}
-	if (ipmi->i_wrfd >= 0) {
-		close(ipmi->i_wrfd);
-		ipmi->i_wrfd = -1;
-	}
-	return 0;
-}
-
-
-static int
-ipmi_expect(struct ipmi *ipmi, struct Etoken *toklist, int timeout)
-{
-	int ret;
-	char buf[32768]; /* XX hope this is enough */
-
-	dbg_printf(ipmi, 3, "Looking for: \n");
-	for (ret = 0; toklist[ret].string; ret++) {
-		dbg_printf(ipmi, 3, "    '%s', val = %d\n",
-			   toklist[ret].string,
-			   toklist[ret].toktype);
-	}
-
-	ret = ExpectToken(ipmi->i_rdfd, toklist, timeout, buf, sizeof(buf));
-	dbg_printf(ipmi, 3, "ExpectToken returned %d\n", ret);
-	if (ret == -1) {
-		ret = errno;
-		dbg_printf(ipmi, 3, "ExpectToken failed.  Info returned:\n");
-		dbg_printf(ipmi, 3, ">>>>>\n%s\n<<<<<\nError = %d (%s)\n",
-			   buf,
-			   ret,
-			   strerror(ret));
-	}
-
-	return ret;
-}
-
-
-static int
-ipmi_op(struct ipmi *ipmi, int op, struct Etoken *toklist)
-{
-	char cmd[2048];
-	int ret;
-
-	build_cmd(cmd, sizeof(cmd), ipmi, op);
-
-	if (ipmi_spawn(ipmi, cmd) != 0)
-		return -1;
-	ret = ipmi_expect(ipmi, toklist, ipmi->i_timeout);
-	ipmi_reap(ipmi);
-
-	if (ret == EFAULT) {
-		log(LOG_CRIT, "ipmilan: ipmitool failed to create "
-		    "mutex; unable to complete operation\n");
-		return ret;
-	}
-
-	if (ret == ECIPHER) {
-		log(LOG_CRIT, "ipmilan: ipmitool failed to operate "
-		    "with ciphersuite %d; unable to complete operation\n",ipmi->i_cipher);
-		return ret;
-	}
-
-	if (ret == ETIMEDOUT) {
-		/*!!! Still couldn't get through?! */
-		log(LOG_WARNING,
-		    "ipmilan: Failed to connect after %d seconds\n",ipmi->i_timeout);
-	}
-
-	return ret;
-}
-
-
-static int
-ipmi_off(struct ipmi *ipmi)
-{
-	int ret, retries = 5;
-
-	ret = ipmi_op(ipmi, ST_STATUS, power_status);
-	switch(ret) {
-	case STATE_ON:
-		break;
-	case STATE_OFF:
-		return 0;
-	default:
-		return ret;
-	}
-
-	ret = ipmi_op(ipmi, ST_POWEROFF, power_off_complete);
-	if (ret != 0)
-		return ret;
-
-	while (retries>=0) {
-		sleep(5);
-		--retries;
-		ret = ipmi_op(ipmi, ST_STATUS, power_status);
-
-		switch(ret) {
-		case STATE_OFF:
-			return 0;
-		case EFAULT:
-			/* We're done. */
-			retries = 0;
-			break;
-		case STATE_ON:
-		default:
-			continue;
-		}
-	}
-	log(LOG_WARNING, "ipmilan: Power still on\n");
-
-	return ret;
-}
-
-
-static int
-ipmi_on(struct ipmi *ipmi)
-{
-	int ret, retries = 5; 
-
-	ret = ipmi_op(ipmi, ST_STATUS, power_status);
-	switch(ret) {
-	case STATE_ON:
-		return 0;
-	case STATE_OFF:
-		break;
-	default:
-		return ret;
-	}
-
-	ret = ipmi_op(ipmi, ST_POWERON, power_on_complete);
-	if (ret != 0)
-		return ret;
-
-	while (retries>=0) {
-		sleep(5);
-		--retries;
-		ret = ipmi_op(ipmi, ST_STATUS, power_status);
-
-		switch(ret) {
-		case STATE_ON:
-			return 0;
-		case EFAULT:
-			/* We're done. */
-			retries = 0;
-			break;
-		case STATE_OFF:
-		default:
-			continue;
-		}
-	}
-	log(LOG_WARNING, "ipmilan: Power still off\n");
-
-	return ret;
-}
-
-
-/**
-  Squash all our private data
- */
-static void
-ipmi_destroy(struct ipmi *i)
-{
-	ipmi_reap(i);
-	if (i->i_user) {
-		free(i->i_user);
-		i->i_user = NULL;
-	}
-	if (i->i_password) {
-		free(i->i_password);
-		i->i_password= NULL;
-	}
-	if (i->i_host) {
-		free(i->i_host);
-		i->i_host = NULL;
-	}
-	i->i_config = 0;
-	i->i_id = NOTIPMI;
-}
-
-
-/**
-  Multipurpose initializer.  Used to either create a new, blank ipmi,
-  or update an existing one, or both.
- */
-static struct ipmi *
-ipmi_init(struct ipmi *i, char *host, char *authtype,
-	  char *user, char *password, int lanplus, int verbose,int timeout,
-	  int cipher)
-{
-	const char *p;
-
-	if (!i || !i->i_ipmitool)
-		p = ipmitool_path();
-	else
-		p = i->i_ipmitool;
-
-	if (!p) {
-		log(LOG_WARNING, "ipmilan: ipmitool not found!\n");
-		return NULL;
-	}
-
-	if (!i)
-		i = malloc (sizeof(*i));
-	if (!i)
-		return NULL;
-
-	if (host && strlen(host)) {
-		i->i_host = strdup(host);
-		if (!i->i_host) {
-			free(i);
-			return NULL;
-		}
-	} else
-		i->i_host = NULL;
-
-	if (password && strlen(password)) {
-		i->i_password = strdup(password);
-		if (!i->i_password) {
-			free(i->i_host);
-			free(i);
-			return NULL;
-		}
-	} else
-		i->i_password = NULL;
-
-	if (authtype && strlen(authtype)) {
-		i->i_authtype = strdup(authtype);
-		if (!i->i_authtype) {
-			free(i->i_host);
-			if (i->i_password)
-				free(i->i_password);
-			free(i);
-			return NULL;
-		}
-	} else
-		i->i_authtype = NULL;
-
-
-	if (user && strlen(user)) {
-		i->i_user= strdup(user);
-		if (!i->i_user) {
-			free(i->i_host);
-			if (i->i_authtype)
-				free(i->i_authtype);
-			if (i->i_password)
-				free(i->i_password);
-			free(i);
-			return NULL;
-		}
-	} else
-		i->i_user = NULL;
-	i->i_ipmitool = p;
-	i->i_rdfd = -1;
-	i->i_wrfd = -1;
-	i->i_pid = -1;
-	i->i_id = IPMIID;
-	i->i_verbose = verbose;
-	i->i_lanplus = lanplus;
-	i->i_timeout = timeout;
-	i->i_cipher = cipher;
-
-	return i;
-}
-
-
-/**
-   Remove leading and trailing whitespace from a line of text.
- */
-int
-cleanup(char *line, size_t linelen)
-{
-	char *p;
-	size_t x;
-
-	/* Remove leading whitespace. */
-	p = line;
-	for (x = 0; x <= linelen; x++) {
-		switch (line[x]) {
-		case '\t':
-		case ' ':
-			break;
-		case '\n':
-		case '\r':
-			return -1;
-		default:
-			goto eol;
-		}
-	}
-eol:
-	/* Move the remainder down by as many whitespace chars as we
-	   chewed up */
-	if (x)
-		memmove(p, &line[x], linelen-x);
-
-	/* Remove trailing whitespace. */
-	for (x=0; x <= linelen; x++) {
-		switch(line[x]) {
-		case '\t':
-		case ' ':
-		case '\r':
-		case '\n':
-			line[x] = 0;
-		case 0:
-		/* End of line */
-			return 0;
-		}
-	}
-
-	return -1;
-}
-
-
-/**
-   Parse args from stdin.  Dev + devlen + op + oplen must be valid.
- */
-int
-get_options_stdin(char *ip, size_t iplen,
-		  char *authtype, size_t atlen,
-		  char *passwd, size_t pwlen,
-		  char *pwd_script, size_t pwd_script_len,
-		  char *user, size_t userlen,
-		  char *op, size_t oplen,
-		  int *lanplus, int *verbose,int *timeout,
-	          int *cipher)
-{
-	char in[256];
-	int line = 0;
-	char *name, *val;
-
-	op[0] = 0;
-
-	while (fgets(in, sizeof(in), stdin)) {
-		++line;
-
-		if (in[0] == '#')
-			continue;
-
-		if (cleanup(in, sizeof(in)) == -1)
-			continue;
-
-		name = in;
-		if ((val = strchr(in, '='))) {
-			*val = 0;
-			++val;
-		}
-
-		if (!strcasecmp(name, "agent")) {
-			/* Used by fenced? */
-		} else if (!strcasecmp(name, "verbose")) {
-			*verbose = 1;
-		} else if (!strcasecmp(name, "ipaddr")) {
-			/* IP address to use.  E.g. 10.1.1.2 */
-			if (val)
-				strncpy(ip, val, iplen);
-			else
-				ip[0] = 0;
-
-		} else if (!strcasecmp(name, "auth")) {
-			/* Authtype to use */
-			if (val)
-				strncpy(authtype, val, atlen);
-			else
-				authtype[0] = 0;
-
-		} else if (!strcasecmp(name, "passwd")) {
-			/* password */
-			if (val)
-				strncpy(passwd, val, pwlen);
-			else
-				passwd[0] = 0;
-
-		} else if (!strcasecmp(name, "passwd_script")) {
-			if (val) {
-				strncpy(pwd_script, val, pwd_script_len);
-				pwd_script[pwd_script_len - 1] = '\0';
-			} else
-				pwd_script[0] = '\0';
-		} else if (!strcasecmp(name, "user") || !strcasecmp(name, "login")) {
-			/* username */
-			if (val)
-				strncpy(user, val, userlen);
-			else
-				user[0] = 0;
-		} else if (!strcasecmp(name, "lanplus")) {
-			(*lanplus) = 1;
-		} else if (!strcasecmp(name,"timeout")) {
-			if ((sscanf(val,"%d",timeout)!=1) || *timeout<1) {
-			    *timeout=DEFAULT_TIMEOUT;
-			}
-		} else if (!strcasecmp(name,"cipher")) {
-			if ((sscanf(val,"%d",cipher)!=1) || *cipher<0) {
-			    *cipher=-1;
-			}
-		} else if (!strcasecmp(name, "option") ||
-			   !strcasecmp(name, "operation") ||
-			   !strcasecmp(name, "action")) {
-			if (val)
-				strncpy(op, val, oplen);
-			else
-				op[0] = 0;
-		}
-	}
-
-	return 0;
-}
-
-
-/**
-   Print a message to stderr and call exit(1).
- */
-void
-fail_exit(char *msg)
-{
-	fprintf(stderr, "failed: %s\n", msg);
-	exit(1);
-}
-
-void
-usage_exit(char *pname)
-{
-printf("usage: %s <options>\n", pname);
-printf("   -A <authtype>  IPMI Lan Auth type (md5, password, or none)\n");
-printf("   -a <ipaddr>    IPMI Lan IP to talk to\n");
-printf("   -i <ipaddr>    IPMI Lan IP to talk to (deprecated, use -a)\n");
-printf("   -p <password>  Password (if required) to control power on\n"
-       "                  IPMI device\n");
-printf("   -P             Use Lanplus\n");
-printf("   -S <path>      Script to retrieve password (if required)\n");
-printf("   -l <login>     Username/Login (if required) to control power\n"
-       "                  on IPMI device\n");
-printf("   -o <op>        Operation to perform.\n");
-printf("                  Valid operations: on, off, reboot, status\n");
-printf("   -t <timeout>   Timeout (sec) for IPMI operation (default %d)\n",DEFAULT_TIMEOUT);
-printf("   -C <cipher>    Ciphersuite to use (same as ipmitool -C parameter)\n");
-printf("   -V             Print version and exit\n");
-printf("   -v             Verbose mode\n\n");
-printf("If no options are specified, the following options will be read\n");
-printf("from standard input (one per line):\n\n");
-printf("   auth=<auth>           Same as -A\n");
-printf("   ipaddr=<#>            Same as -a\n");
-printf("   passwd=<pass>         Same as -p\n");
-printf("   passwd_script=<path>  Same as -S\n");
-printf("   lanplus               Same as -P\n");
-printf("   login=<login>         Same as -u\n");
-printf("   option=<op>           Same as -o\n");
-printf("   operation=<op>        Same as -o\n");
-printf("   action=<op>           Same as -o\n");
-printf("   timeout=<timeout>     Same as -t\n");
-printf("   cipher=<cipher>       Same as -C\n");
-printf("   verbose               Same as -v\n\n");
-	exit(1);
-}
-
-
-int
-main(int argc, char **argv)
-{
-	extern char *optarg;
-	int opt, ret = -1;
-	char authtype[64];
-	char ip[64];
-	char passwd[64];
-	char user[64];
-	char op[64];
-	char pwd_script[PATH_MAX] = { 0, };
-	int lanplus=0;
-	int verbose=0;
-	char *pname = basename(argv[0]);
-	struct ipmi *i;
-	int timeout=DEFAULT_TIMEOUT;
-        int cipher=-1;
-
-	memset(ip, 0, sizeof(ip));
-	memset(authtype, 0, sizeof(authtype));
-	memset(passwd, 0, sizeof(passwd));
-	memset(user, 0, sizeof(user));
-	memset(op, 0, sizeof(op));
-
-	if (argc > 1) {
-		/*
-		   Parse command line options if any were specified
-		 */
-		while ((opt = getopt(argc, argv, "A:a:i:l:p:S:Po:vV?hHt:C:")) != EOF) {
-			switch(opt) {
-			case 'A':
-				/* Auth type */
-				strncpy(authtype, optarg, sizeof(authtype));
-				break;
-			case 'a':
-			case 'i':
-				/* IP address */
-				strncpy(ip, optarg, sizeof(ip));
-				break;
-			case 'l':
-				/* user / login */
-				strncpy(user, optarg, sizeof(user));
-				break;
-			case 'p':
-				/* password */
-				strncpy(passwd, optarg, sizeof(passwd));
-				break;
-			case 'P':
-				lanplus = 1;
-				break;
-			case 'S':
-				strncpy(pwd_script, optarg, sizeof(pwd_script));
-				pwd_script[sizeof(pwd_script) - 1] = '\0';
-				break;
-			case 'o':
-				/* Operation */
-				strncpy(op, optarg, sizeof(op));
-				break;
-			case 't':
-				/* Timeout */
-				if ((sscanf(optarg,"%d",&timeout)!=1) || timeout<1) {
-				    fail_exit("Timeout option expects positive number parameter");
-				}
-				break;
-			case 'C':
-				/* Ciphersuite */
-				if ((sscanf(optarg,"%d",&cipher)!=1) || cipher<0) {
-				    fail_exit("Ciphersuite option expects positive number parameter");
-				}
-				break;
-			case 'v':
-				verbose++;
-				break;
-			case 'V':
-        			printf("%s %s (built %s %s)\n", pname,
-				       RELEASE_VERSION,
-               				__DATE__, __TIME__);
-        			printf("%s\n",
-				       REDHAT_COPYRIGHT);
-				return 0;
-			default:
-				usage_exit(pname);
-			}
-		}
-	} else {
-		/*
-		   No command line args?  Get stuff from stdin
-		 */
-		if (get_options_stdin(ip, sizeof(ip),
-				      authtype, sizeof(authtype),
-				      passwd, sizeof(passwd),
-					  pwd_script, sizeof(pwd_script),
-				      user, sizeof(user),
-				      op, sizeof(op), &lanplus, &verbose,&timeout,
-				      &cipher) != 0)
-			return 1;
-	}
-
-	if (pwd_script[0] != '\0') {
-		char pwd_buf[1024];
-		FILE *fp;
-		fp = popen(pwd_script, "r");
-		if (fp != NULL) {
-			ssize_t len = fread(pwd_buf, 1, sizeof(pwd_buf), fp);
-			if (len > 0) {
-				char *p;
-				p = strchr(pwd_buf, '\n');
-				if (p != NULL)
-					*p = '\0';
-				p = strchr(pwd_buf, '\r');
-				if (p != NULL)
-					*p = '\0';
-				strncpy(passwd, pwd_buf, sizeof(passwd));
-				passwd[sizeof(passwd) - 1] = '\0';
-			}
-			pclose(fp);
-		}
-	}
-
-	/*
-	   Validate the operating parameters
-	 */
-	if (strlen(ip) == 0)
-		fail_exit("no IP address specified");
-
-	if (!strlen(op))
-		snprintf(op,sizeof(op), "reboot");
-
-	if (strcasecmp(op, "off") && strcasecmp(op, "on") &&
-	    strcasecmp(op, "status") && strcasecmp(op, "reboot")) {
-		fail_exit("operation must be 'on', 'off', 'status', "
-			  "or 'reboot'");
-	}
-
-	if (strlen(authtype) &&
-	    strcasecmp(authtype, "md5") &&
-	    strcasecmp(authtype, "password") &&
-	    strcasecmp(authtype, "none")) {
-		fail_exit("authtype, if included, must be 'md5', 'password',"
-			  " 'none'.");
-	}
-
-
-	/* Ok, set up the IPMI struct */
-	i = ipmi_init(NULL, ip, authtype, user, passwd, lanplus, verbose, timeout, cipher);
-	if (!i)
-		fail_exit("Failed to initialize\n");
-
-	/*
-	   Perform the requested operation
-	 */
-	if (!strcasecmp(op, "reboot")) {
-		printf("Rebooting machine @ IPMI:%s...", ip);
-		fflush(stdout);
-		ret = ipmi_off(i);
-		if (ret != 0)
-			goto out;
-		ret = ipmi_on(i);
-
-	} else if (!strcasecmp(op, "on")) {
-		printf("Powering on machine @ IPMI:%s...", ip);
-		fflush(stdout);
-		ret = ipmi_on(i);
-
-	} else if (!strcasecmp(op, "off")) {
-		printf("Powering off machine @ IPMI:%s...", ip);
-		fflush(stdout);
-		ret = ipmi_off(i);
-	} else if (!strcasecmp(op, "status")) {
-		printf("Getting status of IPMI:%s...",ip);
-		fflush(stdout);
-		ret = ipmi_op(i, ST_STATUS, power_status);
-		switch(ret) {
-		case STATE_ON:
-			printf("Chassis power = On\n");
-			ret = 0;
-			break;
-		case STATE_OFF:
-			printf("Chassis power = Off\n");
-			ret = 0;
-			break;
-		default:
-			printf("Chassis power = Unknown\n");
-			ret = 1;
-			break;
-		}
-	}
-
-
-out:
-	ipmi_destroy(i);
-	free(i);
-	if (ret == 0)
-		printf("Done\n");
-	else
-		printf("Failed\n");
-	return ret;
-}
diff --git a/fence/agents/ldom/Makefile b/fence/agents/ldom/Makefile
deleted file mode 100644
index a288025..0000000
--- a/fence/agents/ldom/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-include ../../../make/defines.mk
-
-TARGET= fence_ldom
-
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/ldom/fence_ldom.py b/fence/agents/ldom/fence_ldom.py
deleted file mode 100644
index 390d072..0000000
--- a/fence/agents/ldom/fence_ldom.py
+++ /dev/null
@@ -1,113 +0,0 @@
-#!/usr/bin/python
-
-##
-## The Following Agent Has Been Tested On - LDOM 1.0.3
-## The interface is backward compatible so it will work 
-## with 1.0, 1.0.1 and .2 too.
-## 
-#####
-
-import sys, re, pexpect
-sys.path.append("@FENCEAGENTSLIBDIR@")
-from fencing import *
-
-#BEGIN_VERSION_GENERATION
-RELEASE_VERSION="Logical Domains (LDoms) fence Agent"
-REDHAT_COPYRIGHT=""
-BUILD_DATE=""
-#END_VERSION_GENERATION
-
-COMMAND_PROMPT_REG="\[PEXPECT\]$"
-COMMAND_PROMPT_NEW="[PEXPECT]"
-
-# Start comunicating after login. Prepare good environment.
-def start_communication(conn, options):
-	conn.sendline ("PS1='"+COMMAND_PROMPT_NEW+"'")
-	res=conn.expect([pexpect.TIMEOUT, COMMAND_PROMPT_REG],SHELL_TIMEOUT)
-	if res==0:
-		#CSH stuff
-		conn.sendline("set prompt='"+COMMAND_PROMPT_NEW+"'")
-		conn.log_expect(options, COMMAND_PROMPT_REG,SHELL_TIMEOUT)
-	
-
-def get_power_status(conn, options):
-	try:
-		start_communication(conn,options)
-		
-		conn.sendline("ldm ls")
-		    
-		conn.log_expect(options,COMMAND_PROMPT_REG,SHELL_TIMEOUT)
-
-		result={}
-
-		#This is status of mini finite automata. 0 = we didn't found NAME and STATE, 1 = we did
-		fa_status=0
-		
-		for line in conn.before.splitlines():
-			domain=re.search("^(\S+)\s+(\S+)\s+.*$",line)
-
-			if (domain!=None):
-				if ((fa_status==0) and (domain.group(1)=="NAME") and (domain.group(2)=="STATE")):
-					fa_status=1
-				elif (fa_status==1):
-					result[domain.group(1)]=("",(domain.group(2).lower()=="bound" and "off" or "on"))
-
-	except pexpect.EOF:
-		fail(EC_CONNECTION_LOST)
-	except pexpect.TIMEOUT:
-		fail(EC_TIMED_OUT)
-
-	if (not (options["-o"] in ['monitor','list'])):
-		if (not (options["-n"] in result)):
-			fail_usage("Failed: You have to enter existing logical domain!")
-		else:
-			return result[options["-n"]][1]
-	else:
-		return result
-
-def set_power_status(conn, options):
-	try:
-		start_communication(conn,options)
-         	
-		cmd_line="ldm "+(options["-o"]=="on" and "start" or "stop -f")+" \""+options["-n"]+"\""
-            	
-		conn.sendline(cmd_line)
-		    
-		conn.log_expect(options,COMMAND_PROMPT_REG,POWER_TIMEOUT)
-		
-	except pexpect.EOF:
-		fail(EC_CONNECTION_LOST)
-	except pexpect.TIMEOUT:
-		fail(EC_TIMED_OUT)
-		
-def main():
-	device_opt = [  "help", "version", "agent", "quiet", "verbose", "debug",
-			"action", "ipaddr", "login", "passwd", "passwd_script",
-			"secure",  "identity_file", "test" , "port", "cmd_prompt",
-			"separator" ]
-
-    	
-	options = check_input(device_opt, process_input(device_opt))
-
-	## 
-	## Fence agent specific defaults
-	#####
-	if (not options.has_key("-c")):
-		options["-c"] = "\ $"
-	
-
-	options["-x"] = 1
-	##
-	## Operate the fencing device
-	####
-	conn = fence_login(options)
-	fence_action(conn, options, set_power_status, get_power_status,get_power_status)
-
-	##
-	## Logout from system
-	######
-	conn.sendline("logout")
-	conn.close()
-
-if __name__ == "__main__":
-	main()
diff --git a/fence/agents/lib/Makefile b/fence/agents/lib/Makefile
deleted file mode 100644
index 00666fa..0000000
--- a/fence/agents/lib/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-include ../../../make/defines.mk
-
-TARGET= fencing.py telnet_ssl
-
-FENCEAGENTSLIB= $(TARGET)
-
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/lib/fencing.py.py b/fence/agents/lib/fencing.py.py
deleted file mode 100644
index 11e8bca..0000000
--- a/fence/agents/lib/fencing.py.py
+++ /dev/null
@@ -1,586 +0,0 @@
-#!/usr/bin/python
-
-import sys, getopt, time, os
-import pexpect, re
-import telnetlib
-
-## do not add code here.
-#BEGIN_VERSION_GENERATION
-RELEASE_VERSION = "New fence lib agent - test release on steroids"
-REDHAT_COPYRIGHT = ""
-BUILD_DATE = "March, 2008"
-#END_VERSION_GENERATION
-
-POWER_TIMEOUT = 20
-SHELL_TIMEOUT = 3
-LOGIN_TIMEOUT = 5
-
-LOG_MODE_VERBOSE = 100
-LOG_MODE_QUIET = 0
-
-EC_BAD_ARGS        = 2
-EC_LOGIN_DENIED    = 3
-EC_CONNECTION_LOST = 4
-EC_TIMED_OUT       = 5
-EC_WAITING_ON      = 6
-EC_WAITING_OFF     = 7
-EC_STATUS          = 8
-
-TELNET_PATH = "/usr/bin/telnet"
-SSH_PATH    = "/usr/bin/ssh"
-SSL_PATH    = "@FENCEAGENTSLIBDIR@/telnet_ssl"
-
-all_opt = {
-	"help"    : {
-		"getopt" : "h",
-		"longopt" : "help",
-		"help" : "-h, --help                     Display this help and exit",
-		"order" : 54 },
-	"version" : { 
-		"getopt" : "V",
-		"longopt" : "version",
-		"help" : "-V, --version                  Output version information and exit",
-		"order" : 53 },
-	"quiet"   : {
-		"getopt" : "q",
-		"help" : "",
-		"order" : 50 },
-	"verbose" : {
-		"getopt" : "v",
-		"longopt" : "verbose",
-		"help" : "-v, --verbose                  Verbose mode",
-		"required" : "0",
-		"shortdesc" : "Verbose mode",
-		"order" : 51 },
-	"debug" : {
-		"getopt" : "D:",
-		"longopt" : "debug-file", 
-		"help" : "-D, --debug-file=<debugfile>   Debugging to output file",
-		"order" : 52 },
-	"agent"   : {
-		"getopt" : "",
-		"help" : "",
-		"order" : 1 },
-	"action" : {
-		"getopt" : "o:",
-		"longopt" : "action",
-		"help" : "-o, --action=<action>          Action: status, reboot (default), off or on",
-		"required" : "1",
-		"shortdesc" : "Fencing Action",
-		"default" : "reboot",
-		"order" : 1 },
-	"ipaddr" : {
-		"getopt" : "a:",
-		"longopt" : "ip",
-		"help" : "-a, --ip=<ip>                  IP address or hostname of fencing device",
-		"required" : "1",
-		"shortdesc" : "IP Address or Hostname",
-		"order" : 1 },
-	"login" : {
-		"getopt" : "l:",
-		"longopt" : "username",
-		"help" : "-l, --username=<name>          Login name",
-		"required" : "?",
-		"shortdesc" : "Login Name",
-		"order" : 1 },
-	"no_login" : {
-		"getopt" : "",
-		"help" : "",
-		"order" : 1 },
-	"no_password" : {
-		"getopt" : "",
-		"help" : "",
-		"order" : 1 },
-	"passwd" : {
-		"getopt" : "p:",
-		"longopt" : "password",
-		"help" : "-p, --password=<password>      Login password or passphrase",
-		"required" : "0",
-		"shortdesc" : "Login password or passphrase",
-		"order" : 1 },
-	"passwd_script" : {
-		"getopt" : "S:",
-		"longopt" : "password-script=",
-		"help" : "-S, --password-script=<script> Script to run to retrieve password",
-		"required" : "0",
-		"shortdesc" : "Script to retrieve password",
-		"order" : 1 },
-	"identity_file" : {
-		"getopt" : "k:",
-		"longopt" : "identity-file",
-		"help" : "-k, --identity-file=<filename> Identity file (private key) for ssh ",
-		"required" : "0",
-		"shortdesc" : "Identity file for ssh",
-		"order" : 1 },
-	"module_name" : {
-		"getopt" : "m:",
-		"longopt" : "module-name",
-		"help" : "-m, --module-name=<module>     DRAC/MC module name",
-		"order" : 1 },
-	"drac_version" : {
-		"getopt" : "d:",
-		"longopt" : "drac-version",
-		"help" : "-D, --drac-version=<version>   Force DRAC version to use",
-		"order" : 1 },
-	"ribcl" : {
-		"getopt" : "r:",
-		"longopt" : "ribcl-version",
-		"help" : "-r, --ribcl-version=<version>  Force ribcl version to use",
-		"order" : 1 },
-	"cmd_prompt" : {
-		"getopt" : "c:",
-		"longopt" : "command-prompt",
-		"help" : "-c, --command-prompt=<prompt>  Force command prompt",
-		"order" : 1 },
-	"secure" : {
-		"getopt" : "x",
-		"longopt" : "ssh",
-		"help" : "-x, --ssh                      Use ssh connection",
-		"required" : "0",
-		"shortdesc" : "SSH connection",
-		"order" : 1 },
-	"ssl" : {
-		"getopt" : "z",
-		"longopt" : "ssl",
-		"help" : "-z, --ssl                      Use ssl connection",
-		"required" : "0",
-		"shortdesc" : "SSL connection",
-		"order" : 1 },
-	"port" : {
-		"getopt" : "n:",
-		"longopt" : "plug",
-		"help" : "-n, --plug=<id>                Physical plug number on device or\n" + 
-        "                                        name of virtual machine",
-		"required" : "1",
-		"shortdesc" : "Physical plug number or name of virtual machine",
-		"order" : 1 },
-	"switch" : {
-		"getopt" : "s:",
-		"longopt" : "switch",
-		"help" : "-s, --switch=<id>              Physical switch number on device",
-		"required" : "0",
-		"shortdesc" : "Physical switch number on device",
-		"order" : 1 },
-	"partition" : {
-		"getopt" : "n:",
-		"help" : "-n <id>                        Name of the partition",
-		"required" : "0",
-		"shortdesc" : "Partition name",
-		"order" : 1 },
-	"managed" : {
-		"getopt" : "s:",
-		"help" : "-s <id>                        Name of the managed system",
-		"required" : "0",
-		"shortdesc" : "Managed system name",
-		"order" : 1 },
-	"test" : {
-		"getopt" : "T",
-		"help" : "",
-		"order" : 1,
-		"obsolete" : "use -o status instead" },
-	"vmipaddr" : {
-		"getopt" : "A:",
-		"help" : "-A <ip>        IP address or hostname of managed VMware ESX (default localhost)",
-		"order" : 2 },
-	"vmlogin" : {
-		"getopt" : "L:",
-		"help" : "-L <name>      VMware ESX management login name",
-		"order" : 2 },
-	"vmpasswd" : {
-		"getopt" : "P:",
-		"help" : "-P <password>  VMware ESX management login password",
-		"order" : 2 },
-	"vmpasswd_script" : {
-		"getopt" : "B:",
-		"help" : "-B <script>    Script to run to retrieve VMware ESX management password",
-		"order" : 2 },
-	"separator" : {
-		"getopt" : "C:",
-		"longopt" : "separator",
-		"help" : "-C, --separator=<char>         Separator for CSV created by 'list' operation",
-		"default" : ",", 
-		"order" : 100 }
-}
-
-class fspawn(pexpect.spawn):
-	def log_expect(self, options, pattern, timeout):
-		result = self.expect(pattern, timeout)
-		if options["log"] >= LOG_MODE_VERBOSE:
-			options["debug_fh"].write(self.before + self.after)
-		return result
-
-def version(command, release, build_date, copyright_notice):
-	print command, " ", release, " ", build_date
-	if len(copyright_notice) > 0:
-		print copyright_notice
-
-def fail_usage(message = ""):
-	if len(message) > 0:
-		sys.stderr.write(message+"\n")
-	sys.stderr.write("Please use '-h' for usage\n")
-	sys.exit(EC_BAD_ARGS)
-
-def fail(error_code):
-	message = {
-		EC_LOGIN_DENIED : "Unable to connect/login to fencing device",
-		EC_CONNECTION_LOST : "Connection lost",
-		EC_TIMED_OUT : "Connection timed out",
-		EC_WAITING_ON : "Failed: Timed out waiting to power ON",
-		EC_WAITING_OFF : "Failed: Timed out waiting to power OFF",
-		EC_STATUS : "Failed: Unable to obtain correct plug status"
-	}[error_code] + "\n"
-	sys.stderr.write(message)
-	sys.exit(error_code)
-
-def usage(avail_opt):
-	global all_opt
-
-	print "Usage:"
-	print "\t" + os.path.basename(sys.argv[0]) + " [options]"
-	print "Options:"
-
-	sorted_list = [ (key, all_opt[key]) for key in avail_opt ]
-	sorted_list.sort(lambda x, y: cmp(x[1]["order"], y[1]["order"]))
-
-	for key, value in sorted_list:
-		if len(value["help"]) != 0:
-			print "   " + value["help"]
-
-def metadata(avail_opt):
-	global all_opt
-
-	sorted_list = [ (key, all_opt[key]) for key in avail_opt ]
-	sorted_list.sort(lambda x, y: cmp(x[1]["order"], y[1]["order"]))
-
-	print "<parameters>"
-	for option, value in sorted_list:
-		if all_opt[option].has_key("shortdesc"):
-			print "\t<parameter name=\"" + option + "\" unique=\"1\" required=\"" + all_opt[option]["required"] + "\">"
-
-			default = ""
-			if all_opt[option].has_key("default"):
-				default = "default=\""+all_opt[option]["default"]+"\""
-
-			if all_opt[option]["getopt"].count(":") > 0:
-				print "\t\t<content type=\"string\" "+default+" />"
-			else:
-				print "\t\t<content type=\"boolean\" "+default+" />"
-			print "\t\t<shortdesc lang=\"en\">" + all_opt[option]["shortdesc"] + "</shortdesc>"
-			print "\t</parameter>"
-	print "</parameters>"
-
-def process_input(avail_opt):
-	global all_opt
-
-	##
-	## Set standard environment
-	#####
-	os.putenv("LANG", "C")
-	os.putenv("LC_ALL", "C")
-
-	##
-	## Prepare list of options for getopt
-	#####
-	getopt_string = ""
-	longopt_list = [ ]
-	for k in avail_opt:
-		if all_opt.has_key(k):
-			getopt_string += all_opt[k]["getopt"]
-		else:
-			fail_usage("Parse error: unknown option '"+k+"'")
-
-		if all_opt.has_key(k) and all_opt[k].has_key("longopt"):
-			if all_opt[k]["getopt"].endswith(":"):
-				longopt_list.append(all_opt[k]["longopt"] + "=")
-			else:
-				longopt_list.append(all_opt[k]["longopt"])
-
-	##
-	## Read options from command line or standard input
-	#####
-	if len(sys.argv) > 1:
-		try:
-			opt, args = getopt.gnu_getopt(sys.argv[1:], getopt_string, longopt_list)
-		except getopt.GetoptError, error:
-			fail_usage("Parse error: " + error.msg)
-
-		## Transform longopt to short one which are used in fencing agents
-		#####
-		old_opt = opt
-		opt = { }
-		for o in dict(old_opt).keys():
-			if o.startswith("--"):
-				for x in all_opt.keys():
-					if all_opt[x].has_key("longopt") and "--" + all_opt[x]["longopt"] == o:
-						opt["-" + all_opt[x]["getopt"]] = dict(old_opt)[o]
-			else:
-				opt[o] = dict(old_opt)[o]
-
-		## Compatibility Layer
-		#####
-		z = dict(opt)
-		if z.has_key("-T") == 1:
-			z["-o"] = "status"
-
-		opt = z
-		##
-		#####
-	else:
-		opt = { }
-		name = ""
-		for line in sys.stdin.readlines():
-			line = line.strip()
-			if ((line.startswith("#")) or (len(line) == 0)):
-				continue
-
-			(name, value) = (line + "=").split("=", 1)
-			value = value[:-1]
-
-			## Compatibility Layer
-			######
-			if name == "blade":
-				name = "port"
-			elif name == "option":
-				name = "action"
-			elif name == "fm":
-				name = "port"
-			elif name == "hostname":
-				name = "ipaddr"
-
-			##
-			######
-			if avail_opt.count(name) == 0:
-				fail_usage("Parse error: Unknown option '"+line+"'")
-
-			if all_opt[name]["getopt"].endswith(":"):
-				opt["-"+all_opt[name]["getopt"].rstrip(":")] = value
-			elif ((value == "1") or (value.lower() == "yes")):
-				opt["-"+all_opt[name]["getopt"]] = "1"
-	return opt
-
-##
-## This function checks input and answers if we want to have same answers 
-## in each of the fencing agents. It looks for possible errors and run
-## password script to set a correct password
-######
-def check_input(device_opt, opt):
-	global all_opt
-
-	options = dict(opt)
-	options["device_opt"] = device_opt
-
-	## Set requirements that should be included in metadata
-	#####
-	if device_opt.count("login") and device_opt.count("no_login") == 0:
-		all_opt["login"]["required"] = "1"
-	else:
-		all_opt["login"]["required"] = "0"
-
-	## Process special options (and exit)
-	#####
-	if options.has_key("-h"): 
-		usage(device_opt)
-		sys.exit(0)
-
-	if options.has_key("-o") and options["-o"].lower() == "metadata":
-		metadata(device_opt)
-		sys.exit(0)
-
-	if options.has_key("-V"):
-		print RELEASE_VERSION, BUILD_DATE
-		print REDHAT_COPYRIGHT
-		sys.exit(0)
-
-	## Set default values
-	#####
-	for opt in device_opt:
-		if all_opt[opt].has_key("default"):
-			getopt = "-" + all_opt[opt]["getopt"].rstrip(":")
-			if 0 == options.has_key(getopt):
-				options[getopt] = all_opt[opt]["default"]
-
-	options["-o"]=options["-o"].lower()
-
-	if options.has_key("-v"):
-		options["log"] = LOG_MODE_VERBOSE
-	else:
-		options["log"] = LOG_MODE_QUIET
-
-	if 0 == ["on", "off", "reboot", "status", "list", "monitor"].count(options["-o"].lower()):
-		fail_usage("Failed: Unrecognised action '" + options["-o"] + "'")
-
-	if (0 == options.has_key("-l")) and device_opt.count("login") and (device_opt.count("no_login") == 0):
-		fail_usage("Failed: You have to set login name")
-
-	if 0 == options.has_key("-a"):
-		fail_usage("Failed: You have to enter fence address")
-
-	if (device_opt.count("no_password") == 0):
-		if 0 == device_opt.count("identity_file"):
-			if 0 == (options.has_key("-p") or options.has_key("-S")):
-				fail_usage("Failed: You have to enter password or password script")
-			else: 
-				if 0 == (options.has_key("-p") or options.has_key("-S") or options.has_key("-k")):
-					fail_usage("Failed: You have to enter password, password script or identity file")
-
-	if 0 == options.has_key("-x") and 1 == options.has_key("-k"):
-		fail_usage("Failed: You have to use identity file together with ssh connection (-x)")
-
-	if 1 == options.has_key("-k"):
-		if 0 == os.path.isfile(options["-k"]):
-			fail_usage("Failed: Identity file " + options["-k"] + " does not exist")
-
-	if (0 == ["list", "monitor"].count(options["-o"].lower())) and (0 == options.has_key("-n")) and (device_opt.count("port")):
-		fail_usage("Failed: You have to enter plug number")
-
-	if options.has_key("-S"):
-		options["-p"] = os.popen(options["-S"]).read().rstrip()
-
-	if options.has_key("-D"):
-		try:
-			options["debug_fh"] = file (options["-D"], "w")
-		except IOError:
-			fail_usage("Failed: Unable to create file "+options["-D"])
-
-	if options.has_key("-v") and options.has_key("debug_fh") == 0:
-		options["debug_fh"] = sys.stderr
-
-	## VMware
-	#######
-	if options.has_key("-B"):
-		options["-P"] = os.popen(options["-B"]).read().rstrip()
-
-	if (device_opt.count("vmlogin") and (not options.has_key("-L"))):
-		fail_usage("Failed: You have to set login name for VMware ESX management console")
-
-	if (options.has_key("-L") and (not (options.has_key("-P") or options.has_key("-B")))):
-		fail_usage("Failed: You have to enter password or password script for VMware ESX management console")
-
-	if (["list", "monitor"].count(options["-o"])==0 and (options.has_key("-L") and (not (options.has_key("-n"))))):
-		fail_usage("Failed: You have to enter virtual machine name")
-
-	return options
-	
-def wait_power_status(tn, options, get_power_fn):
-	for dummy in xrange(POWER_TIMEOUT):
-		if get_power_fn(tn, options) != options["-o"]:
-			time.sleep(1)
-		else:
-			return 1
-	return 0
-
-def fence_action(tn, options, set_power_fn, get_power_fn, get_outlet_list = None):
-	if (options["-o"] == "list") and (0 == options["device_opt"].count("port")) and (0 == options["device_opt"].count("partition")):
-		print "N/A"
-		return
-	elif (options["-o"] == "list" and get_outlet_list == None):
-		## @todo: exception?
-		## This is just temporal solution, we will remove default value
-		## None as soon as all existing agent will support this operation 
-		print "NOTICE: List option is not working on this device yet"
-		return
-	elif (options["-o"] == "list") or ((options["-o"] == "monitor") and 1 == options["device_opt"].count("port")):
-		outlets = get_outlet_list(tn, options)
-		## keys can be numbers (port numbers) or strings (names of VM)
-		for o in outlets.keys():
-			(alias, status) = outlets[o]
-			if options["-o"] != "monitor":
-				print o + options["-C"] + alias	
-		return
-
-	status = get_power_fn(tn, options)
-
-	if status != "on" and status != "off":  
-		fail(EC_STATUS)
-
-	if options["-o"] == "on":
-		if status == "on":
-			print "Success: Already ON"
-		else:
-			set_power_fn(tn, options)
-			if wait_power_status(tn, options, get_power_fn):
-				print "Success: Powered ON"
-			else:
-				fail(EC_WAITING_ON)
-	elif options["-o"] == "off":
-		if status == "off":
-			print "Success: Already OFF"
-		else:
-			set_power_fn(tn, options)
-			if wait_power_status(tn, options, get_power_fn):
-				print "Success: Powered OFF"
-			else:
-				fail(EC_WAITING_OFF)
-	elif options["-o"] == "reboot":
-		if status != "off":
-			options["-o"] = "off"
-			set_power_fn(tn, options)
-			if wait_power_status(tn, options, get_power_fn) == 0:
-				fail(EC_WAITING_OFF)
-		options["-o"] = "on"
-		set_power_fn(tn, options)
-		if wait_power_status(tn, options, get_power_fn) == 0:
-			sys.stderr.write('Timed out waiting to power ON\n')
-		print "Success: Rebooted"
-	elif options["-o"] == "status":
-		print "Status: " + status.upper()
-	elif options["-o"] == "monitor":
-		1
-
-def fence_login(options):
-	try:
-		re_login = re.compile("(login: )|(Login Name:  )|(username: )|(User Name :)", re.IGNORECASE)
-		re_pass  = re.compile("password", re.IGNORECASE)
-
-		if options.has_key("-z"):
-			command = '%s %s %s' % (SSL_PATH, options["-a"], "443")
-			conn = fspawn(command)
-		elif options.has_key("-x") and 0 == options.has_key("-k"):
-			command = '%s %s@%s' % (SSH_PATH, options["-l"], options["-a"])
-			if options.has_key("ssh_options"):
-				command += ' ' + options["ssh_options"]
-			conn = fspawn(command)
-
-			if options.has_key("telnet_over_ssh"):
-				#This is for stupid ssh servers (like ALOM) which behave more like telnet (ignore name and display login prompt)
-				result = conn.log_expect(options, [ re_login, "Are you sure you want to continue connecting (yes/no)?" ], LOGIN_TIMEOUT)
-				if result == 1:
-					conn.sendline("yes") # Host identity confirm
-					conn.log_expect(options, re_login, LOGIN_TIMEOUT)
-
-				conn.sendline(options["-l"])
-				conn.log_expect(options, re_pass, LOGIN_TIMEOUT)
-			else:
-				result = conn.log_expect(options, [ "ssword:", "Are you sure you want to continue connecting (yes/no)?" ], LOGIN_TIMEOUT)
-				if result == 1:
-					conn.sendline("yes")
-					conn.log_expect(options, "ssword:", LOGIN_TIMEOUT)
-
-			conn.sendline(options["-p"])
-			conn.log_expect(options, options["-c"], LOGIN_TIMEOUT)
-		elif options.has_key("-x") and 1 == options.has_key("-k"):
-			conn = fspawn('%s %s@%s -i %s' % (SSH_PATH, options["-l"], options["-a"], options["-k"]))
-			result = conn.log_expect(options, [ options["-c"], "Are you sure you want to continue connecting (yes/no)?", "Enter passphrase for key '"+options["-k"]+"':" ], LOGIN_TIMEOUT)
-			if result == 1:
-				conn.sendline("yes")
-				conn.log_expect(options, [ options["-c"], "Enter passphrase for key '"+options["-k"]+"':"] , LOGIN_TIMEOUT)
-			if result != 0:
-				if options.has_key("-p"):
-					conn.sendline(options["-p"])
-					conn.log_expect(options, options["-c"], LOGIN_TIMEOUT)
-				else:
-					fail_usage("Failed: You have to enter passphrase (-p) for identity file")
-		else:
-			conn = fspawn(TELNET_PATH)
-			conn.send("set binary\n")
-			conn.send("open %s\n"%(options["-a"]))
-			conn.log_expect(options, re_login, LOGIN_TIMEOUT)
-			conn.send(options["-l"]+"\r\n")
-			conn.log_expect(options, re_pass, SHELL_TIMEOUT)
-			conn.send(options["-p"]+"\r\n")
-			conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
-	except pexpect.EOF:
-		fail(EC_LOGIN_DENIED) 
-	except pexpect.TIMEOUT:
-		fail(EC_LOGIN_DENIED)
-	return conn
diff --git a/fence/agents/lib/telnet_ssl.py b/fence/agents/lib/telnet_ssl.py
deleted file mode 100644
index 5d0c981..0000000
--- a/fence/agents/lib/telnet_ssl.py
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/python
-
-#####
-## simple telnet client with SSL support 
-##
-## ./telnet_ssl host port
-#####
-
-import sys, socket, string, fcntl, os , time
-from OpenSSL import SSL
-
-#BEGIN_VERSION_GENERATION
-RELEASE_VERSION=""
-REDHAT_COPYRIGHT=""
-BUILD_DATE=""
-#END_VERSION_GENERATION
-
-def main():
-	hostname = None
-	port = None
-
-	if (len(sys.argv) != 3):
-		print "Error: You have to enter hostname and port number\n"
-		sys.exit(-1)
-
-	hostname = sys.argv[1]
-	port = int(sys.argv[2])
-
-	try:
-		s = socket.socket (socket.AF_INET, socket.SOCK_STREAM)
-		s.connect((hostname,port))
-		ctx = SSL.Context(SSL.SSLv23_METHOD)
-		conn = SSL.Connection(ctx, s)
-		conn.set_connect_state()
-	except socket.error, e:
-		print "Error: Unable to connect to %s:%s %s" % (hostname, port, str(e))
-		sys.exit(-1)
-
-	fcntl.fcntl(sys.stdin, fcntl.F_SETFL, os.O_NONBLOCK) 
-	s.settimeout(0)
-
-	while 1:
-		try:
-			write_buff = sys.stdin.readline()
-			if (len(write_buff) > 0):
-				write_buff = string.rstrip(write_buff)
-				i = 10
-				while i > 0:
-					i = i-1
-					try:
-						conn.send(write_buff + "\r\n")
-						i = -1
-					except SSL.WantReadError:
-						## We have to wait for connect, mostly just for first time
-						time.sleep(1)
-				if i == 0:
-					sys.exit(-2)
-		except IOError:
-			1
-
-		try:
-			read_buff = conn.recv(4096)
-			print read_buff
-			sys.stdout.flush()
-		except SSL.WantReadError:
-			1
-		except SSL.ZeroReturnError:
-			break
-
-
-if __name__ == "__main__":
-	main()
diff --git a/fence/agents/lpar/Makefile b/fence/agents/lpar/Makefile
deleted file mode 100644
index ef7d91a..0000000
--- a/fence/agents/lpar/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-include ../../../make/defines.mk
-
-TARGET= fence_lpar
-
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/lpar/fence_lpar.py b/fence/agents/lpar/fence_lpar.py
deleted file mode 100644
index 56c3153..0000000
--- a/fence/agents/lpar/fence_lpar.py
+++ /dev/null
@@ -1,120 +0,0 @@
-#!/usr/bin/python
-
-#####
-##
-## The Following Agent Has Been Tested On:
-##
-##  Version       
-## +---------------------------------------------+
-##  Tested on HMC
-##
-#####
-
-import sys, re, pexpect
-sys.path.append("@FENCEAGENTSLIBDIR@")
-from fencing import *
-
-#BEGIN_VERSION_GENERATION
-RELEASE_VERSION=""
-REDHAT_COPYRIGHT=""
-BUILD_DATE=""
-#END_VERSION_GENERATION
-
-def get_power_status(conn, options):
-	try:
-		conn.send("lssyscfg -r lpar -m "+ options["-s"] +" --filter 'lpar_names=" + options["-n"] + "'\n")
-		conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
-	except pexpect.EOF:
-		fail(EC_CONNECTION_LOST)
-	except pexpect.TIMEOUT:
-		fail(EC_TIMED_OUT)
-				
-	status = re.compile(",state=(.*?),", re.IGNORECASE).search(conn.before).group(1)
-
-	##
-	## Transformation to standard ON/OFF status if possible
-	if status == "Running":
-		status = "on"
-	else:
-		status = "off"
-
-	return status
-
-def set_power_status(conn, options):
-	try:
-		if options["-o"] == "on":
-			conn.send("chsysstate -o on -r lpar -m " + options["-s"] + 
-				" -n " + options["-n"] + 
-				" -f `lssyscfg -r lpar -F curr_profile " +
-				" -m " + options["-s"] +
-				" --filter \"lpar_names="+ options["-n"] +"\"`\n" )
-		else:
-			conn.send("chsysstate -o shutdown -r lpar --immed" +
-				" -m " + options["-s"] + " -n " + options["-n"] + "\n")		
-		conn.log_expect(options, options["-c"], POWER_TIMEOUT)
-	except pexpect.EOF:
-		fail(EC_CONNECTION_LOST)
-	except pexpect.TIMEOUT:
-		fail(EC_TIMED_OUT)
-
-def get_lpar_list(conn, options):
-	outlets = { }
-	try:
-		conn.send("lssyscfg -r lpar -m " + options["-s"] + 
-			" -F name:state\n")
-		conn.log_expect(options, options["-c"], POWER_TIMEOUT)
-
-		## We have to remove first line (command) and last line (part of new prompt)
-		####
-		res = re.search("^.+?\n(.*)\n.*$", conn.before, re.S)
-
-		if res == None:
-			fail_usage("Unable to parse output of list command")
-		
-		lines = res.group(1).split("\n")
-		for x in lines:
-			s = x.split(":")
-			outlets[s[0]] = ("", s[1])
-	except pexpect.EOF:
-		fail(EC_CONNECTION_LOST)
-	except pexpect.TIMEOUT:
-		fail(EC_TIMED_OUT)
-
-	return outlets
-
-def main():
-	device_opt = [  "help", "version", "agent", "quiet", "verbose", "debug",
-			"action", "ipaddr", "login", "passwd", "passwd_script",
-			"secure", "partition", "managed" ]
-
-	options = check_input(device_opt, process_input(device_opt))
-
-	## 
-	## Fence agent specific defaults
-	#####
-	if 0 == options.has_key("-c"):
-		options["-c"] = ":~>"
-
-	if 0 == options.has_key("-x"):
-		fail_usage("Failed: You have to use ssh connection (-x) to fence device")
-
-	if 0 == options.has_key("-s"):
-		fail_usage("Failed: You have to enter name of managed system")
-
-        if (0 == ["list", "monitor"].count(options["-o"].lower())) and (0 == options.has_key("-n")):
-                fail_usage("Failed: You have to enter name of the partition")
-
-	##
-	## Operate the fencing device
-	####
-	conn = fence_login(options)
-	fence_action(conn, options, set_power_status, get_power_status, get_lpar_list)
-
-	##
-	## Logout from system
-	######
-	conn.send("quit\r\n")
-	conn.close()
-
-if __name__ == "__main__":
-	main()
diff --git a/fence/agents/manual/Makefile b/fence/agents/manual/Makefile
deleted file mode 100644
index 490100f..0000000
--- a/fence/agents/manual/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-TARGET= fence_ack_manual
-
-SBINDIRT=$(TARGET)
-
-all: ${TARGET}
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-
-# Using manual override instead of the binary version.
-# (this version does not require any configuration params
-# in cluster.conf, but fencing must fail first)
-${TARGET}: 
-	cp $(S)/$@.sh $@
-
-clean: generalclean
diff --git a/fence/agents/manual/fence_ack_manual.sh b/fence/agents/manual/fence_ack_manual.sh
deleted file mode 100644
index 83102aa..0000000
--- a/fence/agents/manual/fence_ack_manual.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/bash
-#
-# Manual override after fencing has failed.
-#
-
-if [ "$1" = "-n" ]; then
-	shift
-fi
-
-if [ -z "$1" ] || [ "$1" = "-h" ]; then
-	echo "usage:"
-        echo " 	$0 <nodename>"
-        echo " 	$0 -n <nodename>"
-	echo 
-	echo "The -n flag exists to preserve compatibility with previous "
-	echo "releases of $0, and is no longer required."
-	exit 1
-fi
-
-declare answer
-
-echo "About to override fencing for $1."
-echo "Improper use of this command can cause severe file system damage."
-echo
-read -p "Continue [NO/absolutely]? " answer
-
-if [ "$answer" != "absolutely" ]; then
-	echo "Aborted."
-	exit 1
-fi
-
-while ! [ -e /var/run/cluster/fenced_override ]; do
-	sleep 1
-done
-
-echo $1>/var/run/cluster/fenced_override
-echo Done
diff --git a/fence/agents/mcdata/Makefile b/fence/agents/mcdata/Makefile
deleted file mode 100644
index ca2facf..0000000
--- a/fence/agents/mcdata/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-TARGET= fence_mcdata
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/mcdata/fence_mcdata.pl b/fence/agents/mcdata/fence_mcdata.pl
deleted file mode 100644
index e16282b..0000000
--- a/fence/agents/mcdata/fence_mcdata.pl
+++ /dev/null
@@ -1,282 +0,0 @@
-#!/usr/bin/perl
-
-# This works on the following firmware versions:
-#   01.03.00
-#   02.00.00
-#   04.01.00
-#   04.01.02
-
-use Getopt::Std;
-use Net::Telnet ();
-
-# Get the program name from $0 and strip directory names
-$_=$0;
-s/.*\///;
-my $pname = $_;
-
-$opt_o = 'disable';        # Default fence action
-
-# WARNING!! Do not add code bewteen "#BEGIN_VERSION_GENERATION" and 
-# "#END_VERSION_GENERATION"  It is generated by the Makefile
-
-#BEGIN_VERSION_GENERATION
-$RELEASE_VERSION="";
-$REDHAT_COPYRIGHT="";
-$BUILD_DATE="";
-#END_VERSION_GENERATION
-
-
-sub usage
-{
-    print "Usage:\n";
-    print "\n";
-    print "$pname [options]\n";
-    print "\n";
-    print "Options:\n";
-    print "  -a <ip>          IP address or hostname of switch\n";
-    print "  -h               usage\n";
-    print "  -l <name>        Login name\n";
-    print "  -n <num>         Port number to disable\n";
-    print "  -o <string>      Action:  disable (default) or enable\n";
-    print "  -p <string>      Password for login\n";
-    print "  -S <path>        Script to run to retrieve login password\n";
-    print "  -q               quiet mode\n";
-    print "  -V               version\n";
-
-    exit 0;
-}
-
-sub fail
-{
-  ($msg) = @_;
-  print $msg."\n" unless defined $opt_q;
-  $t->close if defined $t;
-  exit 1;
-}
-
-sub fail_usage
-{
-  ($msg)=@_;
-  print STDERR $msg."\n" if $msg;
-  print STDERR "Please use '-h' for usage.\n";
-  exit 1;
-}
-
-sub version
-{
-  print "$pname $RELEASE_VERSION $BUILD_DATE\n";
-  print "$REDHAT_COPYRIGHT\n" if ( $REDHAT_COPYRIGHT );
-
-  exit 0;
-}
-
-sub get_options_stdin
-{
-    my $opt;
-    my $line = 0;
-    while( defined($in = <>) )
-    {
-        $_ = $in;
-        chomp;
-
-	# strip leading and trailing whitespace
-        s/^\s*//;
-        s/\s*$//;
-
-	# skip comments
-        next if /^#/;
-
-        $line+=1;
-        $opt=$_;
-        next unless $opt;
-
-        ($name,$val)=split /\s*=\s*/, $opt;
-
-        if ( $name eq "" )
-        {  
-           print STDERR "parse error: illegal name in option $line\n";
-           exit 2;
-	}
-	
-        # DO NOTHING -- this field is used by fenced
-	elsif ($name eq "agent" ) { } 
-
-        elsif ($name eq "ipaddr" ) 
-	{
-            $opt_a = $val;
-        } 
-	elsif ($name eq "login" ) 
-	{
-            $opt_l = $val;
-        } 
-        elsif ($name eq "option" )
-        {
-            $opt_o = $val;
-        }
-	elsif ($name eq "passwd" ) 
-	{
-            $opt_p = $val;
-        }
-	elsif ($name eq "passwd_script" )
-	{
-		$opt_S = $val;
-	}
-	elsif ($name eq "port" ) 
-	{
-            $opt_n = $val;
-        } 
-    }
-}
-
-sub telnet_error
-{ 
-  fail "failed: telnet returned: ".$t->errmsg;
-}
-
-######################################################################33
-# MAIN
-
-if (@ARGV > 0) {
-   getopts("a:hl:n:o:p:S:qV") || fail_usage ;
-
-   usage if defined $opt_h;
-   version if defined $opt_V;
-
-   fail_usage "Unknown parameter." if (@ARGV > 0);
-
-   fail_usage "No '-a' flag specified." unless defined $opt_a;
-   fail_usage "No '-n' flag specified." unless defined $opt_n;
-   fail_usage "No '-l' flag specified." unless defined $opt_l;
-
-   if (defined $opt_S) {
-     $pwd_script_out = `$opt_S`;
-     chomp($pwd_script_out);
-     if ($pwd_script_out) {
-        $opt_p = $pwd_script_out;
-     }
-   }
-
-   fail_usage "No '-p' or '-S' flag specified." unless defined $opt_p;
-   fail_usage "Unrecognised action '$opt_o' for '-o' flag"
-      unless $opt_o =~ /^(disable|enable)$/i;
-
-} else {
-   get_options_stdin();
-
-   fail "failed: no IP address" unless defined $opt_a;
-   fail "failed: no plug number" unless defined $opt_n;
-   fail "failed: no login name" unless defined $opt_l;
-
-   if (defined $opt_S) {
-     $pwd_script_out = `$opt_S`;
-     chomp($pwd_script_out);
-     if ($pwd_script_out) {
-        $opt_p = $pwd_script_out;
-     }
-   }
-
-   fail "failed: no password" unless defined $opt_p;
-   fail "failed: unrecognised action: $opt_o"
-      unless $opt_o =~ /^(disable|enable)$/i;
-}
-
-
-my $block=1;
-$_=$opt_o;
-if(/disable/)
-{
-    $block=1
-}
-elsif(/enable/)
-{
-    $block=0
-}
-else
-{
-    fail "failed: unrecognised action: $opt_o"
-}
-
-#
-# Set up and log in
-#
-
-$t = new Net::Telnet;
-
-$t->errmode(\&telnet_error);
-$t->open($opt_a);
-
-$t->waitfor('/sername:/');
-
-# Send Username
-$t->print($opt_l);
-
-# Send Password
-$t->waitfor('/assword:/');
-$t->print($opt_p);
-$t->waitfor('/\>/');
-
-#> # Set switch to comma delimited output
-#> $t->print("commadelim 1");
-#> $t->waitfor('/\>/');
-
-# Block/Unblock the desired port
-$t->print("config port blocked $opt_n $block");
-($text, $match) = $t->waitfor('/\>/');
-
-# Verfiy that the port has been blocked/unblocked
-$t->print("config port show $opt_n");
-($text, $match) = $t->waitfor('/\>/');
-
-# scan the port configurations to make sure that
-# the port is in the state we told it to be in
-#
-# Output from the prvious command will look like:
-# 
-# Root> config port show 0
-#
-# Port Information
-# Port Number:          0
-# Name:                 name
-# Blocked:              true
-# Extended Distance:    false
-# Type:                 gPort
-# 
-my $fail=1;
-
-@lines = split /\n/,$text;
-foreach my $line (@lines)
-{
-   my $field = "";
-   my $b_state = "";
-
-   if ( $line =~ /^(.*):\s*(\S*)/ )
-   {
-      $field = $1;
-      $b_state = $2;
-   }
-   next unless ( $field eq "Blocked" );
-   if ( ($block && $b_state eq "true") ||
-        (!$block && $b_state eq "false") )
-   {
-      $fail = 0;
-   }
-   last;
-}
-
-# log out of the switch
-$t->print("logout");
-$t->close();
-
-if($fail)
-{
-   print "failed: unexpected port state\n" unless $opt_q;
-}
-else
-{
-   print "success: port $opt_n ".($block?"disabled":"enabled")."\n" 
-      unless defined $opt_q;
-}
-
-exit $fail;
-
-
diff --git a/fence/agents/rackswitch/Makefile b/fence/agents/rackswitch/Makefile
deleted file mode 100644
index 71334d5..0000000
--- a/fence/agents/rackswitch/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
-TARGET= fence_rackswitch
-
-SBINDIRT=$(TARGET)
-
-all: ${TARGET}
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-OBJS=	do_rack.o
-
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${libdir}
-
-${TARGET}: ${OBJS}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-clean: generalclean
-
--include $(OBJS:.o=.d)
diff --git a/fence/agents/rackswitch/do_rack.c b/fence/agents/rackswitch/do_rack.c
deleted file mode 100644
index c1ef1cf..0000000
--- a/fence/agents/rackswitch/do_rack.c
+++ /dev/null
@@ -1,748 +0,0 @@
-#include "do_rack.h"
-
-char *pname = "fence_rack";
-
-int quiet_flag = 0;
-int verbose_flag = 0;
-int debug_flag = 0;
-
-char ipaddr[256];
-char portnumber[256];
-char username[256];
-char password[256];
-char arg[256];
-char name[256];
-char pwd_script[PATH_MAX] = { 0, };
-
-char readbuf[MAXBUF];
-char writebuf[MAXBUF];
-int sock;
-
-char op_login = 0x7e; 	        /* 126*/ 
-char op_action = 0x66;	        /* 102 */
-char ack_login = 0x7D;	        /* 125 */
-
-char action_idle = 0x00;
-char action_reset = 0x01;
-char action_off = 0x02;
-char action_offon = 0x03;
-
-char configuration_request = 0x5b;   /* 91 */
-char config_reply = 0x5c;            /* 92 */
-char config_general = 0x01;
-char config_section1 = 0x02;
-char config_section2 = 0x03;
-char config_section3 = 0x04;
-
-char message_status = 0x65;         /* 101 */
-
-char login_deny = 0xFF;          
-
-int time_out = 60;
-
-void ignore_message_status(void);
-int wait_frame(char);
-
-/*
- * scan input, waiting for a given frame
- */
-int wait_frame(char frame_id)
-{
-  int read_more = 1;
-  int success = 0;
-  int n;
-  char target = frame_id;
-
-  if(debug_flag){printf("%s: Looking for frametype 0x%.2x\n",name,target);}
-  read_more = 1;
-  while(read_more){
-    n = read(sock,readbuf,1);
-    if(debug_flag){printf("%s: Found frametype 0x%.2x\n",name,readbuf[0]);}
-    if(readbuf[0] == target){
-      read_more = 0;
-      success = 1;
-    }
-    else{
-      if(readbuf[0] == message_status){
-	ignore_message_status();
-	read_more = 1;
-      }
-      else{
-	if(debug_flag){printf("%s: Got unexpected frame from switch\n",name);}
-	read_more = 0;
-	success = 0;
-      }
-    }
-  }
-  return(success);
-}  
-
-void ignore_message_status(void)
-{
-  int n,i;
-  int read_more = 1;
-  int number_of_temp;
-  int number_of_config_mobo;
-    
-  if(debug_flag){printf("%s: Ignoring message-status\n",name);}
-  read_more=1;
-  while(read_more){
-    n = read(sock,readbuf,1); /* status */
-    if(n == 1)
-      read_more = 0;
-  }
-
-  read_more = 1;
-  while(read_more){         /* Date & time */
-    n = read(sock,readbuf,1);
-    if(readbuf[0] == '\0'){
-      read_more = 0;
-    }
-    else{
-      read_more = 1;
-    }
-  }
-   
-  read_more = 1;
-  number_of_temp = 0;
-  n = read(sock,readbuf,1); /* Temprature Input count */
-  number_of_temp = (int)readbuf[0];
-  
-  for(i=0;i<number_of_temp;i++){
-    read_more = 1;
-    while(read_more){
-      n = read(sock,readbuf,1); /* Temprature input ID */
-      n = read(sock,readbuf,8); /* Temprature Value, Fahrenheit */
-      n = read(sock,readbuf,8); /* Temprature Vaule, Celcius */
-      n = read(sock,readbuf,1); /* Temprature Alarm */
-    }
-  }
-  number_of_config_mobo = 0;
-  for(i=4;i>0;i--){
-    read_more = 1;	
-    while(read_more){
-      n=read(sock,readbuf,1);
-      if(n == 1){
-	read_more = 0;
-	number_of_config_mobo = number_of_config_mobo + (int)(readbuf[0]<<(8*(i-1)));
-      }
-    }
-  }
-  for(i=0;i<number_of_config_mobo;i++){
-    n = read(sock,readbuf,4); /* Motherboard ID */
-    n = read(sock,readbuf,1); /* Motherboard status */
-  }
-}
-
-
-
-void print_usage(void)
-{
-  printf("Usage:\n");
-  printf("\n");
-  printf("%s [options]\n"
-         "\n"
-         "Options:\n"
-         "  -h               usage\n"
-	 "  -a <ip>          IP address for RackSwitch\n"
-	 "  -n <dec num>     Physical plug number on RackSwitch\n"
-	 "  -l <string>      Username\n"
-	 "  -p <string>      Password\n"
-	 "  -S <path>        Script to retrieve password\n"
-	 "  -v               Verbose\n"
-	 "  -q               Quiet\n"
-         "  -V               Version information\n", pname);
-}
-
-
-
-void get_options(int argc, char **argv)
-{
-  int c;
-  char *value;
-
-  if (argc > 1){  
-    /*
-     * Command line input
-     */
-    while ((c = getopt(argc, argv, "ha:n:l:p:S:vqVd")) != -1)
-      {
-	switch(c)
-	  {
-	  case 'h':
-	    print_usage();
-	    exit(DID_SUCCESS);
-	
-	  case 'a':
-	    strncpy(ipaddr,optarg,254);
-	    break;
-
-	  case 'n':
-	    strncpy(portnumber,optarg,254);
-	    break;
-
-	  case 'l':
-	    strncpy(username,optarg,254);	
-	    break;
-
-	  case 'p':
-	    strncpy(password,optarg,254);
-	    break;
-
-	  case 'S':
-		strncpy(pwd_script, optarg, sizeof(pwd_script));
-		pwd_script[sizeof(pwd_script) - 1] = '\0';
-		break;
-
-	  case 'v':
-	    verbose_flag = 1;
-	    break;
-
-	  case 'q':
-	    quiet_flag = 1;
-	    break;
-
-	  case 'd':
-	    debug_flag = 1;
-	    break;
-
-	  case 'V':
-	    printf("%s %s (built %s %s)\n", pname, RELEASE_VERSION,
-		   __DATE__, __TIME__);
-	    printf("%s\n", REDHAT_COPYRIGHT);
-	    exit(DID_SUCCESS);
-	    break;
-
-	  case ':':
-	  case '?':
-	    fprintf(stderr, "Please use '-h' for usage.\n");
-	    exit(DID_FAILURE);
-	    break;
-
-	  default:
-	    fprintf(stderr, "Bad programmer! You forgot to catch the %c flag\n", c);
-	    exit(DID_FAILURE);
-	    break;
-
-	  }
-      }
-    strcpy(name, pname);
-  }
-  else{
-    errno = 0;
-    while(fgets(arg, 256, stdin) != NULL){    
- if( (value = strchr(arg, '\n')) == NULL){
-        fprintf(stderr, "line too long: '%s'\n", arg);
-	exit(DID_FAILURE);
-      }
-      *value = 0;
-      if( (value = strchr(arg, '=')) == NULL){
-        fprintf(stderr, "invalid input: '%s'\n", arg);
-	exit(DID_FAILURE); 
-      }   
-      *value = 0;
-      value++;
-    /*  bahfuck. "agent" is not passed to us anyway
-     *  if (!strcmp(arg, "agent")){
-      *  strcpy(name, value);
-       * pname = name;
-      *}
-      */
-      strcpy(name, pname);
-      if (!strcmp(arg, "ipaddr"))
-        strcpy(ipaddr, value);
-      
-      if (!strcmp(arg, "portnumber"))
-        strcpy(portnumber, value);
-      
-      if (!strcmp(arg, "username"))
-        strcpy(username, value);
-      
-      if (!strcmp(arg, "password"))
-        strcpy(password, value);
-
-	  if (!strcasecmp(arg, "passwd_script")) {
-		strncpy(pwd_script, optarg, sizeof(pwd_script));
-		pwd_script[sizeof(pwd_script) - 1] = '\0';
-	  }
-    }
-    errno = 0;
-    
-  }
-
-  if (pwd_script[0] != '\0') {
-	FILE *fp;
-	char pwd_buf[1024];
-
-	fp = popen(pwd_script, "r");
-	if (fp != NULL) {
-		ssize_t len = fread(pwd_buf, 1, sizeof(pwd_buf), fp);
-		if (len > 0) {
-			char *p;
-			p = strchr(pwd_buf, '\n');
-			if (p != NULL)
-				*p = '\0';
-			p = strchr(pwd_buf, '\r');
-			if (p != NULL)
-				*p = '\0';
-			strncpy(password, pwd_buf, sizeof(password));
-			password[sizeof(password) - 1] = '\0';
-		}
-		pclose(fp);
-	}
-  }
-}
-
-static void sig_alarm(int sig)
-{
- if(!quiet_flag){
-   fprintf(stderr,"failed: %s: Timeout, nothing happened for %d seconds.\n", pname, time_out);
-   fprintf(stderr,"failed: %s: Perhaps you should inspect the RackSwitch at %s\n",pname,ipaddr);
- }
- exit(DID_FAILURE);	
-}
-
-
-int main(int argc, char **argv)
-{
-  int n,i,j,pnumb;
-  int ip_portnumber = 1025;
-  char boardnum = 0x00;
-  /*char number_of_action = 0x01;*/
-  int number_of_config_mobo = 0;
-  int number_of_section_config_mobo = 0;
-  int exit_status= 0;
-  int success_off = 0;
-  /*int success_on = 0;*/
-  int read_more = 1;
-  struct sockaddr_in rackaddr; 
-  
-  /*char mobo_enabled = 0x01;*/
-  /*char mobo_default_status = 0x00;*/
-  /*char mobo_output_status = 0x00;*/
-  int this_mobo = 0;
-  /*int mobo_id = 0;*/
-  /*int our_mobo = 0;*/
-  int number_of_temp = 0;
-
-  memset(arg, 0, 256);
-  memset(name, 0, 256);
-  memset(ipaddr, 0, 256);
-  memset(portnumber,0,256);
-  memset(username,0,256);
-  memset(password,0,256);
-
-  /*
-   * Ensure that we always get out of the fencing agent
-   * even if things get fucked up and we get no replies
-   */
-  signal(SIGALRM, &sig_alarm);
-  alarm(time_out);
-  get_options(argc, argv);
-
-  if(name[0] == '\0')
-  {
-    if(!quiet_flag)
-      fprintf(stderr,"failed: no name for this program\n");
-    exit(DID_FAILURE);
-  }
-  
-  if(ipaddr[0] == '\0')
-  {
-    if(!quiet_flag)
-      fprintf(stderr,"failed: %s, no IP address given\n",name);
-    exit(DID_FAILURE);
-  }
-  if (portnumber[0] == '\0')
-  {
-    if(!quiet_flag)
-      fprintf(stderr,"failed: %s, no portnumber given\n",name);
-    exit(DID_FAILURE);
-  }
-  if (username[0] == '\0')
-  {
-    if(!quiet_flag)
-      fprintf(stderr,"failed: %s, no username given\n",name);
-    exit(DID_FAILURE);
-  }
-
-  if (password[0] == '\0')
-  {
-    if(!quiet_flag)
-      fprintf(stderr,"failed: %s, no password given\n",name);
-    exit(DID_FAILURE);
-  }
-  /*
-   * Port number given to us as a string.
-   * Does the number make sense?
-   */
-  pnumb = 0;
-  for(n=0;(portnumber[n]!='\0');n++){
-    if((portnumber[n] < 48) || (portnumber[n] > 57)){
-      if(!quiet_flag)
-	fprintf(stderr,"failed: %s, invalid port number\n",name);
-      exit(1);
-    }
-    pnumb = ((pnumb * 10) + ((int)(portnumber[n]) - 48));
-  }
-  /*
-   * what section of the rack is this port part of?
-   * The switch has 4 "subsections", called boardnum here
-   */
-  if((pnumb > 0) && (pnumb < 47))
-    boardnum = 0x02;
-  if((pnumb > 46) && (pnumb < 94))
-    boardnum = 0x03;
-  if((pnumb > 93) && (pnumb < 137))
-    boardnum = 0x04;
-  if((pnumb < 1) || (pnumb> 136)){
-    boardnum = 0x00;
-    if(!quiet_flag)
-      fprintf(stderr,"failed: %s, the portnumber given is not in the range [1 - 136]\n",name);
-    exit(DID_FAILURE);
-  } 
-  /*********************************************
-   ***
-   *** set up TCP connection to the rackswitch
-   ***
-   ********************************************/
-  if ((sock = socket(AF_INET,SOCK_STREAM,0)) < 0){
-    fprintf(stderr,"failed: %s: socket error, %s\n",name,strerror(errno));
-    exit(DID_FAILURE);
-  }
-  
-  bzero(&rackaddr,sizeof(rackaddr));
-  rackaddr.sin_family = AF_INET;
-  rackaddr.sin_port = htons(ip_portnumber);
-
-  if(inet_pton(AF_INET,ipaddr,&rackaddr.sin_addr) <= 0){
-    fprintf(stderr,"failed: %s: inet_pton error\n", name);
-  }
- 
-  if(connect(sock,(SA *) &rackaddr,sizeof(rackaddr)) < 0){
-    fprintf(stderr,"failed: %s: connect error to %s, %s\n", name, ipaddr,strerror(errno));
-    exit(DID_FAILURE);
-  }
-  /**********************************************
-   ***
-   ***	Send Login Frame
-   ***
-   *********************************************/
-  writebuf[0] = op_login;
-   
-  for(n=0;n<=(strlen(username));n++){
-    writebuf[sizeof(char)+n] = username[n];
-  }
-  writebuf[sizeof(char)+(strlen(username))+1] ='\n';
-   
-  for(n=0;n<=(strlen(password))+1;n++){
-    writebuf[sizeof(char)+strlen(username)+1+n] = password[n];
-  }
-  writebuf[sizeof(char)+(strlen(username))+1+(strlen(password))+1] ='\n';
-     
-  if(write(sock,writebuf,sizeof(char)+strlen(username)+strlen(password)+2) < 0) {
-    fprintf(stderr,"failed to write to socket\n");
-    exit(DID_FAILURE);
-  }
-   
-  /********************************************
-   ***
-   ***	Read Login Reply
-   ***
-   *******************************************/
- if(wait_frame(ack_login)){
-   n=read(sock,readbuf,1);
-   if(readbuf[0] == login_deny){
-     if(!quiet_flag){fprintf(stderr,"failed: %s: Not able to log into RackSwitch\n",name);}
-     exit(DID_FAILURE);
-   }
-   else{
-     if(verbose_flag){printf("%s: Successfully logged into RackSwitch\n",name);}
-   }
-  }
-
- /********************************************
-  ***
-  ***	Send Configuration Request Message
-  ***
-  *******************************************/
- 
- writebuf[0] = configuration_request;
- writebuf[1] = config_general;
- if(write(sock,writebuf,2*(sizeof(char))) < 0) {
-   fprintf(stderr,"failed to write to socket\n");
-   exit(DID_FAILURE);
- }
-
- /********************************************
-   ***
-   ***	Read General Configuration Message
-   ***
-   *******************************************/
-
- if(wait_frame(config_reply)){
-   n = read(sock,readbuf,1);
-   if(readbuf[0] == config_general){
-
-     /* Configuration Status, one byte */
-     n = read(sock,readbuf,1);
-     
-     /* Switch description, string */
-     read_more = 1;
-     while(read_more){         
-       n = read(sock,readbuf,1);
-       if(readbuf[0] == '\0'){
-	 read_more = 0;
-       }
-       else{
-	 read_more = 1;
-       }
-     }
-     
-     /* Serial number, string */
-     read_more = 1;
-     while(read_more){
-       n = read(sock,readbuf,1);
-       if(readbuf[0] == '\0'){
-	 read_more = 0;
-       }
-       else{
-	 read_more = 1;
-       }
-     }
-
-       	  /* Version number, string */
-     read_more = 1;
-     while(read_more){
-       n = read(sock,readbuf,1);
-       if(readbuf[0] == '\0'){
-	 read_more = 0;
-       }
-       else{
-	 read_more = 1;
-       }
-     }
-
-     /* number of configured temps, 1 byte */
-     number_of_temp = 0; 
-     n = read(sock,readbuf,1);
-     number_of_temp = (int)readbuf[0];
-     
-     for(i=0;i<number_of_temp;i++){
-
-       /* Temprature description, string */
-       read_more = 1;
-       while(read_more){ 
-	 read_more = 1;
-	 while(read_more){         
-	   n = read(sock,readbuf,1);
-	   if(readbuf[0] == '\0'){
-	     read_more = 0;
-	   }
-	   else{
-	     read_more = 1;
-	   }
-	 }
-       }
-       
-       n = read(sock,readbuf,1); /* Temprature input ID */
-       n = read(sock,readbuf,1); /* Tempratue unit */
-       n = read(sock,readbuf,8); /* Temprature HI alarm */
-       n = read(sock,readbuf,8); /* Temprature LO alarm */
-       n = read(sock,readbuf,1); /* Temprature HI Alarm */
-       n = read(sock,readbuf,1); /* Temprature LO Alarm */
-       n = read(sock,readbuf,1); /* Temprature Alarm email */
-     }
-     /* Number of configured motherboards */
-     number_of_config_mobo = 0;
-     for(i=4;i>0;i--){
-       read_more = 1;	
-       while(read_more){
-	 n=read(sock,readbuf,1);
-	 if(n == 1){
-	   read_more = 0;
-	   number_of_config_mobo = number_of_config_mobo + (int)(readbuf[0]<<(8*(i-1)));
-	 }
-       }
-     }
-     /*
-      * make sure the motherboard we are asked to turn of is configured
-      */
-     if(pnumb > number_of_config_mobo){
-       if(!quiet_flag){
-	 fprintf(stderr,"failed: %s asked to reboot port %d, but there are only %d ports configured\n",name,pnumb,number_of_config_mobo);
-	 exit(DID_FAILURE);
-       }
-     }
-     n = read(sock,readbuf,1); /* email alarms */
-     n = read(sock,readbuf,4); /* email alarm delay */
-
-     /* email addresses, string */
-     read_more = 1;
-     while(read_more){         
-       n = read(sock,readbuf,1);
-       if(readbuf[0] == '\0'){
-	 read_more = 0;
-       }
-       else{
-	 read_more = 1;
-       }
-     }
-     
-     n = read(sock,readbuf,4); /* reset action duration */
-     n = read(sock,readbuf,4); /* power off action duration */
-     n = read(sock,readbuf,4); /* power on action duration */
-   }
-   else{
-     if(debug_flag){fprintf(stderr,"failed: %s: Did not receive general configuration frame when requested\n",name);}
-     exit(DID_FAILURE);
-   }
- }
- else{
-   if(debug_flag){fprintf(stderr,"failed: %s: Did not receive configuration frame when requested\n",name);}
-   exit(DID_FAILURE);
- }
-
-
-
- /******************************************
-  ***
-  ***	Send Action packet to switch
-  ***	Off/On port <portnum>
-  ***
-  *****************************************/
- memset(writebuf,0,sizeof(writebuf));
- writebuf[0] = op_action; 
- writebuf[1] = (char)(number_of_config_mobo >> 24);
- writebuf[2] = (char)(number_of_config_mobo >> 16);
- writebuf[3] = (char)(number_of_config_mobo >> 8);
- writebuf[4] = (char)(number_of_config_mobo);
- 
- writebuf[(pnumb*5)+0] = (char)(pnumb >> 24);
- writebuf[(pnumb*5)+1] = (char)(pnumb >> 16);
- writebuf[(pnumb*5)+2] = (char)(pnumb >> 8);
- writebuf[(pnumb*5)+3] = (char)(pnumb);
- writebuf[(pnumb*5)+4] = action_offon;
-
- if(write(sock,writebuf,(pnumb*5)+5) < 0) {
-   fprintf(stderr,"failed to write to socket\n");
-   exit(DID_FAILURE);
- }
- if(verbose_flag){
-   printf("%s: sending action frame to switch:\n",name);
-   for(i=0;i<(pnumb*5)+5;i++) 
-     printf("0x%.2x ",writebuf[i]);
-   printf("\n");
- }
-
-  /******************************************
-   ***
-   ***	Send Configuration Request packet to switch
-   ***
-   *****************************************/
- memset(writebuf,0,sizeof(writebuf));
- writebuf[0] = configuration_request;
- writebuf[1] = boardnum;
- 
- if(write(sock,writebuf,2*(sizeof(char))) < 0) {
-   fprintf(stderr,"failed to write to socket\n");
-   exit(DID_FAILURE);
- }
- if(verbose_flag){
-   printf("%s: sending Request Configuration Frame from switch:\n",name);
-   printf("0x%.2x 0x%.2x\n",writebuf[0],writebuf[1]);
- }
-
- /*******************************************
-  ***
-  ***	Read Switch Status Message
-  ***
-  ******************************************/
- while(success_off == 0){
-   if(debug_flag){
-     printf("%s: Status does not indicate port %d being rebooted. Looking again\n",name,pnumb);}
-   if(wait_frame(message_status)){
-     n = read(sock,readbuf,1); /* Rackswitch status */
-     
-     read_more = 1;
-     while(read_more){         /* Date & time */
-       n = read(sock,readbuf,1);
-       if(readbuf[0] == '\0'){
-	 read_more = 0;
-       }
-       else{
-	 read_more = 1;
-       }
-     }
-     number_of_temp = 0;
-     n = read(sock,readbuf,1);
-     number_of_temp = readbuf[0];
-     for(i=0;i<number_of_temp;i++){
-       read_more = 1;
-       while(read_more){
-	 n = read(sock,readbuf,1); /* Temprature input ID */
-	 n = read(sock,readbuf,8); /* Temprature Value, Fahrenheit */
-	 n = read(sock,readbuf,8); /* Temprature Vaule, Celcius */
-	 n = read(sock,readbuf,1); /* Temprature Alarm */
-       }
-     }
-     
-     /* number of motherboards, 4 byte */
-     number_of_section_config_mobo = 0;
-     for(i=4;i>0;i--){
-       read_more = 1;	
-       while(read_more){
-	 n=read(sock,readbuf,1);
-	 if(n == 1){
-	   read_more = 0;
-	   number_of_section_config_mobo = number_of_section_config_mobo + (int)(readbuf[0]<<(8*(i-1)));
-	 }
-       }
-     }
-     
-     for(i=0;i<number_of_section_config_mobo;i++){
-       
-       this_mobo = 0;
-       for(j=4;j>0;j--){
-	 read_more = 1;	
-	 while(read_more){
-	   n=read(sock,readbuf,1);
-	   if(n == 1){
-	     read_more = 0;
-	     this_mobo = this_mobo + (int)(readbuf[0]<<(8*(j-1)));
-	   }
-	 }
-       }
-       if(debug_flag){printf("%s: port %d is currently ",name,this_mobo);}
-       n = read(sock,readbuf,1); /* Motherboard status */
-       if(debug_flag){printf("0x%.2x\n",readbuf[0]);}
-       if((pnumb == this_mobo) && ((readbuf[0] == 0x02)||(readbuf[0] == 0x03))){
-	 success_off = 1;
-	 if(verbose_flag){printf("%s: Status shows port %d being rebooted\n",name,this_mobo);}
-       }
-     } /* end number_of_section_mobo loop */
-     if(!success_off){
-       if(verbose_flag){printf("%s: Status shows port %d NOT being rebooted, asking for status again\n",name,pnumb);}
-     }
-   }
-   else{
-     if(debug_flag){fprintf(stderr,"%s: Did not receive Switch Status Message\n",name);}
-     exit(DID_FAILURE);
-   }
- }
-
-
- if(success_off){
-	 if(!quiet_flag){	
-   printf("success: %s: successfully told RackSwitch to reboot port %d\n",name,pnumb);
-	 }   
-   alarm(0);
-   exit_status = DID_SUCCESS;
- }
- return(exit_status);
-}
-/* And that is it. There is no more.
- * Maybe there  should be more?
- * Or maybe not?
- * But there is no more
- */
diff --git a/fence/agents/rackswitch/do_rack.h b/fence/agents/rackswitch/do_rack.h
deleted file mode 100644
index 63c1365..0000000
--- a/fence/agents/rackswitch/do_rack.h
+++ /dev/null
@@ -1,27 +0,0 @@
-
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <limits.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <ctype.h>
-
-#include <sys/socket.h>
-#include <sys/types.h>
-
-#include <arpa/inet.h>
-
-#include <signal.h>
-
-#include "copyright.cf"
-
-#define SA struct sockaddr
-
-
-#define MAXBUF 1200
-
-#define DID_SUCCESS 0
-#define DID_FAILURE 1 
-
diff --git a/fence/agents/rps10/Makefile b/fence/agents/rps10/Makefile
deleted file mode 100644
index dd69478..0000000
--- a/fence/agents/rps10/Makefile
+++ /dev/null
@@ -1,26 +0,0 @@
-TARGET= fence_rps10
-
-SBINDIRT=$(TARGET)
-
-all: ${TARGET}
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-TARGET= fence_rps10
-
-OBJS=	rps10.o
-
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${libdir}
-
-${TARGET}: ${OBJS}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-clean: generalclean
-
--include $(OBJS:.o=.d)
diff --git a/fence/agents/rps10/rps10.c b/fence/agents/rps10/rps10.c
deleted file mode 100644
index dea02d8..0000000
--- a/fence/agents/rps10/rps10.c
+++ /dev/null
@@ -1,521 +0,0 @@
-/** @file
- * Fencing agent for WTI RPS-10 (serial) power devices.  Based on
- * the fence_apc agent from linux-cluster, and the prb utility (which
- * controls RPS-10s and PRB-5 rev 1 remote power switches).
- *
- * Only works in 2-node clusters because of the requirement that each node
- * be able to fence each other node.  This driver does not support using the
- * 'all ports' directive; cluster machines with multiple power supplies will
- * need to have their configuration updated accordingly if they are upgrading
- * from clumanager 1.0.x or 1.2.x.
- */
-#include <stdio.h>
-#include <termios.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <sys/select.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <libgen.h>
-#include "copyright.cf"
-
-/*
- * Salt to taste.
- */
-#define DEFAULT_DEVICE "/dev/ttyS0"
-#define DEFAULT_SPEED  B9600
-#define RPS10_CMD_STR   "\x02\x18\x18\x02\x18\x18%d%c\r"
-
-
-/**
-  Open a serial port and lock it.
- */
-int
-open_port(char *file, int speed)
-{
-	struct termios  ti;
-	int fd;
-	struct flock lock;
-
-	if ((fd = open(file, O_RDWR | O_EXCL)) == -1) {
-		perror("open");
-		return -1;
-	}
-
-	memset(&lock,0,sizeof(lock));
-	lock.l_type = F_WRLCK;
-	if (fcntl(fd, F_SETLK, &lock) == -1) {
-		perror("Failed to lock serial port");
-		close(fd);
-		return -1;
-	}
-		
-	memset(&ti, 0, sizeof(ti));
-	ti.c_cflag = (speed | CLOCAL | CRTSCTS | CREAD | CS8);
-
-	if (tcsetattr(fd, TCSANOW, &ti) < 0) {
-		perror("tcsetattr");
-		close(fd);
-		return -1;
-	}                             
-
-	tcflush(fd, TCIOFLUSH);
-
-	return fd;
-}
-
-
-/**
-  Toggle data terminal ready (basically, hangup).  This will cause the RPS-10
-  to print a "RPS-10 Ready" message.
- */
-void
-hangup(int fd, int delay)
-{
-	unsigned int bits;
-
-	if (ioctl(fd, TIOCMGET, &bits)) {
-		perror("ioctl1");
-		return;
-	}
-
-	bits &= ~(TIOCM_DTR | TIOCM_CTS | TIOCM_RTS | TIOCM_DSR | TIOCM_CD);
-
-	if (ioctl(fd, TIOCMSET, &bits)) {
-		perror("ioctl2");
-		return;
-	}
-	
-	usleep(delay);
-
-	bits |= (TIOCM_DTR | TIOCM_CTS | TIOCM_RTS | TIOCM_DSR | TIOCM_CD);
-
-	if (ioctl(fd, TIOCMSET, &bits)) {
-		perror("ioctl3");
-		return;
-	}
-}
-
-
-int
-char_to_speed(char *speed)
-{
-	if (!strcmp(speed, "300"))
-		return B300;
-	if (!strcmp(speed, "1200"))
-		return B1200;
-	if (!strcmp(speed, "2400"))
-		return B2400;
-	if (!strcmp(speed, "9600"))
-		return B9600;
-	return -1;
-}
-
-
-void
-usage_exit(char *pname)
-{
-printf("usage: %s <options>\n", pname);
-printf("   -n <#>         Specify RPS-10 port number <#>.  Default=0\n"
-       "                  Valid ports: 0-9\n");
-printf("   -d <device>    Use serial device <dev>.  Default=%s\n",
-       DEFAULT_DEVICE);
-printf("   -s <speed>     Use speed <speed>. Default=9600\n"
-       "                  Valid speeds: 300, 1200, 2400, 9600\n");
-printf("   -o <op>        Operation to perform.\n");
-printf("                  Valid operations: on, off, [reboot]\n");
-printf("   -V             Print version and exit\n");
-printf("   -v             Verbose mode\n\n");
-printf("If no options are specified, the following options will be read\n");
-printf("from standard input (one per line):\n\n");
-printf("   port=<#>       Same as -n\n");
-printf("   device=<dev>   Same as -d\n");
-printf("   speed=<speed>  Same as -s\n");
-printf("   option=<op>    Same as -o\n");
-printf("   operation=<op> Same as -o\n");
-printf("   action=<op>    Same as -o\n");
-printf("   verbose        Same as -v\n\n");
-	exit(1);
-}
-
-
-/**
-  Perform an operation on an RPS-10.
- */
-int
-rps10_port_op(int fd, int port, char cmd)
-{
-	char buf[30];
-
-	snprintf(buf, sizeof(buf), RPS10_CMD_STR, port, cmd);
-	if (write(fd, buf, strlen(buf)) != strlen(buf))
-		return -1;
-
-	return 0;
-}
-
-
-/**
-  Toggle = ^B^X^X^B^X^X<port>T^M
- */
-int
-rps10_toggle_port(int fd, int port)
-{
-	return rps10_port_op(fd, port, 'T');
-}
-
-
-/**
-  Power-off = ^B^X^X^B^X^X<port>0^M
- */
-int
-rps10_port_off(int fd, int port)
-{
-	return rps10_port_op(fd, port, '0');
-}
-
-
-/**
-  Power-on = ^B^X^X^B^X^X<port>1^M
- */
-int
-rps10_port_on(int fd, int port)
-{
-	return rps10_port_op(fd, port, '1');
-}
-
-
-/**
-  Super-simple expect code.
- */
-int
-wait_for(int fd, char *what, int timeout)
-{
-	char *wp, *wend, c;
-	struct timeval tv;
-	fd_set rfds;
-	int l;
-       
-	if (!what)
-		return -1;
-
-	l = strlen(what);
-
-	if (!l)
-		return -1;
-
-	tv.tv_sec = timeout;
-	tv.tv_usec = 0;
-
-	wp = what;
-	wend = what + l;
-
-	while (wp != wend) {
-		FD_ZERO(&rfds);
-		FD_SET(fd, &rfds);
-
-		switch(select(fd+1, &rfds, NULL, NULL, &tv)) {
-		case -1:
-			return -1;
-		case 0:
-			errno = ETIMEDOUT;
-			return -1;
-		}
-
-		if (read(fd, &c, 1) == -1)
-			return -1;
-
-		if (*wp == c)
-			wp++;
-		else
-			wp = what;
-	}
-
-	return 0;
-}
-
-
-/**
-   Remove leading and trailing whitespace from a line of text.
- */
-int
-cleanup(char *line, size_t linelen)
-{
-	char *p;
-	int x;
-
-	/* Remove leading whitespace. */
-	p = line;
-	for (x = 0; x <= linelen; x++) {
-		switch (line[x]) {
-		case '\t':
-		case ' ':
-			break;
-		case '\n':
-		case '\r':
-			return -1;
-		default:
-			goto eol;
-		}
-	}
-eol:
-	/* Move the remainder down by as many whitespace chars as we
-	   chewed up */
-	if (x)
-		memmove(p, &line[x], linelen-x);
-
-	/* Remove trailing whitespace. */
-	for (x=0; x <= linelen; x++) {
-		switch(line[x]) {
-		case '\t':
-		case ' ':
-		case '\r':
-		case '\n':
-			line[x] = 0;
-		case 0:
-		/* End of line */
-			return 0;
-		}
-	}
-
-	return -1;
-}
-
-
-/**
-   Parse args from stdin.  Dev + devlen + op + oplen must be valid.
- */
-int
-get_options_stdin(char *dev, size_t devlen, int *speed, int *port,
-		  char *op, size_t oplen, int *verbose)
-{
-	char in[256];
-	int line = 0;
-	char *name, *val;
-
-	while (fgets(in, sizeof(in), stdin)) {
-		++line;
-
-		if (in[0] == '#')
-			continue;
-
-		if (cleanup(in, sizeof(in)) == -1)
-			continue;
-
-		name = in;
-		if ((val = strchr(in, '='))) {
-			*val = 0;
-			++val;
-		}
-
-		if (!strcasecmp(name, "agent")) {
-			/* Used by fenced? */
-		} else if (!strcasecmp(name, "verbose")) {
-			*verbose = 1;
-		} else if (!strcasecmp(name, "device")) {
-			/* Character device to use.  E.g. /dev/ttyS0 */
-			if (val)
-				strncpy(dev, val, devlen);
-			else
-				dev[0] = 0;
-
-		} else if (!strcasecmp(name, "port")) {
-			/* Port number */
-			if (val)
-				*port = atoi(val);
-			else
-				*port = -1;
-
-		} else if (!strcasecmp(name, "speed")) {
-			/* Speed in bits per second */
-			if (val)
-				*speed = char_to_speed(val);
-			else
-				*speed = -1;
-		} else if (!strcasecmp(name, "option") ||
-			   !strcasecmp(name, "operation") ||
-			   !strcasecmp(name, "action")) {
-			if (val)
-				strncpy(op, val, oplen);
-			else
-				op[0] = 0;
-		} else {
-			fprintf(stderr,
-				"parse error: illegal name on line %d\n",
-				line);
-			return 1;
-		}
-	}
-
-	return 0;
-}
-
-
-/**
-   Print a message to stderr and call exit(1).
- */
-void
-fail_exit(char *msg)
-{
-	fprintf(stderr, "failed: %s\n", msg);
-	exit(1);
-}
-
-
-int
-main(int argc, char **argv)
-{
-	int fd, speed = DEFAULT_SPEED, opt, ret = 1;
-	extern char *optarg;
-	char dev[256];
-	char op[256];
-	int port = 0, verbose=0;
-	char *pname = basename(argv[0]);
-
-	strncpy(dev, DEFAULT_DEVICE, sizeof(dev));
-	strncpy(op, "reboot", sizeof(op));
-
-	if (argc > 1) {
-		/*
-		   Parse command line options if any were specified
-		 */
-		while ((opt = getopt(argc, argv, "s:d:n:ro:vV?hH")) != EOF) {
-			switch(opt) {
-			case 's':
-				/* Speed */
-				speed = char_to_speed(optarg);
-				if (speed == -1)
-					usage_exit(pname);
-	
-				break;
-			case 'd':
-				/* Device to open */
-				strncpy(dev, optarg, sizeof(dev));
-				break;
-			case 'n':
-				port = atoi(optarg);
-				break;
-			case 'o':
-				/* Operation */
-				strncpy(op, optarg, sizeof(op));
-				break;
-			case 'v':
-				verbose++;
-				break;
-			case 'V':
-        			printf("%s %s (built %s %s)\n", pname,
-				       RELEASE_VERSION,
-               				__DATE__, __TIME__);
-        			printf("%s\n",
-				       REDHAT_COPYRIGHT);
-				return 0;
-			default:
-				usage_exit(pname);
-			}
-		}
-	} else {
-		/*
-		   No command line args?  Get stuff from stdin
-		 */
-		if (get_options_stdin(dev, sizeof(dev), &speed, &port,
-				      op, sizeof(op), &verbose) != 0)
-			return 1;
-	}
-
-	/*
-	   Validate the operating parameters
-	 */
-	if (strlen(dev) == 0)
-		fail_exit("no device specified");
-
-	if (speed == -1)
-		fail_exit("invalid serial port speed");
-
-	if (strcasecmp(op, "off") && strcasecmp(op, "on") &&
-	    strcasecmp(op, "reboot")) {
-		fail_exit("operation must be 'on', 'off', or 'reboot'");
-	}
-
-	if ((port < 0) && (port != 9))
-		fail_exit("port must be between 0 and 9, inclusive");
-
-	/*
-	   Open the serial port up
-	 */
-	fd = open_port(dev, speed);
-	if (fd == -1)
-		exit(1);
-
-	if (verbose) {
-		printf("Toggling DTR...");
-		fflush(stdout);
-	}
-	hangup(fd, 500000);
-	if (verbose)
-		printf("Done\n");
-
-	/*
-	   Some misc. RPS-10s return PRS for some reason...
-	 */
-	if (verbose) {
-		printf("Waiting for Ready signal...");
-		fflush(stdout);
-	}
-	if (wait_for(fd, "S-10 Ready", 10) == -1) {
-		perror("wait_for");
-		return -1;
-	}
-	if (verbose)
-		printf("Done\n");
-
-	/*
-	   Perform the requested operation
-	 */
-	if (!strcasecmp(op, "reboot")) {
-		printf("Rebooting port %d...", port);
-		fflush(stdout);
-		if (rps10_toggle_port(fd, port) < 0)
-			goto out;
-
-		if (wait_for(fd, " Off", 10) < 0)
-			goto out;
-
-		/* turning on doesn't require a failure check */
-		if (wait_for(fd, " On", 10) != 0)
-			printf("<warn: "
-			       "Plug %d might still be off>", port);
-
-		ret = 0;
-
-	} else if (!strcasecmp(op, "on")) {
-		printf("Powering on port %d...", port);
-		fflush(stdout);
-		if (rps10_port_on(fd, port) < 0)
-			goto out;
-
-		if (wait_for(fd, " On", 10) < 0)
-	       		goto out;
-
-		ret = 0;
-
-	} else if (!strcasecmp(op, "off")) {
-		printf("Powering off port %d...", port);
-		fflush(stdout);
-		if (rps10_port_off(fd, port) < 0)
-			goto out;
-
-		if (wait_for(fd, " Off", 10) < 0)
-			goto out;
-
-		ret = 0;
-	}
-
-out:
-	if (ret == 0)
-		printf("Done\n");
-	else
-		printf("Failed\n");
-	return ret;
-}
diff --git a/fence/agents/rsa/Makefile b/fence/agents/rsa/Makefile
deleted file mode 100644
index e85ed97..0000000
--- a/fence/agents/rsa/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-TARGET= fence_rsa
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/rsa/fence_rsa.py b/fence/agents/rsa/fence_rsa.py
deleted file mode 100644
index 51910e8..0000000
--- a/fence/agents/rsa/fence_rsa.py
+++ /dev/null
@@ -1,286 +0,0 @@
-#!/usr/bin/python
-
-import getopt, sys
-import os
-import socket
-import time
-
-from telnetlib import Telnet
-
-TELNET_TIMEOUT=30  #How long to wait for a response from a telnet try
-
-# WARNING!! Do not add code bewteen "#BEGIN_VERSION_GENERATION" and
-# "#END_VERSION_GENERATION"  It is generated by the Makefile
-
-#BEGIN_VERSION_GENERATION
-RELEASE_VERSION=""
-REDHAT_COPYRIGHT=""
-BUILD_DATE=""
-#END_VERSION_GENERATION
-
-def usage():
-  print "Usage:"
-  print "fence_rsa [options]"
-  print "Options:"
-  print "   -a <ipaddress>           ip or hostname of rsa II port"
-  print "   -h                       print out help"
-  print "   -l [login]               login name"
-  print "   -p [password]            password"
-  print "   -S [path]                script to run to retrieve password"
-  print "   -o [action]              reboot (default), off, on, or status"
-  print "   -v Verbose               Verbose mode"
-  print "   -V                       Print Version, then exit"
-  
-  sys.exit (0)
-
-def version():
-  print "fence_rsa %s  %s\n" % (RELEASE_VERSION, BUILD_DATE)
-  print "%s\n" % REDHAT_COPYRIGHT
-  sys.exit(0)
-
-def main():
-
-  POWER_OFF = 0
-  POWER_ON = 1
-  POWER_STATUS = 2
-  POWER_REBOOT = 3
-
-  address = ""
-  login = ""
-  passwd = ""
-  passwd_script = ""
-  action = POWER_REBOOT   #default action
-  verbose = False
-
-  standard_err = 2
-
-  #set up regex list
-  USERNAME = 0
-  PASSWORD = 1
-  PROMPT = 2
-  STATE = 3
-  ERROR = 4
-  regex_list = list()
-  regex_list.append("username:")
-  regex_list.append("password:")
-  regex_list.append(".*>")
-  regex_list.append("Power:")
-  regex_list.append("Error:")
-
-  if len(sys.argv) > 1:
-    try:
-      opts, args = getopt.getopt(sys.argv[1:], "a:hl:o:p:S:vV", ["help", "output="])
-    except getopt.GetoptError:
-      #print help info and quit
-      usage()
-      sys.exit(2)
-
-                                                                                
-    for o, a in opts:
-      if o == "-v":
-        verbose = True
-      if o == "-V":
-        version()
-      if o in ("-h", "--help"):
-        usage()
-        sys.exit(0)
-      if o == "-l":
-        login = a
-      if o == "-p":
-        passwd = a
-      if o == "-S":
-        passwd_script = a
-      if o  == "-o":
-        a_lower=a.lower()
-        if a_lower == "off":
-          action = POWER_OFF
-        elif a_lower == "on":
-          action = POWER_ON
-        elif a_lower == "status":
-          action = POWER_STATUS
-        elif a_lower == "reboot":
-          action = POWER_REBOOT
-        else:
-          usage()
-          sys.exit(1)
-      if o == "-a":
-        address = a
-    if address == "" or login == "" or (passwd == "" and passwd_script == ""):
-      usage()
-      sys.exit(1)
-
-  else: #Take args from stdin...
-    params = {}
-    #place params in dict
-    for line in sys.stdin:
-      val = line.split("=")
-      if len(val) == 2:
-        params[val[0].strip()] = val[1].strip()
-    
-    try:
-      address = params["ipaddr"]
-    except KeyError, e:
-      os.write(standard_err, "FENCE: Missing ipaddr param for fence_rsa...exiting")
-      sys.exit(1)
-    
-    try:
-      login = params["login"]
-    except KeyError, e:
-      os.write(standard_err, "FENCE: Missing login param for fence_rsa...exiting")
-      sys.exit(1)
-    
-    try:
-      if 'passwd' in params:
-        passwd = params["passwd"]
-      if 'passwd_script' in params:
-        passwd_script = params['passwd_script']
-      if passwd == "" and passwd_script == "":
-        raise "missing password"
-    except KeyError, e:
-      os.write(standard_err, "FENCE: Missing passwd param for fence_rsa...exiting")
-      sys.exit(1)
-    
-    try:
-      a = params["option"]
-      a_lower=a.lower()
-      if a_lower == "off":
-        action = POWER_OFF
-      elif a_lower == "on":
-        action = POWER_ON
-      elif a_lower == "reboot":
-        action = POWER_REBOOT
-    except KeyError, e:
-      action = POWER_REBOOT
-    
-    ####End of stdin section
-  
-  
-  # retrieve passwd from passwd_script (if specified)
-  passwd_scr = ''
-  if len(passwd_script):
-    try:
-      if not os.access(passwd_script, os.X_OK):
-        raise 'script not executable'
-      p = os.popen(passwd_script, 'r', 1024)
-      passwd_scr = p.readline().strip()
-      if p.close() != None:
-        raise 'script failed'
-    except:
-      sys.stderr.write('password-script "%s" failed\n' % passwd_script)
-      passwd_scr = ''
-  
-  if passwd == "" and passwd_scr == "":
-    sys.stderr.write('password not available, exiting...')
-    sys.exit(1)
-  elif passwd == passwd_scr:
-    pass
-  elif passwd and passwd_scr:
-    # execute self, with password_scr as passwd,
-    # if that fails, continue with "passwd" argument as password
-    if len(sys.argv) > 1:
-      comm = sys.argv[0]
-      skip_next = False
-      for w in sys.argv[1:]:
-        if skip_next:
-          skip_next = False
-        elif w in ['-p', '-S']:
-          skip_next = True
-        else:
-          comm += ' ' + w
-      comm += ' -p ' + passwd_scr
-      ret = os.system(comm)
-      if ret != -1 and os.WIFEXITED(ret) and os.WEXITSTATUS(ret) == 0:
-        # success
-        sys.exit(0)
-      else:
-        sys.stderr.write('Use of password from "passwd_script" failed, trying "passwd" argument\n')
-    else: # use stdin
-      p = os.popen(sys.argv[0], 'w', 1024)
-      for par in params:
-        if par not in ['passwd', 'passwd_script']:
-          p.write(par + '=' + params[par] + '\n')
-      p.write('passwd=' + passwd_scr + '\n')
-      p.flush()
-      if p.close() == None:
-        # success
-        sys.exit(0)
-      else:
-        sys.stderr.write('Use of password from "passwd_script" failed, trying "passwd" argument\n')
-  elif passwd_scr:
-    passwd = passwd_scr
-  # passwd all set
-  
-  
-  
-  ##Time to open telnet session and log in. 
-  try:
-    sock = Telnet(address.strip())
-  except socket.error, (errno, msg):
-    my_msg = "FENCE: A problem was encountered opening a telnet session with " + address
-    os.write(standard_err, my_msg)
-    os.write(standard_err, ("FENCE: Error number: %d -- Message: %s\n" % (errno, msg)))
-    os.write(standard_err, "Firewall issue? Correct address?\n")
-    sys.exit(1)
-
-  if verbose:
-    print  "socket open to %s\n" % address
-
-  ##This loop offers all expected responses in the regex_list, and
-  ##handles responses accordingly.
-  while 1:
-    i, mo, txt = sock.expect(regex_list, TELNET_TIMEOUT)
-    if i == ERROR:
-      os.write(standard_err,("FENCE: An error was encountered when communicating with the rsa device at %s" % address))
-      buf = sock.read_eager()
-      os.write(standard_err,("FENCE: The error message is - %s" % txt + " " + buf))
-      sock.close()
-      sys.exit(1)
-    if i == USERNAME:
-      if verbose:
-        print "Sending login: %s\n" % login
-      sock.write(login + "\r")
-    elif i == PASSWORD:
-      if verbose:
-        print "Sending password: %s\n" % passwd
-      sock.write(passwd + "\r")
-    elif i == PROMPT:
-      if verbose:
-        print "Evaluating prompt...%s\n" % txt
-      if action == POWER_OFF:
-        if verbose:
-          print "Sending power off command to %s\n" % address
-        sock.write("power off\r")
-        time.sleep(2)
-        if verbose:
-          buf = sock.read_eager()
-          print "result from power off command is: %s" % buf
-        break
-      if action == POWER_ON:
-        if verbose:
-          print "Sending power on %s" % address
-        sock.write("power on\r")
-        time.sleep(2)
-        break
-      if action == POWER_STATUS:
-        if verbose:
-          print "Checking power state..."
-        sock.write("power state\r")
-        time.sleep(2)
-      if action == POWER_REBOOT:
-        if verbose:
-          print "Rebooting server..."
-        sock.write("power cycle\r")
-        time.sleep(2)
-        break
-    elif i == STATE:
-      power_state = sock.read_until("State:")
-      if power_state.find(" On") != (-1):
-        print "Server is On"
-      elif power_state.find(" Off") != (-1):
-        print "Server is off"
-      break
-
-  sock.close()
-
-if __name__ == "__main__":
-  main()
diff --git a/fence/agents/rsb/Makefile b/fence/agents/rsb/Makefile
deleted file mode 100644
index 0f77de2..0000000
--- a/fence/agents/rsb/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-TARGET= fence_rsb
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/rsb/fence_rsb.py b/fence/agents/rsb/fence_rsb.py
deleted file mode 100644
index a11e7ce..0000000
--- a/fence/agents/rsb/fence_rsb.py
+++ /dev/null
@@ -1,376 +0,0 @@
-#!/usr/bin/python
-
-import getopt, sys
-import os
-import socket
-import time
-
-from telnetlib import Telnet
-
-TELNET_TIMEOUT=30 #How long to wait for a response from a telnet try
-MAX_TRIES = 20
-
-# WARNING!! Do not add code bewteen "#BEGIN_VERSION_GENERATION" and
-# "#END_VERSION_GENERATION"  It is generated by the Makefile
-
-#BEGIN_VERSION_GENERATION
-RELEASE_VERSION=""
-REDHAT_COPYRIGHT=""
-BUILD_DATE=""
-#END_VERSION_GENERATION
-
-def usage():
-  print "Usage:"
-  print "fence_rsb [options]"
-  print "Options:"
-  print "   -a <ipaddress>           ip or hostname of rsb"
-  print "   -h                       print out help"
-  print "   -l [login]               login name"
-  print "   -n [telnet port]         telnet port"
-  print "   -p [password]            password"
-  print "   -S [path]                script to run to retrieve password"
-  print "   -o [action]              reboot (default), off, on, or status"
-  print "   -v Verbose               Verbose mode"
-  print "   -V                       Print Version, then exit"
-
-  sys.exit (0)
-
-def version():
-  print "fence_rsb %s  %s\n" % (RELEASE_VERSION, BUILD_DATE)
-  print "%s\n" % REDHAT_COPYRIGHT
-  sys.exit(0)
-
-def main():
-  depth = 0
-  POWER_OFF = 0
-  POWER_ON = 1
-  POWER_STATUS = 2
-  POWER_REBOOT = 3
-
-  power_command_issued = 0 
-
-  address = ""
-  login = ""
-  passwd = ""
-  passwd_script = ""
-  action = POWER_REBOOT   #default action
-  telnet_port = 3172
-  verbose = False
-  power_state = None
-
-  standard_err = 2
-
-  #set up regex list
-  USERNAME = 0
-  PASSWORD = 1
-  PROMPT = 2
-  STATE = 3
-  ERROR = 4
-  CONT = 5
-  CONFIRM = 6
-  DONE = 7
-
-  regex_list = list()
-  regex_list.append("user name\s*:")
-  regex_list.append("pass phrase\s*:")
-  regex_list.append("[Ee]nter\s+[Ss]election[^\r\n]*:")
-  regex_list.append("[pP]ower Status:")
-  regex_list.append("[Ee]rror\s*:")
-  regex_list.append("[Pp]ress any key to continue")
-  regex_list.append("really want to")
-  regex_list.append("CLOSING TELNET CONNECTION")
-
-  if len(sys.argv) > 1:
-    try:
-      opts, args = getopt.getopt(sys.argv[1:], "a:hl:n:o:p:S:vV", ["help", "output="])
-    except getopt.GetoptError:
-      #print help info and quit
-      usage()
-      sys.exit(2)
-
-    for o, a in opts:
-      if o == "-v":
-        verbose = True
-      if o == "-V":
-        version()
-      if o in ("-h", "--help"):
-        usage()
-        sys.exit(0)
-      if o == "-l":
-        login = a
-      if o == "-n":
-        telnet_port = a
-      if o == "-p":
-        passwd = a
-      if o == "-S":
-        passwd_script = a
-      if o  == "-o":
-        a_lower=a.lower()
-        if a_lower == "off":
-          action = POWER_OFF
-        elif a_lower == "on":
-          action = POWER_ON
-        elif a_lower == "status":
-          action = POWER_STATUS
-        elif a_lower == "reboot":
-          action = POWER_REBOOT
-        else:
-          usage()
-          sys.exit(1)
-      if o == "-a":
-        address = a
-    if address == "" or login == "" or (passwd == "" and passwd_script == ""):
-      usage()
-      sys.exit(1)
-
-  else: #Take args from stdin...
-    params = {}
-    #place params in dict
-    for line in sys.stdin:
-      val = line.split("=")
-      if len(val) == 2:
-        params[val[0].strip()] = val[1].strip()
-
-    try:
-      address = params["ipaddr"]
-    except KeyError, e:
-      os.write(standard_err, "FENCE: Missing ipaddr param for fence_rsb...exiting")
-      sys.exit(1)
-    
-    try:
-      login = params["login"]
-    except KeyError, e:
-      os.write(standard_err, "FENCE: Missing login param for fence_rsb...exiting")
-      sys.exit(1)
-    
-    try:
-      if 'passwd' in params:
-        passwd = params["passwd"]
-      if 'passwd_script' in params:
-        passwd_script = params['passwd_script']
-      if passwd == "" and passwd_script == "":
-        raise "missing password"
-    except KeyError, e:
-      os.write(standard_err, "FENCE: Missing passwd param for fence_rsb...exiting")
-      sys.exit(1)
-    
-    try:
-      telnet_port = params["telnet_port"]
-    except KeyError, e:
-      pass
-
-    try:
-      a = params["option"]
-      a_lower=a.lower()
-      if a_lower == "off":
-        action = POWER_OFF
-      elif a_lower == "on":
-        action = POWER_ON
-      elif a_lower == "reboot":
-        action = POWER_REBOOT
-    except KeyError, e:
-      action = POWER_REBOOT
-
-    ####End of stdin section
-  
-  
-  # retrieve passwd from passwd_script (if specified)
-  passwd_scr = ''
-  if len(passwd_script):
-    try:
-      if not os.access(passwd_script, os.X_OK):
-        raise 'script not executable'
-      p = os.popen(passwd_script, 'r', 1024)
-      passwd_scr = p.readline().strip()
-      if p.close() != None:
-        raise 'script failed'
-    except:
-      sys.stderr.write('password-script "%s" failed\n' % passwd_script)
-      passwd_scr = ''
-  
-  if passwd == "" and passwd_scr == "":
-    sys.stderr.write('password not available, exiting...')
-    sys.exit(1)
-  elif passwd == passwd_scr:
-    pass
-  elif passwd and passwd_scr:
-    # execute self, with password_scr as passwd,
-    # if that fails, continue with "passwd" argument as password
-    if len(sys.argv) > 1:
-      comm = sys.argv[0]
-      skip_next = False
-      for w in sys.argv[1:]:
-        if skip_next:
-          skip_next = False
-        elif w in ['-p', '-S']:
-          skip_next = True
-        else:
-          comm += ' ' + w
-      comm += ' -p ' + passwd_scr
-      ret = os.system(comm)
-      if ret != -1 and os.WIFEXITED(ret) and os.WEXITSTATUS(ret) == 0:
-        # success
-        sys.exit(0)
-      else:
-        sys.stderr.write('Use of password from "passwd_script" failed, trying "passwd" argument\n')
-    else: # use stdin
-      p = os.popen(sys.argv[0], 'w', 1024)
-      for par in params:
-        if par not in ['passwd', 'passwd_script']:
-          p.write(par + '=' + params[par] + '\n')
-      p.write('passwd=' + passwd_scr + '\n')
-      p.flush()
-      if p.close() == None:
-        # success
-        sys.exit(0)
-      else:
-        sys.stderr.write('Use of password from "passwd_script" failed, trying "passwd" argument\n')
-  elif passwd_scr:
-    passwd = passwd_scr
-  # passwd all set
-  
-  
-  
-  try:
-    telnet_port = int(telnet_port)
-  except:
-    os.write(standard_err, ("FENCE: Invalid telnet port: %s\n" % telnet_port))
-    sys.exit(1)
-    
-  ##Time to open telnet session and log in. 
-  try:
-    sock = Telnet(address.strip(), telnet_port)
-  except socket.error, (errno, msg):
-    my_msg = "FENCE: A problem was encountered opening a telnet session with " + address
-    os.write(standard_err, my_msg)
-    os.write(standard_err, ("FENCE: Error number: %d -- Message: %s\n" % (errno, msg)))
-    os.write(standard_err, "Firewall issue? Correct address?\n")
-    sys.exit(1)
-
-  if verbose:
-    #sock.set_debuglevel(10000)
-    print  "socket open to %s %d\n" % (address, telnet_port)
-
-  tries = MAX_TRIES
-  while 1:
-    i, mo, txt = sock.expect(regex_list, TELNET_TIMEOUT)
-    if i == ERROR:
-      os.write(standard_err,("FENCE: An error was encountered when communicating with the rsb device at %s" % address))
-      buf = sock.read_eager()
-      os.write(standard_err,("FENCE: The error message is - %s" % txt + " " + buf))
-      sock.close()
-      sys.exit(1)
-
-    buf = sock.read_eager()
-    if i == USERNAME:
-      if verbose:
-        print "Sending login: %s\n" % login
-      sock.write(login + "\r")
-
-    elif i == PASSWORD:
-      if verbose:
-        print "Sending password: %s\n" % passwd
-      sock.write(passwd + "\r")
-
-    elif i == CONT:
-      if verbose:
-        print "Sending continue char..."
-      sock.write("\r")
-      time.sleep(2)
-
-    elif i == CONFIRM:
-      if verbose:
-        print "Confirming..."
-      sock.write("yes\r")
-
-    elif i == PROMPT:
-      if verbose:
-        print "Evaluating prompt...\n"
-
-      if depth == 0:
-        sock.write("2\r")
-        depth += 1
-      elif depth == 1:
-        if action == POWER_OFF or action == POWER_REBOOT:
-          if power_command_issued == 0:
-            if verbose:
-              print "Sending power off %s" % address
-            sock.write("1\r")
-            power_command_issued += 1
-            time.sleep(2)
-          elif power_command_issued and power_state == 0:
-            if verbose:
-              print "Power off was successful"
-            if action == POWER_OFF:
-              depth += 1
-              sock.write("0\r")
-            else:
-              action = POWER_ON
-              power_command_issued = 0
-              sock.write("\r")
-          elif tries > 0:
-            if verbose:
-              print "Waiting for power off to complete"
-            tries -= 1
-            sock.write("\r")
-            time.sleep(2)
-          else:
-            os.write(standard_err, "FENCE: Unable to power off server")
-            depth += 1
-            sock.write("0\r")
-
-        elif action == POWER_ON:
-          if power_command_issued == 0:
-            if verbose:
-              print "Sending power on %s" % address
-            sock.write("4\r")
-            power_command_issued += 1
-            time.sleep(2)
-          elif power_command_issued and power_state == 1:
-            if verbose:
-              print "Power on was successful"
-            depth += 1
-            sock.write("0\r")
-          elif tries > 0:
-            if verbose:
-              print "Waiting for power on to complete"
-            tries -= 1
-            sock.write("\r")
-            time.sleep(2)
-          else:
-            os.write(standard_err, "FENCE: Unable to power on server")
-            depth += 1
-            sock.write("0\r")
-      else:
-        sock.write("0\r")
-
-    elif i == STATE:
-      if buf.find(" On") != (-1):
-        power_state = 1
-      elif buf.find(" Off") != (-1):
-        power_state = 0
-      else:
-        power_state = None
-
-      if action == POWER_STATUS:
-        if verbose:
-          print "Determining power state..."
-        if power_state == 1:
-          print "Server is On"
-        elif power_state == 0:
-          print "Server is Off"
-        else:
-          os.write(standard_err, ("FENCE: Cannot determine power state: %s" % buf))
-          sys.exit(1)
-        depth = 2
-
-    elif i == DONE:
-      break
-
-    else:
-      sock.write("\r")
-
-  sock.close()
-
-if __name__ == "__main__":
-  main()
diff --git a/fence/agents/sanbox2/Makefile b/fence/agents/sanbox2/Makefile
deleted file mode 100644
index 7f3fc0c..0000000
--- a/fence/agents/sanbox2/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-TARGET= fence_sanbox2
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/sanbox2/fence_sanbox2.pl b/fence/agents/sanbox2/fence_sanbox2.pl
deleted file mode 100644
index 225d640..0000000
--- a/fence/agents/sanbox2/fence_sanbox2.pl
+++ /dev/null
@@ -1,241 +0,0 @@
-#!/usr/bin/perl
-
-use Getopt::Std;
-use Net::Telnet ();
-
-# Get the program name from $0 and strip directory names
-$_=$0;
-s/.*\///;
-my $pname = $_;
-
-$opt_o = 'disable';        # Default fence action
-
-# WARNING!! Do not add code bewteen "#BEGIN_VERSION_GENERATION" and 
-# "#END_VERSION_GENERATION"  It is generated by the Makefile
-
-#BEGIN_VERSION_GENERATION
-$RELEASE_VERSION="";
-$REDHAT_COPYRIGHT="";
-$BUILD_DATE="";
-#END_VERSION_GENERATION
-
-
-sub usage
-{
-    print "Usage:\n";
-    print "\n";
-    print "$pname [options]\n";
-    print "\n";
-    print "Options:\n";
-    print "  -a <ip>          IP address or hostname of switch\n";
-    print "  -h               usage\n";
-    print "  -l <name>        Login name\n";
-    print "  -n <num>         Port number to disable\n";
-    print "  -o <string>      Action:  disable (default) or enable\n";
-    print "  -p <string>      Password for login\n";
-    print "  -S <path>        Script to run to retrieve login password\n";
-    print "  -q               quiet mode\n";
-    print "  -V               version\n";
-
-    exit 0;
-}
-
-sub fail
-{
-  ($msg) = @_;
-  print $msg."\n" unless defined $opt_q;
-  $t->close if defined $t;
-  exit 1;
-}
-
-sub fail_usage
-{
-  ($msg)=@_;
-  print STDERR $msg."\n" if $msg;
-  print STDERR "Please use '-h' for usage.\n";
-  exit 1;
-}
-
-sub version
-{
-  print "$pname $RELEASE_VERSION $BUILD_DATE\n";
-  print "$REDHAT_COPYRIGHT\n" if ( $REDHAT_COPYRIGHT );
-
-  exit 0;
-}
-
-
-if (@ARGV > 0) {
-   getopts("a:hl:n:o:p:S:qV") || fail_usage ;
-
-   usage if defined $opt_h;
-   version if defined $opt_V;
-
-   fail_usage "Unknown parameter." if (@ARGV > 0);
-
-   fail_usage "No '-a' flag specified." unless defined $opt_a;
-   fail_usage "No '-n' flag specified." unless defined $opt_n;
-   fail_usage "No '-l' flag specified." unless defined $opt_l;
-
-   if (defined $opt_S) {
-      $pwd_script_out = `$opt_S`;
-      chomp($pwd_script_out);
-      if ($pwd_script_out) {
-          $opt_p = $pwd_script_out;
-      }
-   }
-
-   fail_usage "No '-p' or '-S' flag specified." unless defined $opt_p;
-   fail_usage "Unrecognised action '$opt_o' for '-o' flag"
-      unless $opt_o =~ /^(disable|enable)$/i;
-
-} else {
-   get_options_stdin();
-
-   fail "failed: no IP address" unless defined $opt_a;
-   fail "failed: no plug number" unless defined $opt_n;
-   fail "failed: no login name" unless defined $opt_l;
-
-   if (defined $opt_S) {
-      $pwd_script_out = `$opt_S`;
-      chomp($pwd_script_out);
-      if ($pwd_script_out) {
-          $opt_p = $pwd_script_out;
-      }
-   }
-
-   fail "failed: no password" unless defined $opt_p;
-   fail "failed: unrecognised action: $opt_o"
-      unless $opt_o =~ /^(disable|enable)$/i;
-}
-
-     if ( $opt_o =~ /^disable$/i ) 
-{ 
-	$command = "set port $opt_n state offline"; 
-} 
-elsif ( $opt_o =~ /^enable$/i ) 
-{
-	$command = "set port $opt_n state online"; 
-}
-
-#
-# Set up and log in
-#
-
-$t = new Net::Telnet;
-
-$t->open($opt_a);
-
-$t->waitfor('/login:/');
-
-$t->print($opt_l);
-
-$t->waitfor('/assword:/');
-
-$t->print($opt_p);
-
-$t->waitfor('/\>/');
-
-#
-# Go to admin mode and check if we're really in it
-#
-$t->print ("admin start"); 
-($text, $match) = $t->waitfor('/\>/'); 
-if ($text =~ /Switch is already in Admin Mode/i) { 
-	fail "failed: parallel telnet session\n"; 
-};
-
-#
-# Do the command
-#
-$t->print($command);
-print "$command \n"; 
-
-#
-# Assume here that the word "error" will appear after errors (bad assumption! see next check)
-#
-
-($text, $match) = $t->waitfor('/\>/');
-
-#
-# Do a portshow on the port and look for the DISABLED string to verify success
-#
-
-$t->print("show port $opt_n");
-($text, $match) = $t->waitfor('/\>/');
-
-if (!((($opt_o =~ /disable/i) && ($text =~ /AdminState\ *Offline/i)) ||
-    (($opt_o =~ /enable/i) && ($text =~ /AdminState\ *Online/i))))
-{
-  # Get out of admin mode before failing
-  $t->print("admin end");
-  $t->waitfor('/\>/');
-  fail "failed: could not change state to $opt_o\n"; 
-}
-
-
-print "success: $opt_o $opt_n\n" unless defined $opt_q;
-$t->print("admin end"); 
-$t->waitfor('/\>/');
-$t->print("quit"); 
-
-exit 0;
-
-sub get_options_stdin
-{
-    my $opt;
-    my $line = 0;
-    while( defined($in = <>) )
-    {
-        $_ = $in;
-        chomp;
-
-	# strip leading and trailing whitespace
-        s/^\s*//;
-        s/\s*$//;
-
-	# skip comments
-        next if /^#/;
-
-        $line+=1;
-        $opt=$_;
-        next unless $opt;
-
-        ($name,$val)=split /\s*=\s*/, $opt;
-
-        if ( $name eq "" )
-        {  
-           print STDERR "parse error: illegal name in option $line\n";
-           exit 2;
-	}
-	
-        # DO NOTHING -- this field is used by fenced
-	elsif ($name eq "agent" ) { } 
-
-        elsif ($name eq "ipaddr" ) 
-	{
-            $opt_a = $val;
-        } 
-	elsif ($name eq "login" ) 
-	{
-            $opt_l = $val;
-        } 
-
-        elsif ($name eq "option" )
-        {
-            $opt_o = $val;
-        }
-	elsif ($name eq "passwd" ) 
-	{
-            $opt_p = $val;
-        }
-	elsif ($name eq "passwd_script" )
-	{
-		$opt_S = $val;
-	}
-	elsif ($name eq "port" ) 
-	{
-            $opt_n = $val;
-        } 
-    }
-}
diff --git a/fence/agents/scsi/Makefile b/fence/agents/scsi/Makefile
deleted file mode 100644
index dc5f2d9..0000000
--- a/fence/agents/scsi/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-include ../../../make/defines.mk
-
-TARGET= fence_scsi fence_scsi_test scsi_reserve_notify scsi_reserve
-SBINDIRT=fence_scsi fence_scsi_test
-INITDT= scsi_reserve
-NOTIFYD= scsi_reserve_notify
-
-include $(OBJDIR)/make/fencebuild.mk
-
-$(NOTIFYD): $(S)/$(NOTIFYD).in
-	cat $(S)/$(NOTIFYD).in | sed \
-		-e 's#@INITDT@#${initddir}#g' \
-	> $(NOTIFYD)
-
-$(INITDT): $(S)/$(INITDT).in
-	cat $(S)/$(INITDT).in | sed \
-		-e 's#@INITDDIR@#${initddir}#g' \
-	> $(INITDT)
diff --git a/fence/agents/scsi/fence_scsi.pl b/fence/agents/scsi/fence_scsi.pl
deleted file mode 100644
index 80066a3..0000000
--- a/fence/agents/scsi/fence_scsi.pl
+++ /dev/null
@@ -1,481 +0,0 @@
-#!/usr/bin/perl
-
-use Getopt::Std;
-use IPC::Open3;
-use POSIX;
-
-my @device_list;
-
-$_ = $0;
-s/.*\///;
-my $pname = $_;
-
-#BEGIN_VERSION_GENERATION
-$RELEASE_VERSION="";
-$REDHAT_COPYRIGHT="";
-$BUILD_DATE="";
-#END_VERSION_GENERATION
-
-sub usage
-{
-    print "Usage\n";
-    print "\n";
-    print "$pname [options]\n";
-    print "\n";
-    print "Options\n";
-    print "  -n <node>        IP address or hostname of node to fence\n";
-    print "  -h               usage\n";
-    print "  -V               version\n";
-    print "  -v               verbose\n";
-
-    exit 0;
-}
-
-sub version
-{
-    print "$pname $RELEASE_VERSION $BUILD_DATE\n";
-    print "$REDHAT_COPYRIGHT\n" if ( $REDHAT_COPYRIGHT );
-
-    exit 0;
-}
-
-sub fail
-{
-    ($msg)=@_;
-
-    print $msg."\n" unless defined $opt_q;
-
-    exit 1;
-}
-
-sub fail_usage
-{
-    ($msg)=@_;
-
-    print STDERR $msg."\n" if $msg;
-    print STDERR "Please use '-h' for usage.\n";
-
-    exit 1;
-}
-
-sub get_cluster_id
-{
-    my $cluster_id;
-
-    my ($in, $out, $err);
-    my $cmd = "cman_tool status";
-
-    my $pid = open3($in, $out, $err, $cmd) or die "$!\n";
-
-    waitpid($pid, 0);
-
-    die "Unable to execute cman_tool.\n" if ($?>>8);
-
-    while (<$out>)
-    {
-	chomp;
-
-	my ($name, $value) = split(/\s*:\s*/, $_);
-
-	if ($name eq "Cluster Id")
-	{
-	    $cluster_id = $value;
-	    last;
-	}
-    }
-
-    close($in);
-    close($out);
-    close($err);
-
-    print "[$pname]: get_cluster_id: cluster_id=$cluster_id\n" if $opt_v;
-
-    return $cluster_id;
-}
-
-sub get_node_id
-{
-    ($node)=@_;
-
-    my $node_id;
-
-    my ($in, $out, $err);
-    my $cmd = "ccs_tool query /cluster/clusternodes/clusternode[\@name=\\\"$node\\\"]/\@nodeid";
-
-    my $pid = open3($in, $out, $err, $cmd) or die "$!\n";
-
-    waitpid($pid, 0);
-
-    die "Unable to execute ccs_tool.\n" if ($?>>8);
-
-    while (<$out>) {
-        chomp;
-        $node_id = $_;
-    }
-
-    close($in);
-    close($out);
-    close($err);
-
-    print "[$pname]: get_node_id ($node): node_id=$node_id\n" if $opt_v;
-
-    return $node_id;
-}
-
-sub get_node_name
-{
-    print "[$pname]: get_hode_name: node_name=$opt_n\n" if $opt_v;
-
-    return $opt_n;
-}
-
-sub get_host_id
-{
-    my $host_id;
-
-    my ($in, $out, $err);
-    my $cmd = "cman_tool status";
-
-    my $pid = open3($in, $out, $err, $cmd) or die "$!\n";
-
-    waitpid($pid, 0);
-
-    die "Unable to execute cman_tool.\n" if ($?>>8);
-
-    while (<$out>)
-    {
-	chomp;
-
-	my ($name, $value) = split(/\s*:\s*/, $_);
-
-	if ($name eq "Node ID")
-	{
-	    $host_id = $value;
-	    last;
-	}
-    }
-
-    close($in);
-    close($out);
-    close($err);
-
-    print "[$pname]: get_host_id: host_id=$host_id\n" if $opt_v;
-
-    return $host_id;
-}
-
-sub get_host_name
-{
-    my $host_name;
-
-    my ($in, $out, $err);
-    my $cmd = "cman_tool status";
-
-    my $pid = open3($in, $out, $err, $cmd) or die "$!\n";
-
-    waitpid($pid, 0);
-
-    die "Unable to execute cman_tool.\n" if ($?>>8);
-
-    while (<$out>)
-    {
-	chomp;
-
-	my ($name, $value) = split(/\s*:\s*/, $_);
-
-	if ($name eq "Node name")
-	{
-	    $host_name = $value;
-	    last;
-	}
-    }
-
-    close($in);
-    close($out);
-    close($err);
-
-    print "[$pname]: get_host_name: host_name=$host_name\n" if $opt_v;
-
-    return $host_name;
-}
-
-sub get_key
-{
-    ($node)=@_;
-
-    my $cluster_id = get_cluster_id;
-    my $node_id = get_node_id($node);
-
-    if ($node_id == 0) {
-	die "Unable to determine nodeid for $node.\n";
-    }
-
-    my $key = sprintf "%x%.4x", $cluster_id, $node_id;
-
-    print "[$pname]: get_key ($node): key=$key\n" if $opt_v;
-
-    return $key;
-}
-
-sub get_options_stdin
-{
-    my $opt;
-    my $line = 0;
-
-    while (defined($in = <>))
-    {
-	$_ = $in;
-	chomp;
-
-	# strip leading and trailing whitespace
-	s/^\s*//;
-	s/\s*$//;
-
-	# skip comments
-	next if /^#/;
-
-	$line += 1;
-	$opt = $_;
-
-	next unless $opt;
-
-	($name, $val) = split(/\s*=\s*/, $opt);
-
-	if ($name eq "")
-	{
-	    print STDERR "parse error: illegal name in option $line\n";
-	    exit 2;
-	}
-	elsif ($name eq "agent")
-	{
-	}
-	elsif ($name eq "node")
-	{
-	    $opt_n = $val;
-	}
-	elsif ($name eq "nodename")
-	{
-	    $opt_n = $val;
-	}
-	elsif ($name eq "verbose")
-	{
-	    $opt_v = $val;
-	}
-	else
-	{
-	    fail "parse error: unknown option \"$opt\"";
-	}
-    }
-}
-
-sub get_key_list
-{
-    ($dev) = @_;
-
-    my ($in, $out, $err);
-
-    my $cmd = "sg_persist -d $dev -i -k";
-    my $pid = open3($in, $out, $err, $cmd) or die "$!\n";
-
-    waitpid($pid, 0);
-
-    die "Unable to execute sg_persist.\n" if ($?>>8);
-
-    my %key_list;
-
-    while (<$out>)
-    {
-	chomp;
-	if ($_ =~ /^\s*0x/)
-	{
-	    s/^\s+0x//;
-	    s/\s+$//;
-
-	    $key_list{$_} = 1;
-	}
-    }
-
-    # DEBUG: use -v option
-    #
-    if ($opt_v)
-    {
-	my $count = keys %key_list;
-	my $index = 0;
-
-	print "[$pname]: get_key_list: found $count keys registered with $dev\n";
-
-	for $key (keys %key_list)
-	{
-	    print "[$pname]:   ($index) key=$key\n";
-	    $index++;
-	}
-    }
-
-    close($in);
-    close($out);
-    close($err);
-
-    return %key_list;
-}
-
-sub get_scsi_devices
-{
-    my ($in, $out, $err);
-
-    my $cmd = "vgs --config 'global { locking_type = 0 }'" .
-              "    --noheadings --separator : -o vg_attr,pv_name 2> /dev/null";
-
-    my $pid = open3($in, $out, $err, $cmd) or die "$!\n";
-
-    waitpid($pid, 0);
-
-    die "Unable to execute vgs.\n" if ($?>>8);
-
-    while (<$out>)
-    {
-	chomp;
-
-	my ($vg_attrs, $dev) = split(/:/, $_);
-
-	if ($vg_attrs =~ /.*c$/)
-	{
-	    $dev =~ s/\(.*\)//;
-	    push(@device_list, $dev);
-	}
-    }
-
-    # DEBUG: use -v flag
-    #
-    if ($opt_v)
-    {
-	my $count = scalar @device_list;
-	my $index = 0;
-
-	print "[$pname]: get_scsi_devices: found $count devices\n";
-
-	for $dev (@device_list)
-	{
-	    print "[$pname]:   ($index) dev=$dev\n";
-	    $index++;
-	}
-    }
-
-    close($in);
-    close($out);
-    close($err);
-}
-
-sub check_sg_persist
-{
-    my ($in, $out, $err);
-    my $cmd = "sg_persist -V";
-    my $pid = open3($in, $out, $err, $cmd) or die "$!\n";
-
-    waitpid($pid, 0);
-
-    die "Unable to execute sg_persist.\n" if ($?>>8);
-
-    close($in);
-    close($out);
-    close($err);
-}
-
-sub do_register
-{
-    ($dev, $key) = @_;
-
-    my ($in, $out, $err);
-    my $cmd = "sg_persist -n -d $dev -o -G -S $key";
-    my $pid = open3($in, $out, $err, $cmd) or die "$!\n";
-
-    waitpid($pid, 0);
-
-    die "Unable to execute sg_persist ($dev).\n" if ($?>>8);
-
-    close($in);
-    close($out);
-    close($err);
-}
-
-sub fence_node
-{
-    my $host_name = get_host_name();
-    my $node_name = get_node_name();
-
-    my $host_key = get_key($host_name);
-    my $node_key = get_key($node_name);
-
-    my ($in, $out, $err);
-
-    foreach $dev (@device_list)
-    {
-	my %key_list = get_key_list($dev);
-
-	# DEBUG: use -v option
-	#
-	if ($opt_v)
-	{
-	    print "[$pname]: unregister key 0x$node_key from device $dev\n";
-	}
-
-	if (!$key_list{$host_key})
-	{
-	    do_register($dev, $host_key);
-	}
-
-	if (!$key_list{$node_key})
-	{
-	    if ($opt_v)
-	    {
-		print "[$pname]: key 0x$node_key is not registered with device $dev\n";
-	    }
-	    next;
-	}
-
-	if ($host_key eq $node_key)
-	{
-	    $cmd = "sg_persist -n -d $dev -o -G -K $host_key -S 0";
-	}
-	else
-	{
-	    $cmd = "sg_persist -n -d $dev -o -A -K $host_key -S $node_key -T 5";
-	}
-
-	my $pid = open3($in, $out, $err, $cmd) or die "$!\n";
-
-	waitpid($pid, 0);
-
-	die "Unable to execute sg_persist ($dev).\n" if ($?>>8);
-
-	close($in);
-	close($out);
-	close($err);
-    }
-}
-
-### MAIN #######################################################
-
-if (@ARGV > 0) {
-
-    getopts("n:hqvV") || fail_usage;
-
-    usage if defined $opt_h;
-    version if defined $opt_V;
-
-    fail_usage "Unknown parameter." if (@ARGV > 0);
-
-    fail_usage "No '-n' flag specified." unless defined $opt_n;
-
-} else {
-
-    get_options_stdin();
-
-    fail "failed: missing 'node'" unless defined $opt_n;
-
-}
-
-check_sg_persist;
-
-get_scsi_devices;
-
-fence_node;
diff --git a/fence/agents/scsi/fence_scsi_test.pl b/fence/agents/scsi/fence_scsi_test.pl
deleted file mode 100644
index 357a824..0000000
--- a/fence/agents/scsi/fence_scsi_test.pl
+++ /dev/null
@@ -1,221 +0,0 @@
-#!/usr/bin/perl
-
-use POSIX;
-use IPC::Open3;
-use Getopt::Std;
-
-my @devices;
-my %results;
-
-#BEGIN_VERSION_GENERATION
-$RELEASE_VERSION="";
-$REDHAT_COPYRIGHT="";
-$BUILD_DATE="";
-#END_VERSION_GENERATION
-
-sub get_scsi_block_devices
-{
-    my $block_dir = "/sys/block";
-
-    opendir(DIR, $block_dir) or die "$!\n";
-
-    my @block_devices = grep { /^sd*/ } readdir(DIR);
-
-    closedir(DIR);
-
-    for $block_dev (@block_devices)
-    {
-	push(@devices, "/dev/" . $block_dev);
-    }
-}
-
-sub get_cluster_vol_devices
-{
-    my ($in, $out, $err);
-
-    my $cmd = "vgs --config 'global { locking_type = 0 }'" .
-              "    --noheadings --separator : -o vg_attr,pv_name";
-
-    my $pid = open3($in, $out, $err, $cmd) or die "$!\n";
-
-    waitpid($pid, 0);
-
-    die "[error] unable to execute vgs command.\n" if WEXITSTATUS($?);
-
-    while (<$out>)
-    {
-	chomp;
-
-	my ($vg_attr, $pv_name) = split(/:/, $_);
-
-	if ($vg_attr =~ /.*c$/)
-	{
-	    ###### DEBUG ######
-	    print "DEBUG: pv_name = $pv_name\n";
-
-	    push(@devices, $pv_name);
-	}
-    }
-
-    close($in);
-    close($out);
-    close($err);
-}
-
-sub register_device
-{
-    my ($dev, $key) = @_;
-    my ($in, $out, $err);
-
-    my $cmd = "sg_persist -n -d $dev -o -G -S $key";
-    my $pid = open3($in, $out, $err, $cmd) or die "$!\n";
-
-    waitpid($pid, 0);
-
-    $results{$dev}[0] = WEXITSTATUS($?);
-
-    close($in);
-    close($out);
-    close($err);
-}
-
-sub unregister_device
-{
-    my ($dev, $key) = @_;
-    my ($in, $out, $err);
-
-    my $cmd = "sg_persist -n -d $dev -o -G -K $key -S 0";
-    my $pid = open3($in, $out, $err, $cmd) or die "$!\n";
-
-    waitpid($pid, 0);
-
-    $results{$dev}[1] = WEXITSTATUS($?);
-
-    close($in);
-    close($out);
-    close($err);
-}
-
-sub test_devices
-{
-    my $key = "0xDEADBEEF";
-
-    foreach $dev (@devices)
-    {
-	register_device($dev, $key);
-	unregister_device($dev, $key);
-    }
-}
-
-sub check_config_fence
-{
-    my ($in, $out, $err);
-    my $cmd = "ccs_tool query /cluster/fencedevices/fencedevice[\@agent=\\\"fence_scsi\\\"]";
-
-    my $pid = open3($in, $out, $err, $cmd) or die "$!\n";
-
-    waitpid($pid, 0);
-
-    return ($?>>8);
-}
-
-sub print_results
-{
-    my $device_count = scalar(@devices);
-
-    my $failure_count = 0;
-    my $success_count = 0;
-
-    print "\nAttempted to register with devices:\n";
-    print "-------------------------------------\n";
-
-    for $dev (@devices)
-    {
-	print "\t$dev\t";
-	if ($results{$dev}[0] == 0)
-	{
-	    $success_count++;
-	    print "Success\n";
-	}
-	else
-	{
-	    $failure_count++;
-	    print "Failure\n";
-	}
-    }
-
-    print "-------------------------------------\n";
-    print "Number of devices tested: $device_count\n";
-    print "Number of devices passed: $success_count\n";
-    print "Number of devices failed: $failure_count\n\n";
-
-    if ($failure_count != 0)
-    {
-	exit(1);
-    }
-}
-
-sub print_usage
-{
-    print "\nUsage: fence_scsi_test [-c|-s] [-d] [-h]\n\n";
-
-    print "Options:\n\n";
-
-    print "  -c     Cluster mode. This mode is intended to test\n";
-    print "         SCSI persistent reservation capabilties for\n";
-    print "         devices that are part of existing clustered\n";
-    print "         volumes. Only devices in LVM cluster volumes\n";
-    print "         will be tested.\n\n";
-    print "  -s     SCSI mode. This mode is intended to test SCSI\n";
-    print "         persistent reservation capabilities for all SCSI\n";
-    print "         devices visible on a node.\n\n";
-    print "  -d     Debug flag. This will print debugging information\n";
-    print "         such as the actual commands being run to register\n";
-    print "         and unregister a device.\n\n";
-    print "  -h     Help. Prints out this usage information.\n\n";
-}
-
-### MAIN #######################################################################
-
-if (getopts("cdhst:v") == 0)
-{
-    print_usage;
-    exit(1);
-}
-
-if ($opt_h)
-{
-    print_usage;
-    exit(0);
-}
-
-if ($opt_c)
-{
-    print "\nTesting devices in cluster volumes...\n";
-    get_cluster_vol_devices;
-    test_devices;
-    print_results;
-}
-
-if ($opt_s)
-{
-    print "\nTesting all SCSI block devices...\n";
-    get_scsi_block_devices;
-    test_devices;
-    print_results;
-}
-
-if ($opt_t)
-{
-    if ($opt_t eq "fence")
-    {
-	exit check_config_fence;
-    }
-}
-
-if (!$opt_c && !$opt_s && !$opt_t)
-{
-    print "\nPlease specify either cluster or SCSI mode.\n";
-    print_usage;
-    exit(1);
-}
diff --git a/fence/agents/scsi/scsi_reserve.in b/fence/agents/scsi/scsi_reserve.in
deleted file mode 100644
index c5a9790..0000000
--- a/fence/agents/scsi/scsi_reserve.in
+++ /dev/null
@@ -1,338 +0,0 @@
-#!/bin/bash
-#
-# scsi_reserve persistent reservation service for lvm
-#
-# chkconfig: - 25 75
-# description: start/stop persistent reservation service for lvm
-
-### BEGIN INIT INFO
-# Provides:		scsi_reserve
-# Required-Start:	cman
-# Required-Stop:	cman
-# Default-Start:
-# Default-Stop:
-# Short-Description:	start/stop persistent reservation service for lvm
-# Description:		start/stop persistent reservation service for lvm
-### END INIT INFO
-
-# rpm based distros
-if [ -d /etc/sysconfig ]; then
-	[ -f @INITDDIR@/functions ] && . @INITDDIR@/functions
-	[ -f /etc/sysconfig/cluster ] && . /etc/sysconfig/cluster
-	[ -f /etc/sysconfig/scsi_reserve ] && . /etc/sysconfig/scsi_reserve
-	[ -z "$LOCK_FILE" ] && LOCK_FILE="/var/lock/subsys/scsi_reserve"
-	success=success
-	failure=failure
-fi
-
-# deb based distros
-if [ -d /etc/default ]; then
-	[ -f /etc/default/cluster ] && . /etc/default/cluster
-	[ -f /etc/default/scsi_reserve ] && . /etc/default/scsi_reserve
-	[ -z "$LOCK_FILE" ] && LOCK_FILE="/var/lock/scsi_reserve"
-	success=local_success
-	failure=local_failure
-fi
-
-local_success()
-{
-    echo -ne "[  OK  ]\r"
-}
-
-local_failure()
-{
-    echo -ne "[FAILED]\r"
-}
-
-# check that cman is running
-#
-if ! cman_tool status > /dev/null 2>&1; then
-    logger -t scsi_reserve \
-	"[error] cman does not appear to be running"
-    exit 1
-fi
-
-# check if cluster is configured for fence_scsi
-#
-if ! fence_scsi_test -t fence ; then
-    logger -t scsi_reserve \
-	"[error] cluster not configured for scsi reservations"
-    exit 1
-fi
-
-# check for sg_persist command provided by sg3_utils package
-#
-if ! sg_persist -V > /dev/null 2>&1; then
-    logger -t scsi_reserve \
-	"[error] unable to exec sg_persist"
-    exit 1
-fi
-
-# get physical volumes (devices) that are part of cluster volumes
-#
-scsi_devices=$( vgs --config 'global { locking_type = 0 }' \
-                    --noheadings -o vg_attr,pv_name 2> /dev/null \
-              | awk ' $1 ~ /.*c$/ { print $2 } ' )
-
-if [ -z "$scsi_devices" ] ; then
-    logger -t scsi_reserve \
-	"[error] did not find devices in cluster volumes"
-    exit 1
-fi
-
-# get the cluster id from cman
-#
-cluster_id=$( cman_tool status | grep -i "Cluster ID" \
-            | awk -F": " '{ print $2 }' )
-
-if [ -z "$cluster_id" ] ; then
-    logger -s -t scsi_reserve \
-	"[error] unable to determine cluster id"
-    exit 1
-fi
-
-# get the node id from cman
-#
-node_id=$( cman_tool status | grep -i "Node ID" \
-         | awk -F": " '{ print $2 }' )
-
-if [ -z "$node_id" ] ; then
-    logger -t scsi_reserve \
-	"[error] unable to determine node id"
-    exit 1
-fi
-
-# generate unique key using cluster_id and node_id
-#
-key=$( printf "%x%.4x" $cluster_id $node_id )
-
-if [ -z "$key" ] ; then
-    logger -t scsi_reserve \
-	"[error] unable to generate key"
-    exit 1
-fi
-
-################################################################################
-
-case $1 in
-
-    start)
-
-	error=0
-	count=0
-
-	echo -n "Starting scsi_reserve:"
-
-	for dev in $scsi_devices
-	do
-	  # check if our key is already resgistered with this device
-	  #
-	  if sg_persist -n -d $dev -i -k | grep -qiE "^[[:space:]]*0x$key" ; then
-	      logger -t scsi_reserve \
-		"[info] already registered with $dev (key=0x$key)"
-	      continue
-	  fi
-
-	  # create the scsi registration
-	  #
-	  if ! sg_persist -n -d $dev -o -I -S $key > /dev/null 2>&1; then
-	      logger -t scsi_reserve \
-		"[error] unable to register device $dev (key=0x$key)"
-	      : $[ count = $count + 1 ]
-	      error=1
-	  else
-	      logger -t scsi_reserve \
-		"[info] registered with device $dev (key=0x$key)"
-	  fi
-
-	  # check to see if reservation already exists
-	  #
-	  if sg_persist -n -d $dev -i -r | grep -qiE "^[[:space:]]*Key=0x" ; then
-	      logger -t scsi_reserve \
-		"[info] reservation already exists on $dev"
-	      continue
-	  fi
-
-	  # create the scsi reservation
-	  #
-	  if ! sg_persist -n -d $dev -o -R -K $key -T 5 > /dev/null 2>&1; then
-	      logger -t scsi_reserver \
-		"[error] unable to create reservation on $dev (key=0x$key)"
-	      : $[ count = $count + 1 ]
-	      error=1
-	  fi
-	done
-
-	# leave fence domain if any errors occured during registration
-	#
-	if [ $error -eq 0 ] ; then
-	    $success
-	else
-	    logger -t scsi_reserve \
-		"[info] $count errors during registration"
-	    logger -t scsi_reserve \
-		"[info] leaving the fence domain"
-	    fence_tool leave
-	    $failure
-	fi
-
-	touch $LOCK_FILE
-
-	echo
-
-	;; # end of start
-
-    stop)
-
-	error=0
-	count=0
-
-	echo -n "Stopping scsi_reserve:"
-
-	for dev in $scsi_devices
-	do
-	  # get list of keys registered with this device
-	  #
-	  key_list=$( sg_persist -n -d $dev -i -k | grep -iE "^[[:space:]]*0x" )
-
-	  # check that our key is registered with this device
-	  #
-	  if ! sg_persist -d $dev -i -k | grep -qiE "^[[:space:]]*0x$key" ; then
-	      logger -t scsi_reserve \
-		"[info] not registered with $dev (key=0x$key)"
-	      continue
-	  fi
-
-	  # check if our key is the reservation holder
-	  #
-	  if sg_persist -n -d $dev -i -r 2>/dev/null | grep -qiE "$key" ; then
-	      if echo "$key_list" | grep -qivE "$key" ; then
-		  logger -t scsi_reserve \
-		      "[error] unable to remove registration on $dev (key=0x$key)"
-		  : $[ count = $count + 1 ]
-		  error=1
-		  continue
-	      fi
-	  fi
-
-	  # remove registration for this device
-	  #
-	  if ! sg_persist -n -d $dev -o -G -K $key -S 0 > /dev/null 2>&1; then
-	      logger -t scsi_reserve \
-		"[error] failed to remove registration on $dev (key=0x$key)"
-	      : $[ count = $count + 1 ]
-	      error=1
-	  else
-	      logger -t scsi_reserve \
-		"[info] removed registration on $dev (key=0x$key)"
-	  fi
-
-	done
-
-	# report success or failure
-	#
-	if [ $error -eq 0 ] ; then
-	    $success
-	else
-	    logger -t scsi_reserve \
-		"[info] $count errors occured during unregistration"
-	    $failure
-	fi
-
-	rm -f $LOCK_FILE
-
-	echo
-
-	;; # end of stop
-
-    restart)
-
-	error=0
-
-	echo -n "Retarting scsi_reserve:"
-
-	for dev in $scsi_devices
-	do
-	  # recreate the scsi registration
-	  #
-	  if ! sg_persist -n -d $dev -o -I -S $key > /dev/null 2>&1; then
-	      logger -t scsi_reserve \
-		"[error] unable to register device $dev (key=0x$key)"
-	      : $[ count = $count + 1 ]
-	      error=1
-	  else
-	      logger -t scsi_reserve \
-		"[info] registered with device $dev (key=0x$key)"
-	  fi
-
-	  # check to see if reservation already exists
-	  #
-	  if sg_persist -n -d $dev -i -r | grep -qiE "^[[:space:]]*Key=0x" ; then
-	      logger -t scsi_reserve \
-		"[info] reservation already exists on $dev"
-	      continue
-	  fi
-
-	  # recreate the scsi reservation
-	  #
-	  if ! sg_persist -n -d $dev -o -R -K $key -T 5 > /dev/null 2>&1; then
-	      logger -t scsi_reserver \
-		"[error] unable to create reservation on $dev (key=0x$key)"
-	      : $[ count = $count + 1 ]
-	      error=1
-	  fi
-	done
-
-	# leave fence domain if any errors occured during registration
-	#
-	if [ $error -eq 0 ] ; then
-	    $success
-	else
-	    logger -t scsi_reserve \
-		"[info] $count errors during registration"
-	    logger -t scsi_reserve \
-		"[info] leaving the fence domain"
-	    fence_tool leave
-	    $failure
-	fi
-
-	echo
-
-	;; # end of restart
-
-    status)
-
-	error=0
-
-	for dev in $scsi_devices
-	do
-	  if sg_persist -n -d $dev -i -k | grep -qiE "$key" ; then
-	      devices[${#devices[@]}]=$dev
-	  fi
-	done
-
-	if [ -z "$devices" ] ; then
-	    echo "No registered devices found."
-	else
-	    echo "Found ${#devices[@]} registered device(s):"
-
-	    for i in "${devices[@]}"
-	    do
-	      echo $i
-	    done
-	fi
-
-	;; # end of status
-
-    restart|reload)
-	$0 stop
-	$0 start
-	;;
-
-    *)
-	echo $"Usage: $0 {start|stop|restart|reload|status}"
-	exit 1
-
-esac
-
-exit $error
diff --git a/fence/agents/scsi/scsi_reserve_notify.in b/fence/agents/scsi/scsi_reserve_notify.in
deleted file mode 100644
index ac6c3f4..0000000
--- a/fence/agents/scsi/scsi_reserve_notify.in
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-
-[ "$CMAN_NOTIFICATION" = "CMAN_REASON_CONFIG_UPDATE" ] && @INITDT@/scsi_reserve start
-
-exit 0
diff --git a/fence/agents/virsh/Makefile b/fence/agents/virsh/Makefile
deleted file mode 100644
index bbea7b6..0000000
--- a/fence/agents/virsh/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-include ../../../make/defines.mk
-
-TARGET= fence_virsh
-
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/virsh/fence_virsh.py b/fence/agents/virsh/fence_virsh.py
deleted file mode 100644
index d54478d..0000000
--- a/fence/agents/virsh/fence_virsh.py
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/usr/bin/python
-
-# The Following Agent Has Been Tested On:
-#
-# Virsh 0.3.3 on RHEL 5.2 with xen-3.0.3-51
-#
-
-import sys, re, pexpect
-sys.path.append("@FENCEAGENTSLIBDIR@")
-from fencing import *
-
-#BEGIN_VERSION_GENERATION
-RELEASE_VERSION="Virsh fence agent"
-REDHAT_COPYRIGHT=""
-BUILD_DATE=""
-#END_VERSION_GENERATION
-
-def get_outlets_status(conn, options):
-	try:
-		conn.sendline("virsh list --all")
-		conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
-	except pexpect.EOF:
-		fail(EC_CONNECTION_LOST)
-	except pexpect.TIMEOUT:
-		fail(EC_TIMED_OUT)
-
-	result={}
-
-        #This is status of mini finite automata. 0 = we didn't found Id and Name, 1 = we did
-        fa_status=0
-
-        for line in conn.before.splitlines():
-	        domain=re.search("^\s*(\S+)\s+(\S+)\s+(\S+).*$",line)
-
-                if (domain!=None):
-			if ((fa_status==0) and (domain.group(1).lower()=="id") and (domain.group(2).lower()=="name")):
-				fa_status=1
-			elif (fa_status==1):
-				result[domain.group(2)]=("",(domain.group(3).lower() in ["running","blocked"] and "on" or "off"))
-	return result
-
-def get_power_status(conn, options):
-	outlets=get_outlets_status(conn,options)
-
-        if (not (options["-n"] in outlets)):
-                fail_usage("Failed: You have to enter existing name of virtual machine!")
-        else:
-                return outlets[options["-n"]][1]
-
-def set_power_status(conn, options):
-	try:
-		conn.sendline("virsh %s "%(options["-o"] == "on" and "start" or "destroy")+options["-n"])
-
-		conn.log_expect(options, options["-c"], POWER_TIMEOUT)
-                time.sleep(1)
-
-	except pexpect.EOF:
-		fail(EC_CONNECTION_LOST)
-	except pexpect.TIMEOUT:
-		fail(EC_TIMED_OUT)
-
-def main():
-	device_opt = [  "help", "version", "agent", "quiet", "verbose", "debug",
-			"action", "ipaddr", "login", "passwd", "passwd_script",
-			"secure", "identity_file", "test", "port", "separator" ]
-
-	options = check_input(device_opt, process_input(device_opt))
-
-	## Defaults for fence agent
-	if 0 == options.has_key("-c"):
-		options["-c"] = "\[EXPECT\]#\ "
-
-	options["-x"]=1
-
-	options["ssh_options"]="-t '/bin/bash -c \"PS1=\[EXPECT\]#\  /bin/bash\"'"
-
-	## Operate the fencing device
-	conn = fence_login(options)
-	fence_action(conn, options, set_power_status, get_power_status, get_outlets_status)
-
-	## Logout from system
-	conn.sendline("quit")
-	conn.close()
-
-if __name__ == "__main__":
-	main()
diff --git a/fence/agents/vixel/Makefile b/fence/agents/vixel/Makefile
deleted file mode 100644
index 6760e14..0000000
--- a/fence/agents/vixel/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-TARGET= fence_vixel
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/vixel/fence_vixel.pl b/fence/agents/vixel/fence_vixel.pl
deleted file mode 100644
index c6dc77a..0000000
--- a/fence/agents/vixel/fence_vixel.pl
+++ /dev/null
@@ -1,203 +0,0 @@
-#!/usr/bin/perl
-
-use Getopt::Std;
-use Net::Telnet ();
-
-# Get the program name from $0 and strip directory names
-$_=$0;
-s/.*\///;
-my $pname = $_;
-
-# WARNING!! Do not add code bewteen "#BEGIN_VERSION_GENERATION" and
-# "#END_VERSION_GENERATION"  It is generated by the Makefile
-
-#BEGIN_VERSION_GENERATION
-$RELEASE_VERSION="";
-$REDHAT_COPYRIGHT="";
-$BUILD_DATE="";
-#END_VERSION_GENERATION
-
-
-sub usage 
-{
-    print "Usage:\n\n"; 
-    print "$pname [options]\n\n";
-    print "Options:\n";
-    print "  -a <ip>          IP address or hostname of switch\n";
-    print "  -h               Usage\n";
-    print "  -n <num>         Port number to disable\n";
-    print "  -p <string>      Password for login\n";
-    print "  -S <path>        Script to run to retrieve login password\n";
-    print "  -V               version\n\n";
-
-    exit 0;
-}
-
-sub fail
-{
-  ($msg) = @_;
-  print $msg."\n" unless defined $opt_q;
-  $t->close if defined $t;
-  exit 1;
-}
-
-sub fail_usage
-{
-  ($msg) = @_;
-  print STDERR $msg."\n" if $msg;
-  print STDERR "Please use '-h' for usage.\n";
-  exit 1;
-}
-
-sub version
-{
-  print "$pname $RELEASE_VERSION $BUILD_DATE\n";
-  print "$REDHAT_COPYRIGHT\n" if ( $REDHAT_COPYRIGHT );
-
-  exit 0;
-}
-
-if (@ARGV > 0) {
-    getopts("a:hn:p:S:V") || fail_usage ;
-
-    usage if defined $opt_h;
-    version if defined $opt_V;
-
-    fail_usage "Unknown parameter." if (@ARGV > 0);
-
-    fail_usage "No '-a' flag specified." unless defined $opt_a;
-
-	if (defined $opt_S) {
-		$pwd_script_out = `$opt_S`;
-		chomp($pwd_script_out);
-		if ($pwd_script_out) {
-			$opt_p = $pwd_script_out;
-		}
-	}
-
-    fail_usage "No '-p' or '-S' flag specified." unless defined $opt_p;
-    fail_usage "No '-n' flag specified." unless defined $opt_n;
-
-} else {
-    get_options_stdin();
-
-    fail "failed: no IP address for the Vixel." unless defined $opt_a;
-
-	if (defined $opt_S) {
-		$pwd_script_out = `$opt_S`;
-		chomp($pwd_script_out);
-		if ($pwd_script_out) {
-			$opt_p = $pwd_script_out;
-		}
-	}
-
-    fail "failed: no password provided." unless defined $opt_p;
-    fail "failed: no port number specified." unless defined $opt_n;
-}
-
-#
-# Set up and log in
-#
-
-$t = new Net::Telnet;
-
-$t->open($opt_a);
-
-$t->waitfor('/assword:/');
-
-$t->print($opt_p);
-
-($out, $match)= $t->waitfor(Match => '/\>/', Match => '/assword:/');
-
-if ($match =~ /assword:/) {
-  fail "failed: incorrect password\n";
-} elsif ( $match !~ />/ ) {
-  fail "failed: timed out waiting for prompt\n";
-}
- 
-$t->print("config");
-
-$t->waitfor('/\(config\)\>/');
-
-$t->print("zone");
-
-$t->waitfor('/\(config\/zone\)\>/');
-
-#
-# Do the command
-#
-
-$cmd = "config $opt_n \"\"";
-$t->print($cmd);
-
-$t->waitfor('/\(config\/zone\)\>/');
-
-$t->print("apply");
-
-($text, $match) = $t->waitfor('/\>/');
-if ($text !~ /[Oo][Kk]/) {
-	fail "failed: error from switch\n";
-}
-
-$t->print("exit");
-
-print "success: zonedisable $opt_n\n";
-exit 0;
-
-
-sub get_options_stdin
-{
-	my $opt;
-	my $line = 0;
-
-	while( defined($in = <>) )
-	{
-		$_ = $in;
-		chomp;
-
-		# strip leading and trailing whitespace
-		s/^\s*//;
-		s/\s*$//;
-
-		# skip comments
-		next if /^#/;
-
-		$line+=1;
-		$opt=$_;
-		next unless $opt;
-
-		($name,$val)=split /\s*=\s*/, $opt;
-
-		if ( $name eq "" ) {
-			print("parse error: illegal name in option $line\n");
-			exit 2;
-		} 
-
-		# DO NOTHING -- this field is used by fenced
-		elsif ($name eq "agent" ) { }
-
-		# FIXME -- depricated.  use "port" instead.
-		elsif ($name eq "fm" ) {
-			(my $dummy,$opt_n) = split /\s+/,$val;
-			print STDERR "Depricated \"fm\" entry detected. Refer to man page.\n";
-		} 
-		elsif ($name eq "ipaddr" ) 
-		{
-			$opt_a = $val;
-		} 
-		elsif ($name eq "name" ) { }
-		elsif ($name eq "passwd" ) 
-		{
-			$opt_p = $val;
-		}
-		elsif ($name eq "passwd_script" )
-		{
-			$opt_S = $val;
-		} 
-		elsif ($name eq "port" ) 
-		{
-			$opt_n = $val;
-		} 
-	}
-}
-
diff --git a/fence/agents/vmware/Makefile b/fence/agents/vmware/Makefile
deleted file mode 100644
index 6ed7594..0000000
--- a/fence/agents/vmware/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-TARGET= fence_vmware
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/vmware/fence_vmware.py b/fence/agents/vmware/fence_vmware.py
deleted file mode 100644
index fc5618f..0000000
--- a/fence/agents/vmware/fence_vmware.py
+++ /dev/null
@@ -1,143 +0,0 @@
-#!/usr/bin/python
-
-#####
-##
-## The Following Agent Has Been Tested On VMware ESX 3.5 and VMware Server 1.0.7
-## 
-#####
-
-import sys, re, pexpect
-sys.path.append("@FENCEAGENTSLIBDIR@")
-from fencing import *
-
-#BEGIN_VERSION_GENERATION
-RELEASE_VERSION="New VMware Agent - test release on steroids"
-REDHAT_COPYRIGHT=""
-BUILD_DATE=""
-#END_VERSION_GENERATION
-
-VMWARE_COMMAND="/usr/bin/vmware-cmd"
-COMMAND_PROMPT_REG="\[PEXPECT\]\$ "
-COMMAND_PROMPT_NEW="[PEXPECT]\$ "
-
-# Start comunicating after login. Prepare good environment.
-def start_communication(conn, options):
-	conn.sendline ("PS1='"+COMMAND_PROMPT_NEW+"'");
-	conn.log_expect(options,COMMAND_PROMPT_REG,SHELL_TIMEOUT)
-
-# Prepare command line for vmware-cmd with parameters.
-def prepare_cmdline(conn,options,add_vm_name):
-	cmd_line=VMWARE_COMMAND+" -H '"+options["-A"]+"' -U '"+options["-L"]+"' -P '"+options["-P"]+"'"
-	if (add_vm_name):
-		cmd_line+=" '"+options["-n"]+"'"
-
-        if options.has_key("-v"):
-    		cmd_line+=" -v"
-
-    	return cmd_line
-    	
-def get_power_status(conn, options):
-	result = ""
-	try:
-		start_communication(conn,options)
-
-		cmd_line=prepare_cmdline(conn,options,True)
-
-            	cmd_line+=" getstate"
-
-		conn.sendline(cmd_line)
-
-		conn.log_expect(options,COMMAND_PROMPT_REG,SHELL_TIMEOUT)
-		status_err = re.search("vmcontrol\ error\ ([-+]?\d+)\:(.*)",conn.before.lower())
-		if (status_err!=None):
-			fail_usage("VMware error "+status_err.group(1)+": "+status_err.group(2))
-			
-		status = re.search("getstate\(\)\ =\ on",conn.before.lower())
-		
-		result=(status==None and "off" or "on")
-		
-	except pexpect.EOF:
-		fail(EC_CONNECTION_LOST)
-	except pexpect.TIMEOUT:
-		fail(EC_TIMED_OUT)
-
-	return result
-
-def get_outlet_list(conn,options):
-	result={}
-
-	try:
-		start_communication(conn,options)
-
-		cmd_line=prepare_cmdline(conn,options,False)
-		cmd_line+=" -l"
-
-		conn.sendline(cmd_line)
-
-		conn.log_expect(options,COMMAND_PROMPT_REG,SHELL_TIMEOUT)
-		status_err = re.search("vmcontrol\ error\ ([-+]?\d+)\:(.*)",conn.before.lower())
-		if (status_err!=None):
-			fail_usage("VMware error "+status_err.group(1)+": "+status_err.group(2))
-
-                lines=conn.before.splitlines()
-
-                for line in lines[(options.has_key("-v") and 3 or 1):-1]:
-			if (line!=""):
-			    result[line]=("","")
-
-	except pexpect.EOF:
-		fail(EC_CONNECTION_LOST)
-	except pexpect.TIMEOUT:
-		fail(EC_TIMED_OUT)
-
-	return result
-
-def set_power_status(conn, options):
-	try:
-		start_communication(conn,options)
-
-		cmd_line=prepare_cmdline(conn,options,True)
-
-            	cmd_line+=" "+(options["-o"]=="on" and "start" or "stop hard")
-
-		conn.sendline(cmd_line)
-
-		conn.log_expect(options,COMMAND_PROMPT_REG,POWER_TIMEOUT)
-
-	except pexpect.EOF:
-		fail(EC_CONNECTION_LOST)
-	except pexpect.TIMEOUT:
-		fail(EC_TIMED_OUT)
-		
-def main():
-	device_opt = [  "help", "version", "agent", "quiet", "verbose", "debug",
-			"action", "ipaddr", "login", "passwd", "passwd_script",
-			"secure",  "identity_file", "test" , "vmipaddr", "vmlogin", 
-			"vmpasswd", "port", "vmpasswd_script", "separator" ]
-
-	options = check_input(device_opt, process_input(device_opt))
-
-	## 
-	## Fence agent specific defaults
-	#####
-        if 0 == options.has_key("-c"):
-            options["-c"] = "\$ "
-
-        if 0 == options.has_key("-A"):
-            options["-A"] = "localhost"
-    
-    	options["-x"] = 1
-	##
-	## Operate the fencing device
-	####
-	conn = fence_login(options)
-	fence_action(conn, options, set_power_status, get_power_status, get_outlet_list)
-
-	##
-	## Logout from system
-	######
-	conn.sendline("logout")
-	conn.close()
-
-if __name__ == "__main__":
-	main()
diff --git a/fence/agents/vmware_vi/Makefile b/fence/agents/vmware_vi/Makefile
deleted file mode 100644
index e62d4c6..0000000
--- a/fence/agents/vmware_vi/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-include ../../../make/defines.mk
-
-TARGET= fence_vmware_vi_helper fence_vmware_vi
-
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/vmware_vi/fence_vmware_vi.py b/fence/agents/vmware_vi/fence_vmware_vi.py
deleted file mode 100644
index 4526b94..0000000
--- a/fence/agents/vmware_vi/fence_vmware_vi.py
+++ /dev/null
@@ -1,149 +0,0 @@
-#!/usr/bin/python
-
-#
-# The Following agent has been tested on:
-# VI Perl API 1.6 against:
-# 	VMware ESX 3.5
-#	VMware ESXi 3.5 update 2
-# 	VMware Virtual Center 2.5
-#
-
-import sys, re, pexpect
-sys.path.append("@FENCEAGENTSLIBDIR@")
-from fencing import *
-
-#BEGIN_VERSION_GENERATION
-RELEASE_VERSION="VMware Agent using VI Perl API"
-REDHAT_COPYRIGHT=""
-BUILD_DATE=""
-#END_VERSION_GENERATION
-
-# Path to vmrun command
-VMHELPER_COMMAND="fence_vmware_vi_helper"
-
-# Return string with command and additional parameters (something like vmrun -h 'host'
-def vmware_vi_prepare_command(options,add_login_params,additional_params):
-	res=VMHELPER_COMMAND
-
-	if (add_login_params):
-		res+=" --server '%s' --username '%s' --password '%s' "%(options["-a"],options["-l"],options["-p"])
-
-	if (options.has_key("-d")):
-		res+="--datacenter '%s' "%(options["-d"])
-
-	if (additional_params!=""):
-		res+=additional_params
-
-	return res
-
-# Log message if user set verbose option
-def vmware_vi_log(options, message):
-	if options["log"] >= LOG_MODE_VERBOSE:
-		options["debug_fh"].write(message+"\n")
-
-# Run vmrun command with timeout and parameters. Internaly uses vmware_vix_prepare_command. Returns string
-# with output from vmrun command. If something fails (command not found, exit code is not 0), fail_usage
-# function is called (and never return).
-def vmware_vi_run_command(options,add_login_params,additional_params):
-	command=vmware_vi_prepare_command(options,add_login_params,additional_params)
-
-	try:
-		vmware_vi_log(options,command)
-
-		(res_output,res_code)=pexpect.run(command,POWER_TIMEOUT+SHELL_TIMEOUT+LOGIN_TIMEOUT,True)
-
-		if (res_code==None):
-			fail(EC_TIMED_OUT)
-		if ((res_code!=0) and (add_login_params)):
-			vmware_vi_log(options,res_output)
-			fail_usage("vmware_helper returned %s"%(res_output))
-		else:
-			vmware_vi_log(options,res_output)
-
-	except pexpect.ExceptionPexpect:
-		fail_usage("Cannot run vmware_helper command %s"%(VMHELPER_COMMAND))
-
-	return res_output
-
-def dsv_split(dsv_str):
-	delimiter_c=':'
-	escape_c='\\'
-
-	res=[]
-	status=0
-	tmp_str=""
-
-	for x in dsv_str:
-		if (status==0):
-			if (x==delimiter_c):
-				res.append(tmp_str)
-				tmp_str=""
-			elif (x==escape_c):
-				status=1
-			else:
-				tmp_str+=x
-		elif (status==1):
-			if (x==delimiter_c):
-				tmp_str+=delimiter_c
-			elif (x==escape_c):
-				tmp_str+=escape_c
-			else:
-				tmp_str+=escape_c+x
-			status=0
-
-	if (tmp_str!=""):
-		res.append(tmp_str)
-
-	return res
-
-def get_outlets_status(conn, options):
-	outlets={}
-
-	all_machines=vmware_vi_run_command(options,True,"--operation list")
-
-	all_machines_array=all_machines.splitlines()
-
-	for machine in all_machines_array:
-		machine_array=dsv_split(machine)
-		if (len(machine_array)==3):
-			if (machine_array[0] in outlets):
-				fail_usage("Failed. More machines with same name %s found!"%(machine_array[0]))
-
-			outlets[machine_array[0]]=("",((machine_array[2].lower() in ["poweredon"]) and "on" or "off"))
-
-	return outlets
-
-def get_power_status(conn,options):
-	outlets=get_outlets_status(conn,options)
-
-	if (not (options["-n"] in outlets)):
-		fail_usage("Failed: You have to enter existing name of virtual machine!")
-	else:
-		return outlets[options["-n"]][1]
-
-def set_power_status(conn, options):
-	additional_params="--operation %s --vmname '%s'"%((options["-o"]=="on" and "on" or "off"),options["-n"])
-
-	vmware_vi_run_command(options,True,additional_params)
-
-# Define new options
-def vmware_vi_define_new_opts():
-	all_opt["datacenter"]={
-		"getopt":"d:",
-		"help":"-d <type>      Datacenter",
-		"order": 2}
-
-def main():
-	device_opt = [  "help", "version", "agent", "quiet", "verbose", "debug",
-			"action", "ipaddr", "login", "passwd", "passwd_script",
-			"test", "port", "separator", "datacenter" ]
-
-	vmware_vi_define_new_opts()
-
-	options = check_input(device_opt, process_input(device_opt))
-
-	# Operate the fencing device
-	fence_action(None, options, set_power_status, get_power_status, get_outlets_status)
-
-if __name__ == "__main__":
-	main()
diff --git a/fence/agents/vmware_vi/fence_vmware_vi_helper.pl b/fence/agents/vmware_vi/fence_vmware_vi_helper.pl
deleted file mode 100644
index fcd4f5a..0000000
--- a/fence/agents/vmware_vi/fence_vmware_vi_helper.pl
+++ /dev/null
@@ -1,237 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-my ($RELEASE_VERSION, $REDHAT_COPYRIGHT, $BUILD_DATE);
-
-#BEGIN_VERSION_GENERATION
-$RELEASE_VERSION="";
-$REDHAT_COPYRIGHT="";
-$BUILD_DATE="";
-#END_VERSION_GENERATION
-
-#### FUNCTIONS #####
-# Show error message
-sub show_error {
-  print STDERR @_;
-}
-
-sub my_exit {
-  my ($exit_code)=@_;
-  
-  # Disconnect from server
-  Util::disconnect();
-
-  exit $exit_code;
-}
-
-# Convert one field (string) to format acceptable by DSV. This
-# means replace any : with \: and \ with \\.
-sub convert_field_to_dsv {
-  my ($input_line)=@_;
-
-  $input_line =~ s/([\\:])/\\$1/g;
-  return $input_line
-}
-
-#### Global variables #####
-# Aditional options
-my %opts = (
-   'operation' => {
-      type => "=s",
-      help => "The operation to perform (on,off,list). Operations on/off require name of the virtual machine",
-      default => "list",
-      required => 0,
-   },
-   'vmname' => {
-      type => "=s",
-      help => "The name of the virtual machine",
-      required => 0,
-   },
-   'datacenter' => {
-      type => "=s",
-      help => "The name of the datacenter",
-      required => 0,
-   }
-);
-
-#################
-##### MAIN ######
-#################
-
-# Conditional use of VIRuntime
-eval "use VMware::VIRuntime;";
-
-if ($@) {
-  show_error "Please install VI Perl API package to use this tool!\n";
-  exit 1;
-}
-
-# Parse options
-Opts::add_options(%opts);
-Opts::parse();
-Opts::validate();
-
-if (!(Opts::get_option('operation')=~/^(on|off|list)$/i)) {
-  show_error "Operation should be on, off or list!\n";
-  exit 2;
-}
-
-my $operation=lc(Opts::get_option('operation'));
-
-if (($operation ne 'list') && (!defined Opts::get_option('vmname'))) {
-  show_error "Operation on, off require vmname parameter!\n";
-  exit 2;
-}
-
-
-# Try connect to machine
-eval {
-  Util::connect();
-};
-
-if ($@) {
-  show_error "Cannot connect to server!\nVMware error:".$@;
-  exit 3;
-}
-
-my ($datacenter, $datacenter_view, $vm_views,$vm);
-# We are connected to machine
-
-# If user want's datacenter, we must first find datacenter
-my %filter=(view_type => 'VirtualMachine');
-
-if( defined (Opts::get_option('datacenter')) ) {
-  $datacenter = Opts::get_option('datacenter');
-  $datacenter_view = Vim::find_entity_view(view_type => 'Datacenter',
-                                            filter => { name => $datacenter });
-  if (!$datacenter_view) {
-    show_error "Cannot find datacenter ".$datacenter."!\n";
-
-    my_exit 4;
-  }
-
-  $filter{'begin_entity'}=$datacenter_view;
-}
-
-if ($operation ne 'list') {
-  $filter{'filter'}= {"config.name" => Opts::get_option('vmname')};
-}   
-
-$vm_views = Vim::find_entity_views(%filter);
-
-my $found=0;
-
-# Traverse all found vm
-foreach $vm(@$vm_views) {
-  if ($operation eq 'list') {
-    print convert_field_to_dsv($vm->name).":".
-          convert_field_to_dsv($vm->summary->config->vmPathName).":".
-          convert_field_to_dsv($vm->runtime->powerState->val)."\n";
-  } elsif ($operation eq 'on') {
-    eval {
-      $vm->PowerOnVM();
-    };
-    
-    if ($@) {
-      show_error "Cannot power on vm ".Opts::get_option('vmname')."!\nVMware error:".$@;
-      my_exit 6;
-    }      
-  } elsif ($operation eq 'off') {
-    eval {
-      $vm->PowerOffVM();
-    };
-    
-    if ($@) {
-      show_error "Cannot power off vm ".Opts::get_option('vmname')."!\nVMware error:".$@;
-      my_exit 6;
-    }      
-  } else {
-    show_error "Operation should be on, off or list!\n";
-    my_exit 2;
-  }
-  $found++;
-}
-
-if (!$found) {
-  show_error "Cannot find vm ".Opts::get_option('vmname')."!\n";
-  my_exit 5;
-}
-
-# Should be 0 -> success all, or 6 in case of error
-my_exit 0;
-
-__END__
-
-=head1 NAME
-
-fence_vmware_vi_helper - Perform list of virtual machines and 
-               poweron, poweroff  of operations on virtual machines.
-
-=head1 SYNOPSIS
-
- fence_vmware_vi_helper --operation <on|off|list> [options]
-
-=head1 DESCRIPTION
-
-This VI Perl command-line utility provides an interface for 
-seven common provisioning operations on one or more virtual 
-machines: powering on, powering off and listing virtual mode.
-
-=head1 OPTIONS
-
-=head2 GENERAL OPTIONS
-
-=over
-
-=item B<operation>
-
-Operation to be performed.  One of the following:
-
-  <on> (power on one or more virtual machines),
-  <off> (power off one  or more virtual machines),
-  <list> (list virtual machines and their status)
-
-=item B<vmname>
-
-Optional. Name of the virtual machine on which the
-operation is to be performed. 
-
-=item B<datacenter>
-
-Optional. Name of the  datacenter for the virtual machine(s).
-Operations will be performed on all the virtual machines under the given datacenter.
-
-=back
-
-=head1 EXAMPLES
-
-Power on a virtual machine
-
-   fence_vmware_vi_helper --username administrator --password administrator --operation on
-                --vmname rhel --server win1
-
-   fence_vmware_vi_helper --username administrator --password administrator --operation on
-                --vmname rhel --server win1 --datacenter Datacenter
-
-Power off a virtual machine
-
-   fence_vmware_vi_helper --username administrator --password administrator --operation off
-                --vmname rhel --server win1
-
-   perl fence_vmware_vi_helper --username administrator --password administrator --operation off
-                --vmname rhel --server win1 --datacenter Datacenter
-
-List of virtual machines
-
-   fence_vmware_vi_helper --username administrator --password administrator --server win1
-
-   fence_vmware_vi_helper --username administrator --password administrator --server win1
-                --operation list
-
-=head1 SUPPORTED PLATFORMS
-
-All operations supported on ESX 3.0.1
-
-All operations supported on Virtual Center 2.0.1
diff --git a/fence/agents/vmware_vmrun/Makefile b/fence/agents/vmware_vmrun/Makefile
deleted file mode 100644
index 01e8d90..0000000
--- a/fence/agents/vmware_vmrun/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-TARGET= fence_vmware_vmrun
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/vmware_vmrun/fence_vmware_vmrun.py b/fence/agents/vmware_vmrun/fence_vmware_vmrun.py
deleted file mode 100644
index e51b581..0000000
--- a/fence/agents/vmware_vmrun/fence_vmware_vmrun.py
+++ /dev/null
@@ -1,154 +0,0 @@
-#!/usr/bin/python
-
-#
-# The Following agent has been tested on:
-# vmrun 2.0.0 build-116503 (from VMware Server 2.0) against:
-# 	VMware ESX 3.5 (works correctly)
-# 	VMware Server 2.0.0 (works correctly)
-#	VMware ESXi 3.5 update 2 (works correctly)
-# 	VMware Server 1.0.7 (doesn't work)
-# Any older version of vmrun doesn't have support for ESX/ESXi
-#
-
-import sys, re, pexpect
-sys.path.append("@FENCEAGENTSLIBDIR@")
-from fencing import *
-
-#BEGIN_VERSION_GENERATION
-RELEASE_VERSION="VMware Agent using VIX API"
-REDHAT_COPYRIGHT=""
-BUILD_DATE=""
-#END_VERSION_GENERATION
-
-# Path to vmrun command
-VMRUN_COMMAND="/usr/bin/vmrun"
-# Default type for -T parameter of vmrun command (default is esx, can be changed with -c)
-VMWARE_DEFAULT_TYPE="esx"
-# Minimum required version of vmrun command
-VMRUN_MINIMUM_REQUIRED_VERSION=2
-
-# Return string with command and additional parameters (something like vmrun -h 'host'
-def vmware_vix_prepare_command(options,add_login_params,additional_params):
-	res=options["-c"]
-
-	if (add_login_params):
-		res+=" -h '%s' -u '%s' -p '%s' -T '%s' "%(options["-a"],options["-l"],options["-p"],options["-d"])
-
-	if (additional_params!=""):
-		res+=additional_params
-
-	return res
-
-# Log message if user set verbose option
-def vmware_vix_log(options, message):
-	if options["log"] >= LOG_MODE_VERBOSE:
-		options["debug_fh"].write(message+"\n")
-
-# Run vmrun command with timeout and parameters. Internaly uses vmware_vix_prepare_command. Returns string
-# with output from vmrun command. If something fails (command not found, exit code is not 0), fail_usage
-# function is called (and never return).
-def vmware_vix_run_command(options,add_login_params,additional_params):
-	command=vmware_vix_prepare_command(options,add_login_params,additional_params)
-
-	try:
-		vmware_vix_log(options,command)
-
-		(res_output,res_code)=pexpect.run(command,POWER_TIMEOUT+SHELL_TIMEOUT+LOGIN_TIMEOUT,True)
-
-		if (res_code==None):
-			fail(EC_TIMED_OUT)
-		if ((res_code!=0) and (add_login_params)):
-			vmware_vix_log(options,res_output)
-			fail_usage("vmrun returned %s"%(res_output))
-		else:
-			vmware_vix_log(options,res_output)
-
-	except pexpect.ExceptionPexpect:
-		fail_usage(("Bad command name %s. Make sure, that you installed\nvmrun command (VIX Api). "+\
-		"If you have nonstandard installation location,\ntry use -c switch.")%(options["-c"]))
-
-	return res_output
-
-# Returns True, if user uses supported vmrun version (currently >=2.0.0) otherwise False.
-def vmware_vix_is_supported_vmrun_version(options):
-	vmware_help_str=vmware_vix_run_command(options,False,"")
-	version_re=re.search("vmrun version (\d\.(\d[\.]*)*)",vmware_help_str.lower())
-	if (version_re==None):
-		    return False   # Looks like this "vmrun" is not real vmrun
-
-	version_array=version_re.group(1).split(".")
-
-	try:
-		if (int(version_array[0])<VMRUN_MINIMUM_REQUIRED_VERSION):
-			return False
-	except Exception:
-		return False
-
-	return True
-
-def get_outlets_status(conn, options):
-	outlets={}
-
-	running_machines=vmware_vix_run_command(options,True,"list")
-	all_machines=vmware_vix_run_command(options,True,"listRegisteredVM")
-
-	all_machines_array=all_machines.splitlines()[1:]
-	running_machines_array=running_machines.splitlines()[1:]
-
-	for machine in all_machines_array:
-		if (machine!=""):
-			outlets[machine]=("",((machine in running_machines_array) and "on" or "off"))
-
-	return outlets
-
-def get_power_status(conn,options):
-	outlets=get_outlets_status(conn,options)
-
-	if (not (options["-n"] in outlets)):
-		fail_usage("Failed: You have to enter existing name of virtual machine!")
-	else:
-		return outlets[options["-n"]][1]
-
-def set_power_status(conn, options):
-	additional_params="%s '%s'"%((options["-o"]=="on" and "start" or "stop"),options["-n"])
-	if (options["-o"]=="off"):
-		additional_params+=" hard"
-
-	vmware_vix_run_command(options,True,additional_params)
-
-# Define new options
-def vmware_vix_define_new_opts():
-	all_opt["vmrun_cmd"]={
-		"getopt":"c:",
-		"help":"-c <command>   Name of vmrun command (default "+VMRUN_COMMAND+")",
-		"order": 2}
-	all_opt["host_type"]={
-		"getopt":"d:",
-		"help":"-d <type>      Type of VMware to connect (default "+VMWARE_DEFAULT_TYPE+")",
-		"order": 2}
-
-def main():
-	device_opt = [  "help", "version", "agent", "quiet", "verbose", "debug",
-			"action", "ipaddr", "login", "passwd", "passwd_script",
-			"test", "port", "separator", "vmrun_cmd", "host_type" ]
-
-	vmware_vix_define_new_opts()
-
-	options = check_input(device_opt, process_input(device_opt))
-
-	# Fence agent specific defaults
-        if (not options.has_key("-c")):
-		options["-c"]=VMRUN_COMMAND
-
-	if (not options.has_key("-d")):
-		options["-d"]=VMWARE_DEFAULT_TYPE
-
-	# Test user vmrun command version
-	if (not (vmware_vix_is_supported_vmrun_version(options))):
-		fail_usage("Unsupported version of vmrun command! You must use at least version %d!"%(VMRUN_MINIMUM_REQUIRED_VERSION))
-
-	# Operate the fencing device
-	fence_action(None, options, set_power_status, get_power_status, get_outlets_status)
-
-if __name__ == "__main__":
-	main()
diff --git a/fence/agents/wti/Makefile b/fence/agents/wti/Makefile
deleted file mode 100644
index 2638d3f..0000000
--- a/fence/agents/wti/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-include ../../../make/defines.mk
-
-TARGET= fence_wti
-
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/wti/fence_wti.py b/fence/agents/wti/fence_wti.py
deleted file mode 100644
index 29aace7..0000000
--- a/fence/agents/wti/fence_wti.py
+++ /dev/null
@@ -1,116 +0,0 @@
-#!/usr/bin/python
-
-#####
-##
-## The Following Agent Has Been Tested On:
-##
-##  Version            Firmware
-## +-----------------+---------------------------+
-##  WTI RSM-8R4         ?? unable to find out ??
-##  WTI MPC-??? 	?? unable to find out ??
-##  WTI IPS-800-CE     v1.40h		(no username) ('list' tested)
-#####
-
-import sys, re, pexpect
-sys.path.append("@FENCEAGENTSLIBDIR@")
-from fencing import *
-
-#BEGIN_VERSION_GENERATION
-RELEASE_VERSION="New WTI Agent - test release on steroids"
-REDHAT_COPYRIGHT=""
-BUILD_DATE="March, 2008"
-#END_VERSION_GENERATION
-
-def get_power_status(conn, options):
-	try:
-		conn.send("/S"+"\r\n")
-		conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
-	except pexpect.EOF:
-		fail(EC_CONNECTION_LOST)
-	except pexpect.TIMEOUT:
-		fail(EC_TIMED_OUT)
-	
-	plug_section = 0
-	outlets = {}
-	for line in conn.before.splitlines():
-		if (plug_section == 2) and line.find("|") >= 0:
-			plug_line = [x.strip().lower() for x in line.split("|")]
-			if len(plug_line) < len(plug_header):
-				plug_section = -1
-				pass
-			if ["list", "monitor"].count(options["-o"]) == 0 and options["-n"].lower() == plug_line[plug_index]:
-				return plug_line[status_index]
-			else:
-				## We already believe that first column contains plug number
-				outlets[plug_line[0]] = (plug_line[name_index], plug_line[status_index])
-		elif (plug_section == 1):
-			plug_section = 2
-			pass
-		elif (line.upper().startswith("PLUG")):
-			plug_section = 1
-			plug_header = [x.strip().lower() for x in line.split("|")]
-			plug_index = plug_header.index("plug")
-			name_index = plug_header.index("name")
-			status_index = plug_header.index("status")
-
-	if ["list", "monitor"].count(options["-o"]) == 1:
-		return outlets
-	else:
-		return "PROBLEM"
-
-def set_power_status(conn, options):
-	action = {
-		'on' : "/on",
-		'off': "/off"
-	}[options["-o"]]
-
-	try:
-		conn.send(action + " " + options["-n"] + ",y\r\n")
-		conn.log_expect(options, options["-c"], POWER_TIMEOUT)
-	except pexpect.EOF:
-		fail(EC_CONNECTION_LOST)
-	except pexpect.TIMEOUT:
-		fail(EC_TIMED_OUT)
-
-def main():
-	device_opt = [  "help", "version", "agent", "quiet", "verbose", "debug",
-			"action", "ipaddr", "login", "passwd", "passwd_script",
-			"cmd_prompt", "secure", "port", "no_login", "test" ]
-
-	options = check_input(device_opt, process_input(device_opt))
-
-	## 
-	## Fence agent specific defaults
-	#####
-	if 0 == options.has_key("-c"):
-		options["-c"] = [ "RSM>", "MPC>", "IPS>", "TPS>", "NBB>", "NPS>" ]
-
-	##
-	## Operate the fencing device
-	##
-	## @note: if there is not a login name then we assume that it is WTI-IPS
-	##        where no login name is used
-	#####	
-	if (0 == options.has_key("-l")):
-		try:
-			conn = fspawn ('telnet ' + options["-a"])
-			conn.log_expect(options, "Password: ", SHELL_TIMEOUT)
-			conn.send(options["-p"]+"\r\n")
-			conn.log_expect(options, options["-c"], SHELL_TIMEOUT)
-		except pexpect.EOF:
-			fail(EC_LOGIN_DENIED) 
-		except pexpect.TIMEOUT:
-			fail(EC_LOGIN_DENIED)		
-	else:
-		conn = fence_login(options)
-
-	fence_action(conn, options, set_power_status, get_power_status, get_power_status)
-
-	##
-	## Logout from system
-	######
-	conn.send("/X"+"\r\n")
-	conn.close()
-
-if __name__ == "__main__":
-	main()
diff --git a/fence/agents/xcat/Makefile b/fence/agents/xcat/Makefile
deleted file mode 100644
index 0c1fed0..0000000
--- a/fence/agents/xcat/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-TARGET= fence_xcat
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/xcat/fence_xcat.pl b/fence/agents/xcat/fence_xcat.pl
deleted file mode 100644
index 9e65ff8..0000000
--- a/fence/agents/xcat/fence_xcat.pl
+++ /dev/null
@@ -1,188 +0,0 @@
-#!/usr/bin/perl
-
-use Getopt::Std;
-
-# Get the program name from $0 and strip directory names
-$_=$0;
-s/.*\///;
-my $pname = $_;
-
-$opt_o = 'reset';        # Default fence action
-$opt_r = 'rpower';        # Default fence action
-
-# WARNING!! Do not add code bewteen "#BEGIN_VERSION_GENERATION" and 
-# "#END_VERSION_GENERATION"  It is generated by the Makefile
-
-#BEGIN_VERSION_GENERATION
-$RELEASE_VERSION="";
-$REDHAT_COPYRIGHT="";
-$BUILD_DATE="";
-#END_VERSION_GENERATION
-
-
-sub usage
-{
-    print "Usage:\n";
-    print "\n";
-    print "$pname [options]\n";
-    print "\n";
-    print "Options:\n";
-    print "  -h               usage\n";
-    print "  -n <name>        nodename\n";
-    print "  -o <string>      Action:  on | off | reset (default) | stat\n";
-    print "  -r <rpower>      rpower command\n";
-    print "  -q               quiet mode\n";
-    print "  -V               version\n";
-
-    exit 0;
-}
-
-sub fail
-{
-  ($msg) = @_;
-  print $msg."\n" unless defined $opt_q;
-  $t->close if defined $t;
-  exit 1;
-}
-
-sub fail_usage
-{
-  ($msg)=@_;
-  print STDERR $msg."\n" if $msg;
-  print STDERR "Please use '-h' for usage.\n";
-  exit 1;
-}
-
-sub version
-{
-  print "$pname $RELEASE_VERSION $BUILD_DATE\n";
-  print "$REDHAT_COPYRIGHT\n" if ( $REDHAT_COPYRIGHT );
-
-  exit 0;
-}
-
-sub get_options_stdin
-{
-    my $opt;
-    my $line = 0;
-    while( defined($in = <>) )
-    {
-        $_ = $in;
-        chomp;
-
-	# strip leading and trailing whitespace
-        s/^\s*//;
-        s/\s*$//;
-
-	# skip comments
-        next if /^#/;
-
-        $line+=1;
-        $opt=$_;
-        next unless $opt;
-
-        ($name,$val)=split /\s*=\s*/, $opt;
-
-        if ( $name eq "" )
-        {  
-           print STDERR "parse error: illegal name in option $line\n";
-           exit 2;
-	}
-	
-        # DO NOTHING -- this field is used by fenced
-	elsif ($name eq "agent" ) { } 
-
-        elsif ($name eq "action" )
-        {
-            $opt_o = $val;
-        }
-	elsif ($name eq "nodename" ) 
-	{
-            $opt_n = $val;
-        } 
-	elsif ($name eq "rpower" ) 
-	{
-            $opt_r = $val;
-        } 
-
-    }
-}
-
-######################################################################33
-# MAIN
-
-if (@ARGV > 0) {
-   getopts("hn:o:r:qV") || fail_usage ;
-
-   usage if defined $opt_h;
-   version if defined $opt_V;
-
-   fail_usage "Unknown parameter." if (@ARGV > 0);
-
-   fail_usage "No '-n' flag specified." unless defined $opt_n;
-   $opt_o=lc($opt_o);
-   fail_usage "Unrecognised action '$opt_o' for '-o' flag"
-      unless $opt_o =~ /^(on|off|reset|stat)$/;
-
-} else {
-   get_options_stdin();
-
-   fail "failed: no plug number" unless defined $opt_n;
-   $opt_o=lc($opt_o);
-   fail "failed: unrecognised action: $opt_o"
-      unless $opt_o =~ /^(on|off|reset|stat)$/;
-}
-
-pipe (RDR,WTR);
-
-if ( $pid=fork() == 0 )
-{
-   close RDR;
-
-   open STDOUT, ">&WTR";
-   exec "$opt_r $opt_n $opt_o" or die "failed to exec \"$opt_r\"\n";
-}
-
-close WTR;
-
-wait;
-
-if ( $? != 0 )
-{
-   die "failed: rpower error: exit $?\n"
-}
-
-$found=0;
-$status="";
-while (<RDR>)
-{
-   chomp;
-
-   if ( $_ =~ /^(\S+): (\S+)$/)
-   {
-      if ($opt_n eq $1) 
-      {
-         $status = $2;
-
-         if (($opt_o eq $2) || ($opt_o eq "stat"))
-         {
-            $found=1;
-            last;
-         }
-      }
-   }
-}
-
-print (($found ? "success":"failed") . ": $opt_n $status\n")
-   unless defined $opt_q;
-
-exit ($found ? 0 : 1 );
-
-
-
-
-
-
-
-
-
diff --git a/fence/agents/xvm/Makefile b/fence/agents/xvm/Makefile
deleted file mode 100644
index cbabda0..0000000
--- a/fence/agents/xvm/Makefile
+++ /dev/null
@@ -1,66 +0,0 @@
-TARGET1= fence_xvm
-TARGET2= fence_xvmd
-TARGET3= testprog
-
-SBINDIRT=$(TARGET1) $(TARGET2)
-
-all: ${TARGET1} ${TARGET2}
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-OBJS1=	fence_xvm.o \
-	ip_lookup.o
-
-OBJS2=	fence_xvmd.o \
-	virt.o \
-	options-ccs.o \
-	vm_states.o \
-	xml.o
-
-OBJS3=	xml-standalone.o
-
-SHAREDOBJS=	mcast.o \
-		simple_auth.o \
-		tcp.o \
-		options.o \
-		debug.o
-
-CFLAGS += -D_GNU_SOURCE
-CFLAGS += -Werror -Wstrict-prototypes -Wshadow
-CFLAGS += -I${ccsincdir} -I${cmanincdir}
-CFLAGS += -I${corosyncincdir} -I${openaisincdir}
-CFLAGS += -I${logtincdir}
-CFLAGS += -I${virtincdir} -I${nssincdir} -I${nsprincdir}
-CFLAGS += `xml2-config --cflags`
-CFLAGS += -I${incdir}
-
-STANDALONE_CFLAGS += -DSTANDALONE
-
-LDFLAGS += -L${nsslibdir} -lnss3
-LDFLAGS += -L${logtlibdir} -llogthread
-LDFLAGS += -L${libdir}
-
-EXTRA_LDFLAGS += -L${ccslibdir} -lccs -L${cmanlibdir} -lcman
-EXTRA_LDFLAGS += -L${virtlibdir} -lvirt
-EXTRA_LDFLAGS += -L${openaislibdir} -lSaCkpt
-XML_LDFLAGS += `xml2-config --libs`
-
-${TARGET1}: ${SHAREDOBJS} ${OBJS1}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-${TARGET2}: ${SHAREDOBJS} ${OBJS2}
-	$(CC) -o $@ $^ $(EXTRA_LDFLAGS) $(XML_LDFLAGS) $(LDFLAGS)
-
-${TARGET3}: ${OBJS3}
-	$(CC) -o $@ $^ $(XML_LDFLAGS)
-
-clean: generalclean
-
--include $(OBJS1:.o=.d)
--include $(OBJS2:.o=.d)
--include $(OBJS3:.o=.d)
--include $(SHAREDOBJS:.o=.d)
diff --git a/fence/agents/xvm/README b/fence/agents/xvm/README
deleted file mode 100644
index 401666d..0000000
--- a/fence/agents/xvm/README
+++ /dev/null
@@ -1,182 +0,0 @@
-I. Fence_xvm - virtual machine fencing agent
-
-Fence_xvm is an agent which establishes a communications link between
-a cluster of virtual machines (VC) and a cluster of domain0/physical
-nodes which are hosting the virtual cluster.  Its operations are
-fairly simple.
-
-  (a) Start a listener service.
-  (b) Send a multicast packet requesting that a VM be fenced.
-  (c) Authenticate client.
-  (e) Read response.
-  (f) Exit with success/failure, depending on the response received.
-
-If any of the above steps fail, the fencing agent exits with a failure
-code and fencing is retried by the virtual cluster at a later time.
-Because of the simplicty of fence_xvm, it is not necessary that
-fence_xvm be run from within a virtualized guest - all it needs is
-libnspr and libnss and a shared private key (for authentication; we
-would hate to receive a false positive response from a node not in the
-cluster!).
-
-
-II. Fence_xvmd - The virtual machine fencing host
-
-Fence_xvmd is a daemon which runs on physical hosts (e.g. in domain0)
-of the cluster hosting the virtual cluster.  It listens on a port
-for multicast traffic from virtual cluster(s), and takes actions.
-Multiple disjoint virtual clusters can coexist on a single physical
-host cluster, but this requires multiple instances of fence_xvmd.
-
-NOTE: fence_xvmd *MUST* be run on ALL nodes in a given cluster which
-will be hosting virtual machines if fence_xvm is to be used for 
-fencing!
-
-There are a couple of ways the multicast packet is handled,
-depending on the state of the host OS.  It might be hosting the VM,
-or it might not.  Furthermore, the VM might "reside" on a host which
-has failed.
-
-In order to be able to guarantee safe fencing of a VM even if the
-last- known host is down, we must store the last-known locations of
-each virtual machine in some sort of cluster-wide way.  For this, we
-use the AIS Checkpointing API, which is provided by OpenAIS.  Every
-few seconds, fence_xvmd queries the hypervisor via libvirt and
-stores any local VM states in a checkpoint.  In the event of a
-physical node failure (which consequently causes the failure of one
-or more guests), we can then read the checkpoint section corresponding
-to the guest we need to fence to find out the previous
-owner.  With that information, we can then check with CMAN to see if
-the last-known host node has been fenced.  If so, then the VM is
-clean as well.  The physical cluster must, therefore, have fencing
-in order for fence_xvmd to work.
-
-Operation of a node hosting a VM which needs to be fenced:
-  
-  (a) Receive multicast packet
-  (b) Authenticate multicast packet
-  (c) Open connection to host contained within multicast
-      packet.
-  (d) Authenticate server.
-  (e) Carry out fencing operation (e.g. call libvirt to destroy or
-      reboot the VM; there is no "on" method at this point).
-  (f) If operation succeeds, send success response.
-
-Operation of high-node-ID:
-
-  (a) Receive multicast packet
-  (b) Authenticate multicast packet
-  (c) Read VM state from checkpoint
-  (d) Check liveliness of nodeID hosting VM (if alive, do nothing)
-  (e) Open connection to host contained within multicast
-      packet.
-  (f) Check with CMAN to see if last-known host has been fenced.
-      (If it has not; do nothing -- this is why the physical 
-      cluster also needs fencing!)
-  (g) Authenticate server & send response.
-  (h) If last-known host has been fenced, send success response.
-
-NOTE: There is always a possibility that a VM is started again
-before the fencing operation and checkpoint update for that VM
-occurs.  If the VM has booted and rejoined the cluster, fencing will
-not be necessary.  If it is in the process of booting, but has not
-yet joined the cluster, fencing will also not be necessary - because
-it will not be using cluster resources yet.
-
-
-III. Security considerations
-
-While fencing is generally expected to run on a more or less trusted
-network, there are cases where it may not be.
-
-* The multicast packet is subject to replay attacks, but because no
-fencing action is taken based solely on the information contained
-within the packet, this should not allow an attacker to maliciously
-fence a VM from outside the cluster, though it may be possible to
-cause a DoS of fence_xvmd if enough multicast packets are sent.
-
-* The only currently supported authentication mechanisms are simple
-challenge-response based on a shared private key and pseudorandom
-number generation.
-
-* An attacker with access to the shared key(s) can easily fence any
-known VM, even if they are not on a cluster node.
-
-* Different shared keys should be used for different virtual
-clusters on the same subnet (whether in the same physical cluster
-or not).  Additionally, multiple fence_xvmd instances must be run
-(each listening on a different multicast IP + port combination).
-
-IV.  Configuration
-
-Generate a random key file.  An example of how to generate it is:
-
-    dd if=/dev/urandom of=/etc/cluster/fence_xvm.key bs=4096 count=1
-
-Distribute the generated key file to all virtual machines in a
-cluster as well as all physical host nodes which will be hosting
-that particular cluster of guests.  More simply, everything involved
-with hosting the virtual cluster as well as the virtual cluster
-itself must have the same key file; it acts as a password.
-
-The key should not be placed on shared file systems (because shared
-file systems require the cluster, which requires fencing...).  
-Furthermore, it is considered 'unsupported' to join a host cluster
-and a guest cluster in one management domain.
-
-A. Configuring the host (physical) cluster
-
-On the host cluster, you need to add the following tag as a
-child of the <cluster> tag in /etc/cluster/cluster.conf:
-
-    <fence_xvmd/>
-
-(Do not forget to increment the configuration version number and
-run 'ccs_tool update /etc/cluster/cluster.conf' !).
-
-Start fence_xvmd on all host nodes if it isn't already running.
-Just run 'fence_xvmd'.  The next time the cluster is restarted,
-fence_xvmd will start automatically; it is started by the cman
-script if you have the above tag in cluster.conf.
-
-B.  Configuring the guest (virtual) cluster
-
-On the guest cluster, you need to set up per-node fencing.  This
-is a fairly simple task as well.  First, you need to add a fence
-device for 'xvm'.  Simply add the following to the <fencedevices/>
-tag in the guest cluster's cluster.conf:
-
-    <fencedevice name="xvm" agent="fence_xvm"/>
-
-After doing this, each node also needs individual fencing set up.
-For each <clusternode/> tag, you will need to add something like
-the following:
-
-    <fence>
-        <method name="1">
-            <device name="xvm" domain="doman-name"/>
-        </method>
-    </fence>
-
-For example, if you have a virtual host named 'vm1.test.com' with a
-corresponding virtual domain name of 'domU-vm1' in the dom0 cluster,
-and a node ID of 1, the <clusternode> tag for that virtual machine
-would look like so:
-
-    <clusternode name="vm1.test.com" nodeid="1" votes="1">
-        <fence>
-            <method name="1">
-                <device name="xvm" domain="domU-vm1"/>
-            </method>
-        </fence>
-    </clusternode>
-
-C. Advanced configuration
-
-Any advanced configuration parameters (e.g. changing authentication,
-hashing, key file, etc.) should be included in the <fence_xvmd/> tag
-in the host cluster and the <fencedevice .../> tag in the guest
-cluster.  For a complete list of advanced parameters, see:
-
-    fence_xvmd -h
-    fence_xvm -h
diff --git a/fence/agents/xvm/TODO b/fence/agents/xvm/TODO
deleted file mode 100644
index 0158742..0000000
--- a/fence/agents/xvm/TODO
+++ /dev/null
@@ -1,33 +0,0 @@
-High Priority / Blockers:
-
-* Nothing at this time.
-
-Medium Priority:
-
-* Need to add ability for fence_xvmd to forcefully fence the host
-dom0 if it's not responding.  Medium because it should not be the
-default behavior since fencing a host can affect multiple domains
-across potentially multiple domU clusters.  This will be a server-
-side configuration option; domUs will not be able to override it.
-
-* Support multiple authentication keys in fence_xvmd simultaneously
-so that we can fence multiple clusters with only one instance of
-fence_xvmd running on a given dom0.
-
-Low Priority:
-
-* Turn README in to man pages.
-
-* Make sure CMAN is running and/or restart/reconnect if CMAN goes
-away and comes back.  (If CMAN dies, we have big problems anyway)
-
-* Add SSL connection support.  (Challenge/response on a trusted
-network should be okay.)
-
-* Make sure addresses contained in the multicast packet are always
-in network-byte order.  Low because it will be unlikely that the
-host-byte ordering of a domU and its dom0 will be different.
-
-* Make sure node IDs and VM states stored in openais checkpoints
-are in network-byte order and swap back/forth if not.
-
diff --git a/fence/agents/xvm/debug.c b/fence/agents/xvm/debug.c
deleted file mode 100644
index d8bd109..0000000
--- a/fence/agents/xvm/debug.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <stdio.h>
-#include "debug.h"
-
-static int _debug = 0;
-
-inline void
-dset(int threshold)
-{
-	_debug = threshold;
-	dbg_printf(3, "Debugging threshold is now %d\n", threshold);
-}
-
-inline int
-dget(void)
-{
-	return _debug;
-}
-
diff --git a/fence/agents/xvm/debug.h b/fence/agents/xvm/debug.h
deleted file mode 100644
index 84a5df9..0000000
--- a/fence/agents/xvm/debug.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef _DBG_H
-#define _DBG_H
-
-#include <liblogthread.h>
-
-inline void dset(int);
-inline int dget(void);
-
-#define dbg_printf(level, fmt, args...) \
-do { \
-	if (dget()>=level) \
-		logt_print(LOG_DEBUG, fmt, ##args); \
-} while(0)
-
-#endif
diff --git a/fence/agents/xvm/fence_xvm.c b/fence/agents/xvm/fence_xvm.c
deleted file mode 100644
index c072cf6..0000000
--- a/fence/agents/xvm/fence_xvm.c
+++ /dev/null
@@ -1,375 +0,0 @@
-/*
- * @file fence_xvmd.c: Implementation of server daemon for Xen virtual
- * machine fencing.  This uses SA AIS CKPT b.1.0 checkpointing API to 
- * store virtual machine states.
- *
- * Author: Lon Hohberger <lhh at redhat.com>
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <sys/un.h>
-#include <sys/socket.h>
-#include <sys/select.h>
-#include <sys/ioctl.h>
-#include <arpa/inet.h>
-#include <net/if.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <sys/time.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <pthread.h>
-#include <libgen.h>
-#include <nss.h>
-#include <liblogthread.h>
-
-/* Local includes */
-#include "xvm.h"
-#include "ip_lookup.h"
-#include "simple_auth.h"
-#include "options.h"
-#include "tcp.h"
-#include "mcast.h"
-#include "debug.h"
-
-#define LOG_DAEMON_NAME "fence_xvm"
-
-int
-tcp_wait_connect(int lfd, int retry_tenths)
-{
-	int fd;
-	fd_set rfds;
-	int n;
-	struct timeval tv;
-
-	dbg_printf(3, "Waiting for connection from XVM host daemon.\n");
-	FD_ZERO(&rfds);
-	FD_SET(lfd, &rfds);
-	tv.tv_sec = retry_tenths / 10;
-	tv.tv_usec = (retry_tenths % 10) * 100000;
-
-	n = select(lfd + 1, &rfds, NULL, NULL, &tv);
-	if (n == 0) {
-		errno = ETIMEDOUT;
-		return -1;
-	} else if (n < 0) {
-		return -1;
-	}
-
-	fd = accept(lfd, NULL, 0);
-	if (fd < 0)
-		return -1;
-
-	return fd;
-}
-
-
-int
-tcp_exchange(int fd, fence_auth_type_t auth, void *key,
-	      size_t key_len, int timeout)
-{
-	char ret;
-	fd_set rfds;
-	struct timeval tv;
-
-	/* Ok, we're connected */
-	dbg_printf(3, "Issuing TCP challenge\n");
-	if (tcp_challenge(fd, auth, key, key_len, timeout) <= 0) {
-		/* Challenge failed */
-		logt_print(LOG_ERR, "Invalid response to challenge\n");
-		return 0;
-	}
-
-	/* Now they'll send us one, so we need to respond here */
-	dbg_printf(3, "Responding to TCP challenge\n");
-	if (tcp_response(fd, auth, key, key_len, timeout) <= 0) {
-		logt_print(LOG_ERR, "Invalid response to challenge\n");
-		return 0;
-	}
-
-	dbg_printf(2, "TCP Exchange + Authentication done... \n");
-
-	FD_ZERO(&rfds);
-	FD_SET(fd, &rfds);
-	tv.tv_sec = timeout;
-	tv.tv_usec = 0;
-
-	ret = 1;
-	dbg_printf(3, "Waiting for return value from XVM host\n");
-	if (select(fd + 1, &rfds, NULL, NULL, &tv) <= 0)
-		return -1;
-
-	/* Read return code */
-	if (read(fd, &ret, 1) < 0)
-		return -1;
-
-	close(fd);
-	if (ret == 0)
-		logt_print(LOG_INFO, "Remote: Operation was successful\n");
-	else
-		logt_print(LOG_INFO, "Remote: Operation failed\n");
-	return ret;
-}
-
-
-int
-send_multicast_packets(ip_list_t *ipl, fence_xvm_args_t *args, void *key,
-		       size_t key_len)
-{
-	fence_req_t freq;
-	int mc_sock;
-	ip_addr_t *ipa;
-	struct sockaddr_in tgt4;
-	struct sockaddr_in6 tgt6;
-	struct sockaddr *tgt;
-	socklen_t tgt_len;
-
-	for (ipa = ipl->tqh_first; ipa; ipa = ipa->ipa_entries.tqe_next) {
-
-		if (ipa->ipa_family != args->family) {
-			dbg_printf(2, "Ignoring %s: wrong family\n", ipa->ipa_address);
-			continue;
-		}
-
-		if (args->family == PF_INET) {
-			mc_sock = ipv4_send_sk(ipa->ipa_address, args->addr,
-					       args->port,
-					       (struct sockaddr *)&tgt4,
-					       sizeof(struct sockaddr_in),
-					       args->ttl);
-			tgt = (struct sockaddr *)&tgt4;
-			tgt_len = sizeof(tgt4);
-			
-		} else if (args->family == PF_INET6) {
-			mc_sock = ipv6_send_sk(ipa->ipa_address, args->addr,
-					       args->port,
-					       (struct sockaddr *)&tgt6,
-					       sizeof(struct sockaddr_in6),
-					       args->ttl);
-			tgt = (struct sockaddr *)&tgt6;
-			tgt_len = sizeof(tgt6);
-		} else {
-			dbg_printf(2, "Unsupported family %d\n", args->family);
-			return -1;
-		}
-
-		if (mc_sock < 0)
-			continue;
-
-		/* Build our packet */
-		memset(&freq, 0, sizeof(freq));
-		strncpy((char *)freq.domain, args->domain,
-			sizeof(freq.domain));
-		freq.request = args->op;
-		freq.hashtype = args->hash;
-
-		/* Store source address */
-		if (ipa->ipa_family == PF_INET) {
-			freq.addrlen = sizeof(struct in_addr);
-			/* XXX Swap order for in_addr ? XXX */
-			inet_pton(PF_INET, ipa->ipa_address, freq.address);
-		} else if (ipa->ipa_family == PF_INET6) {
-			freq.addrlen = sizeof(struct in6_addr);
-			inet_pton(PF_INET6, ipa->ipa_address, freq.address);
-		}
-
-		freq.flags = 0;
-		if (args->flags & F_USE_UUID)
-			freq.flags |= RF_UUID;
-		freq.family = ipa->ipa_family;
-		freq.port = args->port;
-
-		sign_request(&freq, key, key_len);
-
-		dbg_printf(3, "Sending to %s via %s\n", args->addr,
-		        ipa->ipa_address);
-
-		sendto(mc_sock, &freq, sizeof(freq), 0,
-		       (struct sockaddr *)tgt, tgt_len);
-
-		close(mc_sock);
-	}
-
-	return 0;
-}
-
-
-/* TODO: Clean this up!!! */
-int
-fence_xen_domain(fence_xvm_args_t *args)
-{
-	ip_list_t ipl;
-	char key[MAX_KEY_LEN];
-	int lfd, key_len = 0, fd;
-	int attempts = 0;
-	
-	if (args->auth != AUTH_NONE || args->hash != HASH_NONE) {
-		key_len = read_key_file(args->key_file, key, sizeof(key));
-		if (key_len < 0) {
-			logt_print(LOG_INFO,
-				   "Could not read %s; trying without "
-			           "authentication\n", args->key_file);
-			args->auth = AUTH_NONE;
-			args->hash = HASH_NONE;
-		}
-	}
-
-	/* Do the real work */
-	if (ip_build_list(&ipl) < 0) {
-		logt_print(LOG_ERR, "Error building IP address list\n");
-		return 1;
-	}
-
-	switch (args->auth) {
-		case AUTH_NONE:
-		case AUTH_SHA1:
-		case AUTH_SHA256:
-		case AUTH_SHA512:
-			if (args->family == PF_INET) {
-				lfd = ipv4_listen(args->port, 10);
-			} else {
-				lfd = ipv6_listen(args->port, 10);
-			}
-			break;
-		/*case AUTH_X509:*/
-			/* XXX Setup SSL listener socket here */
-		default:
-			return 1;
-	}
-
-	if (lfd < 0) {
-		logt_print(LOG_ERR, "Failed to listen: %s\n", strerror(errno));
-		return 1;
-	}
-
-	attempts = args->timeout * 10 / args->retr_time;
-
-	logt_print(LOG_INFO, "Sending fence request for %s\n", 
-		   args->domain);
-
-	do {
-		if (send_multicast_packets(&ipl, args, key, key_len)) {
-			return -1;
-		}
-
-		switch (args->auth) {
-			case AUTH_NONE:
-			case AUTH_SHA1:
-			case AUTH_SHA256:
-			case AUTH_SHA512:
-				fd = tcp_wait_connect(lfd, args->retr_time);
-				if (fd < 0 && (errno == ETIMEDOUT ||
-					       errno == EINTR))
-					continue;
-				break;
-			/* case AUTH_X509:
-				... = ssl_wait_connect... */
-			break;
-		default:
-			return 1;
-		}
-
-		break;
-	} while (--attempts);
-
-	if (fd < 0) {
-		if (attempts <= 0) {
-			logt_print(LOG_ERR,
-				   "Timed out waiting for response\n");
-			return 1;
-		}
-		logt_print(LOG_ERR, "Fencing failed: %s\n", strerror(errno));
-		return -1;
-	}
-
-	switch (args->auth) {
-		case AUTH_NONE:
-		case AUTH_SHA1:
-		case AUTH_SHA256:
-		case AUTH_SHA512:
-			return tcp_exchange(fd, args->auth, key, key_len,
-					    args->timeout);
-			break;
-		/* case AUTH_X509: 
-			return ssl_exchange(...); */
-		default:
-			return 1;
-	}
-
-	return 1;
-}
-
-
-int
-main(int argc, char **argv)
-{
-	fence_xvm_args_t args;
-	char *my_options = "di:a:p:T:r:C:c:k:H:uo:t:?hV";
-
-	/* Print to stderr.  Fenced will report our output for us */
-	logt_init(LOG_DAEMON_NAME, LOG_MODE_OUTPUT_STDERR,
-		  SYSLOGFACILITY, SYSLOGLEVEL, SYSLOGLEVEL, NULL);
-
-	args_init(&args);
-
-	if (argc == 1) {
-		args_get_stdin(my_options, &args);
-	} else {
-		args_get_getopt(argc, argv, my_options, &args);
-	}
-
-	if (args.flags & F_HELP) {
-		args_usage(argv[0], my_options, 0);
-
-                printf("With no command line argument, arguments are "
-                       "read from standard input.\n");
-                printf("Arguments read from standard input take "
-                       "the form of:\n\n");
-                printf("    arg1=value1\n");
-                printf("    arg2=value2\n\n");
-
-		args_usage(argv[0], my_options, 1);
-		exit(0);
-	}
-
-	if (args.flags & F_VERSION) {
-		printf("%s %s\n", basename(argv[0]), XVM_VERSION);
-		printf("fence release %s\n", RELEASE_VERSION);
-		exit(0);
-	}
-
-	args_finalize(&args);
-	dset(args.debug);
-	
-	if (args.debug > 0) {
-		logt_conf(LOG_DAEMON_NAME, LOG_MODE_OUTPUT_STDERR,
-			  SYSLOGFACILITY, LOG_DEBUG, LOG_DEBUG, NULL);
-		args_print(&args);
-	}
-
-	/* Additional validation here */
-	if (!args.domain) {
-		logt_print(LOG_ERR, "No domain specified!\n");
-		args.flags |= F_ERR;
-	}
-
-	if (args.flags & F_ERR) {
-		args_usage(argv[0], my_options, (argc == 1));
-		exit(1);
-	}
-
-	/* Initialize NSS; required to do hashing, as silly as that
-	   sounds... */
-	if (NSS_NoDB_Init(NULL) != SECSuccess) {
-		logt_print(LOG_ERR, "Could not initialize NSS\n");
-		return 1;
-	}
-
-	return fence_xen_domain(&args);
-}
diff --git a/fence/agents/xvm/fence_xvmd.c b/fence/agents/xvm/fence_xvmd.c
deleted file mode 100644
index e6037a7..0000000
--- a/fence/agents/xvm/fence_xvmd.c
+++ /dev/null
@@ -1,1004 +0,0 @@
-/*
- * Author: Lon Hohberger <lhh at redhat.com>
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <sys/un.h>
-#include <sys/socket.h>
-#include <sys/select.h>
-#include <sys/ioctl.h>
-#include <arpa/inet.h>
-#include <net/if.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <sys/time.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <limits.h>
-#include <pthread.h>
-#define SYSLOG_NAMES
-#include <syslog.h>
-#include <virterror.h>
-#include <nss.h>
-#include <libgen.h>
-#include <ccs.h>
-#include <liblogthread.h>
-
-/* Local includes */
-#include "xvm.h"
-#include "simple_auth.h"
-#include "options.h"
-#include "mcast.h"
-#include "tcp.h"
-#include "virt.h"
-#include "libcman.h"
-#include "debug.h"
-
-static int running = 1;
-static int reload_key;
-
-#define LOG_DAEMON_NAME  "xvmd"
-#define LOG_MODE_DEFAULT LOG_MODE_OUTPUT_SYSLOG|LOG_MODE_OUTPUT_FILE
-static int log_mode_default = LOG_MODE_DEFAULT;
-
-int cleanup_xml(char *xmldesc, char **ret, size_t *retsz);
-
-int
-connect_tcp(fence_req_t *req, fence_auth_type_t auth,
-	    void *key, size_t key_len)
-{
-	int fd = -1;
-	struct sockaddr_in sin;
-	struct sockaddr_in6 sin6;
-	char buf[128];
-
-	switch(req->family) {
-	case PF_INET:
-		memset(&sin, 0, sizeof(sin));
-		memcpy(&sin.sin_addr, req->address,
-		       sizeof(sin.sin_addr));
-		sin.sin_family = PF_INET;
-		fd = ipv4_connect(&sin.sin_addr, req->port,
-				  5);
-		if (fd < 0) {
-			logt_print(LOG_ERR,
-				   "Failed to connect to caller: %s\n",
-				   strerror(errno));
-			return -1;
-		}
-		break;
-	case PF_INET6:
-		memset(&sin6, 0, sizeof(sin));
-		memcpy(&sin6.sin6_addr, req->address,
-		       sizeof(sin6.sin6_addr));
-		sin.sin_family = PF_INET6;
-		fd = ipv6_connect(&sin6.sin6_addr, req->port,
-				  5);
-
-		memset(buf,0,sizeof(buf));
-		inet_ntop(PF_INET6, &sin6.sin6_addr, buf, sizeof(buf));
-
-		if (fd < 0) {
-			logt_print(LOG_ERR, "Failed to call back %s\n", buf);
-			return -1;
-		}
-		break;
-	default:
-		dbg_printf(1, "Family = %d\n", req->family);
-		return -1;
-	}
-
-	/* Noops if auth == AUTH_NONE */
-	if (tcp_response(fd, auth, key, key_len, 10) <= 0) {
-		logt_print(LOG_ERR, "Failed to respond to challenge\n");
-		close(fd);
-		return -1;
-	}
-
-	if (tcp_challenge(fd, auth, key, key_len, 10) <= 0) {
-		logt_print(LOG_ERR, "Remote failed challenge\n");
-		close(fd);
-		return -1;
-	}
-	return fd;
-}
-
-
-int
-do_notify_caller_tcp(fence_req_t *req, fence_auth_type_t auth,
-		     void *key, size_t key_len, char response)
-{
-	int fd;
-
-	fd = connect_tcp(req, auth, key, key_len);
-	if (fd < 0)
-		goto out;
-
-	if (write(fd, &response, 1) < 0) {
-		perror("write");
-	}
-out:
-	if (fd != -1) {
-		close(fd);
-		return 0;
-	}
-
-	return -1;
-}
-
-
-void
-raise_error(virConnectPtr vp)
-{
-	virErrorPtr vep;
-
-	vep = virConnGetLastError(vp);
-	if (!vep) {
-		logt_print(LOG_ERR,
-		   "Error: Unable to retrieve error from connection!\n");
-		return;
-	}
-
-	logt_print(LOG_ERR, "Error: libvirt #%d domain %d: %s\n", vep->code,
-	       vep->domain, vep->message);
-}
-
-
-static inline virDomainPtr
-get_domain(fence_req_t *req, virConnectPtr vp)
-{
-	if (req->flags & RF_UUID) {
-		return virDomainLookupByUUIDString(vp,
-					(const char *)req->domain);
-	}
-
-	return virDomainLookupByName(vp, (const char *)req->domain);
-}
-
-
-static inline int
-wait_domain(fence_req_t *req, virConnectPtr vp, int timeout)
-{
-	int tries = 0;
-	int response = 1;
-	virDomainPtr vdp;
-	virDomainInfo di;
-
-	if (!(vdp = get_domain(req, vp)))
-		return 0;
-
-	/* Check domain liveliness.  If the domain is still here,
-	   we return failure, and the client must then retry */
-	/* XXX On the xen 3.0.4 API, we will be able to guarantee
-	   synchronous virDomainDestroy, so this check will not
-	   be necessary */
-	do {
-		sleep(1);
-		vdp = get_domain(req, vp);
-		if (!vdp) {
-			dbg_printf(2, "Domain no longer exists\n");
-			response = 0;
-			break;
-		}
-
-		memset(&di, 0, sizeof(di));
-		virDomainGetInfo(vdp, &di);
-		virDomainFree(vdp);
-
-		if (di.state == VIR_DOMAIN_SHUTOFF) {
-			dbg_printf(2, "Domain has been shut off\n");
-			response = 0;
-			break;
-		}
-		
-		dbg_printf(4, "Domain still exists (state %d) after %d seconds\n",
-			di.state, tries);
-
-		if (++tries >= timeout)
-			break;
-	} while (1);
-
-	return response;
-}
-
-
-
-
-int
-do_fence_request_tcp(fence_req_t *req, fence_auth_type_t auth,
-		     void *key, size_t key_len, virConnectPtr vp,
-		     int flags)
-{
-	int fd = -1, ret = -1;
-	virDomainPtr vdp = NULL, nvdp = NULL;
-	virDomainInfo vdi;
-	char response = 1;
-	char *domain_desc, *domain_desc_sanitized;
-	size_t sz;
-
-	if (!(vdp = get_domain(req, vp)) && (!(flags & F_NOCLUSTER))) {
-		dbg_printf(2, "Could not find domain: %s\n", req->domain);
-		goto out;
-	}
-
-	fd = connect_tcp(req, auth, key, key_len);
-	if (fd < 0) {
-		dbg_printf(2, "Could call back for fence request: %s\n", 
-			strerror(errno));
-		goto out;
-	}
-
-	switch(req->request) {
-	case FENCE_NULL:
-		dbg_printf(1, "NULL operation: returning failure\n");
-		response = 1;
-		break;
-	case FENCE_OFF:
-		logt_print(LOG_NOTICE, "Destroying domain %s...\n",
-			   (char *)req->domain);
-		if (flags & F_NOCLUSTER) {
-			if (!vdp ||
-			    ((virDomainGetInfo(vdp, &vdi) == 0) &&
-			     (vdi.state == VIR_DOMAIN_SHUTOFF))) {
-				dbg_printf(2, "[NOCLUSTER] Nothing to "
-					   "do - domain does not exist\n");
-				response = 0;
-				break;
-			}
-		}
-
-
-		dbg_printf(2, "[OFF] Calling virDomainDestroy\n");
-		ret = virDomainDestroy(vdp);
-		if (ret < 0) {
-			logt_print(LOG_ERR,
-				   "virDomainDestroy() failed: %d\n",
-				   ret);
-			break;
-		}
-
-		response = wait_domain(req, vp, 15);
-
-		if (response) {
-			logt_print(LOG_ERR,
-			   "Domain %s still exists; fencing failed\n",
-			   (char *)req->domain);
-		}
-		break;
-	case FENCE_REBOOT:
-		logt_print(LOG_NOTICE, "Rebooting domain %s...\n",
-			   (char *)req->domain);
-
-		if (flags & F_NOCLUSTER) {
-			if (!vdp ||
-			    ((virDomainGetInfo(vdp, &vdi) == 0) &&
-			     (vdi.state == VIR_DOMAIN_SHUTOFF))) {
-				dbg_printf(2, "[NOCLUSTER] Nothing to "
-					   "do - domain does not exist\n");
-				response = 0;
-				break;
-			}
-		}
-
-		domain_desc = virDomainGetXMLDesc(vdp, 0);
-
-		if (domain_desc) {
-			dbg_printf(3, "[[ XML Domain Info ]]\n");
-			dbg_printf(3, "%s\n[[ XML END ]]\n", domain_desc);
-
-			sz = 0;
-			if (cleanup_xml(domain_desc,
-					&domain_desc_sanitized, &sz) == 0) {
-				free(domain_desc);
-				domain_desc = domain_desc_sanitized;
-			}
-
-			dbg_printf(3, "[[ XML Domain Info (modified) ]]\n");
-			dbg_printf(3, "%s\n[[ XML END ]]\n", domain_desc);
-		} else {
-			dbg_printf(1, "Failed getting domain description from "
-				   "libvirt\n");
-		}
-
-		dbg_printf(2, "[REBOOT] Calling virDomainDestroy(%p)\n", vdp);
-		ret = virDomainDestroy(vdp);
-		if (ret < 0) {
-			logt_print(LOG_ERR,
-				   "virDomainDestroy() failed: %d/%d\n",
-				   ret, errno);
-			if (domain_desc)
-				free(domain_desc);
-			break;
-		}
-
-		response = wait_domain(req, vp, 15);
-
-		if (response) {
-			logt_print(LOG_ERR,
-				   "Domain %s still exists; fencing failed\n",
-				   (char *)req->domain);
-		} else if (domain_desc) {
-			/* Recreate the domain if possible */
-			/* Success... or not? */
-			dbg_printf(2, "Calling virDomainCreateLinux()...\n");
-			nvdp = virDomainCreateLinux(vp, domain_desc, 0);
-
-			if (nvdp == NULL) {
-				/* More recent versions of libvirt or perhaps the
- 				   KVM back-end do not let you create a domain from
- 				   XML if there is already a defined domain description
- 				   with the same name that it knows about.  You must
- 				   then call virDomainCreate() */
-				dbg_printf(2, "Failed; Trying virDomainCreate()...\n");
-				if (virDomainCreate(vdp) < 0) {
-					logt_print(LOG_ERR, "Failed to recreate guest"
-						   " %s!\n", (char *)req->domain);
-				}
-			}
-			free(domain_desc);
-		}
-		break;
-	}
-
-	dbg_printf(3, "Sending response to caller...\n");
-	if (write(fd, &response, 1) < 0) {
-		logt_print(LOG_ERR, "Failed to send response to caller: %s\n",
-			   strerror(errno));
-	}
-out:
-	if (vdp)
-		virDomainFree(vdp);
-	if (nvdp)
-		virDomainFree(nvdp);
-	if (fd != -1)
-		close(fd);
-
-	return 1;
-}
-
-
-int
-virt_list_update(virConnectPtr vp, virt_list_t **vl, int my_id)
-{
-	virt_list_t *list = NULL;
-
-	list = vl_get(vp, my_id);
-	if (!list)
-		return -1;
-
-	if (*vl)
-		vl_free(*vl);
-	*vl = list;
-
-	return 0;
-}
-
-
-int
-get_cman_ids(cman_handle_t ch, int *my_id, int *high_id)
-{
-	int max_nodes;
-	int actual;
-	cman_node_t *nodes = NULL;
-	cman_node_t me;
-	int high = 0, ret = -1, x, _local = 0;
-
-	if (!my_id && !high_id)
-		return 0;
-
-	if (!ch) {
-		_local = 1;
-		ch = cman_init(NULL);
-	}
-	if (!ch)
-		return -1;
-
-	max_nodes = cman_get_node_count(ch);
-	if (max_nodes <= 0)
-		goto out;
-
-	if (my_id) {
-		memset(&me, 0, sizeof(me));
-		if (cman_get_node(ch, CMAN_NODEID_US, &me) < 0)
-			goto out;
-		*my_id = me.cn_nodeid;
-	}
-
-	if (!high_id) {
-		ret = 0;
-		goto out;
-	}
-
-	nodes = malloc(sizeof(cman_node_t) * max_nodes);
-	if (!nodes)
-		goto out;
-	memset(nodes, 0, sizeof(cman_node_t) * max_nodes);
-
-	if (cman_get_nodes(ch, max_nodes, &actual, nodes) < 0)
-		goto out;
-
-	for (x = 0; x < actual; x++)
-		if (nodes[x].cn_nodeid > high && nodes[x].cn_member)
-			high = nodes[x].cn_nodeid;
-
-	*high_id = high;
-
-	ret = 0;
-out:
-	if (nodes)
-		free(nodes);
-	if (ch && _local)
-		cman_finish(ch);
-	return ret;
-}
-
-
-int
-get_domain_state_ckpt(void *hp, unsigned char *domain, vm_state_t *state)
-{
-	errno = EINVAL;
-
-	if (!hp || !domain || !state || !strlen((char *)domain))
-		return -1;
-	if (!strcmp(DOMAIN0NAME, (char *)domain))
-		return -1;
-
-	return ckpt_read(hp, (char *)domain, state, sizeof(*state));
-}
-
-
-void
-store_domains_by_name(void *hp, virt_list_t *vl)
-{
-	int x;
-
-	if (!vl)
-		return;
-
-	for (x = 0; x < vl->vm_count; x++) {
-		if (!strcmp(DOMAIN0NAME, vl->vm_states[x].v_name))
-			continue;
-		dbg_printf(2, "Storing %s\n", vl->vm_states[x].v_name);
-		ckpt_write(hp, vl->vm_states[x].v_name, 
-			   &vl->vm_states[x].v_state,
-			   sizeof(vm_state_t));
-	}
-}
-
-
-void
-store_domains_by_uuid(void *hp, virt_list_t *vl)
-{
-	int x;
-
-	if (!vl)
-		return;
-
-	for (x = 0; x < vl->vm_count; x++) {
-		if (!strcmp(DOMAIN0UUID, vl->vm_states[x].v_uuid))
-			continue;
-		dbg_printf(2, "Storing %s\n", vl->vm_states[x].v_uuid);
-		ckpt_write(hp, vl->vm_states[x].v_uuid, 
-			   &vl->vm_states[x].v_state,
-			   sizeof(vm_state_t));
-	}
-}
-
-
-static void
-handle_remote_domain(cman_handle_t ch, void *h, fence_req_t *data,
-		     fence_auth_type_t auth, void *key, size_t key_len,
-		     int my_id)
-{
-	vm_state_t vst;
-	int high_id;
-	int fenced;
-	uint64_t fence_time;
-	char ret = 1;
-	cman_node_t node;
-	
-
-	if (get_domain_state_ckpt(h, data->domain, &vst) < 0) {
-		dbg_printf(1, "Evaluating Domain: %s   Last Owner/State Unknown\n",
-		       data->domain);
-		memset(&vst, 0, sizeof(vst));
-	} else {
-		dbg_printf(1, "Evaluating Domain: %s   Last Owner: %d   State %d\n",
-		       data->domain, vst.s_owner, vst.s_state);
-	}
-			
-	if (get_cman_ids(ch, NULL, &high_id) < 0) {
-		logt_print(LOG_ERR,
-			   "Error: Could not determine high node ID; "
-			   "unable to process fencing request\n");
-		return;
-	}
-	
-	if (my_id == high_id && vst.s_owner == 0) {
-		dbg_printf(1, "There is no record of that domain; "
-		       "returning success\n");
-		ret = 0;
-	} else if (my_id == high_id && vst.s_owner != my_id) {
-
-		memset(&node, 0, sizeof(node));
-		cman_get_node(ch, vst.s_owner, &node);
-		if (node.cn_nodeid == 0) {
-			dbg_printf(1, "Node %d does not exist\n",
-				   vst.s_owner);
-			return;
-		}
-
-		if (node.cn_member) {
-			dbg_printf(1,
-				   "Node %d is online - not taking action\n",
-				   vst.s_owner);
-			return;
-		}
-
-		fenced = 0;
-		cman_get_fenceinfo(ch, vst.s_owner, &fence_time, &fenced, NULL);
-		if (fenced == 0) {
-			dbg_printf(1, "Node %d is dead but not fenced - not "
-				   "taking action\n", vst.s_owner);
-			return;
-		}
-
-		dbg_printf(1, "Node %d is dead & fenced\n", vst.s_owner);
-		ret = 0;
-					
-	} else if (vst.s_owner == my_id) {
-		dbg_printf(1, "I am the last owner of the domain\n");
-		ret = 0;
-	}
-
-	if (!ret) {
-		switch(auth) {
-		case AUTH_NONE:
-		case AUTH_SHA1:
-		case AUTH_SHA256:
-		case AUTH_SHA512:
-			dbg_printf(1, "Plain TCP request\n");
-			do_notify_caller_tcp(data, auth, key, key_len, ret);
-			break;
-		default:
-			dbg_printf(1, "XXX Unhandled authentication\n");
-		}
-	}
-}
-
-
-int
-xvmd_loop(cman_handle_t ch, void *h, int fd, fence_xvm_args_t *args,
-	  void *key, size_t key_len)
-{
-	fd_set rfds;
-	struct timeval tv;
-	struct sockaddr_in sin;
-	int len;
-	int n;
-	int my_id = 1;
-	socklen_t slen;
-	fence_req_t data;
-	virConnectPtr vp = NULL;
-	virt_list_t *vl = NULL;
-	virt_state_t *dom = NULL;
-
-	vp = virConnectOpen(args->uri);
-  	if (!vp)
-		logt_print(LOG_ERR, "virConnectOpen failed: %s",
-			   strerror(errno));
-  
-  	if (!(args->flags & F_NOCLUSTER))
-  		get_cman_ids(ch, &my_id, NULL);
-  
-	dbg_printf(1, "My Node ID = %d\n", my_id);
-	
-	if (vp) {
-		vl = vl_get(vp, my_id);
-		vl_print(vl);
-		virt_list_update(vp, &vl, my_id);
-		if (args->flags & F_USE_UUID) 
-			store_domains_by_uuid(h, vl);
-		else
-			store_domains_by_name(h, vl);
-	}
-
-	while (running) {
-		FD_ZERO(&rfds);
-		FD_SET(fd, &rfds);
-		tv.tv_sec = 10;
-		tv.tv_usec = 0;
-
-		/* Close the connection */
-		if (vp) {
-			virConnectClose(vp);
-			vp = NULL;
-		}
-
-		if (reload_key) {
-			char temp_key[MAX_KEY_LEN];
-			int ret;
-
-			reload_key = 0;
-
-			ret = read_key_file(args->key_file, temp_key,
-					    sizeof(temp_key));
-			if (ret < 0) {
-				logt_print(LOG_ERR, "Could not read %s; not updating key",
-					args->key_file);
-			} else {
-				memcpy(key, temp_key, MAX_KEY_LEN);
-				key_len = (size_t) ret;
-
-				if (args->auth == AUTH_NONE)
-					args->auth = AUTH_SHA256;
-				if (args->hash == HASH_NONE)
-					args->hash = HASH_SHA256;
-			}
-		}
-		
-		n = select(fd+1, &rfds, NULL, NULL, &tv);
-		if (n < 0)
-			continue;
-	
-		/* Request and/or timeout: open connection */
-		vp = virConnectOpen(args->uri);
-		if (!vp) {
-			logt_print(LOG_NOTICE, "NOTICE: virConnectOpen(): "
-				   "%s; cannot fence!\n", strerror(errno));
-			continue;
-		}
-			
-		/* Update list of VMs from libvirt. */
-		virt_list_update(vp, &vl, my_id);
-		vl_print(vl);
-
-		/* Store information here */
-		if (!(args->flags & F_NOCLUSTER)) {
-			if (args->flags & F_USE_UUID) 
-				store_domains_by_uuid(h, vl);
-			else
-				store_domains_by_name(h, vl);
-		}
-		
-		/* 
-		 * If no requests, we're done 
-		 */
-		if (n == 0)
-			continue;
-
-		slen = sizeof(sin);
-		len = recvfrom(fd, &data, sizeof(data), 0,
-			       (struct sockaddr *)&sin, &slen);
-		
-		if (len <= 0) {
-			logt_print(LOG_ERR, "recvfrom: %s\n",
-				   strerror(errno));
-			continue;
-		}
-
-		if (!verify_request(&data, args->hash, key, key_len)) {
-			dbg_printf(1, "Key mismatch; dropping packet\n");
-			continue;
-		}
-
-		if ((args->flags & F_USE_UUID) &&
-		    !(data.flags & RF_UUID)) {
-			dbg_printf(1, "Dropping packet: Request to fence by "
-			           "name while using UUIDs\n");
-			continue;
-		}
-
-		if (!(args->flags & F_USE_UUID) &&
-		    (data.flags & RF_UUID)) {
-			dbg_printf(1, "Dropping packet: Request to fence by "
-			           "UUID while using names\n");
-			continue;
-		}
-
-		dbg_printf(1, "Request to fence: %s\n", data.domain);
-		
-		if (args->flags & F_USE_UUID)
-			dom = vl_find_uuid(vl, (char *)data.domain);
-		else
-			dom = vl_find_name(vl, (char *)data.domain);
-		if (!dom && !(args->flags & F_NOCLUSTER)) {
-			handle_remote_domain(ch, h, &data, args->auth,
-					     key, key_len, my_id);
-			continue;
-		}
-
-		dbg_printf(1, "%s is running locally\n", (char *)data.domain);
-
-		switch(args->auth) {
-		case AUTH_NONE:
-		case AUTH_SHA1:
-		case AUTH_SHA256:
-		case AUTH_SHA512:
-			dbg_printf(1, "Plain TCP request\n");
-			do_fence_request_tcp(&data, args->auth, key,
-					     key_len, vp, args->flags);
-			break;
-		default:
-			logt_print(LOG_ERR, "XXX Unhandled authentication\n");
-		}
-	}
-
-	cman_finish(ch);
-	
-	if (vp) {
-		virConnectClose(vp);
-		vp = NULL;
-	}
-
-	return 0;
-}
-
-
-void
-sigint_handler(int sig)
-{
-	running = 0;
-}
-
-void
-sighup_handler(int sig)
-{
-	reload_key = 1;
-}
-
-void malloc_dump_table(void);
-
-int
-ccs_read_old_logging(int ccsfd, int *facility, int *priority)
-{
-	char query[256];
-	char *val;
-	int x, ret = 0;
-
-	/* Get log log_facility */
-	snprintf(query, sizeof(query), "/cluster/fence_xvmd/@log_facility");
-	if (ccs_get(ccsfd, query, &val) == 0) {
-		logt_print(LOG_WARNING,
-			   "Use of fence_xvmd/@log_facility is deprecated!\n");
-		for (x = 0; facilitynames[x].c_name; x++) {
-			if (strcasecmp(val, facilitynames[x].c_name))
-				continue;
-			*facility = facilitynames[x].c_val;
-			ret = 1;
-			break;
-		}
-		free(val);
-	}
-
-	/* Get log level */
-	snprintf(query, sizeof(query), "/cluster/fence_xvmd/@log_level");
-	if (ccs_get(ccsfd, query, &val) == 0) {
-		logt_print(LOG_WARNING,
-			   "Use of fence_xvmd/@log_level is deprecated!\n");
-		*priority = atoi(val);
-		free(val);
-		if (*priority < 0)
-			*priority = SYSLOGLEVEL;
-		else
-			ret = 1;
-	}
-
-	return ret;
-}
-
-
-void
-conf_logging(int debug, int logmode, int facility, int loglevel,
-	     int filelevel, char *fname)
-{
-	static int _log_config = 0;
-
-	if (debug)
-		filelevel = LOG_DEBUG;
-
-	if (_log_config) {
-		logt_conf(LOG_DAEMON_NAME, logmode, facility, loglevel,
-			  filelevel, fname);
-	}
-
-	logt_init(LOG_DAEMON_NAME, logmode, facility, loglevel,
-		  filelevel, fname);
-	_log_config = 1;
-}
-
-
-/**
-  Grab log configuration data from libccs
- */
-static int
-get_log_config_data(int use_ccs, int debug)
-{
-	char fname[PATH_MAX];
-	int logmode = log_mode_default;
-	int facility = SYSLOGFACILITY;
-	int loglevel = SYSLOGLEVEL, filelevel = SYSLOGLEVEL;
-	int need_close = 0, ccsfd = -1;
-
-	logt_print(LOG_DEBUG, "Loading logging configuration\n");
-
-	if (use_ccs) {
-		ccsfd = ccs_connect();
-		if (ccsfd < 0) {
-			logt_print(LOG_ERR, "Failed to gather logging "
-				"configuration; using defaults\n");
-			use_ccs = 0;
-		} else {
-			need_close = 1;
-		}
-	}
-
-	snprintf(fname, sizeof(fname)-1, LOGDIR "/fence_xvmd.log");
-
-	if (use_ccs) {
-		if (ccs_read_old_logging(ccsfd, &facility, &loglevel))
-			filelevel = loglevel;
-
-		ccs_read_logging(ccsfd, LOG_DAEMON_NAME, &debug, &logmode,
-       		 	&facility, &loglevel, &filelevel, (char *)fname);
-	}
-
-	conf_logging(debug, logmode, facility, loglevel, filelevel, fname);
-
-	if (need_close)
-		ccs_disconnect(ccsfd);
-
-	return 0;
-}
-
-
-int
-main(int argc, char **argv)
-{
-	fence_xvm_args_t args;
-	int mc_sock;
-	char key[MAX_KEY_LEN];
-	int key_len = 0, x;
-	char *my_options = "dfi:a:p:I:C:U:c:k:u?hLXV";
-	cman_handle_t ch = NULL;
-	void *h = NULL;
-
-	/* Start w/ stderr output only */
-	conf_logging(0, LOG_MODE_OUTPUT_STDERR, SYSLOGFACILITY,
-		     SYSLOGLEVEL, SYSLOGLEVEL, NULL);
-
-	args_init(&args);
-	args_get_getopt(argc, argv, my_options, &args);
-
-	if (args.flags & F_HELP) {
-		args_usage(argv[0], my_options, 0);
-
-		printf("Arguments may be specified as part of the\n");
-		printf("fence_xvmd tag in cluster.conf in the form of:\n");
-		printf("    <fence_xvmd argname=\"value\" ... />\n\n");
-
-		args_usage(argv[0], my_options, 1);
-		return 0;
-	}
-
-	if (args.flags & F_VERSION) {
-		printf("%s %s\n", basename(argv[0]), XVM_VERSION);
-		printf("fence release %s\n", RELEASE_VERSION);
-		logt_exit();
-		exit(0);
-	}
-
-	if (!(args.flags & F_NOCCS)) {
-		args_get_ccs(my_options, &args);
-	}
-
-	if (args.flags & F_FOREGROUND)
-		log_mode_default |= LOG_MODE_OUTPUT_STDERR;
-	get_log_config_data(!(args.flags & F_NOCCS), args.debug);
-
-	args_finalize(&args);
-	if (args.debug > 0) {
-		dset(args.debug);
-		args_print(&args);
-	}
-
-	if (args.flags & F_ERR)
-		goto out_fail;
-
-	if (args.auth != AUTH_NONE || args.hash != HASH_NONE) {
-		key_len = read_key_file(args.key_file, key, sizeof(key));
-		if (key_len < 0) {
-			logt_print(LOG_WARNING,
-				   "Could not read %s; operating without "
-			           "authentication\n", args.key_file);
-			args.auth = AUTH_NONE;
-			args.hash = HASH_NONE;
-		}
-	}
-
-	/* Fork in to background */
-	/* XXX need to wait for child to successfully start before
-	   exiting... */
-	if (!(args.flags & F_FOREGROUND)) {
-		logt_exit();
-		if(daemon(0,0)) {
-			logt_reinit();
-			logt_print(LOG_ERR, "Could not daemonize\n");
-			goto out_fail;
-		}
-		logt_reinit();
-	}
-
-	if (virInitialize() != 0) {
-		logt_print(LOG_ERR, "Could not initialize libvirt\n");
-		goto out_fail;
-	}
-
-	/* Initialize NSS; required to do hashing, as silly as that
-	   sounds... */
-	if (NSS_NoDB_Init(NULL) != SECSuccess) {
-		logt_print(LOG_ERR, "Could not initialize NSS\n");
-		goto out_fail;
-	}
-	
-	if (!(args.flags & F_NOCLUSTER)) {
-		/* Wait for cman to start. */
-		x = 0;
-		while ((ch = cman_init(NULL)) == NULL) {
-			if (!x) {
-				dbg_printf(1,
-				  "Could not connect to CMAN; retrying...\n");
-				x = 1;
-			}
-			sleep(3);
-		}
-		if (x)
-			dbg_printf(1, "Connected to CMAN\n");
-		/* Wait for quorum */
-		while (!cman_is_quorate(ch))
-			sleep(3);
-
-		/* Wait for openais checkpointing to become available */
-		x = 0;
-		while ((h = ckpt_init("vm_states", 262144, 4096, 64, 10)) == NULL) {
-			if (!x) {
-				dbg_printf(1, "Could not initialize saCkPt; retrying...\n");
-				x = 1;
-			}
-			sleep(3);
-		}
-		if (x)
-			dbg_printf(1, "Checkpoint initialized\n");
-	}
-
-	if (args.family == PF_INET)
-		mc_sock = ipv4_recv_sk(args.addr, args.port, args.ifindex);
-	else
-		mc_sock = ipv6_recv_sk(args.addr, args.port, args.ifindex);
-	if (mc_sock < 0) {
-		logt_print(LOG_ERR,
-			   "Could not set up multicast listen socket\n");
-		goto out_fail;
-	}
-
-
-	signal(SIGHUP, sighup_handler);
-	signal(SIGINT, sigint_handler);
-	signal(SIGTERM, sigint_handler);
-	signal(SIGQUIT, sigint_handler);
-	xvmd_loop(ch, h, mc_sock, &args, key, key_len);
-
-	//malloc_dump_table();
-
-	return 0;
-
-out_fail:
-	logt_exit();
-	return 1;
-}
diff --git a/fence/agents/xvm/ip_lookup.c b/fence/agents/xvm/ip_lookup.c
deleted file mode 100644
index e70675c..0000000
--- a/fence/agents/xvm/ip_lookup.c
+++ /dev/null
@@ -1,307 +0,0 @@
-/** @file
- * Build lists of IPs on the system, excepting loopback ipv6 link-local
- */
-#include <asm/types.h>
-#include <sys/types.h>
-#include <arpa/inet.h>
-#include <sys/socket.h>
-#include <linux/netlink.h>
-#include <linux/rtnetlink.h>
-#include <errno.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <netdb.h>
-#include <liblogthread.h>
-
-#ifndef IFA_MAX
-#include <linux/if_addr.h>
-#endif
-
-/* Local includes */
-#include "ip_lookup.h"
-#include "debug.h"
-
-static int
-send_addr_dump(int fd, int family)
-{
-	struct nlmsghdr *nh;
-	struct rtgenmsg *g;
-	char buf[256];
-	struct sockaddr_nl addr;
-
-	memset(&addr,0,sizeof(addr));
-	addr.nl_family = PF_NETLINK;
-
-	memset(buf, 0, sizeof(buf));
-	nh = (struct nlmsghdr *)buf;
-	g = (struct rtgenmsg *)(buf + sizeof(struct nlmsghdr));
-
-	nh->nlmsg_len = NLMSG_LENGTH(sizeof(struct rtgenmsg));
-	nh->nlmsg_flags = NLM_F_REQUEST|NLM_F_DUMP;
-	nh->nlmsg_type = RTM_GETADDR;
-	g->rtgen_family = family;
-
-	return sendto(fd, buf, nh->nlmsg_len, 0, (struct sockaddr *)&addr,
-	   	      sizeof(addr));
-}
-
-
-static int
-add_ip(ip_list_t *ipl, char *ipaddr, char family)
-{
-	ip_addr_t *ipa;
-
-	if (family == PF_INET6) {
-		/* Avoid loopback */
-		if (!strcmp(ipaddr, "::1"))
-			return -1;
-
-		/* Avoid link-local addresses */
-		if (!strncmp(ipaddr, "fe80", 4))
-			return -1;
-		if (!strncmp(ipaddr, "fe90", 4))
-			return -1;
-		if (!strncmp(ipaddr, "fea0", 4))
-			return -1;
-		if (!strncmp(ipaddr, "feb0", 4))
-			return -1;
-	}
-	
-	dbg_printf(4, "Adding IP %s to list (family %d)\n", ipaddr, family);
-
-	ipa = malloc(sizeof(*ipa));
-	if (!ipa)
-		return -1;
-	memset(ipa, 0, sizeof(*ipa));
-	ipa->ipa_family = family;
-	ipa->ipa_address = strdup(ipaddr);
-
-	TAILQ_INSERT_TAIL(ipl, ipa, ipa_entries);
-
-	return 0;
-}
-
-
-static int
-add_ip_addresses(int family, ip_list_t *ipl)
-{
-	/* List ipv4 addresses */
-	struct nlmsghdr *nh;
-	struct ifaddrmsg *ifa;
-	struct rtattr *rta, *nrta;
-	struct nlmsgerr *err;
-	char buf[10240];
-	char outbuf[256];
-	int x, fd, len;
-
-	dbg_printf(5, "Connecting to Netlink...\n");
-	fd = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE);
-	if (fd < 0) {
-		perror("socket");
-		exit(1);
-	}
-	
-	dbg_printf(5, "Sending address dump request\n");
-	send_addr_dump(fd, family);
-	memset(buf, 0, sizeof(buf));
-	
-	dbg_printf(5, "Waiting for response\n");
-	x = recvfrom(fd, buf, sizeof(buf), 0, NULL, 0);
-	if (x < 0) {
-		perror("recvfrom");
-		return -1;
-	}
-	
-	dbg_printf(5, "Received %d bytes\n", x);
-
-	nh = (struct nlmsghdr *)buf;
-	while (NLMSG_OK(nh, x)) {
-
-		switch(nh->nlmsg_type) {
-		case NLMSG_DONE:
-			close(fd);
-    			return 0;
-
-		case NLMSG_ERROR:
-			err = (struct nlmsgerr*)NLMSG_DATA(nh);
-			if (nh->nlmsg_len <
-			    NLMSG_LENGTH(sizeof(struct nlmsgerr))) {
-				fprintf(stderr, "ERROR truncated");
-			} else {
-				errno = -err->error;
-				perror("RTNETLINK answers");
-			}
-			close(fd);
-			return -1;
-
-		case RTM_NEWADDR:
-			break;
-
-		default:
-			nh = NLMSG_NEXT(nh, x);
-			continue;
-		}
-
-		/* RTM_NEWADDR */
-		len = NLMSG_PAYLOAD(nh,0);
-		ifa = NLMSG_DATA(nh);
-
-		/* Make sure we got the type we expect back */
-		if (ifa->ifa_family != family) {
-			nh = NLMSG_NEXT(nh, x);
-			continue;
-		}
-
-		rta = (struct rtattr *)((void *)ifa + sizeof(*ifa));
-		len -= sizeof(*ifa);
-		do {
-			/* Make sure we've got a valid rtaddr field */
-			if (!RTA_OK(rta, len)) {
-				dbg_printf(5, "!RTA_OK(rta, len)\n");
-				break;
-			}
-
-			if (rta->rta_type == IFA_ADDRESS) {
-				inet_ntop(family, RTA_DATA(rta), outbuf,
-					  sizeof(outbuf) );
-				add_ip(ipl, outbuf, family);
-			}
-
-			if (rta->rta_type == IFA_LABEL) {
-				dbg_printf(5, "Skipping label: %s\n",
-					(char *)RTA_DATA(rta));
-			}
-
-			nrta = RTA_NEXT(rta, len);
-			if (!nrta)
-				break;
-
-			len -= ((void *)nrta - (void *)rta);
-			rta = nrta;
-		} while (RTA_OK(rta, len));
-
-		nh = NLMSG_NEXT(nh, x);
-	}
-
-	dbg_printf(5, "Closing Netlink connection\n");
-	close(fd);
-	return 0;
-}
-
-
-int
-ip_search(ip_list_t *ipl, char *ip_name)
-{
-	ip_addr_t *ipa;
-	
-	dbg_printf(5, "Looking for IP address %s in IP list %p...", ip_name, ipl);
-	ipa = ipl->tqh_first;
-	for (ipa = ipl->tqh_first; ipa; ipa = ipa->ipa_entries.tqe_next) {
-		if (!strcmp(ip_name, ipa->ipa_address)) {
-			dbg_printf(4,"Found\n");
-			return 0;
-		}
-	}
-	dbg_printf(5, "Not found\n");
-	return 1;
-}
-
-
-int
-ip_free_list(ip_list_t *ipl)
-{
-	ip_addr_t *ipa;
-	
-	dbg_printf(5, "Tearing down IP list @ %p\n", ipl);
-	while ((ipa = ipl->tqh_first)) {
-		TAILQ_REMOVE(ipl, ipa, ipa_entries);
-		free(ipa->ipa_address);
-		free(ipa);
-	}
-	return 0;
-}
-
-
-int
-ip_build_list(ip_list_t *ipl)
-{
-	dbg_printf(5, "Build IP address list\n");
-	TAILQ_INIT(ipl);
-	if (add_ip_addresses(PF_INET6, ipl) < 0) {
-		ip_free_list(ipl);
-		return -1;
-	}
-	if (add_ip_addresses(PF_INET, ipl) < 0) {
-		ip_free_list(ipl);
-		return -1;
-	}
-	return 0;
-}
-
-
-/**
-  Look up the interface name which corresponds to the given hostname and
-  return the list of matching attrinfo structures.  We do this by looking
-  up all the possible physical and virtual network interfaces on the machine
-  and checking the hostname/IP mappings for each active IP address incurred.
-
-  @param nodename	Interface name
-  @param ret_ai		Structure pointer to allocate & return.
-  @return		-1 on failure or 0 on success.
- */
-int
-ip_lookup(char *nodename, struct addrinfo **ret_ai)
-{
-	char ip_name[256];
-	struct addrinfo *ai = NULL;
-	struct addrinfo *n;
-	void *p;
-	ip_list_t ipl;
-	int ret = -1;
-
-	dbg_printf(5, "Looking for IP matching %s\n", nodename);
-	/* Build list of IP addresses configured locally */
-	if (ip_build_list(&ipl) < 0)
-		return -1;
-
-	/* Get list of addresses for the host-name/ip */
-	if (getaddrinfo(nodename, NULL, NULL, &ai) != 0) 
-		return -1;
-	
-
-	/* Traverse list of addresses for given host-name/ip */
-	for (n = ai; n; n = n->ai_next) {
-		if (n->ai_family != PF_INET && n->ai_family != PF_INET6)
-			continue;
-
-		if (n->ai_family == PF_INET)
-			p = &(((struct sockaddr_in *)n->ai_addr)->sin_addr);
-		else
-			p = &(((struct sockaddr_in6 *)n->ai_addr)->sin6_addr);
-
-		if (!inet_ntop(n->ai_family, p, ip_name,
-			       sizeof(ip_name)))
-			continue;
-
-		/* Search local interfaces for this IP address */
-		if (ip_search(&ipl, ip_name) != 0)
-			continue;
-
-		/* Found it */
-		ret = 0;
-		break;
-	}
-
-	/* Clean up */
-	if (!ret_ai)
-		freeaddrinfo(ai);
-	else
-		*ret_ai = ai;
-
-	ip_free_list(&ipl);
-
-	return ret;
-}
-
diff --git a/fence/agents/xvm/ip_lookup.h b/fence/agents/xvm/ip_lookup.h
deleted file mode 100644
index a3e4568..0000000
--- a/fence/agents/xvm/ip_lookup.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/** @file
- * Header for ip_lookup.c
- */
-#ifndef _IP_LOOKUP_H
-#define _IP_LOOKUP_H
-
-#include <sys/queue.h>
-
-typedef struct _ip_address {
-	TAILQ_ENTRY(_ip_address) ipa_entries;
-	char ipa_family;
-	char *ipa_address;
-} ip_addr_t;
-
-typedef TAILQ_HEAD(_ip_list, _ip_address) ip_list_t;
-
-int ip_search(ip_list_t *ipl, char *ip_name);
-int ip_free_list(ip_list_t *ipl);
-int ip_build_list(ip_list_t *ipl);
-int ip_lookup(char *, struct addrinfo **);
-
-#endif
diff --git a/fence/agents/xvm/mcast.c b/fence/agents/xvm/mcast.c
deleted file mode 100644
index 1a7265d..0000000
--- a/fence/agents/xvm/mcast.c
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- * Author: Lon Hohberger <lhh at redhat.com>
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <sys/un.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <arpa/inet.h>
-#include <net/if.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <sys/time.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <pthread.h>
-
-/* Local includes */
-#include "mcast.h"
-#include "debug.h"
-
-/** 
-  Sets up a multicast receive socket
- */
-int
-ipv4_recv_sk(char *addr, int port, unsigned int ifindex)
-{
-	int sock;
-	struct ip_mreqn mreq;
-	struct sockaddr_in sin;
-
-	/* Store multicast address */
-	if (inet_pton(PF_INET, addr,
-		      (void *)&mreq.imr_multiaddr.s_addr) < 0) {
-		printf("Invalid multicast address: %s\n", addr);
-		return -1;
-	}
-
-	/********************************
-	 * SET UP MULTICAST RECV SOCKET *
-	 ********************************/
-	dbg_printf(4, "Setting up ipv4 multicast receive (%s:%d)\n", addr, port);
-	sock = socket(PF_INET, SOCK_DGRAM, 0);
-	if (sock < 0) {
-		printf("socket: %s\n", strerror(errno));
-		close(sock);
-		sock = -1;
-		return 1;
-	}
-
-	/*
-	 * When using Multicast, bind to the LOCAL address, not the MULTICAST
-	 * address.
-	 */
-	sin.sin_family = PF_INET;
-	sin.sin_port = htons(port);
-	sin.sin_addr.s_addr = htonl(INADDR_ANY);
-	if (bind(sock, (struct sockaddr *) &sin,
-		 sizeof(struct sockaddr_in)) < 0) {
-		printf("bind failed: %s\n", strerror(errno));
-		close(sock);
-		return -1;
-	}
-
-	/*
-	 * Join multicast group
-	 */
-	/* mreq.imr_multiaddr.s_addr is set above */
-	mreq.imr_ifindex = ifindex;
-	dbg_printf(4, "Joining multicast group\n");
-	if (setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP,
-		       &mreq, sizeof(mreq)) == -1) {
-		printf("Failed to bind multicast receive socket to "
-		       "%s: %s\n", addr, strerror(errno));
-		printf("Check network configuration.\n");
-		close(sock);
-		return -1;
-	}
-
-	dbg_printf(4, "%s: success, fd = %d\n", __FUNCTION__, sock);
-	return sock;
-}
-
-
-/**
-  Set up multicast send socket
- */
-int
-ipv4_send_sk(char *send_addr, char *addr, int port, struct sockaddr *tgt,
-	     socklen_t tgt_len, int ttl)
-{
-	int val;
-	struct ip_mreq mreq;
-	struct sockaddr_in mcast;
-	struct sockaddr_in src;
-	int sock;
-
-	if (tgt_len < sizeof(struct sockaddr_in)) {
-		errno = EINVAL;
-		return -1;
-	}
-
-	/* Store multicast address */
-	mcast.sin_family = PF_INET;
-	mcast.sin_port = htons(port);
-	if (inet_pton(PF_INET, addr,
-		      (void *)&mcast.sin_addr.s_addr) < 0) {
-		printf("Invalid multicast address: %s\n", addr);
-		return -1;
-	}
-	mreq.imr_multiaddr.s_addr = mcast.sin_addr.s_addr;
-
-	/* Store sending address */
-	src.sin_family = PF_INET;
-	src.sin_port = htons(port);
-	if (inet_pton(PF_INET, send_addr,
-		      (void *)&src.sin_addr.s_addr) < 0) {
-		printf("Invalid source address: %s\n", send_addr);
-		return -1;
-	}
-	mreq.imr_interface.s_addr = src.sin_addr.s_addr;
-
-
-	/*************************
-	 * SET UP MULTICAST SEND *
-	 *************************/
-	dbg_printf(4, "Setting up ipv4 multicast send (%s:%d)\n", addr, port);
-	sock = socket(PF_INET, SOCK_DGRAM, 0);
-	if (sock < 0) {
-		perror("socket");
-		return -1;
-	}
-
-	/*
-	 * Join Multicast group.
-	 */
-	dbg_printf(4, "Joining IP Multicast group (pass 1)\n");
-	if (setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq,
-		       sizeof(mreq)) == -1) {
-		printf("Failed to add multicast membership to transmit "
-		       "socket %s: %s\n", addr, strerror(errno));
-		close(sock);
-		return -1;
-	}
-
-	/*
-	 * Join Multicast group.
-	 */
-	dbg_printf(4, "Joining IP Multicast group (pass 2)\n");
-	if (setsockopt(sock, IPPROTO_IP, IP_MULTICAST_IF, &src.sin_addr,
-		       sizeof(src.sin_addr)) == -1) {
-		printf("Failed to bind multicast transmit socket to "
-		       "%s: %s\n", addr, strerror(errno));
-		close(sock);
-		return -1;
-	}
-
-	/*
-	 * set time to live to 2 hops.
-	 */
-	dbg_printf(4, "Setting TTL to %d for fd%d\n", ttl, sock);
-	val = ttl;
-	if (setsockopt(sock, SOL_IP, IP_MULTICAST_TTL, &val,
-		       sizeof(val)))
-		printf("warning: setting TTL failed %s\n", strerror(errno));
-
-	memcpy((struct sockaddr_in *)tgt, &mcast, sizeof(struct sockaddr_in));
-
-	dbg_printf(4, "%s: success, fd = %d\n", __FUNCTION__, sock);
-	return sock;
-}
-
-
-
-/** 
-  Sets up a multicast receive (ipv6) socket
- */
-int
-ipv6_recv_sk(char *addr, int port, unsigned int ifindex)
-{
-	int sock, val;
-	struct ipv6_mreq mreq;
-	struct sockaddr_in6 sin;
-
-	memset(&mreq, 0, sizeof(mreq));
-	memset(&sin, 0, sizeof(sin));
-	sin.sin6_family = PF_INET6;
-	sin.sin6_port = htons(port);
-	if (inet_pton(PF_INET6, addr,
-		      (void *)&sin.sin6_addr) < 0) {
-		printf("Invalid multicast address: %s\n", addr);
-		return -1;
-	}
-
-	memcpy(&mreq.ipv6mr_multiaddr, &sin.sin6_addr,
-	       sizeof(struct in6_addr));
-
-	mreq.ipv6mr_interface = ifindex;
-
-	/********************************
-	 * SET UP MULTICAST RECV SOCKET *
-	 ********************************/
-	dbg_printf(4, "Setting up ipv6 multicast receive (%s:%d)\n", addr, port);
-	sock = socket(PF_INET6, SOCK_DGRAM, IPPROTO_UDP);
-	if (sock < 0) {
-		printf("socket: %s\n", strerror(errno));
-		close(sock);
-		sock = -1;
-		return 1;
-	}
-
-	/*
-	 * When using Multicast, bind to the LOCAL address, not the MULTICAST
-	 * address.
-	 */
-	memset(&sin, 0, sizeof(sin));
-	sin.sin6_family = PF_INET6;
-	sin.sin6_port = htons(port);
-	sin.sin6_addr = in6addr_any;
-	if (bind(sock, (struct sockaddr *) &sin,
-		 sizeof(struct sockaddr_in6)) < 0) {
-		printf("bind failed: %s\n", strerror(errno));
-		close(sock);
-		return -1;
-	}
-
-	dbg_printf(4, "Disabling IP Multicast loopback\n");
-	val = 1;
-	if (setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &val,
-		       sizeof(val)) != 0) {
-		printf("Failed to disable multicast loopback\n");
-		close(sock);
-		return -1;
-	}
-
-	/*
-	 * Join multicast group
-	 */
-	dbg_printf(4, "Joining IP Multicast group\n");
-	if (setsockopt(sock, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, &mreq,
-		       sizeof(mreq)) == -1) {
-		printf("Failed to add multicast to socket %s: %s\n",
-		       addr, strerror(errno));
-		close(sock);
-		return -1;
-	}
-
-	dbg_printf(4, "%s: success, fd = %d\n", __FUNCTION__, sock);
-	return sock;
-}
-
-
-/**
-  Set up ipv6 multicast send socket
- */
-int
-ipv6_send_sk(char *send_addr, char *addr, int port, struct sockaddr *tgt,
-	     socklen_t tgt_len, int ttl)
-{
-	int val;
-	struct ipv6_mreq mreq;
-	struct sockaddr_in6 mcast;
-	struct sockaddr_in6 src;
-	int sock;
-
-	if (tgt_len < sizeof(struct sockaddr_in6)) {
-		errno = EINVAL;
-		return -1;
-	}
-
-	memset(&mreq, 0, sizeof(mreq));
-
-	/* Store multicast address */
-	mcast.sin6_family = PF_INET6;
-	mcast.sin6_port = htons(port);
-	if (inet_pton(PF_INET6, addr,
-		      (void *)&mcast.sin6_addr) < 0) {
-		printf("Invalid multicast address: %s\n", addr);
-		return -1;
-	}
-
-	memcpy(&mreq.ipv6mr_multiaddr, &mcast.sin6_addr,
-	       sizeof(struct in6_addr));
-
-	/* Store sending address */
-	src.sin6_family = PF_INET6;
-	src.sin6_port = htons(port);
-	if (inet_pton(PF_INET6, send_addr,
-		      (void *)&src.sin6_addr) < 0) {
-		printf("Invalid source address: %s\n", send_addr);
-		return -1;
-	}
-
-	/*************************
-	 * SET UP MULTICAST SEND *
-	 *************************/
-	dbg_printf(4, "Setting up ipv6 multicast send (%s:%d)\n", addr, port);
-	sock = socket(PF_INET6, SOCK_DGRAM, 0);
-	if (sock < 0) {
-		perror("socket");
-		return -1;
-	}
-
-	dbg_printf(4, "Disabling IP Multicast loopback\n");
-	val = 1;
-	if (setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &val,
-		       sizeof(val)) != 0) {
-		printf("Failed to disable multicast loopback\n");
-		close(sock);
-		return -1;
-	}
-
-	/*
-	 * Join Multicast group.
-	 */
-	dbg_printf(4, "Joining IP Multicast group\n");
-	if (setsockopt(sock, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, &mreq,
-		       sizeof(mreq)) == -1) {
-		printf("Failed to add multicast membership to transmit "
-		       "socket %s: %s\n", addr, strerror(errno));
-		close(sock);
-		return -1;
-	}
-
-	/*
-	 * Join Multicast group (part 2)
-	 */
-	/*
-	if (setsockopt(sock, IPPROTO_IPV6, IP_MULTICAST_IF, &src.sin6_addr,
-		       sizeof(src.sin6_addr)) == -1) {
-		printf("Failed to bind multicast transmit socket to "
-		       "%s: %s\n", addr, strerror(errno));
-		close(sock);
-		return -1;
-	}
-	*/
-
-	/*
-	 * set time to live to 2 hops.
-	 */
-	val = ttl;
-	if (setsockopt(sock, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &val,
-		       sizeof(val)))
-		printf("warning: setting TTL failed %s\n", strerror(errno));
-
-	memcpy((struct sockaddr_in *)tgt, &mcast, sizeof(struct sockaddr_in6));
-
-	dbg_printf(4, "%s: success, fd = %d\n", __FUNCTION__, sock);
-	return sock;
-}
diff --git a/fence/agents/xvm/mcast.h b/fence/agents/xvm/mcast.h
deleted file mode 100644
index 08fd6de..0000000
--- a/fence/agents/xvm/mcast.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#ifndef _XVM_MCAST_H
-#define _XVM_MCAST_H
-
-#define IPV4_MCAST_DEFAULT "225.0.0.12"
-#define IPV6_MCAST_DEFAULT "ff05::3:1"
-
-int ipv4_recv_sk(char *addr, int port, unsigned int ifindex);
-int ipv4_send_sk(char *src_addr, char *addr, int port,
-		 struct sockaddr *src, socklen_t slen,
-		 int ttl);
-int ipv6_recv_sk(char *addr, int port, unsigned int ifindex);
-int ipv6_send_sk(char *src_addr, char *addr, int port,
-		 struct sockaddr *src, socklen_t slen,
-		 int ttl);
-
-#endif
diff --git a/fence/agents/xvm/options-ccs.c b/fence/agents/xvm/options-ccs.c
deleted file mode 100644
index 0384aee..0000000
--- a/fence/agents/xvm/options-ccs.c
+++ /dev/null
@@ -1,100 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <sys/un.h>
-#include <sys/socket.h>
-#include <sys/select.h>
-#include <sys/ioctl.h>
-#include <arpa/inet.h>
-#include <net/if.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <sys/time.h>
-#include <fcntl.h>
-#include <errno.h>
-
-/* Local includes */
-#include "xvm.h"
-#include "simple_auth.h"
-#include "mcast.h"
-#include "options.h"
-
-#include <ccs.h>
-
-struct arg_info *find_arg_by_char(char arg);
-struct arg_info *find_arg_by_string(char *arg);
-
-extern int _debug;
-
-/**
-  Parse args from ccs and assign to the specified args structure.
-  (This should only be called from fence_xvmd; not fence_xvm!!!)
-  
-  @param optstr		Command line option string in getopt(3) format
-  @param args		Args structure to fill in.
- */
-void
-args_get_ccs(char *optstr, fence_xvm_args_t *args)
-{
-	char buf[256];
-	int ccsfd = -1, x, n;
-	char *val;
-	struct arg_info *arg;
-	
-	if (args->flags & (F_NOCCS | F_HELP | F_VERSION))
-		return;
-
-	ccsfd = ccs_connect();
-	if (ccsfd < 0) {
-		args->flags |= F_CCSFAIL;
-		return;
-	}
-
-	for (x = 0; x < strlen(optstr); x++) {
-		arg = find_arg_by_char(optstr[x]);
-		if (!arg)
-			continue;
-
-		if (!arg || (arg->opt != '\xff' && 
-			     !strchr(optstr, arg->opt))) {
-			continue;
-		}
-
-		if (!arg->stdin_opt)
-			continue;
-
-		n = snprintf(buf, sizeof(buf), "/cluster/fence_xvmd/@%s\n",
-			     arg->stdin_opt);
-		if (n == sizeof(buf)) {
-			args->flags |= F_CCSERR;
-			return;		
-		}
-
-		val = NULL;
-		if (ccs_get(ccsfd, buf, &val) != 0) {
-			if (val) {
-				free(val);
-				val = NULL;
-			}
-			continue;
-		}
-
-		if (!val)
-			continue;
-
-		if (arg->assign)
-			arg->assign(args, arg, val);
-
-		if (val) {
-			free(val);
-			val = NULL;
-		}
-	}
-	
-	ccs_disconnect(ccsfd);
-}
diff --git a/fence/agents/xvm/options.c b/fence/agents/xvm/options.c
deleted file mode 100644
index 49e6578..0000000
--- a/fence/agents/xvm/options.c
+++ /dev/null
@@ -1,677 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <sys/un.h>
-#include <sys/socket.h>
-#include <sys/select.h>
-#include <sys/ioctl.h>
-#include <arpa/inet.h>
-#include <net/if.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include <sys/time.h>
-#include <fcntl.h>
-#include <errno.h>
-
-/* Local includes */
-#include "xvm.h"
-#include "simple_auth.h"
-#include "mcast.h"
-#include "options.h"
-#include "debug.h"
-
-
-/* Assignment functions */
-
-static inline void
-assign_debug(fence_xvm_args_t *args, struct arg_info *arg, char *value)
-{
-	if (!value) {
-		/* GNU getopt sets optarg to NULL for options w/o a param
-		   We rely on this here... */
-		/* Command-line debug sets a special flag */
-		args->flags |= F_DEBUG;
-		args->debug++;
-		return;
-	}
-
-	args->debug = atoi(value);
-	if (args->debug < 0) {
-		args->debug = 1;
-	}
-}
-
-
-static inline void
-assign_foreground(fence_xvm_args_t *args, struct arg_info *arg,
-		  char *value)
-{
-	args->flags |= F_FOREGROUND;
-}
-
-
-static inline void
-assign_family(fence_xvm_args_t *args, struct arg_info *arg,
-	      char *value)
-{
-	if (!strcasecmp(value, "ipv4")) {
-		args->family = PF_INET;
-	} else if (!strcasecmp(value, "ipv6")) {
-		args->family = PF_INET6;
-	} else if (!strcasecmp(value, "auto")) {
-		args->family = 0;
-	} else {
-		logt_print(LOG_ERR, "Unsupported family: '%s'\n", value);
-		args->flags |= F_ERR;
-	}
-}
-
-
-static inline void
-assign_address(fence_xvm_args_t *args, struct arg_info *arg, char *value)
-{
-	if (args->addr)
-		free(args->addr);
-	args->addr = strdup(value);
-}
-
-
-static inline void
-assign_ttl(fence_xvm_args_t *args, struct arg_info *arg, char *value)
-{
-	int ttl;
-	ttl = atoi(value);
-	if (ttl < 1 || ttl > 255)
-		ttl = DEFAULT_TTL;
-	args->ttl = ttl;
-}
-
-
-static inline void
-assign_port(fence_xvm_args_t *args, struct arg_info *arg, char *value)
-{
-	args->port = atoi(value);
-	if (args->port <= 0 || args->port >= 65500) {
-		logt_print(LOG_ERR, "Invalid port: '%s'\n", value);
-		args->flags |= F_ERR;
-	}
-}
-
-
-static inline void
-assign_interface(fence_xvm_args_t *args, struct arg_info *arg, char *value)
-{
-	args->ifindex = if_nametoindex(value);
-}
-
-
-static inline void
-assign_retrans(fence_xvm_args_t *args, struct arg_info *arg, char *value)
-{
-	args->retr_time = atoi(value);
-	if (args->retr_time <= 0) {
-		logt_print(LOG_ERR, "Invalid retransmit time: '%s'\n", value);
-		args->flags |= F_ERR;
-	}
-}
-
-static inline void
-assign_hash(fence_xvm_args_t *args, struct arg_info *arg, char *value)
-{
-	if (!strcasecmp(value, "none")) {
-		args->hash = HASH_NONE;
-	} else if (!strcasecmp(value, "sha1")) {
-		args->hash = HASH_SHA1;
-	} else if (!strcasecmp(value, "sha256")) {
-		args->hash = HASH_SHA256;
-	} else if (!strcasecmp(value, "sha512")) {
-		args->hash = HASH_SHA512;
-	} else {
-		logt_print(LOG_ERR, "Unsupported hash: %s\n", value);
-		args->flags |= F_ERR;
-	}
-}
-
-
-static inline void
-assign_auth(fence_xvm_args_t *args, struct arg_info *arg, char *value)
-{
-	if (!strcasecmp(value, "none")) {
-		args->auth = AUTH_NONE;
-	} else if (!strcasecmp(value, "sha1")) {
-		args->auth = AUTH_SHA1;
-	} else if (!strcasecmp(value, "sha256")) {
-		args->auth = AUTH_SHA256;
-	} else if (!strcasecmp(value, "sha512")) {
-		args->auth = AUTH_SHA512;
-	} else {
-		logt_print(LOG_ERR, "Unsupported auth type: %s\n", value);
-		args->flags |= F_ERR;
-	}
-}
-
-static inline void
-assign_key(fence_xvm_args_t *args, struct arg_info *arg, char *value)
-{
-	struct stat st;
-
-	if (args->key_file)
-		free(args->key_file);
-	args->key_file = strdup(value);
-
-	if (stat(value, &st) == -1) {
- 		logt_print(LOG_ERR, "Invalid key file: '%s' (%s)\n", value,
-  		       strerror(errno));
-		args->flags |= F_ERR;
-	}
-}
-
-
-static inline void
-assign_op(fence_xvm_args_t *args, struct arg_info *arg, char *value)
-{
-	if (!strcasecmp(value, "null")) {
-		args->op = FENCE_NULL;
-	} else if (!strcasecmp(value, "off")) {
-		args->op = FENCE_OFF;
-	} else if (!strcasecmp(value, "reboot")) {
-		args->op = FENCE_REBOOT;
-	} else {
-		logt_print(LOG_ERR, "Unsupported operation: %s\n", value);
-		args->flags |= F_ERR;
-	}
-}
-
-
-static inline void
-assign_domain(fence_xvm_args_t *args, struct arg_info *arg, char *value)
-{
-	if (args->domain) {
-		logt_print(LOG_ERR,
-		   "Domain/UUID may not be specified more than once\n");
-		args->flags |= F_ERR;
-		return;
-	}
-
-	if (args->domain)
-		free(args->domain);
-	args->domain = strdup(value);
-
-	if (strlen(value) <= 0) {
-		logt_print(LOG_ERR, "Invalid domain name\n");
-		args->flags |= F_ERR;
-	}
-
-	if (strlen(value) >= MAX_DOMAINNAME_LENGTH) {
-		errno = ENAMETOOLONG;
-		logt_print(LOG_ERR, "Invalid domain name: '%s' (%s)\n",
-		       value, strerror(errno));
-		args->flags |= F_ERR;
-	}
-}
-
-
-static inline void
-assign_uuid_lookup(fence_xvm_args_t *args, struct arg_info *arg, char *value)
-{
-	if (!value) {
-		/* GNU getopt sets optarg to NULL for options w/o a param
-		   We rely on this here... */
-		args->flags |= F_USE_UUID;
-		return;
-	}
-
-	args->flags |= ( !!atoi(value) ? F_USE_UUID : 0);
-}
-
-
-static inline void
-assign_timeout(fence_xvm_args_t *args, struct arg_info *arg, char *value)
-{
-	args->timeout = atoi(value);
-	if (args->timeout <= 0) {
-		logt_print(LOG_ERR, "Invalid timeout: '%s'\n", value);
-		args->flags |= F_ERR;
-	}
-}
-
-
-static inline void
-assign_help(fence_xvm_args_t *args, struct arg_info *arg, char *value)
-{
-	args->flags |= F_HELP;
-}
-
-
-static inline void
-assign_version(fence_xvm_args_t *args, struct arg_info *arg, char *value)
-{
-	args->flags |= F_VERSION;
-}
-
-
-static inline void
-assign_noccs(fence_xvm_args_t *args, struct arg_info *arg, char *value)
-{
-	args->flags |= F_NOCCS;
-}
-
-
-static inline void
-assign_nocluster(fence_xvm_args_t *args, struct arg_info *arg, char *value)
-{
-	args->flags |= F_NOCLUSTER;
-}
-
-
-static inline void
-assign_uri(fence_xvm_args_t *args, struct arg_info *arg, char *value)
-{
-	if (args->uri)
-		free(args->uri);
-
-	/* XXX NO validation yet */
-	args->uri = strdup(value);
-}
-
-
-/** ALL valid command line and stdin arguments for this fencing agent */
-static struct arg_info _arg_info[] = {
-	{ '\xff', NULL, "agent",
-	  "Not user serviceable",
-	  NULL },
-
-	{ '\xff', NULL, "self",
-	  "Not user serviceable", 
-	  NULL },
-
-	{ 'd', "-d", "debug",
-	  "Specify (CCS) / increment (command line) debug level",
-	  assign_debug },
-
-	{ 'f', "-f", NULL,
-	  "Foreground mode (do not fork)",
-	  assign_foreground },
-
-	{ 'i', "-i <family>", "ip_family",
-	  "IP Family ([auto], ipv4, ipv6)",
-	  assign_family },
-
-	{ 'a', "-a <address>", "multicast_address",
-	  "Multicast address (default=225.0.0.12 / ff02::3:1)",
-	  assign_address },
-
-	{ 'T', "-T <ttl>", "multicast_ttl",
-	  "Multicast time-to-live (in hops; default=2)",
-	  assign_ttl },
-
-	{ 'p', "-p <port>", "port",
-	  "IP port (default=1229)",
-	  assign_port },
-
-	{ 'I', "-I <interface>", "multicast_address",
-	  "Network interface name to listen on",
-	  assign_interface },
-
-	{ 'r', "-r <retrans>", "retrans", 
-	  "Multicast retransmit time (in 1/10sec; default=20)",
-	  assign_retrans },
-
-	{ 'c', "-c <hash>", "hash",
-	  "Packet hash strength (none, sha1, [sha256], sha512)",
-	  assign_hash },
-
-	{ 'C', "-C <auth>", "auth",
-	  "Authentication (none, sha1, [sha256], sha512)",
-	  assign_auth },
-
-	{ 'k', "-k <file>", "key_file",
-	  "Shared key file (default=" DEFAULT_KEY_FILE ")",
-	  assign_key },
-
-	{ 'o', "-o <operation>", "option",
-	  "Fencing operation (null, off, [reboot])",
-	  assign_op },
-
-	{ 'H', "-H <domain>", "domain",
-	  "Xen host (domain name) to fence",
-	  assign_domain },
-
-	{ 'u', "-u", "use_uuid",
-	  "Treat <domain> as UUID instead of domain name",
-	  assign_uuid_lookup },
-
-	{ 't', "-t <timeout>", "timeout",
-	  "Fencing timeout (in seconds; default=30)",
-	  assign_timeout },
-
-	{ 'h', "-h", NULL,
- 	  "Help",
-	  assign_help },
-
-	{ '?', "-?", NULL,
- 	  "Help (alternate)", 
-	  assign_help },
-
-	{ 'X', "-X", NULL,
- 	  "Do not connect to CCS for configuration", 
-	  assign_noccs }, 
-
-	{ 'L', "-L", NULL,
- 	  "Local mode only (no cluster)",
-	  assign_nocluster }, 
-
-	{ 'U', "-U", "uri",
-	  "URI for Hypervisor (default: " DEFAULT_HYPERVISOR_URI ")",
-	  assign_uri },
-	  
-	{ 'V', "-V", NULL,
- 	  "Display version and exit", 
-	  assign_version },
-
-	/* Terminator */
-	{ 0, NULL, NULL, NULL, NULL }
-};
-
-
-struct arg_info *
-find_arg_by_char(char arg)
-{
-	int x = 0;
-
-	for (x = 0; _arg_info[x].opt != 0; x++) {
-		if (_arg_info[x].opt == arg)
-			return &_arg_info[x];
-	}
-
-	return NULL;
-}
-
-
-struct arg_info *
-find_arg_by_string(char *arg)
-{
-	int x = 0;
-
-	for (x = 0; _arg_info[x].opt != 0; x++) {
-		if (!_arg_info[x].stdin_opt)
-			continue;
-		if (!strcasecmp(_arg_info[x].stdin_opt, arg))
-			return &_arg_info[x];
-	}
-
-	return NULL;
-}
-
-
-/* ============================================================= */
-
-/**
-  Initialize an args structure.
-
-  @param args		Pointer to args structure to initialize.
- */
-void
-args_init(fence_xvm_args_t *args)
-{
-	args->addr = NULL;
-	args->domain = NULL;
-	args->key_file = strdup(DEFAULT_KEY_FILE);
-	args->uri = strdup(DEFAULT_HYPERVISOR_URI);
-	args->op = FENCE_REBOOT;
-	args->hash = DEFAULT_HASH;
-	args->auth = DEFAULT_AUTH;
-	args->port = 1229;
-	args->ifindex = 0;
-	args->family = PF_INET;
-	args->timeout = 30;
-	args->retr_time = 20;
-	args->flags = 0;
-	args->debug = 0;
-	args->ttl = DEFAULT_TTL;
-}
-
-
-#define _pr_int(piece) dbg_printf(1, "  %s = %d\n", #piece, piece)
-#define _pr_str(piece) dbg_printf(1, "  %s = %s\n", #piece, piece)
-
-
-/**
-  Prints out the contents of an args structure for debugging.
-
-  @param args		Pointer to args structure to print out.
- */
-void
-args_print(fence_xvm_args_t *args)
-{
-	dbg_printf(1, "-- args @ %p --\n", args);
-	_pr_str(args->addr);
-	_pr_str(args->domain);
-	_pr_str(args->key_file);
-	_pr_int(args->op);
-	_pr_int(args->hash);
-	_pr_int(args->auth);
-	_pr_int(args->port);
-	_pr_int(args->ifindex);
-	_pr_int(args->family);
-	_pr_int(args->timeout);
-	_pr_int(args->retr_time);
-	_pr_int(args->flags);
-	_pr_int(args->debug);
-	dbg_printf(1, "-- end args --\n");
-}
-
-
-/**
-  Print out arguments and help information based on what is allowed in
-  the getopt string optstr.
-
-  @param progname	Program name.
-  @param optstr		Getopt(3) style options string
-  @param print_stdin	0 = print command line options + description,
-			1 = print fence-style stdin args + description
- */
-void
-args_usage(char *progname, char *optstr, int print_stdin)
-{
-	int x;
-	struct arg_info *arg;
-
-	if (!print_stdin) {
-		if (progname) {
-			printf("usage: %s [args]\n", progname);
-		} else {
-			printf("usage: fence_xvm [args]\n");
-		}
-	}
-
-	for (x = 0; x < strlen(optstr); x++) {
-		arg = find_arg_by_char(optstr[x]);
-		if (!arg)
-			continue;
-
-		if (print_stdin) {
-			if (arg && arg->stdin_opt)
-				printf("  %-20.20s %-55.55s\n",
-				       arg->stdin_opt, arg->desc);
-		} else {
-			printf("  %-20.20s %-55.55s\n", arg->opt_desc,
-			       arg->desc);
-		}
-	}
-
-	printf("\n");
-}
-
-
-/**
-  Remove leading and trailing whitespace from a line of text.
-
-  @param line		Line to clean up
-  @param linelen	Max size of line
-  @return		0 on success, -1 on failure
- */
-int
-cleanup(char *line, size_t linelen)
-{
-	char *p;
-	int x;
-	
-	/* Remove leading whitespace. */
-	p = line;
-	for (x = 0; x <= linelen; x++) {
-		switch (line[x]) {
-		case '\t':
-		case ' ':
-			break;
-		case '\n':
-		case '\r':
-			return -1;
-		default:
-			goto eol;
-		}
-	}
-eol:
-	/* Move the remainder down by as many whitespace chars as we
-	   chewed up */
-	if (x)
-		memmove(p, &line[x], linelen-x);
-
-	/* Remove trailing whitespace. */
-	for (x=0; x <= linelen; x++) {
-		switch(line[x]) {
-		case '\t':
-		case ' ':
-		case '\r':
-		case '\n':
-			line[x] = 0;
-		case 0:
-		/* End of line */
-			return 0;
-		}
-	}
-
-	return -1;
-}
-
-
-/**
-  Parse args from stdin and assign to the specified args structure.
-  
-  @param optstr		Command line option string in getopt(3) format
-  @param args		Args structure to fill in.
- */
-void
-args_get_stdin(char *optstr, fence_xvm_args_t *args)
-{
-	char in[256];
-	int line = 0;
-	char *name, *val;
-	struct arg_info *arg;
-
-	while (fgets(in, sizeof(in), stdin)) {
-		++line;
-
-		if (in[0] == '#')
-			continue;
-
-		if (cleanup(in, sizeof(in)) == -1)
-			continue;
-
-		name = in;
-		if ((val = strchr(in, '='))) {
-			*val = 0;
-			++val;
-		}
-
-		arg = find_arg_by_string(name);
-		if (!arg || (arg->opt != '\xff' && 
-			     !strchr(optstr, arg->opt))) {
-			fprintf(stderr,
-				"parse warning: "
-				"illegal variable '%s' on line %d\n", name,
-				line);
-			continue;
-		}
-
-		if (arg->assign)
-			arg->assign(args, arg, val);
-	}
-}
-
-
-/**
-  Parse args from stdin and assign to the specified args structure.
-  
-  @param optstr		Command line option string in getopt(3) format
-  @param args		Args structure to fill in.
- */
-void
-args_get_getopt(int argc, char **argv, char *optstr, fence_xvm_args_t *args)
-{
-	int opt;
-	struct arg_info *arg;
-
-	while ((opt = getopt(argc, argv, optstr)) != EOF) {
-
-		arg = find_arg_by_char(opt);
-
-		if (!arg) {
-			args->flags |= F_ERR;
-			continue;
-		}
-
-		if (arg->assign)
-			arg->assign(args, arg, optarg);
-	}
-}
-
-
-void
-args_finalize(fence_xvm_args_t *args)
-{
-	char *addr = NULL;
-
-	if (!args->addr) {
-		switch(args->family) {
-		case 0:
-		case PF_INET:
-			addr = IPV4_MCAST_DEFAULT;
-			break;
-		case PF_INET6:
-			addr = IPV6_MCAST_DEFAULT;
-			break;
-		default:
-			args->flags |= F_ERR;
-		break;
-		}
-	}
-
-	if (!args->addr)
-		args->addr = addr;
-
-	if (!args->addr) {
-		printf("No multicast address available\n");
-		args->flags |= F_ERR;
-	}
-
-	if (!args->addr)
-		return;
-	if (args->family)
-		return;
-
-	/* Set family */
-	if (strchr(args->addr, ':'))
-		args->family = PF_INET6;
-	if (strchr(args->addr, '.'))
-		args->family = PF_INET;
-	if (!args->family) {
-		printf("Could not determine address family\n");
-		args->flags |= F_ERR;
-	}
-}
diff --git a/fence/agents/xvm/options.h b/fence/agents/xvm/options.h
deleted file mode 100644
index ecf5439..0000000
--- a/fence/agents/xvm/options.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef _XVM_OPTIONS_H
-#define _XVM_OPTIONS_H
-
-typedef enum {
-	F_FOREGROUND	= 0x1,
-	F_NOCCS		= 0x2,
-	F_ERR		= 0x4,
-	F_HELP		= 0x8,
-	F_USE_UUID	= 0x10,
-	F_VERSION	= 0x20,
-	F_CCSERR	= 0x40,
-	F_CCSFAIL	= 0x80,
-	F_NOCLUSTER	= 0x100,
-	F_DEBUG		= 0x200
-} arg_flags_t;
-
-
-typedef struct {
-	char *addr;
-	char *domain;
-	char *key_file;
-	char *uri;
-	fence_cmd_t op;
-	fence_hash_t hash;
-	fence_auth_type_t auth;
-	int port;
-	unsigned int ifindex;
-	int family;
-	int timeout;
-	int retr_time;
-	arg_flags_t flags;
-	int debug;
-	int ttl;
-} fence_xvm_args_t;
-
-/* Private structure for commandline / stdin fencing args */
-struct arg_info {
-	char opt;
-	char *opt_desc;
-	char *stdin_opt;
-	char *desc;
-	void (*assign)(fence_xvm_args_t *, struct arg_info *, char *);
-};
-
-
-/* Get options */
-void args_init(fence_xvm_args_t *args);
-void args_finalize(fence_xvm_args_t *args);
-
-void args_get_getopt(int argc, char **argv, char *optstr,
-		     fence_xvm_args_t *args);
-void args_get_stdin(char *optstr, fence_xvm_args_t *args);
-void args_get_ccs(char *optstr, fence_xvm_args_t *args);
-void args_usage(char *progname, char *optstr, int print_stdin);
-void args_print(fence_xvm_args_t *args);
-
-#endif
diff --git a/fence/agents/xvm/simple_auth.c b/fence/agents/xvm/simple_auth.c
deleted file mode 100644
index 9e0e114..0000000
--- a/fence/agents/xvm/simple_auth.c
+++ /dev/null
@@ -1,395 +0,0 @@
-#include <sys/types.h>
-#include <string.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sechash.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <errno.h>
-
-/* Local includes */
-#include "xvm.h"
-#include "simple_auth.h"
-#include "debug.h"
-
-void
-print_hash(unsigned char *hash, size_t hashlen)
-{
-	int x; 
-
-	for (x = 0; x < hashlen; x++)
-		printf("%02x", (hash[x]&0xff));
-}
-
-
-static void
-sha_sign(fence_req_t *req, void *key, size_t key_len)
-{
-	unsigned char hash[SHA512_LENGTH];
-	HASHContext *h;
-	HASH_HashType ht;
-	unsigned int rlen;
-	int devrand;
-
-	switch(req->hashtype) {
-		case HASH_SHA1:
-			ht = HASH_AlgSHA1;
-			break;
-		case HASH_SHA256:
-			ht = HASH_AlgSHA256;
-			break;
-		case HASH_SHA512:
-			ht = HASH_AlgSHA512;
-			break;
-		default:
-			return;
-	}
-
-	dbg_printf(4, "Opening /dev/urandom\n");
-	devrand = open("/dev/urandom", O_RDONLY);
-	if (devrand >= 0) {
-		if (read(devrand, req->random, sizeof(req->random)) < 0) {
-			perror("read /dev/urandom");
-		}
-		close(devrand);
-	}
-
-	memset(hash, 0, sizeof(hash));
-	h = HASH_Create(ht);
-	if (!h)
-		return;
-
-	HASH_Begin(h);
-	HASH_Update(h, key, key_len);
-	HASH_Update(h, (void *)req, sizeof(*req));
-	HASH_End(h, hash, &rlen, sizeof(hash));
-	HASH_Destroy(h);
-
-	memcpy(req->hash, hash, sizeof(req->hash));
-}
-
-
-static int
-sha_verify(fence_req_t *req, void *key, size_t key_len)
-{
-	unsigned char hash[SHA512_LENGTH];
-	unsigned char pkt_hash[SHA512_LENGTH];
-	HASHContext *h = NULL;
-	HASH_HashType ht;
-	unsigned int rlen;
-	int ret;
-
-	switch(req->hashtype) {
-		case HASH_SHA1:
-			ht = HASH_AlgSHA1;
-			break;
-		case HASH_SHA256:
-			ht = HASH_AlgSHA256;
-			break;
-		case HASH_SHA512:
-			ht = HASH_AlgSHA512;
-			break;
-		default:
-			dbg_printf(3, "%s: no-op (HASH_NONE)\n", __FUNCTION__);
-			return 0;
-	}
-
-	memset(hash, 0, sizeof(hash));
-	h = HASH_Create(ht);
-	if (!h)
-		return 0;
-
-	memcpy(pkt_hash, req->hash, sizeof(pkt_hash));
-	memset(req->hash, 0, sizeof(req->hash));
-
-	HASH_Begin(h);
-	HASH_Update(h, key, key_len);
-	HASH_Update(h, (void *)req, sizeof(*req));
-	HASH_End(h, hash, &rlen, sizeof(hash));
-	HASH_Destroy(h);
-
-	memcpy(req->hash, pkt_hash, sizeof(req->hash));
-
-	ret = !memcmp(hash, pkt_hash, sizeof(hash));
-	if (!ret) {
-		printf("Hash mismatch:\nPKT = ");
-		print_hash(pkt_hash, sizeof(pkt_hash));
-		printf("\nEXP = ");
-		print_hash(hash, sizeof(hash));
-		printf("\n");
-	}
-
-	return ret;
-}
-
-
-int
-sign_request(fence_req_t *req, void *key, size_t key_len)
-{
-	memset(req->hash, 0, sizeof(req->hash));
-	switch(req->hashtype) {
-	case HASH_NONE:
-		dbg_printf(3, "%s: no-op (HASH_NONE)\n", __FUNCTION__);
-		return 0;
-	case HASH_SHA1:
-	case HASH_SHA256:
-	case HASH_SHA512:
-		sha_sign(req, key, key_len);
-		return 0;
-	default:
-		break;
-	}
-	return -1;
-}
-
-
-int
-verify_request(fence_req_t *req, fence_hash_t min,
-	       void *key, size_t key_len)
-{
-	if (req->hashtype < min) {
-		printf("Hash type not strong enough (%d < %d)\n",
-		       req->hashtype, min);
-		return 0;
-	}
-	switch(req->hashtype) {
-	case HASH_NONE:
-		return 1;
-	case HASH_SHA1:
-	case HASH_SHA256:
-	case HASH_SHA512:
-		return sha_verify(req, key, key_len);
-	default:
-		break;
-	}
-	return 0;
-}
-
-
-int
-sha_challenge(int fd, fence_auth_type_t auth, void *key,
-	      size_t key_len, int timeout)
-{
-	fd_set rfds;
-	struct timeval tv;
-	unsigned char hash[MAX_HASH_LENGTH];
-	unsigned char challenge[MAX_HASH_LENGTH];
-	unsigned char response[MAX_HASH_LENGTH];
-	int devrand;
-	int ret;
-	HASHContext *h;
-	HASH_HashType ht;
-	unsigned int rlen;
-
-	devrand = open("/dev/urandom", O_RDONLY);
-	if (read(devrand, challenge, sizeof(challenge)) < 0) {
-		perror("read /dev/urandom");
-		return 0;
-	}
-	close(devrand);
-
-	if (write(fd, challenge, sizeof(challenge)) < 0) {
-		perror("write");
-		return 0;
-	}
-
-	switch(auth) {
-		case HASH_SHA1:
-			ht = HASH_AlgSHA1;
-			break;
-		case HASH_SHA256:
-			ht = HASH_AlgSHA256;
-			break;
-		case HASH_SHA512:
-			ht = HASH_AlgSHA512;
-			break;
-		default:
-			return 0;
-	}
-
-	memset(hash, 0, sizeof(hash));
-	h = HASH_Create(ht);
-	if (!h)
-		return 0;
-
-	HASH_Begin(h);
-	HASH_Update(h, key, key_len);
-	HASH_Update(h, challenge, sizeof(challenge));
-	HASH_End(h, hash, &rlen, sizeof(hash));
-	HASH_Destroy(h);
-
-	memset(response, 0, sizeof(response));
-
-	FD_ZERO(&rfds);
-	FD_SET(fd, &rfds);
-	tv.tv_sec = timeout;
-	tv.tv_usec = 0;
-	if (select(fd + 1, &rfds, NULL, NULL, &tv) <= 0) {
-		perror("select");
-		return 0;
-	}
-
-	if (read(fd, response, sizeof(response)) < sizeof(response)) {
-		perror("read");
-		return 0;
-	}
-
-	ret = !memcmp(response, hash, sizeof(response));
-	if (!ret) {
-		printf("Hash mismatch:\nC = ");
-		print_hash(challenge, sizeof(challenge));
-		printf("\nH = ");
-		print_hash(hash, sizeof(hash));
-		printf("\nR = ");
-		print_hash(response, sizeof(response));
-		printf("\n");
-	}
-
-	return ret;
-}
-
-
-int
-sha_response(int fd, fence_auth_type_t auth, void *key,
-	     size_t key_len, int timeout)
-{
-	fd_set rfds;
-	struct timeval tv;
-	unsigned char challenge[MAX_HASH_LENGTH];
-	unsigned char hash[MAX_HASH_LENGTH];
-	HASHContext *h;
-	HASH_HashType ht;
-	unsigned int rlen;
-
-	FD_ZERO(&rfds);
-	FD_SET(fd, &rfds);
-	tv.tv_sec = timeout;
-	tv.tv_usec = 0;
-	if (select(fd + 1, &rfds, NULL, NULL, &tv) <= 0) {
-		perror("select");
-		return 0;
-	}
-
-	if (read(fd, challenge, sizeof(challenge)) < 0) {
-		perror("read");
-		return 0;
-	}
-
-	switch(auth) {
-		case AUTH_SHA1:
-			ht = HASH_AlgSHA1;
-			break;
-		case AUTH_SHA256:
-			ht = HASH_AlgSHA256;
-			break;
-		case AUTH_SHA512:
-			ht = HASH_AlgSHA512;
-			break;
-		default:
-			dbg_printf(3, "%s: no-op (AUTH_NONE)\n", __FUNCTION__);
-			return 0;
-	}
-
-	memset(hash, 0, sizeof(hash));
-	h = HASH_Create(ht); /* */
-	if (!h)
-		return 0;
-
-	HASH_Begin(h);
-	HASH_Update(h, key, key_len);
-	HASH_Update(h, challenge, sizeof(challenge));
-	HASH_End(h, hash, &rlen, sizeof(hash));
-	HASH_Destroy(h);
-
-	if (write(fd, hash, sizeof(hash)) < sizeof(hash)) {
-		perror("read");
-		return 0;
-	}
-
-	return 1;
-}
-
-
-int
-tcp_challenge(int fd, fence_auth_type_t auth, void *key, size_t key_len,
-	      int timeout)
-{
-	switch(auth) {
-	case AUTH_NONE:
-		dbg_printf(3, "%s: no-op (AUTH_NONE)\n", __FUNCTION__);
-		return 1;
-	case AUTH_SHA1:
-	case AUTH_SHA256:
-	case AUTH_SHA512:
-		return sha_challenge(fd, auth, key, key_len, timeout);
-	default:
-		break;
-	}
-	return -1;
-}
-
-
-int
-tcp_response(int fd, fence_auth_type_t auth, void *key, size_t key_len,
-	     int timeout)
-{
-	switch(auth) {
-	case AUTH_NONE:
-		dbg_printf(3, "%s: no-op (AUTH_NONE)\n", __FUNCTION__);
-		return 1;
-	case AUTH_SHA1:
-	case AUTH_SHA256:
-	case AUTH_SHA512:
-		return sha_response(fd, auth, key, key_len, timeout);
-	default:
-		break;
-	}
-	return -1;
-}
-
-
-int
-read_key_file(char *file, char *key, size_t max_len)
-{
-	int fd;
-	int nread, remain = max_len;
-	char *p;
-
-	dbg_printf(3, "Reading in key file %s into %p (%d max size)\n",
-		file, key, (int)max_len);
-	fd = open(file, O_RDONLY);
-	if (fd < 0) {
-		dbg_printf(2, "Error opening key file: %s\n", strerror(errno));
-		return -1;
-	}
-
-	memset(key, 0, max_len);
-	p = key;
-	remain = max_len;
-
-	while (remain) {
-		nread = read(fd, p, remain);
-		if (nread < 0) {
-			if (errno == EINTR)
-				continue;
-			dbg_printf(2, "Error from read: %s\n", strerror(errno));
-			close(fd);
-			return -1;
-		}
-
-		if (nread == 0) {
-			dbg_printf(3, "Stopped reading @ %d bytes",
-				(int)max_len-remain);
-			break;
-		}
-		
-		p += nread;
-		remain -= nread;
-	}
-
-	close(fd);	
-	dbg_printf(3, "Actual key length = %d bytes", (int)max_len-remain);
-	
-	return (int)(max_len - remain);
-}
diff --git a/fence/agents/xvm/simple_auth.h b/fence/agents/xvm/simple_auth.h
deleted file mode 100644
index d05526c..0000000
--- a/fence/agents/xvm/simple_auth.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef _XVM_SIMPLE_AUTH_H
-#define _XVM_SIMPLE_AUTH_H
-
-#include <sys/types.h>
-
-/* 2-way challenge/response simple auth */
-#define DEFAULT_KEY_FILE DEFAULT_CONFIG_DIR "/fence_xvm.key"
-
-int read_key_file(char *, char *, size_t);
-int tcp_challenge(int, fence_auth_type_t, void *, size_t, int);
-int tcp_response(int, fence_auth_type_t, void *, size_t, int);
-int sign_request(fence_req_t *, void *, size_t);
-int verify_request(fence_req_t *, fence_hash_t, void *, size_t);
-
-/* SSL certificate-based authentication TBD */
-
-#endif
diff --git a/fence/agents/xvm/tcp.c b/fence/agents/xvm/tcp.c
deleted file mode 100644
index a09ebd2..0000000
--- a/fence/agents/xvm/tcp.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/** @file
- *
- * @author Lon H. Hohberger <lhh at redhat.com>
- * @author Jeff Moyer <jmoyer at redhat.com>
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/socket.h>
-#include <sys/select.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <arpa/inet.h>
-
-#include "debug.h"
-
-static int connect_nb(int fd, struct sockaddr *dest, socklen_t len, int timeout);
-
-/**
-  Set close-on-exec bit option for a socket.
-
-   @param fd		Socket to set CLOEXEC flag
-   @return		0 on success, -1 on failure
-   @see			fcntl
- */
-static int 
-set_cloexec(int fd)
-{
-	int flags = fcntl(fd, F_GETFD, 0);
-	flags |= FD_CLOEXEC;
-	return fcntl(fd, F_SETFD, flags);
-}
-
-
-/**
-  Bind to a port on the local IPv6 stack
-
-  @param port		Port to bind to
-  @param backlog	same as backlog for listen(2)
-  @return		0 on success, -1 on failure
-  @see			ipv4_bind
- */
-int
-ipv6_listen(uint16_t port, int backlog)
-{
-	struct sockaddr_in6 _sin6;
-	int fd, ret;
-
-	dbg_printf(4, "%s: Setting up ipv6 listen socket\n", __FUNCTION__);
-	fd = socket(PF_INET6, SOCK_STREAM, 0);
-	if (fd < 0)
-		return -1;
-
-	memset(&_sin6, 0, sizeof(_sin6));
-	_sin6.sin6_family = PF_INET6;
-	_sin6.sin6_port = htons(port);
-	_sin6.sin6_flowinfo = 0;
-	_sin6.sin6_addr = in6addr_any;
-
-	ret = 1;
-	setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void *)&ret, sizeof (ret));
-
-	ret = set_cloexec(fd);
-	if (ret < 0) {
-		close(fd);
-		return -1;
-	}
-
-	ret = bind(fd, (struct sockaddr *)&_sin6, sizeof(_sin6));
-	if (ret < 0) {
-		close(fd);
-		return -1;
-	}
-
-	if (listen(fd, backlog) < 0){
-		close(fd);
-		return -1;
-	}
-
-	dbg_printf(4, "%s: Success; fd = %d\n", __FUNCTION__, fd);
-	return fd;
-}
-
-
-/**
-  Bind to a port on the local IPv4 stack
-
-  @param port		Port to bind to
-  @param backlog	same as backlog for listen(2)
-  @return		0 on success, -1 on failure
-  @see			ipv6_bind
- */
-int
-ipv4_listen(uint16_t port, int backlog)
-{
-	struct sockaddr_in _sin;
-	int fd, ret;
-
-	dbg_printf(4, "%s: Setting up ipv4 listen socket\n", __FUNCTION__);
-	fd = socket(PF_INET, SOCK_STREAM, 0);
-	if (fd < 0)
-		return -1;
-
-	_sin.sin_family = PF_INET;
-	_sin.sin_port = htons(port);
-	_sin.sin_addr.s_addr = htonl(INADDR_ANY);
-
-	ret = 1;
-	setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void *)&ret, sizeof (ret));
-	
-	ret = set_cloexec(fd);
-	if (ret < 0) {
-		close(fd);
-		return -1;
-	}
-
-	ret = bind(fd, (struct sockaddr *)&_sin, sizeof(_sin));
-	if (ret < 0) {
-		close(fd);
-		return -1;
-	}
-
-	if (listen(fd, backlog) < 0){
-		close(fd);
-		return -1;
-	}
-
-	dbg_printf(4, "%s: Success; fd = %d\n", __FUNCTION__, fd);
-	return fd;
-}
-
-
-
-/**
-  Connect via ipv6 socket to a given IP address and port.
-
-  @param in6_addr	IPv6 address to connect to
-  @param port		Port to connect to
-  @param timeout	Timeout, in seconds, to wait for a completed
-  			connection
-  @return 		0 on success, -1 on failure
-  @see			connect_nb, ipv4_connect
- */
-int
-ipv6_connect(struct in6_addr *in6_addr, uint16_t port, int timeout)
-{
-	struct sockaddr_in6 _sin6;
-	int fd, ret;
-
-	dbg_printf(4, "%s: Connecting to client\n", __FUNCTION__);
-	fd = socket(PF_INET6, SOCK_STREAM, 0);
-	if (fd < 0)
-		return -1;
-
-	memset(&_sin6, 0, sizeof(_sin6));
-	_sin6.sin6_family = PF_INET6;
-	_sin6.sin6_port = htons(port);
-	_sin6.sin6_flowinfo = 0;
-	memcpy(&_sin6.sin6_addr, in6_addr, sizeof(_sin6.sin6_addr));
-
-	ret = connect_nb(fd, (struct sockaddr *)&_sin6, sizeof(_sin6), timeout);
-	if (ret < 0) {
-		close(fd);
-		return -1;
-	}
-	dbg_printf(4, "%s: Success; fd = %d\n", __FUNCTION__, fd);
-	return fd;
-}
-
-
-/**
-  Connect via ipv4 socket to a given IP address and port.
-
-  @param in_addr	IPv4 address to connect to
-  @param port		Port to connect to
-  @param timeout	Timeout, in seconds, to wait for a completed
-  			connection
-  @return 		0 on success, -1 on failure
-  @see			connect_nb, ipv6_connect
- */
-int
-ipv4_connect(struct in_addr *in_addr, uint16_t port, int timeout)
-{
-	struct sockaddr_in _sin;
-	int fd, ret;
-
-	dbg_printf(4, "%s: Connecting to client\n", __FUNCTION__);
-	fd = socket(PF_INET, SOCK_STREAM, 0);
-	if (fd < 0)
-		return -1;
-
-	_sin.sin_family = PF_INET;
-	_sin.sin_port = htons(port);
-	memcpy(&_sin.sin_addr, in_addr, sizeof(_sin.sin_addr));
-
-	ret = connect_nb(fd, (struct sockaddr *)&_sin, sizeof(_sin), timeout);
-	if (ret < 0) {
-		close(fd);
-		return -1;
-	}
-
-	dbg_printf(4, "%s: Success; fd = %d\n", __FUNCTION__, fd);
-	return fd;
-}
-
-
-/**
-  Connect in a non-blocking fashion to the designated address.
-
-  @param fd		File descriptor to connect
-  @param dest		sockaddr (ipv4 or ipv6) to connect to.
-  @param len		Length of dest
-  @param timeout	Timeout, in seconds, to wait for a completed
-  			connection.
-  @return		0 on success, -1 on failure.
- */
-static int
-connect_nb(int fd, struct sockaddr *dest, socklen_t len, int timeout)
-{
-	int ret, flags = 1, err;
-	unsigned l;
-	fd_set rfds, wfds;
-	struct timeval tv;
-
-	/*
-	 * Use TCP Keepalive
-	 */
-	if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (void *)&flags,
-		       sizeof(flags))<0)
-		return -1;
-			
-	/*
-	   Set up non-blocking connect
-	 */
-	flags = fcntl(fd, F_GETFL, 0);
-	fcntl(fd, F_SETFL, flags | O_NONBLOCK);
-
-	ret = connect(fd, dest, len);
-
-	if ((ret < 0) && (errno != EINPROGRESS))
-		return -1;
-
-	if (ret != 0) {
-		FD_ZERO(&rfds);
-		FD_SET(fd, &rfds);
-		FD_ZERO(&wfds);
-		FD_SET(fd, &wfds);
-
-		tv.tv_sec = timeout;
-		tv.tv_usec = 0;
-		
-		if (select(fd + 1, &rfds, &wfds, NULL, &tv) == 0) {
-			errno = ETIMEDOUT;
-			return -1;
-		}
-		/* XXX check for -1 from select */
-
-		if (FD_ISSET(fd, &rfds) || FD_ISSET(fd, &wfds)) {
-			l = sizeof(err);
-			if (getsockopt(fd, SOL_SOCKET, SO_ERROR,
-				       (void *)&err, &l) < 0) {
-				close(fd);
-				return -1;
-			}
-
-			if (err != 0) {
-				close(fd);
-				errno = err;
-				return -1;
-			}
-
-			fcntl(fd, F_SETFL, flags);
-			return 0;
-		}
-	}
-
-	errno = EIO;
-	return -1;
-}
diff --git a/fence/agents/xvm/tcp.h b/fence/agents/xvm/tcp.h
deleted file mode 100644
index ec914e5..0000000
--- a/fence/agents/xvm/tcp.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef _XVM_TCP_H
-#define _XVM_TCP_H
-
-int ipv4_connect(struct in_addr *in_addr, uint16_t port, int timeout);
-int ipv6_connect(struct in6_addr *in6_addr, uint16_t port, int timeout);
-int ipv4_listen(uint16_t port, int backlog);
-int ipv6_listen(uint16_t port, int backlog);
-
-#endif
diff --git a/fence/agents/xvm/tests/hvm.xml b/fence/agents/xvm/tests/hvm.xml
deleted file mode 100644
index 4134b24..0000000
--- a/fence/agents/xvm/tests/hvm.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<domain type='xen' id='707'>
-  <name>pjc-xen-06</name>
-  <uuid>081b372c69a68432a13640fa03339353</uuid>
-  <os>
-    <type>hvm</type>
-    <loader>/usr/lib/xen/boot/hvmloader</loader>
-  </os>
-  <memory>524288</memory>
-  <vcpu>1</vcpu>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>restart</on_crash>
-  <features>
-    <pae/>
-  </features>
-  <devices>
-    <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
-    <interface type='bridge'>
-      <source bridge='xenbr0'/>
-      <mac address='02:10:15:84:04:06'/>
-      <script path='vif-bridge'/>
-    </interface>
-    <disk type='file' device='disk'>
-      <driver name='file'/>
-      <source file='/root/pjc6'/>
-      <target dev='hda'/>
-    </disk>
-    <graphics type='vnc' port='5905'/>
-    <console tty='/dev/pts/5'/>
-  </devices>
-</domain>
-
diff --git a/fence/agents/xvm/tests/linux.xml b/fence/agents/xvm/tests/linux.xml
deleted file mode 100644
index 06ac966..0000000
--- a/fence/agents/xvm/tests/linux.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<domain type='xen' id='2'>
-  <name>r5filebacked1</name>
-  <uuid>1a31981a01944fe7b7486a384e93dbae</uuid>
-  <bootloader>/usr/bin/pygrub</bootloader>
-  <os>
-    <type>linux</type>
-    <kernel>/var/lib/xen/boot_kernel.jGsgBH</kernel>
-    <initrd>/var/lib/xen/boot_ramdisk.bYFu-q</initrd>
-    <cmdline>ro root=/dev/VolGroup00/LogVol00</cmdline>
-  </os>
-  <memory>512000</memory>
-  <vcpu>1</vcpu>
-  <on_poweroff>destroy</on_poweroff>
-  <on_reboot>restart</on_reboot>
-  <on_crash>restart</on_crash>
-  <devices>
-    <interface type='bridge'>
-      <source bridge='xenbr0'/>
-      <mac address='C0:D1:F1:ED:1D:11'/>
-      <script path='vif-bridge'/>
-    </interface>
-    <graphics type='vnc' port='5900'/>
-    <disk type='file' device='disk'>
-      <driver name='tap' type='aio'/>
-      <source file='/mnt/xen/r5filebacked1'/>
-      <target dev='xvda'/>
-    </disk>
-    <console tty='/dev/pts/0'/>
-  </devices>
-</domain>
-
diff --git a/fence/agents/xvm/virt.c b/fence/agents/xvm/virt.c
deleted file mode 100644
index a836191..0000000
--- a/fence/agents/xvm/virt.c
+++ /dev/null
@@ -1,202 +0,0 @@
-#include <stdio.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include <libvirt/libvirt.h>
-#include <string.h>
-#include <malloc.h>
-#include <stdint.h>
-#include <errno.h>
-#include "virt.h"
-#include "debug.h"
-
-static int
-_compare_virt(const void *_left, const void *_right)
-{
-	virt_state_t *left = (virt_state_t *)_left,
-		     *right = (virt_state_t *)_right;
-
-	return strcasecmp(left->v_name, right->v_name);
-}
-
-
-virt_list_t *vl_get(virConnectPtr vp, int my_id)
-{
-	virt_list_t *vl = NULL;
-	int *d_ids = NULL;
-	int d_count, x;
-	char *d_name;
-	char d_uuid[MAX_DOMAINNAME_LENGTH];
-	virDomainPtr dom;
-	virDomainInfo d_info;
-
-	errno = EINVAL;
-	if (!vp)
-		return NULL;
-
-	d_count = virConnectNumOfDomains(vp);
-	if (d_count <= 0) {
-		if (d_count == 0) {
-			/* Successful, but no domains running */
-			errno = 0;
-			return NULL;
-		}
-		goto out_fail;
-	}
-
-	vl = malloc(sizeof(uint32_t) + sizeof(virt_state_t) * d_count );
-	if (!vl)
-		goto out_fail;
-
-	d_ids = malloc(sizeof(int) * d_count);
-	if (!d_ids)
-		goto out_fail;
-
-	if (virConnectListDomains(vp, d_ids, d_count) < 0)
-		goto out_fail;
-
-	vl->vm_count = d_count;
-
-	/* Ok, we have the domain IDs - let's get their names and states */
-	for (x = 0; x < d_count; x++) {
-		dom = virDomainLookupByID(vp, d_ids[x]);
-		if (!dom) {
-			/* XXX doom */
-			goto out_fail;
-		}
-
-		if (!(d_name = (char *)virDomainGetName(dom))) {
-			/* XXX no name for the domain?!! */
-			virDomainFree(dom);
-			goto out_fail;
-		}
-
-		if (virDomainGetUUIDString(dom, d_uuid) != 0) {
-			virDomainFree(dom);
-			goto out_fail;
-		}
-
-		if (virDomainGetInfo(dom, &d_info) < 0) {
-			/* XXX no info for the domain?!! */
-			virDomainFree(dom);
-			goto out_fail;
-		}
-
-		/* Store the name & state */
-		strncpy(vl->vm_states[x].v_name, d_name, MAX_DOMAINNAME_LENGTH);
-		strncpy(vl->vm_states[x].v_uuid, d_uuid, MAX_DOMAINNAME_LENGTH);
-		vl->vm_states[x].v_state.s_state = d_info.state;
-		vl->vm_states[x].v_state.s_owner = my_id;
-
-		virDomainFree(dom);
-	}
-
-	/* We have all the locally running domains & states now */
-	/* Sort */
-	free(d_ids);
-	qsort(&vl->vm_states[0], vl->vm_count, sizeof(vl->vm_states[0]),
-	      _compare_virt);
-	return vl;	
-
-out_fail:
-	x = errno;
-	if (d_ids)
-		free(d_ids);
-	if (vl)
-		free(vl);
-	errno = x;
-	return NULL;
-}
-
-
-/* Returns 0 if equal, nonzero if not */
-int
-vl_cmp(virt_list_t *left, virt_list_t *right)
-{
-	int x;
-
-	/* Quick checks */
-	if (!left->vm_count && !right->vm_count)
-		return 1;
-	if (left->vm_count != right->vm_count)
-		return 0;
-
-	for (x = 0; x < left->vm_count; x++) {
-		if (strcmp(left->vm_states[x].v_name,
-			   right->vm_states[x].v_name))
-			return 1;
-		/*
-		if (left->vm_states[x].v_state.s_state !=
-		    right->vm_states[x].v_state.s_state)
-			return 1;
-		 */
-	}
-
-	return 0;
-}
-
-
-void
-vl_print(virt_list_t *vl)
-{
-	int x;
-
-	/* XXX Once the logsys stderr "tag" goes away, the 21s should go back
-	   to 24s. */
-
-	dbg_printf(1, "%-21.21s %-36.36s %-5.5s %-5.5s\n", "Domain", "UUID",
-	       "Owner", "State");
-	dbg_printf(1, "%-21.21s %-36.36s %-5.5s %-5.5s\n", "------", "----",
-	       "-----", "-----");
-
-	if (!vl || !vl->vm_count)
-		return;
-
-	for (x = 0; x < vl->vm_count; x++) {
-		dbg_printf(1, "%-21.21s %-36.36s %-5.5d %-5.5d\n",
-		       vl->vm_states[x].v_name,
-		       vl->vm_states[x].v_uuid,
-		       vl->vm_states[x].v_state.s_owner,
-		       vl->vm_states[x].v_state.s_state);
-	}
-}
-
-
-virt_state_t *
-vl_find_name(virt_list_t *vl, char *name)
-{
-	int x;
-
-	if (!vl || !name || !vl->vm_count)
-		return NULL;
-
-	for (x = 0; x < vl->vm_count; x++) {
-		if (!strcasecmp(vl->vm_states[x].v_name, name))
-			return &vl->vm_states[x];
-	}
-
-	return NULL;
-}
-
-
-virt_state_t *
-vl_find_uuid(virt_list_t *vl, char *uuid)
-{
-	int x;
-
-	if (!vl || !uuid || !vl->vm_count)
-		return NULL;
-
-	for (x = 0; x < vl->vm_count; x++) {
-		if (!strcasecmp(vl->vm_states[x].v_uuid, uuid))
-			return &vl->vm_states[x];
-	}
-
-	return NULL;
-}
-
-
-void
-vl_free(virt_list_t *old)
-{
-	free(old);
-}
diff --git a/fence/agents/xvm/virt.h b/fence/agents/xvm/virt.h
deleted file mode 100644
index ce57c9d..0000000
--- a/fence/agents/xvm/virt.h
+++ /dev/null
@@ -1,62 +0,0 @@
-#ifndef _VIRT_H
-#define _VIRT_H
-#include <libvirt/libvirt.h>
-#include <stdint.h>
-#include <netinet/in.h>
-
-#include "xvm.h"
-
-/*
-   Owner 0 = no owner.
-
-   checkpoint "xen-vm-states" {
-     section "vm-name0" {
-       owner_nodeid;
-       vm_state;
-     }
-     section "vm-name1" {
-       owner_nodeid;
-       vm_state;
-     }
-     ...
-   }
- */
-
-typedef struct {
-	uint32_t s_owner;
-	int32_t s_state;
-} vm_state_t;
-
-typedef struct {
-	char v_name[MAX_DOMAINNAME_LENGTH];
-	char v_uuid[MAX_DOMAINNAME_LENGTH];
-	vm_state_t v_state;
-} virt_state_t;
-
-/**
-  This is stored in our private checkpoint section.
- */
-typedef struct _virt_list {
-	uint32_t	vm_count;
-	virt_state_t	vm_states[0];
-} virt_list_t;
-
-virt_list_t *vl_get(virConnectPtr vp, int my_id);
-
-int vl_cmp(virt_list_t *left, virt_list_t *right);
-
-void vl_print(virt_list_t *vl);
-void vl_free(virt_list_t *old);
-virt_state_t * vl_find_uuid(virt_list_t *vl, char *name);
-virt_state_t * vl_find_name(virt_list_t *vl, char *name);
-
-
-typedef void ckpt_handle;
-int ckpt_read(void *hp, char *secid, void *buf, size_t maxlen);
-int ckpt_finish(void *hp);
-int ckpt_write(void *hp, char *secid, void *buf, size_t maxlen);
-void *ckpt_init(char *ckpt_name, int maxlen, int maxsec, int maxseclen,
-		int timeout);
-
-
-#endif
diff --git a/fence/agents/xvm/vm_states.c b/fence/agents/xvm/vm_states.c
deleted file mode 100644
index 5468ff3..0000000
--- a/fence/agents/xvm/vm_states.c
+++ /dev/null
@@ -1,410 +0,0 @@
-/** @file
- * Distributed VM states using saCkpt interface
- */
-#include <string.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/resource.h>
-#include <sys/wait.h>
-#include <stdlib.h>
-#include <sys/time.h>
-#include <pthread.h>
-#include <openais/saAis.h>
-#include <openais/saCkpt.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <assert.h>
-
-typedef struct {
-	uint32_t ck_ready;
-	int ck_timeout;
-	SaCkptCheckpointHandleT ck_checkpoint;
-	SaCkptHandleT ck_handle;
-	char *ck_name;
-} ckpt_handle;
-
-
-#define READY_MAGIC 0x13fd237c
-#define VALIDATE(h) \
-do { \
-	if (!h || h->ck_ready != READY_MAGIC) { \
-		errno = EINVAL; \
-		return -1; \
-	} \
-} while(0)
-
-int ais_to_posix(SaAisErrorT err);
-
-int
-ais_to_posix(SaAisErrorT err)
-{
-	switch (err) {
-	case SA_AIS_OK:
-		return 0;
-	case SA_AIS_ERR_LIBRARY:
-		return ELIBBAD;
-	case SA_AIS_ERR_VERSION:
-		return EPROTONOSUPPORT; //XXX
-	case SA_AIS_ERR_INIT:
-		return EFAULT; //XXX
-	case SA_AIS_ERR_TIMEOUT:
-		return ETIMEDOUT;
-	case SA_AIS_ERR_TRY_AGAIN:
-		return EAGAIN;
-	case SA_AIS_ERR_INVALID_PARAM:
-		return EINVAL;
-	case SA_AIS_ERR_NO_MEMORY:
-		return ENOMEM;
-	case SA_AIS_ERR_BAD_HANDLE:
-		return EBADF;
-	case SA_AIS_ERR_BUSY:
-		return EBUSY;
-	case SA_AIS_ERR_ACCESS:
-		return EACCES;
-	case SA_AIS_ERR_NOT_EXIST:
-		return ENOENT;
-	case SA_AIS_ERR_NAME_TOO_LONG:
-		return ENAMETOOLONG;
-	case SA_AIS_ERR_EXIST:
-		return EEXIST;
-	case SA_AIS_ERR_NO_SPACE:
-		return ENOSPC;
-	case SA_AIS_ERR_INTERRUPT:
-		return EINTR;
-	case SA_AIS_ERR_NAME_NOT_FOUND:
-		return ENOENT;
-	case SA_AIS_ERR_NO_RESOURCES:
-		return ENOMEM; //XXX
-	case SA_AIS_ERR_NOT_SUPPORTED:
-		return ENOSYS;
-	case SA_AIS_ERR_BAD_OPERATION:
-		return EINVAL; //XXX
-	case SA_AIS_ERR_FAILED_OPERATION:
-		return EIO; //XXX
-	case SA_AIS_ERR_MESSAGE_ERROR:
-		return EIO; // XXX
-	case SA_AIS_ERR_QUEUE_FULL:
-		return ENOBUFS;
-	case SA_AIS_ERR_QUEUE_NOT_AVAILABLE:
-		return ENOENT;
-	case SA_AIS_ERR_BAD_FLAGS:
-		return EINVAL;
-	case SA_AIS_ERR_TOO_BIG:
-		return E2BIG;
-	case SA_AIS_ERR_NO_SECTIONS:
-		return ENOENT; // XXX
-	}
-
-	return -1;
-}
-
-
-static int 
-ckpt_open(ckpt_handle *h, const char *ckpt_name, int maxsize,
-	  int maxsec, int maxsecsize, int timeout)
-{
-	SaCkptCheckpointCreationAttributesT attrs;
-	SaCkptCheckpointOpenFlagsT flags;
-	SaNameT cpname;
-#if 0
-	SaCkptCheckpointDescriptorT status;
-#endif
-	SaAisErrorT err = SA_AIS_OK;
-
-	VALIDATE(h);
-
-	flags = SA_CKPT_CHECKPOINT_READ |
-		SA_CKPT_CHECKPOINT_WRITE;
-
-	snprintf((char *)cpname.value, SA_MAX_NAME_LENGTH-1,
-		 "%s", ckpt_name);
-	cpname.length = strlen(ckpt_name);
-
-	h->ck_timeout = timeout;
-
-	err = saCkptCheckpointOpen(h->ck_handle,
-				   &cpname,
-				   NULL,	
-				   flags,
-				   timeout,
-				   &h->ck_checkpoint);
-
-	if (err == SA_AIS_OK) {
-#if 0
-		saCkptCheckpointStatusGet(h->ck_handle,
-					  &status);
-
-		printf("Checkpoint Size = %d bytes\n", (int)
-			status.checkpointCreationAttributes.checkpointSize);
-		printf("Flags = ");
-		if (status.checkpointCreationAttributes.creationFlags &
-			SA_CKPT_WR_ALL_REPLICAS) {
-			printf("%s ", "SA_CKPT_WR_ALL_REPLICAS");
-		}
-		if (status.checkpointCreationAttributes.creationFlags &
-			SA_CKPT_WR_ACTIVE_REPLICA) {
-			printf("%s ", "SA_CKPT_WR_ACTIVE_REPLICA");
-		}
-		if (status.checkpointCreationAttributes.creationFlags &
-			SA_CKPT_WR_ACTIVE_REPLICA_WEAK) {
-			printf("%s ", "SA_CKPT_WR_ACTIVE_REPLICA_WEAK");
-		}
-		if (status.checkpointCreationAttributes.creationFlags &
-			SA_CKPT_CHECKPOINT_COLLOCATED) {
-			printf("%s ", "SA_CKPT_CHECKPOINT_COLLOCATED");
-		}
-		printf("\nMax sections = %d\n",
-			(int)status.checkpointCreationAttributes.maxSections);
-		printf("Max section size = %d\n",
-			(int)status.checkpointCreationAttributes.maxSectionSize);
-		printf("Max section ID size = %d\n",
-			(int)status.checkpointCreationAttributes.maxSectionIdSize);
-		printf("Section count = %d\n", status.numberOfSections);
-		printf("\n");
-#endif
-		goto good;
-	}
-
-	attrs.creationFlags = SA_CKPT_WR_ALL_REPLICAS;
-	attrs.checkpointSize = (SaSizeT)maxsize;
-	attrs.retentionDuration = SA_TIME_ONE_HOUR;
-	attrs.maxSections = maxsec;
-	attrs.maxSectionSize = (SaSizeT)maxsecsize;
-	attrs.maxSectionIdSize = (SaSizeT)32;
-
-	flags = SA_CKPT_CHECKPOINT_READ |
-		SA_CKPT_CHECKPOINT_WRITE |
-		SA_CKPT_CHECKPOINT_CREATE;
-
-	err = saCkptCheckpointOpen(h->ck_handle,
-				   &cpname,
-				   &attrs,
-				   flags,
-				   timeout,
-				   &h->ck_checkpoint);
-	if (err == SA_AIS_OK)
-		goto good;
-
-	/* No checkpoint */
-	errno = ais_to_posix(err);
-	return (errno == 0 ? 0 : -1);
-good:
-	printf("Opened ckpt %s\n", ckpt_name);
-	h->ck_name = strdup(ckpt_name);
-
-	errno = ais_to_posix(err);
-	return (errno == 0 ? 0 : -1);
-}
-
-
-void *
-ckpt_init(char *ckpt_name, int maxlen, int maxsec,
-	  int maxseclen, int timeout)
-{
-	ckpt_handle *h;
-	SaAisErrorT err;
-	SaVersionT ver;
-
-	if (!ckpt_name || !strlen(ckpt_name)) {
-		errno = EINVAL;
-		return NULL;
-	}
-	h = malloc(sizeof(*h));
-	if (!h)
-		return NULL;
-	memset(h, 0, sizeof(*h));
-
-	ver.releaseCode = 'B';
-	ver.majorVersion = 1;
-	ver.minorVersion = 1;
-
-	err = saCkptInitialize(&h->ck_handle, NULL, &ver);
-
-	if (err != SA_AIS_OK) {
-		free(h);
-		return NULL;
-	} else
-		h->ck_ready = READY_MAGIC;
-
-	if (ckpt_open(h, ckpt_name, maxlen, maxsec, maxseclen,
-		      timeout) < 0) {
-		saCkptCheckpointClose(h->ck_checkpoint);
-		if (h->ck_name) 
-			free(h->ck_name);
-		free(h);
-		return NULL;
-	}
-
-	return (void *)h;
-}
-
-
-int
-ckpt_write(void *hp, char *secid, void *buf, size_t maxlen)
-{
-	ckpt_handle *h = (ckpt_handle *)hp;
-	SaCkptIOVectorElementT iov = {SA_CKPT_DEFAULT_SECTION_ID,
-				      NULL, 0, 0, 0};
-	SaAisErrorT err;
-	SaCkptSectionCreationAttributesT attrs;
-
-	VALIDATE(h);
-
-	/* Set section ID here */
-	iov.sectionId.id = (uint8_t *)secid;
-	iov.sectionId.idLen = strlen(secid);
-	iov.dataBuffer = buf;
-	iov.dataSize = (SaSizeT)maxlen;
-	iov.dataOffset = 0;
-	iov.readSize = 0;
-
-	err = saCkptCheckpointWrite(h->ck_checkpoint, &iov, 1, NULL);
-
-	if (err == SA_AIS_ERR_NOT_EXIST) {
-		attrs.sectionId = &iov.sectionId;
-		attrs.expirationTime = SA_TIME_END;
-
-		err = saCkptSectionCreate(h->ck_checkpoint, &attrs, 
-					  buf, maxlen);
-	}
-
-	if (err == SA_AIS_OK)
-		saCkptCheckpointSynchronize(h->ck_checkpoint,
-					    h->ck_timeout);
-
-	errno = ais_to_posix(err);
-	if (errno)
-		return -1;
-	return maxlen; /* XXX */
-}
-
-
-int
-ckpt_read(void *hp, char *secid, void *buf, size_t maxlen)
-{
-	ckpt_handle *h = (ckpt_handle *)hp;
-	SaCkptIOVectorElementT iov = {SA_CKPT_DEFAULT_SECTION_ID,
-				      NULL, 0, 0, 0};
-	SaAisErrorT err;
-
-	VALIDATE(h);
-	//printf("reading ckpt %s\n", keyid);
-
-	iov.sectionId.id = (uint8_t *)secid;
-	iov.sectionId.idLen = strlen(secid);
-	iov.dataBuffer = buf;
-	iov.dataSize = (SaSizeT)maxlen;
-	iov.dataOffset = 0;
-	iov.readSize = 0;
-
-	err = saCkptCheckpointRead(h->ck_checkpoint, &iov, 1, NULL);
-
-	errno = ais_to_posix(err);
-	if (errno)
-		return -1;
-	return iov.readSize; /* XXX */
-}
-
-
-int
-ckpt_finish(void *hp)
-{
-	ckpt_handle *h = (ckpt_handle *)hp;
-	int ret = 0;
-	SaAisErrorT err;
-
-	saCkptCheckpointClose(h->ck_checkpoint);
-	err = saCkptFinalize(h->ck_handle);
-
-	if (err != SA_AIS_OK)
-		ret = -1;
-	else
-		h->ck_ready = 0;
-
-	if (h->ck_name)
-		free(h->ck_name);
-
-	if (ret != 0)
-		errno = ais_to_posix(err);
-	return ret;
-}
-
-
-#ifdef STANDALONE
-void
-usage(int ret)
-{
-	printf("usage: ckpt [-c ckpt_name] <-r key|-w key -d data>\n");
-	exit(ret);
-}
-
-int
-main(int argc, char **argv)
-{
-	char *ckptname = "ckpt_test";
-	char *sec = "default";
-	char *val;
-	void *h;
-	char buf[64];
-	int ret;
-	int op = 0;
-
-	while((ret = getopt(argc, argv, "c:w:r:d:j?")) != EOF) {
-		switch(ret) {
-		case 'c': 
-			ckptname = optarg;
-			break;
-		case 'w': 
-			op = 'w';
-			sec = optarg;
-			break;
-		case 'r':
-			op = 'r';
-			sec = optarg;
-			break;
-		case 'd':
-			val = optarg;
-			break;
-		case '?':
-		case 'h':
-			usage(0);
-		default:
-			usage(1);
-		}
-	}
-
-	if (!op) {
-		usage(1);
-	}
-
-	if (!sec) {
-		usage(1);
-	}
-
-	h = ckpt_init(ckptname, 262144, 4096, 64, 10);
-	if (!h) {
-		perror("ckpt_init");
-		return -1;
-	}
-
-	if (op == 'w') {
-		if (ckpt_write(h, sec, val, strlen(val)+1) < 0) {
-			perror("ckpt_write");
-			return 1;
-		}
-	} else if (op == 'r') {
-		ret = ckpt_read(h, sec, buf, sizeof(buf));
-		if (ret < 0) {
-			perror("ckpt_read");
-			return 1;
-		}
-
-		printf("%d bytes\nDATA for '%s':\n%s\n", ret, sec,
-		       buf);
-	}
-
-	ckpt_finish(h);
-
-	return 0;
-}
-#endif
diff --git a/fence/agents/xvm/xml.c b/fence/agents/xvm/xml.c
deleted file mode 100644
index 8868e64..0000000
--- a/fence/agents/xvm/xml.c
+++ /dev/null
@@ -1,315 +0,0 @@
-#include <libxml/xmlmemory.h>
-#include <libxml/parser.h>
-#include <string.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <ctype.h>
-
-
-#ifdef STANDALONE
-#define dbg_printf(x, fmt, args...) printf("<%d> " fmt, x, ##args)
-#else
-#include "debug.h"
-#endif
-
-
-xmlNodePtr
-get_os_node(xmlDocPtr doc)
-{
-	xmlNodePtr node;
-
-	/* Flip the property of the graphics port if it exists */
-	node = xmlDocGetRootElement(doc);
-	node = node->children;
-
-	while (node) {
-		if (!xmlStrcmp(node->name, (xmlChar *)"os"))
-			break;
-		node = node->next;
-	}
-
-	return node;
-}
-
-
-int
-flip_graphics_port(xmlDocPtr doc)
-{
-	xmlNodePtr node, curr;
-
-	/* Flip the property of the graphics port if it exists */
-	node = xmlDocGetRootElement(doc);
-	node = node->children;
-
-	while (node) {
-		if (!xmlStrcmp(node->name, (xmlChar *)"devices"))
-			break;
-		node = node->next;
-	}
-
-	node = node->children;
-	curr = node;
-	while (curr) {
-		if (!xmlStrcmp(curr->name, (xmlChar *)"graphics"))
-			break;
-		curr = curr->next;
-	}
-
-	if (xmlGetProp(curr, (xmlChar *)"port")) {
-		dbg_printf(5,"Zapping the graphics port\n");
-		xmlSetProp(curr, (xmlChar *)"port", (xmlChar *)"-1");
-	}
-
-	return 0;
-}
-
-
-int
-cleanup_xml_doc(xmlDocPtr doc)
-{
-	xmlNodePtr os_node, curr;
-	int type = 0;
-	char *val;
-
-	curr = xmlDocGetRootElement(doc);
-	if (xmlStrcmp(curr->name, (xmlChar *)"domain")) {
-		dbg_printf(1, "Invalid XML\n");
-		return -1;
-	}
-
-	flip_graphics_port(doc);
-
-	os_node = get_os_node(doc);
-	if (!os_node)
-		return -1;
-
-	curr = os_node->children;
-	while (curr) {
-		if (!xmlStrcmp(curr->name, (xmlChar *)"type"))
-			break;
-		curr = curr->next;
-	}
-	if (!curr) {
-		dbg_printf(1, "Unable to determine the domain type\n");
-		return -1;
-	}
-
-	val = (char *)xmlNodeGetContent(curr);
-	while (isspace(*val)) val++;
-
-	if (!strcasecmp(val, "hvm")) {
-		type = 1;
-		dbg_printf(2, "Virtual machine is HVM\n");
-	} else if (!strcasecmp(val, "linux")) {
-		type = 2;
-		dbg_printf(2, "Virtual machine is Linux\n");
-	}
-
-	/* Node is still pointing to the <os> block */
-	if (type == 2) {
-		dbg_printf(3, "Unlinking %s block\n", (char *)os_node->name);
-		xmlUnlinkNode(os_node);
-		xmlFreeNode(os_node);
-	}
-
-	return 0;
-}
-
-
-int
-xtree_readfile(const char *filename, xmlDocPtr *xtreep)
-{
-	xmlNodePtr cur;
-
-	xmlKeepBlanksDefault(0);
-	xmlIndentTreeOutput = 1;
-
-	*xtreep = xmlParseFile(filename);
-
-	if (!*xtreep)
-		return -1;
-
-	if (!((cur = xmlDocGetRootElement(*xtreep)))) {
-		xmlFreeDoc(*xtreep);
-		*xtreep = NULL;
-		return -1;
-	}
-
-	return 0;
-}
-
-
-int
-xtree_readbuffer(const char *buffer, size_t size, xmlDocPtr *xtreep)
-{
-	xmlNodePtr cur;
-
-	xmlKeepBlanksDefault(0);
-	xmlIndentTreeOutput = 1;
-
-	*xtreep = xmlParseMemory(buffer, size);
-
-	if (!*xtreep) {
-		dbg_printf(1, "parse failure %p %d\n", buffer, (int)size);
-		return -1;
-	}
-
-	if (!((cur = xmlDocGetRootElement(*xtreep)))) {
-		dbg_printf(1, "root element failure\n");
-		xmlFreeDoc(*xtreep);
-		*xtreep = NULL;
-		return -1;
-	}
-
-	return 0;
-}
-
-
-int
-xtree_writefile(const char *filename, xmlDocPtr xtree)
-{
-	char tmpfn[1024];
-	int fd, tmpfd;
-	xmlChar *buffer;
-	struct flock flock;
-	int n, remain, written, size = 0;
-
-	snprintf(tmpfn, sizeof(tmpfn), "%s.XXXXXX", filename);
-	tmpfd = mkstemp(tmpfn);
-	if (tmpfd == -1)
-		return -1;
-
-	memset(&flock, 0, sizeof(flock));
-	flock.l_type = F_WRLCK;
-
-	fd = open(filename, O_WRONLY | O_CREAT | O_SYNC, S_IRUSR | S_IWUSR );
-	if (fd == -1) {
-		n = errno;
-		close(tmpfd);
-		unlink(tmpfn);
-		errno = n;
-		return -1;
-	}
-
-	while (fcntl(fd, F_SETLKW, &flock) == -1) {
-		if (errno == EINTR)
-			continue;
-		n = errno;
-		close(fd);
-		close(tmpfd);
-		unlink(tmpfn);
-		errno = n;
-		return -1;
-	}
-
-	xmlDocDumpFormatMemory(xtree, (xmlChar **)&buffer, (int *)&size, 1);
-
-	written = 0;
-	remain = size;
-	while (remain) {
-		n = write(tmpfd, buffer + written, remain);
-
-		if (n == -1) {
-			if (errno == EINTR)
-				continue;
-				
-			free(buffer);
-			n = errno;
-			close(fd);
-			close(tmpfd);
-			unlink(tmpfn);
-			errno = n;
-			return -1;
-		}
-			
-		written += n;
-		remain -= n;
-	}
-
-	xmlFree(buffer);
-	if (rename(tmpfn, filename) == -1) {
-		n = errno;
-		close(fd);
-		close(tmpfd);
-		unlink(tmpfn);
-		errno = n;
-		return -1;
-	}
-
-	close(fd);
-	fsync(tmpfd);
-	close(tmpfd);
-	return 0;
-}
-
-
-int
-xtree_writebuffer(xmlDocPtr xtree, char **buffer, size_t *size)
-{
-	*size = 0;
-	xmlDocDumpFormatMemory(xtree, (xmlChar **)buffer, (int *)size, 1);
-	return 0;
-}
-
-
-int
-cleanup_xml(char *desc, char **ret, size_t *retsz)
-{
-	xmlDocPtr xtree;
-	int rv;
-
-	*ret = NULL;
-	if (xtree_readbuffer(desc, strlen(desc), &xtree) < 0) {
-		xmlCleanupParser();
-		return -1;
-	}
-
-	rv = cleanup_xml_doc(xtree);	
-	if (xtree_writebuffer(xtree, ret, retsz) < 0)
-		rv = -1;
-
-	if (*ret && rv < 0)
-		free(*ret);
-	xmlFreeDoc(xtree);
-	xmlCleanupParser();
-	return rv;
-}
-
-
-#ifdef STANDALONE
-int
-main(int argc, char **argv)
-{
-	char *file = NULL;
-	char *buf;
-	size_t sz;
-	int opt;
-	xmlDocPtr xtree;
-
-	while ((opt = getopt(argc, argv, "f:")) != EOF) {
-		switch(opt) {
-		case 'f':
-			file = optarg;
-			break;
-		}
-	}
-
-	if (!file) {
-		printf("No file specified\n");
-		return 1;
-	}
-
-	if (xtree_readfile(file, &xtree) < 0)
-		return -1;
-
-	cleanup_xml_doc(xtree);
-
-	xtree_writebuffer(xtree, &buf, &sz);
-	write(1, buf, sz);
-
-	return 0;
-}
-#endif
diff --git a/fence/agents/xvm/xvm.h b/fence/agents/xvm/xvm.h
deleted file mode 100644
index de89543..0000000
--- a/fence/agents/xvm/xvm.h
+++ /dev/null
@@ -1,65 +0,0 @@
-#ifndef _XVM_H
-#define _XVM_H
-
-#include <stdint.h>
-#include <sechash.h>
-#include <netinet/in.h>
-
-#define XVM_VERSION "0.9.3"
-
-#define MAX_DOMAINNAME_LENGTH 64 /* XXX MAXHOSTNAMELEN */
-#define MAX_ADDR_LEN		sizeof(struct sockaddr_in6)
-#define DOMAIN0NAME "Domain-0"
-#define DOMAIN0UUID "00000000-0000-0000-0000-000000000000"
-
-typedef enum {
-	HASH_NONE = 0x0,	/* No packet signing */
-	HASH_SHA1 = 0x1,	/* SHA1 signing */
-     	HASH_SHA256 = 0x2,      /* SHA256 signing */
-     	HASH_SHA512 = 0x3       /* SHA512 signing */
-} fence_hash_t;
-
-#define DEFAULT_HASH HASH_SHA256
-
-typedef enum {
-	AUTH_NONE = 0x0,	/* Plain TCP */
-	AUTH_SHA1 = 0x1,	/* Challenge-response (SHA1) */
-  	AUTH_SHA256 = 0x2,      /* Challenge-response (SHA256) */
-	AUTH_SHA512 = 0x3,      /* Challenge-response (SHA512) */
-     /* AUTH_SSL_X509 = 0x10        SSL X509 certificates */
-} fence_auth_type_t;
-
-#define DEFAULT_AUTH AUTH_SHA256
-
-typedef enum {
-	FENCE_NULL   = 0x0,	
-	FENCE_OFF    = 0x1,	/* Turn the VM off */
-	FENCE_REBOOT = 0x2	/* Hit the reset button */
-     /* FENCE_ON = 0x3            Turn the VM on */
-} fence_cmd_t;
-
-#define DEFAULT_TTL 4
-
-#ifndef DEFAULT_HYPERVISOR_URI
-#define DEFAULT_HYPERVISOR_URI "qemu:///system"
-#endif
-
-#define MAX_HASH_LENGTH SHA512_LENGTH
-#define MAX_KEY_LEN 4096
-
-typedef struct __attribute__ ((packed)) _fence_req {
-	uint8_t  request;		/* Fence request */
-	uint8_t  hashtype;		/* Hash type used */
-	uint8_t  addrlen;		/* Length of address */
-	uint8_t  flags;			/* Special flags */
-#define RF_UUID 0x1			   /* Flag specifying UUID */
-	uint8_t  domain[MAX_DOMAINNAME_LENGTH]; /* Domain to fence*/
-	uint8_t  address[MAX_ADDR_LEN]; /* We're this IP */
-	uint16_t port;			/* Port we bound to */
-	uint8_t  random[10];		/* Random Data */
-	uint32_t family;		/* Address family */
-	uint8_t  hash[MAX_HASH_LENGTH];	/* Binary hash */
-} fence_req_t;
-
-
-#endif
diff --git a/fence/agents/zvm/Makefile b/fence/agents/zvm/Makefile
deleted file mode 100644
index 7f32889..0000000
--- a/fence/agents/zvm/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-TARGET= fence_zvm
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/fencebuild.mk
diff --git a/fence/agents/zvm/fence_zvm.pl b/fence/agents/zvm/fence_zvm.pl
deleted file mode 100644
index ce9d813..0000000
--- a/fence/agents/zvm/fence_zvm.pl
+++ /dev/null
@@ -1,344 +0,0 @@
-#!/usr/bin/perl
-
-use Getopt::Std;
-use IPC::Open2;
-
-# Get the program name from $0 and strip directory names
-$_=$0;
-s/.*\///;
-my $pname = $_;
-
-# WARNING!! Do not add code bewteen "#BEGIN_VERSION_GENERATION" and
-# "#END_VERSION_GENERATION"  It is generated by the Makefile
-
-#BEGIN_VERSION_GENERATION
-$RELEASE_VERSION="";
-$REDHAT_COPYRIGHT="";
-$BUILD_DATE="";
-#END_VERSION_GENERATION
-
-
-$comm_program = s3270;
-$debug = 0;
-$max_loops = 10;
-
-sub usage
-{
-    print "Usage:\n";  
-    print "\n";
-    print "$pname [options]\n";
-    print "\n";
-    print "Options:\n";
-    print "  -a <ip>          IP address or hostname of the physical s390\n";
-    print "  -h               usage\n";
-    print "  -u <string>      userid of the virtual machine to fence\n";
-    print "  -p <string>      Password\n";
-    print "  -S <path>        Script to run to retrieve login password\n";
-    print "  -q               quiet mode\n";
-    print "  -r <devnum>      ipl device <devnum>\n";
-    print "  -V               Version\n";
-
-    exit 0;
-}
-
-sub fail
-{
-  ($msg)=@_;
-  print "failed: " . $msg . "\n" unless defined $opt_q;
-  exit 1;
-}
-
-sub fail_usage
-{
-  ($msg)=@_;
-  print stderr $msg."\n" if $msg;
-  print stderr "Please use '-h' for usage.\n";
-  exit 1;
-}
-
-sub version
-{
-  print "$pname $RELEASE_VERSION $BUILD_DATE\n";
-  print "$REDHAT_COPYRIGHT\n" if ( $REDHAT_COPYRIGHT );
-
-  exit 0;
-}
-
-
-sub do_read
-{
-    my($line);
-
-    $line = <READ_H>;
-
-    if ($debug)
-    {
-	my($l) = ($line);
-	$l =~ s/\n//;
-	print "read:  $l\n";
-    }
-    
-    return $line;
-}
-
-sub do_write
-{
-    my($line) = @_;
-
-    if ($debug)
-    {
-	my($l) = ($line);
-	$l =~ s/\n//;
-	print "write:  $l\n";	
-    }
-
-    print WRITE_H $line;
-}
-
-
-sub look_for
-{
-    my ($text, $found);
-    $found = 0;
-    ($text) = @_;
-    &do_write("ascii\n");
-    while(1){
-	$_ = &do_read;
-	last unless (/^data:/);
-	$found = 1 if (/$text/);
-    } 
-    $_ = &do_read; 
-    fail "error while looking for string '$text'." unless (/ok/);
-    return $found;
-}
-
-sub in_cp_read_state
-{
-    my ($prev);
-    $_ = "";
-    &do_write("ascii\n");
-    while (1){
-	$prev = $_;
-	$_ = &do_read;
-	last unless (/^data:/);
-    }
-    $_ = &do_read;
-    fail "error while looking for machine state." unless (/ok/);
-    return 1 if ($prev =~ /CP READ/i);
-    return 0;
-}
-
-sub send_wait
-{ 
-    &do_write("wait\n");
-    $_ = &do_read;
-    $_ = &do_read;
-    if (/ok/){
-	return 1;
-    }
-    return 0;
-}
-
-sub send_string
-{
-    my ($cmd);
-    ($cmd) = @_;
-    &do_write('string "' . $cmd . '\n"' . "\n");
-    $_ = &do_read;
-    $_ = &do_read;
-    if (/ok/){
-	return send_wait;
-    }
-    return 0;
-}
-
-sub send_cmd
-{
-    my ($cmd);
-    ($cmd) = @_;
-    &do_write($cmd . "\n");
-    $_ = &do_read;
-    $_ = &do_read;
-    if (/ok/){
-	return send_wait;
-    }
-    return 0;
-}
-
-sub wait_for_response
-{
-    my ($pass, $failure, $msg, $found, $loops);
-    $loops = 0;
-    $found = 0;
-    ($pass, $failure, $msg) = @_;
-    while (1){
-      $loops = $loops + 1;
-      fail "timed out waiting for '$pass'" if ($loops > $max_loops);
-      &do_write("ascii\n");
-      while(1){
-        $_ = &do_read;
-        chomp;
-        last unless (/^data:/);
-        $found = 1 if (/$pass/);
-        if ($failure){
-          fail("$msg '$_'") if (/$failure/);
-        }
-      }
-      $_ = &do_read;
-      fail "wait for response failed '$_'" unless (/ok/);
-      last if $found;
-      sleep 1;
-    }
-    return 0;
-}
-
-sub check_response
-{
-    ($action) = @_;
-    $_ = &do_read;
-    $_ = &do_read;
-    fail "$action failed." unless (/ok/);
-}
-
-sub get_options_stdin
-{
-    my $opt;
-    my $line = 0;
-    while( defined($in = <>) )
-    {
-        $_ = $in;
-	      chomp;
-
-        # strip leading and trailing whitespace
-        s/^\s*//;
-        s/\s*$//;
-
-        # skip comments
-        next if /^#/;
-
-	      $line+=1;
-        $opt=$_;
-        next unless $opt;
-
-	      ($name,$val)=split /\s*=\s*/, $opt;
-
-	      if ( $name eq "" )
-        {
-           print stderr "parse error: illegal name in option $line\n";
-           exit 2;
-        }
-
-	      # DO NOTHING -- this field is used by fenced or stomithd
-        elsif ($name eq "agent" ) { }
-
-	      # FIXME -- depricated.  use "userid" and "password" instead.
-        elsif ($name eq "fm" )
-        {
-            (my $dummy,$opt_u,$opt_p) = split /\s+/,$val;
-	          print STDERR "Depricated \"fm\" entry detected.  refer to man page.\n";
-        }
-
-	      elsif ($name eq "ipaddr" )
-        {
-            $opt_a = $val;
-        }
-
-        elsif ($name eq "ipl" )
-        {
-            $opt_r = $val;
-        }
-
-        # FIXME -- depreicated residue of old fencing system
-      	elsif ($name eq "name" ) { }
-
-	      elsif ($name eq "passwd" )
-        {
-            $opt_p = $val;
-        }
-		elsif ($name eq "passwd_script" )
-		{
-			$opt_S = $val;
-		}
-	      elsif ($name eq "userid" )
-        {
-            $opt_u = $val;
-        }
-
-	else
-        {
-           print stderr "parse error: unknown option \"$opt\"\n";
-           #> exit 2;
-        }
-    }
-}
-
-if (@ARGV > 0){
-    getopts("a:hp:S:qr:u:V") || fail_usage;
-    usage if defined $opt_h;
-    version if defined $opt_V;
-
-    fail_usage "Unkown parameter." if (@ARGV > 0);
-
-    fail_usage "No '-a' flag specified." unless defined $opt_a;
-
-    if (defined $opt_S) {
-        $pwd_script_out = `$opt_S`;
-        chomp($pwd_script_out);
-        if ($pwd_script_out) {
-            $opt_p = $pwd_script_out;
-        }
-    }
-
-    fail_usage "No '-p' or '-S' flag specified." unless defined $opt_p;
-    fail_usage "No '-u' flag specified." unless defined $opt_u;
-
-} else {
-    get_options_stdin();
-
-    fail "no IP address" unless defined $opt_a;
-    fail "no userid" unless defined $opt_u;
-
-    if (defined $opt_S) {
-        $pwd_script_out = `$opt_S`;
-        chomp($pwd_script_out);
-        if ($pwd_script_out) {
-            $opt_p = $pwd_script_out;
-        }
-    }
-
-    fail "no password" unless defined $opt_p;
-}
-
-$pid = open2(READ_H, WRITE_H, "$comm_program 2>&1");
-&do_write("connect $opt_a\n");
-$_ = &do_read;
-unless (/^U U U/){
-    chomp;
-    fail "communication program failed with '$_'.";
-}
-$_ = &do_read;
-fail "couldn't connect to $opt_a." unless(/ok/);
-send_wait or fail "couldn't start 3270 session on $opt_a.";
-send_cmd "enter" or fail "couldn't reach logon prompt.";
-look_for "Enter one of the following commands:" or fail "doesn't look like a login prompt\n";
-send_string "logon $opt_u $opt_p norun here" or fail "couldn't login";
-send_cmd "clear" or fail "couldn't send the clear command.";
-send_string "#cp query userid";
-wait_for_response(uc($opt_u),"Enter one of the following commands:", "logon failed");
-fail "machine not in CP READ state" unless in_cp_read_state;
-if (defined $opt_r){
-    send_string "ipl $opt_r" or fail "couldn't send reboot command";
-} else {
-    send_string "stop" or fail "couldn't send stop command\n";
-}
-fail "command failed" if look_for "Unknown CP command";
-if (defined $opt_r && !in_cp_read_state){
-    send_string "#cp disc";
-} else {
-    &do_write("disconnect\n");
-}
-&do_write("quit\n");
-
-print "success: booted userid $opt_u\n" unless defined $opt_q;
-
-exit 0;
diff --git a/fence/fence_node/Makefile b/fence/fence_node/Makefile
deleted file mode 100644
index 0ce0615..0000000
--- a/fence/fence_node/Makefile
+++ /dev/null
@@ -1,37 +0,0 @@
-TARGET = fence_node
-
-SBINDIRT=$(TARGET)
-
-all: depends ${TARGET}
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-OBJS=	fence_node.o
-
-CFLAGS += -D_FILE_OFFSET_BITS=64
-
-CFLAGS += -I${ccsincdir} -I${fenceincdir} -I${logtincdir}
-CFLAGS += -I$(S)/../libfenced
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${ccslibdir} -L${fencelibdir} -lccs -lfence
-LDFLAGS += -L${logtlibdir} -llogthread
-LDFLAGS += -L../libfenced -lfenced
-LDFLAGS += -L${libdir}
-
-LDDEPS += ../libfenced/libfenced.a
-
-${TARGET}: ${OBJS} ${LDDEPS}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-depends:
-	$(MAKE) -C ../libfence
-	$(MAKE) -C ../libfenced
-
-clean: generalclean
-
--include $(OBJS:.o=.d)
diff --git a/fence/fence_node/fence_node.c b/fence/fence_node/fence_node.c
deleted file mode 100644
index 44dcbc3..0000000
--- a/fence/fence_node/fence_node.c
+++ /dev/null
@@ -1,112 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdint.h>
-#include <string.h>
-#include <liblogthread.h>
-
-#include "libfence.h"
-#include "libfenced.h"
-#include "copyright.cf"
-
-#define OPTION_STRING           ("huV")
-
-#define die(fmt, args...) \
-do \
-{ \
-  fprintf(stderr, "%s: ", prog_name); \
-  fprintf(stderr, fmt "\n", ##args); \
-  exit(EXIT_FAILURE); \
-} \
-while (0)
-
-static char *prog_name;
-
-static void print_usage(void)
-{
-	printf("Usage:\n");
-	printf("\n");
-	printf("%s [options] node_name\n", prog_name);
-	printf("\n");
-	printf("Options:\n");
-	printf("\n");
-	printf("  -h               Print this help, then exit\n");
-	printf("  -V               Print program version information, then exit\n");
-	printf("\n");
-}
-
-int main(int argc, char *argv[])
-{
-	int cont = 1, optchar, error, rv;
-	char *victim = NULL;
-
-	prog_name = argv[0];
-
-	while (cont) {
-		optchar = getopt(argc, argv, OPTION_STRING);
-
-		switch (optchar) {
-
-		case 'h':
-			print_usage();
-			exit(EXIT_SUCCESS);
-			break;
-
-		case 'V':
-			printf("%s %s (built %s %s)\n", prog_name,
-				RELEASE_VERSION, __DATE__, __TIME__);
-			printf("%s\n", REDHAT_COPYRIGHT);
-			exit(EXIT_SUCCESS);
-			break;
-
-		case ':':
-		case '?':
-			fprintf(stderr, "Please use '-h' for usage.\n");
-			exit(EXIT_FAILURE);
-			break;
-
-		case EOF:
-			cont = 0;
-			break;
-
-		default:
-			die("unknown option: %c", optchar);
-			break;
-		};
-	}
-
-	while (optind < argc) {
-		if (victim)
-			die("unknown option %s", argv[optind]);
-		victim = argv[optind];
-		optind++;
-	}
-
-	if (!victim)
-		die("no node name specified");
-
-	error = fence_node(victim);
-
-	logt_init("fence_node", LOG_MODE_OUTPUT_SYSLOG, SYSLOGFACILITY,
-		  SYSLOGLEVEL, 0, NULL);
-
-	if (error) {
-		fprintf(stderr, "Fence of \"%s\" was unsuccessful\n", victim);
-		logt_print(LOG_ERR, "Fence of \"%s\" was unsuccessful\n",
-			   victim);
-		rv = EXIT_FAILURE;
-	} else {
-		fprintf(stderr, "Fence of \"%s\" was successful\n", victim);
-		logt_print(LOG_NOTICE, "Fence of \"%s\" was successful\n",
-			   victim);
-		rv = EXIT_SUCCESS;
-
-		/* Tell fenced what we've done so that it can avoid fencing
-		   this node again if the fence_node() rebooted it. */
-		fenced_external(victim);
-	}
-
-	logt_exit();
-	exit(rv);
-}
-
diff --git a/fence/fence_tool/Makefile b/fence/fence_tool/Makefile
deleted file mode 100644
index 51413fc..0000000
--- a/fence/fence_tool/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-TARGET = fence_tool
-
-SBINDIRT=$(TARGET)
-
-all: depends ${TARGET}
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-OBJS=fence_tool.o
-
-CFLAGS += -D_FILE_OFFSET_BITS=64
-CFLAGS += -I${ccsincdir} -I${cmanincdir}
-CFLAGS += -I$(S)/../libfenced -I$(S)/../include
-CFLAGS += -I${incdir} 
-
-LDFLAGS += -L${ccslibdir} -L${cmanlibdir} -lccs -lcman
-LDFLAGS += -L../libfenced -lfenced
-LDFLAGS += -L${libdir}
-
-LDDEPS += ../libfenced/libfenced.a
-
-${TARGET}: ${OBJS} ${LDDEPS}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-depends:
-	$(MAKE) -C ../libfenced
-
-clean: generalclean
-
--include $(OBJS:.o=.d)
diff --git a/fence/fence_tool/fence_tool.c b/fence/fence_tool/fence_tool.c
deleted file mode 100644
index f5a857e..0000000
--- a/fence/fence_tool/fence_tool.c
+++ /dev/null
@@ -1,660 +0,0 @@
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <signal.h>
-#include <string.h>
-#include <stdint.h>
-#include <dirent.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <errno.h>
-#include <libgen.h>
-
-#include "ccs.h"
-#include "copyright.cf"
-#include "libcman.h"
-#include "libfenced.h"
-
-#define OP_JOIN  			1
-#define OP_LEAVE 			2
-#define OP_LIST				3
-#define OP_DUMP				4
-
-#define DEFAULT_WAIT_TIMEOUT		300 /* five minutes */
-
-#define MAX_NODES			128
-
-int all_nodeids[MAX_NODES];
-int all_nodeids_count;
-cman_node_t cman_nodes[MAX_NODES];
-int cman_nodes_count;
-struct fenced_node nodes[MAX_NODES];
-char *prog_name;
-int operation;
-int ls_all_nodes = 0;
-int inquorate_fail = 0;
-int wait_join = 0;			 /* default: don't wait for join */
-int wait_leave = 0;			 /* default: don't wait for leave */
-int wait_members = 0;			 /* default: don't wait for members */
-int wait_timeout = DEFAULT_WAIT_TIMEOUT;
-
-#define die(fmt, args...) \
-do { \
-	fprintf(stderr, "%s: ", prog_name); \
-	fprintf(stderr, fmt "\n", ##args); \
-	exit(EXIT_FAILURE); \
-} while (0)
-
-static int do_write(int fd, void *buf, size_t count)
-{
-	int rv, off = 0;
-
- retry:
-	rv = write(fd, buf + off, count);
-	if (rv == -1 && errno == EINTR)
-		goto retry;
-	if (rv < 0)
-		return rv;
-
-	if (rv != count) {
-		count -= rv;
-		off += rv;
-		goto retry;
-	}
-	return 0;
-}
-
-static int get_int_arg(char argopt, char *arg)
-{
-	char *tmp;
-	int val;
-
-	val = strtol(arg, &tmp, 10);
-	if (tmp == arg || tmp != arg + strlen(arg))
-		die("argument to %c (%s) is not an integer", argopt, arg);
-	
-	if (val < 0)
-		die("argument to %c cannot be negative", argopt);
-	
-	return val;
-}
-
-static int check_gfs(void)
-{
-	FILE *file;
-	char line[PATH_MAX];
-	char device[PATH_MAX];
-	char path[PATH_MAX];
-	char type[PATH_MAX];
-	int count = 0;
-
-	file = fopen("/proc/mounts", "r");
-	if (!file)
-		return 0;
-
-	while (fgets(line, PATH_MAX, file)) {
-		if (sscanf(line, "%s %s %s", device, path, type) != 3)
-			continue;
-		if (!strcmp(type, "gfs") || !strcmp(type, "gfs2")) {
-			printf("found %s file system mounted from %s on %s\n",
-				type, device, path);
-			count++;
-		}
-	}
-
-	fclose(file);
-	return count;
-}
-
-static int check_controlled_dir(char *path)
-{
-	DIR *d;
-	struct dirent *de;
-	int count = 0;
-
-	d = opendir(path);
-	if (!d)
-		return 0;
-
-	while ((de = readdir(d))) {
-		if (de->d_name[0] == '.')
-			continue;
-
-#if 0
-		if (strstr(path, "fs/gfs") && ignore_nolock(path, de->d_name))
-			continue;
-#endif
-
-		printf("found dlm lockspace %s/%s\n", path, de->d_name);
-		count++;
-	}
-
-	closedir(d);
-	return count;
-}
-
-/* Copying fenced's check_uncontrolled_entries()/check_controlled_dir()
-   in part here.
-   We could also use check_controlled_dir to detect gfs file systems intead
-   of looking at /proc/mounts... /proc/mounts gives us more info (mountpoint)
-   to report about the offending fs */
-
-static void check_controlled_systems(void)
-{
-	int count = 0;
-
-	count += check_gfs();
-	count += check_controlled_dir("/sys/kernel/dlm");
-
-	if (count)
-		die("cannot leave due to active systems");
-}
-
-static int we_are_in_fence_domain(void)
-{
-	struct fenced_node nodeinfo;
-	int rv;
-
-	memset(&nodeinfo, 0, sizeof(nodeinfo));
-
-	rv = fenced_node_info(FENCED_NODEID_US, &nodeinfo);
-	if (rv < 0)
-		return 0;
-
-	if (nodeinfo.member)
-		return 1;
-	return 0;
-}
-
-static void wait_domain(int joining)
-{
-	int in, tries = 0;
-
-	while (1) {
-		in = we_are_in_fence_domain();
-
-		if (joining && in)
-			break;
-
-		if (!joining && !in)
-			break;
-
-		if (tries++ >= wait_timeout)
-			goto fail;
-
-		if (!(tries % 5))
-			printf("Waiting for fenced to %s the fence group.\n",
-			       joining ? "join" : "leave");
-
-		sleep(1);
-	}
-
-	return;
- fail:
-	printf("Error %s the fence group.\n", joining ? "joining" : "leaving");
-}
-
-static void read_ccs_nodeids(int cd)
-{
-	char path[PATH_MAX];
-	char *nodeid_str;
-	int i, error;
-
-	memset(all_nodeids, 0, sizeof(all_nodeids));
-	all_nodeids_count = 0;
-
-	for (i = 1; ; i++) {
-		nodeid_str = NULL;
-		memset(path, 0, sizeof(path));
-		sprintf(path, "/cluster/clusternodes/clusternode[%d]/@nodeid", i);
-
-		error = ccs_get(cd, path, &nodeid_str);
-		if (error || !nodeid_str)
-			break;
-
-		all_nodeids[all_nodeids_count++] = atoi(nodeid_str);
-		free(nodeid_str);
-	}
-}
-
-static int all_nodeids_are_members(cman_handle_t ch)
-{
-	int i, j, rv, found;
-
-	memset(&cman_nodes, 0, sizeof(cman_nodes));
-	cman_nodes_count = 0;
-
-	rv = cman_get_nodes(ch, MAX_NODES, &cman_nodes_count, cman_nodes);
-	if (rv < 0) {
-		printf("cman_get_nodes error %d %d\n", rv, errno);
-		return 0;
-	}
-
-	for (i = 0; i < all_nodeids_count; i++) {
-		found = 0;
-
-		for (j = 0; j < cman_nodes_count; j++) {
-			if (cman_nodes[j].cn_nodeid == all_nodeids[i] &&
-			    cman_nodes[j].cn_member) {
-				found = 1;
-				break;
-			}
-		}
-
-		if (!found)
-			return 0;
-	}
-	return 1;
-}
-
-static void wait_cman(void)
-{
-	cman_handle_t ch;
-	int try_init = 0, try_active = 0, try_quorate = 0;
-	int try_ccs = 0, try_members = 0;
-	int rv, cd;
-
-	while (1) {
-		ch = cman_init(NULL);
-		if (ch)
-			break;
-
-		if (inquorate_fail)
-			goto fail;
-
-		if (try_init++ >= wait_timeout) {
-			printf("%s: timed out waiting for cman init\n",
-			       prog_name);
-			goto fail;
-		}
-
-		if (!(try_init % 10))
-			printf("%s: waiting for cman to start\n", prog_name);
-
-		sleep(1);
-	}
-
-	while (1) {
-		rv = cman_is_active(ch);
-		if (rv)
-			break;
-
-		if (inquorate_fail)
-			goto fail;
-
-		if (try_active++ >= wait_timeout) {
-			printf("%s: timed out waiting for cman active\n",
-			       prog_name);
-			goto fail;
-		}
-
-		if (!(try_active % 10))
-			printf("%s: waiting for cman active\n", prog_name);
-		sleep(1);
-	}
-
-	while (1) {
-		rv = cman_is_quorate(ch);
-		if (rv)
-			break;
-
-		if (inquorate_fail)
-			goto fail;
-
-		if (try_quorate++ >= wait_timeout) {
-			printf("%s: timed out waiting for cman quorum\n",
-			       prog_name);
-			goto fail;
-		}
-
-		if (!(try_quorate % 10))
-			printf("%s: waiting for cman quorum\n", prog_name);
-
-		sleep(1);
-	}
-
-	while (1) {
-		cd = ccs_connect();
-		if (cd > 0)
-			break;
-
-		if (try_ccs++ >= wait_timeout) {
-			printf("%s: timed out waiting for ccs connect\n",
-			       prog_name);
-			goto fail;
-		}
-
-		if (!(try_ccs % 10))
-			printf("%s: waiting for ccs connect\n", prog_name);
-
-		sleep(1);
-	}
-
-	if (!wait_members)
-		goto out;
-	read_ccs_nodeids(cd);
-
-	while (1) {
-		rv = all_nodeids_are_members(ch);
-		if (rv)
-			break;
-
-		if (try_members++ >= wait_members)
-			break;
-
-		if (!(try_members % 10))
-			printf("%s: waiting for all %d nodes to be members\n",
-			       prog_name, all_nodeids_count);
-		sleep(1);
-	}
-
- out:
-	ccs_disconnect(cd);
-	cman_finish(ch);
-	return;
-
- fail:
-	if (ch)
-		cman_finish(ch);
-	exit(EXIT_FAILURE);
-}
-
-static void do_join(int argc, char *argv[])
-{
-	int rv;
-
-	wait_cman();
-
-	rv = fenced_join();
-	if (rv < 0)
-		die("can't communicate with fenced");
-
-	if (wait_join)
-		wait_domain(1);
-
-	exit(EXIT_SUCCESS);
-}
-
-static void do_leave(void)
-{
-	int rv;
-
-	check_controlled_systems();
-
-	rv = fenced_leave();
-	if (rv < 0)
-		die("can't communicate with fenced");
-
-	if (wait_leave)
-		wait_domain(0);
-
-	exit(EXIT_SUCCESS);
-}
-
-static void do_dump(void)
-{
-	char buf[FENCED_DUMP_SIZE];
-	int rv;
-
-	rv = fenced_dump_debug(buf);
-	if (rv < 0)
-		die("can't communicate with fenced");
-
-	do_write(STDOUT_FILENO, buf, sizeof(buf));
-
-	exit(EXIT_SUCCESS);
-}
-
-static int node_compare(const void *va, const void *vb)
-{
-	const struct fenced_node *a = va;
-	const struct fenced_node *b = vb;
-
-	return a->nodeid - b->nodeid;
-}
-
-/* copied from fence/fenced/fd.h, should probably be in libfenced.h */
-#define CGST_WAIT_CONDITIONS	1
-#define CGST_WAIT_MESSAGES	2
-#define CGST_WAIT_FENCING	3
-
-static char *wait_str(int state)
-{
-	switch (state) {
-	case 0:
-		return "none";
-	case CGST_WAIT_CONDITIONS:
-		return "quorum";
-	case CGST_WAIT_MESSAGES:
-		return "messages";
-	case CGST_WAIT_FENCING:
-		return "fencing";
-	}
-	return "unknown";
-}
-
-/* copied from fence/fenced/fd.h, should probably be in libfenced.h */
-#define VIC_DONE_AGENT          1
-#define VIC_DONE_MEMBER         2
-#define VIC_DONE_OVERRIDE       3
-#define VIC_DONE_EXTERNAL       4
-
-static char *how_str(int how)
-{
-	switch (how) {
-	case 0:
-		return "none";
-	case VIC_DONE_AGENT:
-		return "agent";
-	case VIC_DONE_MEMBER:
-		return "member";
-	case VIC_DONE_OVERRIDE:
-		return "override";
-	case VIC_DONE_EXTERNAL:
-		return "external";
-	}
-	return "unknown";
-}
-
-static int do_list(void)
-{
-	struct fenced_domain d;
-	struct fenced_node *np;
-	int node_count;
-	int rv, i;
-
-	rv = fenced_domain_info(&d);
-	if (rv < 0)
-		exit(EXIT_SUCCESS); /* fenced probably not running */
-
-	printf("fence domain\n");
-	printf("member count  %d\n", d.member_count);
-	printf("victim count  %d\n", d.victim_count);
-	printf("victim now    %d\n", d.current_victim);
-	printf("master nodeid %d\n", d.master_nodeid);
-	printf("wait state    %s\n", wait_str(d.state));
-	printf("members       ");
-
-	node_count = 0;
-	memset(&nodes, 0, sizeof(nodes));
-
-	rv = fenced_domain_nodes(FENCED_NODES_MEMBERS, MAX_NODES,
-				 &node_count, nodes);
-	if (rv < 0) {
-		printf("error\n");
-		goto fail;
-	}
-
-	qsort(&nodes, node_count, sizeof(struct fenced_node), node_compare);
-
-	np = nodes;
-	for (i = 0; i < node_count; i++) {
-		printf("%d ", np->nodeid);
-		np++;
-	}
-	printf("\n");
-
-	if (!ls_all_nodes) {
-		printf("\n");
-		exit(EXIT_SUCCESS);
-	}
-
-	node_count = 0;
-	memset(&nodes, 0, sizeof(nodes));
-
-	rv = fenced_domain_nodes(FENCED_NODES_ALL, MAX_NODES,
-				 &node_count, nodes);
-	if (rv < 0)
-		goto fail;
-
-	qsort(&nodes, node_count, sizeof(struct fenced_node), node_compare);
-
-	printf("all nodes\n");
-
-	np = nodes;
-	for (i = 0; i < node_count; i++) {
-		printf("nodeid %d member %d victim %d last fence master %d how %s\n",
-				np->nodeid,
-				np->member,
-				np->victim,
-				np->last_fenced_master,
-				how_str(np->last_fenced_how));
-		np++;
-	}
-	printf("\n");
-	exit(EXIT_SUCCESS);
- fail:
-	fprintf(stderr, "fenced query error %d\n", rv);
-	printf("\n");
-	exit(EXIT_FAILURE);
-}
-
-static void print_usage(void)
-{
-	printf("Usage:\n");
-	printf("\n");
-	printf("%s <join|leave|dump> [options]\n", prog_name);
-	printf("\n");
-	printf("Actions:\n");
-	printf("  join             Join the default fence domain\n");
-	printf("  leave            Leave default fence domain\n");
-	printf("  ls		   List nodes status\n");
-	printf("  dump		   Dump debug buffer from fenced\n");
-	printf("\n");
-	printf("Options:\n");
-	printf("  -n               Show all node information in ls\n");
-	printf("  -m <seconds>     Delay join up to <seconds> for all nodes in cluster.conf\n");
-	printf("                   to be cluster members\n");
-	printf("  -w               Wait for join or leave to complete\n");
-	printf("  -t <seconds>     Maximum time in seconds to wait (default %d)\n", DEFAULT_WAIT_TIMEOUT);
-	printf("  -Q               Fail if cluster is not quorate, don't wait\n");
-	printf("  -V               Print program version information, then exit\n");
-	printf("  -h               Print this help, then exit\n");
-	printf("\n");
-}
-
-#define OPTION_STRING "Vht:wQm:n"
-
-static void decode_arguments(int argc, char *argv[])
-{
-	int cont = 1;
-	int optchar;
-
-	while (cont) {
-		optchar = getopt(argc, argv, OPTION_STRING);
-
-		switch (optchar) {
-
-		case 'V':
-			printf("fence_tool %s (built %s %s)\n",
-			       RELEASE_VERSION, __DATE__, __TIME__);
-			printf("%s\n", REDHAT_COPYRIGHT);
-			exit(EXIT_SUCCESS);
-			break;
-
-		case 'n':
-			ls_all_nodes = 1;
-			break;
-
-		case 'h':
-			print_usage();
-			exit(EXIT_SUCCESS);
-			break;
-
-		case 'Q':
-			inquorate_fail = 1;
-			break;
-
-		case 'w':
-			wait_join = 1;
-			wait_leave = 1;
-			break;
-
-		case 'm':
-			wait_members = atoi(optarg);
-			break;
-
-		case 't':
-			wait_timeout = get_int_arg(optchar, optarg);
-			break;
-
-		case ':':
-		case '?':
-			fprintf(stderr, "Please use '-h' for usage.\n");
-			exit(EXIT_FAILURE);
-			break;
-
-		case EOF:
-			cont = 0;
-			break;
-
-		default:
-			die("unknown option: %c\n", optchar);
-			break;
-		}
-	}
-
-	while (optind < argc) {
-		if (strcmp(argv[optind], "join") == 0) {
-			operation = OP_JOIN;
-		} else if (strcmp(argv[optind], "leave") == 0) {
-			operation = OP_LEAVE;
-		} else if (strcmp(argv[optind], "dump") == 0) {
-			operation = OP_DUMP;
-		} else if (strcmp(argv[optind], "ls") == 0) {
-			operation = OP_LIST;
-		} else
-			die("unknown option %s\n", argv[optind]);
-		optind++;
-	}
-
-	if (!operation)
-		die("no operation specified\n");
-}
-
-int main(int argc, char *argv[])
-{
-	prog_name = basename(argv[0]);
-
-	decode_arguments(argc, argv);
-
-	switch (operation) {
-	case OP_JOIN:
-		do_join(argc, argv);
-	case OP_LEAVE:
-		do_leave();
-	case OP_DUMP:
-		do_dump();
-	case OP_LIST:
-		do_list();
-	}
-
-	return EXIT_FAILURE;
-}
-
diff --git a/fence/fenced/Makefile b/fence/fenced/Makefile
deleted file mode 100644
index 9fc9307..0000000
--- a/fence/fenced/Makefile
+++ /dev/null
@@ -1,42 +0,0 @@
-TARGET = fenced
-
-SBINDIRT=$(TARGET)
-
-all: depends ${TARGET}
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-OBJS=	config.o \
-	cpg.o \
-	group.o \
-	main.o \
-	member_cman.o \
-	recover.o \
-	logging.o
-
-CFLAGS += -D_FILE_OFFSET_BITS=64
-CFLAGS += -I${ccsincdir} -I${cmanincdir} -I${logtincdir} -I${fenceincdir} -I${corosyncincdir}
-CFLAGS += -I$(S) -I$(S)/../include -I$(S)/../libfenced -I$(SRCDIR)/group/lib
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${ccslibdir} -L${cmanlibdir} -L${logtlibdir} -lccs -lcman -llogthread
-LDFLAGS += -L${fencelibdir} -lfence
-LDFLAGS += -L${corosynclibdir} -lcpg -lpthread
-LDFLAGS += -L../../group/lib -l group
-LDFLAGS += -L${libdir}
-
-LDDEPS += ../../group/lib/libgroup.a
-
-${TARGET}: ${OBJS} ${LDDEPS}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-depends:
-	$(MAKE) -C ../libfence
-
-clean: generalclean
-
--include $(OBJS:.o=.d)
diff --git a/fence/fenced/config.c b/fence/fenced/config.c
deleted file mode 100644
index e40d653..0000000
--- a/fence/fenced/config.c
+++ /dev/null
@@ -1,231 +0,0 @@
-#include "fd.h"
-#include "config.h"
-#include "ccs.h"
-
-int ccs_handle;
-
-/* was a config value set on command line?, 0 or 1. */
-
-int optd_groupd_compat;
-int optd_debug_logfile;
-int optd_clean_start;
-int optd_skip_undefined;
-int optd_post_join_delay;
-int optd_post_fail_delay;
-int optd_override_time;
-int optd_override_path;
-
-/* actual config value from command line, cluster.conf, or default. */
-
-int cfgd_groupd_compat   = DEFAULT_GROUPD_COMPAT;
-int cfgd_debug_logfile   = DEFAULT_DEBUG_LOGFILE;
-int cfgd_clean_start     = DEFAULT_CLEAN_START;
-int cfgd_skip_undefined  = DEFAULT_SKIP_UNDEFINED;
-int cfgd_post_join_delay = DEFAULT_POST_JOIN_DELAY;
-int cfgd_post_fail_delay = DEFAULT_POST_FAIL_DELAY;
-int cfgd_override_time   = DEFAULT_OVERRIDE_TIME;
-char *cfgd_override_path = DEFAULT_OVERRIDE_PATH;
-
-int setup_ccs(void)
-{
-	int cd;
-
-	cd = ccs_connect();
-	if (cd < 0) {
-		log_error("ccs_connect error %d %d", cd, errno);
-		return -1;
-	}
-	ccs_handle = cd;
-
-	return 0;
-}
-
-void close_ccs(void)
-{
-	ccs_disconnect(ccs_handle);
-}
-
-void read_ccs_name(char *path, char *name)
-{
-	char *str;
-	int error;
-
-	error = ccs_get(ccs_handle, path, &str);
-	if (error || !str)
-		return;
-
-	strcpy(name, str);
-
-	free(str);
-}
-
-void read_ccs_yesno(char *path, int *yes, int *no)
-{
-	char *str;
-	int error;
-
-	*yes = 0;
-	*no = 0;
-
-	error = ccs_get(ccs_handle, path, &str);
-	if (error || !str)
-		return;
-
-	if (!strcmp(str, "yes"))
-		*yes = 1;
-
-	else if (!strcmp(str, "no"))
-		*no = 1;
-
-	free(str);
-}
-
-void read_ccs_int(char *path, int *config_val)
-{
-	char *str;
-	int val;
-	int error;
-
-	error = ccs_get(ccs_handle, path, &str);
-	if (error || !str)
-		return;
-
-	val = atoi(str);
-
-	if (val < 0) {
-		log_error("ignore invalid value %d for %s", val, path);
-		return;
-	}
-
-	*config_val = val;
-	log_debug("%s is %u", path, val);
-	free(str);
-}
-
-#define OUR_NAME_PATH "/cluster/clusternodes/clusternode[@name=\"%s\"]/@name"
-#define GROUPD_COMPAT_PATH "/cluster/group/@groupd_compat"
-#define CLEAN_START_PATH "/cluster/fence_daemon/@clean_start"
-#define POST_JOIN_DELAY_PATH "/cluster/fence_daemon/@post_join_delay"
-#define POST_FAIL_DELAY_PATH "/cluster/fence_daemon/@post_fail_delay"
-#define OVERRIDE_PATH_PATH "/cluster/fence_daemon/@override_path"
-#define OVERRIDE_TIME_PATH "/cluster/fence_daemon/@override_time"
-#define METHOD_NAME_PATH "/cluster/clusternodes/clusternode[@name=\"%s\"]/fence/method[%d]/@name"
-
-static int count_methods(char *victim)
-{
-	char path[PATH_MAX], *name;
-	int error, i;
-
-	for (i = 0; i < 2; i++) {
-		memset(path, 0, sizeof(path));
-		sprintf(path, METHOD_NAME_PATH, victim, i+1);
-
-		error = ccs_get(ccs_handle, path, &name);
-		if (error)
-			break;
-		free(name);
-	}
-	return i;
-}
-
-/* These are the options that can be changed while running. */
-
-void reread_ccs(void)
-{
-	if (!optd_post_join_delay)
-		read_ccs_int(POST_JOIN_DELAY_PATH, &cfgd_post_join_delay);
-	if (!optd_post_fail_delay)
-		read_ccs_int(POST_FAIL_DELAY_PATH, &cfgd_post_fail_delay);
-	if (!optd_override_time)
-		read_ccs_int(OVERRIDE_TIME_PATH, &cfgd_override_time);
-}
-
-int read_ccs(struct fd *fd)
-{
-	char path[PATH_MAX];
-	char *str, *name;
-	int error, i = 0, count = 0;
-	int num_methods;
-
-	/* Our own nodename must be in cluster.conf before we're allowed to
-	   join the fence domain and then mount gfs; other nodes need this to
-	   fence us. */
-
-	str = NULL;
-	memset(path, 0, sizeof(path));
-	snprintf(path, sizeof(path), OUR_NAME_PATH, our_name);
-
-	error = ccs_get(ccs_handle, path, &str);
-	if (error || !str) {
-		log_error("local cman node name \"%s\" not found in the "
-			  "configuration", our_name);
-		return error;
-	}
-	if (str)
-		free(str);
-
-	if (!optd_groupd_compat)
-		read_ccs_int(GROUPD_COMPAT_PATH, &cfgd_groupd_compat);
-	if (!optd_clean_start)
-		read_ccs_int(CLEAN_START_PATH, &cfgd_clean_start);
-
-	reread_ccs();
-
-	if (!optd_override_path) {
-		str = NULL;
-		memset(path, 0, sizeof(path));
-		sprintf(path, OVERRIDE_PATH_PATH);
-
-		error = ccs_get(ccs_handle, path, &str);
-		if (!error && str)
-			cfgd_override_path = strdup(str);
-		if (str)
-			free(str);
-	}
-
-	if (cfgd_clean_start) {
-		log_debug("clean start, skipping initial nodes");
-		goto out;
-	}
-
-	for (i = 1; ; i++) {
-		str = NULL;
-		memset(path, 0, sizeof(path));
-		sprintf(path, "/cluster/clusternodes/clusternode[%d]/@nodeid", i);
-
-		error = ccs_get(ccs_handle, path, &str);
-		if (error || !str)
-			break;
-
-		name = NULL;
-		memset(path, 0, sizeof(path));
-		sprintf(path, "/cluster/clusternodes/clusternode[%d]/@name", i);
-
-		error = ccs_get(ccs_handle, path, &name);
-		if (error || !name) {
-			log_error("node name query failed for num %d nodeid %s",
-				  i, str);
-			break;
-		}
-
-		num_methods = count_methods(name);
-
-		/* the libcpg code only uses the fd->complete list for
-		   determining initial victims; the libgroup code uses
-		   fd->complete more extensively */
-
-		if (cfgd_skip_undefined && !num_methods)
-			log_debug("skip %s with zero methods", name);
-		else
-			add_complete_node(fd, atoi(str));
-
-		free(str);
-		free(name);
-		count++;
-	}
-
-	log_debug("added %d nodes from ccs", count);
- out:
-	return 0;
-}
-
diff --git a/fence/fenced/config.h b/fence/fenced/config.h
deleted file mode 100644
index 8152787..0000000
--- a/fence/fenced/config.h
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef __CONFIG_DOT_H__
-#define __CONFIG_DOT_H__
-
-#define DEFAULT_GROUPD_COMPAT 2
-#define DEFAULT_DEBUG_LOGFILE 0
-#define DEFAULT_CLEAN_START 0
-#define DEFAULT_SKIP_UNDEFINED 0
-#define DEFAULT_POST_JOIN_DELAY 6
-#define DEFAULT_POST_FAIL_DELAY 0
-#define DEFAULT_OVERRIDE_TIME 3
-#define DEFAULT_OVERRIDE_PATH "/var/run/cluster/fenced_override"
-
-extern int optd_groupd_compat;
-extern int optd_debug_logfile;
-extern int optd_clean_start;
-extern int optd_skip_undefined;
-extern int optd_post_join_delay;
-extern int optd_post_fail_delay;
-extern int optd_override_time;
-extern int optd_override_path;
-
-extern int cfgd_groupd_compat;
-extern int cfgd_debug_logfile;
-extern int cfgd_clean_start;
-extern int cfgd_skip_undefined;
-extern int cfgd_post_join_delay;
-extern int cfgd_post_fail_delay;
-extern int cfgd_override_time;
-extern char *cfgd_override_path;
-
-#endif
-
diff --git a/fence/fenced/cpg.c b/fence/fenced/cpg.c
deleted file mode 100644
index ead60dd..0000000
--- a/fence/fenced/cpg.c
+++ /dev/null
@@ -1,1976 +0,0 @@
-#include "fd.h"
-#include "config.h"
-
-struct protocol_version {
-	uint16_t major;
-	uint16_t minor;
-	uint16_t patch;
-	uint16_t flags;
-};
-
-struct protocol {
-	union {
-		struct protocol_version dm_ver;
-		uint16_t                daemon_max[4];
-	};
-	union {
-		struct protocol_version dr_ver;
-		uint16_t                daemon_run[4];
-	};
-};
-
-struct node_daemon {
-	struct list_head list;
-	int nodeid;
-	struct protocol proto;
-};
-
-struct member {
-	struct list_head list;
-	int nodeid;
-	int start;   /* 1 if we received a start message for this change */
-	int added;   /* 1 if added by this change */
-	int failed;  /* 1 if failed in this change */
-	int disallowed;
-	uint32_t start_flags;
-};
-
-/* fd_info and id_info: for syncing state in start message */
-
-struct fd_info {
-	uint32_t fd_info_size;
-	uint32_t id_info_size;
-	uint32_t id_info_count;
-
-	uint32_t started_count;
-
-	int member_count;
-	int joined_count;
-	int remove_count;
-	int failed_count;
-};
-
-#define IDI_NODEID_IS_MEMBER    0x00000001
-
-struct id_info {
-	int nodeid;
-	uint32_t flags;
-
-	/* the following syncs info to make queries useful from all nodes */
-
-	int fence_external_node;
-	int fence_master;
-	int fence_how;
-	uint64_t fence_time;
-	uint64_t fence_external_time;
-};
-
-static cpg_handle_t cpg_handle_daemon;
-static int daemon_cpg_fd;
-static struct protocol our_protocol;
-static struct list_head daemon_nodes;
-static struct cpg_address daemon_member[MAX_NODES];
-static int daemon_member_count;
-
-static void fd_info_in(struct fd_info *fi)
-{
-	fi->fd_info_size  = le32_to_cpu(fi->fd_info_size);
-	fi->id_info_size  = le32_to_cpu(fi->id_info_size);
-	fi->id_info_count = le32_to_cpu(fi->id_info_count);
-	fi->started_count = le32_to_cpu(fi->started_count);
-	fi->member_count  = le32_to_cpu(fi->member_count);
-	fi->joined_count  = le32_to_cpu(fi->joined_count);
-	fi->remove_count  = le32_to_cpu(fi->remove_count);
-	fi->failed_count  = le32_to_cpu(fi->failed_count);
-}
-
-static void id_info_in(struct id_info *id)
-{
-	id->nodeid              = le32_to_cpu(id->nodeid);
-	id->flags               = le32_to_cpu(id->flags);
-	id->fence_external_node = le32_to_cpu(id->fence_external_node);
-	id->fence_master        = le32_to_cpu(id->fence_master);
-	id->fence_how           = le32_to_cpu(id->fence_how);
-	id->fence_time          = le64_to_cpu(id->fence_time);
-	id->fence_external_time = le64_to_cpu(id->fence_external_time);
-}
-
-static void ids_in(struct fd_info *fi, struct id_info *ids)
-{
-	struct id_info *id;
-	int i;
-
-	id = ids;
-	for (i = 0; i < fi->id_info_count; i++) {
-		id_info_in(id);
-		id = (struct id_info *)((char *)id + fi->id_info_size);
-        }
-}
-
-static char *msg_name(int type)
-{
-	switch (type) {
-	case FD_MSG_PROTOCOL:
-		return "protocol";
-	case FD_MSG_START:
-		return "start";
-	case FD_MSG_VICTIM_DONE:
-		return "victim_done";
-	case FD_MSG_COMPLETE:
-		return "complete";
-	case FD_MSG_EXTERNAL:
-		return "external";
-	default:
-		return "unknown";
-	}
-}
-
-static int _send_message(cpg_handle_t h, void *buf, int len, int type)
-{
-	struct iovec iov;
-	cpg_error_t error;
-	int retries = 0;
-
-	iov.iov_base = buf;
-	iov.iov_len = len;
-
- retry:
-	error = cpg_mcast_joined(h, CPG_TYPE_AGREED, &iov, 1);
-	if (error == CPG_ERR_TRY_AGAIN) {
-		retries++;
-		usleep(1000);
-		if (!(retries % 100))
-			log_error("cpg_mcast_joined retry %d %s",
-				   retries, msg_name(type));
-		goto retry;
-	}
-	if (error != CPG_OK) {
-		log_error("cpg_mcast_joined error %d handle %llx %s",
-			  error, (unsigned long long)h, msg_name(type));
-		return -1;
-	}
-
-	if (retries)
-		log_debug("cpg_mcast_joined retried %d %s",
-			  retries, msg_name(type));
-
-	return 0;
-}
-
-/* header fields caller needs to set: type, to_nodeid, flags, msgdata */
-
-static void fd_send_message(struct fd *fd, char *buf, int len)
-{
-	struct fd_header *hd = (struct fd_header *) buf;
-	int type = hd->type;
-
-	hd->version[0]  = cpu_to_le16(our_protocol.daemon_run[0]);
-	hd->version[1]  = cpu_to_le16(our_protocol.daemon_run[1]);
-	hd->version[2]  = cpu_to_le16(our_protocol.daemon_run[2]);
-	hd->type	= cpu_to_le16(hd->type);
-	hd->nodeid      = cpu_to_le32(our_nodeid);
-	hd->to_nodeid   = cpu_to_le32(hd->to_nodeid);
-	hd->flags       = cpu_to_le32(hd->flags);
-	hd->msgdata     = cpu_to_le32(hd->msgdata);
-
-	_send_message(fd->cpg_handle, buf, len, type);
-}
-
-static struct member *find_memb(struct change *cg, int nodeid)
-{
-	struct member *memb;
-
-	list_for_each_entry(memb, &cg->members, list) {
-		if (memb->nodeid == nodeid)
-			return memb;
-	}
-	return NULL;
-}
-
-static struct fd *find_fd_handle(cpg_handle_t h)
-{
-	struct fd *fd;
-
-	list_for_each_entry(fd, &domains, list) {
-		if (fd->cpg_handle == h)
-			return fd;
-	}
-	return NULL;
-}
-
-static struct fd *find_fd_ci(int ci)
-{
-	struct fd *fd;
-
-	list_for_each_entry(fd, &domains, list) {
-		if (fd->cpg_client == ci)
-			return fd;
-	}
-	return NULL;
-}
-
-void free_cg(struct change *cg)
-{
-	struct member *memb, *safe;
-
-	list_for_each_entry_safe(memb, safe, &cg->members, list) {
-		list_del(&memb->list);
-		free(memb);
-	}
-	list_for_each_entry_safe(memb, safe, &cg->removed, list) {
-		list_del(&memb->list);
-		free(memb);
-	}
-	free(cg);
-}
-
-static struct node_history *get_node_history(struct fd *fd, int nodeid)
-{
-	struct node_history *node;
-
-	list_for_each_entry(node, &fd->node_history, list) {
-		if (node->nodeid == nodeid)
-			return node;
-	}
-	return NULL;
-}
-
-static void node_history_init(struct fd *fd, int nodeid)
-{
-	struct node_history *node;
-
-	node = get_node_history(fd, nodeid);
-	if (node)
-		return;
-
-	node = malloc(sizeof(struct node_history));
-	if (!node)
-		return;
-	memset(node, 0, sizeof(struct node_history));
-
-	node->nodeid = nodeid;
-	list_add_tail(&node->list, &fd->node_history);
-}
-
-static void node_history_start(struct fd *fd, int nodeid)
-{
-	struct node_history *node;
-	
-	node = get_node_history(fd, nodeid);
-	if (!node) {
-		log_error("node_history_start no nodeid %d", nodeid);
-		return;
-	}
-
-	node->add_time = time(NULL);
-}
-
-static void node_history_left(struct fd *fd, int nodeid)
-{
-	struct node_history *node;
-
-	node = get_node_history(fd, nodeid);
-	if (!node) {
-		log_error("node_history_left no nodeid %d", nodeid);
-		return;
-	}
-
-	node->left_time = time(NULL);
-}
-
-static void node_history_fail(struct fd *fd, int nodeid)
-{
-	struct node_history *node;
-
-	node = get_node_history(fd, nodeid);
-	if (!node) {
-		log_error("node_history_fail no nodeid %d", nodeid);
-		return;
-	}
-
-	node->fail_time = time(NULL);
-
-	node->check_quorum = 1;
-}
-
-/* The master node updates this info when it fences the victim, the other
-   domain members update it when they receive the status message from the
-   master. */
-
-void node_history_fence(struct fd *fd, int victim, int master, int how,
-			uint64_t mastertime)
-{
-	struct node_history *node;
-
-	node = get_node_history(fd, victim);
-	if (!node) {
-		log_error("node_history_fence no nodeid %d", victim);
-		return;
-	}
-
-	node->fence_master = master;
-	node->fence_time = mastertime;
-	node->fence_how = how;
-}
-
-/* When the fence_node command is run on a machine, it will first call
-   libfence:fence_node(victim) to do the fencing.  Afterward, it should call
-   libfenced:fence_external(victim) to tell fenced what it's done, so fenced
-   can avoid fencing the node a second time.  This will result in a message
-   being sent to all domain members which will update their node_history entry
-   for the victim.  The recover.c:fence_victims() code can check whether
-   a victim has been externally fenced since the last add_time, and if so
-   skip the fencing.  This won't always work perfectly; a node might in some
-   circumstances be fenced a second time by fenced. */
-
-static void node_history_fence_external(struct fd *fd, int nodeid, int from)
-{
-	struct node_history *node;
-
-	node = get_node_history(fd, nodeid);
-	if (!node) {
-		log_error("node_history_fence_external no nodeid %d", nodeid);
-		return;
-	}
-
-	node->fence_external_time = time(NULL);
-	node->fence_external_node = from;
-}
-
-static void save_history(struct fd *fd, struct fd_info *fi, struct id_info *ids)
-{
-	struct node_history *node;
-	struct id_info *id;
-	int i;
-
-	id = ids;
-
-	for (i = 0; i < fi->id_info_count; i++) {
-		/* create history entries for nodes that were domain members
-		   prior to our joining the domain */
-		node_history_init(fd, id->nodeid);
-
-		node = get_node_history(fd, id->nodeid);
-		if (!node) {
-			log_error("save_history no nodeid %d", id->nodeid);
-			goto next;
-		}
-
-		if (!node->fence_time && id->fence_time) {
-			node->fence_master = id->fence_master;
-			node->fence_time = id->fence_time;
-			node->fence_how = id->fence_how;
-			log_debug("save_history %d master %d time %llu how %d",
-				  node->nodeid, node->fence_master,
-				  (unsigned long long)node->fence_time,
-				  node->fence_how);
-		}
-
-		if (!node->fence_external_time && id->fence_external_time) {
-			node->fence_external_time = id->fence_external_time;
-			node->fence_external_node = id->fence_external_node;
-			log_debug("save_history %d ext node %d ext time %llu",
-				  node->nodeid, node->fence_external_node,
-				  (unsigned long long)node->fence_external_time);
-		}
- next:
-		id = (struct id_info *)((char *)id + fi->id_info_size);
-	}
-}
-
-/* call this from libfenced:fenced_external() */
-
-void send_external(struct fd *fd, int victim)
-{
-	struct fd_header *hd;
-	char *buf;
-	int len;
-
-	len = sizeof(struct fd_header);
-
-	buf = malloc(len);
-	if (!buf) {
-		log_error("send_external no mem len %d", len);
-		return;
-	}
-	memset(buf, 0, len);
-
-	hd = (struct fd_header *)buf;
-	hd->type = FD_MSG_EXTERNAL;
-	hd->msgdata = victim;
-
-	log_debug("send_external victim nodeid %u", victim);
-
-	fd_send_message(fd, buf, len);
-
-	free(buf);
-}
-
-/* now, if the victim dies and the fence domain sees it fail,
-   it will be added as an fd victim, but fence_victims() will
-   call is_fenced_external() which will see that it's already
-   fenced and bypass fencing it again */
-
-static void receive_external(struct fd *fd, struct fd_header *hd, int len)
-{
-	log_debug("receive_external from %d len %d victim nodeid %d",
-		  hd->nodeid, len, hd->msgdata);
-
-	node_history_fence_external(fd, hd->msgdata, hd->nodeid);
-}
-
-int is_fenced_external(struct fd *fd, int nodeid)
-{
-	struct node_history *node;
-
-	node = get_node_history(fd, nodeid);
-	if (!node) {
-		log_error("is_fenced_external no nodeid %d", nodeid);
-		return 0;
-	}
-
-	if (node->fence_external_time > node->add_time)
-		return 1;
-	return 0;
-}
-
-/* completed victim must be removed from victims list before calling this
-   because we count the number of entries on the victims list for remaining */
-
-void send_victim_done(struct fd *fd, int victim)
-{
-	struct change *cg = list_first_entry(&fd->changes, struct change, list);
-	struct fd_header *hd;
-	struct id_info *id;
-	struct node_history *node;
-	char *buf;
-	int len;
-
-	len = sizeof(struct fd_header) + sizeof(struct id_info);
-
-	buf = malloc(len);
-	if (!buf) {
-		log_error("send_victim_done no mem len %d", len);
-		return;
-	}
-	memset(buf, 0, len);
-
-	hd = (struct fd_header *)buf;
-	hd->type = FD_MSG_VICTIM_DONE;
-	hd->msgdata = cg->seq;
-
-	if (fd->init_complete)
-		hd->flags |= FD_MFLG_COMPLETE;
-
-	node = get_node_history(fd, victim);
-	if (!node) {
-		log_error("send_victim_done no nodeid %d", victim);
-		return;
-	}
-
-	id = (struct id_info *)(buf + sizeof(struct fd_header));
-	id->nodeid       = cpu_to_le32(victim);
-	id->fence_master = cpu_to_le32(our_nodeid);
-	id->fence_time   = cpu_to_le64(node->fence_time);
-	id->fence_how    = cpu_to_le32(node->fence_how);
-
-	log_debug("send_victim_done cg %u flags %x victim nodeid %d",
-		  cg->seq, hd->flags, victim);
-
-	fd_send_message(fd, buf, len);
-
-	free(buf);
-}
-
-static void receive_victim_done(struct fd *fd, struct fd_header *hd, int len)
-{
-	struct node *node;
-	uint32_t seq = hd->msgdata;
-	int found;
-	struct id_info *id;
-
-	log_debug("receive_victim_done %d:%u flags %x len %d", hd->nodeid, seq,
-		  hd->flags, len);
-
-	/* check that hd->nodeids is fd->master ? */
-
-	/* I don't think there's any problem with the master removing the
-	   victim when it's done instead of waiting to remove it when it
-	   receives its own victim_done message, like the other nodes do */
-
-	if (hd->nodeid == our_nodeid)
-		return;
-
-	id = (struct id_info *)((char *)hd + sizeof(struct fd_header));
-	id_info_in(id);
-
-	found = 0;
-	list_for_each_entry(node, &fd->victims, list) {
-		if (node->nodeid == id->nodeid) {
-			log_debug("receive_victim_done remove nodeid %d how %d",
-				  id->nodeid, id->fence_how);
-			node_history_fence(fd, id->nodeid, id->fence_master,
-					   id->fence_how, id->fence_time);
-			list_del(&node->list);
-			free(node);
-			found = 1;
-			break;
-		}
-	}
-
-	if (!found)
-		log_debug("receive_victim_done no nodeid %d from %d",
-			  id->nodeid, hd->nodeid);
-}
-
-static int check_quorum_done(struct fd *fd)
-{
-	struct node_history *node;
-	int wait_count = 0;
-
-	/* We don't want to trust the cman_quorate value until we know
-	   that cman has seen the same nodes fail that we have.  So, we
-	   first make sure that all nodes we've seen fail are also
-	   failed in cman, then we can just check cman_quorate.  This
-	   assumes that we'll get to this function to do all the checks
-	   before any of the failed nodes can actually rejoin and become
-	   cman members again (if that assumption doesn't hold, perhaps
-	   do something with timestamps of join/fail). */
-
-	list_for_each_entry(node, &fd->node_history, list) {
-		if (!node->check_quorum)
-			continue;
-
-		if (!is_cman_member(node->nodeid)) {
-			node->check_quorum = 0;
-		} else {
-			log_debug("check_quorum %d is_cman_member",
-				  node->nodeid);
-			wait_count++;
-		}
-	}
-
-	if (wait_count)
-		return 0;
-
-	if (!cman_quorate) {
-		log_debug("check_quorum not quorate");
-		return 0;
-	}
-
-	log_debug("check_quorum done");
-	return 1;
-}
-
-static int wait_conditions_done(struct fd *fd)
-{
-	if (!check_quorum_done(fd))
-		return 0;
-	return 1;
-}
-
-static int wait_messages_done(struct fd *fd)
-{
-	struct change *cg = list_first_entry(&fd->changes, struct change, list);
-	struct member *memb;
-	int need = 0, total = 0;
-
-	list_for_each_entry(memb, &cg->members, list) {
-		if (!memb->start)
-			need++;
-		total++;
-	}
-
-	if (need) {
-		log_debug("wait_messages cg %u need %d of %d",
-			  cg->seq, need, total);
-		return 0;
-	}
-
-	log_debug("wait_messages cg %u got all %d", cg->seq, total);
-	return 1;
-}
-
-static void cleanup_changes(struct fd *fd)
-{
-	struct change *cg = list_first_entry(&fd->changes, struct change, list);
-	struct change *safe;
-
-	list_del(&cg->list);
-	if (fd->started_change)
-		free_cg(fd->started_change);
-	fd->started_change = cg;
-
-	/* zero started_count means "never started" */
-
-	fd->started_count++;
-	if (!fd->started_count)
-		fd->started_count++;
-
-	list_for_each_entry_safe(cg, safe, &fd->changes, list) {
-		list_del(&cg->list);
-		free_cg(cg);
-	}
-}
-
-static void set_master(struct fd *fd)
-{
-	struct change *cg = list_first_entry(&fd->changes, struct change, list);
-	struct member *memb;
-	int low = 0, complete = 0;
-
-	list_for_each_entry(memb, &cg->members, list) {
-		if (!low || memb->nodeid < low)
-			low = memb->nodeid;
-
-		if (!(memb->start_flags & FD_MFLG_COMPLETE))
-			continue;
-
-		if (!complete || memb->nodeid < complete)
-			complete = memb->nodeid;
-	}
-
-	log_debug("set_master from %d to %s node %d", fd->master,
-		  complete ? "complete" : "low",
-		  complete ? complete : low);
-
-	fd->master = complete ? complete : low;
-}
-
-static struct id_info *get_id_struct(struct id_info *ids, int count, int size,
-                                     int nodeid)
-{
-	struct id_info *id = ids;
-	int i;
-
-	for (i = 0; i < count; i++) {
-		if (id->nodeid == nodeid)
-			return id;
-		id = (struct id_info *)((char *)id + size);
-	}
-	return NULL;
-}
-
-/* do the change details in the message match the details of the given change */
-
-static int match_change(struct fd *fd, struct change *cg, struct fd_header *hd,
-			struct fd_info *fi, struct id_info *ids)
-{
-	struct id_info *id;
-	struct member *memb;
-	uint32_t seq = hd->msgdata;
-	int i, members_mismatch;
-
-	/* We can ignore messages if we're not in the list of members.
-	   The one known time this will happen is after we've joined
-	   the cpg, we can get messages for changes prior to the change
-	   in which we're added. */
-
-	id = get_id_struct(ids, fi->id_info_count, fi->id_info_size,our_nodeid);
-
-	if (!id || !(id->flags & IDI_NODEID_IS_MEMBER)) {
-		log_debug("match_change %d:%u skip cg %u we are not in members",
-			  hd->nodeid, seq, cg->seq);
-		return 0;
-	}
-
-	memb = find_memb(cg, hd->nodeid);
-	if (!memb) {
-		log_debug("match_change %d:%u skip cg %u sender not member",
-			  hd->nodeid, seq, cg->seq);
-		return 0;
-	}
-
-	/* verify this is the right change by matching the counts
-	   and the nodeids of the current members */
-
-	if (fi->member_count != cg->member_count ||
-	    fi->joined_count != cg->joined_count ||
-	    fi->remove_count != cg->remove_count ||
-	    fi->failed_count != cg->failed_count) {
-		log_debug("match_change %d:%u skip cg %u expect counts "
-			  "%d %d %d %d", hd->nodeid, seq, cg->seq,
-			  cg->member_count, cg->joined_count,
-			  cg->remove_count, cg->failed_count);
-		return 0;
-	}
-
-	members_mismatch = 0;
-	id = ids;
-
-	for (i = 0; i < fi->id_info_count; i++) {
-		if (id->flags & IDI_NODEID_IS_MEMBER) {
-			memb = find_memb(cg, id->nodeid);
-			if (!memb) {
-				log_debug("match_change %d:%u skip cg %u "
-					  "no memb %d", hd->nodeid, seq,
-					  cg->seq, id->nodeid);
-				members_mismatch = 1;
-				break;
-			}
-		}
-		id = (struct id_info *)((char *)id + fi->id_info_size);
-	}
-
-	if (members_mismatch)
-		return 0;
-
-	log_debug("match_change %d:%u matches cg %u", hd->nodeid, seq, cg->seq);
-	return 1;
-}
-
-/* Unfortunately, there's no really simple way to match a message with the
-   specific change that it was sent for.  We hope that by passing all the
-   details of the change in the message, we will be able to uniquely match the
-   it to the correct change. */
-
-/* A start message will usually be for the first (current) change on our list.
-   In some cases it will be for a non-current change, and we can ignore it:
-
-   1. A,B,C get confchg1 adding C
-   2. C sends start for confchg1
-   3. A,B,C get confchg2 adding D
-   4. A,B,C,D recv start from C for confchg1 - ignored
-   5. C,D send start for confchg2
-   6. A,B send start for confchg2
-   7. A,B,C,D recv all start messages for confchg2, and start kernel
- 
-   In step 4, how do the nodes know whether the start message from C is
-   for confchg1 or confchg2?  Hopefully by comparing the counts and members. */
-
-static struct change *find_change(struct fd *fd, struct fd_header *hd,
-				  struct fd_info *fi, struct id_info *ids)
-{
-	struct change *cg;
-
-	list_for_each_entry_reverse(cg, &fd->changes, list) {
-		if (!match_change(fd, cg, hd, fi, ids))
-			continue;
-		return cg;
-	}
-
-	log_debug("find_change %d:%u no match", hd->nodeid, hd->msgdata);
-	return NULL;
-}
-
-static int is_added(struct fd *fd, int nodeid)
-{
-	struct change *cg;
-	struct member *memb;
-
-	list_for_each_entry(cg, &fd->changes, list) {
-		memb = find_memb(cg, nodeid);
-		if (memb && memb->added)
-			return 1;
-	}
-	return 0;
-}
-
-static void receive_start(struct fd *fd, struct fd_header *hd, int len)
-{
-	struct change *cg;
-	struct member *memb;
-	struct fd_info *fi;
-	struct id_info *ids;
-	uint32_t seq = hd->msgdata;
-	int added;
-
-	log_debug("receive_start %d:%u len %d", hd->nodeid, seq, len);
-
-	fi = (struct fd_info *)((char *)hd + sizeof(struct fd_header));
-	ids = (struct id_info *)((char *)fi + sizeof(struct fd_info));
-
-	fd_info_in(fi);
-	ids_in(fi, ids);
-
-	cg = find_change(fd, hd, fi, ids);
-	if (!cg)
-		return;
-
-	memb = find_memb(cg, hd->nodeid);
-	if (!memb) {
-		/* this should never happen since match_change checks it */
-		log_error("receive_start no member %d", hd->nodeid);
-		return;
-	}
-
-	memb->start_flags = hd->flags;
-
-	added = is_added(fd, hd->nodeid);
-
-	if (added && fi->started_count) {
-		log_error("receive_start %d:%u add node with started_count %u",
-			  hd->nodeid, seq, fi->started_count);
-
-		/* This is how we deal with cpg's that are partitioned and
-		   then merge back together.  When the merge happens, the
-		   cpg on each side will see nodes from the other side being
-		   added, and neither side will have zero started_count.  So,
-		   both sides will ignore start messages from the other side.
-		   This causes the the domain on each side to continue waiting
-		   for the missing start messages indefinately.  To unblock
-		   things, all nodes from one side of the former partition
-		   need to fail. */
-
-		/* This method of detecting a merge of a partitioned cpg
-		   assumes a joining node won't ever see an existing node
-		   as "added" under normal circumstances. */
-
-		memb->disallowed = 1;
-		return;
-	}
-
-	node_history_start(fd, hd->nodeid);
-	memb->start = 1;
-
-	/* save any fencing history from this message that we don't have */
-	save_history(fd, fi, ids);
-}
-
-static void receive_complete(struct fd *fd, struct fd_header *hd, int len)
-{
-	struct fd_info *fi;
-	struct id_info *ids, *id;
-	uint32_t seq = hd->msgdata;
-	struct node *node, *safe;
-
-	log_debug("receive_complete %d:%u len %d", hd->nodeid, seq, len);
-
-	if (fd->init_complete)
-		return;
-
-	fi = (struct fd_info *)((char *)hd + sizeof(struct fd_header));
-	ids = (struct id_info *)((char *)fi + sizeof(struct fd_info));
-
-	fd_info_in(fi);
-	ids_in(fi, ids);
-
-	id = get_id_struct(ids, fi->id_info_count, fi->id_info_size,our_nodeid);
-
-	if (!id || !(id->flags & IDI_NODEID_IS_MEMBER)) {
-		log_debug("receive_complete %d:%u we are not in members",
-			  hd->nodeid, seq);
-		return;
-	}
-
-	fd->init_complete = 1;
-
-	/* we may have victims from init which we can clear now */
-	list_for_each_entry_safe(node, safe, &fd->victims, list) {
-		log_debug("receive_complete clear victim nodeid %d init %d",
-			  node->nodeid, node->init_victim);
-		list_del(&node->list);
-		free(node);
-	}
-}
-
-static int count_ids(struct fd *fd)
-{
-	struct node_history *node;
-	int count = 0;
-
-	list_for_each_entry(node, &fd->node_history, list)
-		count++;
-
-	return count;
-}
-
-static void send_info(struct fd *fd, int type)
-{
-	struct change *cg;
-	struct fd_header *hd;
-	struct fd_info *fi;
-	struct id_info *id;
-	struct node_history *node;
-	char *buf;
-	uint32_t flags;
-	int len, id_count;
-
-	cg = list_first_entry(&fd->changes, struct change, list);
-
-	id_count = count_ids(fd);
-
-	len = sizeof(struct fd_header) + sizeof(struct fd_info) +
-	      id_count * sizeof(struct id_info);
-
-	buf = malloc(len);
-	if (!buf) {
-		log_error("send_info len %d no mem", len);
-		return;
-	}
-	memset(buf, 0, len);
-
-	hd = (struct fd_header *)buf;
-	fi = (struct fd_info *)(buf + sizeof(*hd));
-	id = (struct id_info *)(buf + sizeof(*hd) + sizeof(*fi));
-
-	/* fill in header (fd_send_message handles part of header) */
-
-	hd->type = type;
-	hd->msgdata = cg->seq;
-	if (cg->we_joined)
-		hd->flags |= FD_MFLG_JOINING;
-	if (fd->init_complete)
-		hd->flags |= FD_MFLG_COMPLETE;
-
-	/* fill in fd_info */
-
-	fi->fd_info_size  = cpu_to_le32(sizeof(struct fd_info));
-	fi->id_info_size  = cpu_to_le32(sizeof(struct id_info));
-	fi->id_info_count = cpu_to_le32(id_count);
-	fi->started_count = cpu_to_le32(fd->started_count);
-	fi->member_count  = cpu_to_le32(cg->member_count);
-	fi->joined_count  = cpu_to_le32(cg->joined_count);
-	fi->remove_count  = cpu_to_le32(cg->remove_count);
-	fi->failed_count  = cpu_to_le32(cg->failed_count);
-
-	/* fill in id_info entries */
-
-	list_for_each_entry(node, &fd->node_history, list) {
-		flags = 0;
-		if (find_memb(cg, node->nodeid))
-			flags = IDI_NODEID_IS_MEMBER;
-
-		id->flags              = cpu_to_le32(flags);
-		id->nodeid             = cpu_to_le32(node->nodeid);
-		id->fence_external_node= cpu_to_le32(node->fence_external_node);
-		id->fence_master       = cpu_to_le32(node->fence_master);
-		id->fence_how          = cpu_to_le32(node->fence_how);
-		id->fence_time         = cpu_to_le64(node->fence_time);
-		id->fence_external_time= cpu_to_le64(node->fence_external_time);
-		id++;
-	}
-
-	log_debug("send_%s cg %u flags %x counts %u %d %d %d %d",
-		  type == FD_MSG_START ? "start" : "complete",
-		  cg->seq, hd->flags, fd->started_count, cg->member_count,
-		  cg->joined_count, cg->remove_count, cg->failed_count);
-
-	fd_send_message(fd, buf, len);
-
-	free(buf);
-}
-
-static void send_start(struct fd *fd)
-{
-	send_info(fd, FD_MSG_START);
-}
-
-/* same content as a start message, a new (incomplete) node will look for
-   a complete message that shows it as a member, when it sees one it can
-   clear any init_victims and set init_complete for future cycles */
-
-static void send_complete(struct fd *fd)
-{
-	send_info(fd, FD_MSG_COMPLETE);
-}
-
-/* FIXME: better to just look in victims list for any nodes with init_victim? */
-
-static int nodes_added(struct fd *fd)
-{
-	struct change *cg;
-
-	list_for_each_entry(cg, &fd->changes, list) {
-		if (cg->joined_count)
-			return 1;
-	}
-	return 0;
-}
-
-/* If we're being added by the current change, we'll have an empty victims
-   list, while other previous members may already have nodes in their
-   victims list.  So, we need to assume that any node in cluster.conf that's
-   not a cluster member when we're added to the fd is already a victim.
-   We can go back on that assumption, and clear out any presumed victims, when
-   we see a message from a previous member saying that are no current victims. */
-
-static void add_victims(struct fd *fd, struct change *cg)
-{
-	struct member *memb;
-	struct node *node;
-
-	list_for_each_entry(memb, &cg->removed, list) {
-		if (!memb->failed)
-			continue;
-		if (is_victim(fd, memb->nodeid)) {
-			/* Only one scenario I know of where this happens:
-			   when a partitioned cpg merges and then the
-			   disallowed node is killed.  The original
-			   partition makes the node a victim, and killing
-			   it after a merge will find it already a victim. */
-			log_debug("add_victims nodeid %d already victim",
-				  memb->nodeid);
-			continue;
-		}
-		node = get_new_node(fd, memb->nodeid);
-		if (!node)
-			return;
-		list_add(&node->list, &fd->victims);
-		log_debug("add nodeid %d to victims", node->nodeid);
-	}
-}
-
-/* with start messages from all members, we can pick which one should be master
-   and do the fencing (low nodeid with state, "COMPLETE").  as the master
-   successfully fences each victim, it sends a status message such that all
-   members remove the node from their victims list.
-
-   after all victims have been dealt following a change (or set of changes),
-   the master sends a complete message that indicates the members of the group
-   for the change it has completed processing.  when a joining node sees this
-   complete message and sees itself as a member, it knows it can clear all
-   init_victims from startup init, and it sets init_complete so it will
-   volunteer to be master in the next round by setting COMPLETE flag.
-
-   once the master begins fencing victims, it won't process any new changes
-   until it's done.  the non-master members will process changes while the
-   master is fencing, but will wait for the master to catch up in
-   WAIT_MESSAGES.  if the master fails, the others will no longer wait for it.*/
-
-static void apply_changes(struct fd *fd)
-{
-	struct change *cg;
-
-	if (list_empty(&fd->changes))
-		return;
-	cg = list_first_entry(&fd->changes, struct change, list);
-
-	switch (cg->state) {
-
-	case CGST_WAIT_CONDITIONS:
-		if (wait_conditions_done(fd)) {
-			send_start(fd);
-			cg->state = CGST_WAIT_MESSAGES;
-		}
-		break;
-
-	case CGST_WAIT_MESSAGES:
-		if (wait_messages_done(fd)) {
-			set_master(fd);
-			cg->state = CGST_WAIT_FENCING;  /* for queries */
-
-			if (fd->master == our_nodeid) {
-				delay_fencing(fd, nodes_added(fd));
-				fence_victims(fd);
-				send_complete(fd);
-			} else {
-				defer_fencing(fd);
-			}
-
-			cleanup_changes(fd);
-			fd->joining_group = 0;
-		}
-		break;
-
-	default:
-		log_error("apply_changes invalid state %d", cg->state);
-	}
-}
-
-void process_fd_changes(void)
-{
-	struct fd *fd, *safe;
-
-	list_for_each_entry_safe(fd, safe, &domains, list) {
-		if (!list_empty(&fd->changes))
-			apply_changes(fd);
-	}
-}
-
-static int add_change(struct fd *fd,
-		      struct cpg_address *member_list, int member_list_entries,
-		      struct cpg_address *left_list, int left_list_entries,
-		      struct cpg_address *joined_list, int joined_list_entries,
-		      struct change **cg_out)
-{
-	struct change *cg;
-	struct member *memb;
-	int i, error;
-
-	cg = malloc(sizeof(struct change));
-	if (!cg)
-		goto fail_nomem;
-	memset(cg, 0, sizeof(struct change));
-	INIT_LIST_HEAD(&cg->members);
-	INIT_LIST_HEAD(&cg->removed);
-	cg->seq = ++fd->change_seq;
-	cg->state = CGST_WAIT_CONDITIONS;
-
-	cg->member_count = member_list_entries;
-	cg->joined_count = joined_list_entries;
-	cg->remove_count = left_list_entries;
-
-	for (i = 0; i < member_list_entries; i++) {
-		memb = malloc(sizeof(struct member));
-		if (!memb)
-			goto fail_nomem;
-		memset(memb, 0, sizeof(struct member));
-		memb->nodeid = member_list[i].nodeid;
-		list_add_tail(&memb->list, &cg->members);
-	}
-
-	for (i = 0; i < left_list_entries; i++) {
-		memb = malloc(sizeof(struct member));
-		if (!memb)
-			goto fail_nomem;
-		memset(memb, 0, sizeof(struct member));
-		memb->nodeid = left_list[i].nodeid;
-		if (left_list[i].reason == CPG_REASON_NODEDOWN ||
-		    left_list[i].reason == CPG_REASON_PROCDOWN) {
-			memb->failed = 1;
-			cg->failed_count++;
-		}
-		list_add_tail(&memb->list, &cg->removed);
-
-		if (memb->failed)
-			node_history_fail(fd, memb->nodeid);
-		else
-			node_history_left(fd, memb->nodeid);
-
-		log_debug("add_change cg %u remove nodeid %d reason %d",
-			  cg->seq, memb->nodeid, left_list[i].reason);
-
-		if (left_list[i].reason == CPG_REASON_PROCDOWN)
-			kick_node_from_cluster(memb->nodeid);
-	}
-
-	for (i = 0; i < joined_list_entries; i++) {
-		memb = find_memb(cg, joined_list[i].nodeid);
-		if (!memb) {
-			log_error("no member %d", joined_list[i].nodeid);
-			error = -ENOENT;
-			goto fail;
-		}
-		memb->added = 1;
-
-		if (memb->nodeid == our_nodeid)
-			cg->we_joined = 1;
-		else
-			node_history_init(fd, memb->nodeid);
-
-		log_debug("add_change cg %u joined nodeid %d", cg->seq,
-			  memb->nodeid);
-	}
-
-	if (cg->we_joined)
-		list_for_each_entry(memb, &cg->members, list)
-			node_history_init(fd, memb->nodeid);
-
-	log_debug("add_change cg %u counts member %d joined %d remove %d "
-		  "failed %d", cg->seq, cg->member_count, cg->joined_count,
-		  cg->remove_count, cg->failed_count);
-
-	list_add(&cg->list, &fd->changes);
-	*cg_out = cg;
-	return 0;
-
- fail_nomem:
-	log_error("no memory");
-	error = -ENOMEM;
- fail:
-	free_cg(cg);
-	return error;
-}
-
-/* add a victim for each node in complete list (represents all nodes in
-   cluster.conf) that is not a cman member (and not already a victim) */
-
-static void add_victims_init(struct fd *fd, struct change *cg)
-{
-	struct node *node, *safe;
-
-	list_for_each_entry_safe(node, safe, &fd->complete, list) {
-		list_del(&node->list);
-
-		if (!is_cman_member(node->nodeid) &&
-		    !find_memb(cg, node->nodeid) &&
-		    !is_victim(fd, node->nodeid)) {
-			node->init_victim = 1;
-			list_add(&node->list, &fd->victims);
-			log_debug("add_victims_init nodeid %d", node->nodeid);
-		} else {
-			free(node);
-		}
-	}
-}
-
-static int we_left(struct cpg_address *left_list, int left_list_entries)
-{
-	int i;
-
-	for (i = 0; i < left_list_entries; i++) {
-		if (left_list[i].nodeid == our_nodeid)
-			return 1;
-	}
-	return 0;
-}
-
-static void confchg_cb(cpg_handle_t handle, struct cpg_name *group_name,
-		       struct cpg_address *member_list, int member_list_entries,
-		       struct cpg_address *left_list, int left_list_entries,
-		       struct cpg_address *joined_list, int joined_list_entries)
-{
-	struct fd *fd;
-	struct change *cg;
-	int rv;
-
-	fd = find_fd_handle(handle);
-	if (!fd) {
-		log_error("confchg_cb no fence domain for cpg %s",
-			  group_name->value);
-		return;
-	}
-
-	if (fd->leaving_group && we_left(left_list, left_list_entries)) {
-		/* we called cpg_leave(), and this should be the final
-		   cpg callback we receive */
-		log_debug("confchg for our leave");
-		cpg_finalize(fd->cpg_handle);
-		client_dead(fd->cpg_client);
-		list_del(&fd->list);
-		free_fd(fd);
-		return;
-	}
-
-	rv = add_change(fd, member_list, member_list_entries,
-			left_list, left_list_entries,
-			joined_list, joined_list_entries, &cg);
-	if (rv)
-		return;
-
-	/* failed nodes in this change become victims */
-
-	add_victims(fd, cg);
-
-	/* As a joining domain member with no previous state, we need to
-	   assume non-member nodes are already victims; these initial victims
-	   are cleared if we get a "complete" message from the master.
-	   But, if we're the master, we do end up fencing these init nodes. */
-
-	if (cg->we_joined)
-		add_victims_init(fd, cg);
-
-	apply_changes(fd);
-}
-
-static void fd_header_in(struct fd_header *hd)
-{
-	hd->version[0]  = le16_to_cpu(hd->version[0]);
-	hd->version[1]  = le16_to_cpu(hd->version[1]);
-	hd->version[2]  = le16_to_cpu(hd->version[2]);
-	hd->type        = le16_to_cpu(hd->type);
-	hd->nodeid      = le32_to_cpu(hd->nodeid);
-	hd->to_nodeid   = le32_to_cpu(hd->to_nodeid);
-	hd->global_id   = le32_to_cpu(hd->global_id);
-	hd->flags       = le32_to_cpu(hd->flags);
-	hd->msgdata     = le32_to_cpu(hd->msgdata);
-}
-
-static void deliver_cb(cpg_handle_t handle, struct cpg_name *group_name,
-		       uint32_t nodeid, uint32_t pid, void *data, int len)
-{
-	struct fd *fd;
-	struct fd_header *hd;
-
-	fd = find_fd_handle(handle);
-	if (!fd) {
-		log_error("deliver_cb no fd for cpg %s", group_name->value);
-		return;
-	}
-
-	if (len < sizeof(*hd)) {
-		log_error("deliver_cb short message %d", len);
-		return;
-	}
-
-	hd = (struct fd_header *)data;
-	fd_header_in(hd);
-
-	if (hd->version[0] != our_protocol.daemon_run[0] ||
-	    hd->version[1] != our_protocol.daemon_run[1]) {
-		log_error("reject message from %d version %u.%u.%u vs %u.%u.%u",
-			  nodeid, hd->version[0], hd->version[1],
-			  hd->version[2], our_protocol.daemon_run[0],
-			  our_protocol.daemon_run[1],
-			  our_protocol.daemon_run[2]);
-		return;
-	}
-
-	if (hd->nodeid != nodeid) {
-		log_error("bad msg nodeid %d %d", hd->nodeid, nodeid);
-		return;
-	}
-
-	switch (hd->type) {
-	case FD_MSG_START:
-		receive_start(fd, hd, len);
-		break;
-	case FD_MSG_VICTIM_DONE:
-		receive_victim_done(fd, hd, len);
-		break;
-	case FD_MSG_COMPLETE:
-		receive_complete(fd, hd, len);
-		break;
-	case FD_MSG_EXTERNAL:
-		receive_external(fd, hd, len);
-		break;
-	default:
-		log_error("unknown msg type %d", hd->type);
-	}
-
-	apply_changes(fd);
-}
-
-static cpg_callbacks_t cpg_callbacks = {
-	.cpg_deliver_fn = deliver_cb,
-	.cpg_confchg_fn = confchg_cb,
-};
-
-static void process_fd_cpg(int ci)
-{
-	struct fd *fd;
-	cpg_error_t error;
-
-	fd = find_fd_ci(ci);
-	if (!fd) {
-		log_error("process_fd_cpg no fence domain for ci %d", ci);
-		return;
-	}
-
-	error = cpg_dispatch(fd->cpg_handle, CPG_DISPATCH_ALL);
-	if (error != CPG_OK) {
-		log_error("cpg_dispatch error %d", error);
-		return;
-	}
-}
-
-int fd_join(struct fd *fd)
-{
-	cpg_error_t error;
-	cpg_handle_t h;
-	struct cpg_name name;
-	int i = 0, f, ci;
-
-	error = cpg_initialize(&h, &cpg_callbacks);
-	if (error != CPG_OK) {
-		log_error("cpg_initialize error %d", error);
-		goto fail_free;
-	}
-
-	cpg_fd_get(h, &f);
-
-	ci = client_add(f, process_fd_cpg, NULL);
-
-	list_add(&fd->list, &domains);
-	fd->cpg_handle = h;
-	fd->cpg_client = ci;
-	fd->cpg_fd = f;
-	fd->joining_group = 1;
-
-	memset(&name, 0, sizeof(name));
-	sprintf(name.value, "fenced:%s", fd->name);
-	name.length = strlen(name.value) + 1;
-
- retry:
-	error = cpg_join(h, &name);
-	if (error == CPG_ERR_TRY_AGAIN) {
-		sleep(1);
-		if (!(++i % 10))
-			log_error("cpg_join error retrying");
-		goto retry;
-	}
-	if (error != CPG_OK) {
-		log_error("cpg_join error %d", error);
-		goto fail;
-	}
-
-	return 0;
-
- fail:
-	list_del(&fd->list);
-	client_dead(ci);
-	cpg_finalize(h);
- fail_free:
-	free(fd);
-	return error;
-}
-
-int fd_leave(struct fd *fd)
-{
-	cpg_error_t error;
-	struct cpg_name name;
-	int i = 0;
-
-	fd->leaving_group = 1;
-
-	memset(&name, 0, sizeof(name));
-	sprintf(name.value, "fenced:%s", fd->name);
-	name.length = strlen(name.value) + 1;
-
- retry:
-	error = cpg_leave(fd->cpg_handle, &name);
-	if (error == CPG_ERR_TRY_AGAIN) {
-		sleep(1);
-		if (!(++i % 10))
-			log_error("cpg_leave error retrying");
-		goto retry;
-	}
-	if (error != CPG_OK)
-		log_error("cpg_leave error %d", error);
-
-	return 0;
-}
-
-static struct node_daemon *get_node_daemon(int nodeid)
-{
-	struct node_daemon *node;
-
-	list_for_each_entry(node, &daemon_nodes, list) {
-		if (node->nodeid == nodeid)
-			return node;
-	}
-	return NULL;
-}
-
-static void add_node_daemon(int nodeid)
-{
-	struct node_daemon *node;
-
-	if (get_node_daemon(nodeid))
-		return;
-
-	node = malloc(sizeof(struct node_daemon));
-	if (!node) {
-		log_error("add_node_daemon no mem");
-		return;
-	}
-	memset(node, 0, sizeof(struct node_daemon));
-	node->nodeid = nodeid;
-	list_add_tail(&node->list, &daemon_nodes);
-}
-
-static void pv_in(struct protocol_version *pv)
-{
-	pv->major = le16_to_cpu(pv->major);
-	pv->minor = le16_to_cpu(pv->minor);
-	pv->patch = le16_to_cpu(pv->patch);
-	pv->flags = le16_to_cpu(pv->flags);
-}
-
-static void pv_out(struct protocol_version *pv)
-{
-	pv->major = cpu_to_le16(pv->major);
-	pv->minor = cpu_to_le16(pv->minor);
-	pv->patch = cpu_to_le16(pv->patch);
-	pv->flags = cpu_to_le16(pv->flags);
-}
-
-static void protocol_in(struct protocol *proto)
-{
-	pv_in(&proto->dm_ver);
-	pv_in(&proto->dr_ver);
-}
-
-static void protocol_out(struct protocol *proto)
-{
-	pv_out(&proto->dm_ver);
-	pv_out(&proto->dr_ver);
-}
-
-/* go through member list saved in last confchg, see if we have received a
-   proto message from each */
-
-static int all_protocol_messages(void)
-{
-	struct node_daemon *node;
-	int i;
-
-	if (!daemon_member_count)
-		return 0;
-
-	for (i = 0; i < daemon_member_count; i++) {
-		node = get_node_daemon(daemon_member[i].nodeid);
-		if (!node) {
-			log_error("all_protocol_messages no node %d",
-				  daemon_member[i].nodeid);
-			return 0;
-		}
-
-		if (!node->proto.daemon_max[0])
-			return 0;
-	}
-	return 1;
-}
-
-static int pick_min_protocol(struct protocol *proto)
-{
-	uint16_t mind[4];
-	struct node_daemon *node;
-	int i;
-
-	memset(&mind, 0, sizeof(mind));
-
-	/* first choose the minimum major */
-
-	for (i = 0; i < daemon_member_count; i++) {
-		node = get_node_daemon(daemon_member[i].nodeid);
-		if (!node) {
-			log_error("pick_min_protocol no node %d",
-				  daemon_member[i].nodeid);
-			return -1;
-		}
-
-		if (!mind[0] || node->proto.daemon_max[0] < mind[0])
-			mind[0] = node->proto.daemon_max[0];
-	}
-
-	if (!mind[0]) {
-		log_error("pick_min_protocol zero major number");
-		return -1;
-	}
-
-	/* second pick the minimum minor with the chosen major */
-
-	for (i = 0; i < daemon_member_count; i++) {
-		node = get_node_daemon(daemon_member[i].nodeid);
-		if (!node)
-			continue;
-
-		if (mind[0] == node->proto.daemon_max[0]) {
-			if (!mind[1] || node->proto.daemon_max[1] < mind[1])
-				mind[1] = node->proto.daemon_max[1];
-		}
-	}
-
-	if (!mind[1]) {
-		log_error("pick_min_protocol zero minor number");
-		return -1;
-	}
-
-	/* third pick the minimum patch with the chosen major.minor */
-
-	for (i = 0; i < daemon_member_count; i++) {
-		node = get_node_daemon(daemon_member[i].nodeid);
-		if (!node)
-			continue;
-
-		if (mind[0] == node->proto.daemon_max[0] &&
-		    mind[1] == node->proto.daemon_max[1]) {
-			if (!mind[2] || node->proto.daemon_max[2] < mind[2])
-				mind[2] = node->proto.daemon_max[2];
-		}
-	}
-
-	if (!mind[2]) {
-		log_error("pick_min_protocol zero patch number");
-		return -1;
-	}
-
-	memcpy(&proto->daemon_run, &mind, sizeof(mind));
-	return 0;
-}
-
-static void receive_protocol(struct fd_header *hd, int len)
-{
-	struct protocol *p;
-	struct node_daemon *node;
-
-	p = (struct protocol *)((char *)hd + sizeof(struct fd_header));
-	protocol_in(p);
-
-	if (len < sizeof(struct fd_header) + sizeof(struct protocol)) {
-		log_error("receive_protocol invalid len %d from %d",
-			  len, hd->nodeid);
-		return;
-	}
-
-	/* zero is an invalid version value */
-
-	if (!p->daemon_max[0] || !p->daemon_max[1] || !p->daemon_max[2]) {
-		log_error("receive_protocol invalid max value from %d "
-			  "daemon %u.%u.%u", hd->nodeid,
-			  p->daemon_max[0], p->daemon_max[1], p->daemon_max[2]);
-		return;
-	}
-
-	/* the run values will be zero until a version is set, after
-	   which none of the run values can be zero */
-
-	if (p->daemon_run[0] && (!p->daemon_run[1] || !p->daemon_run[2])) {
-		log_error("receive_protocol invalid run value from %d "
-			  "daemon %u.%u.%u", hd->nodeid,
-			  p->daemon_run[0], p->daemon_run[1], p->daemon_run[2]);
-		return;
-	}
-
-	/* if we have zero run values, and this msg has non-zero run values,
-	   then adopt them as ours; otherwise save this proto message */
-
-	if (our_protocol.daemon_run[0])
-		return;
-
-	if (p->daemon_run[0]) {
-		memcpy(&our_protocol.daemon_run, &p->daemon_run,
-		       sizeof(struct protocol_version));
-		log_debug("run protocol from nodeid %d", hd->nodeid);
-		return;
-	}
-
-	/* save this node's proto so we can tell when we've got all, and
-	   use it to select a minimum protocol from all */
-
-	node = get_node_daemon(hd->nodeid);
-	if (!node) {
-		log_error("receive_protocol no node %d", hd->nodeid);
-		return;
-	}
-	memcpy(&node->proto, p, sizeof(struct protocol));
-}
-
-static void send_protocol(struct protocol *proto)
-{
-	struct fd_header *hd;
-	struct protocol *pr;
-	char *buf;
-	int len;
-
-	len = sizeof(struct fd_header) + sizeof(struct protocol);
-	buf = malloc(len);
-	if (!buf) {
-		log_error("send_protocol no mem %d", len);
-		return;
-	}
-	memset(buf, 0, len);
-
-	hd = (struct fd_header *)buf;
-	pr = (struct protocol *)(buf + sizeof(*hd));
-
-	hd->type = cpu_to_le16(FD_MSG_PROTOCOL);
-	hd->nodeid = cpu_to_le32(our_nodeid);
-
-	memcpy(pr, proto, sizeof(struct protocol));
-	protocol_out(pr);
-
-	_send_message(cpg_handle_daemon, buf, len, FD_MSG_PROTOCOL);
-}
-
-int set_protocol(void)
-{
-	struct protocol proto;
-	struct pollfd pollfd;
-	int sent_proposal = 0;
-	int rv;
-
-	memset(&pollfd, 0, sizeof(pollfd));
-	pollfd.fd = daemon_cpg_fd;
-	pollfd.events = POLLIN;
-
-	while (1) {
-		if (our_protocol.daemon_run[0])
-			break;
-
-		if (!sent_proposal && all_protocol_messages()) {
-			/* propose a protocol; look through info from all
-			   nodes and pick the min and propose that */
-
-			sent_proposal = 1;
-
-			/* copy our max values */
-			memcpy(&proto, &our_protocol, sizeof(struct protocol));
-
-			rv = pick_min_protocol(&proto);
-			if (rv < 0)
-				return rv;
-
-			log_debug("set_protocol member_count %d propose "
-				  "daemon %u.%u.%u", daemon_member_count,
-				  proto.daemon_run[0], proto.daemon_run[1],
-				  proto.daemon_run[2]);
-
-			send_protocol(&proto);
-		}
-
-		/* only process messages/events from daemon cpg until protocol
-		   is established */
-
-		rv = poll(&pollfd, 1, -1);
-		if (rv == -1 && errno == EINTR) {
-			if (daemon_quit)
-				return -1;
-			continue;
-		}
-		if (rv < 0) {
-			log_error("set_protocol poll errno %d", errno);
-			return -1;
-		}
-
-		if (pollfd.revents & POLLIN)
-			process_cpg(0);
-		if (pollfd.revents & (POLLERR | POLLHUP | POLLNVAL)) {
-			log_error("set_protocol poll revents %u",
-				  pollfd.revents);
-			return -1;
-		}
-	}
-
-	if (our_protocol.daemon_run[0] != our_protocol.daemon_max[0] ||
-	    our_protocol.daemon_run[1] > our_protocol.daemon_max[1]) {
-		log_error("incompatible daemon protocol run %u.%u.%u max %u.%u.%u",
-			our_protocol.daemon_run[0],
-			our_protocol.daemon_run[1],
-			our_protocol.daemon_run[2],
-			our_protocol.daemon_max[0],
-			our_protocol.daemon_max[1],
-			our_protocol.daemon_max[2]);
-		return -1;
-	}
-
-	log_debug("daemon run %u.%u.%u max %u.%u.%u",
-		  our_protocol.daemon_run[0],
-		  our_protocol.daemon_run[1],
-		  our_protocol.daemon_run[2],
-		  our_protocol.daemon_max[0],
-		  our_protocol.daemon_max[1],
-		  our_protocol.daemon_max[2]);
-	return 0;
-}
-
-/* process_cpg(), setup_cpg(), close_cpg() are for the "daemon" cpg which
-   tracks the presence of other daemons; it's not the fenced domain cpg.
-   Joining this cpg tells others that we don't have uncontrolled dlm/gfs
-   kernel state and they can skip fencing us if we're a victim.  (We have
-   to check for that uncontrolled state before calling setup_cpg, obviously.) */
-
-static void deliver_cb_daemon(cpg_handle_t handle, struct cpg_name *group_name,
-		uint32_t nodeid, uint32_t pid, void *data, int len)
-{
-	struct fd_header *hd;
-
-	if (len < sizeof(*hd)) {
-		log_error("deliver_cb short message %d", len);
-		return;
-	}
-
-	hd = (struct fd_header *)data;
-	fd_header_in(hd);
-
-	switch (hd->type) {
-	case FD_MSG_PROTOCOL:
-		receive_protocol(hd, len);
-		break;
-	default:
-		log_error("deliver_cb_daemon unknown msg type %d", hd->type);
-	}
-}
-
-static void confchg_cb_daemon(cpg_handle_t handle, struct cpg_name *group_name,
-		struct cpg_address *member_list, int member_list_entries,
-		struct cpg_address *left_list, int left_list_entries,
-		struct cpg_address *joined_list, int joined_list_entries)
-{
-	int i;
-
-	if (joined_list_entries)
-		send_protocol(&our_protocol);
-
-	memset(&daemon_member, 0, sizeof(daemon_member));
-	daemon_member_count = member_list_entries;
-
-	for (i = 0; i < member_list_entries; i++) {
-		daemon_member[i] = member_list[i];
-		add_node_daemon(member_list[i].nodeid);
-	}
-}
-
-static cpg_callbacks_t cpg_callbacks_daemon = {
-	.cpg_deliver_fn = deliver_cb_daemon,
-	.cpg_confchg_fn = confchg_cb_daemon,
-};
-
-void process_cpg(int ci)
-{
-	cpg_error_t error;
-
-	error = cpg_dispatch(cpg_handle_daemon, CPG_DISPATCH_ALL);
-	if (error != CPG_OK)
-		log_error("daemon cpg_dispatch error %d", error);
-}
-
-int in_daemon_member_list(int nodeid)
-{
-	int i;
-
-	cpg_dispatch(cpg_handle_daemon, CPG_DISPATCH_ALL);
-
-	for (i = 0; i < daemon_member_count; i++) {
-		if (daemon_member[i].nodeid == nodeid)
-			return 1;
-	}
-	return 0;
-}
-
-int setup_cpg(void)
-{
-	cpg_error_t error;
-	struct cpg_name name;
-	int i = 0;
-
-	INIT_LIST_HEAD(&daemon_nodes);
-
-	memset(&our_protocol, 0, sizeof(our_protocol));
-	our_protocol.daemon_max[0] = 1;
-	our_protocol.daemon_max[1] = 1;
-	our_protocol.daemon_max[2] = 1;
-
-	error = cpg_initialize(&cpg_handle_daemon, &cpg_callbacks_daemon);
-	if (error != CPG_OK) {
-		log_error("daemon cpg_initialize error %d", error);
-		goto fail;
-	}
-
-	cpg_fd_get(cpg_handle_daemon, &daemon_cpg_fd);
-
-	memset(&name, 0, sizeof(name));
-	sprintf(name.value, "fenced:daemon");
-	name.length = strlen(name.value) + 1;
-
- retry:
-	error = cpg_join(cpg_handle_daemon, &name);
-	if (error == CPG_ERR_TRY_AGAIN) {
-		sleep(1);
-		if (!(++i % 10))
-			log_error("daemon cpg_join error retrying");
-		goto retry;
-	}
-	if (error != CPG_OK) {
-		log_error("daemon cpg_join error %d", error);
-		goto fail;
-	}
-
-	log_debug("setup_cpg %d", daemon_cpg_fd);
-	return daemon_cpg_fd;
-
- fail:
-	cpg_finalize(cpg_handle_daemon);
-	return -1;
-}
-
-void close_cpg(void)
-{
-	cpg_error_t error;
-	struct cpg_name name;
-	int i = 0;
-
-	if (!cpg_handle_daemon || cluster_down)
-		return;
-
-	memset(&name, 0, sizeof(name));
-	sprintf(name.value, "fenced:daemon");
-	name.length = strlen(name.value) + 1;
-
- retry:
-	error = cpg_leave(cpg_handle_daemon, &name);
-	if (error == CPG_ERR_TRY_AGAIN) {
-		sleep(1);
-		if (!(++i % 10))
-			log_error("daemon cpg_leave error retrying");
-		goto retry;
-	}
-	if (error != CPG_OK)
-		log_error("daemon cpg_leave error %d", error);
-}
-
-int set_node_info(struct fd *fd, int nodeid, struct fenced_node *nodeinfo)
-{
-	struct node_history *node;
-	struct member *memb;
-	struct change *cg;
-
-	nodeinfo->nodeid = nodeid;
-	nodeinfo->victim = is_victim(fd, nodeid);
-
-	if (list_empty(&fd->changes))
-		cg = fd->started_change;
-	else
-		cg = list_first_entry(&fd->changes, struct change, list);
-
-	if (cg) {
-		memb = find_memb(cg, nodeid);
-		if (memb)
-			nodeinfo->member = memb->disallowed ? -1 : 1;
-	}
-
-	node = get_node_history(fd, nodeid);
-	if (node) {
-		nodeinfo->last_fenced_master = node->fence_master;
-		nodeinfo->last_fenced_how = node->fence_how;
-		nodeinfo->last_fenced_time = node->fence_time;
-	}
-
-	return 0;
-}
-
-int set_domain_info(struct fd *fd, struct fenced_domain *domain)
-{
-	struct change *cg;
-
-	if (list_empty(&fd->changes)) {
-		if (fd->started_change)
-			domain->member_count = fd->started_change->member_count;
-	} else {
-		cg = list_first_entry(&fd->changes, struct change, list);
-		domain->member_count = cg->member_count;
-		domain->state = cg->state;
-	}
-
-	domain->master_nodeid = fd->master;
-	domain->victim_count = list_count(&fd->victims);
-	domain->current_victim = fd->current_victim;
-
-	return 0;
-}
-
-int set_domain_nodes(struct fd *fd, int option, int *node_count,
-		     struct fenced_node **nodes_out)
-{
-	struct change *cg = fd->started_change;
-	struct fenced_node *nodes = NULL, *n;
-	struct node_history *nh;
-	struct member *memb;
-	int count = 0;
-
-	if (option == FENCED_NODES_MEMBERS) {
-		if (!cg)
-			goto out;
-		count = cg->member_count;
-
-		nodes = malloc(count * sizeof(struct fenced_node));
-		if (!nodes)
-			return -ENOMEM;
-		memset(nodes, 0, count * sizeof(struct fenced_node));
-
-		n = nodes;
-		list_for_each_entry(memb, &cg->members, list)
-			set_node_info(fd, memb->nodeid, n++);
-	}
-
-	else if (option == FENCED_NODES_ALL) {
-		list_for_each_entry(nh, &fd->node_history, list)
-			count++;
-
-		nodes = malloc(count * sizeof(struct fenced_node));
-		if (!nodes)
-			return -ENOMEM;
-		memset(nodes, 0, count * sizeof(struct fenced_node));
-
-		n = nodes;
-		list_for_each_entry(nh, &fd->node_history, list)
-			set_node_info(fd, nh->nodeid, n++);
-	}
- out:
-	*node_count = count;
-	*nodes_out = nodes;
-	return 0;
-}
-
diff --git a/fence/fenced/fd.h b/fence/fenced/fd.h
deleted file mode 100644
index ed2b318..0000000
--- a/fence/fenced/fd.h
+++ /dev/null
@@ -1,272 +0,0 @@
-#ifndef __FD_DOT_H__
-#define __FD_DOT_H__
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <signal.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <stdint.h>
-#include <time.h>
-#include <sched.h>
-#include <limits.h>
-#include <dirent.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <sys/poll.h>
-#include <sys/select.h>
-#include <sys/time.h>
-
-#include <openais/saAis.h>
-#include <corosync/cpg.h>
-#include <liblogthread.h>
-
-#include "list.h"
-#include "linux_endian.h"
-#include "libfence.h"
-#include "libfenced.h"
-#include "fenced.h"
-
-/* Max name length for a group, pointless since we only ever create the
-   "default" group.  Regardless, set arbitrary max to match dlm's
-   DLM_LOCKSPACE_LEN 64.  The libcpg limit is larger at 128; we prefix
-   the fence domain name with "fenced:" to create the cpg name. */
-
-#define MAX_GROUPNAME_LEN	64
-
-/* Max name length for a node.  This should match libcman's
-   CMAN_MAX_NODENAME_LEN which is 255. */
-
-#define MAX_NODENAME_LEN	255
-
-/* Maximum members of the fence domain, or cluster.  Should match
-   CPG_MEMBERS_MAX in openais/cpg.h. */
-
-#define MAX_NODES		128
-
-/* Max string length printed on a line, for debugging/dump output. */
-
-#define MAXLINE			256
-
-/* group_mode */
-
-#define GROUP_LIBGROUP          2
-#define GROUP_LIBCPG            3
-
-extern int daemon_debug_opt;
-extern int daemon_quit;
-extern int cluster_down;
-extern struct list_head domains;
-extern int cman_quorate;
-extern int our_nodeid;
-extern char our_name[MAX_NODENAME_LEN+1];
-extern char daemon_debug_buf[256];
-extern char dump_buf[FENCED_DUMP_SIZE];
-extern int dump_point;
-extern int dump_wrap;
-extern int group_mode;
-
-extern void daemon_dump_save(void);
-
-#define log_level(lvl, fmt, args...) \
-do { \
-	snprintf(daemon_debug_buf, 255, "%ld " fmt "\n", time(NULL), ##args); \
-	daemon_dump_save(); \
-	logt_print(lvl, fmt "\n", ##args); \
-	if (daemon_debug_opt) \
-		fprintf(stderr, "%s", daemon_debug_buf); \
-} while (0)
-
-#define log_debug(fmt, args...) log_level(LOG_DEBUG, fmt, ##args)
-#define log_error(fmt, args...) log_level(LOG_ERR, fmt, ##args)
-
-#define FD_MSG_PROTOCOL		1
-#define FD_MSG_START		2
-#define FD_MSG_VICTIM_DONE	3
-#define FD_MSG_COMPLETE		4
-#define FD_MSG_EXTERNAL		5
-
-#define FD_MFLG_JOINING		1  /* accompanies start, we are joining */
-#define FD_MFLG_COMPLETE	2  /* accompanies start, we have complete info */
-
-struct fd_header {
-	uint16_t version[3];
-	uint16_t type;		/* FD_MSG_ */
-	uint32_t nodeid;	/* sender */
-	uint32_t to_nodeid;     /* recipient, 0 for all */
-	uint32_t global_id;     /* global unique id for this domain */
-	uint32_t flags;		/* FD_MFLG_ */
-	uint32_t msgdata;       /* in-header payload depends on MSG type */
-	uint32_t pad1;
-	uint64_t pad2;
-};
-
-#define CGST_WAIT_CONDITIONS	1
-#define CGST_WAIT_MESSAGES	2
-#define CGST_WAIT_FENCING	3	/* for queries */
-
-struct change {
-	struct list_head list;
-	struct list_head members;
-	struct list_head removed; /* nodes removed by this change */
-	int member_count;
-	int joined_count;
-	int remove_count;
-	int failed_count;
-	int state; /* CGST_ */
-	int we_joined;
-	uint32_t seq; /* just used as a reference when debugging */
-};
-
-#define VIC_DONE_AGENT		1
-#define VIC_DONE_MEMBER		2
-#define VIC_DONE_OVERRIDE	3
-#define VIC_DONE_EXTERNAL	4
-
-struct node_history {
-	struct list_head list;
-	int nodeid;
-	int check_quorum;
-	uint64_t add_time;
-	uint64_t left_time;
-	uint64_t fail_time;
-	uint64_t fence_time;
-	uint64_t fence_external_time;
-	int fence_external_node;
-	int fence_master;
-	int fence_how; /* VIC_DONE_ */
-};
-
-struct node {
-	struct list_head 	list;
-	int			nodeid;
-	int			init_victim;
-	char 			name[MAX_NODENAME_LEN+1];
-};
-
-struct fd {
-	struct list_head	list;
-	char 			name[MAX_GROUPNAME_LEN+1];
-
-	/* libcpg domain membership */
-
-	cpg_handle_t		cpg_handle;
-	int			cpg_client;
-	int			cpg_fd;
-	uint32_t		change_seq;
-	uint32_t		started_count;
-	struct change		*started_change;
-	struct list_head	changes;
-	struct list_head	node_history;
-	int			init_complete;
-
-	/* general domain membership */
-
-	int			master;
-	int			joining_group;
-	int			leaving_group;
-	int			current_victim; /* for queries */
-	struct list_head 	victims;
-	struct list_head	complete;
-
-	/* libgroup domain membership */
-
-	int 			last_stop;
-	int 			last_start;
-	int 			last_finish;
-	int			first_recovery;
-	int 			prev_count;
-	struct list_head 	prev;
-	struct list_head 	leaving;
-};
-
-/* config.c */
-
-int setup_ccs(void);
-void close_ccs(void);
-void reread_ccs(void);
-void read_ccs_name(char *path, char *name);
-void read_ccs_yesno(char *path, int *yes, int *no);
-void read_ccs_int(char *path, int *config_val);
-int read_ccs(struct fd *fd);
-
-/* cpg.c */
-
-void process_cpg(int ci);
-int setup_cpg(void);
-void close_cpg(void);
-int set_protocol(void);
-void free_cg(struct change *cg);
-void node_history_fence(struct fd *fd, int victim, int master, int how,
-			uint64_t mastertime);
-void send_external(struct fd *fd, int victim);
-int is_fenced_external(struct fd *fd, int nodeid);
-void send_victim_done(struct fd *fd, int victim);
-void process_fd_changes(void);
-int fd_join(struct fd *fd);
-int fd_leave(struct fd *fd);
-int set_node_info(struct fd *fd, int nodeid, struct fenced_node *node);
-int set_domain_info(struct fd *fd, struct fenced_domain *domain);
-int set_domain_nodes(struct fd *fd, int option, int *node_count,
-		     struct fenced_node **nodes);
-int in_daemon_member_list(int nodeid);
-
-/* group.c */
-
-void process_groupd(int ci);
-int setup_groupd(void);
-void close_groupd(void);
-int fd_join_group(struct fd *fd);
-int fd_leave_group(struct fd *fd);
-int set_node_info_group(struct fd *fd, int nodeid, struct fenced_node *node);
-int set_domain_info_group(struct fd *fd, struct fenced_domain *domain);
-int set_domain_nodes_group(struct fd *fd, int option, int *node_count,
-			   struct fenced_node **nodes);
-int set_group_mode(void);
-
-/* main.c */
-
-void client_dead(int ci);
-int client_add(int fd, void (*workfn)(int ci), void (*deadfn)(int ci));
-void free_fd(struct fd *fd);
-struct fd *find_fd(char *name);
-void query_lock(void);
-void query_unlock(void);
-void cluster_dead(int ci);
-
-/* member_cman.c */
-
-void process_cman(int ci);
-int setup_cman(void);
-void close_cman(void);
-int is_cman_member(int nodeid);
-char *nodeid_to_name(int nodeid);
-int name_to_nodeid(char *name);
-struct node *get_new_node(struct fd *fd, int nodeid);
-void kick_node_from_cluster(int nodeid);
-void set_cman_dirty(void);
-
-/* recover.c */
-
-void free_node_list(struct list_head *head);
-void add_complete_node(struct fd *fd, int nodeid);
-int list_count(struct list_head *head);
-int is_victim(struct fd *fd, int nodeid);
-void delay_fencing(struct fd *fd, int node_join);
-void defer_fencing(struct fd *fd);
-void fence_victims(struct fd *fd);
-
-/* logging.c */
-
-void init_logging(void);
-void setup_logging();
-void close_logging(void);
-
-#endif				/*  __FD_DOT_H__  */
-
diff --git a/fence/fenced/fenced.h b/fence/fenced/fenced.h
deleted file mode 100644
index fb7d951..0000000
--- a/fence/fenced/fenced.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef __FENCED_DOT_H__
-#define __FENCED_DOT_H__
-
-/* This defines the interface between fenced and libfenced, and should
-   only be used by libfenced. */
-
-/* should match the same in fd.h */
-#define MAX_NODENAME_LEN		255
-
-#define FENCED_SOCK_PATH		"fenced_sock"
-#define FENCED_QUERY_SOCK_PATH		"fenced_query_sock"
-
-#define FENCED_MAGIC			0x0FE11CED
-#define FENCED_VERSION			0x00010001
-
-#define FENCED_CMD_JOIN			1
-#define FENCED_CMD_LEAVE		2
-#define FENCED_CMD_DUMP_DEBUG		3
-#define FENCED_CMD_EXTERNAL		4
-#define FENCED_CMD_NODE_INFO		5
-#define FENCED_CMD_DOMAIN_INFO		6
-#define FENCED_CMD_DOMAIN_NODES		7
-
-struct fenced_header {
-	unsigned int magic;
-	unsigned int version;
-	unsigned int command;
-	unsigned int option;
-	unsigned int len;
-	int data;	/* embedded command-specific data, for convenience */
-	int unused1;
-	int unsued2;
-};
-
-#endif
-
diff --git a/fence/fenced/group.c b/fence/fenced/group.c
deleted file mode 100644
index 2f95550..0000000
--- a/fence/fenced/group.c
+++ /dev/null
@@ -1,487 +0,0 @@
-#include "fd.h"
-#include "config.h"
-#include "libgroup.h"
-
-#define DO_STOP 1
-#define DO_START 2
-#define DO_FINISH 3
-#define DO_TERMINATE 4
-#define DO_SETID 5
-
-#define GROUPD_TIMEOUT 10 /* seconds */
-
-/* save all the params from callback functions here because we can't
-   do the processing within the callback function itself */
-
-static group_handle_t gh;
-static int cb_action;
-static char cb_name[MAX_GROUPNAME_LEN+1];
-static int cb_event_nr;
-static int cb_id;
-static int cb_type;
-static int cb_member_count;
-static int cb_members[MAX_NODES];
-
-
-static void stop_cbfn(group_handle_t h, void *private, char *name)
-{
-	cb_action = DO_STOP;
-	strcpy(cb_name, name);
-}
-
-static void start_cbfn(group_handle_t h, void *private, char *name,
-		       int event_nr, int type, int member_count, int *members)
-{
-	int i;
-
-	cb_action = DO_START;
-	strcpy(cb_name, name);
-	cb_event_nr = event_nr;
-	cb_type = type;
-	cb_member_count = member_count;
-
-	for (i = 0; i < member_count; i++)
-		cb_members[i] = members[i];
-}
-
-static void finish_cbfn(group_handle_t h, void *private, char *name,
-			int event_nr)
-{
-	cb_action = DO_FINISH;
-	strcpy(cb_name, name);
-	cb_event_nr = event_nr;
-}
-
-static void terminate_cbfn(group_handle_t h, void *private, char *name)
-{
-	cb_action = DO_TERMINATE;
-	strcpy(cb_name, name);
-}
-
-static void setid_cbfn(group_handle_t h, void *private, char *name,
-		       int unsigned id)
-{
-	cb_action = DO_SETID;
-	strcpy(cb_name, name);
-	cb_id = id;
-}
-
-group_callbacks_t callbacks = {
-	stop_cbfn,
-	start_cbfn,
-	finish_cbfn,
-	terminate_cbfn,
-	setid_cbfn
-};
-
-static char *str_members(void)
-{
-	static char mbuf[MAXLINE];
-	int i, len = 0;
-
-	memset(mbuf, 0, MAXLINE);
-
-	for (i = 0; i < cb_member_count; i++)
-		len += sprintf(mbuf+len, "%d ", cb_members[i]);
-	return mbuf;
-}
-
-static int id_in_nodeids(int nodeid, int count, int *nodeids)
-{
-	int i;
-
-	for (i = 0; i < count; i++) {
-		if (nodeid == nodeids[i])
-			return 1;
-	}
-	return 0;
-}
-
-static int next_complete_nodeid(struct fd *fd, int gt)
-{
-	struct node *node;
-	int low = -1;
-
-	/* find lowest node id in fd_complete greater than gt,
-	   if none, return -1 */
-
-	list_for_each_entry(node, &fd->complete, list) {
-		if (node->nodeid <= gt)
-			continue;
-
-		if (low == -1)
-			low = node->nodeid;
-		else if (node->nodeid < low)
-			low = node->nodeid;
-	}
-	return low;
-}
-
-static void set_master(struct fd *fd)
-{
-	struct node *node;
-	int low = -1;
-
-	/* Find the lowest nodeid common to fd->fd_prev (newest member list)
-	 * and fd->fd_complete (last complete member list). */
-
-	for (;;) {
-		low = next_complete_nodeid(fd, low);
-		if (low == -1)
-			break;
-
-		list_for_each_entry(node, &fd->prev, list) {
-			if (low != node->nodeid)
-				continue;
-			goto out;
-		}
-	}
-
-	/* Special case: we're the first and only FD member */
-
-	if (fd->prev_count == 1)
-		low = our_nodeid;
-
-	/* We end up returning -1 when we're not the only node and we've just
-	   joined.  Because we've just joined we weren't in the last complete
-	   domain group and won't be chosen as master.  We defer to someone who
-	   _was_ in the last complete group.  All we know is it isn't us. */
-
- out:
-	fd->master = low;
-}
-
-static void new_prev_nodes(struct fd *fd, int member_count, int *nodeids)
-{
-	struct node *node;
-	int i;
-
-	for (i = 0; i < member_count; i++) {
-		node = get_new_node(fd, nodeids[i]);
-		list_add(&node->list, &fd->prev);
-	}
-
-	fd->prev_count = member_count;
-}
-
-static void _add_first_victims(struct fd *fd)
-{
-	struct node *prev_node, *safe;
-
-	/* complete list initialised in init_nodes() to all nodes from ccs */
-	if (list_empty(&fd->complete))
-		log_debug("first complete list empty warning");
-
-	list_for_each_entry_safe(prev_node, safe, &fd->complete, list) {
-		if (!is_cman_member(prev_node->nodeid)) {
-			list_del(&prev_node->list);
-			list_add(&prev_node->list, &fd->victims);
-			log_debug("add first victim %s", prev_node->name);
-			prev_node->init_victim = 1;
-		}
-	}
-}
-
-static void _add_victims(struct fd *fd, int start_type, int member_count,
-			 int *nodeids)
-{
-	struct node *node, *safe;
-
-	/* nodes which haven't completed leaving when a failure restart happens
-	 * are dead (and need fencing) or are still members */
-
-	if (start_type == GROUP_NODE_FAILED) {
-		list_for_each_entry_safe(node, safe, &fd->leaving, list) {
-			list_del(&node->list);
-			if (id_in_nodeids(node->nodeid, member_count, nodeids))
-				list_add(&node->list, &fd->complete);
-			else {
-				list_add(&node->list, &fd->victims);
-				log_debug("add victim %u, was leaving",
-					  node->nodeid);
-			}
-		}
-	}
-
-	/* nodes in last completed group but missing from fr_nodeids are added
-	 * to victims list or leaving list, depending on the type of start. */
-
-	if (list_empty(&fd->complete))
-		log_debug("complete list empty warning");
-
-	list_for_each_entry_safe(node, safe, &fd->complete, list) {
-		if (!id_in_nodeids(node->nodeid, member_count, nodeids)) {
-			list_del(&node->list);
-
-			if (start_type == GROUP_NODE_FAILED)
-				list_add(&node->list, &fd->victims);
-			else
-				list_add(&node->list, &fd->leaving);
-
-			log_debug("add node %u to list %u", node->nodeid,
-				  start_type);
-		}
-	}
-}
-
-static void add_victims(struct fd *fd, int start_type, int member_count,
-			int *nodeids)
-{
-	/* Reset things when the last stop aborted our first
-	 * start, i.e. there was no finish; we got a
-	 * start/stop/start immediately upon joining. */
-
-	if (!fd->last_finish && fd->last_stop) {
-		log_debug("revert aborted first start");
-		fd->last_stop = 0;
-		fd->first_recovery = 0;
-		free_node_list(&fd->prev);
-		free_node_list(&fd->victims);
-		free_node_list(&fd->leaving);
-	}
-
-	log_debug("add_victims stop %d start %d finish %d",
-		  fd->last_stop, fd->last_start, fd->last_finish);
-
-	if (!fd->first_recovery) {
-		fd->first_recovery = 1;
-		_add_first_victims(fd);
-	} else
-		_add_victims(fd, start_type, member_count, nodeids);
-
-	/* "prev" is just a temporary list of node structs matching the list of
-	   nodeids from the start; these nodes are moved to the "complete" list
-	   in the finish callback, and will be used to compare against the
-	   next set of started nodes */
-	   
-	free_node_list(&fd->prev);
-	new_prev_nodes(fd, member_count, nodeids);
-}
-
-static void clear_victims(struct fd *fd)
-{
-	struct node *node, *safe;
-
-	if (fd->last_finish == fd->last_start) {
-		free_node_list(&fd->leaving);
-		free_node_list(&fd->victims);
-	}
-
-	/* Save a copy of this set of nodes which constitutes the latest
-	 * complete group.  Any of these nodes missing in the next start will
-	 * either be leaving or victims.  For the next recovery, the lowest
-	 * remaining nodeid in this group will be the master. */
-
-	free_node_list(&fd->complete);
-	list_for_each_entry_safe(node, safe, &fd->prev, list) {
-		list_del(&node->list);
-		list_add(&node->list, &fd->complete);
-	}
-}
-
-void process_groupd(int ci)
-{
-	struct fd *fd;
-	int error = -EINVAL;
-
-	group_dispatch(gh);
-
-	if (!cb_action)
-		goto out;
-
-	fd = find_fd(cb_name);
-	if (!fd)
-		goto out;
-
-	switch (cb_action) {
-	case DO_STOP:
-		log_debug("stop %s", cb_name);
-		fd->last_stop = fd->last_start;
-		group_stop_done(gh, cb_name);
-		break;
-
-	case DO_START:
-		log_debug("start %s %d members %s", cb_name, cb_event_nr,
-			  str_members());
-		fd->last_start = cb_event_nr;
-
-		/* we don't get a start callback until there's quorum */
-
-		add_victims(fd, cb_type, cb_member_count, cb_members);
-		set_master(fd);
-		if (fd->master == our_nodeid) {
-			delay_fencing(fd, cb_type == GROUP_NODE_JOIN);
-			fence_victims(fd);
-		} else {
-			defer_fencing(fd);
-		}
-
-		group_start_done(gh, cb_name, cb_event_nr);
-		fd->joining_group = 0;
-		break;
-
-	case DO_FINISH:
-		log_debug("finish %s %d", cb_name, cb_event_nr);
-		fd->last_finish = cb_event_nr;
-
-		/* we get terminate callback when all have started, which means
-		   that the low node has successfully fenced all victims */
-		clear_victims(fd);
-
-		break;
-
-	case DO_TERMINATE:
-		log_debug("terminate %s", cb_name);
-		if (!fd->leaving_group)
-			log_error("process_groupd terminate not leaving");
-		list_del(&fd->list);
-		free_fd(fd);
-		break;
-
-	case DO_SETID:
-		break;
-	default:
-		error = -EINVAL;
-	}
-
-	cb_action = 0;
- out:
-	return;
-}
-
-int setup_groupd(void)
-{
-	int rv;
-
-	gh = group_init(NULL, "fence", 0, &callbacks, GROUPD_TIMEOUT);
-	if (!gh) {
-		log_error("group_init error %p %d", gh, errno);
-		return -ENOTCONN;
-	}
-	rv = group_get_fd(gh);
-	if (rv < 0)
-		log_error("group_get_fd error %d %d", rv, errno);
-	return rv;
-}
-
-void close_groupd(void)
-{
-	group_exit(gh);
-}
-
-int fd_join_group(struct fd *fd)
-{
-	int rv;
-
-	list_add(&fd->list, &domains);
-	fd->joining_group = 1;
-
-	rv = group_join(gh, fd->name);
-	if (rv) {
-		log_error("group_join error %d", rv);
-		list_del(&fd->list);
-		free(fd);
-	}
-	return rv;
-}
-
-int fd_leave_group(struct fd *fd)
-{
-	int rv;
-
-	fd->leaving_group = 1;
-
-	rv = group_leave(gh, fd->name);
-	if (rv)
-		log_error("group_leave error %d", rv);
-
-	return rv;
-}
-
-int set_node_info_group(struct fd *fd, int nodeid, struct fenced_node *nodeinfo)
-{
-	nodeinfo->nodeid = nodeid;
-	nodeinfo->victim = is_victim(fd, nodeid);
-	nodeinfo->member = id_in_nodeids(nodeid, cb_member_count, cb_members);
-
-	/* FIXME: we don't keep track of last_fenced_* in this libgroup code,
-	   maybe just leave it out */
-
-	return 0;
-}
-
-int set_domain_info_group(struct fd *fd, struct fenced_domain *domain)
-{
-	domain->master_nodeid = fd->master;
-	domain->victim_count = list_count(&fd->victims);
-	domain->member_count = cb_member_count;
-	domain->state = cb_action;
-	domain->current_victim = fd->current_victim;
-	return 0;
-}
-
-int set_domain_nodes_group(struct fd *fd, int option, int *node_count,
-			   struct fenced_node **nodes_out)
-{
-	struct fenced_node *nodes = NULL, *nodep;
-	int i;
-
-	if (!cb_member_count)
-		goto out;
-
-	nodes = malloc(cb_member_count * sizeof(struct fenced_node));
-	if (!nodes)
-		return -ENOMEM;
-	memset(nodes, 0, sizeof(*nodes));
-
-	nodep = nodes;
-	for (i = 0; i < cb_member_count; i++) {
-		set_node_info_group(fd, cb_members[i], nodep++);
-	}
- out:
-	*node_count = cb_member_count;
-	*nodes_out = nodes;
-	return 0;
-}
-
-int set_group_mode(void)
-{
-	int i = 0, rv, version, limit;
-
-	while (1) {
-		rv = group_get_version(&version);
-
-		if (rv || version < 0) {
-			/* we expect to get version of -EAGAIN while groupd
-			   is detecting the mode of everyone; don't retry
-			   as long if we're not getting anything back from
-			   groupd */
-
-			log_debug("set_group_mode get_version %d ver %d",
-				  rv, version);
-
-			limit = (version == -EAGAIN) ? 30 : 5;
-
-			if (i++ > limit) {
-				log_error("cannot get groupd compatibility "
-					  "mode rv %d ver %d", rv, version);
-				return -1;
-			}
-			sleep(1);
-			continue;
-		}
-
-
-		if (version == GROUP_LIBGROUP) {
-			group_mode = GROUP_LIBGROUP;
-			return 0;
-		} else if (version == GROUP_LIBCPG) {
-			group_mode = GROUP_LIBCPG;
-			return 0;
-		} else {
-			log_error("set_group_mode invalid ver %d", version);
-			return -1;
-		}
-	}
-}
-
diff --git a/fence/fenced/logging.c b/fence/fenced/logging.c
deleted file mode 100644
index a6a1a66..0000000
--- a/fence/fenced/logging.c
+++ /dev/null
@@ -1,61 +0,0 @@
-#include "fd.h"
-#include "config.h"
-#include "ccs.h"
-
-extern int ccs_handle;
-
-#define DAEMON_NAME "fenced"
-#define DEFAULT_LOG_MODE LOG_MODE_OUTPUT_FILE|LOG_MODE_OUTPUT_SYSLOG
-#define DEFAULT_SYSLOG_FACILITY		SYSLOGFACILITY
-#define DEFAULT_SYSLOG_PRIORITY		SYSLOGLEVEL
-#define DEFAULT_LOGFILE_PRIORITY	LOG_INFO /* ? */
-#define DEFAULT_LOGFILE			LOGDIR "/" DAEMON_NAME ".log"
-
-static int log_mode;
-static int syslog_facility;
-static int syslog_priority;
-static int logfile_priority;
-static char logfile[PATH_MAX];
-
-void init_logging(void)
-{
-	log_mode = DEFAULT_LOG_MODE;
-	syslog_facility = DEFAULT_SYSLOG_FACILITY;
-	syslog_priority = DEFAULT_SYSLOG_PRIORITY;
-	logfile_priority = DEFAULT_LOGFILE_PRIORITY;
-	strcpy(logfile, DEFAULT_LOGFILE);
-
-	/* logfile_priority is the only one of these options that
-	   can be controlled from command line or environment variable */
-
-	if (cfgd_debug_logfile)
-		logfile_priority = LOG_DEBUG;
-
-	log_debug("logging mode %d syslog f %d p %d logfile p %d %s",
-		  log_mode, syslog_facility, syslog_priority,
-		  logfile_priority, logfile);
-
-	logt_init(DAEMON_NAME, log_mode, syslog_facility, syslog_priority,
-		  logfile_priority, logfile);
-}
-
-void setup_logging(void)
-{
-	ccs_read_logging(ccs_handle, DAEMON_NAME,
-			 &cfgd_debug_logfile, &log_mode,
-			 &syslog_facility, &syslog_priority,
-			 &logfile_priority, logfile);
-
-	log_debug("logging mode %d syslog f %d p %d logfile p %d %s",
-		  log_mode, syslog_facility, syslog_priority,
-		  logfile_priority, logfile);
-
-	logt_conf(DAEMON_NAME, log_mode, syslog_facility, syslog_priority,
-		  logfile_priority, logfile);
-}
-
-void close_logging(void)
-{
-	logt_exit();
-}
-
diff --git a/fence/fenced/main.c b/fence/fenced/main.c
deleted file mode 100644
index ceacdd8..0000000
--- a/fence/fenced/main.c
+++ /dev/null
@@ -1,1076 +0,0 @@
-#include "fd.h"
-#include "config.h"
-#include <pthread.h>
-#include "copyright.cf"
-
-#define LOCKFILE_NAME		"/var/run/fenced.pid"
-#define CLIENT_NALLOC		32
-
-static int client_maxi;
-static int client_size = 0;
-static struct client *client = NULL;
-static struct pollfd *pollfd = NULL;
-static pthread_t query_thread;
-static pthread_mutex_t query_mutex;
-static struct list_head controlled_entries;
-
-struct client {
-	int fd;
-	void *workfn;
-	void *deadfn;
-};
-
-static int do_read(int fd, void *buf, size_t count)
-{
-	int rv, off = 0;
-
-	while (off < count) {
-		rv = read(fd, buf + off, count - off);
-		if (rv == 0)
-			return -1;
-		if (rv == -1 && errno == EINTR)
-			continue;
-		if (rv == -1)
-			return -1;
-		off += rv;
-	}
-	return 0;
-}
-
-static int do_write(int fd, void *buf, size_t count)
-{
-	int rv, off = 0;
-
- retry:
-	rv = write(fd, buf + off, count);
-	if (rv == -1 && errno == EINTR)
-		goto retry;
-	if (rv < 0) {
-		return rv;
-	}
-
-	if (rv != count) {
-		count -= rv;
-		off += rv;
-		goto retry;
-	}
-	return 0;
-}
-
-static void client_alloc(void)
-{
-	int i;
-
-	if (!client) {
-		client = malloc(CLIENT_NALLOC * sizeof(struct client));
-		pollfd = malloc(CLIENT_NALLOC * sizeof(struct pollfd));
-	} else {
-		client = realloc(client, (client_size + CLIENT_NALLOC) *
-					 sizeof(struct client));
-		pollfd = realloc(pollfd, (client_size + CLIENT_NALLOC) *
-					 sizeof(struct pollfd));
-		if (!pollfd)
-			log_error("can't alloc for pollfd");
-	}
-	if (!client || !pollfd)
-		log_error("can't alloc for client array");
-
-	for (i = client_size; i < client_size + CLIENT_NALLOC; i++) {
-		client[i].workfn = NULL;
-		client[i].deadfn = NULL;
-		client[i].fd = -1;
-		pollfd[i].fd = -1;
-		pollfd[i].revents = 0;
-	}
-	client_size += CLIENT_NALLOC;
-}
-
-void client_dead(int ci)
-{
-	close(client[ci].fd);
-	client[ci].workfn = NULL;
-	client[ci].fd = -1;
-	pollfd[ci].fd = -1;
-}
-
-int client_add(int fd, void (*workfn)(int ci), void (*deadfn)(int ci))
-{
-	int i;
-
-	if (!client)
-		client_alloc();
- again:
-	for (i = 0; i < client_size; i++) {
-		if (client[i].fd == -1) {
-			client[i].workfn = workfn;
-			if (deadfn)
-				client[i].deadfn = deadfn;
-			else
-				client[i].deadfn = client_dead;
-			client[i].fd = fd;
-			pollfd[i].fd = fd;
-			pollfd[i].events = POLLIN;
-			if (i > client_maxi)
-				client_maxi = i;
-			return i;
-		}
-	}
-
-	client_alloc();
-	goto again;
-}
-
-static void sigterm_handler(int sig)
-{
-	daemon_quit = 1;
-}
-
-static struct fd *create_fd(char *name)
-{
-	struct fd *fd;
-
-	if (strlen(name) > MAX_GROUPNAME_LEN)
-		return NULL;
-
-	fd = malloc(sizeof(struct fd));
-	if (!fd)
-		return NULL;
-
-	memset(fd, 0, sizeof(struct fd));
-	strcpy(fd->name, name);
-
-	INIT_LIST_HEAD(&fd->changes);
-	INIT_LIST_HEAD(&fd->node_history);
-	INIT_LIST_HEAD(&fd->victims);
-	INIT_LIST_HEAD(&fd->complete);
-	INIT_LIST_HEAD(&fd->prev);
-	INIT_LIST_HEAD(&fd->leaving);
-
-	return fd;
-}
-
-void free_fd(struct fd *fd)
-{
-	struct change *cg, *cg_safe;
-	struct node_history *nodeh, *nodeh_safe;
-
-	list_for_each_entry_safe(cg, cg_safe, &fd->changes, list) {
-		list_del(&cg->list);
-		free_cg(cg);
-	}
-	if (fd->started_change)
-		free_cg(fd->started_change);
-
-	list_for_each_entry_safe(nodeh, nodeh_safe, &fd->node_history, list) {
-		list_del(&nodeh->list);
-		free(nodeh);
-	}
-
-	free_node_list(&fd->victims);
-	free_node_list(&fd->complete);
-	free_node_list(&fd->prev);
-	free_node_list(&fd->leaving);
-
-	free(fd);
-}
-
-struct fd *find_fd(char *name)
-{
-	struct fd *fd;
-
-	list_for_each_entry(fd, &domains, list) {
-		if (strlen(name) == strlen(fd->name) &&
-		    !strncmp(fd->name, name, strlen(name)))
-			return fd;
-	}
-	return NULL;
-}
-
-/* We don't require cman dirty/disallowed to detect and handle cpg merges after
-   a partition, because we already do that with started_count checks and our
-   own disallowed flag.  But, we do need cman dirty/disallowed to deal with
-   correctly skipping victims that rejoin the cluster.  Without cman
-   dirty/disallowed, we'd skip fencing a node after a merge of a partition
-   since the merged node would be a cman member and a fenced:daemon cpg member.
-   By setting the dirty flag, cman won't report a dirty merged node as a
-   member, so we'll continue fencing it. */
-
-static int do_join(char *name)
-{
-	struct fd *fd;
-	int rv;
-
-	fd = find_fd(name);
-	if (fd) {
-		log_debug("join error: domain %s exists", name);
-		rv = -EEXIST;
-		goto out;
-	}
-
-	fd = create_fd(name);
-	if (!fd) {
-		rv = -ENOMEM;
-		goto out;
-	}
-
-	rv = read_ccs(fd);
-	if (rv) {
-		free(fd);
-		goto out;
-	}
-
-	if (group_mode == GROUP_LIBGROUP)
-		rv = fd_join_group(fd);
-	else
-		rv = fd_join(fd);
-
-	if (!rv)
-		set_cman_dirty();
- out:
-	return rv;
-}
-
-static int do_leave(char *name)
-{
-	struct fd *fd;
-	int rv;
-
-	fd = find_fd(name);
-	if (!fd)
-		return -EINVAL;
-
-	if (group_mode == GROUP_LIBGROUP)
-		rv = fd_leave_group(fd);
-	else
-		rv = fd_leave(fd);
-
-	return rv;
-}
-
-static int do_external(char *name, char *extra, int extra_len)
-{
-	struct fd *fd;
-	int rv = 0;
-
-	fd = find_fd(name);
-	if (!fd)
-		return -EINVAL;
-
-	if (group_mode == GROUP_LIBGROUP)
-		rv = -ENOSYS;
-	else
-		send_external(fd, name_to_nodeid(extra));
-
-	return rv;
-}
-
-static void init_header(struct fenced_header *h, int cmd, int result,
-			int extra_len)
-{
-	memset(h, 0, sizeof(struct fenced_header));
-
-	h->magic = FENCED_MAGIC;
-	h->version = FENCED_VERSION;
-	h->len = sizeof(struct fenced_header) + extra_len;
-	h->command = cmd;
-	h->data = result;
-}
-
-/* combines a header and the data and sends it back to the client in
-   a single do_write() call */
-
-static void do_reply(int f, int cmd, int result, char *buf, int buflen)
-{
-	char *reply;
-	int reply_len;
-
-	reply_len = sizeof(struct fenced_header) + buflen;
-	reply = malloc(reply_len);
-	if (!reply)
-		return;
-	memset(reply, 0, reply_len);
-
-	init_header((struct fenced_header *)reply, cmd, result, buflen);
-
-	if (buf && buflen)
-		memcpy(reply + sizeof(struct fenced_header), buf, buflen);
-
-	do_write(f, reply, reply_len);
-
-	free(reply);
-}
-
-static void query_dump_debug(int f)
-{
-	struct fenced_header h;
-	int extra_len;
-	int len;
-
-	/* in the case of dump_wrap, extra_len will go in two writes,
-	   first the log tail, then the log head */
-	if (dump_wrap)
-		extra_len = FENCED_DUMP_SIZE;
-	else
-		extra_len = dump_point;
-
-	init_header(&h, FENCED_CMD_DUMP_DEBUG, 0, extra_len);
-	do_write(f, &h, sizeof(h));
-
-	if (dump_wrap) {
-		len = FENCED_DUMP_SIZE - dump_point;
-		do_write(f, dump_buf + dump_point, len);
-		len = dump_point;
-	} else
-		len = dump_point;
-
-	/* NUL terminate the debug string */
-	dump_buf[dump_point] = '\0';
-
-	do_write(f, dump_buf, len);
-}
-
-static void query_node_info(int f, int data_nodeid)
-{
-	struct fd *fd;
-	struct fenced_node node;
-	int nodeid, rv;
-
-	fd = find_fd("default");
-	if (!fd) {
-		rv = -ENOENT;
-		goto out;
-	}
-
-	if (data_nodeid == FENCED_NODEID_US)
-		nodeid = our_nodeid;
-	else
-		nodeid = data_nodeid;
-
-	if (group_mode == GROUP_LIBGROUP)
-		rv = set_node_info_group(fd, nodeid, &node);
-	else
-		rv = set_node_info(fd, nodeid, &node);
- out:
-	do_reply(f, FENCED_CMD_NODE_INFO, rv, (char *)&node, sizeof(node));
-}
-
-static void query_domain_info(int f)
-{
-	struct fd *fd;
-	struct fenced_domain domain;
-	int rv;
-
-	fd = find_fd("default");
-	if (!fd) {
-		rv = -ENOENT;
-		goto out;
-	}
-
-	memset(&domain, 0, sizeof(domain));
-	domain.group_mode = group_mode;
-
-	if (group_mode == GROUP_LIBGROUP)
-		rv = set_domain_info_group(fd, &domain);
-	else
-		rv = set_domain_info(fd, &domain);
- out:
-	do_reply(f, FENCED_CMD_DOMAIN_INFO, rv, (char *)&domain, sizeof(domain));
-}
-
-static void query_domain_nodes(int f, int option, int max)
-{
-	struct fd *fd;
-	int node_count = 0;
-	struct fenced_node *nodes = NULL;
-	int rv, result;
-
-	fd = find_fd("default");
-	if (!fd) {
-		result = -ENOENT;
-		node_count = 0;
-		goto out;
-	}
-
-	if (group_mode == GROUP_LIBGROUP)
-		rv = set_domain_nodes_group(fd, option, &node_count, &nodes);
-	else
-		rv = set_domain_nodes(fd, option, &node_count, &nodes);
-
-	if (rv < 0) {
-		result = rv;
-		node_count = 0;
-		goto out;
-	}
-
-	/* node_count is the number of structs copied/returned; the caller's
-	   max may be less than that, in which case we copy as many as they
-	   asked for and return -E2BIG */
-
-	if (node_count > max) {
-		result = -E2BIG;
-		node_count = max;
-	} else {
-		result = node_count;
-	}
- out:
-	do_reply(f, FENCED_CMD_DOMAIN_NODES, result,
-	         (char *)nodes, node_count * sizeof(struct fenced_node));
-
-	if (nodes)
-		free(nodes);
-}
-
-static void process_connection(int ci)
-{
-	struct fenced_header h;
-	char *extra = NULL;
-	int rv, extra_len;
-
-	rv = do_read(client[ci].fd, &h, sizeof(h));
-	if (rv < 0) {
-		log_debug("connection %d read error %d", ci, rv);
-		goto out;
-	}
-
-	if (h.magic != FENCED_MAGIC) {
-		log_debug("connection %d magic error %x", ci, h.magic);
-		goto out;
-	}
-
-	if ((h.version & 0xFFFF0000) != (FENCED_VERSION & 0xFFFF0000)) {
-		log_debug("connection %d version error %x", ci, h.version);
-		goto out;
-	}
-
-	if (h.len > sizeof(h)) {
-		extra_len = h.len - sizeof(h);
-		extra = malloc(extra_len);
-		if (!extra) {
-			log_error("process_connection no mem %d", extra_len);
-			goto out;
-		}
-		memset(extra, 0, extra_len);
-
-		rv = do_read(client[ci].fd, extra, extra_len);
-		if (rv < 0) {
-			log_debug("connection %d extra read error %d", ci, rv);
-			goto out;
-		}
-	}
-
-	switch (h.command) {
-	case FENCED_CMD_JOIN:
-		do_join("default");
-		break;
-	case FENCED_CMD_LEAVE:
-		do_leave("default");
-		break;
-	case FENCED_CMD_EXTERNAL:
-		do_external("default", extra, extra_len);
-		break;
-	case FENCED_CMD_DUMP_DEBUG:
-	case FENCED_CMD_NODE_INFO:
-	case FENCED_CMD_DOMAIN_INFO:
-	case FENCED_CMD_DOMAIN_NODES:
-		log_error("process_connection query on wrong socket");
-		break;
-	default:
-		log_error("process_connection %d unknown command %d",
-			  ci, h.command);
-	}
- out:
-	if (extra)
-		free(extra);
-	client_dead(ci);
-}
-
-static void process_listener(int ci)
-{
-	int fd, i;
-
-	fd = accept(client[ci].fd, NULL, NULL);
-	if (fd < 0) {
-		log_error("process_listener: accept error %d %d", fd, errno);
-		return;
-	}
-	
-	i = client_add(fd, process_connection, NULL);
-
-	log_debug("client connection %d fd %d", i, fd);
-}
-
-static int setup_listener(char *sock_path)
-{
-	struct sockaddr_un addr;
-	socklen_t addrlen;
-	int rv, s;
-
-	/* we listen for new client connections on socket s */
-
-	s = socket(AF_LOCAL, SOCK_STREAM, 0);
-	if (s < 0) {
-		log_error("socket error %d %d", s, errno);
-		return s;
-	}
-
-	memset(&addr, 0, sizeof(addr));
-	addr.sun_family = AF_LOCAL;
-	strcpy(&addr.sun_path[1], sock_path);
-	addrlen = sizeof(sa_family_t) + strlen(addr.sun_path+1) + 1;
-
-	rv = bind(s, (struct sockaddr *) &addr, addrlen);
-	if (rv < 0) {
-		log_error("bind error %d %d", rv, errno);
-		close(s);
-		return rv;
-	}
-
-	rv = listen(s, 5);
-	if (rv < 0) {
-		log_error("listen error %d %d", rv, errno);
-		close(s);
-		return rv;
-	}
-	return s;
-}
-
-void query_lock(void)
-{
-	pthread_mutex_lock(&query_mutex);
-}
-
-void query_unlock(void)
-{
-	pthread_mutex_unlock(&query_mutex);
-}
-
-/* This is a thread, so we have to be careful, don't call log_ functions.
-   We need a thread to process queries because the main thread will block
-   for long periods when running fence agents. */
-
-static void *process_queries(void *arg)
-{
-	struct fenced_header h;
-	int f, rv, s;
-
-	rv = setup_listener(FENCED_QUERY_SOCK_PATH);
-	if (rv < 0)
-		exit (-1);
-
-	s = rv;
-
-	for (;;) {
-		f = accept(s, NULL, NULL);
-		if (f < 0)
-			exit (-1);
-
-		rv = do_read(f, &h, sizeof(h));
-		if (rv < 0) {
-			goto out;
-		}
-
-		if (h.magic != FENCED_MAGIC) {
-			goto out;
-		}
-
-		if ((h.version & 0xFFFF0000) != (FENCED_VERSION & 0xFFFF0000)) {
-			goto out;
-		}
-
-		query_lock();
-
-		switch (h.command) {
-		case FENCED_CMD_DUMP_DEBUG:
-			query_dump_debug(f);
-			break;
-		case FENCED_CMD_NODE_INFO:
-			query_node_info(f, h.data);
-			break;
-		case FENCED_CMD_DOMAIN_INFO:
-			query_domain_info(f);
-			break;
-		case FENCED_CMD_DOMAIN_NODES:
-			query_domain_nodes(f, h.option, h.data);
-			break;
-		default:
-			break;
-		}
-		query_unlock();
-
- out:
-		close(f);
-	}
-}
-
-static int setup_queries(void)
-{
-	int rv;
-
-	pthread_mutex_init(&query_mutex, NULL);
-
-	rv = pthread_create(&query_thread, NULL, process_queries, NULL);
-	if (rv < 0) {
-		log_error("can't create query thread");
-		return rv;
-	}
-	return 0;
-}
-
-struct controlled_entry {
-	struct list_head list;
-	char path[PATH_MAX+1];
-};
-
-static void register_controlled_dir(char *path)
-{
-	struct controlled_entry *ce;
-
-	ce = malloc(sizeof(struct controlled_entry));
-	if (!ce)
-		return;
-	memset(ce, 0, sizeof(struct controlled_entry));
-	strncpy(ce->path, path, PATH_MAX);
-	list_add(&ce->list, &controlled_entries);
-}
-
-static int ignore_nolock(char *sysfs_dir, char *table)
-{
-	char path[PATH_MAX];
-	int fd;
-
-	memset(path, 0, PATH_MAX);
-
-	snprintf(path, PATH_MAX, "%s/%s/lock_module/proto_name",
-		 sysfs_dir, table);
-
-	/* lock_nolock doesn't create the "lock_module" dir at all,
-	   so we'll fail to open this */
-
-	fd = open(path, O_RDONLY);
-	if (fd < 0)
-		return 1;
-
-	close(fd);
-	return 0;
-}
-
-static int check_controlled_dir(char *path)
-{
-	DIR *d;
-	struct dirent *de;
-	int count = 0;
-
-	d = opendir(path);
-	if (!d)
-		return 0;
-
-	while ((de = readdir(d))) {
-		if (de->d_name[0] == '.')
-			continue;
-
-		if (strstr(path, "fs/gfs") && ignore_nolock(path, de->d_name))
-			continue;
-
-		log_error("found uncontrolled entry %s/%s", path, de->d_name);
-		count++;
-	}
-	closedir(d);
-
-	return count;
-}
-
-/* Joining the "fenced:daemon" cpg (in setup_cpg()) tells fenced on other
-   nodes that we are in a "clean state", and don't need fencing.  So, if
-   we're a pending fence victim on another node, they'll skip fencing us
-   once we start fenced and join the "daemon" cpg (it's not the fence domain
-   cpg which we join when fence_tool join is run).  This "daemon" cpg is just
-   to notify others that we have no uncontrolled gfs/dlm objects.
-   (Conceptually, we could use the fence domain cpg for this purpose instead,
-   but that would require processing domain membership changes during
-   fence_victims(), which would be a major change in the way the daemon works.)
-
-   So, if we (the local node) are *not* in a clean state, we don't join the
-   daemon cpg and we exit; we still need to be fenced.  If we are starting
-   up and find that instances of gfs/dlm in the kernel have been previously
-   abandoned, that's an unclean, unreset state, and we still need fencing. */
-
-static int check_uncontrolled_entries(void)
-{
-	struct controlled_entry *ce;
-	int count = 0;
-
-	list_for_each_entry(ce, &controlled_entries, list) {
-		if (strncmp(ce->path, "-", 1))
-			goto skip_default;
-	}
-
-	/* the default dirs to check */
-	register_controlled_dir("/sys/kernel/dlm");
-	register_controlled_dir("/sys/fs/gfs2");
-	register_controlled_dir("/sys/fs/gfs");
-
- skip_default:
-	list_for_each_entry(ce, &controlled_entries, list)
-		count += check_controlled_dir(ce->path);
-
-	if (count)
-		return -1;
-	return 0;
-}
-
-void cluster_dead(int ci)
-{
-	if (!cluster_down)
-		log_error("cluster is down, exiting");
-	daemon_quit = 1;
-	cluster_down = 1;
-}
-
-static void loop(void)
-{
-	int rv, i;
-	void (*workfn) (int ci);
-	void (*deadfn) (int ci);
-
-	rv = setup_queries();
-	if (rv < 0)
-		goto out;
-
-	rv = setup_listener(FENCED_SOCK_PATH);
-	if (rv < 0)
-		goto out;
-	client_add(rv, process_listener, NULL);
-
-	rv = setup_cman();
-	if (rv < 0)
-		goto out;
-	client_add(rv, process_cman, cluster_dead);
-
-	rv = setup_ccs();
-	if (rv < 0)
-		goto out;
-
-	setup_logging();
-
-	rv = check_uncontrolled_entries();
-	if (rv < 0)
-		goto out;
-
-	rv = setup_cpg();
-	if (rv < 0)
-		goto out;
-	client_add(rv, process_cpg, cluster_dead);
-
-	group_mode = GROUP_LIBCPG;
-
-	if (cfgd_groupd_compat) {
-		rv = setup_groupd();
-		if (rv < 0)
-			goto out;
-		client_add(rv, process_groupd, cluster_dead);
-
-		switch (cfgd_groupd_compat) {
-		case 1:
-			group_mode = GROUP_LIBGROUP;
-			rv = 0;
-			break;
-		case 2:
-			rv = set_group_mode();
-			break;
-		default:
-			log_error("inval groupd_compat %d", cfgd_groupd_compat);
-			rv = -1;
-			break;
-		}
-		if (rv < 0)
-			goto out;
-	}
-	log_debug("group_mode %d compat %d", group_mode, cfgd_groupd_compat);
-
-	if (group_mode == GROUP_LIBCPG) {
-		rv = set_protocol();
-		if (rv < 0)
-			goto out;
-	}
-
-	for (;;) {
-		rv = poll(pollfd, client_maxi + 1, -1);
-		if (rv == -1 && errno == EINTR) {
-			if (daemon_quit && list_empty(&domains))
-				goto out;
-			daemon_quit = 0;
-			continue;
-		}
-		if (rv < 0) {
-			log_error("poll errno %d", errno);
-			goto out;
-		}
-
-		query_lock();
-
-		for (i = 0; i <= client_maxi; i++) {
-			if (client[i].fd < 0)
-				continue;
-			if (pollfd[i].revents & POLLIN) {
-				workfn = client[i].workfn;
-				workfn(i);
-			}
-			if (pollfd[i].revents & (POLLERR | POLLHUP | POLLNVAL)) {
-				deadfn = client[i].deadfn;
-				deadfn(i);
-			}
-		}
-		query_unlock();
-
-		if (daemon_quit)
-			break;
-	}
- out:
-	if (cfgd_groupd_compat)
-		close_groupd();
-	close_cpg();
-	close_logging();
-	close_ccs();
-	close_cman();
-
-	if (!list_empty(&domains))
-		log_error("domain abandoned");
-}
-
-static void lockfile(void)
-{
-	int fd, error;
-	struct flock lock;
-	char buf[33];
-
-	memset(buf, 0, 33);
-
-	fd = open(LOCKFILE_NAME, O_CREAT|O_WRONLY,
-		  S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
-	if (fd < 0) {
-		fprintf(stderr, "cannot open/create lock file %s\n",
-			LOCKFILE_NAME);
-		exit(EXIT_FAILURE);
-	}
-
-	lock.l_type = F_WRLCK;
-	lock.l_start = 0;
-	lock.l_whence = SEEK_SET;
-	lock.l_len = 0;
-
-	error = fcntl(fd, F_SETLK, &lock);
-	if (error) {
-		fprintf(stderr, "is already running\n");
-		exit(EXIT_FAILURE);
-	}
-
-	error = ftruncate(fd, 0);
-	if (error) {
-		fprintf(stderr, "cannot clear lock file %s\n", LOCKFILE_NAME);
-		exit(EXIT_FAILURE);
-	}
-
-	sprintf(buf, "%d\n", getpid());
-
-	error = write(fd, buf, strlen(buf));
-	if (error <= 0) {
-		fprintf(stderr, "cannot write lock file %s\n", LOCKFILE_NAME);
-		exit(EXIT_FAILURE);
-	}
-}
-
-static void print_usage(void)
-{
-	printf("Usage:\n");
-	printf("\n");
-	printf("fenced [options]\n");
-	printf("\n");
-	printf("Options:\n");
-	printf("\n");
-	printf("  -D           Enable debugging to stderr and don't fork\n");
-	printf("  -L           Enable debugging to log file\n");
-	printf("  -g <num>     groupd compatibility mode, 0 off, 1 on, 2 detect (default %d)\n", DEFAULT_GROUPD_COMPAT);
-	printf("               0: use libcpg, no backward compat, best performance\n");
-	printf("               1: use libgroup for compat with cluster2/rhel5\n");
-	printf("               2: use groupd to detect old, or mode 1, nodes that\n"
-	       "               require compat, use libcpg if none found\n");
-	printf("  -r <path>    Register a directory that needs to be empty for\n");
-	printf("               the daemon to start.  \"-\" to skip default directories\n");
-	printf("               /sys/fs/gfs, /sys/fs/gfs2, /sys/kernel/dlm\n");
-	printf("  -c           All nodes are in a clean state to start; do no startup fencing\n");
-	printf("  -s           Skip startup fencing of nodes with no defined fence methods\n");
-	printf("  -j <secs>    Post-join fencing delay (default %d)\n", DEFAULT_POST_JOIN_DELAY);
-	printf("  -f <secs>    Post-fail fencing delay (default %d)\n", DEFAULT_POST_FAIL_DELAY);
-	printf("  -R <secs>    Override time (default %d)\n", DEFAULT_OVERRIDE_TIME);
-
-	printf("  -O <path>    Override path (default %s)\n", DEFAULT_OVERRIDE_PATH);
-	printf("  -h           Print this help, then exit\n");
-	printf("  -V           Print program version information, then exit\n");
-	printf("\n");
-	printf("Command line values override those in " DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE ".\n");
-	printf("For an unbounded delay use <secs> value of -1.\n");
-	printf("\n");
-}
-
-#define OPTION_STRING	"Lg:cj:f:Dn:O:hVSse:r:"
-
-static void read_arguments(int argc, char **argv)
-{
-	int cont = 1;
-	int optchar;
-
-	while (cont) {
-		optchar = getopt(argc, argv, OPTION_STRING);
-
-		switch (optchar) {
-
-		case 'D':
-			daemon_debug_opt = 1;
-			break;
-
-		case 'L':
-			optd_debug_logfile = 1;
-			cfgd_debug_logfile = 1;
-			break;
-
-		case 'g':
-			optd_groupd_compat = 1;
-			cfgd_groupd_compat = atoi(optarg);
-			break;
-
-		case 'c':
-			optd_clean_start = 1;
-			cfgd_clean_start = 1;
-			break;
-
-		case 's':
-			optd_skip_undefined = 1;
-			cfgd_skip_undefined = 1;
-			break;
-
-		case 'j':
-			optd_post_join_delay = 1;
-			cfgd_post_join_delay = atoi(optarg);
-			break;
-
-		case 'f':
-			optd_post_fail_delay = 1;
-			cfgd_post_fail_delay = atoi(optarg);
-			break;
-
-		case 'R':
-			optd_override_time = 1;
-			cfgd_override_time = atoi(optarg);
-			if (cfgd_override_time < 3)
-				cfgd_override_time = 3;
-			break;
-
-		case 'O':
-			optd_override_path = 1;
-			cfgd_override_path = strdup(optarg);
-			break;
-
-		case 'r':
-			register_controlled_dir(optarg);
-			break;
-
-		case 'h':
-			print_usage();
-			exit(EXIT_SUCCESS);
-			break;
-
-		case 'V':
-			printf("fenced %s (built %s %s)\n", RELEASE_VERSION,
-				 __DATE__, __TIME__);
-			printf("%s\n", REDHAT_COPYRIGHT);
-			exit(EXIT_SUCCESS);
-			break;
-
-		case ':':
-		case '?':
-			fprintf(stderr, "Please use '-h' for usage.\n");
-			exit(EXIT_FAILURE);
-			break;
-
-		case EOF:
-			cont = 0;
-			break;
-
-		default:
-			fprintf(stderr, "unknown option: %c", optchar);
-			exit(EXIT_FAILURE);
-		};
-	}
-
-	if (getenv("FENCED_DEBUG")) {
-		optd_debug_logfile = 1;
-		cfgd_debug_logfile = 1;
-	}
-}
-
-static void set_oom_adj(int val)
-{
-	FILE *fp;
-
-	fp = fopen("/proc/self/oom_adj", "w");
-	if (!fp)
-		return;
-
-	fprintf(fp, "%i", val);
-	fclose(fp);
-}
-
-int main(int argc, char **argv)
-{
-	INIT_LIST_HEAD(&domains);
-	INIT_LIST_HEAD(&controlled_entries);
-
-	read_arguments(argc, argv);
-	lockfile();
-
-	if (!daemon_debug_opt) {
-		if (daemon(0, 0) < 0) {
-			perror("main: cannot fork");
-			exit(EXIT_FAILURE);
-		}
-		umask(0);
-	}
-	init_logging();
-	log_level(LOG_INFO, "fenced %s", RELEASE_VERSION);
-	signal(SIGTERM, sigterm_handler);
-	set_oom_adj(-16);
-
-	loop();
-
-	return 0;
-}
-
-void daemon_dump_save(void)
-{
-	int len, i;
-
-	len = strlen(daemon_debug_buf);
-
-	for (i = 0; i < len; i++) {
-		dump_buf[dump_point++] = daemon_debug_buf[i];
-
-		if (dump_point == FENCED_DUMP_SIZE) {
-			dump_point = 0;
-			dump_wrap = 1;
-		}
-	}
-}
-
-int daemon_debug_opt;
-int daemon_quit;
-int cluster_down;
-struct list_head domains;
-int cman_quorate;
-int our_nodeid;
-char our_name[MAX_NODENAME_LEN+1];
-char daemon_debug_buf[256];
-char dump_buf[FENCED_DUMP_SIZE];
-int dump_point;
-int dump_wrap;
-int group_mode;
-
diff --git a/fence/fenced/member_cman.c b/fence/fenced/member_cman.c
deleted file mode 100644
index c99215d..0000000
--- a/fence/fenced/member_cman.c
+++ /dev/null
@@ -1,272 +0,0 @@
-#include "fd.h"
-#include "config.h"
-#include <libcman.h>
-
-#define BUFLEN		MAX_NODENAME_LEN+1
-
-static cman_handle_t	ch;
-static cman_handle_t	ch_admin;
-static cman_node_t	cman_nodes[MAX_NODES];
-static int		cman_node_count;
-
-void set_cman_dirty(void)
-{
-	int rv;
-
-	rv = cman_set_dirty(ch_admin);
-	if (rv)
-		log_error("cman_set_dirty error %d", rv);
-}
-
-void kick_node_from_cluster(int nodeid)
-{
-	if (!nodeid) {
-		log_error("telling cman to shut down cluster locally");
-		cman_shutdown(ch_admin, CMAN_SHUTDOWN_ANYWAY);
-	} else {
-		log_error("telling cman to remove nodeid %d from cluster",
-			  nodeid);
-		cman_kill_node(ch_admin, nodeid);
-	}
-}
-
-static int name_equal(char *name1, char *name2)
-{
-	char name3[BUFLEN], name4[BUFLEN];
-	int i, len1, len2;
-
-	len1 = strlen(name1);
-	len2 = strlen(name2);
-
-	if (len1 == len2 && !strncmp(name1, name2, len1))
-		return 1;
-
-	memset(name3, 0, BUFLEN);
-	memset(name4, 0, BUFLEN);
-
-	for (i = 0; i < BUFLEN && i < len1; i++) {
-		if (name1[i] != '.')
-			name3[i] = name1[i];
-		else
-			break;
-	}
-
-	for (i = 0; i < BUFLEN && i < len2; i++) {
-		if (name2[i] != '.')
-			name4[i] = name2[i];
-		else
-			break;
-	}
-
-	len1 = strlen(name3);
-	len2 = strlen(name4);
-
-	if (len1 == len2 && !strncmp(name3, name4, len1))
-		return 1;
-
-	return 0;
-}
-
-static cman_node_t *find_cman_node_name(char *name)
-{
-	int i;
-
-	for (i = 0; i < cman_node_count; i++) {
-		if (name_equal(cman_nodes[i].cn_name, name))
-			return &cman_nodes[i];
-	}
-	return NULL;
-}
-
-static cman_node_t *find_cman_node(int nodeid)
-{
-	int i;
-
-	for (i = 0; i < cman_node_count; i++) {
-		if (cman_nodes[i].cn_nodeid == nodeid)
-			return &cman_nodes[i];
-	}
-	return NULL;
-}
-
-char *nodeid_to_name(int nodeid)
-{
-	cman_node_t *cn;
-
-	cn = find_cman_node(nodeid);
-	if (cn)
-		return cn->cn_name;
-
-	return "unknown";
-}
-
-int name_to_nodeid(char *name)
-{
-	cman_node_t *cn;
-
-	cn = find_cman_node_name(name);
-	if (cn)
-		return cn->cn_nodeid;
-
-	return -1;
-}
-
-static void statechange(void)
-{
-	int rv;
-
-	cman_quorate = cman_is_quorate(ch);
-	cman_node_count = 0;
-	memset(&cman_nodes, 0, sizeof(cman_nodes));
-
-	rv = cman_get_nodes(ch, MAX_NODES, &cman_node_count, cman_nodes);
-	if (rv < 0)
-		log_error("cman_get_nodes error %d %d", rv, errno);
-}
-
-static void cman_callback(cman_handle_t h, void *private, int reason, int arg)
-{
-	int quorate = cman_quorate;
-
-	switch (reason) {
-	case CMAN_REASON_TRY_SHUTDOWN:
-		if (list_empty(&domains))
-			cman_replyto_shutdown(ch, 1);
-		else {
-			log_debug("no to cman shutdown");
-			cman_replyto_shutdown(ch, 0);
-		}
-		break;
-	case CMAN_REASON_STATECHANGE:
-		statechange();
-
-		/* domain may have been waiting for quorum */
-		if (!quorate && cman_quorate && (group_mode == GROUP_LIBCPG))
-			process_fd_changes();
-		break;
-
-	case CMAN_REASON_CONFIG_UPDATE:
-		setup_logging();
-		reread_ccs();
-		break;
-	}
-}
-
-void process_cman(int ci)
-{
-	int rv;
-
-	rv = cman_dispatch(ch, CMAN_DISPATCH_ALL);
-	if (rv == -1 && errno == EHOSTDOWN)
-		cluster_dead(0);
-}
-
-int setup_cman(void)
-{
-	cman_node_t node;
-	int rv, fd;
-	int init = 0, active = 0;
-
- retry_init:
-	ch_admin = cman_admin_init(NULL);
-	if (!ch_admin) {
-		if (init++ < 2) {
-			sleep(1);
-			goto retry_init;
-		}
-		log_error("cman_admin_init error %d", errno);
-		return -ENOTCONN;
-	}
-
-	ch = cman_init(NULL);
-	if (!ch) {
-		log_error("cman_init error %d", errno);
-		return -ENOTCONN;
-	}
-
- retry_active:
-	rv = cman_is_active(ch);
-	if (!rv) {
-		if (active++ < 2) {
-			sleep(1);
-			goto retry_active;
-		}
-		log_error("cman_is_active error %d", errno);
-		cman_finish(ch);
-		return -ENOTCONN;
-	}
-
-	rv = cman_start_notification(ch, cman_callback);
-	if (rv < 0) {
-		log_error("cman_start_notification error %d %d", rv, errno);
-		cman_finish(ch);
-		return rv;
-	}
-
-	statechange();
-
-	fd = cman_get_fd(ch);
-
-	/* FIXME: wait here for us to be a member of the cluster */
-	memset(&node, 0, sizeof(node));
-	rv = cman_get_node(ch, CMAN_NODEID_US, &node);
-	if (rv < 0) {
-		log_error("cman_get_node us error %d %d", rv, errno);
-		cman_finish(ch);
-		fd = rv;
-		goto out;
-	}
-
-	memset(our_name, 0, sizeof(our_name));
-	strncpy(our_name, node.cn_name, CMAN_MAX_NODENAME_LEN);
-	our_nodeid = node.cn_nodeid;
-
-	log_debug("our_nodeid %d our_name %s", our_nodeid, our_name);
- out:
-	return fd;
-}
-
-void close_cman(void)
-{
-	cman_finish(ch);
-}
-
-int is_cman_member(int nodeid)
-{
-	cman_node_t *cn;
-
-	/* Note: in fence delay loop we aren't processing callbacks so won't
-	   have done a statechange() in response to a cman callback */
-	statechange();
-
-	cn = find_cman_node(nodeid);
-	if (cn && cn->cn_member)
-		return 1;
-
-	log_debug("node %d not a cman member, cn %d", nodeid, cn ? 1 : 0);
-	return 0;
-}
-
-struct node *get_new_node(struct fd *fd, int nodeid)
-{
-	cman_node_t cn;
-	struct node *node;
-	int rv;
-
-	node = malloc(sizeof(*node));
-	if (!node)
-		return NULL;
-	memset(node, 0, sizeof(struct node));
-
-	node->nodeid = nodeid;
-
-	memset(&cn, 0, sizeof(cn));
-	rv = cman_get_node(ch, nodeid, &cn);
-	if (rv < 0)
-		log_debug("get_new_node %d no cman node %d", nodeid, rv);
-	else
-		strncpy(node->name, cn.cn_name, MAX_NODENAME_LEN);
-
-	return node;
-}
-
diff --git a/fence/fenced/recover.c b/fence/fenced/recover.c
deleted file mode 100644
index 5853117..0000000
--- a/fence/fenced/recover.c
+++ /dev/null
@@ -1,314 +0,0 @@
-#include "fd.h"
-#include "config.h"
-
-void free_node_list(struct list_head *head)
-{
-	struct node *node;
-
-	while (!list_empty(head)) {
-		node = list_entry(head->next, struct node, list);
-		list_del(&node->list);
-		free(node);
-	}
-}
-
-void add_complete_node(struct fd *fd, int nodeid)
-{
-	struct node *node;
-
-	node = get_new_node(fd, nodeid);
-	list_add(&node->list, &fd->complete);
-}
-
-int list_count(struct list_head *head)
-{
-	struct list_head *tmp;
-	int count = 0;
-
-	list_for_each(tmp, head)
-		count++;
-	return count;
-}
-
-int is_victim(struct fd *fd, int nodeid)
-{
-	struct node *node;
-
-	list_for_each_entry(node, &fd->victims, list) {
-		if (node->nodeid == nodeid)
-			return 1;
-	}
-	return 0;
-}
-
-static void victim_done(struct fd *fd, int victim, int how)
-{
-	if (group_mode == GROUP_LIBGROUP)
-		return;
-
-	node_history_fence(fd, victim, our_nodeid, how, time(NULL));
-	send_victim_done(fd, victim);
-}
-
-/* This routine should probe other indicators to check if victims
-   can be reduced.  Right now we just check if the victim has rejoined the
-   cluster. */
-
-static int reduce_victims(struct fd *fd)
-{
-	struct node *node, *safe;
-	int num_victims;
-
-	num_victims = list_count(&fd->victims);
-
-	list_for_each_entry_safe(node, safe, &fd->victims, list) {
-		if (is_cman_member(node->nodeid) &&
-		    in_daemon_member_list(node->nodeid)) {
-			log_debug("reduce victim %s", node->name);
-			victim_done(fd, node->nodeid, VIC_DONE_MEMBER);
-			list_del(&node->list);
-			free(node);
-			num_victims--;
-		}
-	}
-
-	return num_victims;
-}
-
-static inline void close_override(int *fd, char *path)
-{
-	unlink(path);
-	if (fd) {
-		if (*fd >= 0)
-			close(*fd);
-		*fd = -1;
-	}
-}
-
-static int open_override(char *path)
-{
-	int ret;
-	mode_t om;
-
-	om = umask(077);
-	ret = mkfifo(path, (S_IRUSR | S_IWUSR));
-	umask(om);
-
-	if (ret < 0)
-		return -1;
-        return open(path, O_RDONLY | O_NONBLOCK);
-}
-
-static int check_override(int ofd, char *nodename, int timeout)
-{
-	char buf[128];
-	fd_set rfds;
-	struct timeval tv = {0, 0};
-	int ret, x, rv;
-
-	query_unlock();
-
-	if (ofd < 0 || !nodename || !strlen(nodename)) {
-		sleep(timeout);
-		rv = 0;
-		goto out;
-	}
-
-	FD_ZERO(&rfds);
-	FD_SET(ofd, &rfds);
-	tv.tv_usec = 0;
-	tv.tv_sec = timeout;
-
-	ret = select(ofd + 1, &rfds, NULL, NULL, &tv);
-	if (ret < 0) {
-		log_debug("check_override select: %s", strerror(errno));
-		rv = -1;
-		goto out;
-	}
-
-	if (ret == 0) {
-		rv = 0;
-		goto out;
-	}
-
-	memset(buf, 0, sizeof(buf));
-	ret = read(ofd, buf, sizeof(buf) - 1);
-	if (ret < 0) {
-		log_debug("check_override read: %s", strerror(errno));
-		rv = -1;
-		goto out;
-	}
-
-	/* chop off control characters */
-	for (x = 0; x < ret; x++) {
-		if (buf[x] < 0x20) {
-			buf[x] = 0;
-			break;
-		}
-	}
-
-	if (!strcasecmp(nodename, buf)) {
-		/* Case insensitive, but not as nice as, say, name_equal
-		   in the other file... */
-		rv = 1;
-		goto out;
-	}
-
-	rv = 0;
- out:
-	query_lock();
-	return rv;
-}
-
-/* If there are victims after a node has joined, it's a good indication that
-   they may be joining the cluster shortly.  If we delay a bit they might
-   become members and we can avoid fencing them.  This is only really an issue
-   when the fencing method reboots the victims.  Otherwise, the nodes should
-   unfence themselves when they start up. */
-
-void delay_fencing(struct fd *fd, int node_join)
-{
-	struct timeval first, last, start, now;
-	int victim_count, last_count = 0, delay = 0;
-	struct node *node;
-	char *delay_type;
-
-	if (list_empty(&fd->victims))
-		return;
-
-	if (node_join) {
-		delay = cfgd_post_join_delay;
-		delay_type = "post_join_delay";
-	} else {
-		delay = cfgd_post_fail_delay;
-		delay_type = "post_fail_delay";
-	}
-
-	if (delay == 0)
-		goto out;
-
-	gettimeofday(&first, NULL);
-	gettimeofday(&start, NULL);
-
-	for (;;) {
-		query_unlock();
-		sleep(1);
-		query_lock();
-
-		victim_count = reduce_victims(fd);
-
-		if (victim_count == 0)
-			break;
-
-		if (victim_count < last_count) {
-			gettimeofday(&start, NULL);
-			if (delay > 0 && cfgd_post_join_delay > delay) {
-				delay = cfgd_post_join_delay;
-				delay_type = "post_join_delay (modified)";
-			}
-		}
-
-		last_count = victim_count;
-
-		/* negative delay means wait forever */
-		if (delay == -1)
-			continue;
-
-		gettimeofday(&now, NULL);
-		if (now.tv_sec - start.tv_sec >= delay)
-			break;
-	}
-
-	gettimeofday(&last, NULL);
-
-	log_debug("delay of %ds leaves %d victims",
-		  (int) (last.tv_sec - first.tv_sec), victim_count);
- out:
-	list_for_each_entry(node, &fd->victims, list) {
-		log_debug("%s not a cluster member after %d sec %s",
-		          node->name, delay, delay_type);
-	}
-}
-
-void defer_fencing(struct fd *fd)
-{
-	char *master_name;
-
-	if (list_empty(&fd->victims))
-		return;
-
-	master_name = nodeid_to_name(fd->master);
-
-	log_level(LOG_INFO, "fencing deferred to %s", master_name);
-}
-
-void fence_victims(struct fd *fd)
-{
-	struct node *node;
-	int error;
-	int override = -1;
-	int cman_member, cpg_member, ext;
-
-	while (!list_empty(&fd->victims)) {
-		node = list_entry(fd->victims.next, struct node, list);
-
-		/* for queries */
-		fd->current_victim = node->nodeid;
-
-		cman_member = is_cman_member(node->nodeid);
-		cpg_member = in_daemon_member_list(node->nodeid);
-		if (group_mode == GROUP_LIBCPG)
-			ext = is_fenced_external(fd, node->nodeid);
-		else
-			ext = 0;
-
-		if ((cman_member && cpg_member) || ext) {
-			log_debug("averting fence of node %s "
-				  "cman member %d cpg member %d external %d",
-				  node->name, cman_member, cpg_member, ext);
-			victim_done(fd, node->nodeid,
-				    ext ? VIC_DONE_EXTERNAL : VIC_DONE_MEMBER);
-			list_del(&node->list);
-			free(node);
-			continue;
-		}
-
-		log_level(LOG_INFO, "fencing node \"%s\"", node->name);
-
-		query_unlock();
-		error = fence_node(node->name);
-		query_lock();
-
-		log_level(LOG_INFO, "fence \"%s\" %s", node->name,
-			  error ? "failed" : "success");
-
-		if (!error) {
-			victim_done(fd, node->nodeid, VIC_DONE_AGENT);
-			list_del(&node->list);
-			free(node);
-			continue;
-		}
-
-		if (!cfgd_override_path) {
-			query_unlock();
-			sleep(5);
-			query_lock();
-			continue;
-		}
-
-		/* Check for manual intervention */
-		override = open_override(cfgd_override_path);
-		if (check_override(override, node->name,
-				   cfgd_override_time) > 0) {
-			log_level(LOG_WARNING, "fence \"%s\" overridden by "
-				  "administrator intervention", node->name);
-			victim_done(fd, node->nodeid, VIC_DONE_OVERRIDE);
-			list_del(&node->list);
-			free(node);
-		}
-		close_override(&override, cfgd_override_path);
-	}
-
-	fd->current_victim = 0;
-}
-
diff --git a/fence/include/linux_endian.h b/fence/include/linux_endian.h
deleted file mode 100644
index 43089d2..0000000
--- a/fence/include/linux_endian.h
+++ /dev/null
@@ -1,68 +0,0 @@
-#ifndef __LINUX_ENDIAN_DOT_H__
-#define __LINUX_ENDIAN_DOT_H__
-
-
-#include <endian.h>
-#include <byteswap.h>
-
-
-/*  I'm not sure which versions of alpha glibc/gcc are broken,
-    so fix all of them.  */
-#ifdef __alpha__
-#undef bswap_64
-static __inline__ unsigned long bswap_64(unsigned long x)
-{
-  unsigned int h = x >> 32;
-  unsigned int l = x;
-
-  h = bswap_32(h);
-  l = bswap_32(l);
-
-  return ((unsigned long)l << 32) | h;
-}
-#endif  /*  __alpha__  */
-
-
-#if __BYTE_ORDER == __BIG_ENDIAN
-
-#define be16_to_cpu(x) (x)
-#define be32_to_cpu(x) (x)
-#define be64_to_cpu(x) (x)
-
-#define cpu_to_be16(x) (x)
-#define cpu_to_be32(x) (x)
-#define cpu_to_be64(x) (x)
-
-#define le16_to_cpu(x) (bswap_16((x)))
-#define le32_to_cpu(x) (bswap_32((x)))
-#define le64_to_cpu(x) (bswap_64((x)))
-
-#define cpu_to_le16(x) (bswap_16((x)))
-#define cpu_to_le32(x) (bswap_32((x)))
-#define cpu_to_le64(x) (bswap_64((x)))
-
-#endif  /*  __BYTE_ORDER == __BIG_ENDIAN  */
-
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-
-#define be16_to_cpu(x) (bswap_16((x)))
-#define be32_to_cpu(x) (bswap_32((x)))
-#define be64_to_cpu(x) (bswap_64((x)))
-
-#define cpu_to_be16(x) (bswap_16((x)))
-#define cpu_to_be32(x) (bswap_32((x)))
-#define cpu_to_be64(x) (bswap_64((x))) 
-
-#define le16_to_cpu(x) (x)
-#define le32_to_cpu(x) (x)
-#define le64_to_cpu(x) (x)
-
-#define cpu_to_le16(x) (x)
-#define cpu_to_le32(x) (x)
-#define cpu_to_le64(x) (x)
-
-#endif  /*  __BYTE_ORDER == __LITTLE_ENDIAN  */
-
-
-#endif  /*  __LINUX_ENDIAN_DOT_H__  */
diff --git a/fence/include/list.h b/fence/include/list.h
deleted file mode 100644
index 8100cbc..0000000
--- a/fence/include/list.h
+++ /dev/null
@@ -1,336 +0,0 @@
-/* Copied from include/linux/list.h */
-
-#ifndef _LINUX_LIST_H
-#define _LINUX_LIST_H
-
-/**
- * container_of - cast a member of a structure out to the containing structure
- *
- * @ptr:        the pointer to the member.
- * @type:       the type of the container struct this is embedded in.
- * @member:     the name of the member within the struct.
- *
- */
-#define container_of(ptr, type, member) ({                      \
-	const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
-	(type *)( (char *)__mptr - offsetof(type,member) );})
-
-
-/*
- * These are non-NULL pointers that will result in page faults
- * under normal circumstances, used to verify that nobody uses
- * non-initialized list entries.
- */
-#define LIST_POISON1  ((void *) 0x00100100)
-#define LIST_POISON2  ((void *) 0x00200200)
-
-/*
- * Simple doubly linked list implementation.
- *
- * Some of the internal functions ("__xxx") are useful when
- * manipulating whole lists rather than single entries, as
- * sometimes we already know the next/prev entries and we can
- * generate better code by using them directly rather than
- * using the generic single-entry routines.
- */
-
-struct list_head {
-	struct list_head *next, *prev;
-};
-
-#define LIST_HEAD_INIT(name) { &(name), &(name) }
-
-#define LIST_HEAD(name) \
-	struct list_head name = LIST_HEAD_INIT(name)
-
-#define INIT_LIST_HEAD(ptr) do { \
-	(ptr)->next = (ptr); (ptr)->prev = (ptr); \
-} while (0)
-
-/*
- * Insert a new entry between two known consecutive entries. 
- *
- * This is only for internal list manipulation where we know
- * the prev/next entries already!
- */
-static inline void __list_add(struct list_head *new,
-			      struct list_head *prev,
-			      struct list_head *next)
-{
-	next->prev = new;
-	new->next = next;
-	new->prev = prev;
-	prev->next = new;
-}
-
-/**
- * list_add - add a new entry
- * @new: new entry to be added
- * @head: list head to add it after
- *
- * Insert a new entry after the specified head.
- * This is good for implementing stacks.
- */
-static inline void list_add(struct list_head *new, struct list_head *head)
-{
-	__list_add(new, head, head->next);
-}
-
-/**
- * list_add_tail - add a new entry
- * @new: new entry to be added
- * @head: list head to add it before
- *
- * Insert a new entry before the specified head.
- * This is useful for implementing queues.
- */
-static inline void list_add_tail(struct list_head *new, struct list_head *head)
-{
-	__list_add(new, head->prev, head);
-}
-
-/*
- * Delete a list entry by making the prev/next entries
- * point to each other.
- *
- * This is only for internal list manipulation where we know
- * the prev/next entries already!
- */
-static inline void __list_del(struct list_head * prev, struct list_head * next)
-{
-	next->prev = prev;
-	prev->next = next;
-}
-
-/**
- * list_del - deletes entry from list.
- * @entry: the element to delete from the list.
- * Note: list_empty on entry does not return true after this, the entry is
- * in an undefined state.
- */
-static inline void list_del(struct list_head *entry)
-{
-	__list_del(entry->prev, entry->next);
-	entry->next = LIST_POISON1;
-	entry->prev = LIST_POISON2;
-}
-
-/**
- * list_del_init - deletes entry from list and reinitialize it.
- * @entry: the element to delete from the list.
- */
-static inline void list_del_init(struct list_head *entry)
-{
-	__list_del(entry->prev, entry->next);
-	INIT_LIST_HEAD(entry); 
-}
-
-/**
- * list_move - delete from one list and add as another's head
- * @list: the entry to move
- * @head: the head that will precede our entry
- */
-static inline void list_move(struct list_head *list, struct list_head *head)
-{
-        __list_del(list->prev, list->next);
-        list_add(list, head);
-}
-
-/**
- * list_move_tail - delete from one list and add as another's tail
- * @list: the entry to move
- * @head: the head that will follow our entry
- */
-static inline void list_move_tail(struct list_head *list,
-				  struct list_head *head)
-{
-        __list_del(list->prev, list->next);
-        list_add_tail(list, head);
-}
-
-/**
- * list_empty - tests whether a list is empty
- * @head: the list to test.
- */
-static inline int list_empty(const struct list_head *head)
-{
-	return head->next == head;
-}
-
-/**
- * list_empty_careful - tests whether a list is
- * empty _and_ checks that no other CPU might be
- * in the process of still modifying either member
- *
- * NOTE: using list_empty_careful() without synchronization
- * can only be safe if the only activity that can happen
- * to the list entry is list_del_init(). Eg. it cannot be used
- * if another CPU could re-list_add() it.
- *
- * @head: the list to test.
- */
-static inline int list_empty_careful(const struct list_head *head)
-{
-	struct list_head *next = head->next;
-	return (next == head) && (next == head->prev);
-}
-
-static inline void __list_splice(struct list_head *list,
-				 struct list_head *head)
-{
-	struct list_head *first = list->next;
-	struct list_head *last = list->prev;
-	struct list_head *at = head->next;
-
-	first->prev = head;
-	head->next = first;
-
-	last->next = at;
-	at->prev = last;
-}
-
-/**
- * list_splice - join two lists
- * @list: the new list to add.
- * @head: the place to add it in the first list.
- */
-static inline void list_splice(struct list_head *list, struct list_head *head)
-{
-	if (!list_empty(list))
-		__list_splice(list, head);
-}
-
-/**
- * list_splice_init - join two lists and reinitialise the emptied list.
- * @list: the new list to add.
- * @head: the place to add it in the first list.
- *
- * The list at @list is reinitialised
- */
-static inline void list_splice_init(struct list_head *list,
-				    struct list_head *head)
-{
-	if (!list_empty(list)) {
-		__list_splice(list, head);
-		INIT_LIST_HEAD(list);
-	}
-}
-
-/**
- * list_entry - get the struct for this entry
- * @ptr:	the &struct list_head pointer.
- * @type:	the type of the struct this is embedded in.
- * @member:	the name of the list_struct within the struct.
- */
-#define list_entry(ptr, type, member) \
-	container_of(ptr, type, member)
-
-/**
- * list_first_entry - get the first element from a list
- * @ptr:        the list head to take the element from.
- * @type:       the type of the struct this is embedded in.
- * @member:     the name of the list_struct within the struct.
- *
- * Note, that list is expected to be not empty.
- */
-#define list_first_entry(ptr, type, member) \
-	list_entry((ptr)->next, type, member)
-
-/**
- * list_for_each	-	iterate over a list
- * @pos:	the &struct list_head to use as a loop counter.
- * @head:	the head for your list.
- */
-#define list_for_each(pos, head) \
-	for (pos = (head)->next; pos != (head); pos = pos->next)
-
-/**
- * __list_for_each	-	iterate over a list
- * @pos:	the &struct list_head to use as a loop counter.
- * @head:	the head for your list.
- *
- * This variant differs from list_for_each() in that it's the
- * simplest possible list iteration code, no prefetching is done.
- * Use this for code that knows the list to be very short (empty
- * or 1 entry) most of the time.
- */
-#define __list_for_each(pos, head) \
-	for (pos = (head)->next; pos != (head); pos = pos->next)
-
-/**
- * list_for_each_prev	-	iterate over a list backwards
- * @pos:	the &struct list_head to use as a loop counter.
- * @head:	the head for your list.
- */
-#define list_for_each_prev(pos, head) \
-	for (pos = (head)->prev; pos != (head); pos = pos->prev)
-        	
-/**
- * list_for_each_safe	-	iterate over a list safe against removal of list entry
- * @pos:	the &struct list_head to use as a loop counter.
- * @n:		another &struct list_head to use as temporary storage
- * @head:	the head for your list.
- */
-#define list_for_each_safe(pos, n, head) \
-	for (pos = (head)->next, n = pos->next; pos != (head); \
-		pos = n, n = pos->next)
-
-/**
- * list_for_each_entry	-	iterate over list of given type
- * @pos:	the type * to use as a loop counter.
- * @head:	the head for your list.
- * @member:	the name of the list_struct within the struct.
- */
-#define list_for_each_entry(pos, head, member)				\
-	for (pos = list_entry((head)->next, typeof(*pos), member);	\
-	     &pos->member != (head); 					\
-	     pos = list_entry(pos->member.next, typeof(*pos), member))
-
-/**
- * list_for_each_entry_reverse - iterate backwards over list of given type.
- * @pos:	the type * to use as a loop counter.
- * @head:	the head for your list.
- * @member:	the name of the list_struct within the struct.
- */
-#define list_for_each_entry_reverse(pos, head, member)			\
-	for (pos = list_entry((head)->prev, typeof(*pos), member);	\
-	     &pos->member != (head); 					\
-	     pos = list_entry(pos->member.prev, typeof(*pos), member))
-
-/**
- * list_prepare_entry - prepare a pos entry for use as a start point in
- *			list_for_each_entry_continue
- * @pos:	the type * to use as a start point
- * @head:	the head of the list
- * @member:	the name of the list_struct within the struct.
- */
-#define list_prepare_entry(pos, head, member) \
-	((pos) ? : list_entry(head, typeof(*pos), member))
-
-/**
- * list_for_each_entry_continue -	iterate over list of given type
- *			continuing after existing point
- * @pos:	the type * to use as a loop counter.
- * @head:	the head for your list.
- * @member:	the name of the list_struct within the struct.
- */
-#define list_for_each_entry_continue(pos, head, member) 		\
-	for (pos = list_entry(pos->member.next, typeof(*pos), member);  \
-	     &pos->member != (head);					\
-	     pos = list_entry(pos->member.next, typeof(*pos), member))
-
-/**
- * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
- * @pos:	the type * to use as a loop counter.
- * @n:		another type * to use as temporary storage
- * @head:	the head for your list.
- * @member:	the name of the list_struct within the struct.
- */
-#define list_for_each_entry_safe(pos, n, head, member)			\
-	for (pos = list_entry((head)->next, typeof(*pos), member),	\
-		n = list_entry(pos->member.next, typeof(*pos), member);	\
-	     &pos->member != (head); 					\
-	     pos = n, n = list_entry(n->member.next, typeof(*n), member))
-
-
-#endif
diff --git a/fence/libfence/Makefile b/fence/libfence/Makefile
deleted file mode 100644
index e1e74db..0000000
--- a/fence/libfence/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-TARGET= libfence
-
-OBJS=	agent.o
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/libs.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-CFLAGS += -fPIC
-CFLAGS += -I${ccsincdir}
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${ccslibdir} -lccs
-LDFLAGS += -L${libdir}
diff --git a/fence/libfence/agent.c b/fence/libfence/agent.c
deleted file mode 100644
index ab93bdf..0000000
--- a/fence/libfence/agent.c
+++ /dev/null
@@ -1,334 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <string.h>
-#include <errno.h>
-#include <time.h>
-
-#include "ccs.h"
-
-#define MAX_METHODS		8
-#define MAX_DEVICES		8
-#define MAX_AGENT_ARGS_LEN	512
-
-#define METHOD_NAME_PATH		"/cluster/clusternodes/clusternode[@name=\"%s\"]/fence/method[%d]/@name"
-#define DEVICE_NAME_PATH		"/cluster/clusternodes/clusternode[@name=\"%s\"]/fence/method[@name=\"%s\"]/device[%d]/@name"
-#define NODE_FENCE_ARGS_PATH	"/cluster/clusternodes/clusternode[@name=\"%s\"]/fence/method[@name=\"%s\"]/device[%d]/@*"
-#define AGENT_NAME_PATH			"/cluster/fencedevices/fencedevice[@name=\"%s\"]/@agent"
-#define FENCE_DEVICE_ARGS_PATH	"/cluster/fencedevices/fencedevice[@name=\"%s\"]/@*"
-
-
-
-static void display_agent_output(const char *agent, int fd)
-{
-	char buf[384];
-	int ret;
-
-	do {
-		ret = read(fd, buf, sizeof(buf) - 1);
-		if (ret < 0) {
-			if (errno == EINTR)
-				continue;
-			break;
-		} else if (ret > 0) {
-			buf[ret] = '\0';
-			/*
-			syslog(LOG_ERR, "agent \"%s\" reports: %s", agent, buf);
-			*/
-		}
-	} while (ret > 0);
-}
-
-static int run_agent(char *agent, char *args)
-{
-	int pid, status, len;
-	int pr_fd, pw_fd;  /* parent read/write file descriptors */
-	int cr_fd, cw_fd;  /* child read/write file descriptors */
-	int fd1[2];
-	int fd2[2];
-
-	cr_fd = cw_fd = pr_fd = pw_fd = -1;
-
-	if (args == NULL || agent == NULL)
-		goto fail;
-	len = strlen(args);
-
-	if (pipe(fd1))
-		goto fail;
-	pr_fd = fd1[0];
-	cw_fd = fd1[1];
-
-	if (pipe(fd2))
-		goto fail;
-	cr_fd = fd2[0];
-	pw_fd = fd2[1];
-
-	pid = fork();
-	if (pid < 0)
-		goto fail;
-
-	if (pid) {
-		/* parent */
-		int ret;
-
-		fcntl(pr_fd, F_SETFL, fcntl(pr_fd, F_GETFL, 0) | O_NONBLOCK);
-
-		do {
-			ret = write(pw_fd, args, len);
-		} while (ret < 0 && errno == EINTR);
-
-		if (ret != len)
-			goto fail;
-
-		close(pw_fd);
-		waitpid(pid, &status, 0);
-
-		if (!WIFEXITED(status) || WEXITSTATUS(status)) {
-			display_agent_output(agent, pr_fd);
-			goto fail;
-		}
-	} else {
-		/* child */
-
-		close(1);
-		if (dup(cw_fd) < 0)
-			goto fail;
-		close(2);
-		if (dup(cw_fd) < 0)
-			goto fail;
-		close(0);
-		if (dup(cr_fd) < 0)
-			goto fail;
-		/* keep cw_fd open so parent can report all errors. */
-		close(pr_fd);
-		close(cr_fd);
-		close(pw_fd);
-
-		execlp(agent, agent, NULL);
-		exit(EXIT_FAILURE);
-	}
-
-	close(pr_fd);
-	close(cw_fd);
-	close(cr_fd);
-	close(pw_fd);
-	return 0;
-
- fail:
-	close(pr_fd);
-	close(cw_fd);
-	close(cr_fd);
-	close(pw_fd);
-	return -1;
-}
-
-static int make_args(int cd, char *victim, char *method, int d,
-				char *device, char **args_out)
-{
-	char path[256], *args, *str;
-	int error, cnt = 0;
-
-	args = malloc(MAX_AGENT_ARGS_LEN);
-	if (!args)
-		return -ENOMEM;
-	memset(args, 0, MAX_AGENT_ARGS_LEN);
-
-	/* node-specific args for victim */
-
-	memset(path, 0, 256);
-	sprintf(path, NODE_FENCE_ARGS_PATH, victim, method, d+1);
-
-	for (;;) {
-		error = ccs_get_list(cd, path, &str);
-		if (error || !str)
-			break;
-		++cnt;
-
-		if (!strncmp(str, "name=", 5)) {
-			free(str);
-			continue;
-		}
-
-		strcat(args, str);
-		strcat(args, "\n");
-		free(str);
-	}
-
-	/* device-specific args */
-
-	memset(path, 0, 256);
-	sprintf(path, FENCE_DEVICE_ARGS_PATH, device);
-
-	for (;;) {
-		error = ccs_get_list(cd, path, &str);
-		if (error || !str)
-			break;
-		++cnt;
-
-		if (!strncmp(str, "name=", 5)) {
-			free(str);
-			continue;
-		}
-
-		strcat(args, str);
-		strcat(args, "\n");
-		free(str);
-	}
-
-	if (cnt)
-		error = 0;
-	if (error) {
-		free(args);
-		args = NULL;
-	}
-
-	*args_out = args;
-	return error;
-}
-
-/* return name of m'th method for nodes/<victim>/fence/ */
-
-static int get_method(int cd, char *victim, int m, char **method)
-{
-	char path[256], *str = NULL;
-	int error;
-
-	memset(path, 0, 256);
-	sprintf(path, METHOD_NAME_PATH, victim, m+1);
-
-	error = ccs_get(cd, path, &str);
-	*method = str;
-	return error;
-}
-
-/* return name of d'th device under nodes/<victim>/fence/<method>/ */
-
-static int get_device(int cd, char *victim, char *method, int d, char **device)
-{
-	char path[256], *str = NULL;
-	int error;
-
-	memset(path, 0, 256);
-	sprintf(path, DEVICE_NAME_PATH, victim, method, d+1);
-
-	error = ccs_get(cd, path, &str);
-	*device = str;
-	return error;
-}
-
-static int count_methods(int cd, char *victim)
-{
-	char path[256], *name;
-	int error, i;
-
-	for (i = 0; i < MAX_METHODS; i++) {
-		memset(path, 0, 256);
-		sprintf(path, METHOD_NAME_PATH, victim, i+1);
-
-		error = ccs_get(cd, path, &name);
-		if (error)
-			break;
-		free(name);
-	}
-	return i;
-}
-
-static int count_devices(int cd, char *victim, char *method)
-{
-	char path[256], *name;
-	int error, i;
-
-	for (i = 0; i < MAX_DEVICES; i++) {
-		memset(path, 0, 256);
-		sprintf(path, DEVICE_NAME_PATH, victim, method, i+1);
-
-		error = ccs_get(cd, path, &name);
-		if (error)
-			break;
-		free(name);
-	}
-	return i;
-}
-
-static int use_device(int cd, char *victim, char *method, int d,
-				char *device)
-{
-	char path[256], *agent, *args = NULL;
-	int error;
-
-	memset(path, 0, 256);
-	sprintf(path, AGENT_NAME_PATH, device);
-
-	error = ccs_get(cd, path, &agent);
-	if (error)
-		goto out;
-
-	error = make_args(cd, victim, method, d, device, &args);
-	if (error)
-		goto out_agent;
-
-	error = run_agent(agent, args);
-
-	free(args);
- out_agent:
-	free(agent);
- out:
-	return error;
-}
-
-int fence_node(char *victim)
-{
-	char *method = NULL, *device = NULL;
-	char *victim_nodename = NULL;
-	int num_methods, num_devices, m, d, error = -1, cd;
-
-	cd = ccs_connect();
-	if (cd < 0)
-		return -1;
-
-	if (ccs_lookup_nodename(cd, victim, &victim_nodename) == 0)
-		victim = victim_nodename;
-
-	num_methods = count_methods(cd, victim);
-
-	for (m = 0; m < num_methods; m++) {
-
-		error = get_method(cd, victim, m, &method);
-		if (error)
-			continue;
-
-		/* if num_devices is zero we should return an error */
-		error = -1;
-
-		num_devices = count_devices(cd, victim, method);
-
-		for (d = 0; d < num_devices; d++) {
-			error = get_device(cd, victim, method, d, &device);
-			if (error)
-				break;
-
-			error = use_device(cd, victim, method, d, device);
-			if (error)
-				break;
-
-			free(device);
-			device = NULL;
-		}
-
-		if (device)
-			free(device);
-		if (victim_nodename)
-			free(victim_nodename);
-		free(method);
-
-		if (!error)
-			break;
-	}
-
-	ccs_disconnect(cd);
-
-	return error;
-}
diff --git a/fence/libfence/libfence.h b/fence/libfence/libfence.h
deleted file mode 100644
index b71450b..0000000
--- a/fence/libfence/libfence.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _LIBFENCE_H_
-#define _LIBFENCE_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-int fence_node(char *name);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/fence/libfenced/Makefile b/fence/libfenced/Makefile
deleted file mode 100644
index 827886e..0000000
--- a/fence/libfenced/Makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-TARGET= libfenced
-
-MAKESTATICLIB = 1
-
-OBJS=	main.o
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/libs.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-CFLAGS += -fPIC
-CFLAGS += -I$(S)/../fenced
-CFLAGS += -I${incdir}
diff --git a/fence/libfenced/libfenced.h b/fence/libfenced/libfenced.h
deleted file mode 100644
index b869136..0000000
--- a/fence/libfenced/libfenced.h
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef _LIBFENCED_H_
-#define _LIBFENCED_H_
-
-#define FENCED_DUMP_SIZE (1024 * 1024)
-
-/* for querying local node info */
-#define FENCED_NODEID_US 0
-
-struct fenced_node {
-	int nodeid;
-	int member;
-	int victim;
-	int last_fenced_master;
-	int last_fenced_how;
-	uint64_t last_fenced_time;
-};
-
-struct fenced_domain {
-	int group_mode;
-	int member_count;
-	int victim_count;
-	int master_nodeid;
-	int current_victim;
-	int state;
-};
-
-/* fenced_domain_nodes() types */
-#define FENCED_NODES_ALL	1
-#define FENCED_NODES_MEMBERS	2
-#define FENCED_NODES_VICTIMS	3
-
-int fenced_join(void);
-int fenced_leave(void);
-int fenced_dump_debug(char *buf);
-int fenced_external(char *name);
-int fenced_node_info(int nodeid, struct fenced_node *node);
-int fenced_domain_info(struct fenced_domain *domain);
-int fenced_domain_nodes(int type, int max, int *count, struct fenced_node *nodes);
-
-#endif
diff --git a/fence/libfenced/main.c b/fence/libfenced/main.c
deleted file mode 100644
index d60647d..0000000
--- a/fence/libfenced/main.c
+++ /dev/null
@@ -1,323 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdint.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-
-#include "fenced.h"
-#include "libfenced.h"
-
-static int do_read(int fd, void *buf, size_t count)
-{
-	int rv, off = 0;
-
-	while (off < count) {
-		rv = read(fd, buf + off, count - off);
-		if (rv == 0)
-			return -1;
-		if (rv == -1 && errno == EINTR)
-			continue;
-		if (rv == -1)
-			return -1;
-		off += rv;
-	}
-	return 0;
-}
-
-static int do_write(int fd, void *buf, size_t count)
-{
-	int rv, off = 0;
-
- retry:
-	rv = write(fd, buf + off, count);
-	if (rv == -1 && errno == EINTR)
-		goto retry;
-	if (rv < 0) {
-		return rv;
-	}
-
-	if (rv != count) {
-		count -= rv;
-		off += rv;
-		goto retry;
-	}
-	return 0;
-}
-
-static int do_connect(char *sock_path)
-{
-	struct sockaddr_un sun;
-	socklen_t addrlen;
-	int rv, fd;
-
-	fd = socket(PF_UNIX, SOCK_STREAM, 0);
-	if (fd < 0)
-		goto out;
-
-	memset(&sun, 0, sizeof(sun));
-	sun.sun_family = AF_UNIX;
-	strcpy(&sun.sun_path[1], sock_path);
-	addrlen = sizeof(sa_family_t) + strlen(sun.sun_path+1) + 1;
-
-	rv = connect(fd, (struct sockaddr *) &sun, addrlen);
-	if (rv < 0) {
-		close(fd);
-		fd = rv;
-	}
- out:
-	return fd;
-}
-
-static void init_header(struct fenced_header *h, int cmd, int extra_len)
-{
-	memset(h, 0, sizeof(struct fenced_header));
-
-	h->magic = FENCED_MAGIC;
-	h->version = FENCED_VERSION;
-	h->len = sizeof(struct fenced_header) + extra_len;
-	h->command = cmd;
-}
-
-int fenced_join(void)
-{
-	struct fenced_header h;
-	int fd, rv;
-
-	init_header(&h, FENCED_CMD_JOIN, 0);
-
-	fd = do_connect(FENCED_SOCK_PATH);
-	if (fd < 0) {
-		rv = fd;
-		goto out;
-	}
-
-	rv = do_write(fd, &h, sizeof(h));
-	close(fd);
- out:
-	return rv;
-}
-
-int fenced_leave(void)
-{
-	struct fenced_header h;
-	int fd, rv;
-
-	init_header(&h, FENCED_CMD_LEAVE, 0);
-
-	fd = do_connect(FENCED_SOCK_PATH);
-	if (fd < 0) {
-		rv = fd;
-		goto out;
-	}
-
-	rv = do_write(fd, &h, sizeof(h));
-	close(fd);
- out:
-	return rv;
-}
-
-int fenced_external(char *name)
-{
-	char msg[sizeof(struct fenced_header) + MAX_NODENAME_LEN + 1];
-	struct fenced_header *hd = (struct fenced_header *)msg;
-	int fd, rv;
-	int namelen;
-
-	memset(&msg, 0, sizeof(msg));
-
-	init_header(hd, FENCED_CMD_EXTERNAL, MAX_NODENAME_LEN + 1);
-
-	namelen = strlen(name);
-	if (namelen > MAX_NODENAME_LEN)
-		namelen = MAX_NODENAME_LEN;
-	memcpy(msg + sizeof(struct fenced_header), name, namelen);
-
-	fd = do_connect(FENCED_SOCK_PATH);
-	if (fd < 0) {
-		rv = fd;
-		goto out;
-	}
-
-	rv = do_write(fd, hd, sizeof(msg));
-	close(fd);
- out:
-	return rv;
-}
-
-int fenced_dump_debug(char *buf)
-{
-	struct fenced_header h, *rh;
-	char *reply;
-	int reply_len;
-	int fd, rv;
-
-	init_header(&h, FENCED_CMD_DUMP_DEBUG, 0);
-
-	reply_len = sizeof(struct fenced_header) + FENCED_DUMP_SIZE;
-	reply = malloc(reply_len);
-	if (!reply) {
-		rv = -1;
-		goto out;
-	}
-	memset(reply, 0, reply_len);
-
-	fd = do_connect(FENCED_QUERY_SOCK_PATH);
-	if (fd < 0) {
-		rv = fd;
-		goto out;
-	}
-
-	rv = do_write(fd, &h, sizeof(h));
-	if (rv < 0)
-		goto out_close;
-
-	/* won't always get back the full reply_len */
-	do_read(fd, reply, reply_len);
-
-	rh = (struct fenced_header *)reply;
-	rv = rh->data;
-	if (rv < 0)
-		goto out_close;
-
-	memcpy(buf, (char *)reply + sizeof(struct fenced_header),
-	       FENCED_DUMP_SIZE);
- out_close:
-	close(fd);
- out:
-	return rv;
-}
-
-int fenced_node_info(int nodeid, struct fenced_node *node)
-{
-	struct fenced_header h, *rh;
-	char reply[sizeof(struct fenced_header) + sizeof(struct fenced_node)];
-	int fd, rv;
-
-	init_header(&h, FENCED_CMD_NODE_INFO, 0);
-	h.data = nodeid;
-
-	memset(reply, 0, sizeof(reply));
-
-	fd = do_connect(FENCED_QUERY_SOCK_PATH);
-	if (fd < 0) {
-		rv = fd;
-		goto out;
-	}
-
-	rv = do_write(fd, &h, sizeof(h));
-	if (rv < 0)
-		goto out_close;
-
-	rv = do_read(fd, reply, sizeof(reply));
-	if (rv < 0)
-		goto out_close;
-
-	rh = (struct fenced_header *)reply;
-	rv = rh->data;
-	if (rv < 0)
-		goto out_close;
-
-	memcpy(node, (char *)reply + sizeof(struct fenced_header),
-	       sizeof(struct fenced_node));
- out_close:
-	close(fd);
- out:
-	return rv;
-}
-
-int fenced_domain_info(struct fenced_domain *domain)
-{
-	struct fenced_header h, *rh;
-	char reply[sizeof(struct fenced_header) + sizeof(struct fenced_domain)];
-	int fd, rv;
-
-	init_header(&h, FENCED_CMD_DOMAIN_INFO, 0);
-
-	memset(reply, 0, sizeof(reply));
-
-	fd = do_connect(FENCED_QUERY_SOCK_PATH);
-	if (fd < 0) {
-		rv = fd;
-		goto out;
-	}
-
-	rv = do_write(fd, &h, sizeof(h));
-	if (rv < 0)
-		goto out_close;
-
-	rv = do_read(fd, reply, sizeof(reply));
-	if (rv < 0)
-		goto out_close;
-
-	rh = (struct fenced_header *)reply;
-	rv = rh->data;
-	if (rv < 0)
-		goto out_close;
-
-	memcpy(domain, (char *)reply + sizeof(struct fenced_header),
-	       sizeof(struct fenced_domain));
- out_close:
-	close(fd);
- out:
-	return rv;
-}
-
-int fenced_domain_nodes(int type, int max, int *count, struct fenced_node *nodes)
-{
-	struct fenced_header h, *rh;
-	char *reply;
-	int reply_len;
-	int fd, rv, result, node_count;
-
-	init_header(&h, FENCED_CMD_DOMAIN_NODES, 0);
-	h.option = type;
-	h.data = max;
-
-	reply_len = sizeof(struct fenced_header) + (max * sizeof(struct fenced_node));
-	reply = malloc(reply_len);
-	if (!reply) {
-		rv = -1;
-		goto out;
-	}
-	memset(reply, 0, reply_len);
-
-	fd = do_connect(FENCED_QUERY_SOCK_PATH);
-	if (fd < 0) {
-		rv = fd;
-		goto out;
-	}
-
-	rv = do_write(fd, &h, sizeof(h));
-	if (rv < 0)
-		goto out_close;
-
-	/* won't usually get back the full reply_len */
-	do_read(fd, reply, reply_len);
-
-	rh = (struct fenced_header *)reply;
-	result = rh->data;
-	if (result < 0 && result != -E2BIG) {
-		rv = result;
-		goto out_close;
-	}
-
-	if (result == -E2BIG) {
-		*count = -E2BIG;
-		node_count = max;
-	} else {
-		*count = result;
-		node_count = result;
-	}
-	rv = 0;
-
-	memcpy(nodes, (char *)reply + sizeof(struct fenced_header),
-	       node_count * sizeof(struct fenced_node));
- out_close:
-	close(fd);
- out:
-	return rv;
-}
-
diff --git a/fence/man/Makefile b/fence/man/Makefile
deleted file mode 100644
index 06d1d5b..0000000
--- a/fence/man/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-TARGET= fence.8 \
-	fenced.8  \
-	fence_ack_manual.8 \
-	fence_alom.8 \
-	fence_apc.8 \
-	fence_bladecenter.8 \
-	fence_brocade.8 \
-	fence_bullpap.8 \
-	fence_drac.8 \
-	fence_egenera.8 \
-	fence_eps.8 \
-	fence_ifmib.8 \
-	fence_ilo.8 \
-	fence_ipmilan.8 \
-	fence_ldom.8 \
-	fence_manual.8 \
-	fence_mcdata.8 \
-	fence_node.8 \
-	fence_rib.8 \
-	fence_rsa.8 \
-	fence_sanbox2.8 \
-	fence_tool.8 \
-	fence_vixel.8 \
-	fence_virsh.8 \
-	fence_vmware.8 \
-	fence_vmware_vmrun.8 \
-	fence_wti.8 \
-	fence_xvm.8 \
-	fence_xvmd.8
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/man.mk
diff --git a/fence/man/fence.8 b/fence/man/fence.8
deleted file mode 100644
index 85b1dba..0000000
--- a/fence/man/fence.8
+++ /dev/null
@@ -1,30 +0,0 @@
-.TH fence 8
-
-.SH NAME
-fence \- I/O Fencing reference guide
-
-.SH SYNOPSIS
-Overview of related manual pages
-.SH DESCRIPTION
-The I/O Fencing documentation has been split into a number of sections.  Please
-refer to the table below to determine which man page coincides with the
-command/feature you are looking for.
-
-.TP 20
-fence
-I/O Fencing overview (this man page)
-.TP
-fenced
-I/O Fencing daemon
-.TP
-fence_tool
-Manages fenced
-.TP
-fence_node
-Runs the fence agent configured (per cluster.conf) for the given node.
-.TP
-fence_*
-Fence agents run by fenced.
-
-.SH SEE ALSO
-gfs(8)
diff --git a/fence/man/fence_ack_manual.8 b/fence/man/fence_ack_manual.8
deleted file mode 100644
index e2ba505..0000000
--- a/fence/man/fence_ack_manual.8
+++ /dev/null
@@ -1,36 +0,0 @@
-.TH fence_ack_manual 8
-
-.SH NAME
-fence_ack_manual - program run by an operator as a part of manual I/O Fencing
-
-.SH SYNOPSIS
-.B
-fence_ack_manual
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_ack_manual is run by an operator on the same node that fence_manual(8) 
-was run after the operator has reset a node which required fencing.  A message 
-in the system log indicates to the operator that they must reset a machine and 
-then run fence_ack_manual.  Running fence_ack_manual allows the cluster to 
-continue with recovery of the fenced machine.  The victim may be disconnected 
-from storage rather than resetting it.
-
-.SH OPTIONS
-.TP
-\fB-h\fP
-Print out a help message describing available options, then exit.
-.TP
-\fB-O\fP
-Run without prompting for user confirmation.
-.TP
-\fB-n\fP \fInodename\fP
-Name of node that has been reset or disconnected from storage.
-.TP
-\fB-s\fP \fIIPaddress\fP
-IP address of the machine which has been reset or disconnected from storage.  (Deprecated; use -n instead.)
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-.SH SEE ALSO
-fence(8), fence_node(8)
diff --git a/fence/man/fence_alom.8 b/fence/man/fence_alom.8
deleted file mode 100644
index 367bb54..0000000
--- a/fence/man/fence_alom.8
+++ /dev/null
@@ -1,84 +0,0 @@
-.TH fence_vmware 8
-
-.SH NAME
-fence_alom - I/O Fencing agent for Sun Advanced Lights Out Manager (ALOM)
-
-.SH SYNOPSIS
-.B 
-fence_alom
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_alom is an I/O Fencing agent which can be used with ALOM connected machines.
-
-fence_alom accepts options on the command line as well as from stdin.  
-Fenced sends parameters through stdin when it execs the agent.  fence_alom
-can be run by itself with command line options.  This is useful for testing 
-and for turning outlets on or off from scripts.
-
-.SH OPTIONS
-.TP
-\fB-a\fP \fIIPaddress\fR
-IP address or hostname of ALOM.
-.TP
-\fB-h\fP 
-Print out a help message describing available options, then exit.
-.TP
-\fB-l\fP \fIlogin\fR
-Login name.
-.TP
-\fB-o\fP \fIaction\fR
-The action required.  This can be reboot (default), status, off or on.
-.TP
-\fB-p\fP \fIpassword\fR
-Password for login.
-.TP
-\fB-B\fP \fIscript\fR
-Script to run to retrieve password.
-.TP
-\fB-x\fP
-Use secure connection over ssh (this is default, and can't be disabled) 
-.TP
-\fB-T\fP
-Test only.  Answer NO to the confirmation prompt instead of YES.
-.TP
-\fB-v\fP
-Verbose. Record session to stdout, or debug file if specified (see -D).
-.TP
-\fB-D\fP
-Specifies file, where will be written debug messages from session.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-
-.SH STDIN PARAMETERS
-.TP
-\fIagent = < param >\fR
-This option is used by fence_node(8) and is ignored by fence_alom.
-.TP
-\fIipaddr = < hostname | ip >\fR
-IP address or hostname of ALOM.
-.TP
-\fIoption = < param >\fR
-The action required.  This can be reboot (default), off or on.
-.TP
-\fIpasswd = < param >\fR
-Password for login.
-.TP
-\fIpasswd_script = < param >\fR
-Script to run to retrieve password.
-.TP
-\fIsecure = < param >\fR
-Use secure connection over ssh (this is default, and can't be disabled) 
-.TP
-\fItest = < param >\fR
-Test only.  Answer NO to the confirmation prompt instead of YES.
-.TP
-\fIverbose = < param >\fR
-Verbose.  Record session to stdout, or debug file if specified (see debug).
-.TP
-\fIdebug = < param >\fR
-Specifies file, where will be written debug messages from session.
-
-.SH SEE ALSO
-fence(8), fence_node(8)
diff --git a/fence/man/fence_apc.8 b/fence/man/fence_apc.8
deleted file mode 100644
index 42eafbe..0000000
--- a/fence/man/fence_apc.8
+++ /dev/null
@@ -1,98 +0,0 @@
-.TH fence_apc 8
-
-.SH NAME
-fence_apc - I/O Fencing agent for APC MasterSwitch
-
-.SH SYNOPSIS
-.B 
-fence_apc
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_apc is an I/O Fencing agent which can be used with the APC MasterSwitch
-network power switch.  It logs into a MasterSwitch via telnet and reboots
-a specified outlet.  Lengthy telnet connections to the MasterSwitch should
-be avoided while a GFS cluster is running because the connection will
-block any necessary fencing actions.
-
-fence_apc accepts options on the command line as well as from stdin.  
-Fenced sends parameters through stdin when it execs the agent.  fence_apc 
-can be run by itself with command line options.  This is useful for testing 
-and for turning outlets on or off from scripts.
-
-.SH OPTIONS
-.TP
-\fB-a\fP \fIIPaddress\fR
-IP address or hostname of the switch.
-.TP
-\fB-h\fP 
-Print out a help message describing available options, then exit.
-.TP
-\fB-l\fP \fIlogin\fR
-Login name.
-.TP
-\fB-n\fP \fI[<switch>:]outlet\fR
-The outlet number to act upon.  
-.TP
-\fB-o\fP \fIaction\fR
-The action required. This can be reboot (default), status, off or on.
-.TP
-\fB-p\fP \fIpassword\fR
-Password for login or for passphrase.
-.TP
-\fB-S\fP \fIscript\fR
-Script to run to retrieve password.
-.TP
-\fB-x\fP
-Use secure connection over ssh (using version 1, cipher blowfish).
-.TP
-\fB-S\fP \fIpath\fR
-Full path to an executable to generate the password for login.
-.TP
-\fB-T\fP
-Test only.  Answer NO to the confirmation prompt instead of YES.
-.TP
-\fB-v\fP
-Verbose.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-
-.SH STDIN PARAMETERS
-.TP
-\fIagent = < param >\fR
-This option is used by fence_node(8) and is ignored by fence_apc.
-.TP
-\fIipaddr = < hostname | ip >\fR
-IP address or hostname of the switch.
-.TP
-\fIlogin = < param >\fR
-Login name.
-.TP
-\fIoption = < param >\fR
-The action required. This can be reboot (default), off or on.
-.TP
-\fIpasswd = < param >\fR
-Password for login or for passphrase.
-\fIpasswd_script = < param >\fR
-Script to run to retrieve password.
-\fIsecure = < param >\fR
-Use secure connection over ssh.
-.TP
-\fIpasswd_script = < param >\fR
-Full path to an executable to generate the password for login.
-.TP
-\fIport = < param >\fR
-The outlet number to act upon.
-.TP
-\fIswitch = < param >\fR
-The switch to operate on.  Defaults to "1" if not specified.
-.TP
-\fItest = < param >\fR
-Test only.  Answer NO to the confirmation prompt instead of YES.
-.TP
-\fIverbose = < param >\fR
-Verbose.
-
-.SH SEE ALSO
-fence(8), fence_node(8)
diff --git a/fence/man/fence_baytech.8 b/fence/man/fence_baytech.8
deleted file mode 100644
index e60175d..0000000
--- a/fence/man/fence_baytech.8
+++ /dev/null
@@ -1,82 +0,0 @@
-.TH fence_baytech 8
-
-.SH NAME
-fence_baytech - I/O Fencing agent for Baytech RPC switches in combination with a Cyclades Terminal Server
-
-.SH SYNOPSIS
-.B
-fence_baytech
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-
-This fencing agent is written for the Baytech RPC27-20nc in combination with
-a Cyclades terminal server.  The Cyclades TS exports the RPC's serial port
-via a Telnet interface.  Other interfaces, such as SSH, are possible.  
-However, this script relies upon the assumption that Telnet is used.  Future
-features to this agent would allow the agent to work with a multitude of 
-different communication protocols such as Telnet, SSH or Kermit.
-
-The other assumption that is made is that Outlet names do not end in space.
-The name "Foo" and "Foo    " are identical when the RPC prints them with
-the status command.
-
-fence_baytech accepts options on the command line as well as from stdin.
-fenced sends parameters through stdin when it execs the agent.  fence_baytech
-can be run by itself with command line options which is useful for testing.
-
-.SH OPTIONS
-.TP
-\fB-a\fP \fIhost\fP
-IP address or hostname to connect to.
-.TP
-\fB-h\fP
-Print out a help message describing available options, then exit.
-.TP
-\fB-l\fP \fIlogin\fP
-Username name for the switch.
-.TP
-\fB-n\fP \fIport\fP
-The name of the outlet to act upon.
-.TP
-\fB-o\fP \fIaction\fP
-The action required. This can be on, off, status or reboot (default)
-.TP
-\fB-p\fP \fIpassword\fP
-Password for login.
-.TP
-\fB-S\fP \fIpath\fR
-Full path to an executable to generate the password for login.
-.TP
-\fB-q\fP
-Quiet mode: print only error messages.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-
-.SH STDIN PARAMETERS
-
-.TP
-\fIagent = < param >\fR
-This option is used by fence_node(8) and is ignored by fence_baytech.
-.TP
-\fIhost = < hostname | ip >\fR
-IP address or hostname to connect to.
-.TP
-\fIlogin = < param >\fR
-Login name.
-.TP
-\fIaction = < param >\fR
-The action required. This can be on, off, status or reboot (default)
-.TP
-\fIpasswd = < param >\fR
-Password for login.
-.TP
-\fIpasswd_script = < param >\fR
-Full path to an executable to generate the password for login.
-.TP
-\fIoutlet = < param >\fR
-The name of the outlet to act upon.
-
-.SH SEE ALSO
-fence(8), fence_node(8)
diff --git a/fence/man/fence_bladecenter.8 b/fence/man/fence_bladecenter.8
deleted file mode 100644
index dabdb5d..0000000
--- a/fence/man/fence_bladecenter.8
+++ /dev/null
@@ -1,95 +0,0 @@
-.TH fence_bladecenter 8
-
-.SH NAME
-fence_bladecenter - I/O Fencing agent for IBM Bladecenter
-
-.SH SYNOPSIS
-.B
-fence_bladecenter
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_bladecenter is an I/O Fencing agent which can be used with IBM
-Bladecenters with recent enough firmware that includes telnet support.  It
-logs into a Brocade chasis via telnet or ssh and uses the command line
-interface to power on and off blades. fence_bladecenter accepts options on
-the command line or from stdin.
-
-.SH OPTIONS
-.TP
-\fB-a\fP \fIIPaddress\fP
-IP address of the Bladecenter.
-.TP
-\fB-h\fP
-Print out a help message describing available options, then exit.
-.TP
-\fB-l\fP \fIlogin\fP
-Login name for the Bladecenter.
-.TP
-\fB-n\fP \fIblade\fP
-The blade to operate on.
-.TP
-\fB-o\fP \fIaction\fP
-The action required.  Valid actions are on, off, reboot (default) and status.
-.TP
-\fB-p\fP \fIpassword\fP
-Password for login or for passphrase.
-.TP
-\fB-S\fP \fIscript\fR
-Script to run to retrieve password.
-.TP
-\fB-k\fP \fIidentity\fR
-Identity file (private key) for ssh connection.
-.TP
-\fB-x\fP
-Use secure connection over ssh.
-.TP
-\fB-S\fP \fIpath\fR
-Full path to an executable to generate the password for login.
-.TP
-\fB-q\fP
-Quiet mode: print only error messages.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-.TP
-\fB-v\fP \fIdebuglog\fP
-Log the telnet session to \fIdebuglog\fP for debugging purposes.
-
-.SH STDIN PARAMETERS
-.TP
-\fIagent = < param >\fR
-This option is used by fence_node(8) and is ignored by fence_bladecenter.
-.TP
-\fIipaddr = < hostname | ip >\fR
-IP address or hostname of the switch.
-.TP
-\fIlogin = < param >\fR
-Login name.
-.TP
-\fIoption = < param >\fR
-The action required.  disable (default) or enable.
-.TP
-\fIpasswd = < param >\fR
-Password for login or for passphrase.
-.TP
-\fIpasswd_script = < param >\fR
-Script to run to retrieve password.
-.TP
-\fIidentity_file = < param > \fR
-Identity file (private key) for ssh.
-.TP
-\fIsecure = < param >\fR
-Use secure connection over ssh.
-.TP
-\fIpasswd_script = < param >\fR
-Full path to an executable to generate the password for login.
-.TP
-\fIblade = < param >\fR
-The blade to operate on.
-.TP
-\fIdebuglog = < param>\fR
-Optional parameter to send debug transcript of the telnet session to a log file
-
-.SH SEE ALSO
-fence(8), fence_node(8)
diff --git a/fence/man/fence_brocade.8 b/fence/man/fence_brocade.8
deleted file mode 100644
index 36fde82..0000000
--- a/fence/man/fence_brocade.8
+++ /dev/null
@@ -1,82 +0,0 @@
-.TH fence_brocade 8
-
-.SH NAME
-fence_brocade - I/O Fencing agent for Brocade FC switches
-
-.SH SYNOPSIS
-.B
-fence_brocade
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_brocade is an I/O Fencing agent which can be used with Brocade FC 
-switches.  It logs into a Brocade switch via telnet and disables a specified 
-port.  Disabling the port which a machine is connected to effectively fences 
-that machine.  Lengthy telnet connections to the switch should be avoided 
-while a GFS cluster is running because the connection will block any necessary 
-fencing actions.
-
-fence_brocade accepts options on the command line as well as from stdin.
-fenced sends parameters through stdin when it execs the agent.  fence_brocade 
-can be run by itself with command line options which is useful for testing.
-
-After a fence operation has taken place the fenced machine can no longer connect
-to the Brocade FC switch.  When the fenced machine is ready to be brought back 
-into the GFS cluster (after reboot) the port on the Brocade FC switch needs to 
-be enabled. This can be done by running fence_brocade and specifying the 
-enable action.
-
-.SH OPTIONS
-.TP
-\fB-a\fP \fIIPaddress\fP
-IP address of the switch.
-.TP
-\fB-h\fP
-Print out a help message describing available options, then exit.
-.TP
-\fB-l\fP \fIlogin\fP
-Login name for the switch.
-.TP
-\fB-n\fP \fIport\fP
-The port number to disable on the switch.
-.TP
-\fB-o\fP \fIaction\fP
-The action required.  disable (default) or enable.
-.TP
-\fB-p\fP \fIpassword\fP
-Password for login.
-.TP
-\fB-S\fP \fIpath\fR
-Full path to an executable to generate the password for login.
-.TP
-\fB-q\fP
-Quiet mode: print only error messages.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-
-.SH STDIN PARAMETERS
-.TP
-\fIagent = < param >\fR
-This option is used by fence_node(8) and is ignored by fence_brocade.
-.TP
-\fIipaddr = < hostname | ip >\fR
-IP address or hostname of the switch.
-.TP
-\fIlogin = < param >\fR
-Login name.
-.TP
-\fIoption = < param >\fR
-The action required.  disable (default) or enable.
-.TP
-\fIpasswd = < param >\fR
-Password for login.
-.TP
-\fIpasswd_script = < param >\fR
-Full path to an executable to generate the password for login.
-.TP
-\fIport = < param >\fR
-The port number to disable on the switch.
-
-.SH SEE ALSO
-fence(8), fence_node(8)
diff --git a/fence/man/fence_bullpap.8 b/fence/man/fence_bullpap.8
deleted file mode 100644
index 876b406..0000000
--- a/fence/man/fence_bullpap.8
+++ /dev/null
@@ -1,71 +0,0 @@
-.TH fence_bullpap 8
-
-.SH NAME
-fence_bullpap - I/O Fencing agent for Bull FAME architecture controlled by a 
-PAP management console.
-
-.SH SYNOPSIS
-.B
-fence_bullpap
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_bullpap is an I/O Fencing agent which can be used with Bull's NovaScale
-machines controlled by PAP management consoles.  This agent calls Bull's
-support software provided by the NSMasterHW RPM available from Bull.
-
-fence_bullpap accepts options on the command line as well as from stdin.  
-fenced sends the options through stdin when it execs the agent.  fence_bullpap
-can be run by itself with command line options which is useful for testing.
-
-.SH OPTIONS
-.TP
-\fB-a\fP \fIIPaddress\fP
-IP address or hostname of the PAP management console.
-.TP
-\fB-h\fP
-Print out a help message describing available options, then exit.
-.TP
-\fB-l\fP \fIlogin\fP
-Login with administrative privileges.
-.TP
-\fB-d\fP \fIdomain\fP
-This is the domain name of the Bull machine to power-cycle.
-.TP
-\fB-o\fP \fIoption\fP
-Action to perform (on, off, reboot, status).
-.TP
-\fB-p\fP \fIpassword\fP
-Password for login.
-.TP
-\fB-S\fP \fIpath\fR
-Full path to an executable to generate the password for login.
-.TP
-\fB-q\fP
-Quiet operation.  Only print out error messages.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-
-.SH STDIN PARAMETERS
-.TP
-\fIipaddr = < hostname | ip >\fR
-IP address or hostname of the PAP management console.
-.TP
-\fIlogin= < param >\fR
-Login with administrative privileges.
-.TP
-\fIdomain = < param >\fR
-This is the domain name of the Bull machine to power-cycle.
-.TP
-\fIoption = < param >\fR
-Action to perform (on, off, reboot, status).
-.TP
-\fIpasswd = < param >\fR
-Password for login.
-.TP
-\fIpasswd_script = < param >\fR
-Full path to an executable to generate the password for login.
-
-.SH SEE ALSO
-fence(8), fence_node(8)
diff --git a/fence/man/fence_cpint.8 b/fence/man/fence_cpint.8
deleted file mode 100644
index efbaa7e..0000000
--- a/fence/man/fence_cpint.8
+++ /dev/null
@@ -1,52 +0,0 @@
-.TH fence_cpint 8
-
-.SH NAME
-fence_cpint - I/O Fencing agent for GFS on s390 and zSeries VM clusters
-
-.SH SYNOPSIS
-.B
-fence_cpint
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_cpint is an I/O Fencing agent used on a virtual machine running GFS in a
-s390 or zSeries VM cluster.
-It uses the cpint package to send a CP LOGOFF command to the specified virtual
-machine.
-For fence_cpint to execute correctly, you must have the cpint module installed,
-and hcp in your PATH.
-\fBNOTE:\fP for fence_cpint to send a command to another virtual machine, the
-machine executing it must either be a privilege class C user or it must be
-the secondary user of the virtual machine to be fenced.  This means that unless
-all of you GULM server nodes are privilege class C, fence_cpint can only be
-used with SLM.
-
-fence_cpint accepts options on the command line as well as from stdin.
-fence_node sends the options through stdin when it execs the agent.
-fence_cpint can be run by itself with command line options which is useful for
-testing.
-
-.SH OPTIONS
-.TP
-\fB-h\fP
-Print out a help message describing available options, then exit.
-.TP
-\fB-u\fP \fIuserid\fP
-userid of the virtual machine to fence (required).
-.TP
-\fB-q\fP
-quiet mode, no output.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-
-.SH STDIN PARAMETERS
-.TP
-\fIagent = < param >\fR
-This option is used by fence_node(8) and is ignored by fence_cpint.
-.TP
-\fIuserid = < parm >\fP
-userid of the virtual machine to fence (required).
-
-.SH SEE ALSO
-fence(8), fence_node(8)
diff --git a/fence/man/fence_drac.8 b/fence/man/fence_drac.8
deleted file mode 100644
index 8dda184..0000000
--- a/fence/man/fence_drac.8
+++ /dev/null
@@ -1,97 +0,0 @@
-.TH fence_drac 8
-
-.SH NAME
-fence_drac - fencing agent for Dell Remote Access Card 
-
-.SH SYNOPSIS
-.B 
-fence_drac
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_drac is an I/O Fencing agent which can be used with the Dell Remote
-Access Card (DRAC).  This card provides remote access to controlling 
-power to a server.  It logs into the DRAC through the telnet interface of
-the card.  By default, the telnet interface is not enabled.  To enable the
-interface, you will need to use the racadm command in the racser-devel rpm 
-available from Dell.  To enable telnet on the DRAC:
-
-[root]# racadm config -g cfgSerial -o cfgSerialTelnetEnable 1
-
-[root]# racadm racreset
-
-fence_drac accepts options on the command line as well as from stdin.  
-Fenced sends parameters through stdin when it execs the agent.  fence_drac 
-can be run by itself with command line options.  This is useful for testing 
-and for turning outlets on or off from scripts.
-
-.SH OPTIONS
-.TP
-\fB-a\fP \fIIPaddress\fR
-IP address or hostname of the switch.
-.TP
-\fB-c\fP \fIcmd_prompt\fR
-Force fence_drac to use cmd_prompt as the command prompt
-.TP
-\fB-d\fP \fIdracversion\fR
-Force fence_drac to treat the device as though it was for the specified drac version
-.TP
-\fB-D\fP \fIdumpfile\fR
-Debug file of the telnet interaction
-.TP
-\fB-h\fP 
-Print out a help message describing available options, then exit.
-.TP
-\fB-l\fP \fIlogin\fR
-Login name.
-.TP
-\fB-m\fP \fImodulename\fR
-The module name of the blade when using DRAC/MC firmware.
-.TP
-\fB-o\fP \fIaction\fR
-The action required.  reboot (default), off, on or status.
-.TP
-\fB-p\fP \fIpassword\fR
-Password for login.
-.TP
-\fB-S\fP \fIpath\fR
-Full path to an executable to generate the password for login.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-
-.SH STDIN PARAMETERS
-.TP
-\fIaction = < param >\fR
-The action required.  reboot (default), off, on or status.
-.TP
-\fIagent = < param >\fR
-This option is used by fence_node(8) and is ignored by fence_apc.
-.TP
-\fIcmd_prompt = < param >\fr
-Force fence_drac to use cmd_prompt as the command prompt
-.TP
-\fIdrac_version = < param >\fr 
-Force fence_drac to treat the device as though it was for the specified drac version.
-.TP
-\fIdebug = < dumpfile >\fR
-Debug file of the telnet interaction
-.TP
-\fIipaddr = < hostname | ip >\fR
-IP address or hostname of the switch.
-.TP
-\fIlogin = < param >\fR
-Login name.
-.TP
-\fImodulename = < param >\fr
-The module name of the blade when using DRAC/MC firmware.
-.TP
-\fIpasswd = < param >\fR
-Password for login.
-.TP
-\fIpasswd_script = < param >\fR
-Full path to an executable to generate the password for login.
-.TP
-
-.SH SEE ALSO
-fence(8), fence_node(8)
diff --git a/fence/man/fence_egenera.8 b/fence/man/fence_egenera.8
deleted file mode 100644
index cfa839e..0000000
--- a/fence/man/fence_egenera.8
+++ /dev/null
@@ -1,70 +0,0 @@
-.TH fence_egenera 8
-
-.SH NAME
-fence_egenera - I/O Fencing agent for the Egenera BladeFrame
-
-.SH SYNOPSIS
-.B
-fence_egenera
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_egenera is an I/O Fencing agent which can be used with the Egenera
-BladeFrame.  It logs into a control blade (cserver) via ssh and operates
-on a processing blade (pserver) identified by the pserver name and the 
-logical process area network (LPAN) that it is in.  fence_egenera requires
-that ssh keys have been setup so that the fence_egenera does not require
-a password to authenticate.  Refer to ssh(8) for more information on setting
-up ssh keys.
-
-fence_egenera accepts options on the command line as well as from stdin.  
-Fenced sends parameters through stdin when it execs the agent.  fence_egenera 
-can also be run by itself with command line options.  
-
-.SH OPTIONS
-.TP
-\fB-c\fP \fIcserver\fR
-The cserver to ssh to.  cserver can be in the form user@hostname to
-specify a different user to login as.
-.TP
-\fB-h\fP 
-Print out a help message describing available options, then exit.
-.TP
-\fB-l\fP \fIlpan\fR
-the lpan to operate on
-.TP
-\fB-o\fP \fIaction\fR
-The action required.  reboot (default), off, on or status.
-.TP
-\fB-p\fP \fIpserver\fR
-the pserver to operate on
-.TP
-\fB-q\fP
-quite mode.  suppress output.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-
-.SH STDIN PARAMETERS
-.TP
-\fIaction = < param >\fR
-The action required.  reboot (default), off, on or status.
-.TP
-\fIagent = < param >\fR
-This option is used by fence_node(8) and is ignored by fence_apc.
-.TP
-\fIcserver = < param >\fR
-The cserver to ssh to.  cserver can be in the form user@hostname to
-specify a different user to login as.
-.TP
-\fIlpan = < param >\fR
-The lpan to operate on
-.TP
-\fIpserver = < param >\fR
-The pserver to operate on
-.TP
-\fIesh = < param >\fR
-The path to the esh command on the cserver (default is /opt/panmgr/bin/esh)
-
-.SH SEE ALSO
-fence(8), fence_node(8), ssh(8)
diff --git a/fence/man/fence_eps.8 b/fence/man/fence_eps.8
deleted file mode 100644
index 3685837..0000000
--- a/fence/man/fence_eps.8
+++ /dev/null
@@ -1,106 +0,0 @@
-.TH fence_eps 8
-
-.SH NAME
-fence_eps - I/O Fencing agent for ePowerSwitch 8M+ power switch
-
-.SH SYNOPSIS
-.B
-fence_eps
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_eps is an I/O Fencing agent which can be used with the ePowerSwitch 8M+ power
-switch to fence connected machines. Fence agent works (in 2008/10/21) ONLY on 8M+
-device, because this is only one, which has support for hidden page feature.
-
-Agent basically works by connecting to hidden page and pass appropriate arguments
-to GET request. This means, that hidden page feature must be enabled and properly
-configured.
-
-fence_eps accepts options on the command line as well as from stdin.
-Fenced sends parameters through stdin when it execs the agent.  fence_eps
-can be run by itself with command line options.  This is useful for testin
-and for turning outlets on or off from scripts.
-
-.SH OPTIONS
-.TP
-\fB-a\fP \fIIPaddress\fR
-IP address or hostname of ePowerSwitch 8M+ device. If device is configured
-to listen on nonstandard port (other than 80), it's possible to use :port syntax
-(ex. psip:8080).
-.TP
-\fB-h\fP
-Print out a help message describing available options, then exit.
-.TP
-\fB-l\fP \fIlogin\fR
-Login name.
-.TP
-\fB-o\fP \fIaction\fR
-The action required.  This can be reboot (default), status, off or on.
-.TP
-\fB-p\fP \fIpassword\fR
-Password for login.
-.TP
-\fB-S\fP \fIscript\fR
-Script to run to retrieve password.
-.TP
-\fB-n\fP \fIname\fR
-Physical plug number. Entered without P and with preceding zero (where is needed).
-.TP
-\fB-c\fP \fIname\fR
-Name of hidden page. Default is (hidden.htm)
-.TP
-\fB-T\fP
-Test only.  Answer NO to the confirmation prompt instead of YES.
-.TP
-\fB-q\fP
-Quiet mode.
-.TP
-\fB-v\fP
-Verbose. Record session to stdout, or debug file if specified (see -D).
-.TP
-\fB-D\fP
-Specifies file, where will be written debug messages from session.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-
-.SH STDIN PARAMETERS
-.TP
-\fIagent = < param >\fR
-This option is used by fence_node(8) and is ignored by fence_eps.
-.TP
-\fIipaddr = < hostname | ip >\fR
-IP address or hostname of ePowerSwitch 8M+ device. If device is configured
-to listen on nonstandard port (other than 80), it's possible to use :port syntax
-(ex. psip:8080).
-.TP
-\fIlogin = < param >\fR
-Login name.
-.TP
-\fIoption = < param >\fR
-The action required.  This can be reboot (default), status, off or on.
-.TP
-\fIpasswd = < param >\fR
-Password for login.
-.TP
-\fIpasswd_script = < param >\fR
-Script to run to retrieve password.
-.TP
-\fIport = < param >\fR
-Physical plug number. Entered without P and with preceding zero (where is needed)
-.TP
-\fIhidden_page = < param >\fR
-Name of hidden page. Default is (hidden.htm)
-.TP
-\fItest = < param >\fR
-Test only.  Answer NO to the confirmation prompt instead of YES.
-.TP
-\fIverbose = < param >\fR
-Verbose.  Record session to stdout, or debug file if specified (see debug).
-.TP
-\fIdebug = < param >\fR
-Specifies file, where will be written debug messages from session.
-
-.SH SEE ALSO
-fence(8), fence_node(8)
diff --git a/fence/man/fence_ibmblade.8 b/fence/man/fence_ibmblade.8
deleted file mode 100644
index ba364c6..0000000
--- a/fence/man/fence_ibmblade.8
+++ /dev/null
@@ -1,61 +0,0 @@
-.TH fence_ibmblade 8
-
-.SH NAME
-fence_ibmblade - I/O Fencing agent for IBM BladeCenter 
-
-.SH SYNOPSIS
-.B
-fence_ibmblade
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_ibmblade is an I/O Fencing agent which can be used with IBM BladeCenter 
-chassis. It issues SNMP Set request to BladeCenter chassis, rebooting, powering
-up or down the specified Blade Server. 
-
-fence_ibmblade accepts options on the command line as well as from stdin.
-fenced sends parameters through stdin when it execs the agent.  fence_ibmblade 
-can be run by itself with command line options which is useful for testing.
-
-.SH OPTIONS
-.TP
-\fB-a\fP \fIIPaddress\fP
-IP address of the BladeCenter chassis. 
-.TP
-\fB-h\fP
-Print out a help message describing available options, then exit.
-.TP
-\fB-c\fP \fIcommunity\fP
-SNMP community string to use.
-.TP
-\fB-n\fP \fIport\fP
-The Blade port number to disable.
-.TP
-\fB-o\fP \fIaction\fP
-The action required.  This can be reboot (default), on or off.
-.TP
-\fB-q\fP
-Quiet mode: print only error messages.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-
-.SH STDIN PARAMETERS
-.TP
-\fIagent = < param >\fR
-This option is used by fence_node(8) and is ignored by fence_ibmblade.
-.TP
-\fIipaddr = < hostname | ip >\fR
-IP address or hostname of the switch.
-.TP
-\fIcommunity = < param >\fR
-SNMP community.
-.TP
-\fIoption = < param >\fR
-The action required.  reboot (default), on or off.
-.TP
-\fIport = < param >\fR
-The Blade port number to disable.
-
-.SH SEE ALSO
-fence(8), fence_node(8)
diff --git a/fence/man/fence_ifmib.8 b/fence/man/fence_ifmib.8
deleted file mode 100644
index 237fcbc..0000000
--- a/fence/man/fence_ifmib.8
+++ /dev/null
@@ -1,69 +0,0 @@
-.\"  Copyright (C) 2008 Ross Vandegrift.  All rights reserved.
-.\"  
-.\"  This copyrighted material is made available to anyone wishing to use,
-.\"  modify, copy, or redistribute it subject to the terms and conditions
-.\"  of the GNU General Public License v.2.
-
-.TH fence_ifmib 8
-
-.SH NAME
-fence_ifmib - I/O Fencing agent for IF-MIB capable SNMP devices
-
-.SH SYNOPSIS
-.B 
-fence_ifmib
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_ifmib is an I/O Fencing agent which can be used with any IF-MIB capable
-SNMP device.  It was written with managed ethernet switches in mind, in order
-to fence iSCSI SAN connections.  However, there are many devices that support
-the IF-MIB interface.  The agent uses IF-MIB::ifAdminStatus to control the
-state of an interface.
-
-fence_ifmib accepts options on the command line as well as from stdin.  
-Fenced sends parameters through stdin when it execs the agent.  fence_ifmib 
-can be run by itself with command line options.  This is useful for testing.
-
-.SH OPTIONS
-.TP
-\fB-a\fP \fIIPaddress\fR
-IP address or hostname of the SNMP agent to be written.
-.TP
-\fB-h\fP 
-Print out a help message describing available options, then exit.
-.TP
-\fB-c\fP \fIcommunity\fR
-The write community string to be used in the request.
-.TP
-\fB-i\fP \fIiIindex\fR
-The ifIndex of the interface to be acted upon.  This will need to be determined
-manually prior to configuration.
-.TP
-\fB-o\fP \fIaction\fR
-The action required.  off (default), on, or status.  off sets ifAdminStatus
-down, on sets ifAdminStatus up, and status returns the current state.
-.TP
-\fB-V\fP
-Verbose.  Print informational messages to standard out.
-
-.SH STDIN PARAMETERS
-.TP
-\fIagent = < param >\fR
-This option is used by fence_node(8) and is ignored by fence_ifmib.
-.TP
-\fIipaddr = < hostname | ip >\fR
-IP address or hostname of the device.
-.TP
-\fIcomm = < param >\fR
-Write community string to be used in the request.
-.TP
-\fIifindex = < param >\fR
-The ifIndex of the interface to be acted upon.
-.TP
-\fIoption = < param >\fR
-The action required.  off (default), on, or status.
-.TP
-
-.SH SEE ALSO
-fence(8), fence_node(8)
diff --git a/fence/man/fence_ilo.8 b/fence/man/fence_ilo.8
deleted file mode 100644
index 7e2d62a..0000000
--- a/fence/man/fence_ilo.8
+++ /dev/null
@@ -1,94 +0,0 @@
-.TH fence_ilo 8
-
-.SH NAME
-fence_ilo - I/O Fencing agent for HP Integrated Lights Out card
-
-.SH SYNOPSIS
-.B
-fence_ilo
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_ilo is an I/O Fencing agent used for HP servers with the Integrated Light 
-Out (iLO) PCI card.  The agent opens an SSL connection to the iLO card.  Once the
-SSL connection is established, the agent is able to communicate with the iLO
-card through an XML stream.  
-
-fence_ilo depends on the pyOpenSSL available in your distribution or 
-downloadable from http://pyopenssl.sourceforge.net
-
-NOTE: fence_ilo deprecates fence_rib.  
-
-.SH OPTIONS
-.TP
-\fB-a\fP \fIIPaddress[:port]\fR
-IP address or hostname of the iLO card.  If the SSL server of the card is
-not running on the default SSL port, 443, then [:port] will also need to be
-specified.
-.TP
-\fB-h\fP 
-Print out a help message describing available options, then exit.
-.TP
-\fB-l\fP \fIlogin\fR
-Login name.
-.TP
-\fB-o\fP \fIaction\fR
-The action required.  reboot (default), off, on or status.
-.TP
-\fB-p\fP \fIpassword\fR
-Password for login or for passphrase.
-.TP
-\fB-S\fP \fIscript\fR
-Script to run to retrieve password.
-\fB-z\fP
-Use secure connection over SSL (default).
-.TP
-\fB-S\fP \fIpath\fR
-Full path to an executable to generate the password for login.
-.TP
-\fB-r\fP \fIprotocol\fR
-RIBCL protocol to use. Default is to autodetect.
-.TP
-\fB-v\fP
-Verbose.  
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-
-.SH STDIN PARAMETERS
-.TP
-\fIaction = < param >\fR
-The action required.  reboot (default), off, on or status.
-.TP
-\fIagent = < param >\fR
-This option is used by fence_node(8) and is ignored by fence_ilo.
-.TP
-\fIhostname = < hostname | ip >\fR
-IP address or hostname of the iLO card.
-.TP
-\fIlogin = < param >\fR
-Login name.
-.TP
-\fIpasswd = < param >\fR
-Password for login or for passphrase.
-.TP
-\fIpasswd_script = < param >\fR
-Script to run to retrieve password.
-.TP
-\fIssl = < param >\fR
-Use secure connection over SSL.
-.TP
-\fIpasswd = < param >\fR
-Password for login.
-.TP
-\fIpasswd_script = < param >\fR
-Full path to an executable to generate the password for login.
-.TP
-\fIribcl = < param >\fR
-RIBCL protocol to use. Default is to autodetect.
-.TP
-\fIverbose = < param >\fR
-Verbose mode.
-
-.SH SEE ALSO
-fence(8), fence_node(8), fence_rib(8)
diff --git a/fence/man/fence_ipmilan.8 b/fence/man/fence_ipmilan.8
deleted file mode 100644
index 19efa99..0000000
--- a/fence/man/fence_ipmilan.8
+++ /dev/null
@@ -1,100 +0,0 @@
-.TH fence_ipmilan 8
-
-.SH NAME
-fence_ipmilan - I/O Fencing agent for machines controlled by IPMI over
-LAN.
-
-.SH SYNOPSIS
-.B
-fence_ipmilan
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_ipmilan is an I/O Fencing agent which can be used with 
-machines controlled by IPMI.  This agent calls support software
-using ipmitool (http://ipmitool.sf.net/).
-
-fence_ipmilan accepts options on the command line as well as from stdin.  
-fenced sends the options through stdin when it execs the agent.  fence_ipmilan
-can be run by itself with command line options which is useful for testing.
-
-.SH OPTIONS
-.TP
-\fB-a\fP \fIIPaddress\fP
-IP address or hostname of the IPMI controller.
-.TP
-\fB-h\fP
-Print out a help message describing available options, then exit.
-.TP
-\fB-l\fP \fIlogin\fP
-Login (if required) with administrative privileges.
-.TP
-\fB-o\fP \fIoption\fP
-Action to perform (on, off, reboot).
-.TP
-\fB-p\fP \fIpassword\fP
-Password (if required) for login.
-.TP
-\fB-S\fP \fIpath\fR
-Full path to an executable to generate the password for login.
-.TP
-\fB-P\fP
-Use the lanplus option if this is a lanplus capable interface (for example iLo2)
-.TP
-\fB-A\fP \fIAuthentication Type\fP
-Can be set to none, password, md2, or md5.
-.TP
-\fB-C\fP \fICiphersuite Type\fP
-If you are using lanplus, this option avails you to define type of ciphersuite to
-use. Standard is 3 (defined if you just use lanplus). For more information please
-refer ipmitool man page (option -C).
-.TP
-\fB-t\fP \fItimeout\fP
-Timeout in seconds for IPMI operation. Default is 10, but in some cases it
-must be set to higher value (anything above 30 is not recommended and may
-cause strange problems).
-.TP
-\fB-q\fP
-Quiet operation.  Only print out error messages.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-.TP
-\fB-v\fP
-Verbose mode.
-
-.SH STDIN PARAMETERS
-.TP
-\fIipaddr = < hostname | ip >\fR
-IP address or hostname of the IPMI controller.
-.TP
-\fIlogin= < param >\fR
-Login (if required) with administrative privileges.
-.TP
-\fIoption = < param >\fR
-Action to perform (on, off, reboot).
-.TP
-\fIpasswd = < param >\fR
-Password (if required) for login.
-.TP
-\fIpasswd_script = < param >\fR
-Full path to an executable to generate the password for login.
-.TP
-\fIauth = < param >\fR
-Authentication type (none, password, md2, md5).
-.TP
-\fItimeout = < param >\fR
-Timeout in seconds for IPMI operation. Default is 10, but in some cases it
-must be set to higher value (anything above 30 is not recommended and may
-cause strange problems).
-.TP
-\fIcipher = < param >\fR
-If you are using lanplus, this option avails you to define type of ciphersuite to
-use. Standard is 3 (defined if you just use lanplus). For more information please
-refer ipmitool man page (option -C).
-.TP
-\fIlanplus\fR
-If we are using the lanplus option for ipmitool
-
-.SH SEE ALSO
-fence(8), fence_node(8), ipmitool(1)
diff --git a/fence/man/fence_ldom.8 b/fence/man/fence_ldom.8
deleted file mode 100644
index 59167c8..0000000
--- a/fence/man/fence_ldom.8
+++ /dev/null
@@ -1,114 +0,0 @@
-.TH fence_ldom 8
-
-.SH NAME
-fence_ldom - I/O Fencing agent for Logical Domains (LDoms)
-
-.SH SYNOPSIS
-.B 
-fence_ldom
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_ldom is an I/O Fencing agent which can be used with LDoms virtual
-machines. This agent works so, that run ldm command on host machine. So
-ldm must be directly runnable. 
-
-Very useful parameter is -c (or cmd_prompt in stdin mode). This must be
-set to something, what is displayed after successful login to host machine.
-Default string is space on end of string (default for root in bash). But
-(for example) csh use ], so in that case you must use parameter -c with
-argument ']'. Very similar situation is, if you use bash and login to host
-machine with other user than root. Than prompt is $, so again, you must
-use parameter -c. 
-
-fence_ldom accepts options on the command line as well as from stdin.  
-Fenced sends parameters through stdin when it execs the agent.  fence_ldom
-can be run by itself with command line options.  This is useful for testing 
-and for turning outlets on or off from scripts.
-
-.SH OPTIONS
-.TP
-\fB-a\fP \fIIPaddress\fR
-IP address or hostname of LDoms host machine.
-.TP
-\fB-h\fP 
-Print out a help message describing available options, then exit.
-.TP
-\fB-l\fP \fIlogin\fR
-Login name to LDoms host machine.
-.TP
-\fB-o\fP \fIaction\fR
-The action required. Valid values are reboot (default), status, off or on.
-.TP
-\fB-p\fP \fIpassword\fR
-Password for login to LDoms host machine.
-.TP
-\fB-B\fP \fIscript\fR
-Script to run to retrieve password.
-.TP
-\fB-x\fP
-Use secure connection over ssh (this is default, and can't be disabled) .
-.TP
-\fB-k\fP \fIfilename\fR
-Identity file (private key) for ssh.
-.TP
-\fB-n\fP \fIname\fR
-Name of quest to fence.
-.TP
-\fB-c\fP \fIprompt\fR
-Force command prompt.
-\fB-T\fP
-Test only.  Answer NO to the confirmation prompt instead of YES.
-.TP
-\fB-v\fP
-Verbose. Record session to stdout, or debug file if specified (see -D).
-.TP
-\fB-D\fP
-Specifies file, where will be written debug messages from session.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-
-.SH STDIN PARAMETERS
-.TP
-\fIagent = < param >\fR
-This option is used by fence_node(8) and is ignored by fence_ldom.
-.TP
-\fIipaddr = < hostname | ip >\fR
-IP address or hostname of LDoms host machine.
-.TP
-\fIaction = < param >\fR
-The action required. Valid values are reboot (default), status, off or on.
-.TP
-\fIlogin = < param >\fR
-Login name to LDoms host machine.
-.TP
-\fIpasswd = < param >\fR
-Password for login to LDoms host machine.
-.TP
-\fIpasswd_script = < param >\fR
-Script to run to retrieve password.
-.TP
-\fIsecure = < param >\fR
-Use secure connection over ssh (this is default, and can't be disabled) 
-.TP
-\fIidentity = < param >\fR
-Identity file (private key) for ssh.
-.TP
-\fIport = < param >\fR
-Name of quest to fence.
-.TP
-\fIcmd_prompt = < param >\fR
-Force command prompt.
-.TP
-\fItest = < param >\fR
-Test only.  Answer NO to the confirmation prompt instead of YES.
-.TP
-\fIverbose = < param >\fR
-Verbose.  Record session to stdout, or debug file if specified (see debug).
-.TP
-\fIdebug = < param >\fR
-Specifies file, where will be written debug messages from session.
-
-.SH SEE ALSO
-fence(8), fence_node(8)
diff --git a/fence/man/fence_manual.8 b/fence/man/fence_manual.8
deleted file mode 100644
index 018ec0d..0000000
--- a/fence/man/fence_manual.8
+++ /dev/null
@@ -1,49 +0,0 @@
-.TH fence_manual 8
-
-.SH NAME
-fence_manual - program run by fenced as a part of manual I/O Fencing
-
-.SH SYNOPSIS
-.B
-fence_manual
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_manual is run by fenced.  It creates a fifo and waits for 
-its counter-part fence_ack_manual(8) to acknowledge that a failed node
-has been reset.  fence_ack_manual(8) should only be run after the operator
-has reset the faulty node.  While waiting for the manual acknowledgement,
-fence_manual also watches for the faulty node to rejoin the cluster;
-if it does, it's taken as an acknowledgement and completes.
-
-Note:  fence_manual is provided for use during testing and evaluation
-only.  Sites should not use fence_manual as the primary fencing method
-on a production cluster.
-
-.SH OPTIONS
-.TP
-\fB-h\fP
-Print out a help message describing available options, then exit.
-.TP
-\fB-q\fP
-quiet mode, no output.
-.TP
-\fB-n\fP \fInodename\fP
-The node name (usually hostname) of the machine that needs to be reset or disconnected from shared storage.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-
-.SH STDIN PARAMETERS
-.TP
-\fIagent = < param >\fR
-This option is used by fence_node(8) and is ignored by fence_manual.
-.TP
-\fInodename = < param >\fR
-The node name (usually hostname) of the machine that needs to be reset or disconnected from storage.
-.TP
-\fIipaddr = < param >\fR
-IP address or hostname of the machine that needs to be reset or disconnected from storage.  (Deprecated; use nodename instead.)
-
-.SH SEE ALSO
-fence(8), fence_node(8), fence_ack_manual(8)
diff --git a/fence/man/fence_mcdata.8 b/fence/man/fence_mcdata.8
deleted file mode 100644
index 2230a66..0000000
--- a/fence/man/fence_mcdata.8
+++ /dev/null
@@ -1,82 +0,0 @@
-.TH fence_mcdata 8
-
-.SH NAME
-fence_mcdata - I/O Fencing agent for McData FC switches
-
-.SH SYNOPSIS
-.B
-fence_mcdata
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_mcdata is an I/O Fencing agent which can be used with McData FC 
-switches.  It logs into a McData switch via telnet and disables a specified 
-port.  Disabling the port which a machine is connected to effectively fences 
-that machine.  Lengthy telnet connections to the switch should be avoided 
-while a GFS cluster is running because the connection will block any necessary 
-fencing actions.
-
-fence_mcdata accepts options on the command line as well as from stdin.
-fenced sends parameters through stdin when it execs the agent.  fence_mcdata 
-can be run by itself with command line options which is useful for testing.
-
-After a fence operation has taken place the fenced machine can no longer connect
-to the McData FC switch.  When the fenced machine is ready to be brought back 
-into the GFS cluster (after reboot) the port on the McData FC switch needs to 
-be enabled. This can be done by running fence_mcdata and specifying the 
-enable action.
-
-.SH OPTIONS
-.TP
-\fB-a\fP \fIIPaddress\fP
-IP address of the switch.
-.TP
-\fB-h\fP
-Print out a help message describing available options, then exit.
-.TP
-\fB-l\fP \fIlogin\fP
-Username name for the switch.
-.TP
-\fB-n\fP \fIport\fP
-The port number to disable on the switch.
-.TP
-\fB-o\fP \fIaction\fP
-The action required.  disable (default) or enable.
-.TP
-\fB-p\fP \fIpassword\fP
-Password for login.
-.TP
-\fB-S\fP \fIpath\fR
-Full path to an executable to generate the password for login.
-.TP
-\fB-q\fP
-Quiet mode: print only error messages.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-
-.SH STDIN PARAMETERS
-.TP
-\fIagent = < param >\fR
-This option is used by fence_node(8) and is ignored by fence_mcdata.
-.TP
-\fIipaddr = < hostname | ip >\fR
-IP address or hostname of the switch.
-.TP
-\fIlogin = < param >\fR
-Login name.
-.TP
-\fIoption = < param >\fR
-The action required.  disable (default) or enable.
-.TP
-\fIpasswd = < param >\fR
-Password for login.
-.TP
-\fIpasswd_script = < param >\fR
-Full path to an executable to generate the password for login.
-.TP
-\fIport = < param >\fR
-The port number to disable on the switch.
-
-.SH SEE ALSO
-fence(8), fence_node(8)
diff --git a/fence/man/fence_node.8 b/fence/man/fence_node.8
deleted file mode 100644
index f109283..0000000
--- a/fence/man/fence_node.8
+++ /dev/null
@@ -1,34 +0,0 @@
-.TH fence_node 8
-
-.SH NAME
-fence_node - A program which performs I/O fencing on a single node.
-
-.SH SYNOPSIS
-.B
-fence_node
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-\fBfence_node\fP is a program that reads the fencing settings from
-cluster.conf (through libccs/ccsd) for the given node and then runs the
-configured fencing agent against the node.
-
-.SH OPTIONS
-.TP
-\fB-h\fP
-Help.  Print out the usage syntax.
-.TP
-\fB-O\fP
-Force a connection to CCS.  This overrides the usual
-requirement that the cluster be quorate to get information from ccs.
-.TP
-\fB-V\fP
-Print version information.
-
-.SH EXAMPLES
-.TP
-To fence a node called ``bellerophon'':
-prompt> fence_node bellerophon
-
-.SH SEE ALSO
-fence(8), ccs(7)
diff --git a/fence/man/fence_rackswitch.8 b/fence/man/fence_rackswitch.8
deleted file mode 100644
index 4f662c7..0000000
--- a/fence/man/fence_rackswitch.8
+++ /dev/null
@@ -1,68 +0,0 @@
-.TH fence_rackswitch 8
-
-.SH NAME
-fence_rackswitch - I/O Fencing agent for RackSaver RackSwitch
-
-.SH SYNOPSIS
-.B
-fence_rackswitch
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_rackswitch is an I/O Fencing agent which can be used with the RackSaver 
-RackSwitch.  It logs into the RackSwitch and boots a specified plug.
-Using the http interface to the RackSwitch should be avoided while a GFS cluster is 
-running because the connection may interfere with the operation of this agent.
-
-fence_rackswitch accepts options on the command line as well as from stdin.  
-fenced sends the options through stdin when it execs the agent.  fence_rackswitch 
-can be run by itself with command line options which is useful for testing.
-
-.SH OPTIONS
-.TP
-\fB-a\fP \fIIPaddress\fP
-IP address of the switch.
-.TP
-\fB-h\fP
-Print out a help message describing available options, then exit.
-.TP
-\fB-n\fP \fIplug\fP
-The plug number to power cycle.
-.TP
-\fB-p\fP \fIpassword\fP
-Password for login.
-.TP
-\fB-S\fP \fIpath\fR
-Full path to an executable to generate the password for login.
-.TP
-\fB-l\fP \fIusername\fP
-Username for login.
-.TP
-\fB-q\fP
-Quiet operation.  Only print out error messages.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-
-.SH STDIN PARAMETERS
-.TP
-\fIagent = < param >\fR
-This option is used by fence_node(8) and is ignored by fence_rackswitch.
-.TP
-\fIipaddr = < ip >\fR
-IP address of the switch.
-.TP
-\fIusername = < param >\fR
-Username for login.
-.TP
-\fIpassword = < param >\fR
-Password for login.
-.TP
-\fIpasswd_script = < param >\fR
-Full path to an executable to generate the password for login.
-.TP
-\fIport = < param >\fR
-The port (outlet) number to act upon.
-
-.SH SEE ALSO
-fence(8), fence_node(8)
diff --git a/fence/man/fence_rib.8 b/fence/man/fence_rib.8
deleted file mode 100644
index 04ace3f..0000000
--- a/fence/man/fence_rib.8
+++ /dev/null
@@ -1,10 +0,0 @@
-.TH fence_rib 8
-
-.SH NAME
-fence_rib - I/O Fencing agent for Compaq Remote Insight Lights Out card
-
-.SH DESCRIPTION
-fence_rib is deprecated.  fence_ilo should be used instead
-
-.SH SEE ALSO
-fence_ilo(8)
diff --git a/fence/man/fence_rsa.8 b/fence/man/fence_rsa.8
deleted file mode 100644
index ad50860..0000000
--- a/fence/man/fence_rsa.8
+++ /dev/null
@@ -1,69 +0,0 @@
-.TH fence_rsa 8
-
-.SH NAME
-fence_rsa - I/O Fencing agent for IBM RSA II
-
-.SH SYNOPSIS
-.B 
-fence_rsa
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_rsa is an I/O Fencing agent which can be used with the IBM RSA II
-management interface.  It logs into an RSA II device via telnet and reboots
-the associated machine. Lengthy telnet connections to the RSA II device 
-should be avoided while a GFS cluster is running because the connection 
-will block any necessary fencing actions.
-
-fence_rsa accepts options on the command line as well as from stdin.  
-Fenced sends parameters through stdin when it execs the agent.  fence_rsa 
-can be run by itself with command line options.  This is useful for testing.
-
-.SH OPTIONS
-.TP
-\fB-a\fP \fIIPaddress\fR
-IP address or hostname of the RSA II device.
-.TP
-\fB-h\fP 
-Print out a help message describing available options, then exit.
-.TP
-\fB-l\fP \fIlogin\fR
-Login name.
-.TP
-\fB-o\fP \fIaction\fR
-The action required.  This can be reboot (default), off, on, or status.
-.TP
-\fB-p\fP \fIpassword\fR
-Password for login.
-.TP
-\fB-S\fP \fIpath\fR
-Full path to an executable to generate the password for login.
-.TP
-\fB-v\fP
-Verbose.  Print informational messages to standard out.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-
-.SH STDIN PARAMETERS
-.TP
-\fIagent = < param >\fR
-This option is used by fence_node(8) and is ignored by fence_rsa.
-.TP
-\fIipaddr = < hostname | ip >\fR
-IP address or hostname of the device.
-.TP
-\fIlogin = < param >\fR
-Login name.
-.TP
-\fIoption = < param >\fR
-The action required.  This can be reboot (default), off, on, or status.
-.TP
-\fIpasswd = < param >\fR
-Password for login.
-.TP
-\fIpasswd_script = < param >\fR
-Full path to an executable to generate the password for login.
-
-.SH SEE ALSO
-fence(8), fence_node(8)
diff --git a/fence/man/fence_rsb.8 b/fence/man/fence_rsb.8
deleted file mode 100644
index 2bb7bf4..0000000
--- a/fence/man/fence_rsb.8
+++ /dev/null
@@ -1,75 +0,0 @@
-.TH fence_rsb 8
-
-.SH NAME
-fence_rsb - I/O Fencing agent for Fujitsu-Siemens RSB
-
-.SH SYNOPSIS
-.B 
-fence_rsb
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_rsb is an I/O Fencing agent which can be used with the Fujitsu-Siemens
-RSB management interface.  It logs into an RSB device via telnet and reboots
-the associated machine. Lengthy telnet connections to the RSB device 
-should be avoided while a GFS cluster is running because the connection 
-will block any necessary fencing actions.
-
-fence_rsb accepts options on the command line as well as from stdin.  
-Fenced sends parameters through stdin when it execs the agent.  fence_rsb
-can be run by itself with command line options.  This is useful for testing.
-
-.SH OPTIONS
-.TP
-\fB-a\fP \fIIPaddress\fR
-IP address or hostname of the RSB device.
-.TP
-\fB-h\fP 
-Print out a help message describing available options, then exit.
-.TP
-\fB-l\fP \fIlogin\fR
-Login name.
-.TP
-\fB-n\fP \fItelnet_port\fR
-The port number on which the telnet service listens.
-.TP
-\fB-o\fP \fIaction\fR
-The action required.  This can be reboot (default), off, on, or status.
-.TP
-\fB-p\fP \fIpassword\fR
-Password for login.
-.TP
-\fB-S\fP \fIpath\fR
-Full path to an executable to generate the password for login.
-.TP
-\fB-v\fP
-Verbose.  Print informational messages to standard out.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-
-.SH STDIN PARAMETERS
-.TP
-\fIagent = < param >\fR
-This option is used by fence_node(8) and is ignored by fence_rsb.
-.TP
-\fIipaddr = < hostname | ip >\fR
-IP address or hostname of the device.
-.TP
-\fItelnet_port = < port number >\fR
-The port number on which the telnet service listens.
-.TP
-\fIlogin = < param >\fR
-Login name.
-.TP
-\fIoption = < param >\fR
-The action required.  This can be reboot (default), off, on, or status.
-.TP
-\fIpasswd = < param >\fR
-Password for login.
-.TP
-\fIpasswd_script = < param >\fR
-Full path to an executable to generate the password for login.
-
-.SH SEE ALSO
-fence(8), fence_node(8)
diff --git a/fence/man/fence_sanbox2.8 b/fence/man/fence_sanbox2.8
deleted file mode 100644
index 0133105..0000000
--- a/fence/man/fence_sanbox2.8
+++ /dev/null
@@ -1,82 +0,0 @@
-.TH fence_sanbox2 8
-
-.SH NAME
-fence_sanbox2 - I/O Fencing agent for QLogic SANBox2 FC switches
-
-.SH SYNOPSIS
-.B
-fence_sanbox2
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_sanbox2 is an I/O Fencing agent which can be used with QLogic SANBox2 FC 
-switches.  It logs into a SANBox2 switch via telnet and disables a specified 
-port.  Disabling the port which a machine is connected to effectively fences 
-that machine.  Lengthy telnet connections to the switch should be avoided 
-while a GFS cluster is running because the connection will block any necessary 
-fencing actions.
-
-fence_sanbox2 accepts options on the command line as well as from stdin.
-fenced sends parameters through stdin when it execs the agent.  fence_sanbox2 
-can be run by itself with command line options which is useful for testing.
-
-After a fence operation has taken place the fenced machine can no longer connect
-to the switch.  When the fenced machine is ready to be brought back 
-into the GFS cluster (after reboot) the port on the FC switch needs to 
-be enabled. This can be done by running fence_sanbox2 and specifying the 
-enable action.
-
-.SH OPTIONS
-.TP
-\fB-a\fP \fIIPaddress\fP
-IP address of the switch.
-.TP
-\fB-h\fP
-Print out a help message describing available options, then exit.
-.TP
-\fB-l\fP \fIlogin\fP
-Login name for the switch.
-.TP
-\fB-n\fP \fIport\fP
-The port number to disable on the switch.
-.TP
-\fB-o\fP \fIaction\fP
-The action required.  disable (default) or enable.
-.TP
-\fB-p\fP \fIpassword\fP
-Password for login.
-.TP
-\fB-S\fP \fIpath\fR
-Full path to an executable to generate the password for login.
-.TP
-\fB-q\fP
-Quiet mode: print only error messages.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-
-.SH STDIN PARAMETERS
-.TP
-\fIagent = < param >\fR
-This option is used by fence_node(8) and is ignored by fence_sanbox2.
-.TP
-\fIipaddr = < hostname | ip >\fR
-IP address or hostname of the switch.
-.TP
-\fIlogin = < param >\fR
-Login name.
-.TP
-\fIoption = < param >\fR
-The action required.  disable (default) or enable.
-.TP
-\fIpasswd = < param >\fR
-Password for login.
-.TP
-\fIpasswd_script = < param >\fR
-Full path to an executable to generate the password for login.
-.TP
-\fIport = < param >\fR
-The port number to disable on the switch.
-
-.SH SEE ALSO
-fence(8), fence_node(8)
diff --git a/fence/man/fence_scsi.8 b/fence/man/fence_scsi.8
deleted file mode 100644
index c714fc7..0000000
--- a/fence/man/fence_scsi.8
+++ /dev/null
@@ -1,103 +0,0 @@
-.TH fence_scsi 8
-
-.SH NAME
-fence_scsi - I/O fencing agent for SCSI persistent reservations
-
-.SH SYNOPSIS
-.B 
-fence_scsi
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_scsi is an I/O fencing agent which can be used with the SCSI
-devices that support persistent reservations (SPC-2 or greater).
-
-SCSI persistent reservations work by having each node in the cluster
-register with the SCSI device. Registration is done using a unique key
-(based on the node's IP address). Each node that will perform I/O
-operations to the shared storage must register with the device. This
-is done at system startup with the scsi_reserve init script. This
-script will discover all clustered volumes as well as the underlying
-SCSI device(s). Device discovery is done via the lvs command (see
-lvs(8)) and is subject to any filtering rules defined in the lvm.conf
-file.
-
-After generating the node's unique key, the script will register the
-node with the SCSI device(s) that were discovered. Once the node is
-registered, the script will attempt to create a reservation. Unlike
-registrations, of which there are multiple registrants (one for each
-node in the cluster), there is only one reservation holder. If a
-reservation does not already exist for a device, the script will
-create a reservation using the node's unique key.
-
-It is important to distinguish between registrations and
-reservations. As mentioned above, each node that will perform I/O
-operations to the SCSI device must register. As a result, there will
-be multiple registrations for a given SCSI device. In contrast, there
-can only be one reservation per SCSI device. It is not important which
-node holds the reservation. The reservation simply tells the device
-how the registrants are allowed to access the device. For our
-purposes, the reservation type is "write exclusive, registrants only".
-With this reservation type, only registered nodes will be able to
-write to the device.
-
-When the cluster must fence a node, it simply revokes a node's
-registration, or "unregisters" the node. This operation also uses the
-node's unique key. By deriving the unique key based on the errant
-node's IP address, the cluster can "unregister" the key. As a
-result, the errant node will no longer be able to write to the SCSI
-device.
-
-Note that the node that holds the reservation for a device must also
-be registered with that device. When the situation arises where the
-node that is being fenced is also the reservation holder, the
-reservation must be moved. This is handled by using the
-"preempt-and-abort command" which will transfer the reservation from
-the node that is being fenced to the node that is performing the
-fencing. This operation will maintain the reservation while
-"unregistering" the node being fenced.
-
-At system shutdown, the scsi_reserve script will attempt to
-"unregister" the node from all devices. The exception is when the
-node happens to be the reservation holder. In this case, the script
-does nothing, due to the fact that there may be other nodes using the
-device and the reservation must remain intact.
-
-fence_scsi accepts options on the command line as well as from stdin.
-fenced sends parameters through stdin when it execs the agent.  fence_scsi
-can be run by itself with command line options.  This is useful for testing 
-and for turning outlets on or off from scripts.
-
-.SH OPTIONS
-.TP
-\fB-n\fP \fInode\fR
-Name of the node to be fenced.
-.TP
-\fB-h\fP
-Print out a help message describing available options, then exit.
-.TP
-\fB-s\fP \fIself\fR
-Name of the node that will perform the fencing operation.
-.TP
-\fB-v\fP
-Verbose output.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-
-.SH STDIN PARAMETERS
-.TP
-\fIagent = < param >\fR
-This option is used by fence_node(8) and is ignored by fence_scsi.
-.TP
-\fInodename = < hostname | ip >\fR
-Name of the node to be fenced.
-.TP
-\fIself = < nodename >\fR
-Name of the node that will perform the fencing operation.
-.TP
-\fIverbose = < param >\fR
-Verbose output.
-
-.SH SEE ALSO
-fence(8), fence_node(8), sg_persist(8), lvs(8), lvm.conf(5)
diff --git a/fence/man/fence_tool.8 b/fence/man/fence_tool.8
deleted file mode 100644
index 625fbe0..0000000
--- a/fence/man/fence_tool.8
+++ /dev/null
@@ -1,42 +0,0 @@
-.TH fence_tool 8
-
-.SH NAME
-fence_tool - A program to join and leave the fence domain
-
-.SH SYNOPSIS
-.B
-fence_tool
-<\fBjoin | leave | ls | dump\fP> 
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-\fBfence_tool\fP is a program used to join or leave the default fence
-domain.  It communicates with the fenced daemon.  Before telling fenced
-to join the domain, fence_tool waits for the cluster to have quorum,
-making it easier to cancel the command if the cluster is inquorate.
-
-The dump option will read fenced's ring buffer of debug messages and print
-it to stdout.
-
-.SH OPTIONS
-.TP
-\fB-m\fP <n>
-Delay join up to n seconds for all nodes in cluster.conf to be cluster members.
-.TP
-\fB-w\fP
-Wait until the join or leave is completed.
-.TP
-\fB-h\fP
-Help.  Print out the usage syntax.
-.TP
-\fB-V\fP
-Print version information.
-.TP
-\fB-t\fP <n>
-Maximum time in seconds to wait for quorum or -w (default: 300 seconds)
-.TP
-\fB-Q\fP
-Fail command immediately if the cluster is not quorate, don't wait.
-
-.SH SEE ALSO
-fenced(8), fence(8), fence_node(8)
diff --git a/fence/man/fence_virsh.8 b/fence/man/fence_virsh.8
deleted file mode 100644
index 9f4f281..0000000
--- a/fence/man/fence_virsh.8
+++ /dev/null
@@ -1,104 +0,0 @@
-.TH fence_virsh 8
-
-.SH NAME
-fence_virsh - I/O Fencing agent for libvirt virtual machines using
-
-.SH SYNOPSIS
-.B
-fence_virsh
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_virsh is an I/O Fencing agent which can be used with the virtual machines
-managed by libvirt. It logs via ssh to a dom0 and there run virsh command,
-which does all work.
-
-By default, virsh needs root account to do properly work. So you must allow
-ssh login in your sshd_config.
-
-fence_virsh accepts options on the command line as well as from stdin.
-Fenced sends parameters through stdin when it execs the agent.  fence_virsh
-can be run by itself with command line options.  This is useful for testing 
-and for turning outlets on or off from scripts.
-
-.SH OPTIONS
-.TP
-\fB-a\fP \fIIPaddress\fR
-IP address or hostname of dom0.
-.TP
-\fB-h\fP
-Print out a help message describing available options, then exit.
-.TP
-\fB-l\fP \fIlogin\fR
-Login name of user root in dom0.
-.TP
-\fB-o\fP \fIaction\fR
-The action required.  This can be reboot (default), status, off, on, list or monitor.
-.TP
-\fB-p\fP \fIpassword\fR
-Password for login or for passphrase for dom0 machine.
-.TP
-\fB-B\fP \fIscript\fR
-Script to run to retrieve password for dom0 machine.
-.TP
-\fB-n\fP \fIname\fR
-Name of virtual machine to fence
-.TP
-\fB-x\fP
-Use secure connection over ssh (this is default, and can't be disabled)
-.TP
-\fB-k\fP \fIfilename\fR
-Identity file (private key) for ssh
-.TP
-\fB-T\fP
-Test only. Answer NO to the confirmation prompt instead of YES.
-.TP
-\fB-v\fP
-Verbose. Record session to stdout, or debug file if specified (see -D).
-.TP
-\fB-D\fP
-Specifies file, where will be written debug messages from session.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-
-.SH STDIN PARAMETERS
-.TP
-\fIagent = < param >\fR
-This option is used by fence_node(8) and is ignored by fence_virsh.
-.TP
-\fIipaddr = < hostname | ip >\fR
-IP address or hostname of dom0.
-.TP
-\fIlogin = < param >\fR
-Login name of user root in dom0.
-.TP
-\fIoption = < param >\fR
-The action required.  This can be reboot (default), status, off or on.
-.TP
-\fIpasswd = < param >\fR
-Password for login or for passphrase for dom0 machine.
-.TP
-\fIpasswd_script = < param >\fR
-Script to run to retrieve password for dom0 machine.
-.TP
-\fIport = < param >\fR
-Name of virtual machine to fence.
-.TP
-\fIsecure = < param >\fR
-Use secure connection over ssh (this is default, and can't be disabled)
-.TP
-\fIidentity_file = < param >\fR
-Identity file (private key) for ssh
-.TP
-\fItest = < param >\fR
-Test only.  Answer NO to the confirmation prompt instead of YES.
-.TP
-\fIverbose = < param >\fR
-Verbose.  Record session to stdout, or debug file if specified (see debug).
-.TP
-\fIdebug = < param >\fR
-Specifies file, where will be written debug messages from session.
-
-.SH SEE ALSO
-fence(8), fence_node(8)
diff --git a/fence/man/fence_vixel.8 b/fence/man/fence_vixel.8
deleted file mode 100644
index dc285c5..0000000
--- a/fence/man/fence_vixel.8
+++ /dev/null
@@ -1,70 +0,0 @@
-.TH fence_vixel 8
-
-.SH NAME
-fence_vixel - I/O Fencing agent for Vixel FC switches
-
-.SH SYNOPSIS
-.B
-fence_vixel
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_vixel is an I/O Fencing agent which can be used with Vixel FC switches.
-It logs into a Vixel switch via telnet and removes the specified port from the
-zone.  Removing the zone access from the port disables the port from being able
-to access the storage.  
-
-fence_vixel accepts options on the command line as well as from stdin.
-fenced sends parameters through stdin when it execs the agent.  fence_vixel 
-can be run by itself with command line options which is useful for testing.
-
-After a fence operation has taken place the fenced machine can no longer 
-connect to the Vixel FC switch.  When the fenced machine is ready to be brought
-back into the GFS cluster (after reboot) the port on the Vixel FC switch needs 
-to be enabled. In order to do this, log into the Vixel FC switch. Then go to:
-
-config->zones->config <port> <comma-separated-list-of-ports-in-the-zone>
-
-Then apply
-
-Consult the Vixel manual for details
-
-.SH OPTIONS
-.TP
-\fB-a\fP \fIIPaddress\fP
-IP address of the switch.
-.TP
-\fB-h\fP
-Print out a help message describing available options, then exit.
-.TP
-\fB-n\fP \fIport\fP
-The port number to remove zoning from on the switch.
-.TP
-\fB-p\fP \fIpassword\fP
-Password for login.
-.TP
-\fB-S\fP \fIpath\fR
-Full path to an executable to generate the password for login.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-
-.SH STDIN PARAMETERS
-.TP
-\fIagent = < param >\fR
-This option is used by fence_node(8) and is ignored by fence_vixel.
-.TP
-\fIipaddr = < hostname | ip >\fR
-IP address or hostname of the switch.
-.TP
-\fIpasswd = < param >\fR
-Password for login.
-.TP
-\fIpasswd_script = < param >\fR
-Full path to an executable to generate the password for login.
-.TP
-\fIport = < param >\fR
-The port number to remove zoning from on the switch.
-
-.SH SEE ALSO
-fence(8), fence_node(8)
diff --git a/fence/man/fence_vmware.8 b/fence/man/fence_vmware.8
deleted file mode 100644
index 6f75afa..0000000
--- a/fence/man/fence_vmware.8
+++ /dev/null
@@ -1,131 +0,0 @@
-.TH fence_vmware 8
-
-.SH NAME
-fence_vmware - I/O Fencing agent for VMware virtual machines
-
-.SH SYNOPSIS
-.B 
-fence_vmware
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_vmware is an I/O Fencing agent which can be used with the VMware ESX or
-VMware Server to fence virtual machines. It logs via ssh to a VMware ESX (or Server) 
-physical machine and there run vmware-cmd, which does all work. 
-
-By default, VMware ESX has disabled root account so you must create annother user 
-account with limited permissions on VMWare ESX machine. 
-
-Better idea is install right version of vmware-cmd (with same API) to any other machine 
-in network and use it for fencing.
-
-fence_vmware accepts options on the command line as well as from stdin.  
-Fenced sends parameters through stdin when it execs the agent.  fence_vmware
-can be run by itself with command line options.  This is useful for testing 
-and for turning outlets on or off from scripts.
-
-.SH OPTIONS
-.TP
-\fB-a\fP \fIIPaddress\fR
-IP address or hostname of machine where is vmware-cmd.
-.TP
-\fB-A\fP \fIIPAdress\fR
-IP adress or hostname of machine where is runing vmware. Default is localhost.
-.TP
-\fB-h\fP 
-Print out a help message describing available options, then exit.
-.TP
-\fB-l\fP \fIlogin\fR
-Login name of machine with vmware-cmd.
-.TP
-\fB-L\fP \fIlogin\fR
-Login name to VMware administration interface.
-.TP
-\fB-o\fP \fIaction\fR
-The action required.  This can be reboot (default), status, off or on.
-.TP
-\fB-p\fP \fIpassword\fR
-Password for login or for passphrase for machine with vmware-cmd.
-.TP
-\fB-P\fP \fIpassword\fR
-Password for login to VMware administration interface.
-.TP
-\fB-B\fP \fIscript\fR
-Script to run to retrieve password for machine with vmware-cmd.
-.TP
-\fB-R\fP \fIscript\fR
-Script to run to retrieve password for VMware administration interface.
-.TP
-\fB-n\fP \fIname\fR
-Name of virtual machine to fence (ie. /vmfs/volumes/48bfcbd1-4624461c-8250-0015c5f3ef0f/Rhel/Rhel.vmx)
-.TP
-\fB-x\fP
-Use secure connection over ssh (this is default, and can't be disabled) 
-.TP
-\fB-k\fP \fIfilename\fR
-Identity file (private key) for ssh
-.TP
-\fB-T\fP
-Test only.  Answer NO to the confirmation prompt instead of YES.
-.TP
-\fB-v\fP
-Verbose. Record session to stdout, or debug file if specified (see -D).
-.TP
-\fB-D\fP
-Specifies file, where will be written debug messages from session.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-
-.SH STDIN PARAMETERS
-.TP
-\fIagent = < param >\fR
-This option is used by fence_node(8) and is ignored by fence_vmware.
-.TP
-\fIipaddr = < hostname | ip >\fR
-IP address or hostname of machine where is vmware-cmd.
-.TP
-\fIvmipaddr = < hostname | ip >\fR
-IP adress or hostname of machine where is runing vmware. Default is localhost.
-.TP
-\fIlogin = < param >\fR
-Login name of machine with vmware-cmd.
-.TP
-\fIvmlogin = < param >\fR
-Login name to VMware administration interface.
-.TP
-\fIoption = < param >\fR
-The action required.  This can be reboot (default), status, off or on.
-.TP
-\fIpasswd = < param >\fR
-Password for login or for passphrase for machine with vmware-cmd.
-.TP
-\fIvmpasswd = < param >\fR
-Password for login to VMware administration interface.
-.TP
-\fIpasswd_script = < param >\fR
-Script to run to retrieve password for machine with vmware-cmd.
-.TP
-\fIvmpasswd_script = < param >\fR
-Script to run to retrieve password for VMware administration interface.
-.TP
-\fIport = < param >\fR
-Name of virtual machine to fence (ie. /vmfs/volumes/48bfcbd1-4624461c-8250-0015c5f3ef0f/Rhel/Rhel.vmx)
-.TP
-\fIsecure = < param >\fR
-Use secure connection over ssh (this is default, and can't be disabled) 
-.TP 
-\fIidentity_file = < param >\fR
-Identity file (private key) for ssh
-.TP
-\fItest = < param >\fR
-Test only.  Answer NO to the confirmation prompt instead of YES.
-.TP
-\fIverbose = < param >\fR
-Verbose.  Record session to stdout, or debug file if specified (see debug).
-.TP
-\fIdebug = < param >\fR
-Specifies file, where will be written debug messages from session.
-
-.SH SEE ALSO
-fence(8), fence_node(8)
diff --git a/fence/man/fence_vmware_vmrun.8 b/fence/man/fence_vmware_vmrun.8
deleted file mode 100644
index dcf4a78..0000000
--- a/fence/man/fence_vmware_vmrun.8
+++ /dev/null
@@ -1,137 +0,0 @@
-.TH fence_vmware_vmrun 8
-
-.SH NAME
-fence_vmware_vmrun - Another I/O Fencing agent for VMware virtual machines
-
-.SH SYNOPSIS
-.B
-fence_vmware_vmrun
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_vmware_vmrun is an I/O Fencing agent which can be used with the VMware ESX,
-VMware ESXi or VMware Server to fence virtual machines. It is based on different
-idea than fence_vmware and don't need to make ssh connection to ESX server. This
-is main advantage, because ESXi doesn't have remote ssh administration console.
-
-Before you can use this agent, it must be installed vmrun command on every node
-you want to make fencing. Vmrun command is available as part of VMware VIX API
-SDK package, which is available from VMware web pages (not in official RHEL
-repository!). After you have successfully installed VIX API, you should be able
-to run vmrun command. This agent supports only vmrun from version 2.0.0 (VIX API
-1.6.0).
-
-fence_vmware_vmrun accepts options on the command line as well as from stdin.
-Fenced sends parameters through stdin when it execs the agent. fence_vmware_vmrun
-can be run by itself with command line options. This is useful for testing
-and for turning outlets on or off from scripts.
-
-.SH HOST NAME/IP ADDRESS SPECIFICATION
-Host name may be entered in many ways and this string is forwarded directly to
-vmrun command. Basic usage is protocol://host_name:[port]/sdk. If you want
-secure (https) connection, just use https as protocol, otherwise use http
-(this is reason, why agent doesn't have any secure switch). Port isn't
-mandatory, but you must use it, if you try use this agent against VMware
-server 2.0.0 with default options, where https console runs on port 8333 and
-http on 8222. In case of ESX/ESXi, you don't need to specify port, because
-default configuration runs https on standard (443) port.
-
-Don't forget to add /sdk suffix, otherwise agent will not work!
-
-.SH OPTIONS
-.TP
-\fB-a\fP \fIIPaddress\fR
-IP address or hostname of ESX/ESXi host machine. See (see
-.SM
-.B "HOST NAME/IP ADDRESS SPECIFICATION"
-above).
-.TP
-\fB-h\fP
-Print out a help message describing available options, then exit.
-.TP
-\fB-l\fP \fIlogin\fR
-Login name to VMware administration console.
-.TP
-\fB-o\fP \fIaction\fR
-The action required.  This can be reboot (default), status, off, on, list
-or monitor.
-.TP
-\fB-p\fP \fIpassword\fR
-Password for login for VMware administration console.
-.TP
-\fB-S\fP \fIscript\fR
-Script to run to retrieve password for VMware administration console.
-.TP
-\fB-n\fP \fIname\fR
-Name of virtual machine to fence (ie.[datastore1] test/test.vmx) which
-is returned by list command.
-.TP
-\fB-c\fP \fIcommand\fR
-Location of vmrun command. Default is /usr/bin/vmrun, but if you are using
-nonstandard location, you may find this switch useful.
-.TP
-\fB-d\fP \fItype\fR
-Type of VMware product you are trying to connect. This is directly forwarded
-to vmrun command as -T switch. Default is esx, which is internally alias
-for server (2.0.x) , which use same VIX API as ESX and ESXi.
-.TP
-\fB-T\fP
-Test only.  Answer NO to the confirmation prompt instead of YES.
-.TP
-\fB-v\fP
-Verbose. Record session to stdout, or debug file if specified (see -D).
-.TP
-\fB-D\fP
-Specifies file, where will be written debug messages from session.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-
-.SH STDIN PARAMETERS
-.TP
-\fIagent = < param >\fR
-This option is used by fence_node(8) and is ignored by fence_vmware_vmrun.
-.TP
-\fIipaddr = < hostname | ip >\fR
-IP address or hostname of ESX/ESXi host machine. See (see
-.SM
-.B "HOST NAME/IP ADDRESS SPECIFICATION"
-above).
-.TP
-\fIlogin = < param >\fR
-Login name to VMware administration console.
-.TP
-\fIoption = < param >\fR
-The action required.  This can be reboot (default), status, off, on, list
-or monitor.
-.TP
-\fIpasswd = < param >\fR
-Password for login for VMware administration console.
-.TP
-\fIpasswd_script = < param >\fR
-Script to run to retrieve password for VMware administration console.
-.TP
-\fIport = < param >\fR
-Name of virtual machine to fence (ie.[datastore1] test/test.vmx) which
-is returned by list command.
-.TP
-\fIvmrun_cmd = < param >\fR
-Location of vmrun command. Default is /usr/bin/vmrun, but if you are using
-nonstandard location, you may find this switch useful.
-.TP
-\fIhost_type = < param >\fR
-Type of VMware product you are trying to connect. This is directly forwarded
-to vmrun command as -T switch. Default is esx, which is internally alias
-for server (2.0.x) , which use same VIX API as ESX and ESXi.
-.TP
-\fItest = < param >\fR
-Test only.  Answer NO to the confirmation prompt instead of YES.
-.TP
-\fIverbose = < param >\fR
-Verbose.  Record session to stdout, or debug file if specified (see debug).
-.TP
-\fIdebug = < param >\fR
-Specifies file, where will be written debug messages from session.
-
-.SH SEE ALSO
-fence(8), fence_node(8), fence_vmware(8)
diff --git a/fence/man/fence_wti.8 b/fence/man/fence_wti.8
deleted file mode 100644
index c2ed90d..0000000
--- a/fence/man/fence_wti.8
+++ /dev/null
@@ -1,83 +0,0 @@
-.TH fence_wti 8
-
-.SH NAME
-fence_wti - I/O Fencing agent for WTI Network Power Switch
-
-.SH SYNOPSIS
-.B
-fence_wti
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_wti is an I/O Fencing agent which can be used with the WTI Network 
-Power Switch (NPS).  It logs into an NPS via telnet or ssh and boots a specified plug.
-Lengthy telnet connections to the NPS should be avoided while a GFS cluster is 
-running because the connection will block any necessary fencing actions.
-
-fence_wti accepts options on the command line as well as from stdin.  
-fenced sends the options through stdin when it execs the agent.  fence_wti 
-can be run by itself with command line options which is useful for testing.
-
-.SH OPTIONS
-.TP
-\fB-a\fP \fIIPaddress\fP
-IP address of the switch.
-.TP
-\fB-h\fP
-Print out a help message describing available options, then exit.
-.TP
-\fB-n\fP \fIplug\fP
-The plug number to power cycle.
-.TP
-\fB-p\fP \fIpassword\fP
-Password for login or for passphrase.
-.TP
-\fB-S\fP \fIscript\fR
-Script to run to retrieve password.
-.TP
-\fB-x\fP
-Use secure connection over ssh.
-.TP
-\fB-S\fP \fIpath\fR
-Full path to an executable to generate the password for login.
-.TP
-\fB-T\fP
-Test only.  Do not power cycle.  Reports state of the plug.
-.TP
-\fB-q\fP
-Quiet operation.  Only print out error messages.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-
-.SH STDIN PARAMETERS
-.TP
-\fIagent = < param >\fR
-This option is used by fence_node(8) and is ignored by fence_wti.
-.TP
-\fIipaddr = < hostname | ip >\fR
-IP address or hostname of the switch.
-.TP
-\fIpasswd = < param >\fR
-Password for login or for passphrase.
-.TP
-\fIpasswd_script = < param >\fR
-Script to run to retrieve password.
-.TP
-\fIidentity_file = < param > \fR
-Identity file (private key) for ssh.
-.TP
-\fIsecure = < param >\fR
-Use secure connection over ssh.
-.TP
-\fIpasswd_script = < param >\fR
-Full path to an executable to generate the password for login.
-.TP
-\fIport = < param >\fR
-The outlet number to act upon.
-.TP
-\fItest = < param >\fR
-Test only.  Answer NO to the confirmation prompt instead of YES.
-
-.SH SEE ALSO
-fence(8), fence_node(8)
diff --git a/fence/man/fence_xcat.8 b/fence/man/fence_xcat.8
deleted file mode 100644
index 7da35d5..0000000
--- a/fence/man/fence_xcat.8
+++ /dev/null
@@ -1,61 +0,0 @@
-.TH fence_xcat 8
-
-.SH NAME
-fence_xcat - I/O Fencing agent for xcat environments
-
-.SH SYNOPSIS
-.B
-fence_xcat
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_xcat is a wrapper to the rpower(1) command that is distributed
-with the xCAT project available at http://www.xcat.org.  Use of 
-fence_xcat requires that xcat has already been properly configured
-for your environment.  Refer to xCAT(1) for more information on 
-configuring xCAT.
-
-fence_xcat accepts options on the command line as well as from stdin.
-fenced sends parameters through stdin when it execs the agent.  fence_xcat 
-can be run by itself with command line options which is useful for testing.
-
-NOTE: It is recommended that fence_bladecenter(8) is used instead of fence_xcat if
-the bladecenter firmware supports telnet.  This interface is much cleaner and
-easier to setup.
-
-.SH OPTIONS
-.TP
-\fB-h\fP
-Print out a help message describing available options, then exit.
-.TP
-\fB-n\fP \fInodename\fP
-The nodename as defined in nodelist.tab of the xCAT setup.
-.TP
-\fB-o\fP \fIaction\fP
-The action required.  on, off, reset (default) or stat.
-.TP
-\fB-r\fP \fIrpower\fP
-The path to the rpower binary.
-.TP
-\fB-q\fP
-Quiet mode: print only error messages.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-
-.SH STDIN PARAMETERS
-.TP
-\fIagent = < param >\fR
-This option is used by fence_node(8) and is ignored by fence_xcat.
-.TP
-\fInodename = < param >\fR
-The nodename as defined in nodelist.tab of the xCAT setup.
-.TP
-\fIaction = < param >\fR
-The action required.  on, off, reset (default) or stat.
-.TP
-\fIrpower = < param >\fR
-The path to the rpower binary.
-
-.SH SEE ALSO
-fence(8), fence_node(8), fence_bladecenter(8), nodelist.tab(8), rpower(1), xCAT(1)
diff --git a/fence/man/fence_xvm.8 b/fence/man/fence_xvm.8
deleted file mode 100644
index e04ea3f..0000000
--- a/fence/man/fence_xvm.8
+++ /dev/null
@@ -1,135 +0,0 @@
-.TH fence_xvm 8
-
-.SH NAME
-fence_xvm - I/O Fencing agent for Xen virtual machines.
-
-.SH SYNOPSIS
-.B
-fence_xvm
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_xvm is an I/O Fencing agent which can be used with Xen virtual machines
-which are part of a cluster.  There is a requirement that the parent 
-domain-0s are also a part of a CMAN/OpenAIS based cluster, such as
-linux-cluster.
-
-fence_xvm accepts options on the command line as well as from standard input.  
-If no command line options are present, fence_xvm will automatically use
-standard input.  fenced sends the options through stdin when it execs the
-agent.  fence_xvm can be run by itself with command line options which is
-useful for testing.
-
-.SH OPTIONS
-.TP
-\fB-d\fP
-Enable debugging output.  The more times you specify this parameter,
-the more debugging output you will receive.
-.TP
-\fB-i\fP \fIfamily\fP
-IP family to use (auto, ipv4, or ipv6; default = auto)
-.TP
-\fB-a\fP \fIaddress\fP
-Multicast address to use (default=225.0.0.12 for ipv4, ff02::3:1 for ipv6)
-.TP
-\fB-p\fP \fIport\fP
-Port to use for all communications; must match fence_xvmd (default=1229)
-.TP
-\fB-r\fP \fIretrans\fP
-Multicast retransmission time (in 1/10 seconds; default=20).  This
-is used to tune the amount of retransmission which is done on busy networks
-where multicast traffic is unreliable.
-.TP
-\fB-C\fP \fIauth\fP
-Authentication type (none, sha1, sha256, sha512; default=sha256).  This
-controls the authentication mechanism used to authenticate clients.  The
-three SHA hashes use a key which must be shared between both the Xen virtual
-machines and the host domain-0 cluster.  The three SHA authentication 
-mechanisms use a simple bidirectional challenge-response based on pseudo-
-random number generation and a shared private key.
-.TP
-\fB-c\fP \fIhash\fP
-Packet hash type (none, sha1, sha256, sha512; default=sha256).  This
-controls the hashing mechanism used to authenticate fencing requests.  The
-three SHA hashes use a key which must be shared between both the Xen virtual
-machines and the host domain-0 cluster.
-.TP
-\fB-k\fP \fIkey_file\fP
-Use the specified key file for packet hashing / SHA authentication.
-When both the hash type and the authentication type are set to "none",
-this parameter is ignored.
-.TP
-\fB-H\fP \fIdomain\fP
-This specifies unique domain name of the Xen guest which needs to be fenced.
-.TP
-\fB-u\fP
-Fence by UUID instead of Xen Domain name.  If specified, the above -H
-parameter should be the statically-defined 36-character UUID of the Xen
-domain rather than its human-readable name.
-.TP
-\fB-o\fP \fIoperation\fP
-Fencing operation to perform (null, off, reboot; default=off).  This specifies
-the fencing operation to perform.  The null operation does not actually do
-anything, but allows you to check to see if communication with fence_xvmd
-is working correctly (note: the result of the null operation is *always*
-failure!).
-.TP
-\fB-t\fP \fItimeout\fP
-This specifies the amount of time, in seconds, to wait before a response to
-the multicast request before giving up (default=30).
-.TP
-\fB-?\fP
-Print out a help message describing available options, then exit.
-.TP
-\fB-h\fP
-Print out a help message describing available options, then exit.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-
-.SH STDIN PARAMETERS
-.TP
-\fIdebug = 1\fR
-Same as the -d option.  Specify numbers >1 for more debugging information.
-.TP
-\fIfamily = < param >\fR
-Same as the -i option.
-.TP
-\fImulticast_address = < param >\fR
-Same as the -a option.
-.TP
-\fIport = < param >\fR
-Same as the -p option.
-.TP
-\fIretrans = < param >\fR
-Same as the -r option.
-.TP
-\fIauth = < param >\fR
-Same as the -C option.
-.TP
-\fIhash = < param >\fR
-Same as the -c option.
-.TP
-\fIkey_file = < param >\fR
-Same as the -k option.
-.TP
-\fIretrans = < param >\fR
-Same as the -r option.
-.TP
-\fIdomain = < param >\fR
-Same as the -H option.
-.TP
-\fIuse_uuid = 1\fR
-Same as the -u option.
-.TP
-\fIoption = < param >\fR
-Same as the -o option.
-.TP
-\fItimeout = < param >\fR
-Same as the -t option.
-.TP
-\fIdomain = < param >\fR
-Same as the -H option.
-
-.SH SEE ALSO
-fence(8), fence_node(8), fence_xvmd(8)
diff --git a/fence/man/fence_xvmd.8 b/fence/man/fence_xvmd.8
deleted file mode 100644
index 12af607..0000000
--- a/fence/man/fence_xvmd.8
+++ /dev/null
@@ -1,120 +0,0 @@
-.TH fence_xvmd 8
-
-.SH NAME
-fence_xvmd - I/O Fencing agent host for Xen virtual machines.
-
-.SH SYNOPSIS
-.B
-fence_xvmd
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_xvmd is an I/O Fencing host which resides on dom0 and is used in
-conjunction with the fence_xvm fencing agent.  Together, these two programs
-can be used to fence can be used to fence Xen virtual machines which are
-part of a cluster.  There is a requirement that the parent 
-dom0s are also a part of their own CMAN/OpenAIS based cluster, and that
-the dom0 cluster does not share any members with the domU cluster.
-Furthermore, the dom0 cluster is required to have fencing if domU recovery
-is expected to be automatic.
-
-fence_xvmd accepts options on the command line.
-
-.SH OPTIONS
-.TP
-\fB-f\fP
-Foreground mode (do not fork)
-.TP
-\fB-d\fP
-Enable debugging output.  The more times you specify this parameter,
-the more debugging output you will receive.
-.TP
-\fB-i\fP \fIfamily\fP
-IP family to use (auto, ipv4, or ipv6; default = auto)
-.TP
-\fB-a\fP \fIaddress\fP
-Multicast address to listen on (default=225.0.0.12 for ipv4, ff02::3:1
-for ipv6)
-.TP
-\fB-p\fP \fIport\fP
-Port to use (default=1229)
-.TP
-\fB-I\fP \fIinterface\fP
-Network interface to listen on, e.g. eth0.
-.TP
-\fB-C\fP \fIauth\fP
-Authentication type (none, sha1, sha256, sha512; default=sha256).  This
-controls the authentication mechanism used to authenticate clients.  The
-three SHA hashes use a key which must be shared between both the Xen virtual
-machines and the host domain-0 cluster.  The three SHA authentication 
-mechanisms use a simple bidirectional challenge-response based on pseudo-
-random number generation and a shared private key.
-.TP
-\fB-c\fP \fIhash\fP
-Packet hash type (none, sha1, sha256, sha512; default=sha256).  This
-controls the hashing mechanism used to authenticate fencing requests.  The
-three SHA hashes use a key which must be shared between both the Xen virtual
-machines and the host domain-0 cluster.
-.TP
-\fB-k\fP \fIkey_file\fP
-Use the specified key file for packet hashing / SHA authentication.
-When both the hash type and the authentication type are set to "none",
-this parameter is ignored.
-.TP
-\fB-u\fP
-Fence by UUID instead of Xen Domain name.
-.TP
-\fB-?\fP
-Print out a help message describing available options, then exit.
-.TP
-\fB-h\fP
-Print out a help message describing available options, then exit.
-.TP
-\fB-X\fP
-Do not connect to CCS for configuration; only use command line
-parameters.  CCS configuration parameters override command line
-parameters (because they are cluster-wide), so if you need to 
-override a configuration option contained in CCS, you must specify
-this parameter.
-\fB-V\fP
-.TP
-\fB-L\fP
-Local-only / non-cluster mode.  When used with -X, this this option
-prevents fence_xvmd from operating as a clustered service, obviating
-the need to configure/run CMAN on the host domain.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-
-.SH CCS PARAMETERS
-CCS options are simply attributes of the <fence_xvmd> tag, a
-child of the <cluster> tag in /etc/cluster/cluster.conf.
-.TP
-\fIdebug="1"\fR
-Same as the -d option.  Specify numbers >1 for more debugging information.
-.TP
-\fIfamily="param"\fR
-Same as the -i option.
-.TP
-\fImulticast_address="param"\fR
-Same as the -a option.
-.TP
-\fIport="param"\fR
-Same as the -p option.
-.TP
-\fIauth="param"\fR
-Same as the -C option.
-.TP
-\fIhash="param"\fR
-Same as the -c option.
-.TP
-\fIkey_file="param"\fR
-Same as the -k option.
-.TP
-\fIuse_uuid="1"\fR
-Same as the -u option.
-.TP
-
-
-.SH SEE ALSO
-fence(8), fence_node(8), fence_xvm(8)
diff --git a/fence/man/fence_zvm.8 b/fence/man/fence_zvm.8
deleted file mode 100644
index b22f8e1..0000000
--- a/fence/man/fence_zvm.8
+++ /dev/null
@@ -1,62 +0,0 @@
-.TH fence_zvm 8
-
-.SH NAME
-fence_zvm - I/O Fencing agent for GFS on s390 and zSeries VM clusters
-
-.SH SYNOPSIS
-.B
-fence_zvm
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-fence_zvm is an I/O Fencing agent used on a GFS virtual machine in a s390 or zSeries VM cluster.
-It uses the s3270 program to log the specified virtual machine out of VM.
-For fence_zvm to execute correctly, you must have s3270 in your PATH.
-
-fence_zvm accepts options on the command line as well as from stdin.
-fence_node sends the options through stdin when it execs the agent.
-fence_zvm can be run by itself with command line options which is useful
-for testing.
-
-.SH OPTIONS
-.TP
-\fB-a\fP \fIIPaddress\fP
-IP address or hostname of the Physical machine (required).
-.TP
-\fB-h\fP
-Print out a help message describing available options, then exit.
-.TP
-\fB-u\fP \fIuserid\fP
-userid of the virtual machine to fence (required).
-.TP
-\fB-p\fP \fIpassword\fP
-password of the virtual machine to fence (required).
-.TP
-\fB-S\fP \fIpath\fR
-Full path to an executable to generate the password of the virtual machine to fence.
-.TP
-\fB-q\fP
-quiet mode, no output.
-.TP
-\fB-V\fP
-Print out a version message, then exit.
-
-.SH STDIN PARAMETERS
-.TP
-\fIagent = < param >\fP
-This option is used by fence_node(8) and is ignored by fence_zvm.
-.TP
-\fIipaddr = < hostname | ip >\fP
-IP address or hostname of the Physical machine (required).
-.TP
-\fIpasswd = < param >\fP
-password of the virtual machine to fence (required).
-.TP
-\fIpasswd_script = < param >\fR
-Full path to an executable to generate the password of the virtual machine to fence.
-.TP
-\fIuserid = < param >\fP
-userid of the virtual machine to fence (required).
-
-.SH SEE ALSO
-fence(8), fenced(8), fence_node(8)
diff --git a/fence/man/fenced.8 b/fence/man/fenced.8
deleted file mode 100644
index 8cdcf1a..0000000
--- a/fence/man/fenced.8
+++ /dev/null
@@ -1,296 +0,0 @@
-.TH fenced 8
-
-.SH NAME
-fenced - the I/O Fencing daemon
-
-.SH SYNOPSIS
-.B
-fenced
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-
-The fencing daemon, fenced, fences cluster nodes that have failed.
-Fencing a node generally means rebooting it or otherwise preventing it
-from writing to storage, e.g. disabling its port on a SAN switch.  Fencing
-involves interacting with a hardware device, e.g. network power switch,
-SAN switch, storage array.  Different "fencing agents" are run by fenced
-to interact with various hardware devices.
-
-Software related to sharing storage among nodes in a cluster, e.g. GFS,
-usually requires fencing to be configured to prevent corruption of the
-storage in the presence of node failure and recovery.  GFS will not allow
-a node to mount a GFS file system unless the node is running fenced.
-Fencing happens in the context of a cman/openais cluster.  A node must be
-a cluster member before it can run fenced.
-
-Once started, fenced waits for the 'fence_tool join' command to be run,
-telling it to join the fence domain: a group of nodes managed by the
-openais/cpg/groupd cluster infrastructure.  In most cases, all nodes will
-join the fence domain after joining the cluster.
-
-Fence domain members are aware of the membership of the group, and are
-notified when nodes join or leave.  If a fence domain member fails, one of
-the remaining members will fence it.  If the cluster has lost quorum,
-fencing won't occur until quorum has been regained.  If a failed node is
-reset and rejoins the cluster before the remaining domain members have
-fenced it, the fencing will be bypassed.
-
-.SS Node failure
-
-When a domain member fails, fenced runs an agent to fence it.  The
-specific agent to run and the parameters the agent requires are all read
-from the cluster.conf file (using libccs) at the time of fencing.  The
-fencing operation against a failed node is not considered complete until
-the exec'ed agent exits.  The exit value of the agent indicates the
-success or failure of the operation.  If the operation failed, fenced will
-retry (possibly with a different agent, depending on the configuration)
-until fencing succeeds.  Other systems such as DLM and GFS will not begin
-their own recovery for a failed node until fenced has successfully
-completed fencing it.  So, a delay or problem in fencing will result in
-other systems like DLM/GFS being blocked.  Information about fencing
-operations will also appear in syslog.
-
-When a domain member fails, the actual fencing operation can be delayed by
-a configurable number of seconds (cluster.conf:post_fail_delay or -f).
-Within this time, the failed node could be reset and rejoin the cluster to
-avoid being fenced.  This delay is 0 by default to minimize the time that
-other systems are blocked (see above).
-
-.SS Domain startup
-
-When the domain is first created in the cluster (by the first node to join
-it) and subsequently enabled (by the cluster gaining quorum) any nodes
-listed in cluster.conf that are not presently members of the cman cluster
-are fenced.  The status of these nodes is unknown, and to be on the side
-of safety they are assumed to be in need of fencing.  This startup fencing
-can be disabled, but it's only truly safe to do so if an operator is
-present to verify that no cluster nodes are in need of fencing.
-
-This example illustrates why startup fencing is important.  Take a three
-node cluster with nodes A, B and C; all three have a GFS fs mounted.  All
-three nodes experience a low-level kernel hang at about the same time.  A
-watchdog triggers a reboot on nodes A and B, but not C.  A and B boot back
-up, form the cluster again, gain quorum, join the fence domain, *don't*
-fence node C which is still hung and unresponsive, and mount the GFS fs
-again.  If C were to come back to life, it could corrupt the fs.  So, A
-and B need to fence C when they reform the fence domain since they don't
-know the state of C.  If C *had* been reset by a watchdog like A and B,
-but was just slow in rebooting, then A and B might be fencing C
-unnecessarily when they do startup fencing.
-
-The first way to avoid fencing nodes unnecessarily on startup is to ensure
-that all nodes have joined the cluster before any of the nodes start the
-fence daemon.  This method is difficult to automate.
-
-A second way to avoid fencing nodes unnecessarily on startup is using the
-cluster.conf:post_join_delay setting (or -j option).  This is the number
-of seconds fenced will delay before actually fencing any victims after
-nodes join the domain.  This delay gives nodes that have been tagged for
-fencing a chance to join the cluster and avoid being fenced.  A delay of
--1 here will cause the daemon to wait indefinitely for all nodes to join
-the cluster and no nodes will actually be fenced on startup.
-
-To disable fencing at domain-creation time entirely, the -c option can be
-used to declare that all nodes are in a clean or safe state to start.  The
-clean_start cluster.conf option can also be set to do this, but
-automatically disabling startup fencing in cluster.conf can risk file
-system corruption.
-
-Avoiding unnecessary fencing at startup is primarily a concern when nodes
-are fenced by power cycling.  If nodes are fenced by disabling their SAN
-access, then unnecessarily fencing a node is usually less disruptive.
-
-.SS Fencing override
-
-If a fencing device fails, the agent may repeatedly return errors as
-fenced tries to fence a failed node.  In this case, the admin can manually
-reset the failed node, and then use fence_ack_manual to tell fenced to
-continue without fencing the node.
-
-.SH CONFIGURATION FILE
-Fencing daemon behavior can be controlled by setting options in the
-cluster.conf file under the section <fence_daemon> </fence_daemon>.  See
-above for complete descriptions of these values.  The delay values are in
-seconds; -1 secs means an unlimited delay.  The values shown are the
-defaults.
-
-Post-join delay is the number of seconds the daemon will wait before
-fencing any victims after a node joins the domain.
-
-  <fence_daemon post_join_delay="6"/>
-
-Post-fail delay is the number of seconds the daemon will wait before
-fencing any victims after a domain member fails.
-
-  <fence_daemon post_fail_delay="0"/>
-
-Clean-start is used to prevent any startup fencing the daemon might do.
-It indicates that the daemon should assume all nodes are in a clean state
-to start.
-
-  <fence_daemon clean_start="0"/>
-
-Override-path is the location of a FIFO used for communication between
-fenced and fence_ack_manual.
-
-  <fence_daemon override_path="/var/run/cluster/fenced_override"/>
-
-Override-time is the amount of time to wait for administrator intervention
-after fencing has failed.  The default is 5 seconds.
-
-  <fence_daemon override_time="10"/>
-
-
-.SS Per-node fencing settings
-
-The per-node fencing configuration can become complex and is largely
-specific to the hardware being used.  The general framework begins like
-this:
-
-  <clusternodes>
-
-  <clusternode name="node1" nodeid="1">
-          <fence>
-          </fence>
-  </clusternode>
-
-  <clusternode name="node2" nodeid="2">
-          <fence>
-          </fence>
-  </clusternode>
-
-  ...
-  </clusternodes>
-
-The simple fragment above is a valid configuration: there is no way to
-fence these nodes.  If one of these nodes is in the fence domain and
-fails, fenced will repeatedly fail in its attempts to fence it.  The admin
-will need to manually reset the failed node and then use fence_ack_manual
-to tell fenced to continue on without fencing it (see override above).
-
-There is typically a single method used to fence each node (the name given
-to the method is not significant).  A method refers to a specific device
-listed in the separate <fencedevices> section, and then lists any
-node-specific parameters related to using the device.
-
-  <clusternodes>
-
-  <clusternode name="node1" nodeid="1">
-          <fence>
-             <method name="single">
-                <device name="myswitch" hw-specific-param="x"/>
-             </method>
-          </fence>
-  </clusternode>
-
-  <clusternode name="node2" nodeid="2">
-          <fence>
-             <method name="single">
-                <device name="myswitch" hw-specific-param="y"/>
-             </method>
-          </fence>
-  </clusternode>
-
-  ...
-  </clusternodes>
-
-.SS Fence device settings
-
-This section defines properties of the devices used to fence nodes.  There
-may be one or more devices listed.  The per-node fencing sections above
-reference one of these fence devices by name.
-
-  <fencedevices>
-          <fencedevice name="myswitch" ipaddr="1.2.3.4" .../>
-  </fencedevices>
-
-.SS Multiple methods for a node
-
-In more advanced configurations, multiple fencing methods can be defined
-for a node.  If fencing fails using the first method, fenced will try the
-next method, and continue to cycle through methods until one succeeds.
-
-  <clusternode name="node1" nodeid="1">
-          <fence>
-             <method name="first">
-                <device name="powerswitch" hw-specific-param="x"/>
-             </method>
-
-             <method name="second">
-                <device name="storageswitch" hw-specific-param="1"/>
-             </method>
-          </fence>
-  </clusternode>
-
-.SS Dual path, redundant power
-
-Sometimes fencing a node requires disabling two power ports or two i/o
-paths.  This is done by specifying two or more devices within a method.
-
-  <clusternode name="node1" nodeid="1">
-          <fence>
-             <method name="single">
-                <device name="sanswitch1" hw-specific-param="x"/>
-                <device name="sanswitch2" hw-specific-param="x"/>
-             </method>
-          </fence>
-  </clusternode>
-
-When using power switches to fence nodes with dual power supplies, the
-agents must be told to turn off both power ports before restoring power to
-either port.  The default off-on behavior of the agent could result in the
-power never being fully disabled to the node.
-
-  <clusternode name="node1" nodeid="1">
-          <fence>
-             <method name="single">
-                <device name="nps1" hw-param="x" action="off"/>
-                <device name="nps2" hw-param="x" action="off"/>
-                <device name="nps1" hw-param="x" action="on"/>
-                <device name="nps2" hw-param="x" action="on"/>
-             </method>
-          </fence>
-  </clusternode>
-
-.SS Hardware-specific settings
-
-Find documentation for configuring specific devices at
-.BR
-http://sources.redhat.com/cluster/
-
-.SH OPTIONS
-Command line options override corresponding values in cluster.conf.
-.TP
-\fB-j\fP \fIsecs\fP
-Post-join fencing delay
-.TP
-\fB-f\fP \fIsecs\fP
-Post-fail fencing delay
-.TP
-\fB-c\fP 
-All nodes are in a clean state to start.
-.TP
-\fB-O\fP
-Path of the override FIFO.
-.TP
-\fB-T\fP
-Amount of time to wait for administrator intervention after 
-fencing has failed, in seconds.
-.TP
-\fB-D\fP
-Enable debugging code and don't fork into the background.
-.TP
-\fB-V\fP
-Print the version information and exit.
-.TP
-\fB-h\fP 
-Print out a help message describing available options, then exit.
-
-.SH DEBUGGING
-The fenced daemon keeps a circular buffer of debug messages that can be
-dumped with the 'fence_tool dump' command.
-
-.SH SEE ALSO
-fence_tool(8), cman(8), groupd(8), group_tool(8)
-
diff --git a/gfs2/Makefile b/gfs2/Makefile
deleted file mode 100644
index 7daf231..0000000
--- a/gfs2/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../make/defines.mk
-include $(OBJDIR)/make/passthrough.mk
-
-SUBDIRS=libgfs2 convert edit fsck mkfs mount quota tool man init.d
diff --git a/gfs2/convert/Makefile b/gfs2/convert/Makefile
deleted file mode 100644
index eddb79a..0000000
--- a/gfs2/convert/Makefile
+++ /dev/null
@@ -1,33 +0,0 @@
-TARGET= gfs2_convert
-
-SBINDIRT=$(TARGET)
-
-all: depends ${TARGET}
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-OBJS= gfs2_convert.o
-
-CFLAGS += -D_FILE_OFFSET_BITS=64 -DHELPER_PROGRAM
-CFLAGS += -I${KERNEL_SRC}/fs/gfs2/ -I${KERNEL_SRC}/include/
-CFLAGS += -I$(S)/../include -I$(S)/../libgfs2
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L../libgfs2 -lgfs2
-LDFLAGS += -L${libdir}
-
-LDDEPS += ../libgfs2/libgfs2.a
-
-${TARGET}: ${OBJS} ${LDDEPS}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-depends:
-	$(MAKE) -C ../libgfs2 all
-
-clean: generalclean
-
--include $(OBJS:.o=.d)
diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
deleted file mode 100644
index c331c95..0000000
--- a/gfs2/convert/gfs2_convert.c
+++ /dev/null
@@ -1,1614 +0,0 @@
-/*****************************************************************************
-******************************************************************************
-**
-**  gfs2_convert - convert a gfs1 filesystem into a gfs2 filesystem.
-**
-******************************************************************************
-*****************************************************************************/
-
-#include <unistd.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <libgen.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdarg.h>
-#include <dirent.h>
-#include <string.h>
-#include <time.h>
-#include <sys/time.h>
-
-#include "linux_endian.h"
-#include <linux/types.h>
-#include <linux/gfs2_ondisk.h>
-#include "osi_list.h"
-#include "copyright.cf"
-#include "ondisk.h"
-#include "libgfs2.h"
-#include "global.h"
-
-/* The following declares are needed because gfs2 can't have  */
-/* dependencies on gfs1:                                      */
-#define RGRP_STUFFED_BLKS(sb) (((sb)->sb_bsize - sizeof(struct gfs2_rgrp)) * GFS2_NBBY)
-#define RGRP_BITMAP_BLKS(sb) (((sb)->sb_bsize - sizeof(struct gfs2_meta_header)) * GFS2_NBBY)
-
-/* Define some gfs1 constants from gfs1's gfs_ondisk.h */
-#define GFS_METATYPE_NONE       (0)
-#define GFS_METATYPE_SB         (1)    /* Super-Block */
-#define GFS_METATYPE_RG         (2)    /* Resource Group Header */
-#define GFS_METATYPE_RB         (3)    /* Resource Group Block Alloc BitBlock */
-#define GFS_METATYPE_DI         (4)    /* "Disk" inode (dinode) */
-#define GFS_METATYPE_IN         (5)    /* Indirect dinode block list */
-#define GFS_METATYPE_LF         (6)    /* Leaf dinode block list */
-#define GFS_METATYPE_JD         (7)    /* Journal Data */
-#define GFS_METATYPE_LH         (8)    /* Log Header (gfs_log_header) */
-#define GFS_METATYPE_LD         (9)    /* Log Descriptor (gfs_log_descriptor) */
-#define GFS_METATYPE_EA         (10)   /* Extended Attribute */
-#define GFS_METATYPE_ED         (11)   /* Extended Attribute data */
-
-/* GFS1 Dinode types  */
-#define GFS_FILE_NON            (0)
-#define GFS_FILE_REG            (1)    /* regular file */
-#define GFS_FILE_DIR            (2)    /* directory */
-#define GFS_FILE_LNK            (5)    /* link */
-#define GFS_FILE_BLK            (7)    /* block device node */
-#define GFS_FILE_CHR            (8)    /* character device node */
-#define GFS_FILE_FIFO           (101)  /* fifo/pipe */
-#define GFS_FILE_SOCK           (102)  /* socket */
-
-#define GFS_FORMAT_SB           (100)  /* Super-Block */
-#define GFS_FORMAT_FS           (1309) /* Filesystem (all-encompassing) */
-#define GFS_FORMAT_MULTI        (1401) /* Multi-Host */
-
-struct gfs1_rgrp {
-	struct gfs2_meta_header rg_header; /* hasn't changed from gfs1 to 2 */
-	uint32_t rg_flags;
-	uint32_t rg_free;       /* Number (qty) of free data blocks */
-	/* Dinodes are USEDMETA, but are handled separately from other METAs */
-	uint32_t rg_useddi;     /* Number (qty) of dinodes (used or free) */
-	uint32_t rg_freedi;     /* Number (qty) of unused (free) dinodes */
-	struct gfs2_inum rg_freedi_list; /* hasn't changed from gfs1 to 2 */
-	/* These META statistics do not include dinodes (used or free) */
-	uint32_t rg_usedmeta;   /* Number (qty) of used metadata blocks */
-	uint32_t rg_freemeta;   /* Number (qty) of unused metadata blocks */
-	char rg_reserved[64];
-};
-
-struct gfs1_jindex {
-	uint64_t ji_addr;       /* starting block of the journal */
-	uint32_t ji_nsegment;   /* number (quantity) of segments in journal */
-	uint32_t ji_pad;
-
-	char ji_reserved[64];
-};
-
-struct gfs1_sb {
-	/*  Order is important; need to be able to read old superblocks
-		in order to support on-disk version upgrades */
-	struct gfs2_meta_header sb_header;
-
-	uint32_t sb_fs_format;         /* GFS_FORMAT_FS (on-disk version) */
-	uint32_t sb_multihost_format;  /* GFS_FORMAT_MULTI */
-	uint32_t sb_flags;             /* ?? */
-
-	uint32_t sb_bsize;             /* fundamental FS block size in bytes */
-	uint32_t sb_bsize_shift;       /* log2(sb_bsize) */
-	uint32_t sb_seg_size;          /* Journal segment size in FS blocks */
-
-	/* These special inodes do not appear in any on-disk directory. */
-	struct gfs2_inum sb_jindex_di;  /* journal index inode */
-	struct gfs2_inum sb_rindex_di;  /* resource group index inode */
-	struct gfs2_inum sb_root_di;    /* root directory inode */
-	
-	/* Default inter-node locking protocol (lock module) and namespace */
-	char sb_lockproto[GFS2_LOCKNAME_LEN]; /* lock protocol name */
-	char sb_locktable[GFS2_LOCKNAME_LEN]; /* unique name for this FS */
-	
-	/* More special inodes */
-	struct gfs2_inum sb_quota_di;   /* quota inode */
-	struct gfs2_inum sb_license_di; /* license inode */
-
-	char sb_reserved[96];
-};
-
-struct inode_block {
-	osi_list_t list;
-	uint64_t di_addr;
-};
-
-struct blocklist {
-	osi_list_t list;
-	uint64_t lbparent; /* parent's buffer offset */
-	uint64_t dbparent; /* parent's disk block */
-	uint64_t dblock; /* disk block */
-	uint64_t lblock; /* logical block relative to start of file */
-};
-
-struct metapath2 {
-	unsigned int mp_list[GFS2_MAX_META_HEIGHT];
-	struct gfs2_buffer_head *mp_bh[GFS2_MAX_META_HEIGHT];
-};
-
-struct gfs1_sb  raw_gfs1_ondisk_sb;
-struct gfs2_sbd sb2;
-char device[256];
-struct inode_block dirs_to_fix;  /* linked list of directories to fix */
-int seconds;
-struct timeval tv;
-uint64_t dirs_fixed;
-uint64_t dirents_fixed;
-char *prog_name = "gfs2_convert"; /* needed by libgfs2 */
-struct gfs1_jindex *sd_jindex = NULL;    /* gfs1 journal index in memory */
-int gfs2_inptrs;
-uint64_t gfs2_heightsize[GFS2_MAX_META_HEIGHT];
-uint64_t gfs2_jheightsize[GFS2_MAX_META_HEIGHT];
-int gfs2_max_height;
-int gfs2_max_jheight;
-
-/* ------------------------------------------------------------------------- */
-/* This function is for libgfs's sake.                                       */
-/* ------------------------------------------------------------------------- */
-void print_it(const char *label, const char *fmt, const char *fmt2, ...)
-{
-	va_list args;
-
-	va_start(args, fmt2);
-	printf("%s: ", label);
-	vprintf(fmt, args);
-	va_end(args);
-}
-
-/* ------------------------------------------------------------------------- */
-/* convert_bitmaps - Convert gfs1 bitmaps to gfs2 bitmaps.                   */
-/*                   Fixes all unallocated metadata bitmap states (which are */
-/*                   valid in gfs1 but invalid in gfs2).                     */
-/* ------------------------------------------------------------------------- */
-void convert_bitmaps(struct gfs2_sbd *sdp, struct rgrp_list *rgd2,
-					 int read_disk)
-{
-	uint32_t blk;
-	int x, y;
-	struct gfs2_rindex *ri;
-	unsigned char state;
-	struct gfs2_buffer_head *bh;
-
-	ri = &rgd2->ri;
-	if (gfs2_compute_bitstructs(sdp, rgd2)) { /* mallocs bh as array */
-		log_crit("gfs2_convert: Error converting bitmaps.\n");
-		exit(-1);
-	}
-	for (blk = 0; blk < ri->ri_length; blk++) {
-		bh = bget_generic(&sdp->nvbuf_list, ri->ri_addr + blk,
-				  read_disk, read_disk);
-		if (!rgd2->bh[blk])
-			rgd2->bh[blk] = bh;
-		x = (blk) ? sizeof(struct gfs2_meta_header) : sizeof(struct gfs2_rgrp);
-
-		for (; x < sdp->bsize; x++)
-			for (y = 0; y < GFS2_NBBY; y++) {
-				state = (rgd2->bh[blk]->b_data[x] >>
-						 (GFS2_BIT_SIZE * y)) & 0x03;
-				if (state == 0x02) /* unallocated metadata state invalid */
-					rgd2->bh[blk]->b_data[x] &= ~(0x02 << (GFS2_BIT_SIZE * y));
-			}
-		brelse(bh, updated);
-	}
-}/* convert_bitmaps */
-
-/* ------------------------------------------------------------------------- */
-/* convert_rgs - Convert gfs1 resource groups to gfs2.                       */
-/* Returns: 0 on success, -1 on failure                                      */
-/* ------------------------------------------------------------------------- */
-static int convert_rgs(struct gfs2_sbd *sbp)
-{
-	struct rgrp_list *rgd;
-	osi_list_t *tmp;
-	struct gfs2_buffer_head *bh;
-	struct gfs1_rgrp *rgd1;
-	int rgs = 0;
-
-	/* --------------------------------- */
-	/* Now convert its rgs into gfs2 rgs */
-	/* --------------------------------- */
-	osi_list_foreach(tmp, &sbp->rglist) {
-		rgd = osi_list_entry(tmp, struct rgrp_list, list);
-		rgd1 = (struct gfs1_rgrp *)&rgd->rg; /* recast as gfs1 structure */
-		/* rg_freemeta is a gfs1 structure, so libgfs2 doesn't know to */
-		/* convert from be to cpu. We must do it now. */
-		rgd->rg.rg_free = rgd1->rg_free + be32_to_cpu(rgd1->rg_freemeta);
-
-		sbp->blks_total += rgd->ri.ri_data;
-		sbp->blks_alloced += (rgd->ri.ri_data - rgd->rg.rg_free);
-		sbp->dinodes_alloced += rgd1->rg_useddi;
-		convert_bitmaps(sbp, rgd, TRUE);
-		/* Write the updated rgrp to the gfs2 buffer */
-		bh = bget(&sbp->nvbuf_list,
-			  rgd->ri.ri_addr); /* get a gfs2 buffer for the rg */
-		gfs2_rgrp_out(&rgd->rg, rgd->bh[0]->b_data);
-		brelse(bh, updated); /* release the buffer */
-		rgs++;
-		if (rgs % 100 == 0) {
-			printf(".");
-			fflush(stdout);
-		}
-	}
-	return 0;
-}/* superblock_cvt */
-
-/* ------------------------------------------------------------------------- */
-/* find_lbh - find a gfs2_buffer_head in a list, based on relative block #   */
-/* ------------------------------------------------------------------------- */
-struct gfs2_buffer_head *find_lbh(struct gfs2_sbd *sbp,
-				  struct blocklist *blist, uint64_t lblock)
-{
-	struct gfs2_buffer_head *bh;
-	osi_list_t *head, *tmp;
-	struct blocklist *blk;
-
-	head = &blist->list;
-
-	for (tmp = head->next; tmp != head; tmp = tmp->next) {
-		blk = osi_list_entry(tmp, struct blocklist, list);
-		if (blk->lbparent == lblock) {
-			bh = bget(&sbp->buf_list, blk->dblock);
-			return bh;
-		}
-	}
-	/* We didn't find one that has the same offset, so let's just reuse
-	   a bh from the same height */
-	blk->lbparent = lblock;
-	bh = bget(&sbp->buf_list, blk->dblock);
-	return bh;
-}
-
-/* ------------------------------------------------------------------------- */
-/* calc_gfs2_tree_height - calculate new dinode height as if this is gfs2    */
-/* ------------------------------------------------------------------------- */
-unsigned int calc_gfs2_tree_height(struct gfs2_inode *ip, uint64_t size)
-{
-	uint64_t *arr;
-	unsigned int max, height;
-
-	if (ip->i_di.di_size > size)
-		size = ip->i_di.di_size;
-
-	if (S_ISDIR(ip->i_di.di_mode)) {
-		arr = gfs2_jheightsize;
-		max = gfs2_max_jheight;
-	} else {
-		arr = gfs2_heightsize;
-		max = gfs2_max_height;
-	}
-
-	for (height = 0; height < max; height++)
-		if (arr[height] >= size)
-			break;
-
-	return height;
-}
-
-/* ------------------------------------------------------------------------- */
-/* gfs1_mp_to_lblock - convert a gfs1 metapath back to a logical block num.  */
-/* ------------------------------------------------------------------------- */
-uint64_t gfs1_mp_to_lblock(struct gfs2_sbd *sbp, int height, int width,
-			   struct blocklist *srcblk,
-			   struct blocklist *blocks[GFS2_MAX_META_HEIGHT])
-{
-	uint64_t lblock;
-	osi_list_t *head, *tmp;
-	int h;
-	struct blocklist *blk, *higher_blk = srcblk;
-	uint64_t gfs1factor[GFS2_MAX_META_HEIGHT];
-
-	/* figure out multiplication factors for each height */
-	memset(&gfs1factor, 0, sizeof(gfs1factor));
-	gfs1factor[height] = 1ull;
-	for (h = height; h > 0; h--)
-		gfs1factor[h - 1] = gfs1factor[h] * sbp->sd_inptrs;
-	/* First, factor in our own height */
-	lblock = width;
-	for (h = height - 1; h > 0; h--) {
-		head = &blocks[h]->list;
-		for (tmp = head->next; tmp != head; tmp = tmp->next) {
-			blk = osi_list_entry(tmp, struct blocklist, list);
-			if (higher_blk->dbparent == blk->dblock) {
-				lblock += (blk->lbparent * gfs1factor[h]);
-				higher_blk = blk;
-				break; /* found it, go to the next height */
-			}
-		}
-	}
-	return lblock;
-}
-
-/* ------------------------------------------------------------------------- */
-/* adjust_indirect_blocks - convert all gfs_indirect blocks to gfs2.         */
-/*                                                                           */
-/* This function converts all gfs_indirect blocks to GFS2.  The difference   */
-/* is that gfs1 indirect block has a 64-byte chunk of reserved space that    */
-/* gfs2 does not.  Since GFS block locations (relative to the start of the   */
-/* file have their locations defined by the offset from the end of the       */
-/* structure, all block pointers must be shifted.                            */
-/*                                                                           */
-/* Stuffed inodes don't need to be shifted at since there are no indirect    */
-/* blocks.  Inodes with height 1 don't need to be shifted either, because    */
-/* the dinode size is the same between gfs and gfs2 (232 bytes), and         */
-/* therefore you can fit the same number of block pointers after the dinode  */
-/* structure.  For the normal 4K block size, that's 483 pointers.  For 1K    */
-/* blocks, it's 99 pointers.                                                 */
-/*                                                                           */
-/* At height 2 things get complex.  GFS1 reserves an area of 64 (0x40) bytes */
-/* at the start of the indirect block, so for 4K blocks, you can fit 501     */
-/* pointers.  GFS2 doesn't reserve that space, so you can fit 509 pointers.  */
-/* For 1K blocks, it's 117 pointers in GFS1 and 125 in GFS2.                 */
-/*                                                                           */
-/* That means, for example, that if you have 4K blocks, a 946MB file will    */
-/* require a height of 3 for GFS, but only a height of 2 for GFS2.           */
-/* There isn't a good way to shift the pointers around from one height to    */
-/* another, so the only way to do it is to rebuild all those indirect blocks */
-/* from empty ones.                                                          */
-/*                                                                           */
-/* For example, with a 1K block size, if you do:                             */
-/*                                                                           */
-/* dd if=/mnt/gfs/big of=/tmp/tocompare skip=496572346368 bs=1024 count=1    */
-/*                                                                           */
-/* the resulting metadata paths will look vastly different for the data:     */
-/*                                                                           */
-/* height    0     1     2     3     4     5                                 */
-/* GFS1:  0x16  0x46  0x70  0x11  0x5e  0x4a                                 */
-/* GFS2:  0x10  0x21  0x78  0x05  0x14  0x78                                 */
-/*                                                                           */
-/* To complicate matters, we can't really require free space.  A user might  */
-/* be trying to migrate a "full" gfs1 file system to GFS2.  After we         */
-/* convert the journals to GFS2, we might have more free space, so we can    */
-/* allocate blocks at that time.                                             */
-/*                                                                           */
-/* Assumes: GFS1 values are in place for diptrs and inptrs.                  */
-/*                                                                           */
-/* Returns: 0 on success, -1 on failure                                      */
-/*                                                                           */
-/* Adapted from gfs2_fsck metawalk.c's build_and_check_metalist              */
-/* ------------------------------------------------------------------------- */
-int adjust_indirect_blocks(struct gfs2_sbd *sbp, struct gfs2_buffer_head *dibh,
-			   struct gfs2_inode *ip)
-{
-	osi_list_t metalist[GFS2_MAX_META_HEIGHT];
-	uint32_t height1 = ip->i_di.di_height, gfs2_height;
-	struct gfs2_buffer_head *bh, *nbh;
-	osi_list_t *next_list, *cur_list, *tmp, *head;
-	int h, h2, head_size1, head_size2;
-	uint64_t *ptr1, *ptr2, block, b, metablocks_gfs1, metablocks_gfs2;
-	int error = 0;
-	struct metapath mp;
-	struct blocklist *blocks[GFS2_MAX_META_HEIGHT], *blk;
-
-	/* if there are no indirect blocks to check */
-	if (height1 <= 1)
-		return 0;
-
-	/* zero all pointers so we can tell what to free if we need to abort */
-	for (h = 0; h <= height1; h++)
-		blocks[h] = NULL;
-	for (h = 0; h <= height1; h++) {
-		blocks[h] = malloc(sizeof(struct blocklist));
-		if (!blocks[h]) {
-			log_crit("Error: Can't allocate memory for indirect "
-				 "block adjustment\n");
-			error = -1;
-			goto out;
-		}
-		memset(blocks[h], 0, sizeof(struct blocklist));
-		osi_list_init(&blocks[h]->list);
-	}
-
-	/* Now run the metadata chain and build the block lists */
-	for (h = 0; h < GFS2_MAX_META_HEIGHT; h++)
-		osi_list_init(&metalist[h]);
-
-	osi_list_add(&dibh->b_altlist, &metalist[0]);
-	memset(&mp, 0, sizeof(mp));
-
-	/* Add the dinode block to the metaheader list */
-	blk = malloc(sizeof(struct blocklist));
-	if (!blk) {
-		log_crit("Error: Can't allocate memory"
-			 " for indirect block fix.\n");
-		error = -1;
-		goto out;
-	}
-	memset(blk, 0, sizeof(*blk));
-	blk->dbparent = 0ull;
-	blk->dblock = ip->i_di.di_num.no_addr;
-	blk->lbparent = -1;
-	blk->lblock = 0ull;
-	osi_list_add_prev(&blk->list, &blocks[0]->list);
-
-	for (h = 0; h < height1; h++){
-		cur_list = &metalist[h];
-		next_list = &metalist[h + 1]; /* future metadata to process */
-		head_size1 = (h > 0 ? sizeof(struct gfs_indirect) :
-			      sizeof(struct gfs_dinode));
-
-		mp.mp_list[h] = 0;
-		for (tmp = cur_list->next; tmp != cur_list; tmp = tmp->next){
-			bh = osi_list_entry(tmp, struct gfs2_buffer_head,
-					    b_altlist);
-
-			for (ptr1 = (uint64_t *)(bh->b_data + head_size1);
-			     (char *)ptr1 < (bh->b_data + sbp->bsize);
-			     ptr1++, mp.mp_list[h]++) {
-				nbh = NULL;
-				if (!*ptr1)
-					continue;
-
-				b = block = be64_to_cpu(*ptr1);
-
-				blk = malloc(sizeof(struct blocklist));
-				if (!blk) {
-					log_crit("Error: Can't allocate memory"
-					       " for indirect block fix.\n");
-					error = -1;
-					goto out;
-				}
-				memset(blk, 0, sizeof(*blk));
-				blk->dbparent = bh->b_blocknr;
-				blk->dblock = block;
-				blk->lbparent = mp.mp_list[h];
-				osi_list_add_prev(&blk->list,
-						  &blocks[h + 1]->list);
-				if (h == height1 - 1)
-					blk->lblock = gfs1_mp_to_lblock(sbp,
-								height1,
-								mp.mp_list[h],
-								blk, blocks);
-				else
-					blk->lblock = 0ull;
-				if (h == height1 - 1) /* if not metadata */
-					continue; /* don't queue it up */
-				/* read the next metadata block in the chain */
-				if(!nbh)
-					nbh = bread(&sbp->buf_list, block);
-				osi_list_add_prev(&nbh->b_altlist, next_list);
-			} /* for all data on the indirect block */
-			for (h2 = h; h2 > 0; h2--)
-				if (mp.mp_list[h2] >= sbp->sd_inptrs) {
-					mp.mp_list[h2 - 1]++;
-					mp.mp_list[h2] = 0;
-				}
-		} /* for blocks at that height */
-	} /* for height */
-
-	/* Run through the metadata block list and zero out all the block */
-	/* pointers in the buffers so we can start clean.                 */
-	/* We've got to keep track of how many blocks we actually use for */
-	/* the converted metadata because we need to free the blocks we   */
-	/* don't use and mark the proper number as "blocks used" in the   */
-	/* dinode's di_blocks.  For example, in a normal 4K block file    */
-	/* system a contiguous file that is 4152273 bytes long needs 1014 */
-	/* data blocks.  GFS1 needs 3 gfs_indirect metadata blocks to     */
-	/* keep track: (1) 0-500, (2) 501-1001, (3) 1002=1014.  However,  */
-	/* GFS2 only needs 2 metadata blocks to keep track: (1) 0-508,    */
-	/* (2) 509-1014.  So the dinode's count of blocks used has to be  */
-	/* one less, and that final block needs to be freed.              */
-	/* I'm going to use the bh->b_changed flag to keep track of which */
-	/* blocks we actually need and which ones we don't.               */
-	metablocks_gfs1 = 0;
-
-	for (h = 0; h < height1; h++) {
-		head = &blocks[h]->list;
-		for (tmp = head->next; tmp != head; tmp = tmp->next) {
-			blk = osi_list_entry(tmp, struct blocklist, list);
-			bh = bget(&sbp->buf_list, blk->dblock);
-			head_size2 = sizeof(struct gfs2_meta_header);
-			memset(bh->b_data + head_size2, 0,
-			       sbp->bsize - head_size2);
-			bh->b_changed = not_updated; /* not used--yet */
-			metablocks_gfs1++;
-			brelse(bh, not_updated); /* not used--yet */
-		}
-	}
-
-	/* zero the dinode's pointers too */
-	head_size2 = sizeof(struct gfs2_dinode);
-	memset(dibh->b_data + sizeof(struct gfs2_dinode), 0,
-	       sbp->bsize - head_size2);
-
-	/* The gfs2 height may be different */
-	gfs2_height = calc_gfs2_tree_height(ip, ip->i_di.di_size);
-
-	/* Now run through the data block list and reformat the blocks.      */
-	/* We want to reuse the same metadata blocks from the list we built. */
-	head = &blocks[gfs2_height]->list; /* highest height:data blocks */
-
-	for (tmp = head->next; tmp != head; tmp = tmp->next) {
-		struct metapath2 mp2; /* metapath in gfs2 terms */
-		struct metapath *mp1;  /* metapath in gfs1 terms */
-
-		blk = osi_list_entry(tmp, struct blocklist, list);
-		block = blk->dblock;
-
-		/* recalculate the metapath */
-		mp1 = find_metapath(ip, blk->lblock);
-		/* figure out the block number from the start of the file. */
-		b = blk->lblock;
-		/* Calculate the metapath in GFS2 terms */
-		memset(&mp2, 0, sizeof(mp2));
-		for (h = gfs2_height; h--;)
-			mp2.mp_list[h] = do_div(b, gfs2_inptrs);
-		for (h = gfs2_height - 1; h >= 0; h--) {
-			if (h) {
-				/* find/reuse a bh from the old metadata. */
-				mp2.mp_bh[h] = find_lbh(sbp, blocks[h],
-							mp2.mp_list[h - 1]);
-			} else {
-				mp2.mp_bh[h] = dibh;
-			}
-			head_size2 = (h > 0 ? sizeof(struct gfs2_meta_header) :
-				      sizeof(struct gfs2_dinode));
-			ptr2 = (uint64_t *)(mp2.mp_bh[h]->b_data + head_size2);
-			ptr2 += mp2.mp_list[h];
-			*ptr2 = cpu_to_be64(block);
-			block = mp2.mp_bh[h]->b_blocknr;
-			if (h)
-				brelse(mp2.mp_bh[h], updated); /* used */
-		}
-		free(mp1);
-	} /* for all data blocks */
-
-	/* Release all the buffers we were using. */
-	/* We need to count the number of blocks we really used in the new */
-	/* metadata along the way. */
-	metablocks_gfs2 = 1; /* 1 for the inode that we know will change */
-	for (h = 1; h < height1; h++){
-		cur_list = &metalist[h];
-		for (tmp = cur_list->next; tmp != cur_list; tmp = tmp->next){
-			bh = osi_list_entry(tmp, struct gfs2_buffer_head,
-					    b_altlist);
-			if (bh->b_changed)     /* if we changed the block */
-				metablocks_gfs2++; /* count it */
-			else                   /* if we didn't change it */
-				gfs2_free_block(sbp, bh->b_blocknr); /* free */
-			brelse(bh, updated);
-		}
-	}
-	/* Set the new dinode height, which may or may not have changed.  */
-	/* The caller will take it from the ip and write it to the buffer */
-	ip->i_di.di_height = gfs2_height;
-	ip->i_di.di_blocks -= (metablocks_gfs1 - metablocks_gfs2);
-
-out:
-	for (h = 0; h <= height1; h++) {
-		head = &blocks[h]->list;
-		tmp = head->next;
-		while (tmp != head) {
-			blk = osi_list_entry(tmp, struct blocklist, list);
-			tmp = tmp->next;
-			free(blk);
-		}
-		if (blocks[h])
-			free(blocks[h]);
-	}
-	return error;
-}
-
-/* ------------------------------------------------------------------------- */
-/* adjust_inode - change an inode from gfs1 to gfs2                          */
-/*                                                                           */
-/* Returns: 0 on success, -1 on failure                                      */
-/* ------------------------------------------------------------------------- */
-int adjust_inode(struct gfs2_sbd *sbp, struct gfs2_buffer_head *bh)
-{
-	struct gfs2_inode *inode;
-	struct inode_block *fixdir;
-	int inode_was_gfs1;
-
-	inode = gfs_inode_get(sbp, bh);
-
-	inode_was_gfs1 = (inode->i_di.di_num.no_formal_ino ==
-					  inode->i_di.di_num.no_addr);
-	/* Fix the inode number: */
-	inode->i_di.di_num.no_formal_ino = sbp->md.next_inum;           ;
-	
-	/* Fix the inode type: gfs1 uses di_type, gfs2 uses di_mode. */
-	switch (inode->i_di.__pad1) { /* formerly di_type */
-	case GFS_FILE_DIR:           /* directory        */
-		inode->i_di.di_mode |= S_IFDIR;
-		/* Add this directory to the list of dirs to fix later. */
-		fixdir = malloc(sizeof(struct inode_block));
-		if (!fixdir) {
-			log_crit("Error: out of memory.\n");
-			return -1;
-		}
-		memset(fixdir, 0, sizeof(struct inode_block));
-		fixdir->di_addr = inode->i_di.di_num.no_addr;
-		osi_list_add_prev((osi_list_t *)&fixdir->list,
-						  (osi_list_t *)&dirs_to_fix);
-		break;
-	case GFS_FILE_REG:           /* regular file     */
-		inode->i_di.di_mode |= S_IFREG;
-		break;
-	case GFS_FILE_LNK:           /* symlink          */
-		inode->i_di.di_mode |= S_IFLNK;
-		break;
-	case GFS_FILE_BLK:           /* block device     */
-		inode->i_di.di_mode |= S_IFBLK;
-		break;
-	case GFS_FILE_CHR:           /* character device */
-		inode->i_di.di_mode |= S_IFCHR;
-		break;
-	case GFS_FILE_FIFO:          /* fifo / pipe      */
-		inode->i_di.di_mode |= S_IFIFO;
-		break;
-	case GFS_FILE_SOCK:          /* socket           */
-		inode->i_di.di_mode |= S_IFSOCK;
-		break;
-	}
-			
-	/* ----------------------------------------------------------- */
-	/* gfs2 inodes are slightly different from gfs1 inodes in that */
-	/* di_goal_meta has shifted locations and di_goal_data has     */
-	/* changed from 32-bits to 64-bits.  The following code        */
-	/* adjusts for the shift.                                      */
-	/*                                                             */
-	/* Note: It may sound absurd, but we need to check if this     */
-	/*       inode has already been converted to gfs2 or if it's   */
-	/*       still a gfs1 inode.  That's just in case there was a  */
-	/*       prior attempt to run gfs2_convert that never finished */
-	/*       (due to power out, ctrl-c, kill, segfault, whatever.) */
-	/*       If it is unconverted gfs1 we want to do a full        */
-	/*       conversion.  If it's a gfs2 inode from a prior run,   */
-	/*       we still need to renumber the inode, but here we      */
-	/*       don't want to shift the data around.                  */
-	/* ----------------------------------------------------------- */
-	if (inode_was_gfs1) {
-		struct gfs_dinode *gfs1_dinode_struct;
-
-		gfs1_dinode_struct = (struct gfs_dinode *)&inode->i_di;
-		inode->i_di.di_goal_meta = inode->i_di.di_goal_data;
-		inode->i_di.di_goal_data = 0; /* make sure the upper 32b are 0 */
-		inode->i_di.di_goal_data = gfs1_dinode_struct->di_goal_dblk;
-		inode->i_di.di_generation = 0;
-		if (adjust_indirect_blocks(sbp, bh, inode))
-			return -1;
-	}
-	
-	gfs2_dinode_out(&inode->i_di, bh->b_data);
-	sbp->md.next_inum++; /* update inode count */
-	return 0;
-} /* adjust_inode */
-
-/* ------------------------------------------------------------------------- */
-/* inode_renumber - renumber the inodes                                      */
-/*                                                                           */
-/* In gfs1, the inode number WAS the inode address.  In gfs2, the inodes are */
-/* numbered sequentially.                                                    */
-/*                                                                           */
-/* Returns: 0 on success, -1 on failure                                      */
-/* ------------------------------------------------------------------------- */
-int inode_renumber(struct gfs2_sbd *sbp, uint64_t root_inode_addr)
-{
-	struct rgrp_list *rgd;
-	osi_list_t *tmp;
-	uint64_t block;
-	struct gfs2_buffer_head *bh;
-	int first;
-	int error = 0;
-	int rgs_processed = 0;
-
-	log_notice("Converting inodes.\n");
-	sbp->md.next_inum = 1; /* starting inode numbering */
-	gettimeofday(&tv, NULL);
-	seconds = tv.tv_sec;
-
-	/* ---------------------------------------------------------------- */
-	/* Traverse the resource groups to figure out where the inodes are. */
-	/* ---------------------------------------------------------------- */
-	osi_list_foreach(tmp, &sbp->rglist) {
-		rgs_processed++;
-		rgd = osi_list_entry(tmp, struct rgrp_list, list);
-		first = 1;
-		if (gfs2_rgrp_read(sbp, rgd)) {
-			log_crit("Unable to read rgrp.\n");
-			return -1;
-		}
-		while (1) {    /* for all inodes in the resource group */
-			gettimeofday(&tv, NULL);
-			/* Put out a warm, fuzzy message every second so the customer */
-			/* doesn't think we hung.  (This may take a long time).       */
-			if (tv.tv_sec - seconds) {
-				seconds = tv.tv_sec;
-				log_notice("\r%" PRIu64" inodes from %d rgs "
-					   "converted.", sbp->md.next_inum,
-					   rgs_processed);
-				fflush(stdout);
-			}
-			/* Get the next metadata block.  Break out if we reach the end. */
-            /* We have to check all metadata blocks because the bitmap may  */
-			/* be "11" (used meta) for both inodes and indirect blocks.     */
-			/* We need to process the inodes and change the indirect blocks */
-			/* to have a bitmap type of "01" (data).                        */
-			if (gfs2_next_rg_metatype(sbp, rgd, &block, 0, first))
-				break;
-			/* If this is the root inode block, remember it for later: */
-			if (block == root_inode_addr) {
-				sbp->sd_sb.sb_root_dir.no_addr = block;
-				sbp->sd_sb.sb_root_dir.no_formal_ino = sbp->md.next_inum;
-			}
-			bh = bread(&sbp->buf_list, block);
-			if (!gfs2_check_meta(bh, GFS_METATYPE_DI)) /* if it is an dinode */
-				error = adjust_inode(sbp, bh);
-			else { /* It's metadata, but not an inode, so fix the bitmap. */
-				int blk, buf_offset;
-				int bitmap_byte; /* byte within the bitmap to fix */
-				int byte_bit; /* bit within the byte */
-
-				/* Figure out the absolute bitmap byte we need to fix.   */
-				/* ignoring structure offsets and bitmap blocks for now. */
-				bitmap_byte = (block - rgd->ri.ri_data0) / GFS2_NBBY;
-				byte_bit = (block - rgd->ri.ri_data0) % GFS2_NBBY;
-				/* Now figure out which bitmap block the byte is on */
-				for (blk = 0; blk < rgd->ri.ri_length; blk++) {
-                    /* figure out offset of first bitmap byte for this map: */
-					buf_offset = (blk) ? sizeof(struct gfs2_meta_header) :
-						sizeof(struct gfs2_rgrp);
-					/* if it's on this page */
-					if (buf_offset + bitmap_byte < sbp->bsize) {
-						rgd->bh[blk]->b_data[buf_offset + bitmap_byte] &=
-							~(0x03 << (GFS2_BIT_SIZE * byte_bit));
-						rgd->bh[blk]->b_data[buf_offset + bitmap_byte] |=
-							(0x01 << (GFS2_BIT_SIZE * byte_bit));
-						break;
-					}
-					bitmap_byte -= (sbp->bsize - buf_offset);
-				}
-			}
-			brelse(bh, updated);
-			first = 0;
-		} /* while 1 */
-		gfs2_rgrp_relse(rgd, updated);
-	} /* for all rgs */
-	log_notice("\r%" PRIu64" inodes from %d rgs converted.",
-		   sbp->md.next_inum, rgs_processed);
-	fflush(stdout);
-	return 0;
-}/* inode_renumber */
-
-/* ------------------------------------------------------------------------- */
-/* fetch_inum - fetch an inum entry from disk, given its block               */
-/* ------------------------------------------------------------------------- */
-int fetch_inum(struct gfs2_sbd *sbp, uint64_t iblock,
-					   struct gfs2_inum *inum)
-{
-	struct gfs2_buffer_head *bh_fix;
-	struct gfs2_inode *fix_inode;
-
-	bh_fix = bread(&sbp->buf_list, iblock);
-	fix_inode = inode_get(sbp, bh_fix);
-	inum->no_formal_ino = fix_inode->i_di.di_num.no_formal_ino;
-	inum->no_addr = fix_inode->i_di.di_num.no_addr;
-	brelse(bh_fix, updated);
-	return 0;
-}/* fetch_inum */
-
-/* ------------------------------------------------------------------------- */
-/* process_dirent_info - fix one dirent (directory entry) buffer             */
-/*                                                                           */
-/* We changed inode numbers, so we must update that number into the          */
-/* directory entries themselves.                                             */
-/*                                                                           */
-/* Returns: 0 on success, -1 on failure                                      */
-/* ------------------------------------------------------------------------- */
-int process_dirent_info(struct gfs2_inode *dip, struct gfs2_sbd *sbp,
-						struct gfs2_buffer_head *bh, int dir_entries)
-{
-	int error;
-	struct gfs2_dirent *dent;
-	int de; /* directory entry index */
-	
-	error = gfs2_dirent_first(dip, bh, &dent);
-	if (error != IS_LEAF && error != IS_DINODE) {
-		log_crit("Error retrieving directory.\n");
-		return -1;
-	}
-	/* Go through every dirent in the buffer and process it. */
-	/* Turns out you can't trust dir_entries is correct.     */
-	for (de = 0; ; de++) {
-		struct gfs2_inum inum;
-		int dent_was_gfs1;
-		
-		gettimeofday(&tv, NULL);
-		/* Do more warm fuzzy stuff for the customer. */
-		dirents_fixed++;
-		if (tv.tv_sec - seconds) {
-			seconds = tv.tv_sec;
-			log_notice("\r%" PRIu64 " directories, %" PRIu64 " dirents fixed.",
-					   dirs_fixed, dirents_fixed);
-			fflush(stdout);
-		}
-		/* fix the dirent's inode number based on the inode */
-		gfs2_inum_in(&inum, (char *)&dent->de_inum);
-		dent_was_gfs1 = (dent->de_inum.no_addr == dent->de_inum.no_formal_ino);
-		if (inum.no_formal_ino) { /* if not a sentinel (placeholder) */
-			error = fetch_inum(sbp, inum.no_addr, &inum);
-			if (error) {
-				log_crit("Error retrieving inode %" PRIx64 "\n", inum.no_addr);
-				break;
-			}
-			/* fix the dirent's inode number from the fetched inum. */
-			dent->de_inum.no_formal_ino = cpu_to_be64(inum.no_formal_ino);
-		}
-		/* Fix the dirent's filename hash: They are the same as gfs1 */
-		/* dent->de_hash = cpu_to_be32(gfs2_disk_hash((char *)(dent + 1), */
-		/*                             be16_to_cpu(dent->de_name_len))); */
-		/* Fix the dirent's file type.  Gfs1 used home-grown values.  */
-		/* Gfs2 uses standard values from include/linux/fs.h          */
-		/* Only do this if the dent was a true gfs1 dent, and not a   */
-		/* gfs2 dent converted from a previously aborted run.         */
-		if (dent_was_gfs1) {
-			switch be16_to_cpu(dent->de_type) {
-			case GFS_FILE_NON:
-				dent->de_type = cpu_to_be16(DT_UNKNOWN);
-				break;
-			case GFS_FILE_REG:    /* regular file */
-				dent->de_type = cpu_to_be16(DT_REG);
-				break;
-			case GFS_FILE_DIR:    /* directory */
-				dent->de_type = cpu_to_be16(DT_DIR);
-				break;
-			case GFS_FILE_LNK:    /* link */
-				dent->de_type = cpu_to_be16(DT_LNK);
-				break;
-			case GFS_FILE_BLK:    /* block device node */
-				dent->de_type = cpu_to_be16(DT_BLK);
-				break;
-			case GFS_FILE_CHR:    /* character device node */
-				dent->de_type = cpu_to_be16(DT_CHR);
-				break;
-			case GFS_FILE_FIFO:   /* fifo/pipe */
-				dent->de_type = cpu_to_be16(DT_FIFO);
-				break;
-			case GFS_FILE_SOCK:   /* socket */
-				dent->de_type = cpu_to_be16(DT_SOCK);
-				break;
-			}
-		}
-		error = gfs2_dirent_next(dip, bh, &dent);
-		if (error)
-			break;
-	} /* for every directory entry */
-	return 0;
-}/* process_dirent_info */
-
-/* ------------------------------------------------------------------------- */
-/* fix_one_directory_exhash - fix one directory's inode numbers.             */
-/*                                                                           */
-/* This is for exhash directories, where the inode has a list of "leaf"      */
-/* blocks, each of which is a buffer full of dirents that must be processed. */
-/*                                                                           */
-/* Returns: 0 on success, -1 on failure                                      */
-/* ------------------------------------------------------------------------- */
-int fix_one_directory_exhash(struct gfs2_sbd *sbp, struct gfs2_inode *dip)
-{
-	struct gfs2_buffer_head *bh_leaf;
-	int error;
-	uint64_t leaf_block, prev_leaf_block;
-	uint32_t leaf_num;
-	
-	prev_leaf_block = 0;
-	/* for all the leafs, get the leaf block and process the dirents inside */
-	for (leaf_num = 0; ; leaf_num++) {
-		uint64 buf;
-		struct gfs2_leaf leaf;
-
-		error = gfs2_readi(dip, (char *)&buf, leaf_num * sizeof(uint64),
-						   sizeof(uint64));
-		if (!error) /* end of file */
-			return 0; /* success */
-		else if (error != sizeof(uint64)) {
-			log_crit("fix_one_directory_exhash: error reading directory.\n");
-			return -1;
-		}
-		else {
-			leaf_block = be64_to_cpu(buf);
-			error = 0;
-		}
-		/* leaf blocks may be repeated, so skip the duplicates: */
-		if (leaf_block == prev_leaf_block) /* same block? */
-			continue;                      /* already converted */
-		prev_leaf_block = leaf_block;
-		/* read the leaf buffer in */
-		error = gfs2_get_leaf(dip, leaf_block, &bh_leaf);
-		if (error) {
-			log_crit("Error reading leaf %" PRIx64 "\n", leaf_block);
-			break;
-		}
-		gfs2_leaf_in(&leaf, (char *)bh_leaf->b_data); /* buffer to structure */
-		error = process_dirent_info(dip, sbp, bh_leaf, leaf.lf_entries);
-		brelse(bh_leaf, updated);
-	} /* for leaf_num */
-	return 0;
-}/* fix_one_directory_exhash */
-
-/* ------------------------------------------------------------------------- */
-/* fix_directory_info - sync new inode numbers with directory info           */
-/* Returns: 0 on success, -1 on failure                                      */
-/* ------------------------------------------------------------------------- */
-int fix_directory_info(struct gfs2_sbd *sbp, osi_list_t *dirs_to_fix)
-{
-	osi_list_t *tmp, *fix;
-	struct inode_block *dir_iblk;
-	uint64_t offset, dirblock;
-	struct gfs2_inode *dip;
-	struct gfs2_buffer_head *bh_dir;
-
-	dirs_fixed = 0;
-	dirents_fixed = 0;
-	gettimeofday(&tv, NULL);
-	seconds = tv.tv_sec;
-	log_notice("\nFixing file and directory information.\n");
-	fflush(stdout);
-	offset = 0;
-	tmp = NULL;
-	/* for every directory in the list */
-	for (fix = dirs_to_fix->next; fix != dirs_to_fix; fix = fix->next) {
-		if (tmp) {
-			osi_list_del(tmp);
-			free(tmp);
-		}
-		tmp = fix; /* remember the addr to free next time */
-		dirs_fixed++;
-		/* figure out the directory inode block and read it in */
-		dir_iblk = (struct inode_block *)fix;
-		dirblock = dir_iblk->di_addr; /* addr of dir inode */
-		/* read in the directory inode */
-		bh_dir = bread(&sbp->buf_list, dirblock);
-		dip = inode_get(sbp, bh_dir);
-		/* fix the directory: either exhash (leaves) or linear (stuffed) */
-		if (dip->i_di.di_flags & GFS2_DIF_EXHASH) {
-			if (fix_one_directory_exhash(sbp, dip)) {
-				log_crit("Error fixing exhash directory.\n");
-				brelse(bh_dir, updated);
-				return -1;
-			}
-		}
-		else {
-			if (process_dirent_info(dip, sbp, bh_dir, dip->i_di.di_entries)) {
-				log_crit("Error fixing linear directory.\n");
-				brelse(bh_dir, updated);
-				return -1;
-			}
-		}
-		brelse(bh_dir, updated);
-	}
-	/* Free the last entry in memory: */
-	if (tmp) {
-		osi_list_del(tmp);
-		free(tmp);
-	}
-	return 0;
-}/* fix_directory_info */
-
-/* ------------------------------------------------------------------------- */
-/* Fetch gfs1 jindex structure from buffer                                   */
-/* ------------------------------------------------------------------------- */
-void gfs1_jindex_in(struct gfs1_jindex *jindex, char *buf)
-{
-	struct gfs1_jindex *str = (struct gfs1_jindex *)buf;
-
-	jindex->ji_addr = be64_to_cpu(str->ji_addr);
-	jindex->ji_nsegment = be32_to_cpu(str->ji_nsegment);
-	memset(jindex->ji_reserved, 0, 64);
-}
-
-/* ------------------------------------------------------------------------- */
-/* read_gfs1_jiindex - read the gfs1 jindex file.                            */
-/* Returns: 0 on success, -1 on failure                                      */
-/* ------------------------------------------------------------------------- */
-int read_gfs1_jiindex(struct gfs2_sbd *sdp)
-{
-	struct gfs2_inode *ip = sdp->md.jiinode;
-	char buf[sizeof(struct gfs1_jindex)];
-	unsigned int j;
-	int error=0;
-
-	if(ip->i_di.di_size % sizeof(struct gfs1_jindex) != 0){
-		log_crit("The size reported in the journal index"
-				" inode is not a\n"
-				"\tmultiple of the size of a journal index.\n");
-		return -1;
-	}
-	if(!(sd_jindex = (struct gfs1_jindex *)malloc(ip->i_di.di_size))) {
-		log_crit("Unable to allocate journal index\n");
-		return -1;
-	}
-	if(!memset(sd_jindex, 0, ip->i_di.di_size)) {
-		log_crit("Unable to zero journal index\n");
-		return -1;
-	}
-	for (j = 0; ; j++) {
-		struct gfs1_jindex *journ;
-
-		error = gfs2_readi(ip, buf, j * sizeof(struct gfs1_jindex),
-						   sizeof(struct gfs1_jindex));
-		if(!error)
-			break;
-		if (error != sizeof(struct gfs1_jindex)){
-			log_crit("An error occurred while reading the"
-					" journal index file.\n");
-			goto fail;
-		}
-		journ = sd_jindex + j;
-		gfs1_jindex_in(journ, buf);
-		sdp->jsize = (journ->ji_nsegment * 16 * sdp->bsize) >> 20;
-	}
-	if(j * sizeof(struct gfs1_jindex) != ip->i_di.di_size){
-		log_crit("journal inode size invalid\n");
-		goto fail;
-	}
-	sdp->md.journals = sdp->orig_journals = j;
-	return 0;
-
- fail:
-	free(sd_jindex);
-	return -1;
-}
-
-/* ------------------------------------------------------------------------- */
-/* init - initialization code                                                */
-/* Returns: 0 on success, -1 on failure                                      */
-/* ------------------------------------------------------------------------- */
-static int init(struct gfs2_sbd *sbp)
-{
-	struct gfs2_buffer_head *bh;
-	int rgcount;
-	struct gfs2_inum inum;
-
-	memset(sbp, 0, sizeof(struct gfs2_sbd));
-	if ((sbp->device_fd = open(device, O_RDWR)) < 0) {
-		perror(device);
-		exit(-1);
-	}
-	/* --------------------------------- */
-	/* initialize the incore superblock  */
-	/* --------------------------------- */
-	sbp->sd_sb.sb_header.mh_magic = GFS2_MAGIC;
-	sbp->sd_sb.sb_header.mh_type = GFS2_METATYPE_SB;
-	sbp->sd_sb.sb_header.mh_format = GFS2_FORMAT_SB;
-
-	osi_list_init((osi_list_t *)&dirs_to_fix);
-	/* ---------------------------------------------- */
-	/* Initialize lists and read in the superblock.   */
-	/* ---------------------------------------------- */
-	sbp->jsize = GFS2_DEFAULT_JSIZE;
-	sbp->rgsize = GFS2_DEFAULT_RGSIZE;
-	sbp->utsize = GFS2_DEFAULT_UTSIZE;
-	sbp->qcsize = GFS2_DEFAULT_QCSIZE;
-	sbp->time = time(NULL);
-	sbp->blks_total = 0;   /* total blocks         - total them up later */
-	sbp->blks_alloced = 0; /* blocks allocated     - total them up later */
-	sbp->dinodes_alloced = 0; /* dinodes allocated - total them up later */
-	sbp->sd_sb.sb_bsize = GFS2_DEFAULT_BSIZE;
-	sbp->bsize = sbp->sd_sb.sb_bsize;
-	osi_list_init(&sbp->rglist);
-	init_buf_list(sbp, &sbp->buf_list, 128 << 20);
-	init_buf_list(sbp, &sbp->nvbuf_list, 0xffffffff);
-	compute_constants(sbp);
-
-	bh = bread(&sbp->buf_list, GFS2_SB_ADDR >> sbp->sd_fsb2bb_shift);
-	memcpy(&raw_gfs1_ondisk_sb, (struct gfs1_sb *)bh->b_data,
-		   sizeof(struct gfs1_sb));
-	gfs2_sb_in(&sbp->sd_sb, bh->b_data);
-	sbp->bsize = sbp->sd_sb.sb_bsize;
-	sbp->sd_inptrs = (sbp->bsize - sizeof(struct gfs_indirect)) /
-		sizeof(uint64_t);
-	sbp->sd_diptrs = (sbp->bsize - sizeof(struct gfs_dinode)) /
-		sizeof(uint64_t);
-	sbp->sd_jbsize = sbp->bsize - sizeof(struct gfs2_meta_header);
-	brelse(bh, not_updated);
-	sbp->sd_max_height = compute_heightsize(sbp, sbp->sd_heightsize,
-						sbp->bsize, sbp->sd_diptrs,
-						sbp->sd_inptrs);
-	sbp->sd_max_jheight = compute_heightsize(sbp, sbp->sd_jheightsize,
-						 sbp->sd_jbsize,
-						 sbp->sd_diptrs,
-						 sbp->sd_inptrs);
-	/* -------------------------------------------------------- */
-	/* Our constants are for gfs1.  Need some for gfs2 as well. */
-	/* -------------------------------------------------------- */
-	gfs2_inptrs = (sbp->bsize - sizeof(struct gfs2_meta_header)) /
-                sizeof(uint64_t); /* How many ptrs can we fit on a block? */
-	memset(gfs2_heightsize, 0, sizeof(gfs2_heightsize));
-	gfs2_max_height = compute_heightsize(sbp, gfs2_heightsize,
-					     sbp->bsize,
-					     sbp->sd_diptrs, gfs2_inptrs);
-	memset(gfs2_jheightsize, 0, sizeof(gfs2_jheightsize));
-	gfs2_max_jheight = compute_heightsize(sbp, gfs2_jheightsize,
-					      sbp->sd_jbsize,
-					      sbp->sd_diptrs, gfs2_inptrs);
-
-	/* ---------------------------------------------- */
-	/* Make sure we're really gfs1                    */
-	/* ---------------------------------------------- */
-	if (sbp->sd_sb.sb_fs_format != GFS_FORMAT_FS ||
-		sbp->sd_sb.sb_header.mh_type != GFS_METATYPE_SB ||
-		sbp->sd_sb.sb_header.mh_format != GFS_FORMAT_SB ||
-		sbp->sd_sb.sb_multihost_format != GFS_FORMAT_MULTI) {
-		log_crit("Error: %s does not look like a gfs1 filesystem.\n",
-				device);
-		close(sbp->device_fd);
-		exit(-1);
-	}
-	/* get gfs1 rindex inode - gfs1's rindex inode ptr became __pad2 */
-	gfs2_inum_in(&inum, (char *)&raw_gfs1_ondisk_sb.sb_rindex_di);
-	bh = bread(&sbp->buf_list, inum.no_addr);
-	sbp->md.riinode = gfs_inode_get(sbp, bh);
-	/* get gfs1 jindex inode - gfs1's journal index inode ptr became master */
-	gfs2_inum_in(&inum, (char *)&raw_gfs1_ondisk_sb.sb_jindex_di);
-	sbp->md.jiinode = gfs2_load_inode(sbp, inum.no_addr);
-	/* read in the journal index data */
-	read_gfs1_jiindex(sbp);
-	/* read in the resource group index data: */
-
-	/* We've got a slight dilemma here.  In gfs1, we used to have a meta */
-	/* header in front of the rgindex pages.  In gfs2, we don't.  That's */
-	/* apparently only for directories.  So we need to fake out libgfs2  */
-	/* so that it adjusts for the metaheader by faking out the inode to  */
-	/* look like a directory, temporarily.                               */
-	sbp->md.riinode->i_di.di_mode &= ~S_IFMT;
-	sbp->md.riinode->i_di.di_mode |= S_IFDIR;
-	printf("Examining file system");
-	if (gfs1_ri_update(sbp, 0, &rgcount)){
-		log_crit("Unable to fill in resource group information.\n");
-		return -1;
-	}
-	printf("\n");
-	fflush(stdout);
-	inode_put(sbp->md.riinode, updated);
-	inode_put(sbp->md.jiinode, updated);
-	log_debug("%d rgs found.\n", rgcount);
-	return 0;
-}/* fill_super_block */
-
-/* ------------------------------------------------------------------------- */
-/* give_warning - give the all-important warning message.                    */
-/* ------------------------------------------------------------------------- */
-void give_warning(void)
-{
-	printf("This program will convert a gfs1 filesystem to a "	\
-		   "gfs2 filesystem.\n");
-	printf("WARNING: This can't be undone.  It is strongly advised "	\
-		   "that you:\n\n");
-	printf("   1. Back up your entire filesystem first.\n");
-	printf("   2. Run gfs_fsck first to ensure filesystem integrity.\n");
-	printf("   3. Make sure the filesystem is NOT mounted from any node.\n");
-	printf("   4. Make sure you have the latest software versions.\n");
-}/* give_warning */
-
-/* ------------------------------------------------------------------------- */
-/* version  - print version information                                      */
-/* ------------------------------------------------------------------------- */
-void version(void)
-{
-	log_notice("gfs2_convert version %s (built %s %s)\n", RELEASE_VERSION,
-			   __DATE__, __TIME__);
-	log_notice("%s\n\n", REDHAT_COPYRIGHT);
-}
-
-/* ------------------------------------------------------------------------- */
-/* usage - print usage information                                           */
-/* ------------------------------------------------------------------------- */
-void usage(const char *name)
-{
-	give_warning();
-	printf("\nUsage:\n");
-	printf("%s [-hnqvVy] <device>\n\n", name);
-	printf("Flags:\n");
-	printf("\th - print this help message\n");
-	printf("\tn - assume 'no' to all questions\n");
-	printf("\tq - quieter output\n");
-	printf("\tv - more verbose output\n");
-	printf("\tV - print version information\n");
-	printf("\ty - assume 'yes' to all questions\n");
-}/* usage */
-
-/* ------------------------------------------------------------------------- */
-/* process_parameters                                                        */
-/* ------------------------------------------------------------------------- */
-void process_parameters(int argc, char **argv, struct gfs2_options *opts)
-
-{
-	char c;
-
-	opts->yes = 0;
-	opts->no = 0;
-	if (argc == 1) {
-		usage(argv[0]);
-		exit(0);
-	}
-	memset(device, 0, sizeof(device));
-	while((c = getopt(argc, argv, "hnqvyV")) != -1) {
-		switch(c) {
-
-		case 'h':
-			usage(argv[0]);
-			exit(0);
-			break;
-		case 'n':
-			opts->no = 1;
-			break;
-		case 'q':
-			decrease_verbosity();
-			break;
-		case 'v':
-			increase_verbosity();
-			break;
-		case 'V':
-			exit(0);
-		case 'y':
-			opts->yes = 1;
-			break;
-		default:
-			fprintf(stderr,"Parameter not understood: %c\n", c);
-			usage(argv[0]);
-			exit(0);
-		}
-	}
-	if(argc > optind) {
-		strcpy(device, argv[optind]);
-		opts->device = device;
-		if(!opts->device) {
-			fprintf(stderr, "Please use '-h' for usage.\n");
-			exit(1);
-		}
-	} else {
-		fprintf(stderr, "No device specified.  Use '-h' for usage.\n");
-		exit(1);
-	}
-} /* process_parameters */
-
-/* ------------------------------------------------------------------------- */
-/* rgrp_length - Calculate the length of a resource group                    */
-/* @size: The total size of the resource group                               */
-/* ------------------------------------------------------------------------- */
-uint64_t rgrp_length(uint64_t size, struct gfs2_sbd *sdp)
-{
-	uint64_t bitbytes = RGRP_BITMAP_BLKS(&sdp->sd_sb) + 1;
-	uint64_t stuff = RGRP_STUFFED_BLKS(&sdp->sd_sb) + 1;
-	uint64_t blocks = 1;
-
-	if (size >= stuff) {
-		size -= stuff;
-		while (size > bitbytes) {
-			blocks++;
-			size -= bitbytes;
-		}
-		if (size)
-			blocks++;
-	}
-	return blocks;
-}/* rgrp_length */
-
-/* ------------------------------------------------------------------------- */
-/* journ_space_to_rg - convert gfs1 journal space to gfs2 rg space.          */
-/*                                                                           */
-/* In gfs1, the journals were kept separate from the files and directories.  */
-/* They had a dedicated section of the fs carved out for them.               */
-/* In gfs2, the journals are just files like any other, (but still hidden).  */
-/* Therefore, the old journal space has to be converted to normal resource   */
-/* group space.                                                              */
-/*                                                                           */
-/* Returns: 0 on success, -1 on failure                                      */
-/* ------------------------------------------------------------------------- */
-int journ_space_to_rg(struct gfs2_sbd *sdp)
-{
-	int error = 0;
-	int j, x;
-	struct gfs1_jindex *jndx;
-	struct rgrp_list *rgd, *rgdhigh;
-	osi_list_t *tmp;
-	struct gfs2_meta_header mh;
-
-	mh.mh_magic = GFS2_MAGIC;
-	mh.mh_type = GFS2_METATYPE_RB;
-	mh.mh_format = GFS2_FORMAT_RB;
-	log_notice("Converting journal space to rg space.\n");
-	/* Go through each journal, converting them one by one */
-	for (j = 0; j < sdp->orig_journals; j++) { /* for each journal */
-		uint64_t size;
-
-		jndx = &sd_jindex[j];
-		/* go through all rg index entries, keeping track of the highest */
-		/* that's still in the first subdevice.                          */
-		/* Note: we really should go through all of the rgindex because  */
-		/* we might have had rg's added by gfs_grow, and journals added  */
-		/* by jadd.  gfs_grow adds rgs out of order, so we can't count   */
-		/* on them being in ascending order.                             */
-		rgdhigh = NULL;
-		osi_list_foreach(tmp, &sdp->rglist) {
-			rgd = osi_list_entry(tmp, struct rgrp_list, list);
-			if (rgd->ri.ri_addr < jndx->ji_addr &&
-				((rgdhigh == NULL) ||
-				 (rgd->ri.ri_addr > rgdhigh->ri.ri_addr)))
-				rgdhigh = rgd;
-		} /* for each rg */
-		log_info("Addr %" PRIx64 " comes after rg at addr %" PRIx64 "\n",
-				 jndx->ji_addr, rgdhigh->ri.ri_addr);
-		if (!rgdhigh) { /* if we somehow didn't find one. */
-			log_crit("Error: No suitable rg found for journal.\n");
-			return -1;
-		}
-		/* Allocate a new rgd entry which includes rg and ri. */
-		/* convert the gfs1 rgrp into a new gfs2 rgrp */
-		rgd = malloc(sizeof(struct rgrp_list));
-		if (!rgd) {
-			log_crit("Error: unable to allocate memory for rg conversion.\n");
-			return -1;
-		}
-		memset(rgd, 0, sizeof(struct rgrp_list));
-		size = jndx->ji_nsegment * be32_to_cpu(raw_gfs1_ondisk_sb.sb_seg_size);
-		rgd->rg.rg_header.mh_magic = GFS2_MAGIC;
-		rgd->rg.rg_header.mh_type = GFS2_METATYPE_RG;
-		rgd->rg.rg_header.mh_format = GFS2_FORMAT_RG;
-		rgd->rg.rg_flags = 0;
-		rgd->rg.rg_dinodes = 0;
-
-		rgd->ri.ri_addr = jndx->ji_addr; /* new rg addr becomes ji addr */
-		rgd->ri.ri_length = rgrp_length(size, sdp); /* aka bitblocks */
-
-		rgd->ri.ri_data0 = jndx->ji_addr + rgd->ri.ri_length;
-		rgd->ri.ri_data = size - rgd->ri.ri_length;
-		sdp->blks_total += rgd->ri.ri_data; /* For statfs file update */
-		/* Round down to nearest multiple of GFS2_NBBY */
-		while (rgd->ri.ri_data & 0x03)
-			rgd->ri.ri_data--;
-		rgd->rg.rg_free = rgd->ri.ri_data;
-		rgd->ri.ri_bitbytes = rgd->ri.ri_data / GFS2_NBBY;
-		convert_bitmaps(sdp, rgd, FALSE); /* allocates rgd->bh */
-		for (x = 0; x < rgd->ri.ri_length; x++) {
-			rgd->bh[x]->b_count++;
-			if (x)
-				gfs2_meta_header_out(&mh, rgd->bh[x]->b_data);
-			else
-				gfs2_rgrp_out(&rgd->rg, rgd->bh[x]->b_data);
-		}
-		/* Add the new gfs2 rg to our list: We'll output the rg index later. */
-		osi_list_add_prev((osi_list_t *)&rgd->list,
-						  (osi_list_t *)&sdp->rglist);
-	} /* for each journal */
-	return error;
-}/* journ_space_to_rg */
-
-/* ------------------------------------------------------------------------- */
-/* update_inode_file - update the inode file with the new next_inum          */
-/* ------------------------------------------------------------------------- */
-void update_inode_file(struct gfs2_sbd *sdp)
-{
-	struct gfs2_inode *ip = sdp->md.inum;
-	uint64_t buf;
-	int count;
-	
-	buf = cpu_to_be64(sdp->md.next_inum);
-	count = gfs2_writei(ip, &buf, 0, sizeof(uint64_t));
-	if (count != sizeof(uint64_t))
-		die("update_inode_file\n");
-	
-	log_debug("\nNext Inum: %"PRIu64"\n", sdp->md.next_inum);
-}/* update_inode_file */
-
-/* ------------------------------------------------------------------------- */
-/* write_statfs_file - write the statfs file                                 */
-/* ------------------------------------------------------------------------- */
-void write_statfs_file(struct gfs2_sbd *sdp)
-{
-	struct gfs2_inode *ip = sdp->md.statfs;
-	struct gfs2_statfs_change sc;
-	char buf[sizeof(struct gfs2_statfs_change)];
-	int count;
-	
-	sc.sc_total = sdp->blks_total;
-	sc.sc_free = sdp->blks_total - sdp->blks_alloced;
-	sc.sc_dinodes = sdp->dinodes_alloced;
-
-	gfs2_statfs_change_out(&sc, buf);
-	count = gfs2_writei(ip, buf, 0, sizeof(struct gfs2_statfs_change));
-	if (count != sizeof(struct gfs2_statfs_change))
-		die("do_init (2)\n");
-}/* write_statfs_file */
-
-/* ------------------------------------------------------------------------- */
-/* remove_obsolete_gfs1 - remove obsolete gfs1 inodes.                       */
-/* ------------------------------------------------------------------------- */
-void remove_obsolete_gfs1(struct gfs2_sbd *sbp)
-{
-	struct gfs2_inum inum;
-
-	log_notice("Removing obsolete GFS1 file system structures.\n");
-	fflush(stdout);
-	/* Delete the old gfs1 Journal index: */
-	gfs2_inum_in(&inum, (char *)&raw_gfs1_ondisk_sb.sb_jindex_di);
-	gfs2_freedi(sbp, inum.no_addr);
-
-	/* Delete the old gfs1 rgindex: */
-	gfs2_inum_in(&inum, (char *)&raw_gfs1_ondisk_sb.sb_rindex_di);
-	gfs2_freedi(sbp, inum.no_addr);
-
-	/* Delete the old gfs1 Quota file: */
-	gfs2_inum_in(&inum, (char *)&raw_gfs1_ondisk_sb.sb_quota_di);
-	gfs2_freedi(sbp, inum.no_addr);
-
-	/* Delete the old gfs1 License file: */
-	gfs2_inum_in(&inum, (char *)&raw_gfs1_ondisk_sb.sb_license_di);
-	gfs2_freedi(sbp, inum.no_addr);
-}
-
-/* ------------------------------------------------------------------------- */
-/* lifted from libgfs2/structures.c                                          */
-/* ------------------------------------------------------------------------- */
-void conv_build_jindex(struct gfs2_sbd *sdp)
-{
-	struct gfs2_inode *jindex;
-	unsigned int j;
-
-	jindex = createi(sdp->master_dir, "jindex", S_IFDIR | 0700,
-			 GFS2_DIF_SYSTEM);
-
-	for (j = 0; j < sdp->md.journals; j++) {
-		char name[256];
-		struct gfs2_inode *ip;
-
-		printf("Writing journal #%d...", j + 1);
-		fflush(stdout);
-		sprintf(name, "journal%u", j);
-		ip = createi(jindex, name, S_IFREG | 0600, GFS2_DIF_SYSTEM);
-		write_journal(sdp, ip, j,
-			      sdp->jsize << 20 >> sdp->sd_sb.sb_bsize_shift);
-		inode_put(ip, updated);
-		printf("done.\n");
-		fflush(stdout);
-	}
-
-	if (sdp->debug) {
-		printf("\nJindex:\n");
-		gfs2_dinode_print(&jindex->i_di);
-	}
-
-	inode_put(jindex, updated);
-}
-
-/* ------------------------------------------------------------------------- */
-/* main - mainline code                                                      */
-/* ------------------------------------------------------------------------- */
-int main(int argc, char **argv)
-{
-	int error;
-	struct gfs2_buffer_head *bh;
-	struct gfs2_options opts;
-
-	version();
-	process_parameters(argc, argv, &opts);
-	error = init(&sb2);
-
-	/* ---------------------------------------------- */
-	/* Make them seal their fate.                     */
-	/* ---------------------------------------------- */
-	if (!error) {
-		int abort;
-
-		give_warning();
-		if (!gfs2_query(&abort, &opts,
-				"Convert %s from GFS1 to GFS2? (y/n)",
-				device)) {
-			log_crit("%s not converted.\n", device);
-			close(sb2.device_fd);
-			exit(0);
-		}
-	}
-	/* ---------------------------------------------- */
-	/* Convert incore gfs1 sb to gfs2 sb              */
-	/* ---------------------------------------------- */
-	if (!error) {
-		log_notice("Converting resource groups.");
-		fflush(stdout);
-		error = convert_rgs(&sb2);
-		log_notice("\n");
-		if (error)
-			log_crit("%s: Unable to convert resource groups.\n",
-					device);
-		bcommit(&sb2.nvbuf_list); /* write the buffers to disk */
-	}
-	/* ---------------------------------------------- */
-	/* Renumber the inodes consecutively.             */
-	/* ---------------------------------------------- */
-	if (!error) {
-		error = inode_renumber(&sb2, sb2.sd_sb.sb_root_dir.no_addr);
-		if (error)
-			log_crit("\n%s: Error renumbering inodes.\n", device);
-		bcommit(&sb2.buf_list); /* write the buffers to disk */
-	}
-	/* ---------------------------------------------- */
-	/* Fix the directories to match the new numbers.  */
-	/* ---------------------------------------------- */
-	if (!error) {
-		error = fix_directory_info(&sb2, (osi_list_t *)&dirs_to_fix);
-		log_notice("\r%" PRIu64 " directories, %" PRIu64 " dirents fixed.",
-				   dirs_fixed, dirents_fixed);
-		fflush(stdout);
-		if (error)
-			log_crit("\n%s: Error fixing directories.\n", device);
-	}
-	/* ---------------------------------------------- */
-	/* Convert journal space to rg space              */
-	/* ---------------------------------------------- */
-	if (!error) {
-		log_notice("\nConverting journals.\n");
-		error = journ_space_to_rg(&sb2);
-		if (error)
-			log_crit("%s: Error converting journal space.\n", device);
-		bcommit(&sb2.buf_list); /* write the buffers to disk */
-	}
-	/* ---------------------------------------------- */
-	/* Create our system files and directories.       */
-	/* ---------------------------------------------- */
-	if (!error) {
-		/* Now we've got to treat it as a gfs2 file system */
-		compute_constants(&sb2);
-		/* Build the master subdirectory. */
-		build_master(&sb2); /* Does not do inode_put */
-		sb2.sd_sb.sb_master_dir = sb2.master_dir->i_di.di_num;
-		/* Build empty journal index file. */
-		conv_build_jindex(&sb2);
-		log_notice("Building GFS2 file system structures.\n");
-		/* Build the per-node directories */
-		build_per_node(&sb2);
-		/* Create the empty inode number file */
-		build_inum(&sb2); /* Does not do inode_put */
-		/* Create the statfs file */
-		build_statfs(&sb2); /* Does not do inode_put */
-
-		/* Create the resource group index file */
-		build_rindex(&sb2);
-		/* Create the quota file */
-		build_quota(&sb2);
-
-		update_inode_file(&sb2);
-		write_statfs_file(&sb2);
-
-		inode_put(sb2.master_dir, updated);
-		inode_put(sb2.md.inum, updated);
-		inode_put(sb2.md.statfs, updated);
-
-		bcommit(&sb2.buf_list); /* write the buffers to disk */
-		bcommit(&sb2.nvbuf_list); /* write the buffers to disk */
-
-		/* Now delete the now-obsolete gfs1 files: */
-		remove_obsolete_gfs1(&sb2);
-		/* Now free all the in memory */
-		gfs2_rgrp_free(&sb2.rglist, updated);
-		log_notice("Committing changes to disk.\n");
-		fflush(stdout);
-		/* Set filesystem type in superblock to gfs2.  We do this at the */
-		/* end because if the tool is interrupted in the middle, we want */
-		/* it to not reject the partially converted fs as already done   */
-		/* when it's run a second time.                                  */
-		bh = bread(&sb2.buf_list, sb2.sb_addr);
-		sb2.sd_sb.sb_fs_format = GFS2_FORMAT_FS;
-		sb2.sd_sb.sb_multihost_format = GFS2_FORMAT_MULTI;
-		gfs2_sb_out(&sb2.sd_sb, bh->b_data);
-		brelse(bh, updated);
-
-		bsync(&sb2.buf_list); /* write the buffers to disk */
-		bsync(&sb2.nvbuf_list); /* write the buffers to disk */
-		error = fsync(sb2.device_fd);
-		if (error)
-			perror(device);
-		else
-			log_notice("%s: filesystem converted successfully to gfs2.\n",
-					   device);
-	}
-	close(sb2.device_fd);
-	if (sd_jindex)
-		free(sd_jindex);
-	exit(0);
-}
diff --git a/gfs2/edit/Makefile b/gfs2/edit/Makefile
deleted file mode 100644
index b8a53cc..0000000
--- a/gfs2/edit/Makefile
+++ /dev/null
@@ -1,37 +0,0 @@
-TARGET= gfs2_edit
-
-SBINDIRT=$(TARGET)
-
-all: depends ${TARGET}
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-OBJS=	gfs2hex.o \
-	savemeta.o \
-	hexedit.o
-
-CFLAGS += -DHELPER_PROGRAM -D_FILE_OFFSET_BITS=64
-CFLAGS += -I${ncursesincdir}
-CFLAGS += -I${KERNEL_SRC}/fs/gfs2/ -I${KERNEL_SRC}/include/
-CFLAGS += -I$(S)/../include -I$(S)/../libgfs2
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${ncurseslibdir} -lncurses
-LDFLAGS += -L../libgfs2/ -lgfs2
-LDFLAGS += -L${libdir}
-
-LDDEPS += ../libgfs2/libgfs2.a
-
-${TARGET}: ${OBJS} ${LDDEPS}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-depends:
-	$(MAKE) -C ../libgfs2 all
-
-clean: generalclean
-
--include $(OBJS:.o=.d)
diff --git a/gfs2/edit/gfs2hex.c b/gfs2/edit/gfs2hex.c
deleted file mode 100644
index a63c421..0000000
--- a/gfs2/edit/gfs2hex.c
+++ /dev/null
@@ -1,581 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <sys/types.h>
-#include <linux/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include <curses.h>
-
-#include "hexedit.h"
-#include "linux_endian.h"
-
-#define WANT_GFS_CONVERSION_FUNCTIONS
-#include <linux/gfs2_ondisk.h>
-
-#include "gfs2hex.h"
-/* from libgfs2: */
-#include "libgfs2.h"
-#include "ondisk.h"
-
-
-extern struct gfs2_sb sb;
-extern char *buf;
-extern struct gfs2_dinode di;
-extern int line, termlines;
-extern char edit_fmt[80];
-extern char estring[1024];
-extern int edit_mode INIT(0);
-extern int edit_row[DMODES], edit_col[DMODES];
-extern int edit_size[DMODES], last_entry_onscreen[DMODES];
-extern char edit_fmt[80];
-extern enum dsp_mode dmode INIT(HEX_MODE); /* display mode */
-
-void eol(int col) /* end of line */
-{
-	if (termlines) {
-		line++;
-		move(line, col);
-	}
-	else {
-		printf("\n");
-		for (; col > 0; col--)
-			printf(" ");
-	}
-}
-
-void print_gfs2(const char *fmt, ...)
-{
-	va_list args;
-	char string[NAME_MAX];
-	
-	memset(string, 0, sizeof(string));
-	va_start(args, fmt);
-	vsprintf(string, fmt, args);
-	if (termlines)
-		printw("%s", string);
-	else
-		printf("%s", string);
-	va_end(args);
-}
-
-void check_highlight(int highlight)
-{
-	if (!termlines || line >= termlines) /* If printing or out of bounds */
-		return;
-	if (dmode == HEX_MODE) {
-		if (line == (edit_row[dmode] * lines_per_row[dmode]) + 4) {
-			if (highlight) {
-				COLORS_HIGHLIGHT;
-				last_entry_onscreen[dmode] = print_entry_ndx;
-			}
-			else
-				COLORS_NORMAL;
-		}
-	}
-	else {
-		if ((line * lines_per_row[dmode]) - 4 == 
-			(edit_row[dmode] - start_row[dmode]) * lines_per_row[dmode]) {
-			if (highlight) {
-				COLORS_HIGHLIGHT;
-				last_entry_onscreen[dmode] = print_entry_ndx;
-			}
-			else
-				COLORS_NORMAL;
-		}
-	}
-}
-
-void print_it(const char *label, const char *fmt, const char *fmt2, ...)
-{
-	va_list args;
-	char tmp_string[NAME_MAX];
-	const char *fmtstring;
-	int decimalsize;
-
-	if (!termlines || line < termlines) {
-		va_start(args, fmt2);
-		check_highlight(TRUE);
-		if (termlines) {
-			move(line,0);
-			printw("%s", label);
-			move(line,24);
-		}
-		else {
-			if (!strcmp(label, "  "))
-				printf("%-11s", label);
-			else
-				printf("%-24s", label);
-		}
-		vsprintf(tmp_string, fmt, args);
-
-		if (termlines)
-			printw("%s", tmp_string);
-		else
-			printf("%s", tmp_string);
-		check_highlight(FALSE);
-
-		if (fmt2) {
-			decimalsize = strlen(tmp_string);
-			va_end(args);
-			va_start(args, fmt2);
-			vsprintf(tmp_string, fmt2, args);
-			check_highlight(TRUE);
-			if (termlines) {
-				move(line, 50);
-				printw("%s", tmp_string);
-			}
-			else {
-				int i;
-				for (i=20 - decimalsize; i > 0; i--)
-					printf(" ");
-				printf("%s", tmp_string);
-			}
-			check_highlight(FALSE);
-		}
-		else {
-			if (strstr(fmt,"X") || strstr(fmt,"x"))
-				fmtstring="(hex)";
-			else if (strstr(fmt,"s"))
-				fmtstring="";
-			else
-				fmtstring="(decimal)";
-			if (termlines) {
-				move(line, 50);
-				printw("%s", fmtstring);
-			}
-			else
-				printf("%s", fmtstring);
-		}
-		if (termlines) {
-			refresh();
-			if (line == (edit_row[dmode] * lines_per_row[dmode]) + 4) {
-				strcpy(estring, tmp_string);
-				strcpy(edit_fmt, fmt);
-				edit_size[dmode] = strlen(estring);
-				COLORS_NORMAL;
-			}
-			last_entry_onscreen[dmode] = (line / lines_per_row[dmode]) - 4;
-		}
-		eol(0);
-		va_end(args);
-	}
-}
-
-int indirect_dirent(struct indirect_info *indir, char *ptr, int d)
-{
-	struct gfs2_dirent de;
-
-	gfs2_dirent_in(&de, ptr);
-	if (de.de_rec_len < sizeof(struct gfs2_dirent) ||
-		de.de_rec_len > 4096 - sizeof(struct gfs2_dirent))
-		return -1;
-	if (de.de_inum.no_addr) {
-		indir->block = de.de_inum.no_addr;
-		memcpy(&indir->dirent[d].dirent, &de, sizeof(struct gfs2_dirent));
-		memcpy(&indir->dirent[d].filename,
-			   ptr + sizeof(struct gfs2_dirent), de.de_name_len);
-		indir->dirent[d].filename[de.de_name_len] = '\0';
-		indir->dirent[d].block = de.de_inum.no_addr;
-		indir->is_dir = TRUE;
-		indir->dirents++;
-	}
-	return de.de_rec_len;
-}
-
-/******************************************************************************
-*******************************************************************************
-**
-** do_dinode_extended()
-**
-** Description:
-**
-** Input(s):
-**
-** Output(s):
-**
-** Returns:
-**
-*******************************************************************************
-******************************************************************************/
-void do_dinode_extended(struct gfs2_dinode *di, char *buf)
-{
-	unsigned int x, y;
-	uint64_t p, last;
-	int isdir = !!(S_ISDIR(di->di_mode)) || 
-		(gfs1 && di->__pad1 == GFS_FILE_DIR);
-
-	indirect_blocks = 0;
-	memset(indirect, 0, sizeof(indirect));
-	if (di->di_height > 0) {
-		/* Indirect pointers */
-		for (x = sizeof(struct gfs2_dinode); x < sbd.bsize;
-			 x += sizeof(uint64_t)) {
-			p = be64_to_cpu(*(uint64_t *)(buf + x));
-			if (p) {
-				indirect->ii[indirect_blocks].block = p;
-				indirect->ii[indirect_blocks].is_dir = FALSE;
-				indirect_blocks++;
-			}
-		}
-	}
-	else if (isdir && !(di->di_flags & GFS2_DIF_EXHASH)) {
-		int skip = 0;
-
-		/* Directory Entries: */
-		indirect->ii[0].dirents = 0;
-		indirect->ii[0].block = block;
-		indirect->ii[0].is_dir = TRUE;
-		for (x = sizeof(struct gfs2_dinode); x < sbd.bsize; x += skip) {
-			skip = indirect_dirent(indirect->ii,
-					       buf + x,
-					       indirect->ii[0].dirents);
-			if (skip <= 0)
-				break;
-		}
-	}
-	else if (isdir &&
-			 (di->di_flags & GFS2_DIF_EXHASH) &&
-			 di->di_height == 0) {
-		/* Leaf Pointers: */
-		
-		last = be64_to_cpu(*(uint64_t *)(buf + sizeof(struct gfs2_dinode)));
-    
-		for (x = sizeof(struct gfs2_dinode), y = 0;
-			 y < (1 << di->di_depth);
-			 x += sizeof(uint64_t), y++) {
-			p = be64_to_cpu(*(uint64_t *)(buf + x));
-
-			if (p != last || ((y + 1) * sizeof(uint64_t) == di->di_size)) {
-				struct gfs2_buffer_head *tmp_bh;
-				int skip = 0, direntcount = 0;
-				struct gfs2_leaf leaf;
-				unsigned int bufoffset;
-
-				if (last >= max_block)
-					break;
-				tmp_bh = bread(&sbd.buf_list, last);
-				gfs2_leaf_in(&leaf, tmp_bh->b_data);
-				indirect->ii[indirect_blocks].dirents = 0;
-				for (direntcount = 0, bufoffset = sizeof(struct gfs2_leaf);
-					 bufoffset < sbd.bsize;
-					 direntcount++, bufoffset += skip) {
-					skip = indirect_dirent(&indirect->ii[indirect_blocks],
-										   tmp_bh->b_data + bufoffset,
-										   direntcount);
-					if (skip <= 0)
-						break;
-				}
-				brelse(tmp_bh, not_updated);
-				indirect->ii[indirect_blocks].block = last;
-				indirect_blocks++;
-				last = p;
-			} /* if not duplicate pointer */
-		} /* for indirect pointers found */
-	} /* if exhash */
-}/* do_dinode_extended */
-
-/******************************************************************************
-*******************************************************************************
-**
-** do_indirect_extended()
-**
-** Description:
-**
-** Input(s):
-**
-** Output(s):
-**
-** Returns:
-**
-*******************************************************************************
-******************************************************************************/
-int do_indirect_extended(char *buf, struct iinfo *iinf)
-{
-	unsigned int x, y;
-	uint64_t p;
-	int i_blocks;
-
-	i_blocks = 0;
-	memset(iinf, 0, sizeof(struct iinfo));
-	for (x = (gfs1 ? sizeof(struct gfs_indirect):
-			  sizeof(struct gfs2_meta_header)), y = 0;
-		 x < sbd.bsize;
-		 x += sizeof(uint64_t), y++) {
-		p = be64_to_cpu(*(uint64_t *)(buf + x));
-		if (p) {
-			iinf->ii[i_blocks].block = p;
-			iinf->ii[i_blocks].is_dir = FALSE;
-			i_blocks++;
-		}
-	}
-	return i_blocks;
-}
-
-/******************************************************************************
-*******************************************************************************
-**
-** do_leaf_extended()
-**
-** Description:
-**
-** Input(s):
-**
-** Output(s):
-**
-** Returns:
-**
-*******************************************************************************
-******************************************************************************/
-void do_leaf_extended(char *buf, struct iinfo *indir)
-{
-	int x, i;
-	struct gfs2_dirent de;
-
-	x = 0;
-	memset(indir, 0, sizeof(indir));
-	/* Directory Entries: */
-	for (i = sizeof(struct gfs2_leaf); i < sbd.bsize;
-	     i += de.de_rec_len) {
-		gfs2_dirent_in(&de, buf + i);
-		if (de.de_inum.no_addr) {
-			indir->ii[0].block = de.de_inum.no_addr;
-			indir->ii[0].dirent[x].block = de.de_inum.no_addr;
-			memcpy(&indir->ii[0].dirent[x].dirent,
-			       &de, sizeof(struct gfs2_dirent));
-			memcpy(&indir->ii[0].dirent[x].filename,
-			       buf + i + sizeof(struct gfs2_dirent),
-			       de.de_name_len);
-			indir->ii[0].dirent[x].filename[de.de_name_len] = '\0';
-			indir->ii[0].is_dir = TRUE;
-			indir->ii[0].dirents++;
-			x++;
-		}
-		if (de.de_rec_len <= sizeof(struct gfs2_dirent))
-			break;
-	}
-}
-
-
-/******************************************************************************
-*******************************************************************************
-**
-** do_eattr_extended()
-**
-** Description:
-**
-** Input(s):
-**
-** Output(s):
-**
-** Returns:
-**
-*******************************************************************************
-******************************************************************************/
-
-void do_eattr_extended(char *buf)
-{
-	struct gfs2_ea_header ea;
-	unsigned int x;
-
-	eol(0);
-	print_gfs2("Eattr Entries:");
-	eol(0);
-
-	for (x = sizeof(struct gfs2_meta_header); x < sbd.bsize; x += ea.ea_rec_len)
-	{
-		eol(0);
-		gfs2_ea_header_in(&ea, buf + x);
-		gfs2_ea_header_print(&ea, buf + x + sizeof(struct gfs2_ea_header));
-	}
-}
-
-void gfs2_inum_print2(const char *title,struct gfs2_inum *no)
-{
-	if (termlines) {
-		check_highlight(TRUE);
-		move(line,2);
-		printw(title);
-		check_highlight(FALSE);
-	}
-	else
-		printf("  %s:",title);
-	pv2(no, no_formal_ino, "%lld", "0x%"PRIx64);
-	if (!termlines)
-		printf("        addr:");
-	pv2(no, no_addr, "%lld", "0x%"PRIx64);
-}
-
-/**
- * gfs2_sb_print2 - Print out a superblock
- * @sb: the cpu-order buffer
- */
-void gfs2_sb_print2(struct gfs2_sb *sb)
-{
-	gfs2_meta_header_print(&sb->sb_header);
-
-	pv(sb, sb_fs_format, "%u", "0x%x");
-	pv(sb, sb_multihost_format, "%u", "0x%x");
-
-	pv(sb, sb_bsize, "%u", "0x%x");
-	pv(sb, sb_bsize_shift, "%u", "0x%x");
-	if (gfs1) {
-		gfs2_inum_print2("jindex ino", &sbd1->sb_jindex_di);
-		gfs2_inum_print2("rindex ino", &sbd1->sb_rindex_di);
-	}
-	else
-		gfs2_inum_print2("master dir", &sb->sb_master_dir);
-	gfs2_inum_print2("root dir  ", &sb->sb_root_dir);
-
-	pv(sb, sb_lockproto, "%s", NULL);
-	pv(sb, sb_locktable, "%s", NULL);
-	if (gfs1) {
-		gfs2_inum_print2("quota ino ", &gfs1_quota_di);
-		gfs2_inum_print2("license   ", &gfs1_license_di);
-	}
-}
-
-/******************************************************************************
-*******************************************************************************
-**
-** int display_gfs2()
-**
-** Description:
-**   This routine...
-**
-** Input(s):
-**  *buffer   - 
-**   extended - 
-**
-** Returns:
-**   0 if OK, 1 on error.
-**
-*******************************************************************************
-******************************************************************************/
-int display_gfs2(void)
-{
-	struct gfs2_meta_header mh;
-	struct gfs2_rgrp rg;
-	struct gfs2_leaf lf;
-	struct gfs_log_header lh1;
-	struct gfs2_log_header lh;
-	struct gfs2_log_descriptor ld;
-	struct gfs2_quota_change qc;
-
-	uint32_t magic;
-
-	magic = be32_to_cpu(*(uint32_t *)buf);
-
-	switch (magic)
-	{
-	case GFS2_MAGIC:
-		gfs2_meta_header_in(&mh, buf);
-		
-		switch (mh.mh_type)
-		{
-		case GFS2_METATYPE_SB:
-			print_gfs2("Superblock:");
-			eol(0);
-			gfs2_sb_in(&sbd.sd_sb, buf);
-			gfs2_sb_print2(&sbd.sd_sb);
-			break;
-			
-		case GFS2_METATYPE_RG:
-			print_gfs2("Resource Group Header:");
-			eol(0);
-			gfs2_rgrp_in(&rg, buf);
-			gfs2_rgrp_print(&rg);
-			break;
-			
-		case GFS2_METATYPE_RB:
-			print_gfs2("Resource Group Bitmap:");
-			eol(0);
-			gfs2_meta_header_print(&mh);
-			break;
-			
-		case GFS2_METATYPE_DI:
-			print_gfs2("Dinode:");
-			eol(0);
-			gfs2_dinode_print(&di);
-			break;
-			
-		case GFS2_METATYPE_LF:
-			print_gfs2("Leaf:");
-			eol(0);
-			gfs2_leaf_in(&lf, buf);
-			gfs2_leaf_print(&lf);
-			break;
-			
-		case GFS2_METATYPE_IN:
-			print_gfs2("Indirect Block:");
-			eol(0);
-			gfs2_meta_header_print(&mh);
-			break;
-			
-		case GFS2_METATYPE_JD:
-			print_gfs2("Journaled File Block:");
-			eol(0);
-			gfs2_meta_header_print(&mh);
-			break;
-			
-		case GFS2_METATYPE_LH:
-			print_gfs2("Log Header:");
-			eol(0);
-			if (gfs1) {
-				gfs_log_header_in(&lh1, buf);
-				gfs_log_header_print(&lh1);
-			} else {
-				gfs2_log_header_in(&lh, buf);
-				gfs2_log_header_print(&lh);
-			}
-			break;
-			
-		case GFS2_METATYPE_LD:
-			print_gfs2("Log descriptor");
-			eol(0);
-			gfs2_log_descriptor_in(&ld, buf);
-			gfs2_log_descriptor_print(&ld);
-			break;
-
-		case GFS2_METATYPE_EA:
-			print_gfs2("Eattr Block:");
-			eol(0);
-			do_eattr_extended(buf);
-			break;
-			
-		case GFS2_METATYPE_ED:
-			print_gfs2("Eattr Data Block:");
-			eol(0);
-			gfs2_meta_header_print(&mh);
-			break;
-			
-		case GFS2_METATYPE_LB:
-			print_gfs2("Log Buffer");
-			eol(0);
-			gfs2_meta_header_print(&mh);
-			break;
-
-		case GFS2_METATYPE_QC:
-			print_gfs2("Quota Change");
-			eol(0);
-			gfs2_quota_change_in(&qc, buf);
-			gfs2_quota_change_print(&qc);
-			break;
-
-		default:
-			print_gfs2("Unknown metadata type");
-			eol(0);
-			break;
-		}
-		break;
-		
-	default:
-		print_gfs2("Unknown block type");
-		eol(0);
-		break;
-	};
-	return(0);
-}
diff --git a/gfs2/edit/gfs2hex.h b/gfs2/edit/gfs2hex.h
deleted file mode 100644
index 4dd92d4..0000000
--- a/gfs2/edit/gfs2hex.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef __GFS2HEX_DOT_H__
-#define __GFS2HEX_DOT_H__
-
-
-int display_gfs2(void);
-int edit_gfs2(void);
-void do_dinode_extended(struct gfs2_dinode *di, char *buf);
-void print_gfs2(const char *fmt, ...);
-
-#endif /*  __GFS2HEX_DOT_H__  */
diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
deleted file mode 100644
index 099d66e..0000000
--- a/gfs2/edit/hexedit.c
+++ /dev/null
@@ -1,2775 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <string.h>
-#include <inttypes.h>
-#include <sys/types.h>
-#include <linux/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include <curses.h>
-#include <term.h>
-#include <time.h>
-#include <signal.h>
-#include <sys/ioctl.h>
-#include <sys/mount.h>
-#include <dirent.h>
-
-#include "linux_endian.h"
-#include <linux/gfs2_ondisk.h>
-#include "copyright.cf"
-
-#define EXTERN
-#include "hexedit.h"
-#include "linux_endian.h"
-#include "libgfs2.h"
-#include "gfs2hex.h"
-
-#define RGLIST_DUMMY_BLOCK -2
-
-int display(int identify_only);
-extern void eol(int col);
-extern void do_leaf_extended(char *buf, struct iinfo *indir);
-extern int do_indirect_extended(char *buf, struct iinfo *ii);
-extern void savemeta(char *out_fn, int slow);
-extern void restoremeta(const char *in_fn, const char *out_device,
-			int printblocksonly);
-
-/* ------------------------------------------------------------------------ */
-/* UpdateSize - screen size changed, so update it                           */
-/* ------------------------------------------------------------------------ */
-void UpdateSize(int sig)
-{
-	static char term_buffer[2048];
-	int rc;
-
-	termlines = 30;
-	termtype = getenv("TERM");
-	if (termtype == NULL)
-		return;
-	rc=tgetent(term_buffer,termtype);
-	if (rc>=0) {
-		termlines = tgetnum("li");
-		if (termlines < 10)
-			termlines = 30;
-		termcols = tgetnum("co");
-		if (termcols < 80)
-			termcols = 80;
-	}
-	else
-		perror("Error: tgetent failed.");
-	termlines--; /* last line is number of lines -1 */
-	display(FALSE);
-	signal(SIGWINCH, UpdateSize);
-}
-
-/* ------------------------------------------------------------------------- */
-/* erase - clear the screen */
-/* ------------------------------------------------------------------------- */
-void Erase(void)
-{
-	int i;
-	char spaces[256];
-
-	memset(spaces, ' ', sizeof(spaces));
-	spaces[termcols] = '\0';
-	for (i = 0; i < termlines; i++) {
-		move(i, 0);
-		printw(spaces);
-	}
-	/*clear(); doesn't set background correctly */
-	/*erase();*/
-	/*bkgd(bg);*/
-}
-
-/* ------------------------------------------------------------------------- */
-/* display_title_lines */
-/* ------------------------------------------------------------------------- */
-void display_title_lines(void)
-{
-	Erase();
-	COLORS_TITLE;
-	move(0, 0);
-	printw("%-80s",TITLE1);
-	move(termlines, 0);
-	printw("%-79s",TITLE2);
-	COLORS_NORMAL;
-}
-
-/* ------------------------------------------------------------------------- */
-/* bobgets - get a string                                                    */
-/* returns: 1 if user exited by hitting enter                                */
-/*          0 if user exited by hitting escape                               */
-/* ------------------------------------------------------------------------- */
-int bobgets(char string[],int x,int y,int sz,int *ch)
-{
-	int done,runningy,rc;
-
-	move(x,y);
-	done=FALSE;
-	COLORS_INVERSE;
-	move(x,y);
-	addstr(string);
-	move(x,y);
-	curs_set(2);
-	refresh();
-	runningy=y;
-	rc=0;
-	while (!done) {
-		*ch = getch();
-		
-		if(*ch < 0x0100 && isprint(*ch)) {
-			char *p=string+strlen(string); // end of the string
-
-			*(p+1)='\0';
-			while (insert && p > &string[runningy-y]) {
-				*p=*(p-1);
-				p--;
-			}
-			string[runningy-y]=*ch;
-			runningy++;
-			move(x,y);
-			addstr(string);
-			if (runningy-y >= sz) {
-				rc=1;
-				*ch = KEY_RIGHT;
-				done = TRUE;
-			}
-		}
-		else {
-			// special character, is it one we recognize?
-			switch(*ch)
-			{
-			case(KEY_ENTER):
-			case('\n'):
-			case('\r'):
-				rc=1;
-				done=TRUE;
-				string[runningy-y] = '\0';
-				break;
-			case(KEY_CANCEL):
-			case(0x01B):
-				rc=0;
-				done=TRUE;
-				break;
-			case(KEY_LEFT):
-				if (dmode == HEX_MODE) {
-					done = TRUE;
-					rc = 1;
-				}
-				else
-					runningy--;
-				break;
-			case(KEY_RIGHT):
-				if (dmode == HEX_MODE) {
-					done = TRUE;
-					rc = 1;
-				}
-				else
-					runningy++;
-				break;
-			case(KEY_DC):
-			case(0x07F):
-				if (runningy>=y) {
-					char *p;
-					p = &string[runningy - y];
-					while (*p) {
-						*p = *(p + 1);
-						p++;
-					}
-					*p = '\0';
-					runningy--;
-					// remove the character from the string 
-					move(x,y);
-					addstr(string);
-					COLORS_NORMAL;
-					addstr(" ");
-					COLORS_INVERSE;
-					runningy++;
-				}
-				break;
-			case(KEY_BACKSPACE):
-				if (runningy>y) {
-					char *p;
-
-					p = &string[runningy - y - 1];
-					while (*p) {
-						*p = *(p + 1);
-						p++;
-					}
-					*p='\0';
-					runningy--;
-					// remove the character from the string 
-					move(x,y);
-					addstr(string);
-					COLORS_NORMAL;
-					addstr(" ");
-					COLORS_INVERSE;
-				}
-				break;
-			case KEY_DOWN:	// Down
-				rc=0x5000U;
-				done=TRUE;
-				break;
-			case KEY_UP:	// Up
-				rc=0x4800U;
-				done=TRUE;
-				break;
-			case 0x014b:
-				insert=!insert;
-				move(0,68);
-				if (insert)
-					printw("insert ");
-				else
-					printw("replace");
-				break;
-			default:
-				move(0,70);
-				printw("%08X",*ch);
-				// ignore all other characters
-				break;
-			} // end switch on non-printable character
-		} // end non-printable character
-		move(x,runningy);
-		refresh();
-	} // while !done
-	if (sz>0)
-		string[sz]='\0';
-	COLORS_NORMAL;
-	return rc;
-}/* bobgets */
-
-/******************************************************************************
-** instr - instructions
-******************************************************************************/
-void gfs2instr(const char *s1, const char *s2)
-{
-	COLORS_HIGHLIGHT;
-	move(line,0);
-	printw(s1);
-	COLORS_NORMAL;
-	move(line,17);
-	printw(s2);
-	line++;
-}
-
-/******************************************************************************
-*******************************************************************************
-**
-** void print_usage()
-**
-** Description:
-**   This routine prints out the appropriate commands for this application.
-**
-*******************************************************************************
-******************************************************************************/
-
-void print_usage(void)
-{
-	int ch;
-
-	line = 2;
-	Erase();
-	display_title_lines();
-	move(line++,0);
-	printw("Supported commands: (roughly conforming to the rules of 'less')");
-	line++;
-	move(line++,0);
-	printw("Navigation:");
-	gfs2instr("<pg up>/<down>","Move up or down one screen full");
-	gfs2instr("<up>/<down>","Move up or down one line");
-	gfs2instr("<left>/<right>","Move left or right one byte");
-	gfs2instr("<home>","Return to the superblock.");
-	gfs2instr("   f","Forward one 4K block");
-	gfs2instr("   b","Backward one 4K block");
-	gfs2instr("   g","Goto a given block (number, master, root, rindex, jindex, etc)");
-	gfs2instr("   j","Jump to the highlighted 64-bit block number.");
-	gfs2instr("    ","(You may also arrow up to the block number and hit enter)");
-	gfs2instr("<backspace>","Return to a previous block (a block stack is kept)");
-	gfs2instr("<space>","Jump forward to block before backspace (opposite of backspace)");
-	line++;
-	move(line++, 0);
-	printw("Other commands:");
-	gfs2instr("   h","This Help display");
-	gfs2instr("   c","Toggle the color scheme");
-	gfs2instr("   m","Switch display mode: hex -> GFS2 structure -> Extended");
-	gfs2instr("   q","Quit (same as hitting <escape> key)");
-	gfs2instr("<enter>","Edit a value (enter to save, esc to discard)");
-	gfs2instr("       ","(Currently only works on the hex display)");
-	gfs2instr("<escape>","Quit the program");
-	line++;
-	move(line++, 0);
-	printw("Notes: Areas shown in red are outside the bounds of the struct/file.");
-	move(line++, 0);
-	printw("       Areas shown in blue are file contents.");
-	move(line++, 0);
-	printw("       Characters shown in green are selected for edit on <enter>.");
-	move(line++, 0);
-	move(line++, 0);
-	printw("Press any key to return.");
-	refresh();
-	while ((ch=getch()) == 0); // wait for input
-	Erase();
-}
-
-
-
-/* ------------------------------------------------------------------------ */
-/* get_block_type                                                           */
-/* returns: metatype if block is a GFS2 structure block type                */
-/*          0 if block is not a GFS2 structure                              */
-/* ------------------------------------------------------------------------ */
-int get_block_type(const char *lpBuffer)
-{
-	int ret_type = 0;
-
-	if (*(lpBuffer+0)==0x01 && *(lpBuffer+1)==0x16 &&
-	    *(lpBuffer+2)==0x19 && *(lpBuffer+3)==0x70 &&
-	    *(lpBuffer+4)==0x00 && *(lpBuffer+5)==0x00 &&
-	    *(lpBuffer+6)==0x00) /* If magic number appears at the start */
-		ret_type = *(lpBuffer+7);
-	return ret_type;
-}
-
-/* ------------------------------------------------------------------------ */
-/* display_block_type                                                       */
-/* returns: metatype if block is a GFS2 structure block type                */
-/*          0 if block is not a GFS2 structure                              */
-/* ------------------------------------------------------------------------ */
-int display_block_type(const char *lpBuffer, int from_restore)
-{
-	int ret_type = 0; /* return type */
-
-	/* first, print out the kind of GFS2 block this is */
-	if (termlines) {
-		line = 1;
-		move(line, 0);
-	}
-	print_gfs2("Block #");
-	if (termlines) {
-		if (edit_row[dmode] == -1)
-			COLORS_HIGHLIGHT;
-	}
-	if (block == RGLIST_DUMMY_BLOCK)
-		print_gfs2("RG List       ");
-	else
-		print_gfs2("%lld    (0x%"PRIx64")", block, block);
-	if (termlines) {
-		if (edit_row[dmode] == -1)
-			COLORS_NORMAL;
-		move(line,30);
-	}
-	else
-		print_gfs2(" ");
-	if (!from_restore) {
-		print_gfs2("of %" PRIu64 " (0x%" PRIX64 ")", max_block,
-			   max_block);
-		if (termlines)
-			move(line, 55);
-		else
-			printf(" ");
-	}
-	if (block == RGLIST_DUMMY_BLOCK) {
-		ret_type = GFS2_METATYPE_RG;
-		struct_len = gfs1 ? sizeof(struct gfs_rgrp) : sizeof(struct gfs2_rgrp);
-	}
-	else if ((ret_type = get_block_type(lpBuffer))) {
-		switch (*(lpBuffer+7)) {
-		case GFS2_METATYPE_SB:   /* 1 */
-			print_gfs2("(superblock)");
-			if (gfs1)
-				struct_len = sizeof(struct gfs_sb);
-			else
-				struct_len = sizeof(struct gfs2_sb);
-			break;
-		case GFS2_METATYPE_RG:   /* 2 */
-			print_gfs2("(rsrc grp hdr)");
-			struct_len = sizeof(struct gfs2_rgrp);
-			break;
-		case GFS2_METATYPE_RB:   /* 3 */
-			print_gfs2("(rsrc grp bitblk)");
-			struct_len = 512;
-			break;
-		case GFS2_METATYPE_DI:   /* 4 */
-			print_gfs2("(disk inode)");
-			struct_len = sizeof(struct gfs2_dinode);
-			break;
-		case GFS2_METATYPE_IN:   /* 5 */
-			print_gfs2("(indir inode blklst)");
-			struct_len = sizeof(struct gfs2_meta_header);
-			break;
-		case GFS2_METATYPE_LF:   /* 6 */
-			print_gfs2("(directory leaf)");
-			struct_len = sizeof(struct gfs2_leaf);
-			break;
-		case GFS2_METATYPE_JD:
-			print_gfs2("(journal data)");
-			struct_len = sizeof(struct gfs2_meta_header);
-			break;
-		case GFS2_METATYPE_LH:
-			print_gfs2("(log header)");
-			struct_len = sizeof(struct gfs2_log_header);
-			break;
-		case GFS2_METATYPE_LD:
-		 	print_gfs2("(log descriptor)");
-			if (gfs1)
-				struct_len = sizeof(struct gfs_log_descriptor);
-			else
-				struct_len =
-					sizeof(struct gfs2_log_descriptor);
-			break;
-		case GFS2_METATYPE_EA:
-			print_gfs2("(extended attr hdr)");
-			struct_len = sizeof(struct gfs2_meta_header) +
-				sizeof(struct gfs2_ea_header);
-			break;
-		case GFS2_METATYPE_ED:
-			print_gfs2("(extended attr data)");
-			struct_len = sizeof(struct gfs2_meta_header) +
-				sizeof(struct gfs2_ea_header);
-			break;
-		case GFS2_METATYPE_LB:
-			print_gfs2("(log buffer)");
-			struct_len = sizeof(struct gfs2_meta_header);
-			break;
-		case GFS2_METATYPE_QC:
-			print_gfs2("(quota change)");
-			struct_len = sizeof(struct gfs2_quota_change);
-			break;
-		default:
-			print_gfs2("(wtf?)");
-			struct_len = 512;
-			break;
-		}
-	}
-	else
-		struct_len = 512;
-	eol(0);
-	if (from_restore)
-		return ret_type;
-	if (termlines && dmode == HEX_MODE) {
-		/* calculate how much of the buffer we can fit on screen */
-		screen_chunk_size = ((termlines - 4) * 16) >> 8 << 8;
-		if (!screen_chunk_size)
-			screen_chunk_size = 256;
-		print_gfs2("(p.%d of %d)", (offset / screen_chunk_size) + 1,
-				   (sbd.bsize % screen_chunk_size) > 0 ?
-				   sbd.bsize / screen_chunk_size + 1 : sbd.bsize /
-				   screen_chunk_size);
-		/*eol(9);*/
-	}
-	if (block == sbd.sd_sb.sb_root_dir.no_addr)
-		print_gfs2("-------------------- Root directory ------------------");
-	else if (!gfs1 && block == sbd.sd_sb.sb_master_dir.no_addr)
-		print_gfs2("------------------- Master directory -----------------");
-	else if (!gfs1 && block == RGLIST_DUMMY_BLOCK)
-		print_gfs2("----------------------- RG List ----------------------");
-	else {
-		if (gfs1) {
-			if (block == sbd1->sb_rindex_di.no_addr)
-				print_gfs2("--------------------- rindex file -------------------");
-			else if (block == gfs1_quota_di.no_addr)
-				print_gfs2("--------------------- Quota file --------------------");
-			else if (block == sbd1->sb_jindex_di.no_addr)
-				print_gfs2("-------------------- Journal Index ------------------");
-			else if (block == gfs1_license_di.no_addr)
-				print_gfs2("-------------------- License file -------------------");
-		}
-		else {
-			int d;
-
-			for (d = 2; d < 8; d++) {
-				if (block == masterdir.dirent[d].block) {
-					if (!strncmp(masterdir.dirent[d].filename, "jindex", 6))
-						print_gfs2("-------------------- Journal Index ------------------");
-					else if (!strncmp(masterdir.dirent[d].filename, "per_node", 8))
-						print_gfs2("-------------------- Per-node Dir -------------------");
-					else if (!strncmp(masterdir.dirent[d].filename, "inum", 4))
-						print_gfs2("--------------------- Inum file ---------------------");
-					else if (!strncmp(masterdir.dirent[d].filename, "statfs", 6))
-						print_gfs2("--------------------- statfs file -------------------");
-					else if (!strncmp(masterdir.dirent[d].filename, "rindex", 6))
-						print_gfs2("--------------------- rindex file -------------------");
-					else if (!strncmp(masterdir.dirent[d].filename, "quota", 5))
-						print_gfs2("--------------------- Quota file --------------------");
-				}
-			}
-		}
-	}
-	eol(0);
-	return ret_type;
-}
-
-/* ------------------------------------------------------------------------ */
-/* hexdump - hex dump the filesystem block to the screen                    */
-/* ------------------------------------------------------------------------ */
-int hexdump(uint64_t startaddr, const char *lpBuffer, int len)
-{
-	const unsigned char *pointer,*ptr2;
-	int i;
-	uint64_t l;
-
-	strcpy(edit_fmt,"%02X");
-	pointer = (unsigned char *)lpBuffer + offset;
-	ptr2 = (unsigned char *)lpBuffer + offset;
-	l = offset;
-	print_entry_ndx = 0;
-	while (((termlines &&
-			line < termlines &&
-			line <= ((screen_chunk_size / 16) + 2)) ||
-			(!termlines && l < len)) &&
-		   l < sbd.bsize) {
-		if (termlines) {
-			move(line, 0);
-			COLORS_OFFSETS; /* cyan for offsets */
-		}
-		if (startaddr < 0xffffffff)
-			print_gfs2("%.8"PRIX64, startaddr + l);
-		else
-			print_gfs2("%.16"PRIX64, startaddr + l);
-		if (termlines) {
-			if (l < struct_len)
-				COLORS_NORMAL; /* normal part of the structure */
-			else if (gfs2_struct_type == GFS2_METATYPE_DI && 
-					 l < struct_len + di.di_size)
-				COLORS_CONTENTS; /* after struct but not eof */
-			else
-				COLORS_SPECIAL; /* beyond the end of the structure */
-		}
-		for (i = 0; i < 16; i++) { /* first print it in hex */
-			if (termlines) {
-				if (l + i < struct_len)
-					COLORS_NORMAL; /* normal part of the structure */
-				else if (gfs2_struct_type == GFS2_METATYPE_DI && 
-						 l + i < struct_len + di.di_size)
-					COLORS_CONTENTS; /* beyond structure but not eof */
-				else
-					COLORS_SPECIAL; /* past end of the structure */
-			}
-			if (i%4 == 0)
-				print_gfs2(" ");
-			if (termlines && line == edit_row[dmode] + 3 &&
-				i == edit_col[dmode]) {
-				COLORS_HIGHLIGHT; /* normal part of the structure */
-				memset(estring,0,3);
-				sprintf(estring,"%02X",*pointer);
-			}
-			print_gfs2("%02X",*pointer);
-			if (termlines && line == edit_row[dmode] + 3 &&
-				i == edit_col[dmode]) {
-				if (l < struct_len + offset)
-					COLORS_NORMAL; /* normal part of the structure */
-				else
-					COLORS_SPECIAL; /* beyond end of the structure */
-			}
-			pointer++;
-		}
-		print_gfs2(" [");
-		for (i=0; i<16; i++) { /* now print it in character format */
-			if ((*ptr2 >=' ') && (*ptr2 <= '~'))
-				print_gfs2("%c",*ptr2);
-			else
-				print_gfs2(".");
-			ptr2++;
-		}
-		print_gfs2("] ");
-		if (line - 3 > last_entry_onscreen[dmode])
-			last_entry_onscreen[dmode] = line - 3;
-		eol(0);
-		l+=16;
-		print_entry_ndx++;
-	} /* while */
-	if (gfs1) {
-		COLORS_NORMAL;
-		print_gfs2("         *** This seems to be a GFS-1 file system ***");
-		eol(0);
-	}
-	return (offset+len);
-}/* hexdump */
-
-/* ------------------------------------------------------------------------ */
-/* masterblock - find a file (by name) in the master directory and return   */
-/*               its block number.                                          */
-/* ------------------------------------------------------------------------ */
-uint64_t masterblock(const char *fn)
-{
-	int d;
-	
-	for (d = 2; d < 8; d++)
-		if (!strncmp(masterdir.dirent[d].filename, fn, strlen(fn)))
-			return (masterdir.dirent[d].block);
-	return 0;
-}
-
-/* ------------------------------------------------------------------------ */
-/* risize - size of one rindex entry, whether gfs1 or gfs2                  */
-/* ------------------------------------------------------------------------ */
-static int risize(void)
-{
-	if (gfs1)
-		return sizeof(struct gfs_rindex);
-	else
-		return sizeof(struct gfs2_rindex);
-}
-
-/* ------------------------------------------------------------------------ */
-/* rgcount - return how many rgrps there are.                               */
-/* ------------------------------------------------------------------------ */
-void rgcount(void)
-{
-	uint64_t block;
-	struct gfs2_buffer_head *ribh;
-	struct gfs2_inode *riinode;
-
-	if (gfs1)
-		block = sbd1->sb_rindex_di.no_addr;
-	else
-		block = masterblock("rindex");
-	ribh = bread(&sbd.buf_list, block);
-	riinode = inode_get(&sbd, ribh);
-	printf("%lld RGs in this file system.\n",
-	       (unsigned long long)riinode->i_di.di_size / risize());
-	inode_put(riinode, not_updated);
-	exit(EXIT_SUCCESS);
-}
-
-/* ------------------------------------------------------------------------ */
-/* find_rgrp_block - locate the block for a given rgrp number               */
-/* ------------------------------------------------------------------------ */
-uint64_t find_rgrp_block(struct gfs2_inode *di, int rg)
-{
-	char buf[sizeof(struct gfs2_rindex)];
-	int amt;
-	struct gfs2_rindex ri;
-	uint64_t offset, gfs1_adj = 0;
-
-	offset = rg * risize();
-	if (gfs1) {
-		uint64_t sd_jbsize =
-			(sbd.bsize - sizeof(struct gfs2_meta_header));
-
-		gfs1_adj = (offset / sd_jbsize) *
-			sizeof(struct gfs2_meta_header);
-		gfs1_adj += sizeof(struct gfs2_meta_header);
-	}
-	amt = gfs2_readi(di, (void *)&buf, offset + gfs1_adj, risize());
-	if (!amt) /* end of file */
-		return 0;
-	gfs2_rindex_in(&ri, buf);
-	return ri.ri_addr;
-}
-
-/* ------------------------------------------------------------------------ */
-/* gfs_rgrp_in - Read in a resource group header                            */
-/* ------------------------------------------------------------------------ */
-void gfs_rgrp_in(struct gfs_rgrp *rgrp, char *buf)
-{
-	struct gfs_rgrp *str = (struct gfs_rgrp *)buf;
-
-	gfs2_meta_header_in(&rgrp->rg_header, buf);
-	rgrp->rg_flags = be32_to_cpu(str->rg_flags);
-	rgrp->rg_free = be32_to_cpu(str->rg_free);
-	rgrp->rg_useddi = be32_to_cpu(str->rg_useddi);
-	rgrp->rg_freedi = be32_to_cpu(str->rg_freedi);
-	gfs2_inum_in(&rgrp->rg_freedi_list, (char *)&str->rg_freedi_list);
-	rgrp->rg_usedmeta = be32_to_cpu(str->rg_usedmeta);
-	rgrp->rg_freemeta = be32_to_cpu(str->rg_freemeta);
-}
-
-/* ------------------------------------------------------------------------ */
-/* gfs_rgrp_out */
-/* ------------------------------------------------------------------------ */
-void gfs_rgrp_out(struct gfs_rgrp *rgrp, char *buf)
-{
-	struct gfs_rgrp *str = (struct gfs_rgrp *)buf;
-
-	gfs2_meta_header_out(&rgrp->rg_header, buf);
-	str->rg_flags = cpu_to_be32(rgrp->rg_flags);
-	str->rg_free = cpu_to_be32(rgrp->rg_free);
-	str->rg_useddi = cpu_to_be32(rgrp->rg_useddi);
-	str->rg_freedi = cpu_to_be32(rgrp->rg_freedi);
-	gfs2_inum_out(&rgrp->rg_freedi_list, (char *)&str->rg_freedi_list);
-	str->rg_usedmeta = cpu_to_be32(rgrp->rg_usedmeta);
-	str->rg_freemeta = cpu_to_be32(rgrp->rg_freemeta);
-}
-
-/* ------------------------------------------------------------------------ */
-/* gfs_rgrp_print - print a gfs1 resource group                             */
-/* ------------------------------------------------------------------------ */
-void gfs_rgrp_print(struct gfs_rgrp *rg)
-{
-	gfs2_meta_header_print(&rg->rg_header);
-	pv(rg, rg_flags, "%u", "0x%x");
-	pv(rg, rg_free, "%u", "0x%x");
-	pv(rg, rg_useddi, "%u", "0x%x");
-	pv(rg, rg_freedi, "%u", "0x%x");
-	gfs2_inum_print(&rg->rg_freedi_list);
-	pv(rg, rg_usedmeta, "%u", "0x%x");
-	pv(rg, rg_freemeta, "%u", "0x%x");
-}
-
-/* ------------------------------------------------------------------------ */
-/* get_rg_addr                                                              */
-/* ------------------------------------------------------------------------ */
-uint64_t get_rg_addr(int rgnum)
-{
-	struct gfs2_buffer_head *bh;
-	uint64_t rgblk = 0, block;
-	struct gfs2_inode *riinode;
-
-	if (gfs1)
-		block = sbd1->sb_rindex_di.no_addr;
-	else
-		block = masterblock("rindex");
-	bh = bread(&sbd.buf_list, block);
-	riinode = inode_get(&sbd, bh);
-	if (rgnum < riinode->i_di.di_size / risize())
-		rgblk = find_rgrp_block(riinode, rgnum);
-	else
-		fprintf(stderr, "Error: File system only has %lld RGs.\n",
-			(unsigned long long)riinode->i_di.di_size / risize());
-	inode_put(riinode, not_updated);
-	return rgblk;
-}
-
-/* ------------------------------------------------------------------------ */
-/* set_rgrp_flags - Set an rgrp's flags to a given value                    */
-/* rgnum: which rg to print or modify flags for (0 - X)                     */
-/* new_flags: value to set new rg_flags to (if modify == TRUE)              */
-/* modify: TRUE if the value is to be modified, FALSE if it's to be printed */
-/* full: TRUE if the full RG should be printed.                             */
-/* ------------------------------------------------------------------------ */
-void set_rgrp_flags(int rgnum, uint32_t new_flags, int modify, int full)
-{
-	union {
-		struct gfs2_rgrp rg2;
-		struct gfs_rgrp rg1;
-	} rg;
-	struct gfs2_buffer_head *bh;
-	uint64_t rgblk;
-
-	rgblk = get_rg_addr(rgnum);
-	bh = bread(&sbd.buf_list, rgblk);
-	if (gfs1)
-		gfs_rgrp_in(&rg.rg1, bh->b_data);
-	else
-		gfs2_rgrp_in(&rg.rg2, bh->b_data);
-	if (modify) {
-		printf("RG #%d (block %llu / 0x%llx) rg_flags changed from 0x%08x to 0x%08x\n",
-		       rgnum, (unsigned long long)rgblk,
-		       (unsigned long long)rgblk, rg.rg2.rg_flags, new_flags);
-		rg.rg2.rg_flags = new_flags;
-		if (gfs1)
-			gfs_rgrp_out(&rg.rg1, bh->b_data);
-		else
-			gfs2_rgrp_out(&rg.rg2, bh->b_data);
-		brelse(bh, updated);
-	} else {
-		if (full) {
-			print_gfs2("RG #%d", rgnum);
-			print_gfs2(" located at: %llu (0x%llx)", rgblk, rgblk);
-                        eol(0);
-			if (gfs1)
-				gfs_rgrp_print(&rg.rg1);
-			else
-				gfs2_rgrp_print(&rg.rg2);
-		}
-		else
-			printf("RG #%d (block %llu / 0x%llx) rg_flags = 0x%08x\n",
-			       rgnum, (unsigned long long)rgblk,
-			       (unsigned long long)rgblk, rg.rg2.rg_flags);
-		brelse(bh, not_updated);
-	}
-	if (modify)
-		bsync(&sbd.buf_list);
-}
-
-/* ------------------------------------------------------------------------ */
-/* parse_rindex - print the rgindex file.                                   */
-/* ------------------------------------------------------------------------ */
-int parse_rindex(struct gfs2_inode *di, int print_rindex)
-{
-	int error, start_line;
-	struct gfs2_rindex ri;
-	char buf[sizeof(struct gfs_rindex)];
-	char highlighted_addr[32];
-
-	start_line = line;
-	error = 0;
-	print_gfs2("RG index entries found: %d.", di->i_di.di_size / risize());
-	eol(0);
-	lines_per_row[dmode] = 6;
-	memset(highlighted_addr, 0, sizeof(highlighted_addr));
-	if (gfs1) {
-		/* gfs1 rindex files have the meta_header which is not
-		   accounted for in gfs2's dinode size.  Therefore, adjust. */
-		di->i_di.di_size += ((di->i_di.di_size / sbd.bsize) + 1) *
-			sizeof(struct gfs2_meta_header);
-	}
-	for (print_entry_ndx=0; ; print_entry_ndx++) {
-		uint64_t gfs1_adj = 0;
-		uint64_t offset = print_entry_ndx * risize();
-
-		if (gfs1) {
-			uint64_t sd_jbsize =
-				(sbd.bsize - sizeof(struct gfs2_meta_header));
-
-			gfs1_adj = (offset / sd_jbsize) *
-				sizeof(struct gfs2_meta_header);
-			gfs1_adj += sizeof(struct gfs2_meta_header);
-		}
-
-		error = gfs2_readi(di, (void *)&buf, offset + gfs1_adj,
-				   risize());
-		if (!error) /* end of file */
-			break;
-		gfs2_rindex_in(&ri, buf);
-		if (!termlines ||
-			(print_entry_ndx >= start_row[dmode] &&
-			 ((print_entry_ndx - start_row[dmode])+1) * lines_per_row[dmode] <=
-			 termlines - start_line - 2)) {
-			if (edit_row[dmode] == print_entry_ndx) {
-				COLORS_HIGHLIGHT;
-				sprintf(highlighted_addr, "%llx", (unsigned long long)ri.ri_addr);
-			}
-			print_gfs2("RG #%d", print_entry_ndx);
-			if (!print_rindex)
-				print_gfs2(" located at: %llu (0x%llx)",
-					   ri.ri_addr, ri.ri_addr);
-			eol(0);
-			if (edit_row[dmode] == print_entry_ndx)
-				COLORS_NORMAL;
-			if(print_rindex)
-				gfs2_rindex_print(&ri);
-			else {
-				struct gfs2_buffer_head *tmp_bh;
-
-				tmp_bh = bread(&sbd.nvbuf_list, ri.ri_addr);
-				if (gfs1) {
-					struct gfs_rgrp rg1;
-					gfs_rgrp_in(&rg1, tmp_bh->b_data);
-					gfs_rgrp_print(&rg1);
-				} else {
-					struct gfs2_rgrp rg;
-					gfs2_rgrp_in(&rg, tmp_bh->b_data);
-					gfs2_rgrp_print(&rg);
-				}
-				brelse(tmp_bh, not_updated);
-			}
-			last_entry_onscreen[dmode] = print_entry_ndx;
-		}
-	}
-	strcpy(estring, highlighted_addr);
-	end_row[dmode] = print_entry_ndx;
-	return error;
-}
-
-/* ------------------------------------------------------------------------ */
-/* gfs_jindex_in - read in a gfs1 jindex structure.                         */
-/* ------------------------------------------------------------------------ */
-void gfs_jindex_in(struct gfs_jindex *jindex, char *buf)
-{
-        struct gfs_jindex *str = (struct gfs_jindex *) buf;
-
-        jindex->ji_addr = be64_to_cpu(str->ji_addr);
-        jindex->ji_nsegment = be32_to_cpu(str->ji_nsegment);
-        jindex->ji_pad = be32_to_cpu(str->ji_pad);
-        memcpy(jindex->ji_reserved, str->ji_reserved, 64);
-}
-
-/* ------------------------------------------------------------------------ */
-/* gfs_jindex_print - print an jindex entry.                                */
-/* ------------------------------------------------------------------------ */
-void gfs_jindex_print(struct gfs_jindex *ji)
-{
-        pv(ji, ji_addr, "%llu", "0x%llx");
-        pv(ji, ji_nsegment, "%u", "0x%x");
-        pv(ji, ji_pad, "%u", "0x%x");
-}
-
-/* ------------------------------------------------------------------------ */
-/* print_jindex - print the jindex file.                                    */
-/* ------------------------------------------------------------------------ */
-int print_jindex(struct gfs2_inode *di)
-{
-	int error, start_line;
-	struct gfs_jindex ji;
-	char buf[sizeof(struct gfs_jindex)];
-
-	start_line = line;
-	error = 0;
-	print_gfs2("Journal index entries found: %d.",
-		   di->i_di.di_size / sizeof(struct gfs_jindex));
-	eol(0);
-	lines_per_row[dmode] = 4;
-	for (print_entry_ndx=0; ; print_entry_ndx++) {
-		error = gfs2_readi(di, (void *)&buf,
-				   print_entry_ndx*sizeof(struct gfs_jindex),
-				   sizeof(struct gfs_jindex));
-		gfs_jindex_in(&ji, buf);
-		if (!error) /* end of file */
-			break;
-		if (!termlines ||
-		    (print_entry_ndx >= start_row[dmode] &&
-		     ((print_entry_ndx - start_row[dmode])+1) *
-		     lines_per_row[dmode] <= termlines - start_line - 2)) {
-			if (edit_row[dmode] == print_entry_ndx) {
-				COLORS_HIGHLIGHT;
-				sprintf(estring, "%" PRIx64, ji.ji_addr);
-			}
-			print_gfs2("Journal #%d", print_entry_ndx);
-			eol(0);
-			if (edit_row[dmode] == print_entry_ndx)
-				COLORS_NORMAL;
-			gfs_jindex_print(&ji);
-			last_entry_onscreen[dmode] = print_entry_ndx;
-		}
-	}
-	end_row[dmode] = print_entry_ndx;
-	return error;
-}
-
-/* ------------------------------------------------------------------------ */
-/* print_inum - print the inum file.                                        */
-/* ------------------------------------------------------------------------ */
-int print_inum(struct gfs2_inode *di)
-{
-	uint64_t buf, inodenum;
-	int rc;
-	
-	rc = gfs2_readi(di, (void *)&buf, 0, sizeof(buf));
-	if (!rc) {
-		print_gfs2("The inum file is empty.");
-		eol(0);
-		return 0;
-	}
-	if (rc != sizeof(buf)) {
-		print_gfs2("Error reading inum file.");
-		eol(0);
-		return -1;
-	}
-	inodenum = be64_to_cpu(buf);
-	print_gfs2("Next inode num = %lld (0x%llx)", inodenum, inodenum);
-	eol(0);
-	return 0;
-}
-
-/* ------------------------------------------------------------------------ */
-/* print_statfs - print the statfs file.                                    */
-/* ------------------------------------------------------------------------ */
-int print_statfs(struct gfs2_inode *di)
-{
-	struct gfs2_statfs_change buf, sfc;
-	int rc;
-	
-	rc = gfs2_readi(di, (void *)&buf, 0, sizeof(buf));
-	if (!rc) {
-		print_gfs2("The statfs file is empty.");
-		eol(0);
-		return 0;
-	}
-	if (rc != sizeof(buf)) {
-		print_gfs2("Error reading statfs file.");
-		eol(0);
-		return -1;
-	}
-	gfs2_statfs_change_in(&sfc, (char *)&buf);
-	print_gfs2("statfs file contents:");
-	eol(0);
-	gfs2_statfs_change_print(&sfc);
-	return 0;
-}
-
-/* ------------------------------------------------------------------------ */
-/* print_quota - print the quota file.                                      */
-/* ------------------------------------------------------------------------ */
-int print_quota(struct gfs2_inode *di)
-{
-	struct gfs2_quota buf, q;
-	int i, error;
-	
-	print_gfs2("quota file contents:");
-	eol(0);
-	print_gfs2("quota entries found: %d.", di->i_di.di_size / sizeof(q));
-	eol(0);
-	for (i=0; ; i++) {
-		error = gfs2_readi(di, (void *)&buf, i * sizeof(q), sizeof(buf));
-		if (!error)
-			break;
-		if (error != sizeof(buf)) {
-			print_gfs2("Error reading quota file.");
-			eol(0);
-			return -1;
-		}
-		gfs2_quota_in(&q, (char *)&buf);
-		print_gfs2("Entry #%d", i + 1);
-		eol(0);
-		gfs2_quota_print(&q);
-	}
-	return 0;
-}
-
-/* ------------------------------------------------------------------------ */
-/* has_indirect_blocks                                                      */
-/* ------------------------------------------------------------------------ */
-int has_indirect_blocks(void)
-{
-	if (indirect_blocks || gfs2_struct_type == GFS2_METATYPE_SB ||
-	    gfs2_struct_type == GFS2_METATYPE_LF ||
-	    (gfs2_struct_type == GFS2_METATYPE_DI &&
-	     (S_ISDIR(di.di_mode) || (gfs1 && di.__pad1 == GFS_FILE_DIR))))
-		return TRUE;
-	return FALSE;
-}
-
-/* ------------------------------------------------------------------------ */
-/* print_inode_type                                                         */
-/* ------------------------------------------------------------------------ */
-void print_inode_type(__be16 de_type)
-{
-	switch(de_type) {
-	case DT_UNKNOWN:
-		print_gfs2("Unknown");
-		break;
-	case DT_REG:
-		print_gfs2("File   ");
-		break;
-	case DT_DIR:
-		print_gfs2("Dir    ");
-		break;
-	case DT_LNK:
-		print_gfs2("Symlink");
-		break;
-	case DT_BLK:
-		print_gfs2("BlkDev ");
-		break;
-	case DT_CHR:
-		print_gfs2("ChrDev ");
-		break;
-	case DT_FIFO:
-		print_gfs2("Fifo   ");
-		break;
-	case DT_SOCK:
-		print_gfs2("Socket ");
-		break;
-	default:
-		print_gfs2("%04x   ", de_type);
-		break;
-	}
-}
-
-/* ------------------------------------------------------------------------ */
-/* display_leaf - display directory leaf                                    */
-/* ------------------------------------------------------------------------ */
-int display_leaf(struct iinfo *ind)
-{
-	int start_line, total_dirents = 0;
-	int d;
-
-	eol(0);
-	if (gfs2_struct_type == GFS2_METATYPE_SB)
-		print_gfs2("The superblock has 2 directories");
-	else
-		print_gfs2("This directory contains %d directory entries.",
-			   ind->ii[0].dirents);
-
-	start_line = line;
-	for (d = 0; d < ind->ii[0].dirents; d++) {
-		if (termlines && d >= termlines - start_line - 1
-		    + start_row[dmode])
-			break;
-		total_dirents++;
-		if (ind->ii[0].dirents > 1) {
-			eol(5);
-			if (termlines) {
-				if (edit_row[dmode] >=0 &&
-				    line - start_line - 1 == 
-				    edit_row[dmode] -
-				    start_row[dmode]) {
-					COLORS_HIGHLIGHT;
-					sprintf(estring, "%"PRIx64,
-						ind->ii[0].dirent[d].block);
-					strcpy(edit_fmt, "%"PRIx64);
-				}
-			}
-			print_gfs2("%d. (%d). %lld (0x%llx) / %lld (0x%llx): ",
-				   total_dirents, d + 1,
-				   ind->ii[0].dirent[d].dirent.de_inum.no_formal_ino,
-				   ind->ii[0].dirent[d].dirent.de_inum.no_formal_ino,
-				   ind->ii[0].dirent[d].block,
-				   ind->ii[0].dirent[d].block);
-		}
-		print_inode_type(ind->ii[0].dirent[d].dirent.de_type);
-		print_gfs2(" %s", ind->ii[0].dirent[d].filename);
-		if (termlines) {
-			if (edit_row[dmode] >= 0 &&
-			    line - start_line - 1 == edit_row[dmode] -
-			    start_row[dmode])
-				COLORS_NORMAL;
-		}
-	}
-	if (line >= 4)
-		last_entry_onscreen[dmode] = line - 4;
-	eol(0);
-	end_row[dmode] = ind->ii[0].dirents;
-	if (end_row[dmode] < last_entry_onscreen[dmode])
-		end_row[dmode] = last_entry_onscreen[dmode];
-	return 0;
-}
-
-/* ------------------------------------------------------------------------ */
-/* display_indirect                                                         */
-/* ------------------------------------------------------------------------ */
-int display_indirect(struct iinfo *ind, int indblocks, int level, uint64_t startoff)
-{
-	int start_line, total_dirents;
-	int i, cur_height = -1, pndx;
-	uint64_t factor[5]={0,0,0,0,0};
-	int offsets[5];
-
-	last_entry_onscreen[dmode] = 0;
-	if (!level)
-		eol(0);
-	if (!has_indirect_blocks())
-		return -1;
-	if (!level) {
-		if (gfs2_struct_type == GFS2_METATYPE_DI) {
-			if (S_ISDIR(di.di_mode))
-				print_gfs2("This directory contains %d indirect blocks",
-					   indblocks);
-			else
-				print_gfs2("This inode contains %d indirect blocks",
-					   indblocks);
-		}
-		else
-			print_gfs2("This indirect block contains %d indirect blocks",
-				   indblocks);
-	}
-	eol(0);
-	total_dirents = 0;
-	/* Figure out multiplication factors for indirect pointers. */
-	if (!S_ISDIR(di.di_mode)) {
-		memset(&offsets, 0, sizeof(offsets));
-		/* See if we are on an inode or have one in history. */
-		cur_height = level;
-		if (!level && gfs2_struct_type != GFS2_METATYPE_DI) {
-			for (i = 0; i <= blockhist && i < 5; i++) {
-				offsets[i] = blockstack[(blockhist - i) % BLOCK_STACK_SIZE].edit_row[dmode];
-				if (blockstack[(blockhist - i) % BLOCK_STACK_SIZE].gfs2_struct_type == GFS2_METATYPE_DI)
-					break;
-				cur_height++;
-			}
-		}
-		if (cur_height >= 0) {
-			int diptrs, inptrs;
-
-			if (gfs1) {
-				diptrs = 483;
-				inptrs = 501;
-			} else {
-				diptrs = (sbd.bsize - sizeof(sizeof(struct gfs2_dinode))) / sizeof(uint64_t);
-				inptrs = (sbd.bsize - sizeof(sizeof(struct gfs2_meta_header))) /
-					sizeof(uint64_t);
-			}
-			/* Multiply out the max factor based on inode height.*/
-			/* This is how much data is represented by each      */
-			/* indirect pointer at each height.                  */
-			factor[0] = 1ull;
-			for (i = 0; i < di.di_height; i++)
-				factor[i + 1] = factor[i] * inptrs;
-		}
-		if (!level)
-			print_gfs2("  (at height=%d)", cur_height);
-		eol(0);
-	}
-	if (!level && indblocks) {
-		print_gfs2("Indirect blocks:");
-		eol(0);
-	}
-	start_line = line;
-	for (pndx = start_row[dmode];
-		 (!termlines || pndx < termlines - start_line - 1
-		  + start_row[dmode]) && pndx < indblocks;
-		 pndx++) {
-		uint64_t file_offset;
-
-		print_entry_ndx = pndx;
-		if (termlines) {
-			if (edit_row[dmode] >= 0 &&
-			    line - start_line ==
-			    edit_row[dmode] - start_row[dmode])
-				COLORS_HIGHLIGHT;
-			move(line, 1);
-		}
-		if (!termlines) {
-			int h;
-
-			for (h = 0; h < level; h++)
-				print_gfs2("   ");
-		}
-		print_gfs2("%d => ", pndx);
-		if (termlines)
-			move(line,9);
-		print_gfs2("0x%llx / %lld", ind->ii[pndx].block,
-			   ind->ii[pndx].block);
-		if (termlines) {
-			if (edit_row[dmode] >= 0 &&
-			    line - start_line ==
-			    edit_row[dmode] - start_row[dmode]) { 
-				sprintf(estring, "%"PRIx64,
-					ind->ii[print_entry_ndx].block);
-				strcpy(edit_fmt, "%"PRIx64);
-				edit_size[dmode] = strlen(estring);
-				COLORS_NORMAL;
-			}
-		}
-		if (!S_ISDIR(di.di_mode)) {
-			int hgt;
-			file_offset = startoff;
-			float human_off;
-			char h;
-
-			/* Now divide by how deep we are at the moment.      */
-			/* This is how much data is represented by each      */
-			/* indirect pointer for each height we've traversed. */
-			offsets[0] = pndx;
-			for (hgt = cur_height; hgt >= 0; hgt--)
-				file_offset += offsets[cur_height - hgt] *
-					factor[di.di_height - hgt - 1] * sbd.bsize;
-			print_gfs2("     ");
-			h = 'K';
-			human_off = (file_offset / 1024.0);
-			if (human_off > 1024.0) { h = 'M'; human_off /= 1024.0; }
-			if (human_off > 1024.0) { h = 'G'; human_off /= 1024.0; }
-			if (human_off > 1024.0) { h = 'T'; human_off /= 1024.0; }
-			if (human_off > 1024.0) { h = 'P'; human_off /= 1024.0; }
-			if (human_off > 1024.0) { h = 'E'; human_off /= 1024.0; }
-			print_gfs2("(data offset 0x%llx / %lld / %6.2f%c)",
-				   file_offset, file_offset, human_off, h);
-			print_gfs2("   ");
-		}
-		else
-			file_offset = 0;
-		if (!termlines && ((level + 1 < di.di_height) ||
-				   (S_ISDIR(di.di_mode) && !level))) {
-			struct iinfo *more_indir;
-			int more_ind;
-			char *tmpbuf;
-			
-			more_indir = malloc(sizeof(struct iinfo));
-			// FIXME: handle failed malloc
-			tmpbuf = malloc(sbd.bsize);
-			if (tmpbuf) {
-				do_lseek(sbd.device_fd,
-					 ind->ii[pndx].block * sbd.bsize);
-				do_read(sbd.device_fd, tmpbuf,
-					sbd.bsize); /* read in the desired block */
-				memset(more_indir, 0, sizeof(struct iinfo));
-				if (S_ISDIR(di.di_mode)) {
-					do_leaf_extended(tmpbuf, more_indir);
-					display_leaf(more_indir);
-				} else {
-					more_ind = do_indirect_extended(tmpbuf,
-									more_indir);
-					display_indirect(more_indir,
-							 more_ind, level + 1,
-							 file_offset);
-				}
-				free(tmpbuf);
-			}
-			free(more_indir);
-		}
-		print_entry_ndx = pndx; /* restore after recursion */
-		eol(0);
-	} /* for each display row */
-	if (line >= 7) /* 7 because it was bumped at the end */
-		last_entry_onscreen[dmode] = line - 7;
-	eol(0);
-	end_row[dmode] = indblocks;
-	if (end_row[dmode] < last_entry_onscreen[dmode])
-		end_row[dmode] = last_entry_onscreen[dmode];
-	lines_per_row[dmode] = 1;
-	return 0;
-}
-
-/* ------------------------------------------------------------------------ */
-/* block_is_rindex                                                          */
-/* ------------------------------------------------------------------------ */
-int block_is_rindex(void)
-{
-	if ((gfs1 && block == sbd1->sb_rindex_di.no_addr) ||
-	    (block == masterblock("rindex")))
-		return TRUE;
-	return FALSE;
-}
-
-/* ------------------------------------------------------------------------ */
-/* block_is_rglist - there's no such block as the rglist.  This is a        */
-/*                   special case meant to parse the rindex and follow the  */
-/*                   blocks to the real rgs.                                */
-/* ------------------------------------------------------------------------ */
-int block_is_rglist(void)
-{
-	if (block == RGLIST_DUMMY_BLOCK)
-		return TRUE;
-	return FALSE;
-}
-
-/* ------------------------------------------------------------------------ */
-/* block_is_jindex                                                          */
-/* ------------------------------------------------------------------------ */
-int block_is_jindex(void)
-{
-	if ((gfs1 && block == sbd1->sb_jindex_di.no_addr))
-		return TRUE;
-	return FALSE;
-}
-
-/* ------------------------------------------------------------------------ */
-/* block_is_inum_file                                                       */
-/* ------------------------------------------------------------------------ */
-int block_is_inum_file(void)
-{
-	if (!gfs1 && block == masterblock("inum"))
-		return TRUE;
-	return FALSE;
-}
-
-/* ------------------------------------------------------------------------ */
-/* block_is_statfs_file                                                     */
-/* ------------------------------------------------------------------------ */
-int block_is_statfs_file(void)
-{
-	if (gfs1 && block == gfs1_license_di.no_addr)
-		return TRUE;
-	if (!gfs1 && block == masterblock("statfs"))
-		return TRUE;
-	return FALSE;
-}
-
-/* ------------------------------------------------------------------------ */
-/* block_is_quota_file                                                      */
-/* ------------------------------------------------------------------------ */
-int block_is_quota_file(void)
-{
-	if (gfs1 && block == gfs1_quota_di.no_addr)
-		return TRUE;
-	if (!gfs1 && block == masterblock("quota"))
-		return TRUE;
-	return FALSE;
-}
-
-/* ------------------------------------------------------------------------ */
-/* block_has_extended_info                                                  */
-/* ------------------------------------------------------------------------ */
-int block_has_extended_info(void)
-{
-	if (has_indirect_blocks() ||
-	    block_is_rindex() ||
-	    block_is_rglist() ||
-	    block_is_jindex() ||
-	    block_is_inum_file() ||
-	    block_is_statfs_file() ||
-	    block_is_quota_file())
-		return TRUE;
-	return FALSE;
-}
-
-/* ------------------------------------------------------------------------ */
-/* display_extended                                                         */
-/* ------------------------------------------------------------------------ */
-int display_extended(void)
-{
-	struct gfs2_inode *tmp_inode;
-	struct gfs2_buffer_head *tmp_bh;
-
-	/* Display any indirect pointers that we have. */
-	if (block_is_rindex()) {
-		tmp_bh = bread(&sbd.buf_list, block);
-		tmp_inode = inode_get(&sbd, tmp_bh);
-		parse_rindex(tmp_inode, TRUE);
-		brelse(tmp_bh, not_updated);
-	}
-	else if (has_indirect_blocks() && !indirect_blocks &&
-		 !display_leaf(indirect))
-		return -1;
-	else if (display_indirect(indirect, indirect_blocks, 0, 0) == 0)
-		return -1;
-	else if (block_is_rglist()) {
-		if (gfs1)
-			tmp_bh = bread(&sbd.buf_list,
-				       sbd1->sb_rindex_di.no_addr);
-		else
-			tmp_bh = bread(&sbd.buf_list, masterblock("rindex"));
-		tmp_inode = inode_get(&sbd, tmp_bh);
-		parse_rindex(tmp_inode, FALSE);
-		brelse(tmp_bh, not_updated);
-	}
-	else if (block_is_jindex()) {
-		tmp_bh = bread(&sbd.buf_list, block);
-		tmp_inode = inode_get(&sbd, tmp_bh);
-		print_jindex(tmp_inode);
-		brelse(tmp_bh, not_updated);
-	}
-	else if (block_is_inum_file()) {
-		tmp_bh = bread(&sbd.buf_list, block);
-		tmp_inode = inode_get(&sbd, tmp_bh);
-		print_inum(tmp_inode);
-		brelse(tmp_bh, not_updated);
-	}
-	else if (block_is_statfs_file()) {
-		tmp_bh = bread(&sbd.buf_list, block);
-		tmp_inode = inode_get(&sbd, tmp_bh);
-		print_statfs(tmp_inode);
-		brelse(tmp_bh, not_updated);
-	}
-	else if (block_is_quota_file()) {
-		tmp_bh = bread(&sbd.buf_list, block);
-		tmp_inode = inode_get(&sbd, tmp_bh);
-		print_quota(tmp_inode);
-		brelse(tmp_bh, not_updated);
-	}
-	return 0;
-}
-
-/* ------------------------------------------------------------------------ */
-/* read_superblock - read the superblock                                    */
-/* ------------------------------------------------------------------------ */
-void read_superblock(int fd)
-{
-	sbd1 = (struct gfs_sb *)&sbd.sd_sb;
-	ioctl(fd, BLKFLSBUF, 0);
-	do_lseek(fd, 0x10 * 4096);
-	do_read(fd, buf, sbd.bsize); /* read in the desired block */
-	memset(&sbd, 0, sizeof(struct gfs2_sbd));
-	sbd.device_fd = fd;
-	sbd.bsize = GFS2_DEFAULT_BSIZE;
-	sbd.jsize = GFS2_DEFAULT_JSIZE;
-	sbd.rgsize = GFS2_DEFAULT_RGSIZE;
-	sbd.utsize = GFS2_DEFAULT_UTSIZE;
-	sbd.qcsize = GFS2_DEFAULT_QCSIZE;
-	sbd.time = time(NULL);
-	osi_list_init(&sbd.rglist);
-	init_buf_list(&sbd, &sbd.buf_list, 128 << 20);
-	init_buf_list(&sbd, &sbd.nvbuf_list, 0xffffffff);
-	compute_constants(&sbd);
-	gfs2_sb_in(&sbd.sd_sb, buf); /* parse it out into the sb structure */
-	/* Check to see if this is really gfs1 */
-	if (sbd1->sb_fs_format == GFS_FORMAT_FS &&
-		sbd1->sb_header.mh_type == GFS_METATYPE_SB &&
-		sbd1->sb_header.mh_format == GFS_FORMAT_SB &&
-		sbd1->sb_multihost_format == GFS_FORMAT_MULTI) {
-		struct gfs_sb *sbbuf = (struct gfs_sb *)buf;
-
-		gfs1 = TRUE;
-		gfs2_inum_in(&sbd1->sb_rindex_di, (void *)&sbbuf->sb_rindex_di);
-		gfs2_inum_in(&gfs1_quota_di, (void *)&sbbuf->sb_quota_di);
-		gfs2_inum_in(&gfs1_license_di, (void *)&sbbuf->sb_license_di);
-	}
-	else
-		gfs1 = FALSE;
-	sbd.bsize = sbd.sd_sb.sb_bsize;
-	if (!sbd.bsize)
-		sbd.bsize = GFS2_DEFAULT_BSIZE;
-	compute_constants(&sbd);
-	block = 0x10 * (GFS2_DEFAULT_BSIZE / sbd.bsize);
-}
-
-/* ------------------------------------------------------------------------ */
-/* read_master_dir - read the master directory                              */
-/* ------------------------------------------------------------------------ */
-void read_master_dir(void)
-{
-	ioctl(sbd.device_fd, BLKFLSBUF, 0);
-	do_lseek(sbd.device_fd, sbd.sd_sb.sb_master_dir.no_addr * sbd.bsize);
-	do_read(sbd.device_fd, buf, sbd.bsize); /* read in the desired block */
-	gfs2_dinode_in(&di, buf); /* parse disk inode into structure */
-	do_dinode_extended(&di, buf); /* get extended data, if any */
-	memcpy(&masterdir, &indirect[0], sizeof(struct indirect_info));
-}
-
-/* ------------------------------------------------------------------------ */
-/* display                                                                  */
-/* ------------------------------------------------------------------------ */
-int display(int identify_only)
-{
-	uint64_t blk;
-
-	if (block == RGLIST_DUMMY_BLOCK) {
-		if (gfs1)
-			blk = sbd1->sb_rindex_di.no_addr;
-		else
-			blk = masterblock("rindex");
-	} else
-		blk = block;
-	if (termlines) {
-		display_title_lines();
-		move(2,0);
-	}
-	if (block_in_mem != blk) { /* If we changed blocks from the last read */
-		dev_offset = blk * sbd.bsize;
-		ioctl(sbd.device_fd, BLKFLSBUF, 0);
-		do_lseek(sbd.device_fd, dev_offset);
-		do_read(sbd.device_fd, buf, sbd.bsize); /* read desired block */
-		block_in_mem = blk; /* remember which block is in memory */
-	}
-	line = 1;
-	gfs2_struct_type = display_block_type(buf, FALSE);
-	if (identify_only)
-		return 0;
-	indirect_blocks = 0;
-	lines_per_row[dmode] = 1;
-	if (gfs2_struct_type == GFS2_METATYPE_SB || blk == 0x10 * (4096 / sbd.bsize)) {
-		gfs2_sb_in(&sbd.sd_sb, buf); /* parse it out into the sb structure */
-		memset(indirect, 0, sizeof(indirect));
-		indirect->ii[0].block = sbd.sd_sb.sb_master_dir.no_addr;
-		indirect->ii[0].is_dir = TRUE;
-		indirect->ii[0].dirents = 2;
-
-		memcpy(&indirect->ii[0].dirent[0].filename, "root", 4);
-		indirect->ii[0].dirent[0].dirent.de_inum.no_formal_ino =
-			sbd.sd_sb.sb_root_dir.no_formal_ino;
-		indirect->ii[0].dirent[0].dirent.de_inum.no_addr =
-			sbd.sd_sb.sb_root_dir.no_addr;
-		indirect->ii[0].dirent[0].block = sbd.sd_sb.sb_root_dir.no_addr;
-		indirect->ii[0].dirent[0].dirent.de_type = DT_DIR;
-
-		memcpy(&indirect->ii[0].dirent[1].filename, "master", 7);
-		indirect->ii[0].dirent[1].dirent.de_inum.no_formal_ino = 
-			sbd.sd_sb.sb_master_dir.no_formal_ino;
-		indirect->ii[0].dirent[1].dirent.de_inum.no_addr =
-			sbd.sd_sb.sb_master_dir.no_addr;
-		indirect->ii[0].dirent[1].block = sbd.sd_sb.sb_master_dir.no_addr;
-		indirect->ii[0].dirent[1].dirent.de_type = DT_DIR;
-	}
-	else if (gfs2_struct_type == GFS2_METATYPE_DI) {
-		gfs2_dinode_in(&di, buf); /* parse disk inode into structure */
-		do_dinode_extended(&di, buf); /* get extended data, if any */
-	}
-	else if (gfs2_struct_type == GFS2_METATYPE_IN) { /* indirect block list */
-		do_indirect_extended(buf, indirect);
-		indirect_blocks = 1;
-	}
-	else if (gfs2_struct_type == GFS2_METATYPE_LF) { /* directory leaf */
-		do_leaf_extended(buf, indirect);
-	}
-	last_entry_onscreen[dmode] = 0;
-	if (dmode == EXTENDED_MODE && !block_has_extended_info())
-		dmode = HEX_MODE;
-	if (termlines) {
-		move(termlines, 63);
-		if (dmode==HEX_MODE)
-			printw("Mode: Hex %s", (editing?"edit ":"view "));
-		else
-			printw("Mode: %s", (dmode==GFS2_MODE?"Structure":
-					    "Pointers "));
-		move(line, 0);
-	}
-	if (dmode == HEX_MODE)          /* if hex display mode           */
-		hexdump(dev_offset, buf,
-			(gfs2_struct_type == GFS2_METATYPE_DI)?
-			struct_len + di.di_size:sbd.bsize);
-	else if (dmode == GFS2_MODE)    /* if structure display          */
-		display_gfs2();            /* display the gfs2 structure    */
-	else
-		display_extended();        /* display extended blocks       */
-	/* No else here because display_extended can switch back to hex mode */
-	if (termlines)
-		refresh();
-	return(0);
-}
-
-/* ------------------------------------------------------------------------ */
-/* push_block - push a block onto the block stack                           */
-/* ------------------------------------------------------------------------ */
-void push_block(uint64_t blk)
-{
-	int i, bhst;
-
-	bhst = blockhist % BLOCK_STACK_SIZE;
-	if (blk) {
-		blockstack[bhst].dmode = dmode;
-		for (i = 0; i < DMODES; i++) {
-			blockstack[bhst].start_row[i] = start_row[i];
-			blockstack[bhst].end_row[i] = end_row[i];
-			blockstack[bhst].edit_row[i] = edit_row[i];
-			blockstack[bhst].edit_col[i] = edit_col[i];
-			blockstack[bhst].lines_per_row[i] = lines_per_row[i];
-		}
-		blockstack[bhst].gfs2_struct_type = gfs2_struct_type;
-		blockhist++;
-		blockstack[blockhist % BLOCK_STACK_SIZE].block = blk;
-	}
-}
-
-/* ------------------------------------------------------------------------ */
-/* pop_block - pop a block off the block stack                              */
-/* ------------------------------------------------------------------------ */
-uint64_t pop_block(void)
-{
-	int i, bhst;
-
-	if (!blockhist)
-		return block;
-	blockhist--;
-	bhst = blockhist % BLOCK_STACK_SIZE;
-	dmode = blockstack[bhst].dmode;
-	for (i = 0; i < DMODES; i++) {
-		start_row[i] = blockstack[bhst].start_row[i];
-		end_row[i] = blockstack[bhst].end_row[i];
-		edit_row[i] = blockstack[bhst].edit_row[i];
-		edit_col[i] = blockstack[bhst].edit_col[i];
-		lines_per_row[i] = blockstack[bhst].lines_per_row[i];
-	}
-	gfs2_struct_type = blockstack[bhst].gfs2_struct_type;
-	return blockstack[bhst].block;
-}
-
-/* ------------------------------------------------------------------------ */
-/* find_journal_block - figure out where a journal starts, given the name   */
-/* Returns: journal block number, changes j_size to the journal size        */
-/* ------------------------------------------------------------------------ */
-uint64_t find_journal_block(const char *journal, uint64_t *j_size)
-{
-	int journal_num;
-	uint64_t jindex_block, jblock = 0;
-	int amtread;
-	struct gfs2_buffer_head *jindex_bh, *j_bh;
-	char jbuf[sbd.bsize];
-	struct gfs2_inode *j_inode = NULL;
-
-	journal_num = atoi(journal + 7);
-	/* Figure out the block of the jindex file */
-	if (gfs1)
-		jindex_block = sbd1->sb_jindex_di.no_addr;
-	else
-		jindex_block = masterblock("jindex");
-	/* read in the block */
-	jindex_bh = bread(&sbd.buf_list, jindex_block);
-	/* get the dinode data from it. */
-	gfs2_dinode_in(&di, jindex_bh->b_data); /* parse disk inode to struct*/
-
-	if (!gfs1)
-		do_dinode_extended(&di, jindex_bh->b_data); /* parse dir. */
-	brelse(jindex_bh, not_updated);
-
-	if (gfs1) {
-		struct gfs2_inode *jiinode;
-		struct gfs_jindex ji;
-
-		jiinode = inode_get(&sbd, jindex_bh);
-		amtread = gfs2_readi(jiinode, (void *)&jbuf,
-				   journal_num * sizeof(struct gfs_jindex),
-				   sizeof(struct gfs_jindex));
-		if (amtread) {
-			gfs_jindex_in(&ji, jbuf);
-			jblock = ji.ji_addr;
-			*j_size = ji.ji_nsegment * 0x10;
-		}
-	} else {
-		struct gfs2_dinode jdi;
-
-		jblock = indirect->ii[0].dirent[journal_num + 2].block;
-		j_bh = bread(&sbd.buf_list, jblock);
-		j_inode = inode_get(&sbd, j_bh);
-		gfs2_dinode_in(&jdi, j_bh->b_data);/* parse dinode to struct */
-		*j_size = jdi.di_size;
-		brelse(j_bh, not_updated);
-	}
-	return jblock;
-}
-
-/* ------------------------------------------------------------------------ */
-/* Check if the word is a keyword such as "sb" or "rindex"                  */
-/* Returns: block number if it is, else 0                                   */
-/* ------------------------------------------------------------------------ */
-uint64_t check_keywords(const char *kword)
-{
-	uint64_t blk = 0;
-
-	if (!strcmp(kword, "sb") ||!strcmp(kword, "superblock"))
-		blk = 0x10 * (4096 / sbd.bsize); /* superblock */
-	else if (!strcmp(kword, "root") || !strcmp(kword, "rootdir"))
-		blk = sbd.sd_sb.sb_root_dir.no_addr;
-	else if (!strcmp(kword, "master")) {
-		if (!gfs1)
-			blk = sbd.sd_sb.sb_master_dir.no_addr;
-		else
-			fprintf(stderr, "This is GFS1; there's no master directory.\n");
-	}
-	else if (!strcmp(kword, "jindex")) {
-		if (gfs1)
-			blk = sbd1->sb_jindex_di.no_addr;
-		else
-			blk = masterblock("jindex"); /* journal index */
-	}
-	else if (!gfs1 && !strcmp(kword, "per_node"))
-		blk = masterblock("per_node");
-	else if (!gfs1 && !strcmp(kword, "inum"))
-		blk = masterblock("inum");
-	else if (!strcmp(kword, "statfs")) {
-		if (gfs1)
-			blk = gfs1_license_di.no_addr;
-		else
-			blk = masterblock("statfs");
-	}
-	else if (!strcmp(kword, "rindex") || !strcmp(kword, "rgindex")) {
-		if (gfs1)
-			blk = sbd1->sb_rindex_di.no_addr;
-		else
-			blk = masterblock("rindex");
-	} else if (!strcmp(kword, "rgs")) {
-		blk = RGLIST_DUMMY_BLOCK;
-	} else if (!strcmp(kword, "quota")) {
-		if (gfs1)
-			blk = gfs1_quota_di.no_addr;
-		else
-			blk = masterblock("quota");
-	} else if (!strncmp(kword, "rg ", 3)) {
-		int rgnum = 0;
-
-		rgnum = atoi(kword + 3);
-		blk = get_rg_addr(rgnum);
-	} else if (!strncmp(kword, "journal", 7) && isdigit(kword[7])) {
-		uint64_t j_size;
-
-		blk = find_journal_block(kword, &j_size);
-	} else if (kword[0]=='0' && kword[1]=='x') /* hex addr */
-		sscanf(kword, "%"SCNx64, &blk);/* retrieve in hex */
-	else
-		sscanf(kword, "%" PRIu64, &blk); /* retrieve decimal */
-
-	return blk;
-}
-
-/* ------------------------------------------------------------------------ */
-/* goto_block - go to a desired block entered by the user                   */
-/* ------------------------------------------------------------------------ */
-uint64_t goto_block(void)
-{
-	char string[256];
-	int ch;
-
-	memset(string, 0, sizeof(string));
-	sprintf(string,"%"PRId64, block);
-	if (bobgets(string, 1, 7, 16, &ch)) {
-		if (isalnum(string[0]))
-			temp_blk = check_keywords(string);
-		else if (string[0] == '+') {
-			if (string[1] == '0' && string[2] == 'x')
-				sscanf(string, "%"SCNx64, &temp_blk);
-			else
-				sscanf(string, "%" PRIu64, &temp_blk);
-			temp_blk += block;
-		}
-		else if (string[0] == '-') {
-			if (string[1] == '0' && string[2] == 'x')
-				sscanf(string, "%"SCNx64, &temp_blk);
-			else
-				sscanf(string, "%" PRIu64, &temp_blk);
-			temp_blk -= block;
-		}
-
-		if (temp_blk == RGLIST_DUMMY_BLOCK || temp_blk < max_block) {
-			offset = 0;
-			block = temp_blk;
-			push_block(block);
-		}
-	}
-	return block;
-}
-
-/* ------------------------------------------------------------------------ */
-/* init_colors                                                              */
-/* ------------------------------------------------------------------------ */
-void init_colors()
-{
-
-	if (color_scheme) {
-		init_pair(COLOR_TITLE, COLOR_BLACK,  COLOR_CYAN);
-		init_pair(COLOR_NORMAL, COLOR_WHITE,  COLOR_BLACK);
-		init_pair(COLOR_INVERSE, COLOR_BLACK,  COLOR_WHITE);
-		init_pair(COLOR_SPECIAL, COLOR_RED,    COLOR_BLACK);
-		init_pair(COLOR_HIGHLIGHT, COLOR_GREEN, COLOR_BLACK);
-		init_pair(COLOR_OFFSETS, COLOR_CYAN,   COLOR_BLACK);
-		init_pair(COLOR_CONTENTS, COLOR_YELLOW, COLOR_BLACK);
-	}
-	else {
-		init_pair(COLOR_TITLE, COLOR_BLACK,  COLOR_CYAN);
-		init_pair(COLOR_NORMAL, COLOR_BLACK,  COLOR_WHITE);
-		init_pair(COLOR_INVERSE, COLOR_WHITE,  COLOR_BLACK);
-		init_pair(COLOR_SPECIAL, COLOR_RED,    COLOR_WHITE);
-		init_pair(COLOR_HIGHLIGHT, COLOR_MAGENTA, COLOR_WHITE);
-		init_pair(COLOR_OFFSETS, COLOR_CYAN,   COLOR_WHITE);
-		init_pair(COLOR_CONTENTS, COLOR_BLUE, COLOR_WHITE);
-	}
-}
-
-/* ------------------------------------------------------------------------ */
-/* hex_edit - Allow the user to edit the page by entering hex digits        */
-/* ------------------------------------------------------------------------ */
-void hex_edit(int *exitch)
-{
-	int left_off;
-	int ch;
-
-	left_off = ((block * sbd.bsize) < 0xffffffff) ? 9 : 17;
-	/* 8 and 16 char addresses on screen */
-	
-	if (bobgets(estring, edit_row[dmode] + 3,
-		    (edit_col[dmode] * 2) + (edit_col[dmode] / 4) + left_off,
-		    2, exitch)) {
-		if (strstr(edit_fmt,"X") || strstr(edit_fmt,"x")) {
-			int hexoffset;
-			int i, sl = strlen(estring);
-			
-			for (i = 0; i < sl; i+=2) {
-				hexoffset = (edit_row[dmode] * 16) +
-					edit_col[dmode] + (i / 2);
-				ch = 0x00;
-				if (isdigit(estring[i]))
-					ch = (estring[i] - '0') * 0x10;
-				else if (estring[i] >= 'a' &&
-					 estring[i] <= 'f')
-					ch = (estring[i]-'a' + 0x0a)*0x10;
-				else if (estring[i] >= 'A' &&
-					 estring[i] <= 'F')
-					ch = (estring[i] - 'A' + 0x0a) * 0x10;
-				if (isdigit(estring[i+1]))
-					ch += (estring[i+1] - '0');
-				else if (estring[i+1] >= 'a' &&
-					 estring[i+1] <= 'f')
-					ch += (estring[i+1] - 'a' + 0x0a);
-				else if (estring[i+1] >= 'A' &&
-					 estring[i+1] <= 'F')
-					ch += (estring[i+1] - 'A' + 0x0a);
-				buf[offset + hexoffset] = ch;
-			}
-			do_lseek(sbd.device_fd, dev_offset);
-			do_write(sbd.device_fd, buf, sbd.bsize);
-			fsync(sbd.device_fd);
-		}
-	}
-}
-
-/* ------------------------------------------------------------------------ */
-/* page up                                                                  */
-/* ------------------------------------------------------------------------ */
-void pageup(void)
-{
-	if (dmode == EXTENDED_MODE) {
-		int dsplines = termlines - 6;
-		
-		if (edit_row[dmode] - (dsplines / lines_per_row[dmode]) > 0) {
-			start_row[dmode] -= (dsplines / lines_per_row[dmode]);
-			edit_row[dmode] -= (dsplines / lines_per_row[dmode]);
-		}
-		else {
-			start_row[dmode] = 0;
-			edit_row[dmode] = 0;
-		}
-	}
-	else {
-		start_row[dmode] = edit_row[dmode] = 0;
-		if (dmode == GFS2_MODE || offset==0) {
-			block--;
-			if (dmode == HEX_MODE)
-				offset = (sbd.bsize % screen_chunk_size) > 0 ?
-					screen_chunk_size *
-					(sbd.bsize / screen_chunk_size) :
-					sbd.bsize - screen_chunk_size;
-			else
-				offset = 0;
-		}
-		else
-			offset -= screen_chunk_size;
-	}
-}
-
-/* ------------------------------------------------------------------------ */
-/* page down                                                                */
-/* ------------------------------------------------------------------------ */
-void pagedn(void)
-{
-	if (dmode == EXTENDED_MODE) {
-		int dsplines = termlines - 6;
-
-		if ((edit_row[dmode] + dsplines) / lines_per_row[dmode] + 1 <
-		    end_row[dmode]) {
-			start_row[dmode] += dsplines / lines_per_row[dmode];
-			edit_row[dmode] += dsplines / lines_per_row[dmode];
-		}
-		else
-			edit_row[dmode] = end_row[dmode] - 1;
-	}
-	else {
-		start_row[dmode] = edit_row[dmode] = 0;
-		if (dmode == GFS2_MODE ||
-		    offset + screen_chunk_size >= sbd.bsize) {
-			block++;
-			offset = 0;
-		}
-		else
-			offset += screen_chunk_size;
-	}
-}
-
-/* ------------------------------------------------------------------------ */
-/* jump - jump to the address the cursor is on                              */
-/* ------------------------------------------------------------------------ */
-void jump(void)
-{
-	if (dmode == HEX_MODE) {
-		unsigned int col2;
-		uint64_t *b;
-		
-		if (edit_row[dmode] >= 0) {
-			col2 = edit_col[dmode] & 0x08;/* thus 0-7->0, 8-15->8 */
-			b = (uint64_t *)&buf[edit_row[dmode]*16 + offset + col2];
-			temp_blk=be64_to_cpu(*b);
-		}
-	}
-	else
-		sscanf(estring, "%"SCNx64, &temp_blk);/* retrieve in hex */
-	if (temp_blk < max_block) { /* if the block number is valid */
-		int i;
-		
-		offset = 0;
-		block = temp_blk;
-		push_block(block);
-		for (i = 0; i < DMODES; i++) {
-			start_row[i] = end_row[i] = edit_row[i] = 0;
-			edit_col[i] = 0;
-		}
-	}
-}
-
-/* ------------------------------------------------------------------------ */
-/* interactive_mode - accept keystrokes from user and display structures    */
-/* ------------------------------------------------------------------------ */
-void interactive_mode(void)
-{
-	int ch, Quit;
-
-	if ((wind = initscr()) == NULL) {
-		fprintf(stderr, "Error: unable to initialize screen.");
-		eol(0);
-		exit(-1);
-	}
-
-	/* Do our initial screen stuff: */
-	signal(SIGWINCH, UpdateSize); /* handle the terminal resize signal */
-	UpdateSize(0); /* update screen size based on terminal settings */
-	clear(); /* don't use Erase */
-	start_color();
-	noecho();
-	keypad(stdscr, TRUE);
-	raw();
-	curs_set(0);
-	init_colors();
-	/* Accept keystrokes and act on them accordingly */
-	Quit = FALSE;
-	editing = FALSE;
-	while (!Quit) {
-		display(FALSE);
-		if (editing) {
-			if (edit_row[dmode] == -1)
-				block = goto_block();
-			else {
-				if (dmode == HEX_MODE)
-					hex_edit(&ch);
-				else if (dmode == GFS2_MODE)
-					bobgets(estring, edit_row[dmode]+4, 24,
-						edit_size[dmode], &ch);
-				else
-					bobgets(estring, edit_row[dmode]+6, 14,
-						edit_size[dmode], &ch);
-			}
-		}
-		else
-			while ((ch=getch()) == 0); // wait for input
-
-		switch (ch)
-		{
-		/* --------------------------------------------------------- */
-		/* escape or 'q' */
-		/* --------------------------------------------------------- */
-		case 0x1b:
-		case 0x03:
-		case 'q':
-			if (editing)
-				editing = FALSE;
-			else
-				Quit=TRUE;
-			break;
-		/* --------------------------------------------------------- */
-		/* home - return to the superblock                           */
-		/* --------------------------------------------------------- */
-		case KEY_HOME:
-			if (dmode == EXTENDED_MODE) {
-				start_row[dmode] = end_row[dmode] = 0;
-				edit_row[dmode] = 0;
-			}
-			else {
-				block = 0x10 * (4096 / sbd.bsize);
-				push_block(block);
-				offset = 0;
-			}
-			break;
-		/* --------------------------------------------------------- */
-		/* backspace - return to the previous block on the stack     */
-		/* --------------------------------------------------------- */
-		case KEY_BACKSPACE:
-		case 0x7f:
-			block = pop_block();
-			offset = 0;
-			break;
-		/* --------------------------------------------------------- */
-		/* space - go down the block stack (opposite of backspace)   */
-		/* --------------------------------------------------------- */
-		case ' ':
-			blockhist++;
-			block = blockstack[blockhist % BLOCK_STACK_SIZE].block;
-			offset = 0;
-			break;
-		/* --------------------------------------------------------- */
-		/* arrow up */
-		/* --------------------------------------------------------- */
-		case KEY_UP:
-			if (dmode == EXTENDED_MODE) {
-				if (edit_row[dmode] > 0)
-					edit_row[dmode]--;
-				if (edit_row[dmode] < start_row[dmode])
-					start_row[dmode] = edit_row[dmode];
-			}
-			else {
-				if (edit_row[dmode] >= 0)
-					edit_row[dmode]--;
-			}
-			break;
-		/* --------------------------------------------------------- */
-		/* arrow down */
-		/* --------------------------------------------------------- */
-		case KEY_DOWN:
-			if (dmode == EXTENDED_MODE) {
-				if (edit_row[dmode] + 1 < end_row[dmode]) {
-					if (edit_row[dmode] >= last_entry_onscreen[dmode])
-						start_row[dmode]++;
-					edit_row[dmode]++;
-				}
-			}
-			else {
-				if (edit_row[dmode] < last_entry_onscreen[dmode])
-					edit_row[dmode]++;
-			}
-			break;
-		/* --------------------------------------------------------- */
-		/* arrow left */
-		/* --------------------------------------------------------- */
-		case KEY_LEFT:
-			if (dmode == HEX_MODE) {
-				if (edit_col[dmode] > 0)
-					edit_col[dmode]--;
-				else
-					edit_col[dmode] = 15;
-			}
-			break;
-		/* --------------------------------------------------------- */
-		/* arrow right */
-		/* --------------------------------------------------------- */
-		case KEY_RIGHT:
-			if (dmode == HEX_MODE) {
-				if (edit_col[dmode] < 15)
-					edit_col[dmode]++;
-				else
-					edit_col[dmode] = 0;
-			}
-			break;
-		/* --------------------------------------------------------- */
-		/* m - change display mode key */
-		/* --------------------------------------------------------- */
-		case 'm':
-			dmode = ((dmode + 1) % DMODES);
-			break;
-		/* --------------------------------------------------------- */
-		/* J - Jump to highlighted block number */
-		/* --------------------------------------------------------- */
-		case 'j':
-			jump();
-			break;
-		/* --------------------------------------------------------- */
-		/* g - goto block */
-		/* --------------------------------------------------------- */
-		case 'g':
-			block = goto_block();
-			break;
-		/* --------------------------------------------------------- */
-		/* h - help key */
-		/* --------------------------------------------------------- */
-		case 'h':
-			print_usage();
-			break;
-		/* --------------------------------------------------------- */
-		/* e - change to extended mode */
-		/* --------------------------------------------------------- */
-		case 'e':
-			dmode = EXTENDED_MODE;
-			break;
-		/* --------------------------------------------------------- */
-		/* b - Back one 4K block */
-		/* --------------------------------------------------------- */
-		case 'b':
-			start_row[dmode] = end_row[dmode] = edit_row[dmode] = 0;
-			if (block > 0)
-				block--;
-			offset = 0;
-			break;
-		/* --------------------------------------------------------- */
-		/* c - Change color scheme */
-		/* --------------------------------------------------------- */
-		case 'c':
-			color_scheme = !color_scheme;
-			init_colors();
-			break;
-		/* --------------------------------------------------------- */
-		/* page up key */
-		/* --------------------------------------------------------- */
-		case 0x19:                    // ctrl-y for vt100
-		case KEY_PPAGE:		      // PgUp
-		case 0x15:                    // ctrl-u for vi compat.
-		case 0x02:                   // ctrl-b for less compat.
-			pageup();
-			break;
-		/* --------------------------------------------------------- */
-		/* end - Jump to the end of the list */
-		/* --------------------------------------------------------- */
-		case 0x168:
-			if (dmode == EXTENDED_MODE) {
-				int dsplines = termlines - 6;
-				int ents_per_screen = dsplines /
-					lines_per_row[dmode];
-
-				edit_row[dmode] = end_row[dmode] - 1;
-				if ((edit_row[dmode] - ents_per_screen)+1 > 0)
-					start_row[dmode] = edit_row[dmode] - 
-						ents_per_screen + 1;
-				else
-					start_row[dmode] = 0;
-			}
-			/* TODO: Make end key work for other display modes. */
-			break;
-		/* --------------------------------------------------------- */
-		/* f - Forward one 4K block */
-		/* --------------------------------------------------------- */
-		case 'f':
-			start_row[dmode]=end_row[dmode]=edit_row[dmode] = 0;
-			lines_per_row[dmode] = 1;
-			block++;
-			offset = 0;
-			break;
-		/* --------------------------------------------------------- */
-		/* page down key */
-		/* --------------------------------------------------------- */
-		case 0x16:                    // ctrl-v for vt100
-		case KEY_NPAGE:		      // PgDown
-		case 0x04:                    // ctrl-d for vi compat.
-			pagedn();
-			break;
-		/* --------------------------------------------------------- */
-		/* enter key - change a value */
-		/* --------------------------------------------------------- */
-		case(KEY_ENTER):
-		case('\n'):
-		case('\r'):
-			editing = !editing;
-			break;
-		default:
-			move(termlines - 1, 0);
-			printw("Keystroke not understood: 0x%03X",ch);
-			refresh();
-			sleep(1);
-			break;
-		} /* switch */
-	} /* while !Quit */
-
-    Erase();
-    refresh();
-    endwin();
-}/* interactive_mode */
-
-/* ------------------------------------------------------------------------ */
-/* gfs_log_header_in - read in a gfs1-style log header                      */
-/* ------------------------------------------------------------------------ */
-void gfs_log_header_in(struct gfs_log_header *head, char *buf)
-{
-	struct gfs_log_header *str = (struct gfs_log_header *) buf;
-
-	gfs2_meta_header_in(&head->lh_header, buf);
-
-	head->lh_flags = be32_to_cpu(str->lh_flags);
-	head->lh_pad = be32_to_cpu(str->lh_pad);
-
-	head->lh_first = be64_to_cpu(str->lh_first);
-	head->lh_sequence = be64_to_cpu(str->lh_sequence);
-
-	head->lh_tail = be64_to_cpu(str->lh_tail);
-	head->lh_last_dump = be64_to_cpu(str->lh_last_dump);
-
-	memcpy(head->lh_reserved, str->lh_reserved, 64);
-}
-
-
-/* ------------------------------------------------------------------------ */
-/* gfs_log_header_print - print a gfs1-style log header                     */
-/* ------------------------------------------------------------------------ */
-void gfs_log_header_print(struct gfs_log_header *lh)
-{
-	gfs2_meta_header_print(&lh->lh_header);
-	pv(lh, lh_flags, "%u", "0x%.8X");
-	pv(lh, lh_pad, "%u", "%x");
-	pv(lh, lh_first, "%llu", "%llx");
-	pv(lh, lh_sequence, "%llu", "%llx");
-	pv(lh, lh_tail, "%llu", "%llx");
-	pv(lh, lh_last_dump, "%llu", "%llx");
-}
-
-/* ------------------------------------------------------------------------ */
-/* print_ld_blocks - print all blocks given in a log descriptor             */
-/* returns: the number of block numbers it printed                          */
-/* ------------------------------------------------------------------------ */
-int print_ld_blocks(const uint64_t *b, const char *end, int start_line)
-{
-	int bcount = 0, i = 0;
-	static char str[256];
-
-	while (*b && (char *)b < end) {
-		if (!termlines ||
-		    (print_entry_ndx >= start_row[dmode] &&
-		     ((print_entry_ndx - start_row[dmode])+1) *
-		     lines_per_row[dmode] <= termlines - start_line - 2)) {
-			if (i && i % 4 == 0) {
-				eol(0);
-				print_gfs2("                    ");
-			}
-			i++;
-			sprintf(str, "0x%llx",
-				(unsigned long long)be64_to_cpu(*b));
-			print_gfs2("%-18.18s ", str);
-			bcount++;
-		}
-		b++;
-		if (gfs1)
-			b++;
-	}
-	eol(0);
-	return bcount;
-}
-
-/* ------------------------------------------------------------------------ */
-/* fsck_readi - same as libgfs2's gfs2_readi, but sets absolute block #     */
-/*              of the first bit of data read.                              */
-/* ------------------------------------------------------------------------ */
-int fsck_readi(struct gfs2_inode *ip, void *buf, uint64_t offset,
-	       unsigned int size, uint64_t *abs_block)
-{
-	struct gfs2_sbd *sdp = ip->i_sbd;
-	struct gfs2_buffer_head *bh;
-	uint64_t lblock, dblock;
-	unsigned int o;
-	uint32_t extlen = 0;
-	unsigned int amount;
-	int not_new = 0;
-	int isdir = !!(S_ISDIR(ip->i_di.di_mode));
-	int copied = 0;
-
-	*abs_block = 0;
-	if (offset >= ip->i_di.di_size)
-		return 0;
-	if ((offset + size) > ip->i_di.di_size)
-		size = ip->i_di.di_size - offset;
-	if (!size)
-		return 0;
-	if (isdir) {
-		lblock = offset;
-		o = do_div(lblock, sdp->sd_jbsize);
-	} else {
-		lblock = offset >> sdp->sd_sb.sb_bsize_shift;
-		o = offset & (sdp->bsize - 1);
-	}
-
-	if (!ip->i_di.di_height) /* inode_is_stuffed */
-		o += sizeof(struct gfs2_dinode);
-	else if (isdir)
-		o += sizeof(struct gfs2_meta_header);
-
-	while (copied < size) {
-		amount = size - copied;
-		if (amount > sdp->bsize - o)
-			amount = sdp->bsize - o;
-		if (!extlen)
-			block_map(ip, lblock, &not_new, &dblock, &extlen,
-				  FALSE, not_updated);
-		if (dblock) {
-			bh = bread(&sdp->buf_list, dblock);
-			if (*abs_block == 0)
-				*abs_block = bh->b_blocknr;
-			dblock++;
-			extlen--;
-		} else
-			bh = NULL;
-		if (bh) {
-			memcpy(buf, bh->b_data + o, amount);
-			brelse(bh, not_updated);
-		} else {
-			memset(buf, 0, amount);
-		}
-		copied += amount;
-		lblock++;
-		o = (isdir) ? sizeof(struct gfs2_meta_header) : 0;
-	}
-	return copied;
-}
-
-void check_journal_wrap(uint64_t seq, uint64_t *highest_seq)
-{
-	if (seq < *highest_seq) {
-		print_gfs2("------------------------------------------------"
-			   "------------------------------------------------");
-		eol(0);
-		print_gfs2("Journal wrapped here.");
-		eol(0);
-		print_gfs2("------------------------------------------------"
-			   "------------------------------------------------");
-		eol(0);
-	}
-	*highest_seq = seq;
-}
-
-/* ------------------------------------------------------------------------ */
-/* dump_journal - dump a journal file's contents.                           */
-/* ------------------------------------------------------------------------ */
-void dump_journal(const char *journal)
-{
-	struct gfs2_buffer_head *j_bh = NULL;
-	uint64_t jblock, j_size, jb, abs_block;
-	int error, start_line, journal_num;
-	char jbuf[sbd.bsize];
-	struct gfs2_inode *j_inode = NULL;
-	int ld_blocks = 0;
-	uint64_t highest_seq = 0;
-
-	start_line = line;
-	lines_per_row[dmode] = 1;
-	error = 0;
-	journal_num = atoi(journal + 7);
-	print_gfs2("Dumping journal #%d.", journal_num);
-	eol(0);
-	jblock = find_journal_block(journal, &j_size);
-	if (!jblock)
-		return;
-	if (!gfs1) {
-		j_bh = bread(&sbd.buf_list, jblock);
-		j_inode = inode_get(&sbd, j_bh);
-	}
-
-	for (jb = 0; jb < j_size; jb += (gfs1 ? 1:sbd.bsize)) {
-		if (gfs1) {
-			if (j_bh)
-				brelse(j_bh, not_updated);
-			j_bh = bread(&sbd.buf_list, jblock + jb);
-			abs_block = jblock + jb;
-			memcpy(jbuf, j_bh->b_data, sbd.bsize);
-		} else {
-			error = fsck_readi(j_inode, (void *)&jbuf, jb,
-					   sbd.bsize, &abs_block);
-			if (!error) /* end of file */
-				break;
-		}
-		if (get_block_type(jbuf) == GFS2_METATYPE_LD) {
-			uint64_t *b;
-			struct gfs2_log_descriptor ld;
-			int ltndx;
-			uint32_t logtypes[2][6] = {
-				{GFS2_LOG_DESC_METADATA,
-				 GFS2_LOG_DESC_REVOKE,
-				 GFS2_LOG_DESC_JDATA,
-				 0, 0, 0},
-				{GFS_LOG_DESC_METADATA,
-				 GFS_LOG_DESC_IUL,
-				 GFS_LOG_DESC_IDA,
-				 GFS_LOG_DESC_Q,
-				 GFS_LOG_DESC_LAST,
-				 0}};
-			const char *logtypestr[2][6] = {
-				{"Metadata", "Revoke", "Jdata",
-				 "Unknown", "Unknown", "Unknown"},
-				{"Metadata", "Unlinked inode", "Dealloc inode",
-				 "Quota", "Final Entry", "Unknown"}};
-
-			print_gfs2("0x%llx (j+%4llx): Log descriptor, ",
-				   abs_block, jb / (gfs1 ? 1 : sbd.bsize));
-			gfs2_log_descriptor_in(&ld, jbuf);
-			print_gfs2("type %d ", ld.ld_type);
-
-			for (ltndx = 0;; ltndx++) {
-				if (ld.ld_type == logtypes[gfs1][ltndx] ||
-				    logtypes[gfs1][ltndx] == 0)
-					break;
-			}
-			print_gfs2("(%s) ", logtypestr[gfs1][ltndx]);
-			print_gfs2("len:%u, data1: %u",
-				   ld.ld_length, ld.ld_data1);
-			eol(0);
-			print_gfs2("                    ");
-			if (gfs1)
-				b = (uint64_t *)(jbuf +
-					sizeof(struct gfs_log_descriptor));
-			else
-				b = (uint64_t *)(jbuf +
-					sizeof(struct gfs2_log_descriptor));
-			ld_blocks = ld.ld_data1;
-			ld_blocks -= print_ld_blocks(b, (jbuf + sbd.bsize),
-						     start_line);
-		} else if (get_block_type(jbuf) == GFS2_METATYPE_LH) {
-			struct gfs2_log_header lh;
-			struct gfs_log_header lh1;
-
-			if (gfs1) {
-				gfs_log_header_in(&lh1, jbuf);
-				check_journal_wrap(lh1.lh_sequence,
-						   &highest_seq);
-				print_gfs2("0x%llx (j+%4llx): Log header: "
-					   "Flags:%x, Seq: 0x%x, "
-					   "1st: 0x%x, tail: 0x%x, "
-					   "last: 0x%x", abs_block,
-					   jb, lh1.lh_flags, lh1.lh_sequence,
-					   lh1.lh_first, lh1.lh_tail,
-					   lh1.lh_last_dump);
-			} else {
-				gfs2_log_header_in(&lh, jbuf);
-				check_journal_wrap(lh.lh_sequence,
-						   &highest_seq);
-				print_gfs2("0x%llx (j+%4llx): Log header: Seq"
-					   ": 0x%x, tail: 0x%x, blk: 0x%x",
-					   abs_block,
-					   jb / sbd.bsize, lh.lh_sequence,
-					   lh.lh_tail, lh.lh_blkno);
-			}
-			eol(0);
-		} else if (gfs1 && ld_blocks > 0) {
-			print_gfs2("0x%llx (j+%4llx): GFS log descriptor"
-				   " continuation block", abs_block, jb);
-			eol(0);
-			print_gfs2("                    ");
-			ld_blocks -= print_ld_blocks((uint64_t *)jbuf,
-						     (jbuf + sbd.bsize),
-						     start_line);
-		}
-	}
-	brelse(j_bh, not_updated);
-	blockhist = -1; /* So we don't print anything else */
-}
-
-/* ------------------------------------------------------------------------ */
-/* usage - print command line usage                                         */
-/* ------------------------------------------------------------------------ */
-void usage(void)
-{
-	fprintf(stderr,"\nFormat is: gfs2_edit [-c 1] [-V] [-x] [-h] [identify] [-p structures|blocks] /dev/device\n\n");
-	fprintf(stderr,"If only the device is specified, it enters into hexedit mode.\n");
-	fprintf(stderr,"identify - prints out only the block type, not the details.\n");
-	fprintf(stderr,"printsavedmeta - prints out the saved metadata blocks from a savemeta file.\n");
-	fprintf(stderr,"savemeta <file_system> <file> - save off your metadata for analysis and debugging.\n");
-	fprintf(stderr,"   (The intelligent way: assume bitmap is correct).\n");
-	fprintf(stderr,"savemetaslow - save off your metadata for analysis and debugging.  The SLOW way (block by block).\n");
-	fprintf(stderr,"savergs - save off only the resource group information (rindex and rgs).\n");
-	fprintf(stderr,"restoremeta - restore metadata for debugging (DANGEROUS).\n");
-	fprintf(stderr,"rgcount - print how many RGs in the file system.\n");
-	fprintf(stderr,"rgflags rgnum [new flags] - print or modify flags for rg #rgnum (0 - X)\n");
-	fprintf(stderr,"-V   prints version number.\n");
-	fprintf(stderr,"-c 1 selects alternate color scheme 1\n");
-	fprintf(stderr,"-p   prints GFS2 structures or blocks to stdout.\n");
-	fprintf(stderr,"     sb - prints the superblock.\n");
-	fprintf(stderr,"     size - prints the filesystem size.\n");
-	fprintf(stderr,"     master - prints the master directory.\n");
-	fprintf(stderr,"     root - prints the root directory.\n");
-	fprintf(stderr,"     jindex - prints the journal index directory.\n");
-	fprintf(stderr,"     per_node - prints the per_node directory.\n");
-	fprintf(stderr,"     inum - prints the inum file.\n");
-	fprintf(stderr,"     statfs - prints the statfs file.\n");
-	fprintf(stderr,"     rindex - prints the rindex file.\n");
-	fprintf(stderr,"     rg X - print resource group X.\n");
-	fprintf(stderr,"     rgs - prints all the resource groups (rgs).\n");
-	fprintf(stderr,"     quota - prints the quota file.\n");
-	fprintf(stderr,"-s   specifies a starting block such as root, rindex, quota, inum.\n");
-	fprintf(stderr,"-x   print in hexmode.\n");
-	fprintf(stderr,"-h   prints this help.\n\n");
-	fprintf(stderr,"Examples:\n");
-	fprintf(stderr,"   To run in interactive mode:\n");
-	fprintf(stderr,"     gfs2_edit /dev/bobs_vg/lvol0\n");
-	fprintf(stderr,"   To print out the superblock and master directory:\n");
-	fprintf(stderr,"     gfs2_edit -p sb master /dev/bobs_vg/lvol0\n");
-	fprintf(stderr,"   To print out the master directory in hex:\n");
-	fprintf(stderr,"     gfs2_edit -x -p master /dev/bobs_vg/lvol0\n");
-	fprintf(stderr,"   To print out the block-type for block 0x27381:\n");
-	fprintf(stderr,"     gfs2_edit identify -p 0x27381 /dev/bobs_vg/lvol0\n");
-	fprintf(stderr,"   To print out the fourth Resource Group. (the first R is #0)\n");
-	fprintf(stderr,"     gfs2_edit -p rg 3 /dev/sdb1\n");
-	fprintf(stderr,"   To set the Resource Group flags for rg #7 to 3.\n");
-	fprintf(stderr,"     gfs2_edit rgflags 7 3 /dev/sdc2\n");
-	fprintf(stderr,"   To save off all metadata for /dev/vg/lv:\n");
-	fprintf(stderr,"     gfs2_edit savemeta /dev/vg/lv /tmp/metasave\n");
-}/* usage */
-
-/* ------------------------------------------------------------------------ */
-/* process_parameters - process commandline parameters                      */
-/* pass - we make two passes through the parameters; the first pass gathers */
-/*        normals parameters, device name, etc.  The second pass is for     */
-/*        figuring out what structures to print out.                        */
-/* ------------------------------------------------------------------------ */
-void process_parameters(int argc, char *argv[], int pass)
-{
-	int i;
-
-	if (argc < 2) {
-		usage();
-		die("no device specified\n");
-	}
-	for (i = 1; i < argc; i++) {
-		if (!pass) {
-			if (!strcasecmp(argv[i], "-V")) {
-				printf("%s version %s (built %s %s)\n", prog_name,
-					   RELEASE_VERSION, __DATE__, __TIME__);
-				printf("%s\n", REDHAT_COPYRIGHT);
-				exit(0);
-			}
-			else if (!strcasecmp(argv[i], "-h") ||
-					 !strcasecmp(argv[i], "-help") ||
-					 !strcasecmp(argv[i], "-usage")) {
-				usage();
-				exit(0);
-			}
-			else if (!strcasecmp(argv[i], "-c")) {
-				i++;
-				color_scheme = atoi(argv[i]);
-			}
-			else if (!strcasecmp(argv[i], "-p") ||
-					 !strcasecmp(argv[i], "-print")) {
-				termlines = 0; /* initial value--we'll figure it out later */
-				dmode = GFS2_MODE;
-			}
-			else if (!strcasecmp(argv[i], "savemeta"))
-				termlines = 0;
-			else if (!strcasecmp(argv[i], "savemetaslow"))
-				termlines = 0;
-			else if (!strcasecmp(argv[i], "savergs"))
-				termlines = 0;
-			else if (!strcasecmp(argv[i], "printsavedmeta"))
-				restoremeta(argv[i+1], argv[i+2],
-					    TRUE);
-			else if (!strcasecmp(argv[i], "restoremeta"))
-				restoremeta(argv[i+1], argv[i+2], FALSE);
-			else if (!strcmp(argv[i], "rgcount"))
-				termlines = 0;
-			else if (!strcmp(argv[i], "rgflags"))
-				termlines = 0;
-			else if (!strcmp(argv[i], "rg"))
-				termlines = 0;
-			else if (!device[0] && strchr(argv[i],'/'))
-				strcpy(device, argv[i]);
-		}
-		else { /* second pass */
-			if (!strcasecmp(argv[i], "-s")) {
-				i++;
-				if (i >= argc - 1) {
-					printf("Error: starting block not specified with -s.\n");
-					printf("%s -s [starting block | keyword] <device>\n",
-					       argv[0]);
-					printf("For example: %s -s \"rg 3\" /dev/exxon_vg/exxon_lv\n",
-					       argv[0]);
-					exit(EXIT_FAILURE);
-				}
-				starting_blk = check_keywords(argv[i]);
-			}
-			else if (!termlines && !strchr(argv[i],'/')) { /* if print, no slash */
-				uint64_t keyword_blk;
-
-				if (!strncmp(argv[i], "journal", 7) &&
-				    isdigit(argv[i][7])) {
-					dump_journal(argv[i]);
-					continue;
-				}
-				keyword_blk = check_keywords(argv[i]);
-				if (keyword_blk) {
-					push_block(keyword_blk);
-				}
-				else if (!strcasecmp(argv[i], "-x"))
-					dmode = HEX_MODE;
-				else if (argv[i][0] == '-') /* if it starts with a dash */
-					; /* ignore it--meant for pass == 0 */
-				else if (!strcmp(argv[i], "identify"))
-					identify = TRUE;
-				else if (!strcmp(argv[i], "size"))
-					printf("Device size: %" PRIu64 " (0x%" PRIx64 ")\n",
-						   max_block, max_block);
-				else if (!strcmp(argv[i], "rgcount"))
-					rgcount();
-				else if (!strcmp(argv[i], "rgflags")) {
-					int rg, set = FALSE;
-					uint32_t new_flags = 0;
-					
-					i++;
-					if (i >= argc - 1) {
-						printf("Error: rg # not specified.\n");
-						printf("Format is: %s rgflags rgnum"
-						       "[newvalue]\n",
-						       argv[0]);
-						exit(EXIT_FAILURE);
-					}
-					if (argv[i][0]=='0' && argv[i][1]=='x')
-						sscanf(argv[i], "%"SCNx32,
-						       &rg);
-					else
-						rg = atoi(argv[i]);
-					i++;
-					if (i < argc - 1 &&
-					    isdigit(argv[i][0])) {
-						set = TRUE;
-						if (argv[i][0]=='0' &&
-						    argv[i][1]=='x')
-							sscanf(argv[i],
-							       "%"SCNx32,
-							       &new_flags);
-						else
-							new_flags =
-								atoi(argv[i]);
-					}
-					set_rgrp_flags(rg, new_flags, set,
-						       FALSE);
-					exit(EXIT_SUCCESS);
-				}
-				else if (!strcmp(argv[i], "rg")) {
-					int rg;
-					
-					i++;
-					if (i >= argc - 1) {
-						printf("Error: rg # not specified.\n");
-						printf("Format is: %s rg rgnum"
-						       "\n", argv[0]);
-						exit(EXIT_FAILURE);
-					}
-					rg = atoi(argv[i]);
-					i++;
-					set_rgrp_flags(rg, 0, FALSE, TRUE);
-					exit(EXIT_SUCCESS);
-				}
-				else if (!strcasecmp(argv[i], "savemeta"))
-					savemeta(argv[i+2], 0);
-				else if (!strcasecmp(argv[i], "savemetaslow"))
-					savemeta(argv[i+2], 1);
-				else if (!strcasecmp(argv[i], "savergs"))
-					savemeta(argv[i+2], 2);
-				else if (isdigit(argv[i][0])) { /* decimal addr */
-					sscanf(argv[i], "%"SCNd64, &temp_blk);
-					push_block(temp_blk);
-				}
-				else {
-					fprintf(stderr,"I don't know what '%s' means.\n", argv[i]);
-					usage();
-					exit(-1);
-				}
-			}
-		}
-	} /* for */
-}/* process_parameters */
-
-/******************************************************************************
-*******************************************************************************
-**
-** main()
-**
-** Description:
-**   Do everything
-**
-*******************************************************************************
-******************************************************************************/
-int main(int argc, char *argv[])
-{
-	int i, j, fd;
-
-	prog_name = argv[0];
-
-	indirect = malloc(sizeof(struct iinfo));
-	if (!indirect)
-		die("Out of memory.");
-	memset(indirect, 0, sizeof(struct iinfo));
-	memset(start_row, 0, sizeof(start_row));
-	memset(lines_per_row, 0, sizeof(lines_per_row));
-	memset(end_row, 0, sizeof(end_row));
-	memset(edit_row, 0, sizeof(edit_row));
-	memset(edit_col, 0, sizeof(edit_col));
-	memset(edit_size, 0, sizeof(edit_size));
-	memset(last_entry_onscreen, 0, sizeof(last_entry_onscreen));
-	dmode = HEX_MODE;
-	sbd.bsize = 4096;
-	type_alloc(buf, char, sbd.bsize); /* allocate/malloc a new 4K buffer */
-	block = starting_blk = 0x10;
-	for (i = 0; i < BLOCK_STACK_SIZE; i++) {
-		blockstack[i].dmode = dmode;
-		blockstack[i].block = block;
-		for (j = 0; j < DMODES; j++) {
-			blockstack[i].start_row[j] = 0;
-			blockstack[i].end_row[j] = 0;
-			blockstack[i].edit_row[j] = 0;
-			blockstack[i].edit_col[j] = 0;
-			blockstack[i].lines_per_row[j] = 0;
-		}
-	}
-
-	edit_row[GFS2_MODE] = 10; /* Start off at root inode
-				     pointer in superblock */
-	memset(device, 0, sizeof(device));
-	termlines = 30;  /* assume interactive mode until we find -p */
-	process_parameters(argc, argv, 0);
-
-	fd = open(device, O_RDWR);
-	if (fd < 0)
-		die("can't open %s: %s\n", device, strerror(errno));
-	max_block = lseek(fd, 0, SEEK_END) / sbd.bsize;
-
-	read_superblock(fd);
-	max_block = lseek(fd, 0, SEEK_END) / sbd.bsize;
-	strcpy(sbd.device_name, device);
-	if (!gfs1)
-		read_master_dir();
-	block_in_mem = -1;
-	process_parameters(argc, argv, 1); /* get what to print from cmdline */
-
-	block = blockstack[0].block = starting_blk * (4096 / sbd.bsize);
-
-	if (termlines)
-		interactive_mode();
-	else { /* print all the structures requested */
-		for (i = 0; i <= blockhist; i++) {
-			block = blockstack[i + 1].block;
-			if (!block)
-				break;
-			display(identify);
-			if (!identify) {
-				display_extended();
-				printf("-------------------------------------" \
-				       "-----------------");
-				eol(0);
-			}
-			block = pop_block();
-		}
-	}
-	close(fd);
-	if (buf)
-		free(buf);
-	if (indirect)
-		free(indirect);
- 	exit(EXIT_SUCCESS);
-}
diff --git a/gfs2/edit/hexedit.h b/gfs2/edit/hexedit.h
deleted file mode 100644
index a3c0830..0000000
--- a/gfs2/edit/hexedit.h
+++ /dev/null
@@ -1,324 +0,0 @@
-#ifndef __HEXVIEW_DOT_H__
-#define __HEXVIEW_DOT_H__
-
-#include "linux_endian.h"
-#include <sys/types.h>
-#include <inttypes.h>
-#include <limits.h>
-#include <linux/gfs2_ondisk.h>
-#include <string.h>
-
-#include "libgfs2.h"
-#include "copyright.cf"
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-/*  Extern Macro  */
-
-#ifndef EXTERN
-#define EXTERN extern
-#define INIT(X)
-#else
-#undef EXTERN
-#define EXTERN
-#define INIT(X) =X 
-#endif
-
-#define DMODES 3
-enum dsp_mode { HEX_MODE = 0, GFS2_MODE = 1, EXTENDED_MODE = 2 };
-#define BLOCK_STACK_SIZE 256
-
-#define GFS_FORMAT_SB           (100)  /* Super-Block */
-#define GFS_METATYPE_SB         (1)    /* Super-Block */
-#define GFS_FORMAT_FS           (1309) /* Filesystem (all-encompassing) */
-#define GFS_FORMAT_MULTI        (1401) /* Multi-Host */
-/* GFS1 Dinode types  */
-#define GFS_FILE_NON            (0)
-#define GFS_FILE_REG            (1)    /* regular file */
-#define GFS_FILE_DIR            (2)    /* directory */
-#define GFS_FILE_LNK            (5)    /* link */
-#define GFS_FILE_BLK            (7)    /* block device node */
-#define GFS_FILE_CHR            (8)    /* character device node */
-#define GFS_FILE_FIFO           (101)  /* fifo/pipe */
-#define GFS_FILE_SOCK           (102)  /* socket */
-
-/* GFS 1 journal block types: */
-#define GFS_LOG_DESC_METADATA   (300)    /* metadata */
-#define GFS_LOG_DESC_IUL        (400)    /* unlinked inode */
-#define GFS_LOG_DESC_IDA        (401)    /* de-allocated inode */
-#define GFS_LOG_DESC_Q          (402)    /* quota */
-#define GFS_LOG_DESC_LAST       (500)    /* final in a logged transaction */
-
-EXTERN char *prog_name;
-EXTERN uint64_t block INIT(0);
-EXTERN int blockhist INIT(0);
-EXTERN int edit_mode INIT(0);
-EXTERN int line;
-EXTERN char edit_fmt[80];
-EXTERN char estring[1024]; /* edit string */
-EXTERN uint64_t dev_offset INIT(0);
-EXTERN uint64_t max_block INIT(0);
-EXTERN char *buf INIT(NULL);
-EXTERN int termlines INIT(30);
-EXTERN int termcols INIT(80);
-EXTERN int insert INIT(0);
-EXTERN const char *termtype;
-EXTERN int line INIT(1);
-EXTERN int struct_len INIT(0);
-EXTERN unsigned int offset;
-EXTERN int edit_row[DMODES], edit_col[DMODES], print_entry_ndx;
-EXTERN int start_row[DMODES], end_row[DMODES], lines_per_row[DMODES];
-EXTERN int edit_size[DMODES], last_entry_onscreen[DMODES];
-EXTERN char edit_fmt[80];
-EXTERN struct gfs2_sbd sbd;
-EXTERN struct gfs_sb *sbd1;
-EXTERN struct gfs2_inum gfs1_quota_di;   /* kludge because gfs2 sb too small */
-EXTERN struct gfs2_inum gfs1_license_di; /* kludge because gfs2 sb too small */
-EXTERN struct gfs2_dinode di;
-EXTERN int screen_chunk_size INIT(512); /* how much of the 4K can fit on screen */
-EXTERN int gfs2_struct_type;
-EXTERN uint64_t block_in_mem INIT(-1);
-EXTERN char device[NAME_MAX];
-EXTERN int identify INIT(FALSE);
-EXTERN int color_scheme INIT(0);
-EXTERN WINDOW *wind;
-EXTERN int gfs1 INIT(0);
-EXTERN int editing INIT(0);
-EXTERN uint64_t temp_blk;
-EXTERN uint64_t starting_blk;
-
-struct gfs_jindex {
-        uint64_t ji_addr;       /* starting block of the journal */
-        uint32_t ji_nsegment;   /* number (quantity) of segments in journal */
-        uint32_t ji_pad;
-
-        char ji_reserved[64];
-};
-
-struct gfs_log_descriptor {
-	struct gfs2_meta_header ld_header;
-
-	uint32_t ld_type;       /* GFS_LOG_DESC_... Type of this log chunk */
-	uint32_t ld_length;     /* Number of buffers in this chunk */
-	uint32_t ld_data1;      /* descriptor-specific field */
-	uint32_t ld_data2;      /* descriptor-specific field */
-	char ld_reserved[64];
-};
-
-struct gfs_log_header {
-	struct gfs2_meta_header lh_header;
-
-	uint32_t lh_flags;      /* GFS_LOG_HEAD_... */
-	uint32_t lh_pad;
-
-	uint64_t lh_first;     /* Block number of first header in this trans */
-	uint64_t lh_sequence;   /* Sequence number of this transaction */
-
-	uint64_t lh_tail;       /* Block number of log tail */
-	uint64_t lh_last_dump;  /* Block number of last dump */
-
-	char lh_reserved[64];
-};
-
-struct gfs_rindex {
-	uint64_t ri_addr;     /* block # of 1st block (header) in rgrp */
-	uint32_t ri_length;   /* # fs blocks containing rgrp header & bitmap */
-	uint32_t ri_pad;
-
-	uint64_t ri_data1;    /* block # of first data/meta block in rgrp */
-	uint32_t ri_data;     /* number (qty) of data/meta blocks in rgrp */
-
-	uint32_t ri_bitbytes; /* total # bytes used by block alloc bitmap */
-
-	char ri_reserved[64];
-};
-
-struct gfs_rgrp {
-	struct gfs2_meta_header rg_header;
-
-	uint32_t rg_flags;      /* ?? */
-
-	uint32_t rg_free;       /* Number (qty) of free data blocks */
-
-	/* Dinodes are USEDMETA, but are handled separately from other METAs */
-	uint32_t rg_useddi;     /* Number (qty) of dinodes (used or free) */
-	uint32_t rg_freedi;     /* Number (qty) of unused (free) dinodes */
-	struct gfs2_inum rg_freedi_list; /* 1st block in chain of free dinodes */
-
-	/* These META statistics do not include dinodes (used or free) */
-	uint32_t rg_usedmeta;   /* Number (qty) of used metadata blocks */
-	uint32_t rg_freemeta;   /* Number (qty) of unused metadata blocks */
-
-	char rg_reserved[64];
-};
-
-EXTERN int block_is_jindex(void);
-EXTERN int block_is_rindex(void);
-EXTERN int block_is_inum_file(void);
-EXTERN int block_is_statfs_file(void);
-EXTERN int block_is_quota_file(void);
-EXTERN int display_block_type(const char *lpBuffer, int from_restore);
-EXTERN void gfs_jindex_in(struct gfs_jindex *jindex, char *buf);
-EXTERN void gfs_log_header_in(struct gfs_log_header *head, char *buf);
-EXTERN void gfs_log_header_print(struct gfs_log_header *lh);
-EXTERN void gfs_dinode_in(struct gfs_dinode *di, char *buf);
-
-struct gfs2_dirents {
-	uint64_t block;
-	struct gfs2_dirent dirent;
-	char filename[NAME_MAX];
-};
-
-struct indirect_info {
-	int is_dir;
-	uint64_t block;
-	uint32_t dirents;
-	struct gfs2_dirents dirent[64];
-};
-
-struct iinfo {
-	struct indirect_info ii[512];
-};
-
-struct blkstack_info {
-	uint64_t block;
-	int start_row[DMODES];
-	int end_row[DMODES];
-	int lines_per_row[DMODES];
-	int edit_row[DMODES];
-	int edit_col[DMODES];
-	enum dsp_mode dmode;
-	int gfs2_struct_type;
-};
-
-struct gfs_sb {
-	/*  Order is important; need to be able to read old superblocks
-	    in order to support on-disk version upgrades */
-	struct gfs2_meta_header sb_header;
-
-	uint32_t sb_fs_format;         /* GFS_FORMAT_FS (on-disk version) */
-	uint32_t sb_multihost_format;  /* GFS_FORMAT_MULTI */
-	uint32_t sb_flags;             /* ?? */
-
-	uint32_t sb_bsize;             /* fundamental FS block size in bytes */
-	uint32_t sb_bsize_shift;       /* log2(sb_bsize) */
-	uint32_t sb_seg_size;          /* Journal segment size in FS blocks */
-
-	/* These special inodes do not appear in any on-disk directory. */
-	struct gfs2_inum sb_jindex_di;  /* journal index inode */
-	struct gfs2_inum sb_rindex_di;  /* resource group index inode */
-	struct gfs2_inum sb_root_di;    /* root directory inode */
-
-	/* Default inter-node locking protocol (lock module) and namespace */
-	char sb_lockproto[GFS2_LOCKNAME_LEN]; /* lock protocol name */
-	char sb_locktable[GFS2_LOCKNAME_LEN]; /* unique name for this FS */
-
-	/* More special inodes */
-	struct gfs2_inum sb_quota_di;   /* quota inode */
-	struct gfs2_inum sb_license_di; /* license inode */
-
-	char sb_reserved[96];
-};
-
-EXTERN struct blkstack_info blockstack[BLOCK_STACK_SIZE];
-EXTERN struct iinfo *indirect; /* more than the most indirect
-			       pointers possible for any given 4K block */
-EXTERN struct indirect_info masterdir; /* Master directory info */
-EXTERN int indirect_blocks INIT(0);  /* count of indirect blocks */
-EXTERN enum dsp_mode dmode INIT(HEX_MODE);
-
-#define SCREEN_HEIGHT   (16)
-#define SCREEN_WIDTH    (16)
-
-/*  Memory macros  */
-
-#define type_zalloc(ptr, type, count) \
-{ \
-  (ptr) = (type *)malloc(sizeof(type) * (count)); \
-  if ((ptr)) \
-    memset((char *)(ptr), 0, sizeof(type) * (count)); \
-  else \
-    die("unable to allocate memory on line %d of file %s\n", \
-	__LINE__, __FILE__); \
-}
-
-#define type_alloc(ptr, type, count) \
-{ \
-  (ptr) = (type *)malloc(sizeof(type) * (count)); \
-  if (!(ptr)) \
-    die("unable to allocate memory on line %d of file %s\n", \
-	__LINE__, __FILE__); \
-}
-
-#define printk printw
-
-/*  Divide x by y.  Round up if there is a remainder.  */
-#define DIV_RU(x, y) (((x) + (y) - 1) / (y))
-
-#define TITLE1 "gfs2_edit - Global File System Editor (use with extreme caution)"
-#define TITLE2 REDHAT_COPYRIGHT " - Press H for help"
-
-#define COLOR_TITLE     1
-#define COLOR_NORMAL    2
-#define COLOR_INVERSE   3
-#define COLOR_SPECIAL   4
-#define COLOR_HIGHLIGHT 5
-#define COLOR_OFFSETS   6
-#define COLOR_CONTENTS  7
-
-#define COLORS_TITLE     \
-	do { \
-		if (termlines) { \
-			attrset(COLOR_PAIR(COLOR_TITLE)); \
-			attron(A_BOLD); \
-		} \
-	} while (0)
-#define COLORS_NORMAL    \
-	do { \
-		if (termlines) { \
-			attrset(COLOR_PAIR(COLOR_NORMAL)); \
-			attron(A_BOLD); \
-		} \
-	} while (0)
-#define COLORS_INVERSE   \
-	do { \
-		if (termlines) { \
-			attrset(COLOR_PAIR(COLOR_INVERSE)); \
-			attron(A_BOLD); \
-		} \
-	} while (0)
-#define COLORS_SPECIAL   \
-	do { \
-		if (termlines) { \
-			attrset(COLOR_PAIR(COLOR_SPECIAL)); \
-			attron(A_BOLD); \
-		} \
-	} while (0)
-#define COLORS_HIGHLIGHT \
-	do { \
-		if (termlines) { \
-			attrset(COLOR_PAIR(COLOR_HIGHLIGHT)); \
-			attron(A_BOLD); \
-		} \
-	} while (0)
-#define COLORS_OFFSETS   \
-	do { \
-		if (termlines) { \
-			attrset(COLOR_PAIR(COLOR_OFFSETS)); \
-			attron(A_BOLD); \
-		} \
-	} while (0)
-#define COLORS_CONTENTS  \
-	do { \
-		if (termlines) { \
-			attrset(COLOR_PAIR(COLOR_CONTENTS)); \
-			attron(A_BOLD); \
-		} \
-	} while (0)
-
-#endif /* __HEXVIEW_DOT_H__ */
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
deleted file mode 100644
index 8b7637b..0000000
--- a/gfs2/edit/savemeta.c
+++ /dev/null
@@ -1,748 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <string.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <sys/types.h>
-#include <linux/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include <curses.h>
-#include <term.h>
-#include <sys/ioctl.h>
-#include <limits.h>
-#include <linux_endian.h>
-#include <sys/time.h>
-#include <linux/gfs2_ondisk.h>
-
-#include "osi_list.h"
-#include "gfs2hex.h"
-#include "hexedit.h"
-#include "libgfs2.h"
-
-#define BUFSIZE (4096)
-#define DFT_SAVE_FILE "/tmp/gfsmeta.XXXXXX"
-#define MAX_JOURNALS_SAVED 256
-
-struct saved_metablock {
-	uint64_t blk;
-	uint16_t siglen; /* significant data length */
-	char buf[BUFSIZE];
-};
-
-struct saved_metablock *savedata;
-uint64_t last_fs_block, last_reported_block, blks_saved, total_out, pct;
-struct gfs2_block_list *blocklist = NULL;
-uint64_t journal_blocks[MAX_JOURNALS_SAVED];
-uint64_t gfs1_journal_size = 0; /* in blocks */
-int journals_found = 0;
-
-extern void read_superblock(void);
-uint64_t masterblock(const char *fn);
-
-/*
- * get_gfs_struct_info - get block type and structure length
- *
- * @block_type - pointer to integer to hold the block type
- * @struct_length - pointer to integet to hold the structure length
- *
- * returns: 0 if successful
- *          -1 if this isn't gfs metadata.
- */
-int get_gfs_struct_info(char *buf, int *block_type, int *struct_len)
-{
-	struct gfs2_meta_header mh;
-
-	*block_type = 0;
-	*struct_len = sbd.bsize;
-
-	gfs2_meta_header_in(&mh, buf);
-	if (mh.mh_magic != GFS2_MAGIC)
-		return -1;
-
-	*block_type = mh.mh_type;
-
-	switch (mh.mh_type) {
-	case GFS2_METATYPE_SB:   /* 1 (superblock) */
-		*struct_len = sizeof(struct gfs_sb);
-		break;
-	case GFS2_METATYPE_RG:   /* 2 (rsrc grp hdr) */
-		*struct_len = sbd.bsize; /*sizeof(struct gfs_rgrp);*/
-		break;
-	case GFS2_METATYPE_RB:   /* 3 (rsrc grp bitblk) */
-		*struct_len = sbd.bsize;
-		break;
-	case GFS2_METATYPE_DI:   /* 4 (disk inode) */
-		*struct_len = sbd.bsize; /*sizeof(struct gfs_dinode);*/
-		break;
-	case GFS2_METATYPE_IN:   /* 5 (indir inode blklst) */
-		*struct_len = sbd.bsize; /*sizeof(struct gfs_indirect);*/
-		break;
-	case GFS2_METATYPE_LF:   /* 6 (leaf dinode blklst) */
-		*struct_len = sbd.bsize; /*sizeof(struct gfs_leaf);*/
-		break;
-	case GFS2_METATYPE_JD:   /* 7 (journal data) */
-		/* GFS1 keeps indirect pointers in GFS2_METATYPE_JD blocks
-		   so we need to save the whole block.  For GFS2, we don't
-		   want to, or we might capture user data, which is bad.  */
-		if (gfs1)
-			*struct_len = sbd.bsize;
-		else
-			*struct_len = sizeof(struct gfs2_meta_header);
-		break;
-	case GFS2_METATYPE_LH:   /* 8 (log header) */
-		*struct_len = sizeof(struct gfs2_log_header);
-		break;
-	case GFS2_METATYPE_LD:   /* 9 (log descriptor) */
-		*struct_len = sbd.bsize;
-		break;
-	case GFS2_METATYPE_EA:   /* 10 (extended attr hdr) */
-		*struct_len = sbd.bsize;
-		break;
-	case GFS2_METATYPE_ED:   /* 11 (extended attr data) */
-		*struct_len = sbd.bsize;
-		break;
-	default:
-		*struct_len = sbd.bsize;
-		break;
-	}
-	return 0;
-}
-
-/* Put out a warm, fuzzy message every second so the user     */
-/* doesn't think we hung.  (This may take a long time).       */
-/* We only check whether to report every one percent because  */
-/* checking every block kills performance.  We only report    */
-/* every second because we don't need 100 extra messages in   */
-/* logs made from verbose mode.                               */
-void warm_fuzzy_stuff(uint64_t block, int force, int save)
-{
-        static struct timeval tv;
-        static uint32_t seconds = 0;
-        
-	last_reported_block = block;
-	gettimeofday(&tv, NULL);
-	if (!seconds)
-		seconds = tv.tv_sec;
-	if (force || tv.tv_sec - seconds) {
-		static uint64_t percent;
-
-		seconds = tv.tv_sec;
-		if (last_fs_block) {
-			printf("\r");
-			if (save) {
-				percent = (block * 100) / last_fs_block;
-				printf("%" PRIu64 " metadata blocks (%"
-				       PRIu64 "%%) processed, ", block,
-				       percent);
-			}
-			if (total_out < 1024 * 1024)
-				printf("%" PRIu64 " metadata blocks (%"
-				       PRIu64 "KB) %s.    ",
-				       blks_saved, total_out / 1024,
-				       save?"saved":"restored");
-			else
-				printf("%" PRIu64 " metadata blocks (%"
-				       PRIu64 "MB) %s.    ",
-				       blks_saved, total_out / (1024*1024),
-				       save?"saved":"restored");
-			if (force)
-				printf("\n");
-			fflush(stdout);
-		}
-	}
-}
-
-int block_is_a_journal(void)
-{
-	int j;
-
-	for (j = 0; j < journals_found; j++)
-		if (block == journal_blocks[j])
-			return TRUE;
-	return FALSE;
-}
-
-int block_is_systemfile(void)
-{
-	return block_is_jindex() ||
-		block_is_inum_file() ||
-		block_is_statfs_file() ||
-		block_is_quota_file() ||
-		block_is_rindex() ||
-		block_is_a_journal();
-}
-
-int save_block(int fd, int out_fd, uint64_t blk)
-{
-	int blktype, blklen, outsz;
-	uint16_t trailing0;
-	char *p;
-
-	if (blk > last_fs_block) {
-		fprintf(stderr, "\nWarning: bad block pointer ignored in "
-			"block (block %llu (%llx))",
-			(unsigned long long)block, (unsigned long long)block);
-		return 0;
-	}
-	memset(savedata, 0, sizeof(struct saved_metablock));
-	do_lseek(fd, blk * sbd.bsize);
-	do_read(fd, savedata->buf, sbd.bsize); /* read in the block */
-
-	/* If this isn't metadata and isn't a system file, we don't want it.
-	   Note that we're checking "block" here rather than blk.  That's
-	   because we want to know if the source inode's "block" is a system
-	   inode, not the block within the inode "blk". They may or may not
-	   be the same thing. */
-	if (get_gfs_struct_info(savedata->buf, &blktype, &blklen) &&
-	    !block_is_systemfile())
-		return 0; /* Not metadata, and not system file, so skip it */
-	trailing0 = 0;
-	p = &savedata->buf[blklen - 1];
-	while (*p=='\0' && trailing0 < sbd.bsize) {
-		trailing0++;
-		p--;
-	}
-	savedata->blk = cpu_to_be64(blk);
-	do_write(out_fd, &savedata->blk, sizeof(savedata->blk));
-	outsz = blklen - trailing0;
-	savedata->siglen = cpu_to_be16(outsz);
-	do_write(out_fd, &savedata->siglen, sizeof(savedata->siglen));
-	do_write(out_fd, savedata->buf, outsz);
-	total_out += sizeof(savedata->blk) + sizeof(savedata->siglen) + outsz;
-	blks_saved++;
-	return blktype;
-}
-
-/*
- * save_indirect_blocks - save all indirect blocks for the given buffer
- */
-void save_indirect_blocks(int out_fd, osi_list_t *cur_list,
-			  struct gfs2_buffer_head *mybh, int height, int hgt)
-{
-	uint64_t old_block = 0, indir_block;
-	uint64_t *ptr;
-	int head_size;
-	struct gfs2_buffer_head *nbh;
-
-	head_size = (hgt > 1 ?
-		     sizeof(struct gfs2_meta_header) :
-		     sizeof(struct gfs2_dinode));
-
-	for (ptr = (uint64_t *)(mybh->b_data + head_size);
-	     (char *)ptr < (mybh->b_data + sbd.bsize); ptr++) {
-		if (!*ptr)
-			continue;
-		indir_block = be64_to_cpu(*ptr);
-		if (indir_block == old_block)
-			continue;
-		old_block = indir_block;
-		save_block(sbd.device_fd, out_fd, indir_block);
-		if (height != hgt) { /* If not at max height */
-			nbh = bread(&sbd.buf_list, indir_block);
-			osi_list_add_prev(&nbh->b_altlist,
-					  cur_list);
-			brelse(nbh, not_updated);
-		}
-	} /* for all data on the indirect block */
-}
-
-/*
- * save_inode_data - save off important data associated with an inode
- *
- * out_fd - destination file descriptor
- * block - block number of the inode to save the data for
- * 
- * For user files, we don't want anything except all the indirect block
- * pointers that reside on blocks on all but the highest height.
- *
- * For system files like statfs and inum, we want everything because they
- * may contain important clues and no user data.
- *
- * For file system journals, the "data" is a mixture of metadata and
- * journaled data.  We want all the metadata and none of the user data.
- */
-void save_inode_data(int out_fd)
-{
-	uint32_t height;
-	struct gfs2_inode *inode;
-	osi_list_t metalist[GFS2_MAX_META_HEIGHT];
-	osi_list_t *prev_list, *cur_list, *tmp;
-	struct gfs2_buffer_head *metabh, *mybh;
-	int i;
-
-	for (i = 0; i < GFS2_MAX_META_HEIGHT; i++)
-		osi_list_init(&metalist[i]);
-	metabh = bread(&sbd.buf_list, block);
-	if (gfs1)
-		inode = inode_get(&sbd, metabh);
-	else
-		inode = gfs_inode_get(&sbd, metabh);
-	height = inode->i_di.di_height;
-	/* If this is a user inode, we don't follow to the file height.
-	   We stop one level less.  That way we save off the indirect
-	   pointer blocks but not the actual file contents. */
-	if (height && !block_is_systemfile())
-		height--;
-	osi_list_add(&metabh->b_altlist, &metalist[0]);
-        for (i = 1; i <= height; i++){
-		prev_list = &metalist[i - 1];
-		cur_list = &metalist[i];
-
-		for (tmp = prev_list->next; tmp != prev_list; tmp = tmp->next){
-			mybh = osi_list_entry(tmp, struct gfs2_buffer_head,
-					      b_altlist);
-			save_indirect_blocks(out_fd, cur_list, mybh,
-					     height, i);
-		} /* for blocks at that height */
-	} /* for height */
-	/* free metalists */
-	for (i = 0; i < GFS2_MAX_META_HEIGHT; i++) {
-		cur_list = &metalist[i];
-		while (!osi_list_empty(cur_list)) {
-			mybh = osi_list_entry(cur_list->next,
-					    struct gfs2_buffer_head,
-					    b_altlist);
-			osi_list_del(&mybh->b_altlist);
-		}
-	}
-	/* Process directory exhash inodes */
-	if (S_ISDIR(inode->i_di.di_mode)) {
-		if (inode->i_di.di_flags & GFS2_DIF_EXHASH) {
-			save_indirect_blocks(out_fd, cur_list, metabh,
-					     height, 0);
-		}
-	}
-	if (inode->i_di.di_eattr) { /* if this inode has extended attributes */
-		struct gfs2_ea_header ea;
-		struct gfs2_meta_header mh;
-		int e;
-
-		metabh = bread(&sbd.buf_list, inode->i_di.di_eattr);
-		save_block(sbd.device_fd, out_fd, inode->i_di.di_eattr);
-		gfs2_meta_header_in(&mh, metabh->b_data);
-		if (mh.mh_magic == GFS2_MAGIC) {
-			for (e = sizeof(struct gfs2_meta_header);
-			     e < sbd.bsize; e += ea.ea_rec_len) {
-				uint64_t blk, *b;
-				int charoff;
-
-				gfs2_ea_header_in(&ea, metabh->b_data + e);
-				for (i = 0; i < ea.ea_num_ptrs; i++) {
-					charoff = e + ea.ea_name_len +
-						sizeof(struct gfs2_ea_header) +
-						sizeof(uint64_t) - 1;
-					charoff /= sizeof(uint64_t);
-					b = (uint64_t *)(metabh->b_data);
-					b += charoff + i;
-					blk = be64_to_cpu(*b);
-					save_block(sbd.device_fd, out_fd, blk);
-				}
-				if (!ea.ea_rec_len)
-					break;
-			}
-		} else {
-			fprintf(stderr, "\nWarning: corrupt extended attribute"
-				" at block %llu (0x%llx) detected.\n",
-				(unsigned long long)block,
-				(unsigned long long)block);
-		}
-		brelse(metabh, not_updated);
-	}
-	inode_put(inode, not_updated);
-}
-
-void get_journal_inode_blocks(void)
-{
-	int journal;
-	struct gfs2_buffer_head *bh;
-
-	journals_found = 0;
-	memset(journal_blocks, 0, sizeof(journal_blocks));
-	/* Save off all the journals--but only the metadata.
-	 * This is confusing so I'll explain.  The journals contain important 
-	 * metadata.  However, in gfs2 the journals are regular files within
-	 * the system directory.  Since they're regular files, the blocks
-	 * within the journals are considered data, not metadata.  Therefore,
-	 * they won't have been saved by the code above.  We want to dump
-	 * these blocks, but we have to be careful.  We only care about the
-	 * journal blocks that look like metadata, and we need to not save
-	 * journaled user data that may exist there as well. */
-	for (journal = 0; ; journal++) { /* while journals exist */
-		uint64_t jblock;
-		int amt;
-		struct gfs2_dinode jdi;
-		struct gfs2_inode *j_inode = NULL;
-
-		if (gfs1) {
-			struct gfs_jindex ji;
-			char jbuf[sizeof(struct gfs_jindex)];
-
-			bh = bread(&sbd.buf_list, sbd1->sb_jindex_di.no_addr);
-			j_inode = gfs_inode_get(&sbd, bh);
-			amt = gfs2_readi(j_inode, (void *)&jbuf,
-					 journal * sizeof(struct gfs_jindex),
-					 sizeof(struct gfs_jindex));
-			brelse(bh, not_updated);
-			if (!amt)
-				break;
-			gfs_jindex_in(&ji, jbuf);
-			jblock = ji.ji_addr;
-			gfs1_journal_size = ji.ji_nsegment * 16;
-		} else {
-			if (journal > indirect->ii[0].dirents - 3)
-				break;
-			jblock = indirect->ii[0].dirent[journal + 2].block;
-			bh = bread(&sbd.buf_list, jblock);
-			j_inode = inode_get(&sbd, bh);
-			gfs2_dinode_in(&jdi, bh->b_data);
-			inode_put(j_inode, not_updated);
-		}
-		journal_blocks[journals_found++] = jblock;
-	}
-}
-
-void savemeta(char *out_fn, int saveoption)
-{
-	int out_fd;
-	int slow;
-	osi_list_t *tmp;
-	uint64_t memreq;
-	int rgcount;
-	uint64_t jindex_block;
-	struct gfs2_buffer_head *bh;
-
-	slow = (saveoption == 1);
-	sbd.md.journals = 1;
-
-	if (!out_fn) {
-		out_fn = strdup(DFT_SAVE_FILE);
-		if (!out_fn)
-			die("Can't allocate memory for the operation.\n");
-		out_fd = mkstemp(out_fn);
-	} else
-		out_fd = open(out_fn, O_RDWR | O_CREAT, 0644);
-
-	if (out_fd < 0)
-		die("Can't open %s: %s\n", out_fn, strerror(errno));
-
-	if (ftruncate(out_fd, 0))
-		die("Can't truncate %s: %s\n", out_fn, strerror(errno));
-	savedata = malloc(sizeof(struct saved_metablock));
-	if (!savedata)
-		die("Can't allocate memory for the operation.\n");
-
-	do_lseek(sbd.device_fd, 0);
-	blks_saved = total_out = last_reported_block = 0;
-	if (!gfs1)
-		sbd.bsize = BUFSIZE;
-	if (!slow) {
-		device_geometry(&sbd);
-		fix_device_geometry(&sbd);
-		osi_list_init(&sbd.rglist);
-		init_buf_list(&sbd, &sbd.buf_list, 128 << 20);
-		init_buf_list(&sbd, &sbd.nvbuf_list, 0xffffffff);
-		if (!gfs1)
-			sbd.sd_sb.sb_bsize = GFS2_DEFAULT_BSIZE;
-		compute_constants(&sbd);
-		if(gfs1) {
-			sbd.bsize = sbd.sd_sb.sb_bsize;
-			sbd.sd_inptrs = (sbd.bsize -
-					 sizeof(struct gfs_indirect)) /
-				sizeof(uint64_t);
-			sbd.sd_diptrs = (sbd.bsize -
-					  sizeof(struct gfs_dinode)) /
-				sizeof(uint64_t);
-		} else {
-			if (read_sb(&sbd) < 0)
-				slow = TRUE;
-			else {
-				sbd.sd_inptrs = (sbd.bsize -
-					 sizeof(struct gfs2_meta_header)) /
-					sizeof(uint64_t);
-				sbd.sd_diptrs = (sbd.bsize -
-					  sizeof(struct gfs2_dinode)) /
-					sizeof(uint64_t);
-			}
-		}
-	}
-	last_fs_block = lseek(sbd.device_fd, 0, SEEK_END) / sbd.bsize;
-	printf("There are %" PRIu64 " blocks of %u bytes.\n",
-	       last_fs_block, sbd.bsize);
-	if (!slow) {
-		if (gfs1) {
-			sbd.md.riinode =
-				gfs2_load_inode(&sbd,
-						sbd1->sb_rindex_di.no_addr);
-			jindex_block = sbd1->sb_jindex_di.no_addr;
-		} else {
-			sbd.master_dir =
-				gfs2_load_inode(&sbd,
-						sbd.sd_sb.sb_master_dir.no_addr);
-
-			slow = gfs2_lookupi(sbd.master_dir, "rindex", 6, 
-					    &sbd.md.riinode);
-			jindex_block = masterblock("jindex");
-		}
-		bh = bread(&sbd.buf_list, jindex_block);
-		gfs2_dinode_in(&di, bh->b_data);
-		if (!gfs1)
-			do_dinode_extended(&di, bh->b_data);
-		brelse(bh, not_updated);
-	}
-	if (!slow) {
-		printf("Reading resource groups...");
-		fflush(stdout);
-		if (gfs1)
-			slow = gfs1_ri_update(&sbd, 0, &rgcount);
-		else
-			slow = ri_update(&sbd, 0, &rgcount);
-		printf("Done.\n\n");
-		fflush(stdout);
-	}
-	if (!slow) {
-		blocklist = gfs2_block_list_create(&sbd, last_fs_block + 1,
-						   &memreq);
-		if (!blocklist)
-			slow = TRUE;
-	}
-	get_journal_inode_blocks();
-	if (!slow) {
-		/* Save off the superblock */
-		save_block(sbd.device_fd, out_fd, 0x10 * (4096 / sbd.bsize));
-		/* If this is gfs1, save off the rindex because it's not
-		   part of the file system as it is in gfs2. */
-		if (gfs1) {
-			int j;
-
-			block = sbd1->sb_rindex_di.no_addr;
-			save_block(sbd.device_fd, out_fd, block);
-			save_inode_data(out_fd);
-			/* In GFS1, journals aren't part of the RG space */
-			for (j = 0; j < journals_found; j++) {
-				log_debug("Saving journal #%d\n", j + 1);
-				for (block = journal_blocks[j];
-				     block < journal_blocks[j] +
-					     gfs1_journal_size;
-				     block++)
-					save_block(sbd.device_fd, out_fd, block);
-			}
-		}
-		/* Walk through the resource groups saving everything within */
-		for (tmp = sbd.rglist.next; tmp != &sbd.rglist;
-		     tmp = tmp->next){
-			struct rgrp_list *rgd;
-			int i, first;
-
-			rgd = osi_list_entry(tmp, struct rgrp_list, list);
-			slow = gfs2_rgrp_read(&sbd, rgd);
-			if (slow)
-				continue;
-			log_debug("RG at %"PRIu64" is %u long\n",
-				  rgd->ri.ri_addr, rgd->ri.ri_length);
-			for (i = 0; i < rgd->ri.ri_length; i++) {
-				if(gfs2_block_set(&sbd, blocklist,
-						  rgd->ri.ri_addr + i,
-						  gfs2_meta_other))
-					break;
-			}
-			first = 1;
-			/* Save off the rg and bitmaps */
-			for (block = rgd->ri.ri_addr;
-			     block < rgd->ri.ri_data0; block++) {
-				warm_fuzzy_stuff(block, FALSE, TRUE);
-				save_block(sbd.device_fd, out_fd, block);
-			}
-			/* Save off the other metadata: inodes, etc. */
-			if (saveoption != 2) {
-				while (!gfs2_next_rg_meta(rgd, &block, first)) {
-					int blktype;
-
-					warm_fuzzy_stuff(block, FALSE, TRUE);
-					blktype = save_block(sbd.device_fd,
-							     out_fd, block);
-					if (blktype == GFS2_METATYPE_DI)
-						save_inode_data(out_fd);
-					first = 0;
-				}
-			}
-			gfs2_rgrp_relse(rgd, not_updated);
-		}
-	}
-	if (slow) {
-		for (block = 0; block < last_fs_block; block++) {
-			save_block(sbd.device_fd, out_fd, block);
-		}
-	}
-	/* Clean up */
-	if (blocklist)
-		gfs2_block_list_destroy(&sbd, blocklist);
-	/* There may be a gap between end of file system and end of device */
-	/* so we tell the user that we've processed everything. */
-	block = last_fs_block;
-	warm_fuzzy_stuff(block, TRUE, TRUE);
-	printf("\nMetadata saved to file %s.\n", out_fn);
-	free(savedata);
-	close(out_fd);
-	close(sbd.device_fd);
-	exit(0);
-}
-
-int restore_data(int fd, int in_fd, int printblocksonly)
-{
-	size_t rs;
-	uint64_t buf64, writes = 0;
-	uint16_t buf16;
-	int first = 1, pos;
-	char buf[256];
-	char gfs_superblock_id[8] = {0x01, 0x16, 0x19, 0x70,
-				     0x00, 0x00, 0x00, 0x01};
-
-	if (!printblocksonly)
-		do_lseek(fd, 0);
-	do_lseek(in_fd, 0);
-	rs = read(in_fd, buf, sizeof(buf));
-	if (rs != sizeof(buf)) {
-		fprintf(stderr, "Error: File is too small.\n");
-		return -1;
-	}
-	for (pos = 0; pos < sizeof(buf) - sizeof(uint64_t) - sizeof(uint16_t);
-	     pos++) {
-		if (!memcmp(&buf[pos + sizeof(uint64_t) + sizeof(uint16_t)],
-			    gfs_superblock_id, sizeof(gfs_superblock_id))) {
-			break;
-		}
-	}
-	if (pos == sizeof(buf) - sizeof(uint64_t) - sizeof(uint16_t))
-		pos = 0;
-	do_lseek(in_fd, pos);
-	blks_saved = total_out = 0;
-	last_fs_block = 0;
-	while (TRUE) {
-		memset(savedata, 0, sizeof(struct saved_metablock));
-		rs = read(in_fd, &buf64, sizeof(uint64_t));
-		if (!rs)
-			break;
-		if (rs != sizeof(uint64_t)) {
-			fprintf(stderr, "Error reading from file.\n");
-			return -1;
-		}
-		total_out += sbd.bsize;
-		savedata->blk = be64_to_cpu(buf64);
-		if (!printblocksonly &&
-		    last_fs_block && savedata->blk >= last_fs_block) {
-			fprintf(stderr, "Error: File system is too small to "
-				"restore this metadata.\n");
-			fprintf(stderr, "File system is %" PRIu64 " blocks, ",
-				last_fs_block);
-			fprintf(stderr, "Restore block = %" PRIu64 "\n",
-				savedata->blk);
-			return -1;
-		}
-		rs = read(in_fd, &buf16, sizeof(uint16_t));
-		savedata->siglen = be16_to_cpu(buf16);
-		if (savedata->siglen > 0 &&
-		    savedata->siglen <= sizeof(savedata->buf)) {
-			do_read(in_fd, savedata->buf, savedata->siglen);
-			if (first) {
-				gfs2_sb_in(&sbd.sd_sb, savedata->buf);
-				sbd1 = (struct gfs_sb *)&sbd.sd_sb;
-				if (sbd1->sb_fs_format == GFS_FORMAT_FS &&
-				    sbd1->sb_header.mh_type ==
-				    GFS_METATYPE_SB &&
-				    sbd1->sb_header.mh_format ==
-				    GFS_FORMAT_SB &&
-				    sbd1->sb_multihost_format ==
-				    GFS_FORMAT_MULTI)
-					;
-				else if (check_sb(&sbd.sd_sb)) {
-					fprintf(stderr,"Error: Invalid superblock data.\n");
-					return -1;
-				}
-				sbd.bsize = sbd.sd_sb.sb_bsize;
-				if (!printblocksonly) {
-					last_fs_block =
-						lseek(fd, 0, SEEK_END) /
-						sbd.bsize;
-					printf("There are %" PRIu64 " blocks of " \
-					       "%u bytes in the destination" \
-					       " file system.\n\n",
-					       last_fs_block, sbd.bsize);
-				}
-				first = 0;
-			}
-			if (printblocksonly) {
-				print_gfs2("%d (l=0x%x): ", blks_saved,
-					   savedata->siglen);
-				block = savedata->blk;
-				display_block_type(savedata->buf, TRUE);
-			} else {
-				warm_fuzzy_stuff(savedata->blk, FALSE, FALSE);
-				if (savedata->blk >= last_fs_block) {
-					printf("Out of space on the destination "
-					       "device; quitting.\n");
-					break;
-				}
-				do_lseek(fd, savedata->blk * sbd.bsize);
-				do_write(fd, savedata->buf, sbd.bsize);
-				writes++;
-			}
-			blks_saved++;
-		} else {
-			fprintf(stderr, "Bad record length: %d for block #%"
-				PRIu64".\n", savedata->siglen, savedata->blk);
-			return -1;
-		}
-	}
-	if (!printblocksonly)
-		warm_fuzzy_stuff(savedata->blk, TRUE, FALSE);
-	return 0;
-}
-
-void complain(const char *complaint)
-{
-	fprintf(stderr, "%s\n", complaint);
-	die("Format is: \ngfs2_edit restoremeta <file to restore> "
-	    "<dest file system>\n");
-}
-
-void restoremeta(const char *in_fn, const char *out_device,
-		 int printblocksonly)
-{
-	int in_fd, error;
-
-	termlines = 0;
-	if (!in_fn)
-		complain("No source file specified.");
-	if (!printblocksonly && !out_device)
-		complain("No destination file system specified.");
-	in_fd = open(in_fn, O_RDONLY);
-	if (in_fd < 0)
-		die("Can't open source file %s: %s\n",
-		    in_fn, strerror(errno));
-
-	if (!printblocksonly) {
-		sbd.device_fd = open(out_device, O_RDWR);
-		if (sbd.device_fd < 0)
-			die("Can't open destination file system %s: %s\n",
-			    out_device, strerror(errno));
-	}
-	savedata = malloc(sizeof(struct saved_metablock));
-	if (!savedata)
-		die("Can't allocate memory for the restore operation.\n");
-
-	blks_saved = 0;
-	error = restore_data(sbd.device_fd, in_fd, printblocksonly);
-	printf("File %s %s %s.\n", in_fn,
-	       (printblocksonly ? "print" : "restore"),
-	       (error ? "error" : "successful"));
-	free(savedata);
-	close(in_fd);
-	if (!printblocksonly)
-		close(sbd.device_fd);
-
-	exit(0);
-}
diff --git a/gfs2/fsck/FEATURES b/gfs2/fsck/FEATURES
deleted file mode 100644
index 8a63591..0000000
--- a/gfs2/fsck/FEATURES
+++ /dev/null
@@ -1,25 +0,0 @@
-This is a completely rewritten filesystem checker for GFS.  Performance
-characteristics are significantly improved.  The design follows the 5-pass
-fsck design found in "Fsck - The UNIX File System Check Program"
-by McKusick & Kowalkski (1994)
-  - http://citeseer.ist.psu.edu/mckusick94fsck.html
-
-
-Line item list of supported features:
-
-1. Detects and replaces missing/bad root inode
-2. Detects and relinks unlinked inodes to l+f
-   o If a file is zero length, it is not relinked to l+f - unless it
-     has an extended attribute attached to it.
-3. Detects duplicate blocks and removes inodes containing them
-4. Detects bad blocks (block number out of range) and removes inodes
-   containing them - Currently EAs that have blocks are removed but
-   the inode containing them is left.
-5. Detects bad metadata headers and clears the structure
-6. Fixes bad resource group bitmaps
-7. Fixes incorrect resource group counts
-8. Creates l+f directory if missing
-9. Detects and removes duplicate '.' and '..' entries
-10. Creates '.' if missing
-11. Beginning of support for internationalization
-12. Checks extended attributes
diff --git a/gfs2/fsck/Makefile b/gfs2/fsck/Makefile
deleted file mode 100644
index 0422acc..0000000
--- a/gfs2/fsck/Makefile
+++ /dev/null
@@ -1,67 +0,0 @@
-TARGET1= fsck.gfs2
-TARGET2= gfs2_fsck
-
-SBINDIRT=$(TARGET1)
-SBINSYMT=$(TARGET2)
-
-all: depends ${TARGET1} ${TARGET2}
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-OBJS=	eattr.o \
-	fs_recovery.o \
-	hash.o \
-	initialize.o \
-	inode_hash.o \
-	link.o \
-	lost_n_found.o \
-	main.o \
-	metawalk.o \
-	pass1.o \
-	pass1b.o \
-	pass1c.o \
-	pass2.o \
-	pass3.o \
-	pass4.o \
-	pass5.o \
-	rgrepair.o \
-	util.o
-
-CFLAGS += -D_FILE_OFFSET_BITS=64 -DHELPER_PROGRAM
-CFLAGS += -I${KERNEL_SRC}/fs/gfs2/ -I${KERNEL_SRC}/include/
-CFLAGS += -I$(S)/../include -I$(S)/../libgfs2
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L../libgfs2 -lgfs2
-LDFLAGS += -L${libdir}
-
-LDDEPS += ../libgfs2/libgfs2.a
-
-${TARGET1}: $(OBJS) ../libgfs2/libgfs2.a
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-${TARGET2}: ${TARGET1} ${LDDEPS}
-	ln -fs ${TARGET1} ${TARGET2}	
-
-depends:
-	$(MAKE) -C ../libgfs2 all
-
-test_block_list: log.o test_block_list.o
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-test_bitmap: test_bitmap.o log.o
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-clean: generalclean
-	rm -f test_block_list test_bitmap
-
-${TARGET1}.pot: $(OBJS:.o=.c)
-	xgettext -C -F --keyword=print_log --keyword=log_debug --keyword=log_info --keyword=_ \
-	 --keyword=log_notice --keyword=log_warn --keyword=log_err --keyword=log_crit \
-	 --keyword=log_debug --keyword=log_err --keyword=log_print -d - $(OBJS:.o=.c) > ${TARGET1}.pot	
-
--include $(OBJS:.o=.d)
diff --git a/gfs2/fsck/TODO b/gfs2/fsck/TODO
deleted file mode 100644
index 2b2e762..0000000
--- a/gfs2/fsck/TODO
+++ /dev/null
@@ -1,49 +0,0 @@
-
-TODO:
-
-Current
- x fs_mkdir appears to be grabbing blocks that are in use - need to
-   figure out why - had to fix fs_blkalloc_internal in fs_bits.c to
-   use the incore bitmaps instead of ondisk.
- o Make sure that all blocks in an inode get marked cleared when an
-   inode is cleared.
- x If a directory is unlinked from pass2 on, make sure that any
-   directories that have it as a parent have their
-   dir_info->treewalk_parent entries cleared - handled by pass3
-   checking if parents inodes are valid in the bitmap
- o If an directory is unlinked from pass2 on, make sure that inodes
-   have their link count decremented (this may be difficult - i'll
-   have to reread the dirents and decrement the counts for all dirents
-   up to the error...).
- x 'Add in UI for interactive mode
- o Check hash of directory name against name given (Would be nice -
-   not in old fsck, but can cause problems if it is not verified.)
- x Unstuffed EA blocks have type GFS_METATYPE_ED in 6.1, but
-   GFS_METATYPE_EA in 6.0 - handle this.
-
----
-
-Future
- o internationalization
- o Check GFS special files (quota, resource group index inode, journal
-   index inode, license inode?)
- o convert dir_info list to a hash table like the inode_info hash
- o Fix up the bitmap enums and #defines in block_list.[ch]
- o Go through all fxns that have NEEDS_CHECKING in them and verify
-   them (and remove NEEDS_CHECKING)
- o Add 'preen' option?
- o Add disk-based bitmaps option in case system doesn't have enough
-   memory to handle all the bitmaps
- o currently rgrp bitmaps are loaded into memory on initialization -
-   need to see if this is necessary or not - we're using them in pass1
-   and again in pass5 - if memory is tight we might be able to free
-   them in between
- o Offer exhaustive search capability if superblock or rgs are missing
-   or broken that checks block by block for fs info.
- o If we encounter a directory entry in pass2 that points to a block
-   marked free, shove it into a queue, and then at the end of pass2,
-   clear all results, then rerun from pass1 including the blocks in
-   the queue as well as those marked in the RG bitmaps.  With this, we
-   can rebuild the entire fs with a valid root inode, it'll just take
-   several iterations.
-
diff --git a/gfs2/fsck/eattr.c b/gfs2/fsck/eattr.c
deleted file mode 100644
index e32a366..0000000
--- a/gfs2/fsck/eattr.c
+++ /dev/null
@@ -1,103 +0,0 @@
-#include <stdint.h>
-#include <string.h>
-#include <linux_endian.h>
-
-#include "libgfs2.h"
-#include "fsck.h"
-
-static int clear_blk_nodup(struct gfs2_sbd *sbp, uint64_t block)
-{
-	struct gfs2_block_query q;
-
-	if(gfs2_block_check(sbp, bl, block, &q)) {
-		stack;
-		return -1;
-	}
-
-	if(q.dup_block) {
-		log_debug("Not clearing block with marked as a duplicate\n");
-		return 1;
-	}
-
-	gfs2_block_set(sbp, bl, block, gfs2_block_free);
-
-	return 0;
-
-}
-
-int clear_eattr_indir(struct gfs2_inode *ip, uint64_t block,
-		      uint64_t parent, struct gfs2_buffer_head **bh,
-		      enum update_flags *want_updated, void *private)
-{
-	*want_updated = not_updated;
-	return clear_blk_nodup(ip->i_sbd, block);
-}
-
-int clear_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
-		     uint64_t parent, struct gfs2_buffer_head **bh,
-		     enum update_flags *want_updated, void *private)
-{
-	*want_updated = not_updated;
-	return clear_blk_nodup(ip->i_sbd, block);
-}
-
-int clear_eattr_entry (struct gfs2_inode *ip,
-		       struct gfs2_buffer_head *leaf_bh,
-		       struct gfs2_ea_header *ea_hdr,
-		       struct gfs2_ea_header *ea_hdr_prev,
-		       void *private)
-{
-	struct gfs2_sbd *sdp = ip->i_sbd;
-	char ea_name[256];
-
-	if(!ea_hdr->ea_name_len){
-		/* Skip this entry for now */
-		return 1;
-	}
-
-	memset(ea_name, 0, sizeof(ea_name));
-	strncpy(ea_name, (char *)ea_hdr + sizeof(struct gfs2_ea_header),
-		ea_hdr->ea_name_len);
-
-	if(!GFS2_EATYPE_VALID(ea_hdr->ea_type) &&
-	   ((ea_hdr_prev) || (!ea_hdr_prev && ea_hdr->ea_type))){
-		/* Skip invalid entry */
-		return 1;
-	}
-
-	if(ea_hdr->ea_num_ptrs){
-		uint32_t avail_size;
-		int max_ptrs;
-
-		avail_size = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_meta_header);
-		max_ptrs = (be32_to_cpu(ea_hdr->ea_data_len)+avail_size-1)/avail_size;
-
-		if(max_ptrs > ea_hdr->ea_num_ptrs) {
-			return 1;
-		} else {
-			log_debug("  Pointers Required: %d\n"
-				  "  Pointers Reported: %d\n",
-				  max_ptrs,
-				  ea_hdr->ea_num_ptrs);
-		}
-
-
-	}
-	return 0;
-}
-
-int clear_eattr_extentry(struct gfs2_inode *ip, uint64_t *ea_data_ptr,
-			 struct gfs2_buffer_head *leaf_bh,
-			 struct gfs2_ea_header *ea_hdr,
-			 struct gfs2_ea_header *ea_hdr_prev,
-			 enum update_flags *want_updated, void *private)
-{
-	uint64_t block = be64_to_cpu(*ea_data_ptr);
-
-	*want_updated = not_updated;
-	return clear_blk_nodup(ip->i_sbd, block);
-
-}
-
-
-
diff --git a/gfs2/fsck/eattr.h b/gfs2/fsck/eattr.h
deleted file mode 100644
index b93b50b..0000000
--- a/gfs2/fsck/eattr.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef _EATTR_H
-#define _EATTR_H
-
-int clear_eattr_indir(struct gfs2_inode *ip, uint64_t block, uint64_t parent,
-		      struct gfs2_buffer_head **bh,
-		      enum update_flags *want_updated, void *private);
-int clear_eattr_leaf(struct gfs2_inode *ip, uint64_t block, uint64_t parent,
-		     struct gfs2_buffer_head **bh,
-		     enum update_flags *want_updated, void *private);
-int clear_eattr_entry (struct gfs2_inode *ip,
-					   struct gfs2_buffer_head *leaf_bh,
-					   struct gfs2_ea_header *ea_hdr,
-					   struct gfs2_ea_header *ea_hdr_prev,
-					   void *private);
-int clear_eattr_extentry(struct gfs2_inode *ip, uint64_t *ea_data_ptr,
-			 struct gfs2_buffer_head *leaf_bh,
-			 struct gfs2_ea_header *ea_hdr,
-			 struct gfs2_ea_header *ea_hdr_prev,
-			 enum update_flags *want_updated, void *private);
-
-#endif /* _EATTR_H */
diff --git a/gfs2/fsck/fs_bits.h b/gfs2/fsck/fs_bits.h
deleted file mode 100644
index 9754ae2..0000000
--- a/gfs2/fsck/fs_bits.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef __FS_BITS_H__
-#define __FS_BITS_H__
-
-/*#include "global.h" */
-#include "libgfs2.h"
-#include "fsck.h"
-
-#define BFITNOENT (0xFFFFFFFF)
-
-struct fs_bitmap
-{
-	uint32_t   bi_offset;	/* The offset in the buffer of the first byte */
-	uint32_t   bi_start;    /* The position of the first byte in this block */
-	uint32_t   bi_len;      /* The number of bytes in this block */
-};
-typedef struct fs_bitmap fs_bitmap_t;
-
-/* functions with blk #'s that are buffer relative */
-uint32_t gfs2_bitcount(unsigned char *buffer, unsigned int buflen,
-		     unsigned char state);
-uint32_t gfs2_bitfit(unsigned char *buffer, unsigned int buflen,
-		   uint32_t goal, unsigned char old_state);
-
-/* functions with blk #'s that are rgrp relative */
-uint32_t gfs2_blkalloc_internal(struct rgrp_list *rgd, uint32_t goal,
-								unsigned char old_state,
-								unsigned char new_state, int do_it);
-
-/* functions with blk #'s that are file system relative */
-int gfs2_get_bitmap(struct gfs2_sbd *sdp, uint64_t blkno,
-					struct rgrp_list *rgd);
-int gfs2_set_bitmap(struct gfs2_sbd *sdp, uint64_t blkno, int state);
-
-#endif /* __FS_BITS_H__ */
diff --git a/gfs2/fsck/fs_recovery.c b/gfs2/fsck/fs_recovery.c
deleted file mode 100644
index 06e71bf..0000000
--- a/gfs2/fsck/fs_recovery.c
+++ /dev/null
@@ -1,428 +0,0 @@
-#include <errno.h>
-#include <inttypes.h>
-#include <linux_endian.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <unistd.h>
-
-#include "fsck.h"
-#include "fs_recovery.h"
-#include "libgfs2.h"
-#include "util.h"
-
-unsigned int sd_found_jblocks = 0, sd_replayed_jblocks = 0;
-unsigned int sd_found_metablocks = 0, sd_replayed_metablocks = 0;
-unsigned int sd_found_revokes = 0;
-osi_list_t sd_revoke_list;
-unsigned int sd_replay_tail;
-
-struct gfs2_revoke_replay {
-	osi_list_t rr_list;
-	uint64_t rr_blkno;
-	unsigned int rr_where;
-};
-
-int gfs2_revoke_add(struct gfs2_sbd *sdp, uint64_t blkno, unsigned int where)
-{
-	osi_list_t *tmp, *head = &sd_revoke_list;
-	struct gfs2_revoke_replay *rr;
-	int found = 0;
-
-	osi_list_foreach(tmp, head) {
-		rr = osi_list_entry(tmp, struct gfs2_revoke_replay, rr_list);
-		if (rr->rr_blkno == blkno) {
-			found = 1;
-			break;
-		}
-	}
-
-	if (found) {
-		rr->rr_where = where;
-		return 0;
-	}
-
-	rr = malloc(sizeof(struct gfs2_revoke_replay));
-	if (!rr)
-		return -ENOMEM;
-
-	rr->rr_blkno = blkno;
-	rr->rr_where = where;
-	osi_list_add(&rr->rr_list, head);
-	return 1;
-}
-
-int gfs2_revoke_check(struct gfs2_sbd *sdp, uint64_t blkno, unsigned int where)
-{
-	osi_list_t *tmp;
-	struct gfs2_revoke_replay *rr;
-	int wrap, a, b, revoke;
-	int found = 0;
-
-	osi_list_foreach(tmp, &sd_revoke_list) {
-		rr = osi_list_entry(tmp, struct gfs2_revoke_replay, rr_list);
-		if (rr->rr_blkno == blkno) {
-			found = 1;
-			break;
-		}
-	}
-
-	if (!found)
-		return 0;
-
-	wrap = (rr->rr_where < sd_replay_tail);
-	a = (sd_replay_tail < where);
-	b = (where < rr->rr_where);
-	revoke = (wrap) ? (a || b) : (a && b);
-	return revoke;
-}
-
-void gfs2_revoke_clean(struct gfs2_sbd *sdp)
-{
-	osi_list_t *head = &sd_revoke_list;
-	struct gfs2_revoke_replay *rr;
-
-	while (!osi_list_empty(head)) {
-		rr = osi_list_entry(head->next, struct gfs2_revoke_replay, rr_list);
-		osi_list_del(&rr->rr_list);
-		free(rr);
-	}
-}
-
-static int buf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
-				struct gfs2_log_descriptor *ld, __be64 *ptr,
-				int pass)
-{
-	struct gfs2_sbd *sdp = ip->i_sbd;
-	unsigned int blks = be32_to_cpu(ld->ld_data1);
-	struct gfs2_buffer_head *bh_log, *bh_ip;
-	uint64_t blkno;
-	int error = 0;
-	enum update_flags if_modified;
-
-	if (pass != 1 || be32_to_cpu(ld->ld_type) != GFS2_LOG_DESC_METADATA)
-		return 0;
-
-	gfs2_replay_incr_blk(ip, &start);
-
-	for (; blks; gfs2_replay_incr_blk(ip, &start), blks--) {
-		uint32_t check_magic;
-
-		sd_found_metablocks++;
-
-		blkno = be64_to_cpu(*ptr);
-		ptr++;
-		if (gfs2_revoke_check(sdp, blkno, start))
-			continue;
-
-		error = gfs2_replay_read_block(ip, start, &bh_log);
-		if (error)
-			return error;
-
-		bh_ip = bget(&sdp->buf_list, blkno);
-		memcpy(bh_ip->b_data, bh_log->b_data, sdp->bsize);
-
-		check_magic = ((struct gfs2_meta_header *)
-			       (bh_ip->b_data))->mh_magic;
-		check_magic = be32_to_cpu(check_magic);
-		if (check_magic != GFS2_MAGIC) {
-			if_modified = not_updated;
-			error = -EIO;
-		} else
-			if_modified = updated;
-
-		brelse(bh_log, not_updated);
-		brelse(bh_ip, if_modified);
-		if (error)
-			break;
-
-		sd_replayed_metablocks++;
-	}
-	return error;
-}
-
-static int revoke_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
-				   struct gfs2_log_descriptor *ld, __be64 *ptr,
-				   int pass)
-{
-	struct gfs2_sbd *sdp = ip->i_sbd;
-	unsigned int blks = be32_to_cpu(ld->ld_length);
-	unsigned int revokes = be32_to_cpu(ld->ld_data1);
-	struct gfs2_buffer_head *bh;
-	unsigned int offset;
-	uint64_t blkno;
-	int first = 1;
-	int error;
-
-	if (pass != 0 || be32_to_cpu(ld->ld_type) != GFS2_LOG_DESC_REVOKE)
-		return 0;
-
-	offset = sizeof(struct gfs2_log_descriptor);
-
-	for (; blks; gfs2_replay_incr_blk(ip, &start), blks--) {
-		error = gfs2_replay_read_block(ip, start, &bh);
-		if (error)
-			return error;
-
-		if (!first) {
-			if (gfs2_check_meta(bh, GFS2_METATYPE_LB))
-				continue;
-		}
-		while (offset + sizeof(uint64_t) <= sdp->sd_sb.sb_bsize) {
-			blkno = be64_to_cpu(*(__be64 *)(bh->b_data + offset));
-			error = gfs2_revoke_add(sdp, blkno, start);
-			if (error < 0)
-				return error;
-			else if (error)
-				sd_found_revokes++;
-
-			if (!--revokes)
-				break;
-			offset += sizeof(uint64_t);
-		}
-
-		brelse(bh, updated);
-		offset = sizeof(struct gfs2_meta_header);
-		first = 0;
-	}
-	return 0;
-}
-
-static int databuf_lo_scan_elements(struct gfs2_inode *ip, unsigned int start,
-				    struct gfs2_log_descriptor *ld,
-				    __be64 *ptr, int pass)
-{
-	struct gfs2_sbd *sdp = ip->i_sbd;
-	unsigned int blks = be32_to_cpu(ld->ld_data1);
-	struct gfs2_buffer_head *bh_log, *bh_ip;
-	uint64_t blkno;
-	uint64_t esc;
-	int error = 0;
-
-	if (pass != 1 || be32_to_cpu(ld->ld_type) != GFS2_LOG_DESC_JDATA)
-		return 0;
-
-	gfs2_replay_incr_blk(ip, &start);
-	for (; blks; gfs2_replay_incr_blk(ip, &start), blks--) {
-		blkno = be64_to_cpu(*ptr);
-		ptr++;
-		esc = be64_to_cpu(*ptr);
-		ptr++;
-
-		sd_found_jblocks++;
-
-		if (gfs2_revoke_check(sdp, blkno, start))
-			continue;
-
-		error = gfs2_replay_read_block(ip, start, &bh_log);
-		if (error)
-			return error;
-
-		bh_ip = bget(&sdp->buf_list, blkno);
-		memcpy(bh_ip->b_data, bh_log->b_data, sdp->bsize);
-
-		/* Unescape */
-		if (esc) {
-			__be32 *eptr = (__be32 *)bh_ip->b_data;
-			*eptr = cpu_to_be32(GFS2_MAGIC);
-		}
-
-		brelse(bh_log, not_updated);
-		brelse(bh_ip, updated);
-
-		sd_replayed_jblocks++;
-	}
-	return error;
-}
-
-/**
- * foreach_descriptor - go through the active part of the log
- * @ip: the journal incore inode
- * @start: the first log header in the active region
- * @end: the last log header (don't process the contents of this entry))
- *
- * Call a given function once for every log descriptor in the active
- * portion of the log.
- *
- * Returns: errno
- */
-
-int foreach_descriptor(struct gfs2_inode *ip, unsigned int start,
-		       unsigned int end, int pass)
-{
-	struct gfs2_buffer_head *bh;
-	struct gfs2_log_descriptor *ld;
-	int error = 0;
-	uint32_t length;
-	__be64 *ptr;
-	unsigned int offset = sizeof(struct gfs2_log_descriptor);
-	offset += sizeof(__be64) - 1;
-	offset &= ~(sizeof(__be64) - 1);
-
-	while (start != end) {
-		uint32_t check_magic;
-
-		error = gfs2_replay_read_block(ip, start, &bh);
-		if (error)
-			return error;
-		check_magic = ((struct gfs2_meta_header *)
-			       (bh->b_data))->mh_magic;
-		check_magic = be32_to_cpu(check_magic);
-		if (check_magic != GFS2_MAGIC) {
-			brelse(bh, updated);
-			return -EIO;
-		}
-		ld = (struct gfs2_log_descriptor *)bh->b_data;
-		length = be32_to_cpu(ld->ld_length);
-
-		if (be32_to_cpu(ld->ld_header.mh_type) == GFS2_METATYPE_LH) {
-			struct gfs2_log_header lh;
-
-			error = get_log_header(ip, start, &lh);
-			if (!error) {
-				gfs2_replay_incr_blk(ip, &start);
-				brelse(bh, updated);
-				continue;
-			}
-			if (error == 1)
-				error = -EIO;
-			brelse(bh, updated);
-			return error;
-		} else if (gfs2_check_meta(bh, GFS2_METATYPE_LD)) {
-			brelse(bh, updated);
-			return -EIO;
-		}
-		ptr = (__be64 *)(bh->b_data + offset);
-		error = databuf_lo_scan_elements(ip, start, ld, ptr, pass);
-		if (error) {
-			brelse(bh, updated);
-			return error;
-		}
-		error = buf_lo_scan_elements(ip, start, ld, ptr, pass);
-		if (error) {
-			brelse(bh, updated);
-			return error;
-		}
-		error = revoke_lo_scan_elements(ip, start, ld, ptr, pass);
-		if (error) {
-			brelse(bh, updated);
-			return error;
-		}
-
-		while (length--)
-			gfs2_replay_incr_blk(ip, &start);
-
-		brelse(bh, updated);
-	}
-
-	return 0;
-}
-
-/**
- * gfs2_recover_journal - recovery a given journal
- * @ip: the journal incore inode
- *
- * Acquire the journal's lock, check to see if the journal is clean, and
- * do recovery if necessary.
- *
- * Returns: errno
- */
-
-int gfs2_recover_journal(struct gfs2_inode *ip, int j)
-{
-	struct gfs2_sbd *sdp = ip->i_sbd;
-	struct gfs2_log_header head;
-	unsigned int pass;
-	int error;
-
-	log_info("jid=%u: Looking at journal...\n", j);
-
-	osi_list_init(&sd_revoke_list);
-	error = gfs2_find_jhead(ip, &head);
-	if (error)
-		goto out;
-
-	if (head.lh_flags & GFS2_LOG_HEAD_UNMOUNT) {
-		log_info("jid=%u: Journal is clean.\n", j);
-		return 0;
-	}
-	if (query(&opts, "\nJournal #%d (\"journal%d\") is dirty.  Okay to replay it? (y/n)",
-		    j+1, j)) {
-		log_info("jid=%u: Replaying journal...\n", j);
-
-		sd_found_jblocks = sd_replayed_jblocks = 0;
-		sd_found_metablocks = sd_replayed_metablocks = 0;
-		sd_found_revokes = 0;
-		sd_replay_tail = head.lh_tail;
-		for (pass = 0; pass < 2; pass++) {
-			error = foreach_descriptor(ip, head.lh_tail,
-						   head.lh_blkno, pass);
-			if (error)
-				goto out;
-		}
-		log_info("jid=%u: Found %u revoke tags\n", j,
-			 sd_found_revokes);
-		gfs2_revoke_clean(sdp);
-		error = clean_journal(ip, &head);
-		if (error)
-			goto out;
-		log_err("jid=%u: Replayed %u of %u journaled data blocks\n",
-			j, sd_replayed_jblocks, sd_found_jblocks);
-		log_err("jid=%u: Replayed %u of %u metadata blocks\n",
-			j, sd_replayed_metablocks, sd_found_metablocks);
-	} else {
-		if (query(&opts, "Do you want to clear the dirty journal instead? (y/n)")) {
-			write_journal(sdp, sdp->md.journal[j], j,
-				      sdp->md.journal[j]->i_di.di_size /
-				      sdp->sd_sb.sb_bsize);
-			
-		} else
-			log_err("jid=%u: Dirty journal not replayed or cleared.\n", j);
-	}
-
-out:
-	log_info("jid=%u: %s\n", j, (error) ? "Failed" : "Done");
-	return error;
-}
-
-/*
- * replay_journals - replay the journals
- * sdp: the super block
- *
- * There should be a flag to the fsck to enable/disable this
- * feature.  The fsck falls back to clearing the journal if an 
- * inconsistency is found, but only for the bad journal.
- *
- * Returns: 0 on success, -1 on failure
- */
-int replay_journals(struct gfs2_sbd *sdp){
-	int i;
-
-	log_notice("Recovering journals (this may take a while)");
-
-	/* Get master dinode */
-	sdp->master_dir = gfs2_load_inode(sdp,
-					  sdp->sd_sb.sb_master_dir.no_addr);
-	gfs2_lookupi(sdp->master_dir, "jindex", 6, &sdp->md.jiinode);
-
-	/* read in the journal index data */
-	if (ji_update(sdp)){
-		log_err("Unable to read in jindex inode.\n");
-		return -1;
-	}
-
-	for(i = 0; i < sdp->md.journals; i++) {
-		if((i % 2) == 0)
-			log_at_notice(".");
-		gfs2_recover_journal(sdp->md.journal[i], i);
-		inode_put(sdp->md.journal[i],
-			  (opts.no ? not_updated : updated));
-	}
-	log_notice("\nJournal recovery complete.\n");
-	inode_put(sdp->master_dir, not_updated);
-	inode_put(sdp->md.jiinode, not_updated);
-	/* Sync the buffers to disk so we get a fresh start. */
-	bsync(&sdp->buf_list);
-	bsync(&sdp->nvbuf_list);
-	return 0;
-}
diff --git a/gfs2/fsck/fs_recovery.h b/gfs2/fsck/fs_recovery.h
deleted file mode 100644
index 484ea67..0000000
--- a/gfs2/fsck/fs_recovery.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef __FS_RECOVERY_H__
-#define __FS_RECOVERY_H__
-
-#include "libgfs2.h"
-
-int replay_journals(struct gfs2_sbd *sdp);
-
-#endif /* __FS_RECOVERY_H__ */
-
diff --git a/gfs2/fsck/fsck.h b/gfs2/fsck/fsck.h
deleted file mode 100644
index 3bf618c..0000000
--- a/gfs2/fsck/fsck.h
+++ /dev/null
@@ -1,81 +0,0 @@
-#ifndef _FSCK_H
-#define _FSCK_H
-
-#include "libgfs2.h"
-
-#define FSCK_HASH_SHIFT         (13)
-#define FSCK_HASH_SIZE          (1 << FSCK_HASH_SHIFT)
-#define FSCK_HASH_MASK          (FSCK_HASH_SIZE - 1)
-
-#define query(opts, fmt, args...) gfs2_query(&fsck_abort, opts, fmt, ##args)
-
-struct inode_info
-{
-        osi_list_t list;
-        uint64_t   inode;
-        uint16_t   link_count;   /* the number of links the inode
-                                  * thinks it has */
-        uint16_t   counted_links; /* the number of links we've found */
-};
-
-struct dir_info
-{
-        osi_list_t list;
-        uint64_t dinode;
-        uint64_t treewalk_parent;
-        uint64_t dotdot_parent;
-        uint8_t  checked:1;
-
-};
-
-struct dir_status {
-	uint8_t dotdir:1;
-	uint8_t dotdotdir:1;
-	struct gfs2_block_query q;
-	uint32_t entry_count;
-};
-
-enum rgindex_trust_level { /* how far can we trust our RG index? */
-	blind_faith = 0, /* We'd like to trust the rgindex. We always used to
-			    before bz 179069. This should cover most cases. */
-	open_minded = 1, /* At least 1 RG is corrupt. Try to calculate what it
-			    should be, in a perfect world where our RGs are all
-			    on even boundaries. Blue sky. Chirping birds. */
-	distrust = 2   /* The world isn't perfect, our RGs are not on nice neat
-			  boundaries.  The fs must have been messed with by
-			  gfs2_grow or something.  Count the RGs by hand. */
-};
-
-struct gfs2_inode *get_system_inode(struct gfs2_sbd *sbp, uint64_t block);
-struct gfs2_inode *fsck_load_inode(struct gfs2_sbd *sbp, uint64_t block);
-struct gfs2_inode *fsck_inode_get(struct gfs2_sbd *sdp,
-				  struct gfs2_buffer_head *bh);
-void fsck_inode_put(struct gfs2_inode *ip, enum update_flags update);
-
-int initialize(struct gfs2_sbd *sbp);
-void destroy(struct gfs2_sbd *sbp);
-int block_mounters(struct gfs2_sbd *sbp, int block_em);
-int pass1(struct gfs2_sbd *sbp);
-int pass1b(struct gfs2_sbd *sbp);
-int pass1c(struct gfs2_sbd *sbp);
-int pass2(struct gfs2_sbd *sbp);
-int pass3(struct gfs2_sbd *sbp);
-int pass4(struct gfs2_sbd *sbp);
-int pass5(struct gfs2_sbd *sbp);
-int rg_repair(struct gfs2_sbd *sdp, int trust_lvl, int *rg_count);
-
-/* FIXME: Hack to get this going for pass2 - this should be pulled out
- * of pass1 and put somewhere else... */
-int add_to_dir_list(struct gfs2_sbd *sbp, uint64_t block);
-
-extern struct gfs2_options opts;
-extern struct gfs2_inode *lf_dip; /* Lost and found directory inode */
-extern osi_list_t dir_hash[FSCK_HASH_SIZE];
-extern osi_list_t inode_hash[FSCK_HASH_SIZE];
-extern struct gfs2_block_list *bl;
-extern uint64_t last_fs_block, last_reported_block;
-extern int skip_this_pass, fsck_abort, fsck_query;
-extern uint64_t last_data_block;
-extern uint64_t first_data_block;
-
-#endif /* _FSCK_H */
diff --git a/gfs2/fsck/hash.c b/gfs2/fsck/hash.c
deleted file mode 100644
index 9f09111..0000000
--- a/gfs2/fsck/hash.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/* This is the same hash algorithm used by the glocks in gfs */
-
-#include <stdint.h>
-#include <unistd.h>
-#include "libgfs2.h"
-#include "hash.h"
-#include "osi_list.h"
-
-/**
- * hash_more_internal - hash an array of data
- * @data: the data to be hashed
- * @len: the length of data to be hashed
- * @hash: the hash from a previous call
- *
- * Take some data and convert it to a 32-bit hash.
- *
- * This is the 32-bit FNV-1a hash from:
- * http://www.isthe.com/chongo/tech/comp/fnv/
- *
- * Hash guts
- *
- * Returns: the hash
- */
-
-static __inline__ uint32_t
-hash_more_internal(const void *data, unsigned int len, uint32_t hash)
-{
-	unsigned char *p = (unsigned char *) data;
-	unsigned char *e = p + len;
-	uint32_t h = hash;
-
-	while (p < e) {
-		h ^= (uint32_t) (*p++);
-		h *= 0x01000193;
-	}
-
-	return h;
-}
-
-/**
- * fsck_hash - hash an array of data
- * @data: the data to be hashed
- * @len: the length of data to be hashed
- *
- * Take some data and convert it to a 32-bit hash.
- *
- * This is the 32-bit FNV-1a hash from:
- * http://www.isthe.com/chongo/tech/comp/fnv/
- *
- * Returns: the hash
- */
-
-uint32_t
-fsck_hash(const void *data, unsigned int len)
-{
-	uint32_t h = 0x811C9DC5;
-	h = hash_more_internal(data, len, h);
-	return h;
-}
-
-/**
- * fsck_hash_more - hash an array of data
- * @data: the data to be hashed
- * @len: the length of data to be hashed
- * @hash: the hash from a previous call
- *
- * Take some data and convert it to a 32-bit hash.
- *
- * This is the 32-bit FNV-1a hash from:
- * http://www.isthe.com/chongo/tech/comp/fnv/
- *
- * This version let's you hash together discontinuous regions.
- * For example, to compute the combined hash of the memory in
- * (data1, len1), (data2, len2), and (data3, len3) you:
- *
- *   h = fsck_hash(data1, len1);
- *   h = fsck_hash_more(data2, len2, h);
- *   h = fsck_hash_more(data3, len3, h);
- *
- * Returns: the hash
- */
-
-uint32_t
-fsck_hash_more(const void *data, unsigned int len, uint32_t hash)
-{
-	uint32_t h;
-	h = hash_more_internal(data, len, hash);
-	return h;
-}
-
-
diff --git a/gfs2/fsck/hash.h b/gfs2/fsck/hash.h
deleted file mode 100644
index d5fe8e9..0000000
--- a/gfs2/fsck/hash.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef _HASH_H
-#define _HASH_H
-
-uint32_t fsck_hash(const void *data, unsigned int len);
-uint32_t fsck_hash_more(const void *data, unsigned int len, uint32_t hash);
-
-#endif				/* _HASH_H  */
diff --git a/gfs2/fsck/initialize.c b/gfs2/fsck/initialize.c
deleted file mode 100644
index 83f5d4c..0000000
--- a/gfs2/fsck/initialize.c
+++ /dev/null
@@ -1,396 +0,0 @@
-#include <linux_endian.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "libgfs2.h"
-#include "fsck.h"
-#include "util.h"
-#include "fs_recovery.h"
-#include "linux_endian.h"
-
-#define CLEAR_POINTER(x) \
-	if(x) { \
-		free(x); \
-		x = NULL; \
-	}
-
-/**
- * init_journals
- *
- * Go through journals and replay them - then clear them
- */
-int init_journals(struct gfs2_sbd *sbp)
-{
-	if(!opts.no) {
-		if(replay_journals(sbp))
-			return 1;
-	}
-	return 0;
-}
-
-/**
- * block_mounters
- *
- * Change the lock protocol so nobody can mount the fs
- *
- */
-int block_mounters(struct gfs2_sbd *sbp, int block_em)
-{
-	if(block_em) {
-		/* verify it starts with lock_ */
-		if(!strncmp(sbp->sd_sb.sb_lockproto, "lock_", 5)) {
-			/* Change lock_ to fsck_ */
-			memcpy(sbp->sd_sb.sb_lockproto, "fsck_", 5);
-		}
-		/* FIXME: Need to do other verification in the else
-		 * case */
-	} else {
-		/* verify it starts with fsck_ */
-		/* verify it starts with lock_ */
-		if(!strncmp(sbp->sd_sb.sb_lockproto, "fsck_", 5)) {
-			/* Change fsck_ to lock_ */
-			memcpy(sbp->sd_sb.sb_lockproto, "lock_", 5);
-		}
-	}
-
-	if(write_sb(sbp)) {
-		stack;
-		return -1;
-	}
-	return 0;
-}
-
-
-/*
- * empty_super_block - free all structures in the super block
- * sdp: the in-core super block
- *
- * This function frees all allocated structures within the
- * super block.  It does not free the super block itself.
- *
- * Returns: Nothing
- */
-static void empty_super_block(struct gfs2_sbd *sdp)
-{
-	uint32_t i;
-
-	log_info("Freeing buffers.\n");
-	while(!osi_list_empty(&sdp->rglist)){
-		struct rgrp_list *rgd;
-
-		rgd = osi_list_entry(sdp->rglist.next, struct rgrp_list, list);
-		log_debug("Deleting rgd for 0x%p:  rgd=0x%p bits=0x%p\n",
-			  rgd->ri.ri_addr, rgd, rgd->bits);
-		osi_list_del(&rgd->list);
-		if(rgd->bits)
-			free(rgd->bits);
-		free(rgd);
-	}
-
-	for(i = 0; i < FSCK_HASH_SIZE; i++) {
-		while(!osi_list_empty(&inode_hash[i])) {
-			struct inode_info *ii;
-			ii = osi_list_entry(inode_hash[i].next, struct inode_info, list);
-			osi_list_del(&ii->list);
-			free(ii);
-		}
-		while(!osi_list_empty(&dir_hash[i])) {
-			struct dir_info *di;
-			di = osi_list_entry(dir_hash[i].next, struct dir_info, list);
-			osi_list_del(&di->list);
-			free(di);
-		}
-	}
-
-	gfs2_block_list_destroy(sdp, bl);
-}
-
-
-/**
- * set_block_ranges
- * @sdp: superblock
- *
- * Uses info in rgrps and jindex to determine boundaries of the
- * file system.
- *
- * Returns: 0 on success, -1 on failure
- */
-static int set_block_ranges(struct gfs2_sbd *sdp)
-{
-
-	struct rgrp_list *rgd;
-	struct gfs2_rindex *ri;
-	osi_list_t *tmp;
-	char buf[sdp->sd_sb.sb_bsize];
-	uint64_t rmax = 0;
-	uint64_t rmin = 0;
-	int error;
-
-	log_info("Setting block ranges...\n");
-
-	for (tmp = sdp->rglist.next; tmp != &sdp->rglist; tmp = tmp->next)
-	{
-		rgd = osi_list_entry(tmp, struct rgrp_list, list);
-		ri = &rgd->ri;
-		if (ri->ri_data0 + ri->ri_data - 1 > rmax)
-			rmax = ri->ri_data0 + ri->ri_data - 1;
-		if (!rmin || ri->ri_data0 < rmin)
-			rmin = ri->ri_data0;
-	}
-
-	last_fs_block = rmax;
-	if (last_fs_block > 0xffffffff && sizeof(unsigned long) <= 4) {
-		log_crit("This file system is too big for this computer to handle.\n");
-		log_crit("Last fs block = 0x%llx, but sizeof(unsigned long) is %d bytes.\n",
-				 last_fs_block, sizeof(unsigned long));
-		goto fail;
-	}
-
-	last_data_block = rmax;
-	first_data_block = rmin;
-
-	if(fsck_lseek(sdp->device_fd, (last_fs_block * sdp->sd_sb.sb_bsize))){
-		log_crit("Can't seek to last block in file system: %"
-				 PRIu64" (0x%" PRIx64 ")\n", last_fs_block, last_fs_block);
-		goto fail;
-	}
-
-	memset(buf, 0, sdp->sd_sb.sb_bsize);
-	error = read(sdp->device_fd, buf, sdp->sd_sb.sb_bsize);
-	if (error != sdp->sd_sb.sb_bsize){
-		log_crit("Can't read last block in file system (error %u), "
-				 "last_fs_block: %"PRIu64" (0x%" PRIx64 ")\n", error,
-				 last_fs_block, last_fs_block);
-		goto fail;
-	}
-
-	return 0;
-
- fail:
-	return -1;
-}
-
-/**
- * init_system_inodes
- *
- * Returns: 0 on success, -1 on failure
- */
-static int init_system_inodes(struct gfs2_sbd *sdp)
-{
-	uint64_t inumbuf;
-	char *buf;
-	struct gfs2_statfs_change sc;
-	int rgcount;
-	enum rgindex_trust_level trust_lvl;
-	uint64_t addl_mem_needed;
-
-	/*******************************************************************
-	 ******************  Initialize important inodes  ******************
-	 *******************************************************************/
-
-	log_info("Initializing special inodes...\n");
-
-	/* Get master dinode */
-	sdp->master_dir = gfs2_load_inode(sdp,
-					  sdp->sd_sb.sb_master_dir.no_addr);
-	/* Get root dinode */
-	sdp->md.rooti = gfs2_load_inode(sdp, sdp->sd_sb.sb_root_dir.no_addr);
-
-	/* Look for "inum" entry in master dinode */
-	gfs2_lookupi(sdp->master_dir, "inum", 4, &sdp->md.inum);
-	/* Read inum entry into buffer */
-	gfs2_readi(sdp->md.inum, &inumbuf, 0, sdp->md.inum->i_di.di_size);
-	/* call gfs2_inum_range_in() to retrieve range */
-	sdp->md.next_inum = be64_to_cpu(inumbuf);
-
-	gfs2_lookupi(sdp->master_dir, "statfs", 6, &sdp->md.statfs);
-	buf = malloc(sdp->md.statfs->i_di.di_size);
-	// FIXME: handle failed malloc
-	gfs2_readi(sdp->md.statfs, buf, 0, sdp->md.statfs->i_di.di_size);
-	/* call gfs2_inum_range_in() to retrieve range */
-	gfs2_statfs_change_in(&sc, buf);
-	free(buf);
-
-
-	gfs2_lookupi(sdp->master_dir, "jindex", 6, &sdp->md.jiinode);
-
-	gfs2_lookupi(sdp->master_dir, "rindex", 6, &sdp->md.riinode);
-
-	gfs2_lookupi(sdp->master_dir, "quota", 5, &sdp->md.qinode);
-
-	gfs2_lookupi(sdp->master_dir, "per_node", 8, &sdp->md.pinode);
-
-	/* FIXME fill in per_node structure */
-
-	/*******************************************************************
-	 *******  Fill in rgrp and journal indexes and related fields  *****
-	 *******************************************************************/
-
-	/* read in the ji data */
-	if (ji_update(sdp)){
-		log_err("Unable to read in ji inode.\n");
-		return -1;
-	}
-
-	log_warn("Validating Resource Group index.\n");
-	for (trust_lvl = blind_faith; trust_lvl <= distrust; trust_lvl++) {
-		log_warn("Level %d RG check.\n", trust_lvl + 1);
-		if ((rg_repair(sdp, trust_lvl, &rgcount) == 0) &&
-		    (ri_update(sdp, 0, &rgcount) == 0)) {
-			log_err("(level %d passed)\n", trust_lvl + 1);
-			break;
-		}
-		else
-			log_err("(level %d failed)\n", trust_lvl + 1);
-	}
-	if (trust_lvl > distrust) {
-		log_err("RG recovery impossible; I can't fix this file system.\n");
-		return -1;
-	}
-	log_info("%u resource groups found.\n", rgcount);
-
-	/*******************************************************************
-	 *******  Now, set boundary fields in the super block  *************
-	 *******************************************************************/
-	if(set_block_ranges(sdp)){
-		log_err("Unable to determine the boundaries of the"
-			" file system.\n");
-		goto fail;
-	}
-
-	bl = gfs2_block_list_create(sdp, last_fs_block+1, &addl_mem_needed);
-	if (!bl) {
-		log_crit("This system doesn't have enough memory + swap space to fsck this file system.\n");
-		log_crit("Additional memory needed is approximately: %ldMB\n", addl_mem_needed / 1048576);
-		log_crit("Please increase your swap space by that amount and run gfs2_fsck again.\n");
-		goto fail;
-	}
-	return 0;
- fail:
-	empty_super_block(sdp);
-
-	return -1;
-}
-
-/**
- * fill_super_block
- * @sdp:
- *
- * Returns: 0 on success, -1 on failure
- */
-static int fill_super_block(struct gfs2_sbd *sdp)
-{
-	uint32_t i;
-
-	sync();
-
-	/********************************************************************
-	 ***************** First, initialize all lists **********************
-	 ********************************************************************/
-	log_info("Initializing lists...\n");
-	osi_list_init(&sdp->rglist);
-	init_buf_list(sdp, &sdp->buf_list, 128 << 20);
-	init_buf_list(sdp, &sdp->nvbuf_list, 0xffffffff);
-	for(i = 0; i < BUF_HASH_SIZE; i++) {
-		osi_list_init(&dir_hash[i]);
-		osi_list_init(&inode_hash[i]);
-	}
-
-	/********************************************************************
-	 ************  next, read in on-disk SB and set constants  **********
-	 ********************************************************************/
-	sdp->sd_sb.sb_bsize = GFS2_DEFAULT_BSIZE;
-	sdp->bsize = sdp->sd_sb.sb_bsize;
-
-	if(sizeof(struct gfs2_sb) > sdp->sd_sb.sb_bsize){
-		log_crit("GFS superblock is larger than the blocksize!\n");
-		log_debug("sizeof(struct gfs2_sb) > sdp->sd_sb.sb_bsize\n");
-		return -1;
-	}
-
-	compute_constants(sdp);
-	if(read_sb(sdp) < 0){
-		return -1;
-	}
-
-	return 0;
-}
-
-/**
- * init_sbp - initialize superblock pointer
- *
- */
-static int init_sbp(struct gfs2_sbd *sbp)
-{
-	if(opts.no) {
-		if ((sbp->device_fd = open(opts.device, O_RDONLY)) < 0) {
-			log_crit("Unable to open device: %s\n", opts.device);
-			return -1;
-		}
-	} else {
-		/* read in sb from disk */
-		if ((sbp->device_fd = open(opts.device, O_RDWR)) < 0){
-			log_crit("Unable to open device: %s\n", opts.device);
-			return -1;
-		}
-	}
-	if (fill_super_block(sbp)) {
-		stack;
-		return -1;
-	}
-
-	/* Change lock protocol to be fsck_* instead of lock_* */
-	if(!opts.no) {
-		if(block_mounters(sbp, 1)) {
-			log_err("Unable to block other mounters\n");
-			return -1;
-		}
-	}
-
-	/* verify various things */
-
-	if(init_journals(sbp)) {
-		if(!opts.no)
-			block_mounters(sbp, 0);
-		stack;
-		return -1;
-	}
-
-	if (init_system_inodes(sbp))
-		return -1;
-
-	return 0;
-}
-
-static void destroy_sbp(struct gfs2_sbd *sbp)
-{
-	if(!opts.no) {
-		if(block_mounters(sbp, 0)) {
-			log_warn("Unable to unblock other mounters - manual intervention required\n");
-			log_warn("Use 'gfs2_tool sb <device> proto' to fix\n");
-		}
-		log_info("Syncing the device.\n");
-		fsync(sbp->device_fd);
-	}
-	empty_super_block(sbp);
-	close(sbp->device_fd);
-}
-
-int initialize(struct gfs2_sbd *sbp)
-{
-
-	return init_sbp(sbp);
-
-}
-
-void destroy(struct gfs2_sbd *sbp)
-{
-	destroy_sbp(sbp);
-}
diff --git a/gfs2/fsck/inode_hash.c b/gfs2/fsck/inode_hash.c
deleted file mode 100644
index 45efe09..0000000
--- a/gfs2/fsck/inode_hash.c
+++ /dev/null
@@ -1,77 +0,0 @@
-#include <stdint.h>
-#include <unistd.h>
-
-#include "libgfs2.h"
-#include "osi_list.h"
-#include "hash.h"
-#include "inode_hash.h"
-#include "fsck.h"
-
-static uint32_t gfs2_inode_hash(uint64_t block_no)
-{
-	unsigned int h;
-
-	h = fsck_hash(&block_no, sizeof (uint64_t));
-	h &= FSCK_HASH_MASK;
-
-	return h;
-}
-
-struct inode_info *inode_hash_search(osi_list_t *buckets, uint64_t key)
-{
-	struct inode_info *ii;
-	osi_list_t *tmp;
-	osi_list_t *bucket = &buckets[gfs2_inode_hash(key)];
-
-	osi_list_foreach(tmp, bucket) {
-		ii = osi_list_entry(tmp, struct inode_info, list);
-		if(ii->inode == key) {
-			return ii;
-		}
-	}
-	return NULL;
-}
-
-int inode_hash_insert(osi_list_t *buckets, uint64_t key, struct inode_info *ii)
-{
-	osi_list_t *tmp;
-	osi_list_t *bucket = &buckets[gfs2_inode_hash(key)];
-	struct inode_info *itmp = NULL;
-
-	if(osi_list_empty(bucket)) {
-		osi_list_add(&ii->list, bucket);
-		return 0;
-	}
-
-	osi_list_foreach(tmp, bucket) {
-		itmp = osi_list_entry(tmp, struct inode_info, list);
-		if(itmp->inode < key) {
-			continue;
-		} else {
-			osi_list_add_prev(&ii->list, tmp);
-			return 0;
-		}
-	}
-	osi_list_add_prev(&ii->list, bucket);
-	return 0;
-}
-
-
-int inode_hash_remove(osi_list_t *buckets, uint64_t key)
-{
-	osi_list_t *tmp;
-	osi_list_t *bucket = &buckets[gfs2_inode_hash(key)];
-	struct inode_info *itmp = NULL;
-
-	if(osi_list_empty(bucket)) {
-		return -1;
-	}
-	osi_list_foreach(tmp, bucket) {
-		itmp = osi_list_entry(tmp, struct inode_info, list);
-		if(itmp->inode == key) {
-			osi_list_del(tmp);
-			return 0;
-		}
-	}
-	return -1;
-}
diff --git a/gfs2/fsck/inode_hash.h b/gfs2/fsck/inode_hash.h
deleted file mode 100644
index 7e41180..0000000
--- a/gfs2/fsck/inode_hash.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef _INODE_HASH_H
-#define _INODE_HASH_H
-
-struct inode_info *inode_hash_search(osi_list_t *buckets, uint64_t block_no);
-int inode_hash_insert(osi_list_t *buckets, uint64_t key,
-					  struct inode_info *ii);
-int inode_hash_remove(osi_list_t *buckets, uint64_t key);
-
-#endif /* _INODE_HASH_H */
diff --git a/gfs2/fsck/link.c b/gfs2/fsck/link.c
deleted file mode 100644
index 1e5fe7f..0000000
--- a/gfs2/fsck/link.c
+++ /dev/null
@@ -1,98 +0,0 @@
-#include <inttypes.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "libgfs2.h"
-#include "fsck.h"
-#include "inode_hash.h"
-#include "link.h"
-
-int set_link_count(struct gfs2_sbd *sbp, uint64_t inode_no, uint32_t count)
-{
-	struct inode_info *ii = NULL;
-	log_debug("Setting link count to %u for %" PRIu64 " (0x%" PRIx64 ")\n",
-			  count, inode_no, inode_no);
-	/* If the list has entries, look for one that matches
-	 * inode_no */
-	ii = inode_hash_search(inode_hash, inode_no);
-	if(ii) {
-		if(ii->link_count) {
-			log_err("Link count already set for inode #%" PRIu64 " (0x%"
-					PRIx64 ")!\n", inode_no, inode_no);
-			stack;
-			return -1;
-		}
-		else
-			ii->link_count = count;
-	}
-	else {
-		/* If not match was found, add a new entry and set it's
-		 * link count to count*/
-		if(!(ii = (struct inode_info *) malloc(sizeof(*ii)))) {
-			log_err("Unable to allocate inode_info structure\n");
-			stack;
-			return -1;
-		}
-		memset(ii, 0, sizeof(*ii));
-		ii->inode = inode_no;
-		ii->link_count = count;
-		inode_hash_insert(inode_hash, inode_no, ii);
-	}
-	return 0;
-}
-
-int increment_link(struct gfs2_sbd *sbp, uint64_t inode_no)
-{
-	struct inode_info *ii = NULL;
-
-	ii = inode_hash_search(inode_hash, inode_no);
-	/* If the list has entries, look for one that matches
-	 * inode_no */
-	if(ii) {
-		ii->counted_links++;
-		log_debug("Incremented counted links to %u for %"PRIu64" (0x%"
-				  PRIx64 ")\n", ii->counted_links, inode_no, inode_no);
-		return 0;
-	}
-	log_debug("No match found when incrementing link for %" PRIu64
-			  " (0x%" PRIx64 ")!\n", inode_no, inode_no);
-	/* If no match was found, add a new entry and set its
-	 * counted links to 1 */
-	if(!(ii = (struct inode_info *) malloc(sizeof(*ii)))) {
-		log_err("Unable to allocate inode_info structure\n");
-		stack;
-		return -1;
-	}
-	if(!memset(ii, 0, sizeof(*ii))) {
-		log_err("Unable to zero inode_info structure\n");
-		stack;
-		return -1;
-	}
-	ii->inode = inode_no;
-	ii->counted_links = 1;
-	inode_hash_insert(inode_hash, inode_no, ii);
-
-	return 0;
-}
-
-int decrement_link(struct gfs2_sbd *sbp, uint64_t inode_no)
-{
-	struct inode_info *ii = NULL;
-
-	ii = inode_hash_search(inode_hash, inode_no);
-	/* If the list has entries, look for one that matches
-	 * inode_no */
-	log_err("Decrementing %"PRIu64" (0x%" PRIx64 ")\n", inode_no, inode_no);
-	if(ii) {
-		ii->counted_links--;
-		return 0;
-	}
-	log_debug("No match found when decrementing link for %" PRIu64
-			  " (0x%" PRIx64 ")!\n", inode_no, inode_no);
-	return -1;
-
-}
-
-
diff --git a/gfs2/fsck/link.h b/gfs2/fsck/link.h
deleted file mode 100644
index becede1..0000000
--- a/gfs2/fsck/link.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef _LINK_H
-#define _LINK_H
-
-int set_link_count(struct gfs2_sbd *sbp, uint64_t inode_no, uint32_t count);
-int increment_link(struct gfs2_sbd *sbp, uint64_t inode_no);
-int decrement_link(struct gfs2_sbd *sbp, uint64_t inode_no);
-
-#endif /* _LINK_H */
diff --git a/gfs2/fsck/lost_n_found.c b/gfs2/fsck/lost_n_found.c
deleted file mode 100644
index 72c5bbe..0000000
--- a/gfs2/fsck/lost_n_found.c
+++ /dev/null
@@ -1,146 +0,0 @@
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <dirent.h>
-
-#include "fsck.h"
-#include "libgfs2.h"
-#include "lost_n_found.h"
-#include "link.h"
-
-/* add_inode_to_lf - Add dir entry to lost+found for the inode
- * @ip: inode to add to lost + found
- *
- * This function adds an entry into the lost and found dir
- * for the given inode.  The name of the entry will be
- * "lost_<ip->i_num.no_addr>".
- *
- * Returns: 0 on success, -1 on failure.
- */
-int add_inode_to_lf(struct gfs2_inode *ip){
-	char tmp_name[256];
-	char *filename;
-	int filename_len;
-	__be32 inode_type;
-
-	if(!lf_dip) {
-		struct gfs2_block_query q = {0};
-
-		log_info("Locating/Creating lost and found directory\n");
-
-        lf_dip = createi(ip->i_sbd->md.rooti, "lost+found", S_IFDIR | 0700, 0);
-	if(gfs2_block_check(ip->i_sbd, bl, lf_dip->i_di.di_num.no_addr, &q)) {
-			stack;
-			return -1;
-		}
-		if(q.block_type != gfs2_inode_dir) {
-			/* This is a new lost+found directory, so set its
-			 * block type and increment link counts for
-			 * the directories */
-			/* FIXME: i'd feel better about this if
-			 * fs_mkdir returned whether it created a new
-			 * directory or just found an old one, and we
-			 * used that instead of the block_type to run
-			 * this */
-			gfs2_block_set(ip->i_sbd, bl,
-				       lf_dip->i_di.di_num.no_addr, gfs2_inode_dir);
-			increment_link(ip->i_sbd,
-						   ip->i_sbd->md.rooti->i_di.di_num.no_addr);
-			increment_link(ip->i_sbd, lf_dip->i_di.di_num.no_addr);
-			increment_link(ip->i_sbd, lf_dip->i_di.di_num.no_addr);
-		}
-	}
-	if(ip->i_di.di_num.no_addr == lf_dip->i_di.di_num.no_addr) {
-		log_err("Trying to add lost+found to itself...skipping");
-		return 0;
-	}
-	switch(ip->i_di.di_mode & S_IFMT){
-	case S_IFDIR:
-		log_info("Adding .. entry pointing to lost+found for %"PRIu64"\n",
-				 ip->i_di.di_num.no_addr);
-		sprintf(tmp_name, "..");
-		filename_len = strlen(tmp_name);  /* no trailing NULL */
-		if(!(filename = malloc((sizeof(char) * filename_len) + 1))) {
-			log_err("Unable to allocate name\n");
-			stack;
-			return -1;
-		}
-		if(!memset(filename, 0, (sizeof(char) * filename_len) + 1)) {
-			log_err("Unable to zero name\n");
-			stack;
-			return -1;
-		}
-		memcpy(filename, tmp_name, filename_len);
-
-		if(gfs2_dirent_del(ip, NULL, filename, filename_len))
-			log_warn("add_inode_to_lf:  "
-					 "Unable to remove \"..\" directory entry.\n");
-
-		dir_add(ip, filename, filename_len, &(lf_dip->i_di.di_num), DT_DIR);
-		free(filename);
-		sprintf(tmp_name, "lost_dir_%llu",
-			(unsigned long long)ip->i_di.di_num.no_addr);
-		inode_type = DT_DIR;
-		break;
-	case S_IFREG:
-		sprintf(tmp_name, "lost_file_%llu",
-			(unsigned long long)ip->i_di.di_num.no_addr);
-		inode_type = DT_REG;
-		break;
-	case S_IFLNK:
-		sprintf(tmp_name, "lost_link_%llu",
-			(unsigned long long)ip->i_di.di_num.no_addr);
-		inode_type = DT_LNK;
-		break;
-	case S_IFBLK:
-		sprintf(tmp_name, "lost_blkdev_%llu",
-			(unsigned long long)ip->i_di.di_num.no_addr);
-		inode_type = DT_BLK;
-		break;
-	case S_IFCHR:
-		sprintf(tmp_name, "lost_chrdev_%llu",
-			(unsigned long long)ip->i_di.di_num.no_addr);
-		inode_type = DT_CHR;
-		break;
-	case S_IFIFO:
-		sprintf(tmp_name, "lost_fifo_%llu",
-			(unsigned long long)ip->i_di.di_num.no_addr);
-		inode_type = DT_FIFO;
-		break;
-	case S_IFSOCK:
-		sprintf(tmp_name, "lost_socket_%llu",
-			(unsigned long long)ip->i_di.di_num.no_addr);
-		inode_type = DT_SOCK;
-		break;
-	default:
-		sprintf(tmp_name, "lost_%llu",
-			(unsigned long long)ip->i_di.di_num.no_addr);
-		inode_type = DT_REG;
-		break;
-	}
-	filename_len = strlen(tmp_name);  /* no trailing NULL */
-	if(!(filename = malloc(sizeof(char) * filename_len))) {
-		log_err("Unable to allocate name\n");
-			stack;
-			return -1;
-		}
-	if(!memset(filename, 0, sizeof(char) * filename_len)) {
-		log_err("Unable to zero name\n");
-		stack;
-		return -1;
-	}
-	memcpy(filename, tmp_name, filename_len);
-
-	dir_add(lf_dip, filename, filename_len, &(ip->i_di.di_num), inode_type);
-  	increment_link(ip->i_sbd, ip->i_di.di_num.no_addr);
-	if(S_ISDIR(ip->i_di.di_mode))
-		increment_link(ip->i_sbd, lf_dip->i_di.di_num.no_addr);
-
-	free(filename);
-	log_notice("Added inode #%"PRIu64" to lost+found dir\n",
-			   ip->i_di.di_num.no_addr);
-	return 0;
-}
diff --git a/gfs2/fsck/lost_n_found.h b/gfs2/fsck/lost_n_found.h
deleted file mode 100644
index f28a1d9..0000000
--- a/gfs2/fsck/lost_n_found.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef __LOST_N_FOUND_H__
-#define __LOST_N_FOUND_H__
-
-#include "libgfs2.h"
-
-int add_inode_to_lf(struct gfs2_inode *ip);
-
-#endif /* __LOST_N_FOUND_H__ */
diff --git a/gfs2/fsck/main.c b/gfs2/fsck/main.c
deleted file mode 100644
index 17c9772..0000000
--- a/gfs2/fsck/main.c
+++ /dev/null
@@ -1,380 +0,0 @@
-#include <unistd.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <libgen.h>
-#include <string.h>
-#include <stdarg.h>
-#include <ctype.h>
-#include <signal.h>
-
-#include "copyright.cf"
-#include "libgfs2.h"
-#include "fsck.h"
-#include "osi_list.h"
-
-struct gfs2_options opts = {0};
-struct gfs2_inode *lf_dip; /* Lost and found directory inode */
-osi_list_t dir_hash[FSCK_HASH_SIZE];
-osi_list_t inode_hash[FSCK_HASH_SIZE];
-struct gfs2_block_list *bl;
-uint64_t last_fs_block, last_reported_block = -1;
-int skip_this_pass = FALSE, fsck_abort = FALSE;
-const char *pass = "";
-uint64_t last_data_block;
-uint64_t first_data_block;
-char *prog_name = "gfs2_fsck"; /* needed by libgfs2 */
-
-/* This function is for libgfs2's sake.                                      */
-void print_it(const char *label, const char *fmt, const char *fmt2, ...)
-{
-	va_list args;
-
-	va_start(args, fmt2);
-	printf("%s: ", label);
-	vprintf(fmt, args);
-	va_end(args);
-}
-
-void usage(char *name)
-{
-	printf("Usage: %s [-hnqvVy] <device> \n", basename(name));
-}
-
-void version(void)
-{
-	printf("GFS2 fsck %s (built %s %s)\n",
-	       RELEASE_VERSION, __DATE__, __TIME__);
-	printf("%s\n", REDHAT_COPYRIGHT);
-}
-
-int read_cmdline(int argc, char **argv, struct gfs2_options *opts)
-{
-	int c;
-
-	while((c = getopt(argc, argv, "hnqvyV")) != -1) {
-		switch(c) {
-
-		case 'h':
-			usage(argv[0]);
-			exit(0);
-			break;
-		case 'n':
-			opts->no = 1;
-			break;
-		case 'q':
-			decrease_verbosity();
-			break;
-		case 'v':
-			increase_verbosity();
-			break;
-		case 'V':
-			version();
-			exit(0);
-			break;
-		case 'y':
-			opts->yes = 1;
-			break;
-		case ':':
-		case '?':
-			fprintf(stderr, "Please use '-h' for usage.\n");
-			exit(1);
-			break;
-		default:
-			fprintf(stderr, "Bad programmer! You forgot to catch"
-				" the %c flag\n", c);
-			exit(1);
-			break;
-
-		}
-	}
-	if(argc > optind) {
-		opts->device = (argv[optind]);
-		if(!opts->device) {
-			fprintf(stderr, "Please use '-h' for usage.\n");
-			exit(1);
-		}
-	} else {
-		fprintf(stderr, "No device specified.  Use '-h' for usage.\n");
-		exit(1);
-	}
-	return 0;
-}
-
-void interrupt(int sig)
-{
-	char response;
-	char progress[PATH_MAX];
-
-	if (!last_reported_block || last_reported_block == last_fs_block)
-		sprintf(progress, "progress unknown.\n");
-	else
-		sprintf(progress, "processing block %" PRIu64 " out of %"
-			PRIu64 "\n", last_reported_block, last_fs_block);
-	
-	response = generic_interrupt("gfs2_fsck", pass, progress,
-				     "Do you want to abort gfs2_fsck, skip " \
-				     "the rest of this pass or continue " \
-				     "(a/s/c)?", "asc");
-	if(tolower(response) == 's') {
-		skip_this_pass = TRUE;
-		return;
-	}
-	else if (tolower(response) == 'a') {
-		fsck_abort = TRUE;
-		return;
-	}
-}
-
-/* Check system inode and verify it's marked "in use" in the bitmap:       */
-/* Should work for all system inodes: root, master, jindex, per_node, etc. */
-int check_system_inode(struct gfs2_inode *sysinode, const char *filename,
-		       void builder(struct gfs2_sbd *sbp),
-		       enum gfs2_mark_block mark)
-{
-	uint64_t iblock = 0;
-	struct dir_status ds = {0};
-
-	log_info("Checking system inode '%s'\n", filename);
-	if (sysinode) {
-		/* Read in the system inode, look at its dentries, and start
-		 * reading through them */
-		iblock = sysinode->i_di.di_num.no_addr;
-		log_info("System inode for '%s' is located at block %"
-			 PRIu64 " (0x%" PRIx64 ")\n", filename,
-			 iblock, iblock);
-		
-		/* FIXME: check this block's validity */
-
-		if(gfs2_block_check(sysinode->i_sbd, bl, iblock, &ds.q)) {
-			log_crit("Can't get %s inode block %" PRIu64 " (0x%"
-				 PRIx64 ") from block list\n", filename,
-				 iblock, iblock);
-			return -1;
-		}
-		/* If the inode exists but the block is marked      */
-		/* free, we might be recovering from a corrupt      */
-		/* bitmap.  In that case, don't rebuild the inode.  */
-		/* Just reuse the inode and fix the bitmap.         */
-		if (ds.q.block_type == gfs2_block_free) {
-			log_info("The inode exists but the block is not marked 'in use'; fixing it.\n");
-			gfs2_block_set(sysinode->i_sbd, bl,
-				       sysinode->i_di.di_num.no_addr,
-				       mark);
-			ds.q.block_type = mark;
-			if (mark == gfs2_inode_dir)
-				add_to_dir_list(sysinode->i_sbd,
-						sysinode->i_di.di_num.no_addr);
-		}
-	}
-	else
-		log_info("System inode for '%s' is missing.\n", filename);
-	/* If there are errors with the inode here, we need to
-	 * create a new inode and get it all setup - of course,
-	 * everything will be in lost+found then, but we *need* our
-	 * system inodes before we can do any of that. */
-	if(!sysinode || ds.q.block_type != mark) {
-		log_err("Invalid or missing %s system inode.\n", filename);
-		if (query(&opts, "Create new %s system inode? (y/n) ",
-			  filename)) {
-			builder(sysinode->i_sbd);
-			gfs2_block_set(sysinode->i_sbd, bl,
-				       sysinode->i_di.di_num.no_addr,
-				       mark);
-			ds.q.block_type = mark;
-			if (mark == gfs2_inode_dir)
-				add_to_dir_list(sysinode->i_sbd,
-						sysinode->i_di.di_num.no_addr);
-		}
-		else {
-			log_err("Cannot continue without valid %s inode\n",
-				filename);
-			return -1;
-		}
-	}
-
-	return 0;
-}
-
-int check_system_inodes(struct gfs2_sbd *sdp)
-{
-	/*******************************************************************
-	 *******  Check the system inode integrity             *************
-	 *******************************************************************/
-	if (check_system_inode(sdp->master_dir, "master", build_master,
-			       gfs2_inode_dir)) {
-		stack;
-		return -1;
-	}
-	if (check_system_inode(sdp->md.rooti, "root", build_root,
-			       gfs2_inode_dir)) {
-		stack;
-		return -1;
-	}
-	if (check_system_inode(sdp->md.inum, "inum", build_inum,
-			       gfs2_inode_file)) {
-		stack;
-		return -1;
-	}
-	if (check_system_inode(sdp->md.statfs, "statfs", build_statfs,
-			       gfs2_inode_file)) {
-		stack;
-		return -1;
-	}
-	if (check_system_inode(sdp->md.jiinode, "jindex", build_jindex,
-			       gfs2_inode_dir)) {
-		stack;
-		return -1;
-	}
-	if (check_system_inode(sdp->md.riinode, "rindex", build_rindex,
-			       gfs2_inode_file)) {
-		stack;
-		return -1;
-	}
-	if (check_system_inode(sdp->md.qinode, "quota", build_quota,
-			       gfs2_inode_file)) {
-		stack;
-		return -1;
-	}
-	if (check_system_inode(sdp->md.pinode, "per_node", build_per_node,
-			       gfs2_inode_dir)) {
-		stack;
-		return -1;
-	}
-	return 0;
-}
-
-int main(int argc, char **argv)
-{
-	struct gfs2_sbd sb;
-	struct gfs2_sbd *sbp = &sb;
-	int j;
-	enum update_flags update_sys_files;
-
-	memset(sbp, 0, sizeof(*sbp));
-
-	if(read_cmdline(argc, argv, &opts))
-		return 1;
-	setbuf(stdout, NULL);
-	log_notice("Initializing fsck\n");
-	if (initialize(sbp))
-		return 1;
-
-	signal(SIGINT, interrupt);
-	log_notice("Starting pass1\n");
-	pass = "pass 1";
-	last_reported_block = 0;
-	if (pass1(sbp))
-		return 1;
-	if (skip_this_pass || fsck_abort) {
-		skip_this_pass = FALSE;
-		log_notice("Pass1 interrupted   \n");
-	}
-	else
-		log_notice("Pass1 complete      \n");
-
-	/* Make sure the system inodes are okay & represented in the bitmap. */
-	check_system_inodes(sbp);
-
-	if (!fsck_abort) {
-		last_reported_block = 0;
-		pass = "pass 1b";
-		log_notice("Starting pass1b\n");
-		if(pass1b(sbp))
-			return 1;
-		if (skip_this_pass || fsck_abort) {
-			skip_this_pass = FALSE;
-			log_notice("Pass1b interrupted   \n");
-		}
-		else
-			log_notice("Pass1b complete\n");
-	}
-	if (!fsck_abort) {
-		last_reported_block = 0;
-		pass = "pass 1c";
-		log_notice("Starting pass1c\n");
-		if(pass1c(sbp))
-			return 1;
-		if (skip_this_pass || fsck_abort) {
-			skip_this_pass = FALSE;
-			log_notice("Pass1c interrupted   \n");
-		}
-		else
-			log_notice("Pass1c complete\n");
-	}
-	if (!fsck_abort) {
-		last_reported_block = 0;
-		pass = "pass 2";
-		log_notice("Starting pass2\n");
-		if (pass2(sbp))
-			return 1;
-		if (skip_this_pass || fsck_abort) {
-			skip_this_pass = FALSE;
-			log_notice("Pass2 interrupted   \n");
-		}
-		else
-			log_notice("Pass2 complete      \n");
-	}
-	if (!fsck_abort) {
-		last_reported_block = 0;
-		pass = "pass 3";
-		log_notice("Starting pass3\n");
-		if (pass3(sbp))
-			return 1;
-		if (skip_this_pass || fsck_abort) {
-			skip_this_pass = FALSE;
-			log_notice("Pass3 interrupted   \n");
-		}
-		else
-			log_notice("Pass3 complete      \n");
-	}
-	if (!fsck_abort) {
-		last_reported_block = 0;
-		pass = "pass 4";
-		log_notice("Starting pass4\n");
-		if (pass4(sbp))
-			return 1;
-		if (skip_this_pass || fsck_abort) {
-			skip_this_pass = FALSE;
-			log_notice("Pass4 interrupted   \n");
-		}
-		else
-			log_notice("Pass4 complete      \n");
-	}
-	if (!fsck_abort) {
-		last_reported_block = 0;
-		pass = "pass 5";
-		log_notice("Starting pass5\n");
-		if (pass5(sbp))
-			return 1;
-		if (skip_this_pass || fsck_abort) {
-			skip_this_pass = FALSE;
-			log_notice("Pass5 interrupted   \n");
-		}
-		else
-			log_notice("Pass5 complete      \n");
-	}
-	update_sys_files = (opts.no ? not_updated : updated);
-	/* Free up our system inodes */
-	inode_put(sbp->md.inum, update_sys_files);
-	inode_put(sbp->md.statfs, update_sys_files);
-	for (j = 0; j < sbp->md.journals; j++)
-		inode_put(sbp->md.journal[j], update_sys_files);
-	inode_put(sbp->md.jiinode, update_sys_files);
-	inode_put(sbp->md.riinode, update_sys_files);
-	inode_put(sbp->md.qinode, update_sys_files);
-	inode_put(sbp->md.pinode, update_sys_files);
-	inode_put(sbp->md.rooti, update_sys_files);
-	inode_put(sbp->master_dir, update_sys_files);
-	if (lf_dip)
-		inode_put(lf_dip, update_sys_files);
-
-	if (!opts.no)
-		log_notice("Writing changes to disk\n");
-	bsync(&sbp->buf_list);
-	bsync(&sbp->nvbuf_list);
-	destroy(sbp);
-	log_notice("gfs2_fsck complete    \n");
-
-	return 0;
-}
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
deleted file mode 100644
index 9915d8d..0000000
--- a/gfs2/fsck/metawalk.c
+++ /dev/null
@@ -1,1012 +0,0 @@
-#include <inttypes.h>
-#include <linux_endian.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include "libgfs2.h"
-#include "fsck.h"
-#include "util.h"
-#include "metawalk.h"
-#include "hash.h"
-
-struct gfs2_inode *get_system_inode(struct gfs2_sbd *sbp, uint64_t block)
-{
-	int j;
-
-	if (block == sbp->md.inum->i_di.di_num.no_addr)
-		return sbp->md.inum;
-	if (block == sbp->md.statfs->i_di.di_num.no_addr)
-		return sbp->md.statfs;
-	if (block == sbp->md.jiinode->i_di.di_num.no_addr)
-		return sbp->md.jiinode;
-	if (block == sbp->md.riinode->i_di.di_num.no_addr)
-		return sbp->md.riinode;
-	if (block == sbp->md.qinode->i_di.di_num.no_addr)
-		return sbp->md.qinode;
-	if (block == sbp->md.pinode->i_di.di_num.no_addr)
-		return sbp->md.pinode;
-	if (block == sbp->md.rooti->i_di.di_num.no_addr)
-		return sbp->md.rooti;
-	if (block == sbp->master_dir->i_di.di_num.no_addr)
-		return sbp->master_dir;
-	if (lf_dip && block == lf_dip->i_di.di_num.no_addr)
-		return lf_dip;
-	for (j = 0; j < sbp->md.journals; j++)
-		if (block == sbp->md.journal[j]->i_di.di_num.no_addr)
-			return sbp->md.journal[j];
-	return NULL;
-}
-
-/* fsck_load_inode - same as gfs2_load_inode() in libgfs2 but system inodes
-   get special treatment. */
-struct gfs2_inode *fsck_load_inode(struct gfs2_sbd *sbp, uint64_t block)
-{
-	struct gfs2_inode *ip = NULL;
-
-	ip = get_system_inode(sbp, block);
-	if (ip) {
-		bhold(ip->i_bh);
-		return ip;
-	}
-	return gfs2_load_inode(sbp, block);
-}
-
-/* fsck_inode_get - same as inode_get() in libgfs2 but system inodes
-   get special treatment. */
-struct gfs2_inode *fsck_inode_get(struct gfs2_sbd *sdp,
-				  struct gfs2_buffer_head *bh)
-{
-	struct gfs2_inode *ip, *sysip;
-
-	zalloc(ip, sizeof(struct gfs2_inode));
-	gfs2_dinode_in(&ip->i_di, bh->b_data);
-	ip->i_bh = bh;
-	ip->i_sbd = sdp;
-
-	sysip = get_system_inode(sdp, ip->i_di.di_num.no_addr);
-	if (sysip) {
-		free(ip);
-		return sysip;
-	}
-	return ip;
-}
-
-/* fsck_inode_put - same as inode_put() in libgfs2 but system inodes
-   get special treatment. */
-void fsck_inode_put(struct gfs2_inode *ip, enum update_flags update)
-{
-	struct gfs2_inode *sysip;
-
-	sysip = get_system_inode(ip->i_sbd, ip->i_di.di_num.no_addr);
-	if (sysip) {
-		if (update)
-			gfs2_dinode_out(&ip->i_di, ip->i_bh->b_data);
-		brelse(ip->i_bh, update);
-	} else {
-		inode_put(ip, update);
-	}
-}
-
-int dirent_repair(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
-		  struct gfs2_dirent *de, struct gfs2_dirent *dent,
-		  int type, int first)
-{
-	char *bh_end, *p;
-	int calc_de_name_len = 0;
-	
-	/* If this is a sentinel, just fix the length and move on */
-	if (first && !de->de_inum.no_formal_ino) { /* Is it a sentinel? */
-		if (type == DIR_LINEAR)
-			de->de_rec_len = ip->i_sbd->bsize -
-				sizeof(struct gfs2_dinode);
-		else
-			de->de_rec_len = ip->i_sbd->bsize -
-				sizeof(struct gfs2_leaf);
-	}
-	else {
-		bh_end = bh->b_data + ip->i_sbd->bsize;
-		/* first, figure out a probable name length */
-		p = (char *)dent + sizeof(struct gfs2_dirent);
-		while (*p &&         /* while there's a non-zero char and */
-		       p < bh_end) { /* not past end of buffer */
-			calc_de_name_len++;
-			p++;
-		}
-		if (!calc_de_name_len)
-			return 1;
-		/* There can often be noise at the end, so only          */
-		/* Trust the shorter of the two in case we have too much */
-		/* Or rather, only trust ours if it's shorter.           */
-		if (!de->de_name_len || de->de_name_len > NAME_MAX ||
-		    calc_de_name_len < de->de_name_len) /* if dent is hosed */
-			de->de_name_len = calc_de_name_len; /* use ours */
-		de->de_rec_len = GFS2_DIRENT_SIZE(de->de_name_len);
-	}
-	gfs2_dirent_out(de, (char *)dent);
-	return 0;
-}
-
-int check_entries(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
-		  int index, int type, enum update_flags *update,
-		  uint16_t *count, struct metawalk_fxns *pass)
-{
-	struct gfs2_leaf *leaf = NULL;
-	struct gfs2_dirent *dent;
-	struct gfs2_dirent de, *prev;
-	int error = 0;
-	char *bh_end;
-	char *filename;
-	int first = 1;
-
-	bh_end = bh->b_data + ip->i_sbd->bsize;
-
-	if(type == DIR_LINEAR) {
-		dent = (struct gfs2_dirent *)(bh->b_data + sizeof(struct gfs2_dinode));
-	}
-	else if (type == DIR_EXHASH) {
-		dent = (struct gfs2_dirent *)(bh->b_data + sizeof(struct gfs2_leaf));
-		leaf = (struct gfs2_leaf *)bh->b_data;
-		log_debug("Checking leaf %" PRIu64 " (0x%" PRIx64 ")\n",
-				  bh->b_blocknr, bh->b_blocknr);
-	}
-	else {
-		log_err("Invalid directory type %d specified\n", type);
-		return -1;
-	}
-
-	prev = NULL;
-	if(!pass->check_dentry)
-		return 0;
-
-	while(1) {
-		memset(&de, 0, sizeof(struct gfs2_dirent));
-		gfs2_dirent_in(&de, (char *)dent);
-		filename = (char *)dent + sizeof(struct gfs2_dirent);
-
-		if (de.de_rec_len < sizeof(struct gfs2_dirent) +
-		    de.de_name_len || !de.de_name_len) {
-			log_err("Directory block %" PRIu64 "(0x%"
-				PRIx64 "), entry %d of directory %"
-				PRIu64 "(0x%" PRIx64 ") is corrupt.\n",
-				bh->b_blocknr, bh->b_blocknr, (*count) + 1,
-				ip->i_di.di_num.no_addr,
-				ip->i_di.di_num.no_addr);
-			if (query(&opts, "Attempt to repair it? (y/n) ")) {
-				if (dirent_repair(ip, bh, &de, dent, type,
-						  first))
-					break;
-				else
-					*update = updated;
-			}
-			else {
-				log_err("Corrupt directory entry ignored, "
-					"stopped after checking %d entries.\n",
-					*count);
-				break;
-			}
-		}
-		if (!de.de_inum.no_formal_ino){
-			if(first){
-				log_debug("First dirent is a sentinel (place holder).\n");
-				first = 0;
-			} else {
-				/* FIXME: Do something about this */
-				log_err("Directory entry with inode number of zero in leaf %"
-						PRIu64 "(0x%" PRIx64 ") of directory %" PRIu64
-						" (0x%" PRIx64 ")!\n", bh->b_blocknr, bh->b_blocknr,
-						ip->i_di.di_num.no_addr, ip->i_di.di_num.no_addr);
-				return 1;
-			}
-		} else {
-			if (!de.de_inum.no_addr && first) { /* reverse sentinel */
-				log_debug("First dirent is a Sentinel (place holder).\n");
-				/* Swap the two to silently make it a proper sentinel */
-				de.de_inum.no_addr = de.de_inum.no_formal_ino;
-				de.de_inum.no_formal_ino = 0;
-				gfs2_dirent_out(&de, (char *)dent);
-				*update = (opts.no ? not_updated : updated);
-				/* Mark dirent buffer as modified */
-				first = 0;
-			}
-			else {
-				error = pass->check_dentry(ip, dent, prev, bh,
-							   filename, update,
-							   count,
-							   pass->private);
-				if(error < 0) {
-					stack;
-					return -1;
-				}
-				/*if(error > 0) {
-				  return 1;
-				  }*/
-			}
-		}
-
-		if ((char *)dent + de.de_rec_len >= bh_end){
-			log_debug("Last entry processed.\n");
-			break;
-		}
-
-		/* If we didn't clear the dentry, or if we did, but it
-		 * was the first dentry, set prev  */
-		if(!error || first)
-			prev = dent;
-		first = 0;
-		dent = (struct gfs2_dirent *)((char *)dent + de.de_rec_len);
-	}
-	return 0;
-}
-
-/* Process a bad leaf pointer and ask to repair the first time.      */
-/* The repair process involves extending the previous leaf's entries */
-/* so that they replace the bad ones.  We have to hack up the old    */
-/* leaf a bit, but it's better than deleting the whole directory,    */
-/* which is what used to happen before.                              */
-void warn_and_patch(struct gfs2_inode *ip, uint64_t *leaf_no, 
-		    uint64_t *bad_leaf, uint64_t old_leaf, int index,
-		    const char *msg)
-{
-	if (*bad_leaf != *leaf_no) {
-		log_err("Directory Inode %" PRIu64 "(0x%"
-			PRIx64 ") points to leaf %" PRIu64 "(0x%"
-			PRIx64 ") %s.\n", ip->i_di.di_num.no_addr,
-			ip->i_di.di_num.no_addr, *leaf_no, *leaf_no, msg);
-	}
-	if (*leaf_no == *bad_leaf ||
-	    query(&opts, "Attempt to patch around it? (y/n) ")) {
-		gfs2_put_leaf_nr(ip, index, old_leaf);
-	}
-	else
-		log_err("Bad leaf left in place.\n");
-	*bad_leaf = *leaf_no;
-	*leaf_no = old_leaf;
-}
-
-/* Checks exhash directory entries */
-int check_leaf(struct gfs2_inode *ip, enum update_flags *update,
-	       struct metawalk_fxns *pass)
-{
-	int error;
-	struct gfs2_leaf leaf, oldleaf;
-	uint64_t leaf_no, old_leaf, bad_leaf = -1;
-	struct gfs2_buffer_head *lbh;
-	int index;
-	struct gfs2_sbd *sbp = ip->i_sbd;
-	uint16_t count;
-	int ref_count = 0, exp_count = 0;
-
-	old_leaf = 0;
-	memset(&oldleaf, 0, sizeof(oldleaf));
-	for(index = 0; index < (1 << ip->i_di.di_depth); index++) {
-		gfs2_get_leaf_nr(ip, index, &leaf_no);
-
-		/* GFS has multiple indirect pointers to the same leaf
-		 * until those extra pointers are needed, so skip the
-		 * dups */
-		if (leaf_no == bad_leaf) {
-			gfs2_put_leaf_nr(ip, index, old_leaf); /* fill w/old
-								  leaf info */
-			ref_count++;
-			continue;
-		}
-		else if(old_leaf == leaf_no) {
-			ref_count++;
-			continue;
-		} else {
-			if(ref_count != exp_count){
-				log_err("Dir #%" PRIu64 " (0x%"
-					PRIx64 ") has an incorrect "
-					"number of pointers to leaf #%"
-					PRIu64 " (0x%" PRIx64
-					")\n\tFound: %u,  Expected: %u\n",
-					ip->i_di.di_num.no_addr,
-					ip->i_di.di_num.no_addr,
-					old_leaf, old_leaf, ref_count,
-					exp_count);
-				if (query(&opts, "Attempt to fix it? (y/n) "))
-				{
-					int factor = 0, divisor = ref_count;
-
-					lbh = bread(&sbp->buf_list, old_leaf);
-					while (divisor > 1) {
-						factor++;
-						divisor /= 2;
-					}
-					oldleaf.lf_depth = ip->i_di.di_depth -
-						factor;
-					gfs2_leaf_out(&oldleaf, lbh->b_data);
-					brelse(lbh, updated);
-				}
-				else
-					return 1;
-			}
-			ref_count = 1;
-		}
-
-		count = 0;
-		do {
-			/* Make sure the block number is in range. */
-			if(gfs2_check_range(ip->i_sbd, leaf_no)){
-				log_err("Leaf block #%" PRIu64 " (0x%"
-					PRIx64 ") is out of range for "
-					"directory #%" PRIu64 " (0x%"
-					PRIx64 ").\n", leaf_no, leaf_no,
-					ip->i_di.di_num.no_addr,
-					ip->i_di.di_num.no_addr);
-				warn_and_patch(ip, &leaf_no, &bad_leaf,
-					       old_leaf, index,
-					       "that is out of range");
-				memcpy(&leaf, &oldleaf, sizeof(oldleaf));
-				break;
-			}
-
-			*update = not_updated;
-			/* Try to read in the leaf block. */
-			lbh = bread(&sbp->buf_list, leaf_no);
-			/* Make sure it's really a valid leaf block. */
-			if (gfs2_check_meta(lbh, GFS2_METATYPE_LF)) {
-				warn_and_patch(ip, &leaf_no, &bad_leaf,
-					       old_leaf, index,
-					       "that is not really a leaf");
-				memcpy(&leaf, &oldleaf, sizeof(oldleaf));
-				brelse(lbh, (opts.no ? not_updated : updated));
-				break;
-			}
-			gfs2_leaf_in(&leaf, lbh->b_data);
-			if(pass->check_leaf) {
-				error = pass->check_leaf(ip, leaf_no, lbh,
-							 pass->private);
-			}
-
-			/*
-			 * Early versions of GFS2 had an endianess bug in the
-			 * kernel that set lf_dirent_format to
-			 * cpu_to_be16(GFS2_FORMAT_DE).  This was fixed to use
-			 * cpu_to_be32(), but we should check for incorrect 
-			 * values and replace them with the correct value. */
-
-			if (leaf.lf_dirent_format == (GFS2_FORMAT_DE << 16)) {
-				log_debug("incorrect lf_dirent_format at leaf #%" PRIu64 "\n", leaf_no);
-				leaf.lf_dirent_format = GFS2_FORMAT_DE;
-				gfs2_leaf_out(&leaf, lbh->b_data);
-				log_debug("Fixing lf_dirent_format.\n");
-				*update = (opts.no ? not_updated : updated);
-			}
-
-			/* Make sure it's really a leaf. */
-			if (leaf.lf_header.mh_type != GFS2_METATYPE_LF) {
-				log_err("Inode %" PRIu64 " (0x%"
-					PRIx64 ") points to bad leaf "
-					PRIu64 " (0x%" PRIx64 ").\n",
-					ip->i_di.di_num.no_addr, leaf_no);
-				brelse(lbh, *update);
-				break;
-			}
-			exp_count = (1 << (ip->i_di.di_depth - leaf.lf_depth));
-			log_debug("expected count %u - di_depth %u, leaf depth %u\n",
-					  exp_count, ip->i_di.di_depth, leaf.lf_depth);
-
-			if(pass->check_dentry &&
-			   S_ISDIR(ip->i_di.di_mode)) {
-				error = check_entries(ip, lbh, index,
-						      DIR_EXHASH, update,
-						      &count, pass);
-
-				/* Since the buffer possibly got
-				 * updated directly, release it now,
-				 * and grab it again later if we need it. */
-
-				brelse(lbh, *update);
-
-				if(error < 0) {
-					stack;
-					return -1;
-				}
-
-				if(error > 0)
-					return 1;
-
-				if(update && (count != leaf.lf_entries)) {
-					enum update_flags f = not_updated;
-
-					lbh = bread(&sbp->buf_list, leaf_no);
-					gfs2_leaf_in(&leaf, lbh->b_data);
-
-					log_err("Leaf %"PRIu64" (0x%" PRIx64
-							") entry count in directory %" PRIu64
-							" doesn't match number of entries found - is %u, found %u\n",
-							leaf_no, leaf_no, ip->i_di.di_num.no_addr,
-							leaf.lf_entries, count);
-					if(query(&opts, "Update leaf entry count? (y/n) ")) {
-						leaf.lf_entries = count;
-						gfs2_leaf_out(&leaf, lbh->b_data);
-						log_warn("Leaf entry count updated\n");
-						f = updated;
-					} else
-						log_err("Leaf entry count left in inconsistant state\n");
-					brelse(lbh, f);
-				}
-				/* FIXME: Need to get entry count and
-				 * compare it against leaf->lf_entries */
-				break;
-			} else {
-				brelse(lbh, *update);
-				if(!leaf.lf_next)
-					break;
-				leaf_no = leaf.lf_next;
-				log_debug("Leaf chain detected.\n");
-			}
-		} while(1);
-		old_leaf = leaf_no;
-		memcpy(&oldleaf, &leaf, sizeof(oldleaf));
-	}
-	return 0;
-}
-
-static int check_eattr_entries(struct gfs2_inode *ip,
-			       struct gfs2_buffer_head *bh,
-			       struct metawalk_fxns *pass,
-			       enum update_flags *update_it)
-{
-	struct gfs2_ea_header *ea_hdr, *ea_hdr_prev = NULL;
-	uint64_t *ea_data_ptr = NULL;
-	int i;
-	int error = 0;
-	uint32_t offset = (uint32_t)sizeof(struct gfs2_meta_header);
-
-	*update_it = 0;
-	if(!pass->check_eattr_entry) {
-		return 0;
-	}
-
-	ea_hdr = (struct gfs2_ea_header *)(bh->b_data +
-					  sizeof(struct gfs2_meta_header));
-
-	while(1){
-		error = pass->check_eattr_entry(ip, bh, ea_hdr, ea_hdr_prev,
-						pass->private);
-		if(error < 0) {
-			stack;
-			return -1;
-		}
-		if(error == 0 && pass->check_eattr_extentry &&
-		   ea_hdr->ea_num_ptrs) {
-			uint32_t tot_ealen = 0;
-			struct gfs2_sbd *sdp = ip->i_sbd;
-
-			ea_data_ptr = ((uint64_t *)((char *)ea_hdr +
-						    sizeof(struct gfs2_ea_header) +
-						    ((ea_hdr->ea_name_len + 7) & ~7)));
-
-			/* It is possible when a EA is shrunk
-			** to have ea_num_ptrs be greater than
-			** the number required for ** data.
-			** In this case, the EA ** code leaves
-			** the blocks ** there for **
-			** reuse...........  */
-
-			for(i = 0; i < ea_hdr->ea_num_ptrs; i++){
-				if(pass->check_eattr_extentry(ip,
-							      ea_data_ptr,
-							      bh, ea_hdr,
-							      ea_hdr_prev,
-							      update_it,
-							      pass->private)) {
-					if (query(&opts, "Repair the bad EA? "
-						  "(y/n) ")) {
-						ea_hdr->ea_num_ptrs = i;
-						ea_hdr->ea_data_len =
-							cpu_to_be32(tot_ealen);
-						*ea_data_ptr = 0;
-						*update_it = 1;
-						/* Endianness doesn't matter
-						   in this case because it's
-						   a single byte. */
-						return -1;
-					}
-					log_err("The bad EA was not fixed.\n");
-				}
-				tot_ealen += sdp->sd_sb.sb_bsize -
-					sizeof(struct gfs2_meta_header);
-				ea_data_ptr++;
-			}
-		}
-		offset += be32_to_cpu(ea_hdr->ea_rec_len);
-		if(ea_hdr->ea_flags & GFS2_EAFLAG_LAST ||
-		   offset >= ip->i_sbd->sd_sb.sb_bsize || ea_hdr->ea_rec_len == 0){
-			break;
-		}
-		ea_hdr_prev = ea_hdr;
-		ea_hdr = (struct gfs2_ea_header *)
-			((char *)(ea_hdr) +
-			 be32_to_cpu(ea_hdr->ea_rec_len));
-	}
-
-	return 0;
-}
-
-/**
- * check_leaf_eattr
- * @ip: the inode the eattr comes from
- * @block: block number of the leaf
- *
- * Returns: 0 on success, -1 if removal is needed
- */
-static int check_leaf_eattr(struct gfs2_inode *ip, uint64_t block,
-			    uint64_t parent, enum update_flags *want_updated,
-			    struct metawalk_fxns *pass)
-{
-	struct gfs2_buffer_head *bh = NULL;
-	int error = 0;
-
-	log_debug("Checking EA leaf block #%"PRIu64" (0x%" PRIx64 ").\n",
-			  block, block);
-
-	if(pass->check_eattr_leaf) {
-		error = pass->check_eattr_leaf(ip, block, parent, &bh,
-					       want_updated, pass->private);
-		if(error < 0) {
-			stack;
-			return -1;
-		}
-		if(error > 0) {
-			return 1;
-		}
-		check_eattr_entries(ip, bh, pass, want_updated);
-		if (bh)
-			brelse(bh, *want_updated);
-	}
-
-	return 0;
-}
-
-/**
- * check_indirect_eattr
- * @ip: the inode the eattr comes from
- * @indirect_block
- *
- * Returns: 0 on success -1 on error
- */
-static int check_indirect_eattr(struct gfs2_inode *ip, uint64_t indirect,
-				enum update_flags *want_updated,
-				struct metawalk_fxns *pass){
-	int error = 0;
-	uint64_t *ea_leaf_ptr, *end;
-	uint64_t block;
-	struct gfs2_buffer_head *indirect_buf = NULL;
-	struct gfs2_sbd *sdp = ip->i_sbd;
-
-	*want_updated = not_updated;
-	log_debug("Checking EA indirect block #%"PRIu64" (0x%" PRIx64 ").\n",
-			  indirect, indirect);
-
-	if (!pass->check_eattr_indir)
-		return 0;
-	error = pass->check_eattr_indir(ip, indirect, ip->i_di.di_num.no_addr,
-					&indirect_buf, want_updated,
-					pass->private);
-	if (!error) {
-		int leaf_pointers = 0, leaf_pointer_errors = 0;
-
-		ea_leaf_ptr = (uint64_t *)(indirect_buf->b_data
-								   + sizeof(struct gfs2_meta_header));
-		end = ea_leaf_ptr + ((sdp->sd_sb.sb_bsize
-							  - sizeof(struct gfs2_meta_header)) / 8);
-
-		while(*ea_leaf_ptr && (ea_leaf_ptr < end)){
-			block = be64_to_cpu(*ea_leaf_ptr);
-			leaf_pointers++;
-			error = check_leaf_eattr(ip, block, indirect,
-						 want_updated, pass);
-			if (error)
-				leaf_pointer_errors++;
-			ea_leaf_ptr++;
-		}
-		if (pass->finish_eattr_indir) {
-			int indir_ok = 1;
-
-			if (leaf_pointer_errors == leaf_pointers)
-				indir_ok = 0;
-			pass->finish_eattr_indir(ip, indir_ok, want_updated,
-						 pass->private);
-			if (!indir_ok) {
-				if (*want_updated)
-					gfs2_set_bitmap(sdp, indirect,
-							GFS2_BLKST_FREE);
-				gfs2_block_clear(sdp, bl, indirect,
-						 gfs2_indir_blk);
-				gfs2_block_set(sdp, bl, indirect,
-					       gfs2_block_free);
-				error = 1;
-			}
-		}
-	}
-	if (indirect_buf)
-		brelse(indirect_buf, not_updated);
-
-	return error;
-}
-
-/**
- * check_inode_eattr - check the EA's for a single inode
- * @ip: the inode whose EA to check
- *
- * Returns: 0 on success, -1 on error
- */
-int check_inode_eattr(struct gfs2_inode *ip, enum update_flags *want_updated,
-		      struct metawalk_fxns *pass)
-{
-	int error = 0;
-
-	if(!ip->i_di.di_eattr){
-		return 0;
-	}
-
-	log_debug("Extended attributes exist for inode #%" PRIu64 " (0x%" PRIx64
-		  ").\n", ip->i_di.di_num.no_addr, ip->i_di.di_num.no_addr);
-
-	if(ip->i_di.di_flags & GFS2_DIF_EA_INDIRECT){
-		if((error = check_indirect_eattr(ip, ip->i_di.di_eattr,
-						 want_updated, pass)))
-			stack;
-	} else {
-		if((error = check_leaf_eattr(ip, ip->i_di.di_eattr,
-					     ip->i_di.di_num.no_addr,
-					     want_updated, pass)))
-			stack;
-	}
-
-	return error;
-}
-
-/**
- * build_and_check_metalist - check a bunch of indirect blocks
- * Note: Every buffer put on the metalist should be "held".
- * @ip:
- * @mlp:
- */
-static int build_and_check_metalist(struct gfs2_inode *ip,
-				    osi_list_t *mlp,
-				    struct metawalk_fxns *pass)
-{
-	uint32_t height = ip->i_di.di_height;
-	struct gfs2_buffer_head *bh, *nbh, *metabh;
-	osi_list_t *prev_list, *cur_list, *tmp;
-	int i, head_size;
-	uint64_t *ptr, block;
-	int err;
-
-	metabh = bread(&ip->i_sbd->buf_list, ip->i_di.di_num.no_addr);
-
-	osi_list_add(&metabh->b_altlist, &mlp[0]);
-
-	/* if(<there are no indirect blocks to check>) */
-	if (height < 2)
-		return 0;
-	for (i = 1; i < height; i++){
-		prev_list = &mlp[i - 1];
-		cur_list = &mlp[i];
-
-		for (tmp = prev_list->next; tmp != prev_list; tmp = tmp->next){
-			bh = osi_list_entry(tmp, struct gfs2_buffer_head,
-					    b_altlist);
-
-			head_size = (i > 1 ?
-				     sizeof(struct gfs2_meta_header) :
-				     sizeof(struct gfs2_dinode));
-
-			for (ptr = (uint64_t *)(bh->b_data + head_size);
-			     (char *)ptr < (bh->b_data + ip->i_sbd->bsize);
-			     ptr++) {
-				nbh = NULL;
-		
-				if (!*ptr)
-					continue;
-
-				block = be64_to_cpu(*ptr);
-				err = pass->check_metalist(ip, block, &nbh,
-							   pass->private);
-				/* check_metalist should hold any buffers
-				   it gets with "bread". */
-				if(err < 0) {
-					stack;
-					goto fail;
-				}
-				if(err > 0) {
-					log_debug("Skipping block %" PRIu64
-						  " (0x%" PRIx64 ")\n",
-						  block, block);
-					continue;
-				}
-				if(!nbh)
-					nbh = bread(&ip->i_sbd->buf_list,
-						    block);
-
-				osi_list_add(&nbh->b_altlist, cur_list);
-			} /* for all data on the indirect block */
-		} /* for blocks at that height */
-	} /* for height */
-	return 0;
-fail:
-	for (i = 0; i < GFS2_MAX_META_HEIGHT; i++) {
-		osi_list_t *list;
-		list = &mlp[i];
-		while (!osi_list_empty(list)) {
-			nbh = osi_list_entry(list->next,
-					     struct gfs2_buffer_head, b_altlist);
-			osi_list_del(&nbh->b_altlist);
-		}
-	}
-	/* This is an error path, so we need to release the buffer here: */
-	brelse(metabh, not_updated);
-	return -1;
-}
-
-/**
- * check_metatree
- * @ip:
- * @rgd:
- *
- */
-int check_metatree(struct gfs2_inode *ip, struct metawalk_fxns *pass)
-{
-	osi_list_t metalist[GFS2_MAX_META_HEIGHT];
-	osi_list_t *list, *tmp;
-	struct gfs2_buffer_head *bh;
-	uint64_t block, *ptr;
-	uint32_t height = ip->i_di.di_height;
-	int  i, head_size;
-	enum update_flags update = not_updated;
-	int error = 0;
-
-	if (!height)
-		goto end;
-
-	for (i = 0; i < GFS2_MAX_META_HEIGHT; i++)
-		osi_list_init(&metalist[i]);
-
-	/* create metalist for each level */
-	if (build_and_check_metalist(ip, &metalist[0], pass)){
-		stack;
-		return -1;
-	}
-
-	/* We don't need to record directory blocks - they will be
-	 * recorded later...i think... */
-        if (S_ISDIR(ip->i_di.di_mode))
-		log_debug("Directory with height > 0 at %"PRIu64"\n",
-			  ip->i_di.di_num.no_addr);
-
-	/* check data blocks */
-	list = &metalist[height - 1];
-
-	for (tmp = list->next; tmp != list; tmp = tmp->next) {
-		bh = osi_list_entry(tmp, struct gfs2_buffer_head, b_altlist);
-
-		head_size = (height != 1 ? sizeof(struct gfs2_meta_header) :
-			     sizeof(struct gfs2_dinode));
-		ptr = (uint64_t *)(bh->b_data + head_size);
-
-		for ( ; (char *)ptr < (bh->b_data + ip->i_sbd->bsize); ptr++) {
-			if (!*ptr)
-				continue;
-
-			block =  be64_to_cpu(*ptr);
-
-			if(pass->check_data &&
-			   (pass->check_data(ip, block, pass->private) < 0)) {
-				stack;
-				return -1;
-			}
-		}
-	}
-
-	/* free metalists */
-	for (i = 0; i < GFS2_MAX_META_HEIGHT; i++)
-	{
-		list = &metalist[i];
-		while (!osi_list_empty(list))
-		{
-			bh = osi_list_entry(list->next,
-					    struct gfs2_buffer_head, b_altlist);
-			brelse(bh, not_updated);
-			osi_list_del(&bh->b_altlist);
-		}
-	}
-
-end:
-        if (S_ISDIR(ip->i_di.di_mode)) {
-		/* check validity of leaf blocks and leaf chains */
-		if (ip->i_di.di_flags & GFS2_DIF_EXHASH) {
-			error = check_leaf(ip, &update, pass);
-			if(error < 0)
-				return -1;
-			if(error > 0)
-				return 1;
-		}
-	}
-
-	return 0;
-}
-
-/* Checks stuffed inode directories */
-int check_linear_dir(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
-		     enum update_flags *update, struct metawalk_fxns *pass)
-{
-	int error = 0;
-	uint16_t count = 0;
-
-	error = check_entries(ip, bh, 0, DIR_LINEAR, update, &count, pass);
-	if(error < 0) {
-		stack;
-		return -1;
-	}
-
-	return error;
-}
-
-
-int check_dir(struct gfs2_sbd *sbp, uint64_t block, struct metawalk_fxns *pass)
-{
-	struct gfs2_buffer_head *bh;
-	struct gfs2_inode *ip;
-	enum update_flags update = not_updated;
-	int error = 0;
-
-	bh = bread(&sbp->buf_list, block);
-	ip = fsck_inode_get(sbp, bh);
-
-	if(ip->i_di.di_flags & GFS2_DIF_EXHASH) {
-		error = check_leaf(ip, &update, pass);
-		if(error < 0) {
-			stack;
-			fsck_inode_put(ip, not_updated); /* does brelse(bh); */
-			return -1;
-		}
-	}
-	else {
-		error = check_linear_dir(ip, bh, &update, pass);
-		if(error < 0) {
-			stack;
-			fsck_inode_put(ip, not_updated); /* does brelse(bh); */
-			return -1;
-		}
-	}
-
-	fsck_inode_put(ip, opts.no ? not_updated : update); /* does a brelse */
-	return error;
-}
-
-static int remove_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
-			 struct gfs2_dirent *prev_de,
-			 struct gfs2_buffer_head *bh,
-			 char *filename, enum update_flags *update,
-			 uint16_t *count, void *private)
-{
-	/* the metawalk_fxn's private field must be set to the dentry
-	 * block we want to clear */
-	uint64_t *dentryblock = (uint64_t *) private;
-	struct gfs2_dirent dentry, *de;
-
-	memset(&dentry, 0, sizeof(struct gfs2_dirent));
-	gfs2_dirent_in(&dentry, (char *)dent);
-	de = &dentry;
-	*update = (opts.no ? not_updated : updated);
-
-	if(de->de_inum.no_addr == *dentryblock)
-		dirent2_del(ip, bh, prev_de, dent);
-	else
-		(*count)++;
-
-	return 0;
-
-}
-
-int remove_dentry_from_dir(struct gfs2_sbd *sbp, uint64_t dir,
-			   uint64_t dentryblock)
-{
-	struct metawalk_fxns remove_dentry_fxns = {0};
-	struct gfs2_block_query q;
-	int error;
-
-	log_debug("Removing dentry %" PRIu64 " (0x%" PRIx64 ") from directory %"
-			  PRIu64" (0x%" PRIx64 ")\n", dentryblock, dentryblock, dir, dir);
-	if(gfs2_check_range(sbp, dir)) {
-		log_err("Parent directory out of range\n");
-		return 1;
-	}
-	remove_dentry_fxns.private = &dentryblock;
-	remove_dentry_fxns.check_dentry = remove_dentry;
-
-	if(gfs2_block_check(sbp, bl, dir, &q)) {
-		stack;
-		return -1;
-	}
-	if(q.block_type != gfs2_inode_dir) {
-		log_info("Parent block is not a directory...ignoring\n");
-		return 1;
-	}
-	/* Need to run check_dir with a private var of dentryblock,
-	 * and fxns that remove that dentry if found */
-	error = check_dir(sbp, dir, &remove_dentry_fxns);
-
-	return error;
-}
-
-/* FIXME: These should be merged with the hash routines in inode_hash.c */
-static uint32_t dinode_hash(uint64_t block_no)
-{
-	unsigned int h;
-
-	h = fsck_hash(&block_no, sizeof (uint64_t));
-	h &= FSCK_HASH_MASK;
-
-	return h;
-}
-
-int find_di(struct gfs2_sbd *sbp, uint64_t childblock, struct dir_info **dip)
-{
-	osi_list_t *bucket = &dir_hash[dinode_hash(childblock)];
-	osi_list_t *tmp;
-	struct dir_info *di = NULL;
-
-	osi_list_foreach(tmp, bucket) {
-		di = osi_list_entry(tmp, struct dir_info, list);
-		if(di->dinode == childblock) {
-			*dip = di;
-			return 0;
-		}
-	}
-	*dip = NULL;
-	return -1;
-
-}
-
-int dinode_hash_insert(osi_list_t *buckets, uint64_t key, struct dir_info *di)
-{
-	osi_list_t *tmp;
-	osi_list_t *bucket = &buckets[dinode_hash(key)];
-	struct dir_info *dtmp = NULL;
-
-	if(osi_list_empty(bucket)) {
-		osi_list_add(&di->list, bucket);
-		return 0;
-	}
-
-	osi_list_foreach(tmp, bucket) {
-		dtmp = osi_list_entry(tmp, struct dir_info, list);
-		if(dtmp->dinode < key) {
-			continue;
-		}
-		else {
-			osi_list_add_prev(&di->list, tmp);
-			return 0;
-		}
-	}
-	osi_list_add_prev(&di->list, bucket);
-	return 0;
-}
-
-int dinode_hash_remove(osi_list_t *buckets, uint64_t key)
-{
-	osi_list_t *tmp;
-	osi_list_t *bucket = &buckets[dinode_hash(key)];
-	struct dir_info *dtmp = NULL;
-
-	if(osi_list_empty(bucket)) {
-		return -1;
-	}
-	osi_list_foreach(tmp, bucket) {
-		dtmp = osi_list_entry(tmp, struct dir_info, list);
-		if(dtmp->dinode == key) {
-			osi_list_del(tmp);
-			return 0;
-		}
-	}
-	return -1;
-}
diff --git a/gfs2/fsck/metawalk.h b/gfs2/fsck/metawalk.h
deleted file mode 100644
index fd8f1b7..0000000
--- a/gfs2/fsck/metawalk.h
+++ /dev/null
@@ -1,74 +0,0 @@
-#ifndef _METAWALK_H
-#define _METAWALK_H
-
-#define DIR_LINEAR 1
-#define DIR_EXHASH 2
-
-struct metawalk_fxns;
-
-int check_inode_eattr(struct gfs2_inode *ip, enum update_flags *want_updated,
-		      struct metawalk_fxns *pass);
-int check_metatree(struct gfs2_inode *ip, struct metawalk_fxns *pass);
-int check_dir(struct gfs2_sbd *sbp, uint64_t block,
-			  struct metawalk_fxns *pass);
-int remove_dentry_from_dir(struct gfs2_sbd *sbp, uint64_t dir,
-						   uint64_t dentryblock);
-int find_di(struct gfs2_sbd *sbp, uint64_t childblock, struct dir_info **dip);
-int dinode_hash_insert(osi_list_t *buckets, uint64_t key, struct dir_info *di);
-int dinode_hash_remove(osi_list_t *buckets, uint64_t key);
-
-/* metawalk_fxns: function pointers to check various parts of the fs
- *
- * The functions should return -1 on fatal errors, 1 if the block
- * should be skipped, and 0 on success
- *
- * private: Data that should be passed to the fxns
- * check_leaf:
- * check_metalist:
- * check_data:
- * check_eattr_indir:
- * check_eattr_leaf:
- * check_dentry:
- * check_eattr_entry:
- * check_eattr_extentry:
- */
-struct metawalk_fxns {
-	void *private;
-	int (*check_leaf) (struct gfs2_inode *ip, uint64_t block,
-			   struct gfs2_buffer_head *bh, void *private);
-	int (*check_metalist) (struct gfs2_inode *ip, uint64_t block,
-			       struct gfs2_buffer_head **bh, void *private);
-	int (*check_data) (struct gfs2_inode *ip, uint64_t block,
-			   void *private);
-	int (*check_eattr_indir) (struct gfs2_inode *ip, uint64_t block,
-				  uint64_t parent,
-				  struct gfs2_buffer_head **bh,
-				  enum update_flags *want_updated,
-				  void *private);
-	int (*check_eattr_leaf) (struct gfs2_inode *ip, uint64_t block,
-				 uint64_t parent, struct gfs2_buffer_head **bh,
-				 enum update_flags *want_updated,
-				 void *private);
-	int (*check_dentry) (struct gfs2_inode *ip, struct gfs2_dirent *de,
-			     struct gfs2_dirent *prev,
-			     struct gfs2_buffer_head *bh,
-			     char *filename, enum update_flags *update,
-			     uint16_t *count, void *private);
-	int (*check_eattr_entry) (struct gfs2_inode *ip,
-				  struct gfs2_buffer_head *leaf_bh,
-				  struct gfs2_ea_header *ea_hdr,
-				  struct gfs2_ea_header *ea_hdr_prev,
-				  void *private);
-	int (*check_eattr_extentry) (struct gfs2_inode *ip,
-				     uint64_t *ea_data_ptr,
-				     struct gfs2_buffer_head *leaf_bh,
-				     struct gfs2_ea_header *ea_hdr,
-				     struct gfs2_ea_header *ea_hdr_prev,
-				     enum update_flags *want_updated,
-				     void *private);
-	int (*finish_eattr_indir) (struct gfs2_inode *ip, int indir_ok,
-				   enum update_flags *want_updated,
-				   void *private);
-};
-
-#endif /* _METAWALK_H */
diff --git a/gfs2/fsck/pass1.c b/gfs2/fsck/pass1.c
deleted file mode 100644
index a33ad16..0000000
--- a/gfs2/fsck/pass1.c
+++ /dev/null
@@ -1,903 +0,0 @@
-/* pass1 checks inodes for format & type, duplicate blocks, & incorrect
- * block count.
- *
- * It builds up tables that contains the state of each block (free,
- * block in use, metadata type, etc), as well as bad blocks and
- * duplicate blocks.  (See block_list.[ch] for more info)
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/time.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <string.h>
-#include <time.h>
-#include <sys/ioctl.h>
-#include <inttypes.h>
-
-#include "libgfs2.h"
-#include "fsck.h"
-#include "util.h"
-#include "link.h"
-#include "linux_endian.h"
-#include "metawalk.h"
-
-struct block_count {
-	uint64_t indir_count;
-	uint64_t data_count;
-	uint64_t ea_count;
-};
-
-static int leaf(struct gfs2_inode *ip, uint64_t block,
-		struct gfs2_buffer_head *bh, void *private);
-static int check_metalist(struct gfs2_inode *ip, uint64_t block,
-			  struct gfs2_buffer_head **bh, void *private);
-static int check_data(struct gfs2_inode *ip, uint64_t block, void *private);
-static int check_eattr_indir(struct gfs2_inode *ip, uint64_t indirect,
-			     uint64_t parent, struct gfs2_buffer_head **bh,
-			     enum update_flags *want_updated, void *private);
-static int check_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
-			    uint64_t parent, struct gfs2_buffer_head **bh,
-			    enum update_flags *want_updated, void *private);
-static int check_eattr_entries(struct gfs2_inode *ip,
-			       struct gfs2_buffer_head *leaf_bh,
-			       struct gfs2_ea_header *ea_hdr,
-			       struct gfs2_ea_header *ea_hdr_prev,
-			       void *private);
-static int check_extended_leaf_eattr(struct gfs2_inode *ip, uint64_t *data_ptr,
-				     struct gfs2_buffer_head *leaf_bh,
-				     struct gfs2_ea_header *ea_hdr,
-				     struct gfs2_ea_header *ea_hdr_prev,
-				     enum update_flags *want_updated,
-				     void *private);
-static int finish_eattr_indir(struct gfs2_inode *ip, int indir_ok,
-			      enum update_flags *want_updated, void *private);
-
-struct metawalk_fxns pass1_fxns = {
-	.private = NULL,
-	.check_leaf = leaf,
-	.check_metalist = check_metalist,
-	.check_data = check_data,
-	.check_eattr_indir = check_eattr_indir,
-	.check_eattr_leaf = check_eattr_leaf,
-	.check_dentry = NULL,
-	.check_eattr_entry = check_eattr_entries,
-	.check_eattr_extentry = check_extended_leaf_eattr,
-	.finish_eattr_indir = finish_eattr_indir,
-};
-
-static int leaf(struct gfs2_inode *ip, uint64_t block,
-		struct gfs2_buffer_head *bh, void *private)
-{
-	struct block_count *bc = (struct block_count *) private;
-
-	log_debug("\tLeaf block at %15" PRIu64 " (0x%" PRIx64 ")\n",
-			  block, block);
-	gfs2_block_set(ip->i_sbd, bl, block, gfs2_leaf_blk);
-	bc->indir_count++;
-	return 0;
-}
-
-static int check_metalist(struct gfs2_inode *ip, uint64_t block,
-			  struct gfs2_buffer_head **bh, void *private)
-{
-	struct gfs2_block_query q = {0};
-	int found_dup = 0;
-	struct gfs2_buffer_head *nbh;
-	struct block_count *bc = (struct block_count *)private;
-
-	*bh = NULL;
-
-	if (gfs2_check_range(ip->i_sbd, block)){ /* blk outside of FS */
-		gfs2_block_set(ip->i_sbd, bl, ip->i_di.di_num.no_addr,
-			       gfs2_bad_block);
-		log_debug("Bad indirect block pointer (out of range).\n");
-
-		return 1;
-	}
-	if(gfs2_block_check(ip->i_sbd, bl, block, &q)) {
-		stack;
-		return -1;
-	}
-	if(q.block_type != gfs2_block_free) {
-		log_debug("Found duplicate block in indirect block -"
-				  " was marked %d\n", q.block_type);
-		gfs2_block_mark(ip->i_sbd, bl, block, gfs2_dup_block);
-		found_dup = 1;
-	}
-	nbh = bread(&ip->i_sbd->buf_list, block);
-
-	if (gfs2_check_meta(nbh, GFS2_METATYPE_IN)){
-		log_debug("Bad indirect block pointer "
-				  "(points to something that is not an indirect block).\n");
-		if(!found_dup) {
-			gfs2_block_set(ip->i_sbd, bl, block, gfs2_meta_inval);
-			brelse(nbh, not_updated);
-			return 1;
-		}
-	}else  /* blk check ok */
-		*bh = nbh;
-
-	log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to indirect block.\n",
-			  block, block);
-	gfs2_block_set(ip->i_sbd, bl, block, gfs2_indir_blk);
-	bc->indir_count++;
-
-	return 0;
-}
-
-static int check_data(struct gfs2_inode *ip, uint64_t block, void *private)
-{
-	struct gfs2_block_query q = {0};
-	struct block_count *bc = (struct block_count *) private;
-
-	if (gfs2_check_range(ip->i_sbd, block)) {
-		log_err( "Bad data block pointer (out of range)\n");
-		/* Mark the owner of this block with the bad_block
-		 * designator so we know to check it for out of range blocks later */
-		gfs2_block_set(ip->i_sbd, bl, ip->i_di.di_num.no_addr,
-			       gfs2_bad_block);
-		return 1;
-	}
-	if(gfs2_block_check(ip->i_sbd, bl, block, &q)) {
-		stack;
-		return -1;
-	}
-	if(q.block_type != gfs2_block_free) {
-		log_debug("Found duplicate block at %" PRIu64 " (0x%"PRIx64 ")\n",
-				  block, block);
-		gfs2_block_mark(ip->i_sbd, bl, block, gfs2_dup_block);
-		bc->data_count++;
-		return 1;
-	}
-	log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to data block\n", block,
-			  block);
-	gfs2_block_set(ip->i_sbd, bl, block, gfs2_block_used);
-	bc->data_count++;
-	return 0;
-}
-
-/* clear_eas - clear the extended attributes for an inode
- *
- * @ip       - in core inode pointer
- * @bc       - pointer to a block count structure
- * block     - the block that had the problem
- * duplicate - if this is a duplicate block, don't set it "free"
- * emsg      - what to tell the user about the eas being checked
- * Returns: 1 if the EA is fixed, else 0 if it was not fixed.
- */
-static int clear_eas(struct gfs2_inode *ip, struct block_count *bc,
-		     uint64_t block, int duplicate,
-		     enum update_flags *want_updated, const char *emsg)
-{
-	struct gfs2_sbd *sdp = ip->i_sbd;
-
-	*want_updated = not_updated;
-	log_err("Inode #%" PRIu64 " (0x%" PRIx64 "): %s",
-		ip->i_di.di_num.no_addr, ip->i_di.di_num.no_addr, emsg);
-	if (block)
-		log_err(" at block #%" PRIu64 " (0x%" PRIx64 ")",
-			block, block);
-	log_err(".\n");
-	if (query(&opts, "Clear the bad EA? (y/n) ")) {
-		if (block == 0)
-			block = ip->i_di.di_eattr;
-		gfs2_block_clear(sdp, bl, block, gfs2_eattr_block);
-		if (!duplicate) {
-			gfs2_block_clear(sdp, bl, block, gfs2_indir_blk);
-			gfs2_block_set(sdp, bl, block, gfs2_block_free);
-			gfs2_set_bitmap(sdp, block, GFS2_BLKST_FREE);
-		}
-		ip->i_di.di_flags &= ~GFS2_DIF_EA_INDIRECT;
-		if (block == ip->i_di.di_eattr)
-			ip->i_di.di_eattr = 0;
-		bc->ea_count = 0;
-		ip->i_di.di_blocks = 1 + bc->indir_count + bc->data_count;
-		gfs2_dinode_out(&ip->i_di, ip->i_bh->b_data);
-		*want_updated = updated;
-		return 1;
-	} else {
-		log_err("The bad EA was not fixed.\n");
-		bc->ea_count++;
-		return 0;
-	}
-}
-
-static int check_eattr_indir(struct gfs2_inode *ip, uint64_t indirect,
-			     uint64_t parent, struct gfs2_buffer_head **bh,
-			     enum update_flags *want_updated, void *private)
-{
-	struct gfs2_sbd *sdp = ip->i_sbd;
-	int ret = 0;
-	struct gfs2_block_query q = {0};
-	struct block_count *bc = (struct block_count *) private;
-
-	/* This inode contains an eattr - it may be invalid, but the
-	 * eattr attributes points to a non-zero block */
-	if(gfs2_check_range(sdp, indirect)) {
-		/*log_warn("EA indirect block #%"PRIu64" is out of range.\n",
-			indirect);
-			gfs2_block_set(sdp, bl, parent, bad_block);*/
-		/* Doesn't help to mark this here - this gets checked
-		 * in pass1c */
-		return 1;
-	}
-	if(gfs2_block_check(sdp, bl, indirect, &q)) {
-		stack;
-		return -1;
-	}
-
-	/* Special duplicate processing:  If we have an EA block,
-	   check if it really is an EA.  If it is, let duplicate
-	   handling sort it out.  If it isn't, clear it but don't
-	   count it as a duplicate. */
-	*bh = bread(&sdp->buf_list, indirect);
-	if(gfs2_check_meta(*bh, GFS2_METATYPE_IN)) {
-		if(q.block_type != gfs2_block_free) { /* Duplicate? */
-			if (!clear_eas(ip, bc, indirect, 1, want_updated,
-				       "Bad indirect EA duplicate found"))
-				gfs2_block_set(sdp, bl, indirect,
-					       gfs2_dup_block);
-			return 1;
-		}
-		clear_eas(ip, bc, indirect, 0, want_updated,
-			  "EA indirect block has incorrect type");
-		return 1;
-	}
-	if(q.block_type != gfs2_block_free) { /* Duplicate? */
-		log_err("Inode #%" PRIu64 " (0x%" PRIx64
-			"): Duplicate EA indirect block found at #%" PRIu64
-			" (0x%" PRIx64 ").\n",
-			ip->i_di.di_num.no_addr, ip->i_di.di_num.no_addr,
-			indirect, indirect);
-		gfs2_block_set(sdp, bl, indirect, gfs2_dup_block);
-		bc->ea_count++;
-		ret = 1;
-	} else {
-		log_debug("Setting #%" PRIu64 " (0x%" PRIx64
-			  ") to indirect EA block\n", indirect, indirect);
-		gfs2_block_set(sdp, bl, indirect, gfs2_indir_blk);
-		bc->ea_count++;
-	}
-	return ret;
-}
-
-static int finish_eattr_indir(struct gfs2_inode *ip, int indir_ok,
-			      enum update_flags *want_updated, void *private)
-{
-	if (indir_ok) {
-		log_debug("Marking inode #%" PRIu64 " (0x%"
-			  PRIx64 ") with eattr block\n",
-			  ip->i_di.di_num.no_addr, ip->i_di.di_num.no_addr);
-		/* Mark the inode as having an eattr in the block map
-		   so pass1c can check it. */
-		gfs2_block_mark(ip->i_sbd, bl, ip->i_di.di_num.no_addr,
-				gfs2_eattr_block);
-		return 0;
-	}
-	clear_eas(ip, (struct block_count *)private, 0, 0, want_updated,
-		  "has unrecoverable indirect EA errors");
-	return 0;
-}
-
-/**
- * check_extended_leaf_eattr
- * @ip
- * @el_blk: block number of the extended leaf
- *
- * An EA leaf block can contain EA's with pointers to blocks
- * where the data for that EA is kept.  Those blocks still
- * have the gfs2 meta header of type GFS2_METATYPE_EA
- *
- * Returns: 0 if correct[able], -1 if removal is needed
- */
-static int check_extended_leaf_eattr(struct gfs2_inode *ip, uint64_t *data_ptr,
-				     struct gfs2_buffer_head *leaf_bh,
-				     struct gfs2_ea_header *ea_hdr,
-				     struct gfs2_ea_header *ea_hdr_prev,
-				     enum update_flags *want_updated,
-				     void *private)
-{
-	struct gfs2_buffer_head *el_buf;
-	struct gfs2_sbd *sdp = ip->i_sbd;
-	struct gfs2_block_query q;
-	uint64_t el_blk = be64_to_cpu(*data_ptr);
-	struct block_count *bc = (struct block_count *) private;
-	int ret = 0;
-
-	if(gfs2_check_range(sdp, el_blk)){
-		log_err("Inode #%" PRIu64 " (0x%" PRIx64 "): EA extended "
-			"leaf block #%" PRIu64 " (0x%" PRIx64
-			") is out of range.\n",
-			ip->i_di.di_num.no_addr, ip->i_di.di_num.no_addr,
-			el_blk, el_blk);
-		gfs2_block_set(sdp, bl, ip->i_di.di_eattr, gfs2_bad_block);
-		return 1;
-	}
-
-	if(gfs2_block_check(sdp, bl, el_blk, &q)) {
-		stack;
-		return -1;
-	}
-	el_buf = bread(&sdp->buf_list, el_blk);
-
-	/* Special duplicate processing:  If we have an EA block,
-	   check if it really is an EA.  If it is, let duplicate
-	   handling sort it out.  If it isn't, clear it but don't
-	   count it as a duplicate. */
-	if(gfs2_check_meta(el_buf, GFS2_METATYPE_ED)) {
-		if(q.block_type != gfs2_block_free) /* Duplicate? */
-			clear_eas(ip, bc, el_blk, 1, want_updated,
-				  "has bad extended EA duplicate");
-		else
-			clear_eas(ip, bc, el_blk, 0, want_updated,
-				  "EA extended leaf block has incorrect type");
-		ret = 1;
-	} else { /* If this looks like an EA */
-		if(q.block_type != gfs2_block_free) { /* Duplicate? */
-			log_debug("Duplicate block found at #%" PRIu64
-				  " (0x%" PRIx64 ").\n",
-				  el_blk, el_blk);
-			gfs2_block_set(sdp, bl, el_blk, gfs2_dup_block);
-			bc->ea_count++;
-			ret = 1;
-		} else {
-			log_debug("Setting block #%" PRIu64
-				  " (0x%" PRIx64 ") to eattr block\n",
-				  el_blk, el_blk);
-			gfs2_block_set(sdp, bl, el_blk, gfs2_meta_eattr);
-			bc->ea_count++;
-		}
-	}
-
-	brelse(el_buf, not_updated);
-	return ret;
-}
-
-static int check_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
-			    uint64_t parent, struct gfs2_buffer_head **bh,
-			    enum update_flags *want_updated, void *private)
-{
-	struct gfs2_sbd *sdp = ip->i_sbd;
-	struct gfs2_buffer_head *leaf_bh = NULL;
-	int ret = 0;
-	struct gfs2_block_query q = {0};
-	struct block_count *bc = (struct block_count *) private;
-
-	/* This inode contains an eattr - it may be invalid, but the
-	 * eattr attributes points to a non-zero block */
-	if (parent != ip->i_di.di_num.no_addr) { /* if parent isn't the inode */
-		log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to eattr block\n",
-				  parent, parent);
-		gfs2_block_set(sdp, bl, parent, gfs2_eattr_block);
-	}
-	if(gfs2_check_range(sdp, block)){
-		log_warn("Inode #%" PRIu64 " (0x%" PRIx64 "): EA leaf block "
-			 "#%" PRIu64 " (0x%" PRIx64 ") is out of range.\n",
-			 ip->i_di.di_num.no_addr, ip->i_di.di_num.no_addr,
-			 block, block);
-		gfs2_block_set(sdp, bl, ip->i_di.di_eattr, gfs2_bad_block);
-		ret = 1;
-	}
-	else if(gfs2_block_check(sdp, bl, block, &q)) {
-		stack;
-		return -1;
-	}
-	else {
-		/* Special duplicate processing:  If we have an EA block,
-		   check if it really is an EA.  If it is, let duplicate
-		   handling sort it out.  If it isn't, clear it but don't
-		   count it as a duplicate. */
-		leaf_bh = bread(&sdp->buf_list, block);
-		if(gfs2_check_meta(leaf_bh, GFS2_METATYPE_EA)) {
-			if(q.block_type != gfs2_block_free) { /* Duplicate? */
-				clear_eas(ip, bc, block, 1, want_updated,
-					  "Bad EA duplicate found");
-			} else {
-				clear_eas(ip, bc, block, 0, want_updated,
-					  "EA leaf block has incorrect type");
-			}
-			ret = 1;
-			brelse(leaf_bh, not_updated);
-		} else { /* If this looks like an EA */
-			if(q.block_type != gfs2_block_free) { /* Duplicate? */
-				log_debug("Duplicate block found at #%" PRIu64
-					  " (0x%" PRIx64 ").\n",
-					  block, block);
-				gfs2_block_set(sdp, bl, block, gfs2_dup_block);
-				bc->ea_count++;
-				ret = 1;
-				brelse(leaf_bh, not_updated);
-			} else {
-				log_debug("Setting block #%" PRIu64
-					  " (0x%" PRIx64 ") to eattr block\n",
-					  block, block);
-				gfs2_block_set(sdp, bl, block,
-					       gfs2_meta_eattr);
-				bc->ea_count++;
-			}
-		}
-	}
-	if (!ret)
-		*bh = leaf_bh;
-
-	return ret;
-}
-
-static int check_eattr_entries(struct gfs2_inode *ip,
-			       struct gfs2_buffer_head *leaf_bh,
-			       struct gfs2_ea_header *ea_hdr,
-			       struct gfs2_ea_header *ea_hdr_prev,
-			       void *private)
-{
-	struct gfs2_sbd *sdp = ip->i_sbd;
-	char ea_name[256];
-
-	if(!ea_hdr->ea_name_len){
-		/* Skip this entry for now */
-		return 1;
-	}
-
-	memset(ea_name, 0, sizeof(ea_name));
-	strncpy(ea_name, (char *)ea_hdr + sizeof(struct gfs2_ea_header),
-		ea_hdr->ea_name_len);
-
-	if(!GFS2_EATYPE_VALID(ea_hdr->ea_type) &&
-	   ((ea_hdr_prev) || (!ea_hdr_prev && ea_hdr->ea_type))){
-		/* Skip invalid entry */
-		return 1;
-	}
-
-	if(ea_hdr->ea_num_ptrs){
-		uint32_t avail_size;
-		int max_ptrs;
-
-		avail_size = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_meta_header);
-		max_ptrs = (be32_to_cpu(ea_hdr->ea_data_len)+avail_size-1)/avail_size;
-
-		if(max_ptrs > ea_hdr->ea_num_ptrs) {
-			return 1;
-		} else {
-			log_debug("  Pointers Required: %d\n  Pointers Reported: %d\n",
-				  max_ptrs, ea_hdr->ea_num_ptrs);
-		}
-	}
-	return 0;
-}
-
-int clear_metalist(struct gfs2_inode *ip, uint64_t block,
-		   struct gfs2_buffer_head **bh, void *private)
-{
-	struct gfs2_block_query q = {0};
-
-	*bh = NULL;
-
-	if(gfs2_block_check(ip->i_sbd, bl, block, &q)) {
-		stack;
-		return -1;
-	}
-	if(!q.dup_block) {
-		gfs2_block_set(ip->i_sbd, bl, block, gfs2_block_free);
-		return 0;
-	}
-	return 0;
-}
-
-int clear_data(struct gfs2_inode *ip, uint64_t block, void *private)
-{
-	struct gfs2_block_query q = {0};
-
-	if(gfs2_block_check(ip->i_sbd, bl, block, &q)) {
-		stack;
-		return -1;
-	}
-	if(!q.dup_block) {
-		gfs2_block_set(ip->i_sbd, bl, block, gfs2_block_free);
-		return 0;
-	}
-	return 0;
-
-}
-
-int clear_leaf(struct gfs2_inode *ip, uint64_t block,
-	       struct gfs2_buffer_head *bh, void *private)
-{
-	struct gfs2_block_query q = {0};
-	log_crit("Clearing leaf #%" PRIu64 " (0x%" PRIx64 ")\n", block, block);
-
-	if(gfs2_block_check(ip->i_sbd, bl, block, &q)) {
-		stack;
-		return -1;
-	}
-	if(!q.dup_block) {
-		log_crit("Setting leaf #%" PRIu64 " (0x%" PRIx64 ") invalid\n",
-				 block, block);
-		if(gfs2_block_set(ip->i_sbd, bl, block, gfs2_block_free)) {
-			stack;
-			return -1;
-		}
-		return 0;
-	}
-	return 0;
-
-}
-
-int add_to_dir_list(struct gfs2_sbd *sbp, uint64_t block)
-{
-	struct dir_info *di = NULL;
-	struct dir_info *newdi;
-
-	/* FIXME: This list should probably be a b-tree or
-	 * something...but since most of the time we're going to be
-	 * tacking the directory onto the end of the list, it doesn't
-	 * matter too much */
-	find_di(sbp, block, &di);
-	if(di) {
-		log_err("Attempting to add directory block #%" PRIu64
-				" (0x%" PRIx64 ") which is already in list\n", block, block);
-		return -1;
-	}
-
-	if(!(newdi = (struct dir_info *) malloc(sizeof(struct dir_info)))) {
-		log_crit("Unable to allocate dir_info structure\n");
-		return -1;
-	}
-	if(!memset(newdi, 0, sizeof(*newdi))) {
-		log_crit("Error while zeroing dir_info structure\n");
-		return -1;
-	}
-
-	newdi->dinode = block;
-	dinode_hash_insert(dir_hash, block, newdi);
-	return 0;
-}
-
-int handle_di(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh,
-			  uint64_t block)
-{
-	struct gfs2_block_query q = {0};
-	struct gfs2_inode *ip;
-	int error;
-	struct block_count bc = {0};
-	struct metawalk_fxns invalidate_metatree = {0};
-	enum update_flags f;
-
-	f = not_updated;
-	invalidate_metatree.check_metalist = clear_metalist;
-	invalidate_metatree.check_data = clear_data;
-	invalidate_metatree.check_leaf = clear_leaf;
-
-	ip = fsck_inode_get(sdp, bh);
-	if (ip->i_di.di_num.no_addr != block) {
-		log_err("Inode #%" PRIu64 " (0x%" PRIx64
-				"): Bad inode address found: %"	PRIu64 " (0x%" PRIx64 ")\n",
-				block, block, ip->i_di.di_num.no_addr,
-				ip->i_di.di_num.no_addr);
-		if(query(&opts, "Fix address in inode at block #%"
-				 PRIu64 " (0x%" PRIx64 ")? (y/n) ", block, block)) {
-			ip->i_di.di_num.no_addr = ip->i_di.di_num.no_formal_ino = block;
-			gfs2_dinode_out(&ip->i_di, ip->i_bh->b_data);
-			f = updated;
-		} else
-			log_err("Address in inode at block #%" PRIu64
-				 " (0x%" PRIx64 ") not fixed\n", block, block);
-	}
-
-	if(gfs2_block_check(sdp, bl, block, &q)) {
-		stack;
-		fsck_inode_put(ip, f);
-		return -1;
-	}
-	if(q.block_type != gfs2_block_free) {
-		log_debug("Found duplicate block at #%" PRIu64 " (0x%" PRIx64 ")\n",
-				  block, block);
-		if(gfs2_block_mark(sdp, bl, block, gfs2_dup_block)) {
-			stack;
-			fsck_inode_put(ip, f);
-			return -1;
-		}
-		fsck_inode_put(ip, f);
-		return 0;
-	}
-
-	switch(ip->i_di.di_mode & S_IFMT) {
-
-	case S_IFDIR:
-		log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to directory inode.\n",
-				  block, block);
-		if(gfs2_block_set(sdp, bl, block, gfs2_inode_dir)) {
-			stack;
-			fsck_inode_put(ip, f);
-			return -1;
-		}
-		if(add_to_dir_list(sdp, block)) {
-			stack;
-			fsck_inode_put(ip, f);
-			return -1;
-		}
-		break;
-	case S_IFREG:
-		log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to file inode.\n",
-				  block, block);
-		if(gfs2_block_set(sdp, bl, block, gfs2_inode_file)) {
-			stack;
-			fsck_inode_put(ip, f);
-			return -1;
-		}
-		break;
-	case S_IFLNK:
-		log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to symlink inode.\n",
-				  block, block);
-		if(gfs2_block_set(sdp, bl, block, gfs2_inode_lnk)) {
-			stack;
-			fsck_inode_put(ip, f);
-			return -1;
-		}
-		break;
-	case S_IFBLK:
-		log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to block dev inode.\n",
-				  block, block);
-		if(gfs2_block_set(sdp, bl, block, gfs2_inode_blk)) {
-			stack;
-			fsck_inode_put(ip, f);
-			return -1;
-		}
-		break;
-	case S_IFCHR:
-		log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to char dev inode.\n",
-				  block, block);
-		if(gfs2_block_set(sdp, bl, block, gfs2_inode_chr)) {
-			stack;
-			fsck_inode_put(ip, f);
-			return -1;
-		}
-		break;
-	case S_IFIFO:
-		log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to fifo inode.\n",
-				  block, block);
-		if(gfs2_block_set(sdp, bl, block, gfs2_inode_fifo)) {
-			stack;
-			fsck_inode_put(ip, f);
-			return -1;
-		}
-		break;
-	case S_IFSOCK:
-		log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to socket inode.\n",
-				  block, block);
-		if(gfs2_block_set(sdp, bl, block, gfs2_inode_sock)) {
-			stack;
-			fsck_inode_put(ip, f);
-			return -1;
-		}
-		break;
-	default:
-		log_debug("Setting %" PRIu64 " (0x%" PRIx64 ") to invalid.\n",
-				  block, block);
-		if(gfs2_block_set(sdp, bl, block, gfs2_meta_inval)) {
-			stack;
-			fsck_inode_put(ip, f);
-			return -1;
-		}
-		gfs2_set_bitmap(sdp, block, GFS2_BLKST_FREE);
-		fsck_inode_put(ip, f);
-		return 0;
-	}
-	if(set_link_count(ip->i_sbd, ip->i_di.di_num.no_addr, ip->i_di.di_nlink)) {
-		stack;
-		fsck_inode_put(ip, f);
-		return -1;
-	}
-
-	/* FIXME: fix height and depth here - wasn't implemented in
-	 * old fsck either, so no biggy... */
-	if (ip->i_di.di_height < compute_height(sdp, ip->i_di.di_size)){
-		log_warn("Dinode #%" PRIu64 " (0x%" PRIx64 ") has bad height  "
-				 "Found %u, Expected >= %u\n", ip->i_di.di_num.no_addr, 
-				 ip->i_di.di_num.no_addr, ip->i_di.di_height,
-				 compute_height(sdp, ip->i_di.di_size));
-			/* once implemented, remove continue statement */
-		log_warn("Marking inode invalid\n");
-		if(gfs2_block_set(sdp, bl, block, gfs2_meta_inval)) {
-			stack;
-			fsck_inode_put(ip, f);
-			return -1;
-		}
-		gfs2_set_bitmap(sdp, block, GFS2_BLKST_FREE);
-		fsck_inode_put(ip, f);
-		return 0;
-	}
-
-	if (S_ISDIR(ip->i_di.di_mode) &&
-	    (ip->i_di.di_flags & GFS2_DIF_EXHASH)) {
-		if (((1 << ip->i_di.di_depth) * sizeof(uint64_t)) != ip->i_di.di_size){
-			log_warn("Directory dinode #%" PRIu64 " (0x%" PRIx64
-					 ") has bad depth.  Found %u, Expected %u\n",
-					 ip->i_di.di_num.no_addr, ip->i_di.di_num.no_addr,
-					 ip->i_di.di_depth,
-					 (1 >> (ip->i_di.di_size/sizeof(uint64_t))));
-			/* once implemented, remove continue statement */
-			log_warn("Marking inode invalid\n");
-			if(gfs2_block_set(sdp, bl, block, gfs2_meta_inval)) {
-				stack;
-				fsck_inode_put(ip, f);
-				return -1;
-			}
-			gfs2_set_bitmap(sdp, block, GFS2_BLKST_FREE);
-			fsck_inode_put(ip, f);
-			return 0;
-		}
-	}
-
-	pass1_fxns.private = &bc;
-
-	error = check_metatree(ip, &pass1_fxns);
-	if(error < 0) {
-		fsck_inode_put(ip, f);
-		return 0;
-	}
-	if(error > 0) {
-		log_warn("Marking inode #%" PRIu64 " (0x%" PRIx64 ") invalid\n",
-			 ip->i_di.di_num.no_addr, ip->i_di.di_num.no_addr);
-		/* FIXME: Must set all leaves invalid as well */
-		check_metatree(ip, &invalidate_metatree);
-		gfs2_block_set(sdp, bl, ip->i_di.di_num.no_addr,
-			       gfs2_meta_inval);
-		gfs2_set_bitmap(sdp, ip->i_di.di_num.no_addr, GFS2_BLKST_FREE);
-		fsck_inode_put(ip, f);
-		return 0;
-	}
-
-	check_inode_eattr(ip, &f, &pass1_fxns);
-
-	if (ip->i_di.di_blocks != 
-		(1 + bc.indir_count + bc.data_count + bc.ea_count)) {
-		log_err("Inode #%" PRIu64 " (0x%" PRIx64 "): Ondisk block count (%"
-				PRIu64 ") does not match what fsck found (%" PRIu64 ")\n",
-				ip->i_di.di_num.no_addr, ip->i_di.di_num.no_addr,
-				ip->i_di.di_blocks,
-				1 + bc.indir_count + bc.data_count + bc.ea_count);
-		if(query(&opts, "Fix ondisk block count? (y/n) ")) {
-			ip->i_di.di_blocks = 1 + bc.indir_count + bc.data_count +
-				bc.ea_count;
-			gfs2_dinode_out(&ip->i_di, ip->i_bh->b_data);
-			f = updated;
-		} else
-			log_err("Bad block count for #%" PRIu64 " (0x%" PRIx64
-					") not fixed\n", ip->i_di.di_num.no_addr,
-					ip->i_di.di_num.no_addr);
-	}
-
-	fsck_inode_put(ip, f);
-	return 0;
-}
-
-int scan_meta(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh,
-			  uint64_t block)
-{
-	if (gfs2_check_meta(bh, 0)) {
-		log_debug("Found invalid metadata at #%" PRIu64 " (0x%" PRIx64 ")\n",
-				  block, block);
-		if(gfs2_block_set(sdp, bl, block, gfs2_meta_inval)) {
-			stack;
-			return -1;
-		}
-		gfs2_set_bitmap(sdp, block, GFS2_BLKST_FREE);
-		return 0;
-	}
-
-	log_debug("Checking metadata block #%" PRIu64 " (0x%" PRIx64 ")\n", block,
-			  block);
-
-	if (!gfs2_check_meta(bh, GFS2_METATYPE_DI)) {
-		/* handle_di calls inode_get, then inode_put, which does brelse.   */
-		/* In order to prevent brelse from getting the count off, hold it. */
-		bhold(bh);
-		if(handle_di(sdp, bh, block)) {
-			stack;
-			return -1;
-		}
-	}
-	/* Ignore everything else - they should be hit by the handle_di step. */
-	/* Don't check NONE either, because check_meta passes everything if   */
-	/* GFS2_METATYPE_NONE is specified.                                   */
-	/* Hopefully, other metadata types such as indirect blocks will be    */
-	/* handled when the inode itself is processed, and if it's not, it    */
-	/* should be caught in pass5.                                         */
-	return 0;
-}
-
-/**
- * pass1 - walk through inodes and check inode state
- *
- * this walk can be done using root inode and depth first search,
- * watching for repeat inode numbers
- *
- * format & type
- * link count
- * duplicate blocks
- * bad blocks
- * inodes size
- * dir info
- */
-int pass1(struct gfs2_sbd *sbp)
-{
-	struct gfs2_buffer_head *bh;
-	osi_list_t *tmp;
-	uint64_t block;
-	struct rgrp_list *rgd;
-	int first;
-	uint64_t i;
-	uint64_t blk_count;
-	uint64_t offset;
-	uint64_t rg_count = 0;
-
-	/* FIXME: In the gfs fsck, we had to mark things like the
-	 * journals and indices and such as 'other_meta' - in gfs2,
-	 * the journals are files and are found in the normal file
-	 * sweep - is there any metadata we need to mark here before
-	 * the sweeps start that we won't find otherwise? */
-
-	/* So, do we do a depth first search starting at the root
-	 * inode, or use the rg bitmaps, or just read every fs block
-	 * to find the inodes?  If we use the depth first search, why
-	 * have pass3 at all - if we use the rg bitmaps, pass5 is at
-	 * least partially invalidated - if we read every fs block,
-	 * things will probably be intolerably slow.  The current fsck
-	 * uses the rg bitmaps, so maybe that's the best way to start
-	 * things - we can change the method later if necessary.
-	 */
-
-	for (tmp = sbp->rglist.next; tmp != &sbp->rglist;
-	     tmp = tmp->next, rg_count++){
-		log_info("Checking metadata in Resource Group #%" PRIu64 "\n",
-				 rg_count);
-		rgd = osi_list_entry(tmp, struct rgrp_list, list);
-		if(gfs2_rgrp_read(sbp, rgd)){
-			stack;
-			return -1;
-		}
-		log_debug("RG at %" PRIu64 " (0x%" PRIx64 ") is %u long\n",
-				  rgd->ri.ri_addr, rgd->ri.ri_addr, rgd->ri.ri_length);
-		for (i = 0; i < rgd->ri.ri_length; i++) {
-			if(gfs2_block_set(sbp, bl, rgd->ri.ri_addr + i,
-					  gfs2_meta_other)){
-				stack;
-				return -1;
-			}
-		}
-
-		offset = sizeof(struct gfs2_rgrp);
-		blk_count = 1;
-		first = 1;
-
-		while (1) {
-			/* "block" is relative to the entire file system */
-			if (gfs2_next_rg_meta(rgd, &block, first))
-				break;
-			warm_fuzzy_stuff(block);
-			if (fsck_abort) { /* if asked to abort */
-				gfs2_rgrp_relse(rgd, not_updated);
-				return 0;
-			}
-			if (skip_this_pass) {
-				printf("Skipping pass 1 is not a good idea.\n");
-				skip_this_pass = FALSE;
-				fflush(stdout);
-			}
-			bh = bread(&sbp->buf_list, block);
-
-			if (scan_meta(sbp, bh, block)) {
-				stack;
-				brelse(bh, not_updated);
-				gfs2_rgrp_relse(rgd, not_updated);
-				return -1;
-			}
-			brelse(bh, not_updated);
-			first = 0;
-		}
-		gfs2_rgrp_relse(rgd, not_updated);
-	}
-	return 0;
-}
diff --git a/gfs2/fsck/pass1b.c b/gfs2/fsck/pass1b.c
deleted file mode 100644
index 88306ad..0000000
--- a/gfs2/fsck/pass1b.c
+++ /dev/null
@@ -1,523 +0,0 @@
-#include <inttypes.h>
-#include <linux_endian.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "libgfs2.h"
-#include "fsck.h"
-#include "osi_list.h"
-#include "util.h"
-#include "metawalk.h"
-#include "inode_hash.h"
-
-struct inode_with_dups {
-	osi_list_t list;
-	uint64_t block_no;
-	int dup_count;
-	int ea_only;
-	uint64_t parent;
-	char *name;
-};
-
-struct blocks {
-	osi_list_t list;
-	uint64_t block_no;
-	osi_list_t ref_inode_list;
-};
-
-struct fxn_info {
-	uint64_t block;
-	int found;
-	int ea_only;    /* The only dups were found in EAs */
-};
-
-struct dup_handler {
-	struct blocks *b;
-	struct inode_with_dups *id;
-	int ref_inode_count;
-	int ref_count;
-};
-
-static inline void inc_if_found(uint64_t block, int not_ea, void *private) {
-	struct fxn_info *fi = (struct fxn_info *) private;
-	if(block == fi->block) {
-		(fi->found)++;
-		if(not_ea)
-			fi->ea_only = 0;
-	}
-}
-
-static int check_metalist(struct gfs2_inode *ip, uint64_t block,
-			  struct gfs2_buffer_head **bh, void *private)
-{
-	inc_if_found(block, 1, private);
-
-	return 0;
-}
-
-static int check_data(struct gfs2_inode *ip, uint64_t block, void *private)
-{
-	inc_if_found(block, 1, private);
-
-	return 0;
-}
-
-static int check_eattr_indir(struct gfs2_inode *ip, uint64_t block,
-			     uint64_t parent, struct gfs2_buffer_head **bh,
-			     enum update_flags *want_updated, void *private)
-{
-	struct gfs2_sbd *sbp = ip->i_sbd;
-	struct gfs2_buffer_head *indir_bh = NULL;
-
-	*want_updated = not_updated;
-	inc_if_found(block, 0, private);
-	indir_bh = bread(&sbp->buf_list, block);
-	*bh = indir_bh;
-
-	return 0;
-}
-
-static int check_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
-			    uint64_t parent, struct gfs2_buffer_head **bh,
-			    enum update_flags *want_updated, void *private)
-{
-	struct gfs2_sbd *sbp = ip->i_sbd;
-	struct gfs2_buffer_head *leaf_bh = NULL;
-
-	*want_updated = not_updated;
-	inc_if_found(block, 0, private);
-	leaf_bh = bread(&sbp->buf_list, block);
-
-	*bh = leaf_bh;
-	return 0;
-}
-
-static int check_eattr_entry(struct gfs2_inode *ip,
-							 struct gfs2_buffer_head *leaf_bh,
-							 struct gfs2_ea_header *ea_hdr,
-							 struct gfs2_ea_header *ea_hdr_prev,
-							 void *private)
-{
-	return 0;
-}
-
-static int check_eattr_extentry(struct gfs2_inode *ip, uint64_t *ea_data_ptr,
-				struct gfs2_buffer_head *leaf_bh,
-				struct gfs2_ea_header *ea_hdr,
-				struct gfs2_ea_header *ea_hdr_prev,
-				enum update_flags *want_updated, void *private)
-{
-	uint64_t block = be64_to_cpu(*ea_data_ptr);
-
-	*want_updated = not_updated;
-	inc_if_found(block, 0, private);
-
-	return 0;
-}
-
-static int find_dentry(struct gfs2_inode *ip, struct gfs2_dirent *de,
-		       struct gfs2_dirent *prev,
-		       struct gfs2_buffer_head *bh, char *filename,
-		       enum update_flags *update, uint16_t *count, void *priv)
-{
-	osi_list_t *tmp1, *tmp2;
-	struct blocks *b;
-	struct inode_with_dups *id;
-	struct gfs2_leaf leaf;
-
-	osi_list_foreach(tmp1, &ip->i_sbd->dup_blocks.list) {
-		b = osi_list_entry(tmp1, struct blocks, list);
-		osi_list_foreach(tmp2, &b->ref_inode_list) {
-			id = osi_list_entry(tmp2, struct inode_with_dups,
-					    list);
-			if(id->name)
-				/* We can only have one parent of
-				 * inodes that contain duplicate
-				 * blocks... */
-				continue;
-			if(id->block_no == de->de_inum.no_addr) {
-				id->name = strdup(filename);
-				id->parent = ip->i_di.di_num.no_addr;
-				log_debug("Duplicate block %" PRIu64 " (0x%" PRIx64
-						  ") is in file or directory %" PRIu64
-						  " (0x%" PRIx64 ") named %s\n", id->block_no,
-						  id->block_no, ip->i_di.di_num.no_addr,
-						  ip->i_di.di_num.no_addr, filename);
-				/* If there are duplicates of
-				 * duplicates, I guess we'll miss them
-				 * here */
-				break;
-			}
-		}
-	}
-	/* Return the number of leaf entries so metawalk doesn't flag this
-	   leaf as having none. */
-	gfs2_leaf_in(&leaf, bh->b_data);
-	*count = leaf.lf_entries;
-	return 0;
-}
-
-static int clear_dup_metalist(struct gfs2_inode *ip, uint64_t block,
-			      struct gfs2_buffer_head **bh, void *private)
-{
-	struct dup_handler *dh = (struct dup_handler *) private;
-
-	if(dh->ref_count == 1)
-		return 1;
-	if(block == dh->b->block_no) {
-		log_err("Found dup in inode \"%s\" (block #%"PRIu64
-				") with block #%"PRIu64"\n",
-				dh->id->name ? dh->id->name : "unknown name",
-				ip->i_di.di_num.no_addr, block);
-		log_err("Inode %s is in directory %"PRIu64" (0x%" PRIx64 ")\n",
-				dh->id->name ? dh->id->name : "",
-				dh->id->parent, dh->id->parent);
-		inode_hash_remove(inode_hash, ip->i_di.di_num.no_addr);
-		/* Setting the block to invalid means the inode is
-		 * cleared in pass2 */
-		gfs2_block_set(ip->i_sbd, bl, ip->i_di.di_num.no_addr,
-			       gfs2_meta_inval);
-	}
-	return 0;
-}
-
-static int clear_dup_data(struct gfs2_inode *ip, uint64_t block, void *private)
-{
-	struct dup_handler *dh = (struct dup_handler *) private;
-
-	if(dh->ref_count == 1) {
-		return 1;
-	}
-	if(block == dh->b->block_no) {
-		log_err("Found dup in inode \"%s\" for block #%" PRIu64
-				" (0x%" PRIx64 ") at block #%" PRIu64 " (0x%" PRIx64 ")\n",
-				dh->id->name ? dh->id->name : "unknown name",
-				ip->i_di.di_num.no_addr, ip->i_di.di_num.no_addr, block,
-				block);
-		log_err("Inode %s is in directory %"PRIu64" (0x%" PRIx64 ")\n",
-				dh->id->name ? dh->id->name : "", dh->id->parent,
-				dh->id->parent);
-		inode_hash_remove(inode_hash, ip->i_di.di_num.no_addr);
-		/* Setting the block to invalid means the inode is
-		 * cleared in pass2 */
-		gfs2_block_set(ip->i_sbd, bl, ip->i_di.di_num.no_addr,
-			       gfs2_meta_inval);
-	}
-
-	return 0;
-}
-static int clear_dup_eattr_indir(struct gfs2_inode *ip, uint64_t block,
-				 uint64_t parent, struct gfs2_buffer_head **bh,
-				 enum update_flags *want_updated,
-				 void *private)
-{
-	struct dup_handler *dh = (struct dup_handler *) private;
-	/* Can't use fxns from eattr.c since we need to check the ref
-	 * count */
-	*bh = NULL;
-	*want_updated = not_updated;
-	if(dh->ref_count == 1)
-		return 1;
-	if(block == dh->b->block_no) {
-		log_err("Found dup in inode \"%s\" with address #%" PRIu64
-				" (0x%" PRIx64 ") with block #%" PRIu64 " (0x%" PRIx64 ")\n",
-				dh->id->name ? dh->id->name : "unknown name",
-				ip->i_di.di_num.no_addr, ip->i_di.di_num.no_addr, block,
-				block);
-		log_err("Inode %s is in directory %" PRIu64 " (0x%" PRIx64 ")\n",
-				dh->id->name ? dh->id->name : "",
-				dh->id->parent, dh->id->parent);
-		gfs2_block_set(ip->i_sbd, bl, ip->i_di.di_eattr,
-			       gfs2_meta_inval);
-	}
-
-	return 0;
-}
-
-static int clear_dup_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
-				uint64_t parent, struct gfs2_buffer_head **bh,
-				enum update_flags *want_updated, void *private)
-{
-	struct dup_handler *dh = (struct dup_handler *) private;
-
-	*want_updated = not_updated;
-	if(dh->ref_count == 1)
-		return 1;
-	if(block == dh->b->block_no) {
-		log_err("Found dup in inode \"%s\" with address #%" PRIu64
-				" (0x%" PRIx64 ") with block #%" PRIu64 " (0x%" PRIx64 ")\n",
-				dh->id->name ? dh->id->name : "unknown name",
-				ip->i_di.di_num.no_addr, ip->i_di.di_num.no_addr, block,
-				block);
-		log_err("Inode %s is in directory %" PRIu64 " (0x%" PRIx64 ")\n",
-				dh->id->name ? dh->id->name : "",
-				dh->id->parent, dh->id->parent);
-		/* mark the main eattr block invalid */
-		gfs2_block_set(ip->i_sbd, bl, ip->i_di.di_eattr,
-			       gfs2_meta_inval);
-	}
-
-	return 0;
-}
-
-static int clear_eattr_entry (struct gfs2_inode *ip,
-		       struct gfs2_buffer_head *leaf_bh,
-		       struct gfs2_ea_header *ea_hdr,
-		       struct gfs2_ea_header *ea_hdr_prev,
-		       void *private)
-{
-	struct gfs2_sbd *sdp = ip->i_sbd;
-	char ea_name[256];
-
-	if(!ea_hdr->ea_name_len){
-		/* Skip this entry for now */
-		return 1;
-	}
-
-	memset(ea_name, 0, sizeof(ea_name));
-	strncpy(ea_name, (char *)ea_hdr + sizeof(struct gfs2_ea_header),
-		ea_hdr->ea_name_len);
-
-	if(!GFS2_EATYPE_VALID(ea_hdr->ea_type) &&
-	   ((ea_hdr_prev) || (!ea_hdr_prev && ea_hdr->ea_type))){
-		/* Skip invalid entry */
-		return 1;
-	}
-
-	if(ea_hdr->ea_num_ptrs){
-		uint32_t avail_size;
-		int max_ptrs;
-
-		avail_size = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_meta_header);
-		max_ptrs = (be32_to_cpu(ea_hdr->ea_data_len) + avail_size - 1) /
-			avail_size;
-
-		if(max_ptrs > ea_hdr->ea_num_ptrs)
-			return 1;
-		else {
-			log_debug("  Pointers Required: %d\n  Pointers Reported: %d\n",
-					  max_ptrs, ea_hdr->ea_num_ptrs);
-		}
-	}
-	return 0;
-}
-
-static int clear_eattr_extentry(struct gfs2_inode *ip, uint64_t *ea_data_ptr,
-				struct gfs2_buffer_head *leaf_bh,
-				struct gfs2_ea_header *ea_hdr,
-				struct gfs2_ea_header *ea_hdr_prev,
-				enum update_flags *want_updated,
-				void *private)
-{
-	uint64_t block = be64_to_cpu(*ea_data_ptr);
-	struct dup_handler *dh = (struct dup_handler *) private;
-
-	*want_updated = not_updated;
-	if(dh->ref_count == 1)
-		return 1;
-	if(block == dh->b->block_no) {
-		log_err("Found dup in inode \"%s\" with address #%" PRIu64
-				" (0x%" PRIx64 ") with block #%" PRIu64 " (0x%" PRIx64 ")\n",
-				dh->id->name ? dh->id->name : "unknown name",
-				ip->i_di.di_num.no_addr, ip->i_di.di_num.no_addr, block,
-				block);
-		log_err("Inode %s is in directory %" PRIu64 " (0x%" PRIx64 ")\n",
-				dh->id->name ? dh->id->name : "",
-				dh->id->parent, dh->id->parent);
-		/* mark the main eattr block invalid */
-		gfs2_block_set(ip->i_sbd, bl, ip->i_di.di_eattr,
-			       gfs2_meta_inval);
-	}
-
-	return 0;
-
-}
-
-/* Finds all references to duplicate blocks in the metadata */
-int find_block_ref(struct gfs2_sbd *sbp, uint64_t inode, struct blocks *b)
-{
-	struct gfs2_inode *ip;
-	struct fxn_info myfi = {b->block_no, 0, 1};
-	struct inode_with_dups *id = NULL;
-	struct metawalk_fxns find_refs = {
-		.private = (void*) &myfi,
-		.check_leaf = NULL,
-		.check_metalist = check_metalist,
-		.check_data = check_data,
-		.check_eattr_indir = check_eattr_indir,
-		.check_eattr_leaf = check_eattr_leaf,
-		.check_dentry = NULL,
-		.check_eattr_entry = check_eattr_entry,
-		.check_eattr_extentry = check_eattr_extentry,
-	};
-	enum update_flags update;
-
-	ip = fsck_load_inode(sbp, inode); /* bread, inode_get */
-	log_info("Checking inode %" PRIu64 " (0x%" PRIx64
-			 ")'s metatree for references to block %" PRIu64 " (0x%" PRIx64
-			 ")\n", inode, inode, b->block_no, b->block_no);
-	if(check_metatree(ip, &find_refs)) {
-		stack;
-		fsck_inode_put(ip, not_updated); /* out, brelse, free */
-		return -1;
-	}
-	log_info("Done checking metatree\n");
-	/* Check for ea references in the inode */
-	if(check_inode_eattr(ip, &update, &find_refs) < 0){
-		stack;
-		fsck_inode_put(ip, not_updated); /* out, brelse, free */
-		return -1;
-	}
-	if (myfi.found) {
-		if(!(id = malloc(sizeof(*id)))) {
-			log_crit("Unable to allocate inode_with_dups structure\n");
-			return -1;
-		}
-		if(!(memset(id, 0, sizeof(*id)))) {
-			log_crit("Unable to zero inode_with_dups structure\n");
-			return -1;
-		}
-		log_debug("Found %d entries with block %" PRIu64
-				  " (0x%" PRIx64 ") in inode #%" PRIu64 " (0x%" PRIx64 ")\n",
-				  myfi.found, b->block_no, b->block_no, inode, inode);
-		id->dup_count = myfi.found;
-		id->block_no = inode;
-		id->ea_only = myfi.ea_only;
-		osi_list_add_prev(&id->list, &b->ref_inode_list);
-	}
-	fsck_inode_put(ip, (opts.no ? not_updated : updated)); /* out, brelse, free */
-	return 0;
-}
-
-int handle_dup_blk(struct gfs2_sbd *sbp, struct blocks *b)
-{
-	osi_list_t *tmp;
-	struct inode_with_dups *id;
-	struct metawalk_fxns clear_dup_fxns = {
-		.private = NULL,
-		.check_leaf = NULL,
-		.check_metalist = clear_dup_metalist,
-		.check_data = clear_dup_data,
-		.check_eattr_indir = clear_dup_eattr_indir,
-		.check_eattr_leaf = clear_dup_eattr_leaf,
-		.check_dentry = NULL,
-		.check_eattr_entry = clear_eattr_entry,
-		.check_eattr_extentry = clear_eattr_extentry,
-	};
-	struct gfs2_inode *ip;
-	struct dup_handler dh = {0};
-	enum update_flags update;
-
-	osi_list_foreach(tmp, &b->ref_inode_list) {
-		id = osi_list_entry(tmp, struct inode_with_dups, list);
-		dh.ref_inode_count++;
-		dh.ref_count += id->dup_count;
-	}
-	log_notice("Block %" PRIu64 " (0x%" PRIx64 ") has %d inodes referencing it"
-			   " for a total of %d duplicate references\n",
-			   b->block_no, b->block_no, dh.ref_inode_count,
-			   dh.ref_inode_count, dh.ref_count);
-
-	osi_list_foreach(tmp, &b->ref_inode_list) {
-		id = osi_list_entry(tmp, struct inode_with_dups, list);
-		log_warn("Inode %s has %d reference(s) to block %"PRIu64
-				 " (0x%" PRIx64 ")\n", id->name, id->dup_count, b->block_no,
-				 b->block_no);
-		/* FIXME: User input */
-		log_warn("Clearing...\n");
-		ip = fsck_load_inode(sbp, id->block_no);
-		dh.b = b;
-		dh.id = id;
-		clear_dup_fxns.private = (void *) &dh;
-		/* Clear the EAs for the inode first */
-		check_inode_eattr(ip, &update, &clear_dup_fxns);
-		/* If the dup wasn't only in the EA, clear the inode */
-		if(!id->ea_only)
-			check_metatree(ip, &clear_dup_fxns);
-
-		fsck_inode_put(ip, not_updated); /* out, brelse, free */
-		dh.ref_inode_count--;
-		if(dh.ref_inode_count == 1)
-			break;
-		/* Inode is marked invalid and is removed in pass2 */
-		/* FIXME: other option should be to duplicate the
-		 * block for each duplicate and point the metadata at
-		 * the cloned blocks */
-	}
-	return 0;
-
-}
-
-/* Pass 1b handles finding the previous inode for a duplicate block
- * When found, store the inodes pointing to the duplicate block for
- * use in pass2 */
-int pass1b(struct gfs2_sbd *sbp)
-{
-	struct blocks *b;
-	uint64_t i;
-	struct gfs2_block_query q;
-	osi_list_t *tmp = NULL, *x;
-	struct metawalk_fxns find_dirents = {0};
-	find_dirents.check_dentry = &find_dentry;
-	int rc = 0;
-
-	log_info("Looking for duplicate blocks...\n");
-
-	/* If there were no dups in the bitmap, we don't need to do anymore */
-	if(osi_list_empty(&sbp->dup_blocks.list)) {
-		log_info("No duplicate blocks found\n");
-		return 0;
-	}
-
-	/* Rescan the fs looking for pointers to blocks that are in
-	 * the duplicate block map */
-	log_info("Scanning filesystem for inodes containing duplicate blocks...\n");
-	log_debug("Filesystem has %"PRIu64" (0x%" PRIx64 ") blocks total\n",
-			  last_fs_block, last_fs_block);
-	for(i = 0; i < last_fs_block; i += 1) {
-		warm_fuzzy_stuff(i);
-		if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
-			goto out;
-		log_debug("Scanning block %" PRIu64 " (0x%" PRIx64 ") for inodes\n",
-				  i, i);
-		if(gfs2_block_check(sbp, bl, i, &q)) {
-			stack;
-			rc = -1;
-			goto out;
-		}
-		if((q.block_type == gfs2_inode_dir) ||
-		   (q.block_type == gfs2_inode_file) ||
-		   (q.block_type == gfs2_inode_lnk) ||
-		   (q.block_type == gfs2_inode_blk) ||
-		   (q.block_type == gfs2_inode_chr) ||
-		   (q.block_type == gfs2_inode_fifo) ||
-		   (q.block_type == gfs2_inode_sock)) {
-			osi_list_foreach_safe(tmp, &sbp->dup_blocks.list, x) {
-				b = osi_list_entry(tmp, struct blocks, list);
-				if(find_block_ref(sbp, i, b)) {
-					stack;
-					rc = -1;
-					goto out;
-				}
-			}
-		}
-		if(q.block_type == gfs2_inode_dir) {
-			check_dir(sbp, i, &find_dirents);
-		}
-	}
-
-	/* Fix dups here - it's going to slow things down a lot to fix
-	 * it later */
-	log_info("Handling duplicate blocks\n");
-out:
-	while (!osi_list_empty(&sbp->dup_blocks.list)) {
-		b = osi_list_entry(&sbp->dup_blocks.list.next, struct blocks,
-				   list);
-		if (!skip_this_pass && !rc) /* no error & not asked to skip the rest */
-			handle_dup_blk(sbp, b);
-		osi_list_del(&b->list);
-		free(b);
-	}
-	return rc;
-}
diff --git a/gfs2/fsck/pass1c.c b/gfs2/fsck/pass1c.c
deleted file mode 100644
index fa0e0db..0000000
--- a/gfs2/fsck/pass1c.c
+++ /dev/null
@@ -1,271 +0,0 @@
-#include <inttypes.h>
-#include <linux_endian.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "libgfs2.h"
-#include "fsck.h"
-#include "util.h"
-#include "metawalk.h"
-
-static int remove_eattr_entry(struct gfs2_sbd *sdp,
-			      struct gfs2_buffer_head *leaf_bh,
-			      struct gfs2_ea_header *curr,
-			      struct gfs2_ea_header *prev)
-{
-	log_warn("Removing EA located in block #%"PRIu64" (0x%" PRIx64 ").\n",
-		 leaf_bh->b_blocknr, leaf_bh->b_blocknr);
-	if(!prev)
-		curr->ea_type = GFS2_EATYPE_UNUSED;
-	else {
-		prev->ea_rec_len =
-			cpu_to_be32(be32_to_cpu(curr->ea_rec_len) +
-						be32_to_cpu(prev->ea_rec_len));
-		if (curr->ea_flags & GFS2_EAFLAG_LAST)
-			prev->ea_flags |= GFS2_EAFLAG_LAST;	
-	}
-	return 0;
-}
-
-int check_eattr_indir(struct gfs2_inode *ip, uint64_t block,
-		      uint64_t parent, struct gfs2_buffer_head **bh,
-		      enum update_flags *update, void *private)
-{
-	struct gfs2_sbd *sbp = ip->i_sbd;
-	struct gfs2_block_query q;
-	struct gfs2_buffer_head *indir_bh = NULL;
-
-	*update = not_updated;
-	if(gfs2_check_range(sbp, block)) {
-		log_err("Extended attributes indirect block #%"PRIu64
-			" (0x%" PRIx64 ") for inode #%" PRIu64
-			" (0x%" PRIx64 ") out of range...removing\n",
-			block, block, ip->i_di.di_num.no_addr,
-			ip->i_di.di_num.no_addr);
-		ip->i_di.di_eattr = 0;
-		*update = (opts.no ? not_updated : updated);
-		return 1;
-	}
-	else if (gfs2_block_check(sbp, bl, block, &q)) {
-		stack;
-		return -1;
-	}
-	else if(q.block_type != gfs2_indir_blk) {
-		log_err("Extended attributes indirect block #%"PRIu64
-			" (0x%" PRIx64 ") for inode #%" PRIu64
-			" (0x%" PRIx64 ") invalid...removing\n",
-			block, block, ip->i_di.di_num.no_addr,
-			ip->i_di.di_num.no_addr);
-		ip->i_di.di_eattr = 0;
-		*update = (opts.no ? not_updated : updated);
-		return 1;
-	}
-	else
-		indir_bh = bread(&sbp->buf_list, block);
-
-	*bh = indir_bh;
-	return 0;
-}
-
-int check_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
-		     uint64_t parent, struct gfs2_buffer_head **bh,
-		     enum update_flags *update, void *private)
-{
-	struct gfs2_sbd *sbp = ip->i_sbd;
-	struct gfs2_block_query q;
-
-	*update = not_updated;
-	if(gfs2_check_range(sbp, block)) {
-		log_err("Extended attributes block for inode #%" PRIu64
-			" (0x%" PRIx64 ") out of range...removing\n",
-			ip->i_di.di_num.no_addr, ip->i_di.di_num.no_addr);
-		ip->i_di.di_eattr = 0;
-		*update = (opts.no ? not_updated : updated);
-		return 1;
-	}
-	else if (gfs2_block_check(sbp, bl, block, &q)) {
-		stack;
-		return -1;
-	}
-	else if(q.block_type != gfs2_meta_eattr) {
-		log_err("Extended attributes block for inode #%"PRIu64
-			" (0x%" PRIx64 ") invalid...removing\n",
-			ip->i_di.di_num.no_addr, ip->i_di.di_num.no_addr);
-		ip->i_di.di_eattr = 0;
-		*update = (opts.no ? not_updated : updated);
-		return 1;
-	}
-	else 
-		*bh = bread(&sbp->buf_list, block);
-
-	return 0;
-}
-
-static int check_eattr_entry(struct gfs2_inode *ip,
-			     struct gfs2_buffer_head *leaf_bh,
-			     struct gfs2_ea_header *ea_hdr,
-			     struct gfs2_ea_header *ea_hdr_prev,
-			     void *private)
-{
-	struct gfs2_sbd *sdp = ip->i_sbd;
-	char ea_name[256];
-	uint32_t offset = (uint32_t)(((unsigned long)ea_hdr) -
-			                  ((unsigned long)leaf_bh->b_data));
-	uint32_t max_size = sdp->sd_sb.sb_bsize;
-
-	if(!ea_hdr->ea_name_len){
-		log_err("EA has name length == 0\n");
-		ea_hdr->ea_flags |= GFS2_EAFLAG_LAST;
-		ea_hdr->ea_rec_len = cpu_to_be32(max_size - offset);
-		if(remove_eattr_entry(sdp, leaf_bh, ea_hdr, ea_hdr_prev)){
-			stack;
-			return -1;
-		}
-		return 1;
-	}
-	if(offset + be32_to_cpu(ea_hdr->ea_rec_len) > max_size){
-		log_err("EA rec length too long\n");
-		ea_hdr->ea_flags |= GFS2_EAFLAG_LAST;
-		ea_hdr->ea_rec_len = cpu_to_be32(max_size - offset);
-		if(remove_eattr_entry(sdp, leaf_bh, ea_hdr, ea_hdr_prev)){
-			stack;
-			return -1;
-		}
-		return 1;
-	}
-	if(offset + be32_to_cpu(ea_hdr->ea_rec_len) == max_size &&
-	   (ea_hdr->ea_flags & GFS2_EAFLAG_LAST) == 0){
-		log_err("last EA has no last entry flag\n");
-		ea_hdr->ea_flags |= GFS2_EAFLAG_LAST;
-		if(remove_eattr_entry(sdp, leaf_bh, ea_hdr, ea_hdr_prev)){
-			stack;
-			return -1;
-		}
-		return 1;
-	}
-	if(!ea_hdr->ea_name_len){
-		log_err("EA has name length == 0\n");
-		if(remove_eattr_entry(sdp, leaf_bh, ea_hdr, ea_hdr_prev)){
-			stack;
-			return -1;
-		}
-		return 1;
-	}
-
-	memset(ea_name, 0, sizeof(ea_name));
-	strncpy(ea_name, (char *)ea_hdr + sizeof(struct gfs2_ea_header),
-		ea_hdr->ea_name_len);
-
-	if(!GFS2_EATYPE_VALID(ea_hdr->ea_type) &&
-	   ((ea_hdr_prev) || (!ea_hdr_prev && ea_hdr->ea_type))){
-		log_err("EA (%s) type is invalid (%d > %d).\n",
-			ea_name, ea_hdr->ea_type, GFS2_EATYPE_LAST);
-		if(remove_eattr_entry(sdp, leaf_bh, ea_hdr, ea_hdr_prev)){
-			stack;
-			return -1;
-		}
-		return 1;
-	}
-
-	if(ea_hdr->ea_num_ptrs){
-		uint32_t avail_size;
-		int max_ptrs;
-
-		avail_size = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_meta_header);
-		max_ptrs = (be32_to_cpu(ea_hdr->ea_data_len)+avail_size-1)/avail_size;
-
-		if(max_ptrs > ea_hdr->ea_num_ptrs){
-			log_err("EA (%s) has incorrect number of pointers.\n", ea_name);
-			log_err("  Required:  %d\n"
-				"  Reported:  %d\n",
-				max_ptrs, ea_hdr->ea_num_ptrs);
-			if(remove_eattr_entry(sdp, leaf_bh, ea_hdr, ea_hdr_prev)){
-				stack;
-				return -1;
-			}
-			return 1;
-		} else {
-			log_debug("  Pointers Required: %d\n  Pointers Reported: %d\n",
-					  max_ptrs, ea_hdr->ea_num_ptrs);
-		}
-	}
-	return 0;
-}
-
-int check_eattr_extentry(struct gfs2_inode *ip, uint64_t *ea_ptr,
-			 struct gfs2_buffer_head *leaf_bh,
-			 struct gfs2_ea_header *ea_hdr,
-			 struct gfs2_ea_header *ea_hdr_prev,
-			 enum update_flags *want_updated, void *private)
-{
-	struct gfs2_block_query q;
-	struct gfs2_sbd *sbp = ip->i_sbd;
-
-	*want_updated = not_updated;
-	if(gfs2_block_check(sbp, bl, be64_to_cpu(*ea_ptr), &q)) {
-		stack;
-		return -1;
-	}
-	if(q.block_type != gfs2_meta_eattr) {
-		if(remove_eattr_entry(sbp, leaf_bh, ea_hdr, ea_hdr_prev)){
-			stack;
-			return -1;
-		}
-		return 1;
-	}
-	return 0;
-}
-
-/* Go over all inodes with extended attributes and verify the EAs are
- * valid */
-int pass1c(struct gfs2_sbd *sbp)
-{
-	uint64_t block_no = 0;
-	struct gfs2_buffer_head *bh;
-	struct gfs2_inode *ip = NULL;
-	struct metawalk_fxns pass1c_fxns = { 0 };
-	int error = 0;
-	osi_list_t *tmp, *x;
-	struct special_blocks *ea_block;
-	enum update_flags want_updated = not_updated;
-
-	pass1c_fxns.check_eattr_indir = &check_eattr_indir;
-	pass1c_fxns.check_eattr_leaf = &check_eattr_leaf;
-	pass1c_fxns.check_eattr_entry = &check_eattr_entry;
-	pass1c_fxns.check_eattr_extentry = &check_eattr_extentry;
-	pass1c_fxns.private = NULL;
-
-	log_info("Looking for inodes containing ea blocks...\n");
-	osi_list_foreach_safe(tmp, &sbp->eattr_blocks.list, x) {
-		ea_block = osi_list_entry(tmp, struct special_blocks, list);
-		block_no = ea_block->block;
-
-		if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
-			return 0;
-		bh = bread(&sbp->buf_list, block_no);
-		if (gfs2_check_meta(bh, GFS2_METATYPE_IN)) { /* if a dinode */
-			log_info("EA in inode %"PRIu64" (0x%" PRIx64 ")\n",
-				 block_no, block_no);
-			gfs2_block_clear(sbp, bl, block_no, gfs2_eattr_block);
-			ip = fsck_inode_get(sbp, bh);
-
-			log_debug("Found eattr at %"PRIu64" (0x%" PRIx64 ")\n",
-				  ip->i_di.di_eattr, ip->i_di.di_eattr);
-			/* FIXME: Handle walking the eattr here */
-			error = check_inode_eattr(ip, &want_updated,
-						  &pass1c_fxns);
-			if(error < 0) {
-				stack;
-				brelse(bh, not_updated);
-				return -1;
-			}
-
-			fsck_inode_put(ip, want_updated); /* dinode_out,
-							     brelse, free */
-		} else {
-			brelse(bh, want_updated);
-		}
-	}
-	return 0;
-}
diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
deleted file mode 100644
index 3d29f88..0000000
--- a/gfs2/fsck/pass2.c
+++ /dev/null
@@ -1,773 +0,0 @@
-#include <dirent.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <inttypes.h>
-#include <sys/stat.h>
-
-#include "libgfs2.h"
-#include "fsck.h"
-#include "util.h"
-#include "eattr.h"
-#include "metawalk.h"
-#include "link.h"
-
-#define MAX_FILENAME 256
-
-/* Set children's parent inode in dir_info structure - ext2 does not set
- * dotdot inode here, but instead in pass3 - should we? */
-int set_parent_dir(struct gfs2_sbd *sbp, uint64_t childblock,
-				   uint64_t parentblock)
-{
-	struct dir_info *di;
-
-	if(!find_di(sbp, childblock, &di)) {
-		if(di->dinode == childblock) {
-			if (di->treewalk_parent) {
-				log_err("Another directory at block %" PRIu64
-						" (0x%" PRIx64 ") already contains"
-						" this child - checking %" PRIu64 " (0x%" PRIx64 ")\n",
-						di->treewalk_parent, di->treewalk_parent,
-						parentblock, parentblock);
-				return 1;
-			}
-			di->treewalk_parent = parentblock;
-		}
-	} else {
-		log_err("Unable to find block %"PRIu64" (0x%" PRIx64
-				") in dir_info list\n",	childblock,	childblock);
-		return -1;
-	}
-
-	return 0;
-}
-
-/* Set's the child's '..' directory inode number in dir_info structure */
-int set_dotdot_dir(struct gfs2_sbd *sbp, uint64_t childblock,
-				   uint64_t parentblock)
-{
-	struct dir_info *di;
-
-	if(!find_di(sbp, childblock, &di)) {
-		if(di->dinode == childblock) {
-			/* Special case for root inode because we set
-			 * it earlier */
-			if(di->dotdot_parent && sbp->md.rooti->i_di.di_num.no_addr
-			   != di->dinode) {
-				/* This should never happen */
-				log_crit("Dotdot parent already set for"
-						 " block %"PRIu64" (0x%" PRIx64 ") -> %" PRIu64
-						 " (0x%" PRIx64 ")\n", childblock, childblock,
-						 di->dotdot_parent, di->dotdot_parent);
-				return -1;
-			}
-			di->dotdot_parent = parentblock;
-		}
-	} else {
-		log_err("Unable to find block %"PRIu64" (0x%" PRIx64
-				") in dir_info list\n", childblock, childblock);
-		return -1;
-	}
-
-	return 0;
-
-}
-
-static int check_eattr_indir(struct gfs2_inode *ip, uint64_t block,
-			    uint64_t parent, struct gfs2_buffer_head **bh,
-			     enum update_flags *want_updated, void *private)
-{
-	*want_updated = not_updated;
-	*bh = bread(&ip->i_sbd->buf_list, block);
-	return 0;
-}
-static int check_eattr_leaf(struct gfs2_inode *ip, uint64_t block,
-			    uint64_t parent, struct gfs2_buffer_head **bh,
-			    enum update_flags *want_updated, void *private)
-{
-	*want_updated = not_updated;
-	*bh = bread(&ip->i_sbd->buf_list, block);
-	return 0;
-}
-
-const char *de_type_string(uint8_t de_type)
-{
-	const char *de_types[15] = {"unknown", "fifo", "chrdev", "invalid",
-								"directory", "invalid", "blkdev", "invalid",
-								"file", "invalid", "symlink", "invalid",
-								"socket", "invalid", "wht"};
-	if (de_type < 15)
-		return de_types[de_type];
-	return de_types[3]; /* invalid */
-}
-
-static int check_file_type(uint8_t de_type, uint8_t block_type)
-{
-	switch(block_type) {
-	case gfs2_inode_dir:
-		if(de_type != DT_DIR)
-			return 1;
-		break;
-	case gfs2_inode_file:
-		if(de_type != DT_REG)
-			return 1;
-		break;
-	case gfs2_inode_lnk:
-		if(de_type != DT_LNK)
-			return 1;
-		break;
-	case gfs2_inode_blk:
-		if(de_type != DT_BLK)
-			return 1;
-		break;
-	case gfs2_inode_chr:
-		if(de_type != DT_CHR)
-			return 1;
-		break;
-	case gfs2_inode_fifo:
-		if(de_type != DT_FIFO)
-			return 1;
-		break;
-	case gfs2_inode_sock:
-		if(de_type != DT_SOCK)
-			return 1;
-		break;
-	default:
-		log_err("Invalid block type\n");
-		return -1;
-		break;
-	}
-	return 0;
-}
-
-/* FIXME: should maybe refactor this a bit - but need to deal with
- * FIXMEs internally first */
-int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
-		 struct gfs2_dirent *prev_de,
-		 struct gfs2_buffer_head *bh, char *filename,
-		 enum update_flags *update, uint16_t *count, void *priv)
-{
-	struct gfs2_sbd *sbp = ip->i_sbd;
-	struct gfs2_block_query q = {0};
-	char tmp_name[MAX_FILENAME];
-	uint64_t entryblock;
-	struct dir_status *ds = (struct dir_status *) priv;
-	int error;
-	struct gfs2_inode *entry_ip = NULL;
-	struct metawalk_fxns clear_eattrs = {0};
-	struct gfs2_dirent dentry, *de;
-	uint32_t calculated_hash;
-
-	*update = not_updated;
-	memset(&dentry, 0, sizeof(struct gfs2_dirent));
-	gfs2_dirent_in(&dentry, (char *)dent);
-	de = &dentry;
-
-	clear_eattrs.check_eattr_indir = clear_eattr_indir;
-	clear_eattrs.check_eattr_leaf = clear_eattr_leaf;
-	clear_eattrs.check_eattr_entry = clear_eattr_entry;
-	clear_eattrs.check_eattr_extentry = clear_eattr_extentry;
-
-	entryblock = de->de_inum.no_addr;
-
-	/* Start of checks */
-	if (de->de_rec_len < GFS2_DIRENT_SIZE(de->de_name_len)){
-		log_err("Dir entry with bad record or name length\n"
-			"\tRecord length = %u\n"
-			"\tName length = %u\n",
-			de->de_rec_len,
-			de->de_name_len);
-		gfs2_block_set(sbp, bl, ip->i_di.di_num.no_addr,
-			       gfs2_meta_inval);
-		return 1;
-		/* FIXME: should probably delete the entry here at the
-		 * very least - maybe look at attempting to fix it */
-	}
-	
-	calculated_hash = gfs2_disk_hash(filename, de->de_name_len);
-	if (de->de_hash != calculated_hash){
-	        log_err("Dir entry with bad hash or name length\n"
-					"\tHash found         = %u (0x%x)\n"
-					"\tFilename           = %s\n", de->de_hash, de->de_hash,
-					filename);
-			log_err("\tName length found  = %u\n"
-					"\tHash expected      = %u (0x%x)\n",
-					de->de_name_len, calculated_hash, calculated_hash);
-			if(query(&opts, "Fix directory hash for %s? (y/n) ",
-					 filename)) {
-				de->de_hash = calculated_hash;
-				gfs2_dirent_out(de, (char *)dent);
-				log_err("Directory entry hash for %s fixed.\n", filename);
-			}
-			else {
-				log_err("Directory entry hash for %s not fixed.\n", filename);
-				return 1;
-			}
-	}
-	/* FIXME: This should probably go to the top of the fxn, and
-	 * references to filename should be replaced with tmp_name */
-	memset(tmp_name, 0, MAX_FILENAME);
-	if(de->de_name_len < MAX_FILENAME)
-		strncpy(tmp_name, filename, de->de_name_len);
-	else
-		strncpy(tmp_name, filename, MAX_FILENAME - 1);
-
-	if(gfs2_check_range(ip->i_sbd, entryblock)) {
-		log_err("Block # referenced by directory entry %s is out of range\n",
-				tmp_name);
-		if(query(&opts, 
-				 "Clear directory entry tp out of range block? (y/n) ")) {
-			log_err("Clearing %s\n", tmp_name);
-			dirent2_del(ip, bh, prev_de, dent);
-			*update = updated;
-			return 1;
-		} else {
-			log_err("Directory entry to out of range block remains\n");
-			(*count)++;
-			ds->entry_count++;
-			return 0;
-		}
-	}
-	if(gfs2_block_check(sbp, bl, de->de_inum.no_addr, &q)) {
-		stack;
-		return -1;
-	}
-	/* Get the status of the directory inode */
-	if(q.bad_block) {
-		/* This entry's inode has bad blocks in it */
-
-		/* FIXME: user interface */
-		/* FIXME: do i want to kill the inode here? */
-		/* Handle bad blocks */
-		log_err("Found a bad directory entry: %s\n", filename);
-
-		if(query(&opts, "Clear entry to inode containing bad blocks? (y/n)")) {
-
-			entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr);
-			check_inode_eattr(entry_ip, update, &clear_eattrs);
-			fsck_inode_put(entry_ip, not_updated);
-
-			/* FIXME: make sure all blocks referenced by
-			 * this inode are cleared in the bitmap */
-
-			dirent2_del(ip, bh, prev_de, dent);
-
-			gfs2_block_set(sbp, bl, de->de_inum.no_addr,
-				       gfs2_meta_inval);
-			*update = updated;
-			return 1;
-		} else {
-			log_warn("Entry to inode containing bad blocks remains\n");
-			(*count)++;
-			ds->entry_count++;
-			return 0;
-		}
-
-	}
-	if(q.block_type != gfs2_inode_dir && q.block_type != gfs2_inode_file &&
-	   q.block_type != gfs2_inode_lnk && q.block_type != gfs2_inode_blk &&
-	   q.block_type != gfs2_inode_chr && q.block_type != gfs2_inode_fifo &&
-	   q.block_type != gfs2_inode_sock) {
-		log_err("Directory entry '%s' at block %" PRIu64 " (0x%" PRIx64
-			") in dir inode %" PRIu64 " (0x%" PRIx64
-			") has an invalid block type: %d.\n", tmp_name,
-			de->de_inum.no_addr, de->de_inum.no_addr,
-			ip->i_di.di_num.no_addr, ip->i_di.di_num.no_addr,
-			q.block_type);
-
-		if(query(&opts, "Clear directory entry to non-inode block? (y/n) ")) {
-			/* FIXME: make sure all blocks referenced by
-			 * this inode are cleared in the bitmap */
-
-			dirent2_del(ip, bh, prev_de, dent);
-			*update = updated;
-			log_warn("Directory entry '%s' cleared\n", tmp_name);
-			return 1;
-		} else {
-			log_err("Directory entry to non-inode block remains\n");
-			(*count)++;
-			ds->entry_count++;
-			return 0;
-		}
-	}
-
-	error = check_file_type(de->de_type, q.block_type);
-	if(error < 0) {
-		stack;
-		return -1;
-	}
-	if(error > 0) {
-		log_warn("Type '%s' in dir entry (%s, %" PRIu64 "/0x%" PRIx64 ") "
-				 "conflicts with type '%s' in dinode. (Dir entry is stale.)\n",
-				 de_type_string(de->de_type), tmp_name, 
-				 de->de_inum.no_addr, de->de_inum.no_addr,
-				 block_type_string(&q));
-		if(query(&opts, "Clear stale directory entry? (y/n) ")) {
-			entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr);
-			check_inode_eattr(entry_ip, update, &clear_eattrs);
-			fsck_inode_put(entry_ip, not_updated);
-
-			dirent2_del(ip, bh, prev_de, dent);
-			*update = updated;
-			return 1;
-		} else {
-			log_err("Stale directory entry remains\n");
-			(*count)++;
-			ds->entry_count++;
-			return 0;
-		}
-	}
-
-	if(!strcmp(".", tmp_name)) {
-		log_debug("Found . dentry\n");
-
-		if(ds->dotdir) {
-			log_err("Already found '.' entry in directory %" PRIu64 " (0x%"
-					PRIx64 ")\n",
-					ip->i_di.di_num.no_addr, ip->i_di.di_num.no_addr);
-			if(query(&opts, "Clear duplicate '.' entry? (y/n) ")) {
-
-				entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr);
-				check_inode_eattr(entry_ip, update,
-						  &clear_eattrs);
-				fsck_inode_put(entry_ip, not_updated);
-
-				dirent2_del(ip, bh, prev_de, dent);
-				*update = updated;
-				return 1;
-			} else {
-				log_err("Duplicate '.' entry remains\n");
-				/* FIXME: Should we continue on here
-				 * and check the rest of the '.'
-				 * entry? */
-				increment_link(sbp, de->de_inum.no_addr);
-				(*count)++;
-				ds->entry_count++;
-				return 0;
-			}
-		}
-
-		/* GFS2 does not rely on '.' being in a certain
-		 * location */
-
-		/* check that '.' refers to this inode */
-		if(de->de_inum.no_addr != ip->i_di.di_num.no_addr) {
-			log_err("'.' entry's value incorrect in directory %" PRIu64
-					" (0x%" PRIx64 ").  Points to %"PRIu64
-					" (0x%" PRIx64 ") when it should point to %" PRIu64
-					" (0x%" PRIx64 ").\n",
-					de->de_inum.no_addr, de->de_inum.no_addr,
-					ip->i_di.di_num.no_addr, ip->i_di.di_num.no_addr);
-			if(query(&opts, "Remove '.' reference? (y/n) ")) {
-				entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr);
-				check_inode_eattr(entry_ip, update,
-						  &clear_eattrs);
-				fsck_inode_put(entry_ip, not_updated);
-
-				dirent2_del(ip, bh, prev_de, dent);
-				*update = updated;
-				return 1;
-
-			} else {
-				log_err("Invalid '.' reference remains\n");
-				/* Not setting ds->dotdir here since
-				 * this '.' entry is invalid */
-				increment_link(sbp, de->de_inum.no_addr);
-				(*count)++;
-				ds->entry_count++;
-				return 0;
-			}
-		}
-
-		ds->dotdir = 1;
-		increment_link(sbp, de->de_inum.no_addr);
-		(*count)++;
-		ds->entry_count++;
-
-		return 0;
-	}
-	if(!strcmp("..", tmp_name)) {
-		log_debug("Found .. dentry\n");
-		if(ds->dotdotdir) {
-			log_err("Already found '..' entry in directory %" PRIu64 " (0x%"
-					PRIx64 ")\n",
-					ip->i_di.di_num.no_addr, ip->i_di.di_num.no_addr);
-			if(query(&opts, "Clear duplicate '..' entry? (y/n) ")) {
-
-				entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr);
-				check_inode_eattr(entry_ip, update,
-						  &clear_eattrs);
-				fsck_inode_put(entry_ip, not_updated);
-
-				dirent2_del(ip, bh, prev_de, dent);
-				*update = 1;
-				return 1;
-			} else {
-				log_err("Duplicate '..' entry remains\n");
-				/* FIXME: Should we continue on here
-				 * and check the rest of the '..'
-				 * entry? */
-				increment_link(sbp, de->de_inum.no_addr);
-				(*count)++;
-				ds->entry_count++;
-				return 0;
-			}
-		}
-
-		if(q.block_type != gfs2_inode_dir) {
-			log_err("Found '..' entry  in directory %" PRIu64 " (0x%"
-					PRIx64 ") pointing to"
-					" something that's not a directory",
-					ip->i_di.di_num.no_addr, ip->i_di.di_num.no_addr);
-			if(query(&opts, "Clear bad '..' directory entry? (y/n) ")) {
-				entry_ip = fsck_load_inode(sbp, de->de_inum.no_addr);
-				check_inode_eattr(entry_ip, update,
-						  &clear_eattrs);
-				fsck_inode_put(entry_ip, not_updated);
-
-				dirent2_del(ip, bh, prev_de, dent);
-				*update = 1;
-				return 1;
-			} else {
-				log_err("Bad '..' directory entry remains\n");
-				increment_link(sbp, de->de_inum.no_addr);
-				(*count)++;
-				ds->entry_count++;
-				return 0;
-			}
-		}
-		/* GFS2 does not rely on '..' being in a
-		 * certain location */
-
-		/* Add the address this entry is pointing to
-		 * to this inode's dotdot_parent in
-		 * dir_info */
-		if(set_dotdot_dir(sbp, ip->i_di.di_num.no_addr, entryblock)) {
-			stack;
-			return -1;
-		}
-
-		ds->dotdotdir = 1;
-		increment_link(sbp, de->de_inum.no_addr);
-		*update = (opts.no ? not_updated : updated);
-		(*count)++;
-		ds->entry_count++;
-		return 0;
-	}
-
-	/* After this point we're only concerned with
-	 * directories */
-	if(q.block_type != gfs2_inode_dir) {
-		log_debug("Found non-dir inode dentry\n");
-		increment_link(sbp, de->de_inum.no_addr);
-		*update = (opts.no ? not_updated : updated);
-		(*count)++;
-		ds->entry_count++;
-		return 0;
-	}
-
-	log_debug("Found plain directory dentry\n");
-	error = set_parent_dir(sbp, entryblock, ip->i_di.di_num.no_addr);
-	if(error > 0) {
-		log_err("%s: Hard link to block %" PRIu64" (0x%" PRIx64
-				") detected.\n", filename, entryblock, entryblock);
-
-		if(query(&opts, "Clear hard link to directory? (y/n) ")) {
-			*update = 1;
-
-			dirent2_del(ip, bh, prev_de, dent);
-			log_warn("Directory entry %s cleared\n", filename);
-
-			return 1;
-		} else {
-			log_err("Hard link to directory remains\n");
-			(*count)++;
-			ds->entry_count++;
-			return 0;
-		}
-	}
-	else if (error < 0) {
-		stack;
-		return -1;
-	}
-	increment_link(sbp, de->de_inum.no_addr);
-	*update = (opts.no ? not_updated : updated);
-	(*count)++;
-	ds->entry_count++;
-	/* End of checks */
-	return 0;
-}
-
-
-struct metawalk_fxns pass2_fxns = {
-	.private = NULL,
-	.check_leaf = NULL,
-	.check_metalist = NULL,
-	.check_data = NULL,
-	.check_eattr_indir = check_eattr_indir,
-	.check_eattr_leaf = check_eattr_leaf,
-	.check_dentry = check_dentry,
-	.check_eattr_entry = NULL,
-};
-
-/* Check system directory inode                                           */
-/* Should work for all system directories: root, master, jindex, per_node */
-int check_system_dir(struct gfs2_inode *sysinode, const char *dirname,
-		     void builder(struct gfs2_sbd *sbp))
-{
-	uint64_t iblock = 0;
-	struct dir_status ds = {0};
-	struct gfs2_buffer_head b, *bh = &b;
-	char *filename;
-	int filename_len;
-	char tmp_name[256];
-	enum update_flags update = not_updated;
-	int error = 0;
-
-	log_info("Checking system directory inode '%s'\n", dirname);
-
-	if (sysinode) {
-		iblock = sysinode->i_di.di_num.no_addr;
-		if(gfs2_block_check(sysinode->i_sbd, bl, iblock, &ds.q)) {
-			iblock = sysinode->i_di.di_num.no_addr;
-		}
-	}
-	pass2_fxns.private = (void *) &ds;
-	if(ds.q.bad_block) {
-		/* First check that the directory's metatree is valid */
-		if(check_metatree(sysinode, &pass2_fxns)) {
-			stack;
-			return -1;
-		}
-	}
-	error = check_dir(sysinode->i_sbd, iblock, &pass2_fxns);
-	if(error < 0) {
-		stack;
-		return -1;
-	}
-	if (error > 0)
-		gfs2_block_set(sysinode->i_sbd, bl, iblock, gfs2_meta_inval);
-
-	bh = bhold(sysinode->i_bh);
-	if(check_inode_eattr(sysinode, &update, &pass2_fxns)) {
-		stack;
-		return -1;
-	}
-	if(!ds.dotdir) {
-		log_err("No '.' entry found for %s directory.\n", dirname);
-		sprintf(tmp_name, ".");
-		filename_len = strlen(tmp_name);  /* no trailing NULL */
-		if(!(filename = malloc(sizeof(char) * filename_len))) {
-			log_err("Unable to allocate name string\n");
-			stack;
-			return -1;
-		}
-		if(!(memset(filename, 0, sizeof(char) * filename_len))) {
-			log_err("Unable to zero name string\n");
-			stack;
-			return -1;
-		}
-		memcpy(filename, tmp_name, filename_len);
-		log_warn("Adding '.' entry\n");
-		dir_add(sysinode, filename, filename_len,
-				&(sysinode->i_di.di_num), DT_DIR);
-		increment_link(sysinode->i_sbd,
-					   sysinode->i_di.di_num.no_addr);
-		ds.entry_count++;
-		free(filename);
-		update = 1;
-	}
-	if(sysinode->i_di.di_entries != ds.entry_count) {
-		log_err("%s inode %" PRIu64 " (0x%" PRIx64
-			"): Entries is %d - should be %d\n", dirname,
-			sysinode->i_di.di_num.no_addr,
-			sysinode->i_di.di_num.no_addr,
-			sysinode->i_di.di_entries, ds.entry_count);
-		if(query(&opts, "Fix entries for %s inode %" PRIu64 " (0x%"
-			 PRIx64 ")? (y/n) ", dirname,
-			 sysinode->i_di.di_num.no_addr,
-			 sysinode->i_di.di_num.no_addr)) {
-			sysinode->i_di.di_entries = ds.entry_count;
-			log_warn("Entries updated\n");
-			update = 1;
-		} else {
-			log_err("Entries for inode %" PRIu64 " (0x%" PRIx64
-					") left out of sync\n",
-					sysinode->i_di.di_num.no_addr,
-					sysinode->i_di.di_num.no_addr);
-		}
-	}
-
-	brelse(bh, opts.no ? not_updated : update);
-	return 0;
-}
-
-/**
- * is_system_dir - determine if a given block is for a system directory.
- */
-static inline int is_system_dir(struct gfs2_sbd *sbp, uint64_t block)
-{
-	if (block == sbp->md.rooti->i_di.di_num.no_addr ||
-	    block == sbp->md.jiinode->i_di.di_num.no_addr ||
-	    block == sbp->md.pinode->i_di.di_num.no_addr ||
-	    block == sbp->master_dir->i_di.di_num.no_addr)
-		return TRUE;
-	return FALSE;
-}
-
-/* What i need to do in this pass is check that the dentries aren't
- * pointing to invalid blocks...and verify the contents of each
- * directory. and start filling in the directory info structure*/
-
-/**
- * pass2 - check pathnames
- *
- * verify root inode
- * directory name length
- * entries in range
- */
-int pass2(struct gfs2_sbd *sbp)
-{
-	uint64_t i;
-	struct gfs2_block_query q;
-	struct dir_status ds = {0};
-	struct gfs2_inode *ip;
-	struct gfs2_buffer_head b, *bh = &b;
-	char *filename;
-	int filename_len;
-	char tmp_name[256];
-	int error = 0;
-
-	/* Check all the system directory inodes. */
-	if (check_system_dir(sbp->md.jiinode, "jindex", build_jindex)) {
-		stack;
-		return -1;
-	}
-	if (check_system_dir(sbp->md.pinode, "per_node", build_per_node)) {
-		stack;
-		return -1;
-	}
-	if (check_system_dir(sbp->master_dir, "master", build_master)) {
-		stack;
-		return -1;
-	}
-	if (check_system_dir(sbp->md.rooti, "root", build_root)) {
-		stack;
-		return -1;
-	}
-	log_info("Checking directory inodes.\n");
-	/* Grab each directory inode, and run checks on it */
-	for(i = 0; i < last_fs_block; i++) {
-		warm_fuzzy_stuff(i);
-		if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
-			return 0;
-
-		/* Skip the system inodes - they're checked above */
-		if (is_system_dir(sbp, i))
-			continue;
-
-		if(gfs2_block_check(sbp, bl, i, &q)) {
-			log_err("Can't get block %"PRIu64 " (0x%" PRIx64
-					") from block list\n", i, i);
-			return -1;
-		}
-
-		if(q.block_type != gfs2_inode_dir)
-			continue;
-
-		log_debug("Checking directory inode at block %"PRIu64" (0x%"
-				  PRIx64 ")\n", i, i);
-
-		memset(&ds, 0, sizeof(ds));
-		pass2_fxns.private = (void *) &ds;
-		if(ds.q.bad_block) {
-			/* First check that the directory's metatree
-			 * is valid */
-			ip = fsck_load_inode(sbp, i);
-			if(check_metatree(ip, &pass2_fxns)) {
-				stack;
-				free(ip);
-				return -1;
-			}
-			fsck_inode_put(ip, not_updated);
-		}
-		error = check_dir(sbp, i, &pass2_fxns);
-		if(error < 0) {
-			stack;
-			return -1;
-		}
-		if (error > 0) {
-			struct dir_info *di = NULL;
-			error = find_di(sbp, i, &di);
-			if(error < 0) {
-				stack;
-				return -1;
-			}
-			if(error == 0) {
-				/* FIXME: factor */
-				if(query(&opts, "Remove directory entry for bad"
-						 " inode %"PRIu64" (0x%" PRIx64 ") in %"PRIu64
-						 " (0x%" PRIx64 ")? (y/n)", i, i, di->treewalk_parent,
-						 di->treewalk_parent)) {
-					error = remove_dentry_from_dir(sbp, di->treewalk_parent,
-												   i);
-					if(error < 0) {
-						stack;
-						return -1;
-					}
-					if(error > 0) {
-						log_warn("Unable to find dentry for %"
-								 PRIu64 " (0x%" PRIx64 ") in %" PRIu64
-								 " (0x%" PRIx64 ")\n", i, i,
-								 di->treewalk_parent, di->treewalk_parent);
-					}
-					log_warn("Directory entry removed\n");
-				} else
-					log_err("Directory entry to invalid inode remains.\n");
-			}
-			gfs2_block_set(sbp, bl, i, gfs2_meta_inval);
-		}
-		bh = bread(&sbp->buf_list, i);
-		ip = fsck_inode_get(sbp, bh);
-		if(!ds.dotdir) {
-			log_err("No '.' entry found\n");
-			sprintf(tmp_name, ".");
-			filename_len = strlen(tmp_name);  /* no trailing NULL */
-			if(!(filename = malloc(sizeof(char) * filename_len))) {
-				log_err("Unable to allocate name string\n");
-				stack;
-				return -1;
-			}
-			if(!memset(filename, 0, sizeof(char) * filename_len)) {
-				log_err("Unable to zero name string\n");
-				stack;
-				return -1;
-			}
-			memcpy(filename, tmp_name, filename_len);
-
-			dir_add(ip, filename, filename_len, &(ip->i_di.di_num), DT_DIR);
-			increment_link(ip->i_sbd, ip->i_di.di_num.no_addr);
-			ds.entry_count++;
-			free(filename);
-
-		}
-		fsck_inode_put(ip, not_updated); /* does a brelse */
-
-		bh = bread(&sbp->buf_list, i);
-		ip = fsck_inode_get(sbp, bh);
-		if(ip->i_di.di_entries != ds.entry_count) {
-			log_err("Entries is %d - should be %d for inode block %" PRIu64
-					" (0x%" PRIx64 ")\n",
-					ip->i_di.di_entries, ds.entry_count,
-					ip->i_di.di_num.no_addr, ip->i_di.di_num.no_addr);
-			ip->i_di.di_entries = ds.entry_count;
-			fsck_inode_put(ip, updated); /* does a gfs2_dinode_out, brelse */
-		}
-		else
-			fsck_inode_put(ip, not_updated); /* does a brelse */
-	}
-	return 0;
-}
-
-
-
diff --git a/gfs2/fsck/pass3.c b/gfs2/fsck/pass3.c
deleted file mode 100644
index aa8d007..0000000
--- a/gfs2/fsck/pass3.c
+++ /dev/null
@@ -1,282 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <inttypes.h>
-#include <string.h>
-#include <dirent.h>
-
-#include "libgfs2.h"
-#include "osi_list.h"
-#include "fsck.h"
-#include "lost_n_found.h"
-#include "link.h"
-#include "metawalk.h"
-
-static int attach_dotdot_to(struct gfs2_sbd *sbp, uint64_t newdotdot,
-							uint64_t olddotdot, uint64_t block)
-{
-	char *filename;
-	int filename_len;
-	struct gfs2_inode *ip, *pip;
-
-	ip = fsck_load_inode(sbp, block);
-	pip = fsck_load_inode(sbp, newdotdot);
-	/* FIXME: Need to add some interactive
-	 * options here and come up with a
-	 * good default for non-interactive */
-	/* FIXME: do i need to correct the
-	 * '..' entry for this directory in
-	 * this case? */
-
-	filename_len = strlen("..");
-	if(!(filename = malloc((sizeof(char) * filename_len) + 1))) {
-		log_err("Unable to allocate name\n");
-		fsck_inode_put(ip, not_updated);
-		fsck_inode_put(pip, not_updated);
-		stack;
-		return -1;
-	}
-	if(!memset(filename, 0, (sizeof(char) * filename_len) + 1)) {
-		log_err("Unable to zero name\n");
-		fsck_inode_put(ip, not_updated);
-		fsck_inode_put(pip, not_updated);
-		stack;
-		return -1;
-	}
-	memcpy(filename, "..", filename_len);
-	if(gfs2_dirent_del(ip, NULL, filename, filename_len))
-		log_warn("Unable to remove \"..\" directory entry.\n");
-	else
-		decrement_link(sbp, olddotdot);
-	dir_add(ip, filename, filename_len, &pip->i_di.di_num, DT_DIR);
-	increment_link(sbp, newdotdot);
-	fsck_inode_put(ip, updated);
-	fsck_inode_put(pip, updated);
-	return 0;
-}
-
-struct dir_info *mark_and_return_parent(struct gfs2_sbd *sbp,
-										struct dir_info *di)
-{
-	struct dir_info *pdi;
-	struct gfs2_block_query q_dotdot, q_treewalk;
-
-	di->checked = 1;
-
-	if(!di->treewalk_parent)
-		return NULL;
-
-	if(di->dotdot_parent != di->treewalk_parent) {
-		log_warn("Directory '..' and treewalk connections disagree for inode %"
-				 PRIu64 " (0x%" PRIx64 ")\n", di->dinode, di->dinode);
-		log_notice("'..' has %" PRIu64" (0x%" PRIx64 "), treewalk has %"
-				   PRIu64" (0x%" PRIx64 ")\n", di->dotdot_parent,
-				   di->dotdot_parent, di->treewalk_parent,
-				   di->treewalk_parent);
-		if(gfs2_block_check(sbp, bl, di->dotdot_parent, &q_dotdot)) {
-			log_err("Unable to find block %"PRIu64
-					" (0x%" PRIx64 ") in block map.\n",
-					di->dotdot_parent, di->dotdot_parent);
-			return NULL;
-		}
-		if(gfs2_block_check(sbp, bl, di->treewalk_parent,
-				    &q_treewalk)) {
-			log_err("Unable to find block %"PRIu64
-					" (0x%" PRIx64 ") in block map\n",
-					di->treewalk_parent, di->treewalk_parent);
-			return NULL;
-		}
-		/* if the dotdot entry isn't a directory, but the
-		 * treewalk is, treewalk is correct - if the treewalk
-		 * entry isn't a directory, but the dotdot is, dotdot
-		 * is correct - if both are directories, which do we
-		 * choose? if neither are directories, we have a
-		 * problem - need to move this directory into lost+found
-		 */
-		if(q_dotdot.block_type != gfs2_inode_dir) {
-			if(q_treewalk.block_type != gfs2_inode_dir) {
-				log_err( "Orphaned directory, move to lost+found\n");
-				return NULL;
-			}
-			else {
-				log_warn("Treewalk parent is correct,"
-						 " fixing dotdot -> %"PRIu64" (0x%" PRIx64 ")\n",
-						 di->treewalk_parent, di->treewalk_parent);
-				attach_dotdot_to(sbp, di->treewalk_parent,
-								 di->dotdot_parent, di->dinode);
-				di->dotdot_parent = di->treewalk_parent;
-			}
-		}
-		else {
-			if(q_treewalk.block_type != gfs2_inode_dir) {
-				int error = 0;
-				log_warn(".. parent is valid, but treewalk"
-						 "is bad - reattaching to lost+found");
-
-				/* FIXME: add a dinode for this entry instead? */
-				if(query(&opts, "Remove directory entry for bad"
-						 " inode %"PRIu64" (0x%" PRIx64 ") in %"PRIu64
-						 " (0x%" PRIx64 ")? (y/n)", di->dinode, di->dinode,
-						 di->treewalk_parent, di->treewalk_parent)) {
-					error = remove_dentry_from_dir(sbp, di->treewalk_parent,
-												   di->dinode);
-					if(error < 0) {
-						stack;
-						return NULL;
-					}
-					if(error > 0) {
-						log_warn("Unable to find dentry for block %"
-								 PRIu64" (0x%" PRIx64 ") in %" PRIu64 " (0x%"
-								 PRIx64 ")\n",di->dinode, di->dinode,
-								 di->treewalk_parent, di->treewalk_parent);
-					}
-					log_warn("Directory entry removed\n");
-				} else {
-					log_err("Directory entry to invalid inode remains\n");
-				}
-				log_info("Marking directory unlinked\n");
-
-				return NULL;
-			}
-			else {
-				log_err("Both .. and treewalk parents are "
-						"directories, going with treewalk for "
-						"now...\n");
-				attach_dotdot_to(sbp, di->treewalk_parent,
-								 di->dotdot_parent, di->dinode);
-				di->dotdot_parent = di->treewalk_parent;
-			}
-		}
-	}
-	else {
-		if(gfs2_block_check(sbp, bl, di->dotdot_parent, &q_dotdot)) {
-			log_err("Unable to find parent block %"PRIu64
-					" (0x%" PRIx64 ")  in block map\n",
-					di->dotdot_parent, di->dotdot_parent);
-			return NULL;
-		}
-		if(q_dotdot.block_type != gfs2_inode_dir) {
-			log_err("Orphaned directory at block %" PRIu64 " (0x%" PRIx64
-					") moved to lost+found\n", di->dinode, di->dinode);
-			return NULL;
-		}
-	}
-	find_di(sbp, di->dotdot_parent, &pdi);
-
-	return pdi;
-}
-
-/**
- * pass3 - check connectivity of directories
- *
- * handle disconnected directories
- * handle lost+found directory errors (missing, not a directory, no space)
- */
-int pass3(struct gfs2_sbd *sbp)
-{
-	osi_list_t *tmp;
-	struct dir_info *di, *tdi;
-	struct gfs2_inode *ip;
-	struct gfs2_block_query q;
-	int i;
-
-	find_di(sbp, sbp->md.rooti->i_di.di_num.no_addr, &di);
-	if(di) {
-		log_info("Marking root inode connected\n");
-		di->checked = 1;
-	}
-	find_di(sbp, sbp->master_dir->i_di.di_num.no_addr, &di);
-	if(di) {
-		log_info("Marking master directory inode connected\n");
-		di->checked = 1;
-	}
-
-	/* Go through the directory list, working up through the parents
-	 * until we find one that's been checked already.  If we don't
-	 * find a parent, put in lost+found.
-	 */
-	log_info("Checking directory linkage.\n");
-	for(i = 0; i < FSCK_HASH_SIZE; i++) {
-	osi_list_foreach(tmp, &dir_hash[i]) {
-		di = osi_list_entry(tmp, struct dir_info, list);
-		while(!di->checked) {
-			/* FIXME: Change this so it returns success or
-			 * failure and put the parent inode in a
-			 * param */
-			if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
-				return 0;
-			tdi = mark_and_return_parent(sbp, di);
-
-			/* FIXME: Factor this ? */
-			if(!tdi) {
-				if(gfs2_block_check(sbp, bl, di->dinode, &q)) {
-					stack;
-					return -1;
-				}
-				if(q.bad_block) {
-					log_err("Found unlinked directory containing bad block\n");
-					if(query(&opts,
-					   "Clear unlinked directory with bad blocks? (y/n) ")) {
-						gfs2_block_set(sbp, bl,
-							       di->dinode,
-							       gfs2_block_free);
-						break;
-					} else
-						log_err("Unlinked directory with bad block remains\n");
-				}
-				if(q.block_type != gfs2_inode_dir &&
-				   q.block_type != gfs2_inode_file &&
-				   q.block_type != gfs2_inode_lnk &&
-				   q.block_type != gfs2_inode_blk &&
-				   q.block_type != gfs2_inode_chr &&
-				   q.block_type != gfs2_inode_fifo &&
-				   q.block_type != gfs2_inode_sock) {
-					log_err("Unlinked block marked as inode not an inode\n");
-					gfs2_block_set(sbp, bl, di->dinode,
-						       gfs2_block_free);
-					log_err("Cleared\n");
-					break;
-				}
-
-				log_err("Found unlinked directory at block %" PRIu64
-						" (0x%" PRIx64 ")\n", di->dinode, di->dinode);
-				ip = fsck_load_inode(sbp, di->dinode);
-				/* Don't skip zero size directories
-				 * with eattrs */
-				if(!ip->i_di.di_size && !ip->i_di.di_eattr){
-					log_err("Unlinked directory has zero size.\n");
-					if(query(&opts, "Remove zero-size unlinked directory? (y/n) ")) {
-						gfs2_block_set(sbp, bl,
-							       di->dinode,
-							       gfs2_block_free);
-						fsck_inode_put(ip, not_updated);
-						break;
-					} else {
-						log_err("Zero-size unlinked directory remains\n");
-					}
-				}
-				if(query(&opts, "Add unlinked directory to lost+found? (y/n) ")) {
-					if(add_inode_to_lf(ip)) {
-						fsck_inode_put(ip, not_updated);
-						stack;
-						return -1;
-					}
-					log_warn("Directory relinked to lost+found\n");
-				} else {
-					log_err("Unlinked directory remains unlinked\n");
-				}
-				fsck_inode_put(ip, not_updated);
-				break;
-			}
-			else {
-				log_debug("Directory at block %" PRIu64 " (0x%" 
-						  PRIx64 ") connected\n", di->dinode, di->dinode);
-			}
-			di = tdi;
-		}
-	}
-	}
-	if(lf_dip)
-		log_debug("At end of pass3, lost+found entries is %u\n",
-				  lf_dip->i_di.di_entries);
-	return 0;
-}
diff --git a/gfs2/fsck/pass4.c b/gfs2/fsck/pass4.c
deleted file mode 100644
index 3ec380d..0000000
--- a/gfs2/fsck/pass4.c
+++ /dev/null
@@ -1,173 +0,0 @@
-#include <inttypes.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "libgfs2.h"
-#include "fsck.h"
-#include "lost_n_found.h"
-#include "inode_hash.h"
-
-/* Updates the link count of an inode to what the fsck has seen for
- * link count */
-int fix_inode_count(struct gfs2_sbd *sbp, struct inode_info *ii,
-					struct gfs2_inode *ip)
-{
-	log_info("Fixing inode count for %" PRIu64 " (0x%" PRIx64 ") \n",
-			 ip->i_di.di_num.no_addr, ip->i_di.di_num.no_addr);
-	if(ip->i_di.di_nlink == ii->counted_links)
-		return 0;
-	ip->i_di.di_nlink = ii->counted_links;
-
-	log_debug("Changing inode %" PRIu64 " (0x%" PRIx64 ") to have %u links\n",
-			  ip->i_di.di_num.no_addr, ip->i_di.di_num.no_addr,
-			  ii->counted_links);
-	return 0;
-}
-
-int scan_inode_list(struct gfs2_sbd *sbp, osi_list_t *list) {
-	osi_list_t *tmp;
-	struct inode_info *ii;
-	struct gfs2_inode *ip;
-	int lf_addition = 0;
-	struct gfs2_block_query q;
-	enum update_flags f;
-
-	/* FIXME: should probably factor this out into a generic
-	 * scanning fxn */
-	osi_list_foreach(tmp, list) {
-		if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
-			return 0;
-		f = not_updated;
-		if(!(ii = osi_list_entry(tmp, struct inode_info, list))) {
-			log_crit("osi_list_foreach broken in scan_info_list!!\n");
-			exit(1);
-		}
-		log_debug("Checking reference count on inode at block %" PRIu64
-				  " (0x%" PRIx64 ")\n", ii->inode, ii->inode);
-		if(ii->counted_links == 0) {
-			log_err("Found unlinked inode at %" PRIu64 " (0x%" PRIx64 ")\n",
-					ii->inode, ii->inode);
-			if(gfs2_block_check(sbp, bl, ii->inode, &q)) {
-				stack;
-				return -1;
-			}
-			if(q.bad_block) {
-				log_err("Unlinked inode contains bad blocks\n", ii->inode);
-				if(query(&opts,
-						 "Clear unlinked inode with bad blocks? (y/n) ")) {
-					gfs2_block_set(sbp, bl, ii->inode,
-						       gfs2_block_free);
-					continue;
-				} else
-					log_err("Unlinked inode with bad blocks not cleared\n");
-			}
-			if(q.block_type != gfs2_inode_dir &&
-			   q.block_type != gfs2_inode_file &&
-			   q.block_type != gfs2_inode_lnk &&
-			   q.block_type != gfs2_inode_blk &&
-			   q.block_type != gfs2_inode_chr &&
-			   q.block_type != gfs2_inode_fifo &&
-			   q.block_type != gfs2_inode_sock) {
-				log_err("Unlinked block marked as inode not an inode\n");
-				gfs2_block_set(sbp, bl, ii->inode,
-					       gfs2_block_free);
-				log_err("Cleared\n");
-				continue;
-			}
-			ip = fsck_load_inode(sbp, ii->inode);
-
-			/* We don't want to clear zero-size files with
-			 * eattrs - there might be relevent info in
-			 * them. */
-			if(!ip->i_di.di_size && !ip->i_di.di_eattr){
-				log_err("Unlinked inode has zero size\n");
-				if(query(&opts, "Clear zero-size unlinked inode? (y/n) ")) {
-					gfs2_block_set(sbp, bl, ii->inode,
-						       gfs2_block_free);
-					fsck_inode_put(ip, not_updated);
-					continue;
-				}
-
-			}
-			if(query(&opts, "Add unlinked inode to lost+found? (y/n)")) {
-				f = updated;
-				if(add_inode_to_lf(ip)) {
-					stack;
-					fsck_inode_put(ip, not_updated);
-					return -1;
-				}
-				else {
-					fix_inode_count(sbp, ii, ip);
-					lf_addition = 1;
-				}
-			} else
-				log_err("Unlinked inode left unlinked\n");
-			fsck_inode_put(ip, f);
-		} /* if(ii->counted_links == 0) */
-		else if(ii->link_count != ii->counted_links) {
-			log_err("Link count inconsistent for inode %" PRIu64
-					" (0x%" PRIx64 ") has %u but fsck found %u.\n", ii->inode, 
-					ii->inode, ii->link_count, ii->counted_links);
-			/* Read in the inode, adjust the link count,
-			 * and write it back out */
-			if(query(&opts, "Update link count for inode %"
-				 PRIu64 " (0x%" PRIx64 ") ? (y/n) ", ii->inode, ii->inode)) {
-				ip = fsck_load_inode(sbp, ii->inode); /* bread, inode_get */
-				fix_inode_count(sbp, ii, ip);
-				fsck_inode_put(ip, updated); /* out, brelse, free */
-				log_warn("Link count updated for inode %"
-						 PRIu64 " (0x%" PRIx64 ") \n", ii->inode, ii->inode);
-			} else {
-				log_err("Link count for inode %" PRIu64 " (0x%" PRIx64
-						") still incorrect\n", ii->inode, ii->inode);
-			}
-		}
-		log_debug("block %" PRIu64 " (0x%" PRIx64 ") has link count %d\n",
-				  ii->inode, ii->inode, ii->link_count);
-	} /* osi_list_foreach(tmp, list) */
-
-	if (lf_addition) {
-		if(!(ii = inode_hash_search(inode_hash,
-									lf_dip->i_di.di_num.no_addr))) {
-			log_crit("Unable to find lost+found inode in inode_hash!!\n");
-			return -1;
-		} else {
-			fix_inode_count(sbp, ii, lf_dip);
-		}
-	}
-
-	return 0;
-}
-
-/**
- * pass4 - Check reference counts (pass 2 & 6 in current fsck)
- *
- * handle unreferenced files
- * lost+found errors (missing, not a directory, no space)
- * adjust link count
- * handle unreferenced inodes of other types
- * handle bad blocks
- */
-int pass4(struct gfs2_sbd *sbp)
-{
-	uint32_t i;
-	osi_list_t *list;
-	if(lf_dip)
-		log_debug("At beginning of pass4, lost+found entries is %u\n",
-				  lf_dip->i_di.di_entries);
-	log_info("Checking inode reference counts.\n");
-	for (i = 0; i < FSCK_HASH_SIZE; i++) {
-		if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
-			return 0;
-		list = &inode_hash[i];
-		if(scan_inode_list(sbp, list)) {
-			stack;
-			return -1;
-		}
-	}
-
-	if(lf_dip)
-		log_debug("At end of pass4, lost+found entries is %u\n",
-				  lf_dip->i_di.di_entries);
-	return 0;
-}
diff --git a/gfs2/fsck/pass5.c b/gfs2/fsck/pass5.c
deleted file mode 100644
index 2a2cf4e..0000000
--- a/gfs2/fsck/pass5.c
+++ /dev/null
@@ -1,207 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <inttypes.h>
-#include <stdlib.h>
-
-#include "libgfs2.h"
-#include "fsck.h"
-#include "fs_bits.h"
-#include "util.h"
-
-int convert_mark(struct gfs2_block_query *q, uint32_t *count)
-{
-	if (q->eattr_block) {
-		count[2]++;
-		return GFS2_BLKST_USED;
-	}
-	switch(q->block_type) {
-
-	case gfs2_meta_inval:
-		/* Convert invalid metadata to free blocks */
-	case gfs2_block_free:
-		count[0]++;
-		return GFS2_BLKST_FREE;
-
-	case gfs2_block_used:
-		count[2]++;
-		return GFS2_BLKST_USED;
-
-	case gfs2_inode_dir:
-	case gfs2_inode_file:
-	case gfs2_inode_lnk:
-	case gfs2_inode_blk:
-	case gfs2_inode_chr:
-	case gfs2_inode_fifo:
-	case gfs2_inode_sock:
-		count[1]++;
-		return GFS2_BLKST_DINODE;
-
-	case gfs2_indir_blk:
-	case gfs2_leaf_blk:
-	case gfs2_journal_blk:
-	case gfs2_meta_other:
-	case gfs2_meta_eattr:
-		count[2]++;
-		return GFS2_BLKST_USED;
-
-	default:
-		log_err("Invalid state %d found\n", q->block_type);
-		return -1;
-	}
-	return -1;
-}
-
-int check_block_status(struct gfs2_sbd *sbp, char *buffer, unsigned int buflen,
-					   uint64_t *rg_block, uint64_t rg_data, uint32_t *count)
-{
-	unsigned char *byte, *end;
-	unsigned int bit;
-	unsigned char rg_status, block_status;
-	struct gfs2_block_query q;
-	uint64_t block;
-
-	/* FIXME verify cast */
-	byte = (unsigned char *) buffer;
-	bit = 0;
-	end = (unsigned char *) buffer + buflen;
-
-	while(byte < end) {
-		rg_status = ((*byte >> bit) & GFS2_BIT_MASK);
-		block = rg_data + *rg_block;
-		warm_fuzzy_stuff(block);
-		if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
-			return 0;
-		gfs2_block_check(sbp, bl, block, &q);
-
-		block_status = convert_mark(&q, count);
-
-		/* If one node opens a file and another node deletes it, we
-		   may be left with a block that appears to be "unlinked" in
-		   the bitmap, but nothing links to it. This is a valid case
-		   and should be cleaned up by the file system eventually.
-		   So we ignore it. */
-		if (rg_status == GFS2_BLKST_UNLINKED &&
-		    block_status == GFS2_BLKST_FREE) {
-			log_warn("Unlinked block found at block %"
-				 PRIu64" (0x%" PRIx64 "), left unchanged.\n",
-				 block, block);
-		} else if (rg_status != block_status) {
-			const char *blockstatus[] = {"Free", "Data", "Unlinked", "inode"};
-
-			log_err("Ondisk and fsck bitmaps differ at"
-					" block %"PRIu64" (0x%" PRIx64 ") \n", block, block);
-			log_err("Ondisk status is %u (%s) but FSCK thinks it should be ",
-					rg_status, blockstatus[rg_status]);
-			log_err("%u (%s)\n", block_status, blockstatus[block_status]);
-			log_err("Metadata type is %u (%s)\n", q.block_type,
-					block_type_string(&q));
-
-			if(query(&opts, "Fix bitmap for block %"
-					 PRIu64" (0x%" PRIx64 ") ? (y/n) ", block, block)) {
-				if(gfs2_set_bitmap(sbp, block, block_status))
-					log_err("Failed.\n");
-				else
-					log_err("Succeeded.\n");
-			} else
-				log_err("Bitmap at block %"PRIu64" (0x%" PRIx64
-						") left inconsistent\n", block, block);
-		}
-		(*rg_block)++;
-		bit += GFS2_BIT_SIZE;
-		if (bit >= 8){
-			bit = 0;
-			byte++;
-		}
-	}
-
-	return 0;
-}
-
-enum update_flags update_rgrp(struct gfs2_sbd *sbp, struct rgrp_list *rgp,
-							  uint32_t *count)
-{
-	uint32_t i;
-	struct gfs2_bitmap *bits;
-	uint64_t rg_block = 0;
-	int update = 0;
-
-	for(i = 0; i < rgp->ri.ri_length; i++) {
-		bits = &rgp->bits[i];
-
-		/* update the bitmaps */
-		check_block_status(sbp, rgp->bh[i]->b_data + bits->bi_offset,
-						   bits->bi_len, &rg_block, rgp->ri.ri_data0, count);
-		if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
-			return 0;
-	}
-
-	/* actually adjust counters and write out to disk */
-	if(rgp->rg.rg_free != count[0]) {
-		log_err("RG #%" PRIu64 " (0x%" PRIx64
-				") free count inconsistent: is %u should be %u\n",
-				rgp->ri.ri_addr, rgp->ri.ri_addr, rgp->rg.rg_free, count[0]);
-		rgp->rg.rg_free = count[0];
-		update = 1;
-	}
-	if(rgp->rg.rg_dinodes != count[1]) {
-		log_err("Inode count inconsistent: is %u should be %u\n",
-				rgp->rg.rg_dinodes, count[1]);
-		rgp->rg.rg_dinodes = count[1];
-		update = 1;
-	}
-	if((rgp->ri.ri_data - count[0] - count[1]) != count[2]) {
-		/* FIXME not sure how to handle this case ATM - it
-		 * means that the total number of blocks we've counted
-		 * exceeds the blocks in the rg */
-		log_err("Internal fsck error - AAHHH!\n");
-		exit(1);
-	}
-	if(update) {
-		if(query(&opts, "Update resource group counts? (y/n) ")) {
-			log_warn("Resource group counts updated\n");
-			/* write out the rgrp */
-			gfs2_rgrp_out(&rgp->rg, rgp->bh[0]->b_data);
-			return updated;
-		} else
-			log_err("Resource group counts left inconsistent\n");
-	}
-	return not_updated;
-}
-
-/**
- * pass5 - check resource groups
- *
- * fix free block maps
- * fix used inode maps
- */
-int pass5(struct gfs2_sbd *sbp)
-{
-	osi_list_t *tmp;
-	struct rgrp_list *rgp = NULL;
-	uint32_t count[3];
-	uint64_t rg_count = 0;
-
-	/* Reconcile RG bitmaps with fsck bitmap */
-	for(tmp = sbp->rglist.next; tmp != &sbp->rglist; tmp = tmp->next){
-		enum update_flags f;
-
-		if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
-			return 0;
-		log_info("Verifying Resource Group #%" PRIu64 "\n", rg_count);
-		memset(count, 0, sizeof(count));
-		rgp = osi_list_entry(tmp, struct rgrp_list, list);
-
-		if(gfs2_rgrp_read(sbp, rgp)){
-			stack;
-			return -1;
-		}
-		rg_count++;
-		/* Compare the bitmaps and report the differences */
-		f = update_rgrp(sbp, rgp, count);
-		gfs2_rgrp_relse(rgp, f);
-	}
-	/* Fix up superblock info based on this - don't think there's
-	 * anything to do here... */
-
-	return 0;
-}
diff --git a/gfs2/fsck/rgrepair.c b/gfs2/fsck/rgrepair.c
deleted file mode 100644
index fce2f17..0000000
--- a/gfs2/fsck/rgrepair.c
+++ /dev/null
@@ -1,568 +0,0 @@
-#include <unistd.h>
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-#include "libgfs2.h"
-#include "osi_list.h"
-#include "fsck.h"
-
-int rindex_modified = FALSE;
-struct special_blocks false_rgrps;
-
-#define ri_equal(ondisk, expected, field) (ondisk.field == expected.field)
-
-#define ri_compare(rg, ondisk, expected, field, fmt)	\
-	if (ondisk.field != expected.field) { \
-		log_warn("rindex #%d " #field " discrepancy: index 0x%" fmt \
-			 " != expected: 0x%" fmt "\n",			\
-			 rg + 1, ondisk.field, expected.field);		\
-		ondisk.field = expected.field; \
-		rindex_modified = TRUE; \
-	}
-
-/*
- * find_journal_entry_rgs - find all RG blocks within all journals
- *
- * Since Resource Groups (RGs) are journaled, it is not uncommon for them
- * to appear inside a journal.  But if there is severe damage to the rindex
- * file or some of the RGs, we may need to hunt and peck for RGs and in that
- * case, we don't want to mistake these blocks that look just a real RG
- * for a real RG block.  These are "fake" RGs that need to be ignored for
- * the purposes of finding where things are.
- */
-void find_journaled_rgs(struct gfs2_sbd *sdp)
-{
-	int j, new = 0;
-	unsigned int jblocks;
-	uint64_t b, dblock;
-	uint32_t extlen;
-	struct gfs2_inode *ip;
-	struct gfs2_buffer_head *bh;
-
-	osi_list_init(&false_rgrps.list);
-	for (j = 0; j < sdp->md.journals; j++) {
-		log_debug("Checking for RGs in journal%d.\n", j);
-		ip = sdp->md.journal[j];
-		jblocks = ip->i_di.di_size / sdp->sd_sb.sb_bsize;
-		for (b = 0; b < jblocks; b++) {
-			block_map(ip, b, &new, &dblock, &extlen, 0,
-				  not_updated);
-			if (!dblock)
-				break;
-			bh = bread(&sdp->buf_list, dblock);
-			if (!gfs2_check_meta(bh, GFS2_METATYPE_RG)) {
-				log_debug("False RG found at block "
-					  "0x%" PRIx64 "\n", dblock);
-				gfs2_special_set(&false_rgrps, dblock);
-			}
-			brelse(bh, not_updated);
-		}
-	}
-}
-
-int is_false_rg(uint64_t block)
-{
-	if (blockfind(&false_rgrps, block))
-		return 1;
-	return 0;
-}
-
-/*
- * gfs2_rindex_rebuild - rebuild a corrupt Resource Group (RG) index manually
- *                        where trust_lvl == distrust
- *
- * If this routine is called, it means we have RGs in odd/unexpected places,
- * and there is a corrupt RG or RG index entry.  It also means we can't trust
- * the RG index to be sane, and the RGs don't agree with how mkfs would have
- * built them by default.  So we have no choice but to go through and count 
- * them by hand.  We've tried twice to recover the RGs and RG index, and
- * failed, so this is our last chance to remedy the situation.
- *
- * This routine tries to minimize performance impact by:
- * 1. Skipping through the filesystem at known increments when possible.
- * 2. Shuffle through every block when RGs are not found at the predicted
- *    locations.
- *
- * Note: A GFS2 filesystem differs from a GFS1 file system in that there will
- * only be ONE chunk (i.e. no artificial subdevices on either size of the
- * journals).  The journals and even the rindex are kept as part of the file
- * system, so we need to rebuild that information by hand.  Also, with GFS1,
- * the different chunks ("subdevices") could have different RG sizes, which
- * made for quite a mess when trying to recover RGs.  GFS2 always uses the 
- * same RG size determined by the original mkfs, so recovery is easier.
- *
- */
-int gfs2_rindex_rebuild(struct gfs2_sbd *sdp, osi_list_t *ret_list,
-			 int *num_rgs)
-{
-	struct gfs2_buffer_head *bh;
-	uint64_t shortest_dist_btwn_rgs;
-	uint64_t blk, block_of_last_rg;
-	uint64_t fwd_block, block_bump;
-	uint64_t first_rg_dist, initial_first_rg_dist;
-	struct rgrp_list *calc_rgd, *prev_rgd;
-	int number_of_rgs, rgi;
-	struct gfs2_rindex buf, tmpndx;
-	int rg_was_fnd = FALSE, corrupt_rgs = 0, bitmap_was_fnd;
-	osi_list_t *tmp;
-
-	/* Figure out if there are any RG-looking blocks in the journal we
-	   need to ignore. */
-	find_journaled_rgs(sdp);
-	osi_list_init(ret_list);
-	number_of_rgs = 0;
-	initial_first_rg_dist = first_rg_dist = sdp->sb_addr + 1;
-	block_of_last_rg = sdp->sb_addr + 1;
-	/* ------------------------------------------------------------- */
-	/* First, hunt and peck for the shortest distance between RGs.   */
-	/* Sample several of them because an RG that's been blasted may  */
-	/* look like twice the distance.  If we can find 6 of them, that */
-	/* should be enough to figure out the correct layout.            */
-	/* ------------------------------------------------------------- */
-	shortest_dist_btwn_rgs = sdp->device.length;
-	for (blk = sdp->sb_addr + 1;
-	     blk < sdp->device.length && number_of_rgs < 6;
-	     blk++) {
-		bh = bread(&sdp->nvbuf_list, blk);
-		if (((blk == sdp->sb_addr + 1) ||
-		    (!gfs2_check_meta(bh, GFS2_METATYPE_RG))) &&
-		    !is_false_rg(blk)) {
-			log_debug("RG found at block 0x%" PRIx64 "\n", blk);
-			if (blk > sdp->sb_addr + 1) {
-				uint64_t rgdist;
-				
-				rgdist = blk - block_of_last_rg;
-				log_debug("dist 0x%" PRIx64 " = 0x% " PRIx64
-					  " - 0x%" PRIx64, rgdist,
-					  blk, block_of_last_rg);
-				/* ----------------------------------------- */
-				/* We found an RG.  Check to see if we need  */
-				/* to set the first_rg_dist based on whether */
-				/* it's still at its initial value (i.e. the */
-				/* fs.)  The first rg distance is different  */
-				/* from the rest because of the superblock   */
-				/* and 64K dead space.                       */
-				/* ----------------------------------------- */
-				if (first_rg_dist == initial_first_rg_dist)
-					first_rg_dist = rgdist;
-				if (rgdist < shortest_dist_btwn_rgs) {
-					shortest_dist_btwn_rgs = rgdist;
-					log_debug("(shortest so far)\n");
-				}
-				else
-					log_debug("\n");
-			}
-			block_of_last_rg = blk;
-			number_of_rgs++;
-			blk += 250; /* skip ahead for performance */
-		}
-		brelse(bh, not_updated);
-	}
-	number_of_rgs = 0;
-	gfs2_special_free(&false_rgrps);
-
-	/* -------------------------------------------------------------- */
-	/* Sanity-check our first_rg_dist. If RG #2 got nuked, the        */
-	/* first_rg_dist would measure from #1 to #3, which would be bad. */
-	/* We need to take remedial measures to fix it (from the index).  */
-	/* -------------------------------------------------------------- */
-	log_debug("First RG distance: 0x%" PRIx64 "\n", first_rg_dist);
-	log_debug("Distance between RGs: 0x%" PRIx64 "\n",
-		  shortest_dist_btwn_rgs);
-	if (first_rg_dist >= shortest_dist_btwn_rgs +
-	    (shortest_dist_btwn_rgs / 4)) {
-		/* read in the second RG index entry for this subd. */
-		gfs2_readi(sdp->md.riinode, (char *)&buf,
-			   sizeof(struct gfs2_rindex),
-			   sizeof(struct gfs2_rindex));
-		gfs2_rindex_in(&tmpndx, (char *)&buf);
-		if (tmpndx.ri_addr > sdp->sb_addr + 1) { /* sanity check */
-			log_warn("RG 2 is damaged: getting dist from index: ");
-			first_rg_dist = tmpndx.ri_addr - (sdp->sb_addr + 1);
-			log_warn("0x%" PRIx64 "\n", first_rg_dist);
-		}
-		else {
-			log_warn("RG index 2 is damaged: extrapolating dist: ");
-			first_rg_dist = sdp->device.length -
-				(sdp->rgrps - 1) *
-				(sdp->device.length / sdp->rgrps);
-			log_warn("0x%" PRIx64 "\n", first_rg_dist);
-		}
-		log_debug("Adjusted first RG distance: 0x%" PRIx64 "\n",
-			  first_rg_dist);
-	} /* if first RG distance is within tolerance */
-	/* -------------------------------------------------------------- */
-	/* Now go through the RGs and verify their integrity, fixing as   */
-	/* needed when corruption is encountered.                         */
-	/* -------------------------------------------------------------- */
-	prev_rgd = NULL;
-	block_bump = first_rg_dist;
-	for (blk = sdp->sb_addr + 1; blk <= sdp->device.length;
-	     blk += block_bump) {
-		log_debug("Block 0x%" PRIx64 "\n", blk);
-		bh = bread(&sdp->nvbuf_list, blk);
-		rg_was_fnd = (!gfs2_check_meta(bh, GFS2_METATYPE_RG));
-		brelse(bh, not_updated);
-		/* Allocate a new RG and index. */
-		calc_rgd = malloc(sizeof(struct rgrp_list));
-		if (!calc_rgd) {
-			log_crit("Can't allocate memory for rg repair.\n");
-			return -1;
-		}
-		memset(calc_rgd, 0, sizeof(struct rgrp_list));
-		osi_list_add_prev(&calc_rgd->list, ret_list);
-		calc_rgd->ri.ri_length = 1;
-		calc_rgd->ri.ri_addr = blk;
-		if (!rg_was_fnd) { /* if not an RG */
-			/* ------------------------------------------------- */
-			/* This SHOULD be an RG but isn't.                   */
-			/* ------------------------------------------------- */
-			corrupt_rgs++;
-			if (corrupt_rgs < 5)
-				log_debug("Missing or damaged RG at block %" 
-					  PRIu64 " (0x%" PRIx64 ")\n",
-					  blk, blk);
-			else {
-				log_crit("Error: too many bad RGs.\n");
-				return -1;
-			}
-		}
-		/* ------------------------------------------------ */
-		/* Now go through and count the bitmaps for this RG */
-		/* ------------------------------------------------ */
-		bitmap_was_fnd = FALSE;
-		for (fwd_block = blk + 1;
-		     fwd_block < sdp->device.length; 
-		     fwd_block++) {
-			bh = bread(&sdp->nvbuf_list, fwd_block);
-			bitmap_was_fnd =
-				(!gfs2_check_meta(bh, GFS2_METATYPE_RB));
-			brelse(bh, not_updated);
-			if (bitmap_was_fnd) /* if a bitmap */
-				calc_rgd->ri.ri_length++;
-			else
-				break; /* end of bitmap, so call it quits. */
-		} /* for subsequent bitmaps */
-		
-		gfs2_compute_bitstructs(sdp, calc_rgd);
-		log_debug("Memory allocated for rg at 0x%p, bh:\n",
-			  calc_rgd->ri.ri_addr, calc_rgd->bh);
-		if (!calc_rgd->bh) {
-			log_crit("Can't allocate memory for bitmap repair.\n");
-			return -1;
-		}
-		calc_rgd->ri.ri_data0 = calc_rgd->ri.ri_addr +
-			calc_rgd->ri.ri_length;
-		if (prev_rgd) {
-			uint32_t rgblocks, bitblocks;
-
-			rgblocks = block_bump;
-			rgblocks2bitblocks(sdp->bsize, &rgblocks, &bitblocks);
-
-			prev_rgd->ri.ri_length = bitblocks;
-			prev_rgd->ri.ri_data = rgblocks;
-			prev_rgd->ri.ri_data -= prev_rgd->ri.ri_data %
-				GFS2_NBBY;
-			prev_rgd->ri.ri_bitbytes = prev_rgd->ri.ri_data /
-				GFS2_NBBY;
-			log_debug("Prev ri_data set to: %" PRIx32 ".\n",
-				  prev_rgd->ri.ri_data);
-		}
-		number_of_rgs++;
-		log_warn("%c RG %d at block 0x%" PRIX64 " %s",
-			 (rg_was_fnd ? ' ' : '*'), number_of_rgs, blk,
-			 (rg_was_fnd ? "intact" : "*** DAMAGED ***"));
-		prev_rgd = calc_rgd;
-		block_of_last_rg = blk;
-
-		if (blk == sdp->sb_addr + 1)
-			block_bump = first_rg_dist;
-		else
-			block_bump = shortest_dist_btwn_rgs;
-		if (block_bump != 1)
-			log_warn(" [length 0x%" PRIx64 "]\n", block_bump);
-	} /* for each rg block */
-	/* ----------------------------------------------------------------- */
-	/* If we got to the end of the fs, we still need to fix the          */
-	/* allocation information for the very last RG.                      */
-	/* ----------------------------------------------------------------- */
-	if (prev_rgd && !prev_rgd->ri.ri_data) {
-		uint32_t rgblocks, bitblocks;
-
-		rgblocks = block_bump;
-		rgblocks2bitblocks(sdp->bsize, &rgblocks, &bitblocks);
-
-		prev_rgd->ri.ri_length = bitblocks;
-		prev_rgd->ri.ri_data = rgblocks;
-		prev_rgd->ri.ri_data -= prev_rgd->ri.ri_data % GFS2_NBBY;
-		prev_rgd->ri.ri_bitbytes = prev_rgd->ri.ri_data / GFS2_NBBY;
-		log_debug("Prev ri_data set to: %" PRIx32 ".\n",
-			  prev_rgd->ri.ri_data);
-		prev_rgd = NULL; /* make sure we don't use it later */
-	}
-        /* ---------------------------------------------- */
-        /* Now dump out the information (if verbose mode) */      
-        /* ---------------------------------------------- */
-        log_debug("RG index rebuilt as follows:\n");
-        for (tmp = ret_list, rgi = 0; tmp != ret_list;
-	     tmp = tmp->next, rgi++) {
-                calc_rgd = osi_list_entry(tmp, struct rgrp_list, list);
-                log_debug("%d: 0x%" PRIx64 " / %x / 0x%"
-			  PRIx64 " / 0x%x / 0x%x\n", rgi + 1, 
-			  calc_rgd->ri.ri_addr, calc_rgd->ri.ri_length,
-			  calc_rgd->ri.ri_data0, calc_rgd->ri.ri_data, 
-			  calc_rgd->ri.ri_bitbytes);
-        }
-	*num_rgs = number_of_rgs;
-	return 0;
-}
-
-/*
- * gfs2_rindex_calculate - calculate what the rindex should look like
- *                          in a perfect world (trust_lvl == open_minded)
- *
- * Calculate what the rindex should look like, 
- * so we can later check if all RG index entries are sane.
- * This is a lot easier for gfs2 because we can just call the same libgfs2 
- * functions used by mkfs.
- *
- * Returns: 0 on success, -1 on failure
- * Sets:    sdp->rglist to a linked list of fsck_rgrp structs representing
- *          what we think the rindex should really look like.
- */
-int gfs2_rindex_calculate(struct gfs2_sbd *sdp, osi_list_t *ret_list,
-			   int *num_rgs)
-{
-	osi_list_init(ret_list);
-	sdp->rgsize = GFS2_DEFAULT_RGSIZE; /* compute_rgrp_layout adjusts */
-	device_geometry(sdp);
-	fix_device_geometry(sdp);
-	/* Compute the default resource group layout as mkfs would have done */
-	compute_rgrp_layout(sdp, FALSE);
-	build_rgrps(sdp, FALSE); /* FALSE = calc but don't write to disk. */
-	*num_rgs = 0;
-	log_debug("fs_total_size = 0x%" PRIX64 " blocks.\n",
-		  sdp->device.length);
-	/* ----------------------------------------------------------------- */
-	/* Calculate how many RGs there are supposed to be based on the      */
-	/* rindex filesize.  Remember that our trust level is open-minded    */
-	/* here.  If the filesize of the rindex file is not a multiple of    */
-	/* our rindex structures, then something's wrong and we can't trust  */
-	/* the index.                                                        */
-	/* ----------------------------------------------------------------- */
-	*num_rgs = sdp->md.riinode->i_di.di_size / sizeof(struct gfs2_rindex);
-	log_warn("L2: number of rgs in the index = %d.\n", *num_rgs);
-	return 0;
-}
-
-/*
- * rewrite_rg_block - rewrite ("fix") a buffer with rg or bitmap data
- * returns: 0 if the rg was repaired, otherwise 1
- */
-int rewrite_rg_block(struct gfs2_sbd *sdp, struct rgrp_list *rg,
-		     uint64_t errblock)
-{
-	int x = errblock - rg->ri.ri_addr;
-
-	log_err("Block #%"PRIu64" (0x%" PRIx64") (%d of %d) is neither"
-		" GFS2_METATYPE_RB nor GFS2_METATYPE_RG.\n",
-		rg->bh[x]->b_blocknr, rg->bh[x]->b_blocknr,
-		(int)x+1, (int)rg->ri.ri_length);
-	if (query(&opts, "Fix the RG? (y/n)")) {
-
-		log_err("Attempting to repair the RG.\n");
-		rg->bh[x] = bread(&sdp->nvbuf_list, rg->ri.ri_addr + x);
-		if (x) {
-			struct gfs2_meta_header mh;
-
-			mh.mh_magic = GFS2_MAGIC;
-			mh.mh_type = GFS2_METATYPE_RB;
-			mh.mh_format = GFS2_FORMAT_RB;
-			gfs2_meta_header_out(&mh, rg->bh[x]->b_data);
-		} else {
-			memset(&rg->rg, 0, sizeof(struct gfs2_rgrp));
-			rg->rg.rg_header.mh_magic = GFS2_MAGIC;
-			rg->rg.rg_header.mh_type = GFS2_METATYPE_RG;
-			rg->rg.rg_header.mh_format = GFS2_FORMAT_RG;
-			rg->rg.rg_free = rg->ri.ri_data;
-			gfs2_rgrp_out(&rg->rg, rg->bh[x]->b_data);
-		}
-		brelse(rg->bh[x], updated);
-		return 0;
-	}
-	return 1;
-}
-
-/*
- * rg_repair - try to repair a damaged rg index (rindex)
- * trust_lvl - This is how much we trust the rindex file.
- *             blind_faith means we take the rindex at face value.
- *             open_minded means it might be okay, but we should verify it.
- *             distrust means it's not to be trusted, so we should go to
- *             greater lengths to build it from scratch.
- */
-int rg_repair(struct gfs2_sbd *sdp, int trust_lvl, int *rg_count)
-{
-	int error, descrepencies;
-	osi_list_t expected_rglist;
-	int calc_rg_count, rgcount_from_index, rg;
-	osi_list_t *exp, *act; /* expected, actual */
-	struct gfs2_rindex buf;
-
-	if (trust_lvl == blind_faith)
-		return 0;
-	else if (trust_lvl == open_minded) { /* If we can't trust RG index */
-		/* Calculate our own RG index for comparison */
-		error = gfs2_rindex_calculate(sdp, &expected_rglist,
-					       &calc_rg_count);
-		if (error) { /* If calculated RGs don't match the fs */
-			gfs2_rgrp_free(&expected_rglist, not_updated);
-			return -1;
-		}
-	}
-	else if (trust_lvl == distrust) { /* If we can't trust RG index */
-		error = gfs2_rindex_rebuild(sdp, &expected_rglist,
-					     &calc_rg_count);
-		if (error) {
-			log_crit("Error rebuilding rg list.\n");
-			gfs2_rgrp_free(&expected_rglist, not_updated);
-			return -1;
-		}
-		sdp->rgrps = calc_rg_count;
-	}
-	/* Read in the rindex */
-	osi_list_init(&sdp->rglist); /* Just to be safe */
-	rindex_read(sdp, 0, &rgcount_from_index);
-	if (sdp->md.riinode->i_di.di_size % sizeof(struct gfs2_rindex)) {
-		log_warn("WARNING: rindex file is corrupt.\n");
-		gfs2_rgrp_free(&expected_rglist, not_updated);
-		gfs2_rgrp_free(&sdp->rglist, not_updated);
-		return -1;
-	}
-	log_warn("L%d: number of rgs expected     = %d.\n", trust_lvl + 1,
-		 sdp->rgrps);
-	if (calc_rg_count != sdp->rgrps) {
-		log_warn("L%d: They don't match; either (1) the fs was extended, (2) an odd\n", trust_lvl + 1);
-		log_warn("L%d: rg size was used, or (3) we have a corrupt rg index.\n", trust_lvl + 1);
-		gfs2_rgrp_free(&expected_rglist, not_updated);
-		gfs2_rgrp_free(&sdp->rglist, not_updated);
-		return -1;
-	}
-	/* ------------------------------------------------------------- */
-	/* Now compare the rindex to what we think it should be.         */
-	/* See how far off our expected values are.  If too much, abort. */
-	/* The theory is: if we calculated the index to have 32 RGs and  */
-	/* we have a large number that are completely wrong, we should   */
-	/* abandon this method of recovery and try a better one.         */
-	/* ------------------------------------------------------------- */
-	descrepencies = 0;
-	for (rg = 0, act = sdp->rglist.next, exp = expected_rglist.next;
-	     act != &sdp->rglist && exp != &expected_rglist;
-	     act = act->next, exp = exp->next, rg++) {
-		struct rgrp_list *expected, *actual;
-
-		expected = osi_list_entry(exp, struct rgrp_list, list);
-		actual = osi_list_entry(act, struct rgrp_list, list);
-		if (!ri_equal(actual->ri, expected->ri, ri_addr) ||
-		    !ri_equal(actual->ri, expected->ri, ri_length) ||
-		    !ri_equal(actual->ri, expected->ri, ri_data0) ||
-		    !ri_equal(actual->ri, expected->ri, ri_data) ||
-		    !ri_equal(actual->ri, expected->ri, ri_bitbytes)) {
-			descrepencies++;
-		}
-	}
-	if (trust_lvl < distrust && descrepencies > (trust_lvl * 8)) {
-		log_warn("Level %d didn't work.  Too many descepencies.\n",
-			 trust_lvl + 1);
-		log_warn("%d out of %d RGs did not match what was expected.\n",
-			 descrepencies, rg);
-		gfs2_rgrp_free(&expected_rglist, not_updated);
-		gfs2_rgrp_free(&sdp->rglist, not_updated);
-		return -1;
-	}
-	/* ------------------------------------------------------------- */
-	/* Now compare the rindex to what we think it should be.         */
-	/* Our rindex should be pretty predictable unless we've grown    */
-	/* so look for index problems first before looking at the rgs.   */
-	/* ------------------------------------------------------------- */
-	for (rg = 0, act = sdp->rglist.next, exp = expected_rglist.next;
-	     act != &sdp->rglist && exp != &expected_rglist;
-	     act = act->next, exp = exp->next, rg++) {
-		struct rgrp_list *expected, *actual;
-
-		expected = osi_list_entry(exp, struct rgrp_list, list);
-		actual = osi_list_entry(act, struct rgrp_list, list);
-		ri_compare(rg, actual->ri, expected->ri, ri_addr, PRIx64);
-		ri_compare(rg, actual->ri, expected->ri, ri_length, PRIx32);
-		ri_compare(rg, actual->ri, expected->ri, ri_data0, PRIx64);
-		ri_compare(rg, actual->ri, expected->ri, ri_data, PRIx32);
-		ri_compare(rg, actual->ri, expected->ri, ri_bitbytes,
-			   PRIx32);
-		/* If we modified the index, write it back to disk. */
-		if (rindex_modified) {
-			if (query(&opts, "Fix the index? (y/n)")) {
-				gfs2_rindex_out(&expected->ri, (char *)&buf);
-				gfs2_writei(sdp->md.riinode, (char *)&buf,
-					    rg * sizeof(struct gfs2_rindex),
-					    sizeof(struct gfs2_rindex));
-				actual->ri.ri_addr = expected->ri.ri_addr;
-				actual->ri.ri_length = expected->ri.ri_length;
-				actual->ri.ri_data0 = expected->ri.ri_data0;
-				actual->ri.ri_data = expected->ri.ri_data;
-				actual->ri.ri_bitbytes =
-					expected->ri.ri_bitbytes;
-				/* If our rindex was hosed, ri_length is bad */
-				/* Therefore, gfs2_compute_bitstructs might  */
-				/* have malloced the wrong length for bitmap */
-				/* buffers.  So we have to redo it.          */
-				if (actual->bh)
-					free(actual->bh);
-				if (actual->bits)
-					free(actual->bits);
-				gfs2_compute_bitstructs(sdp, actual);
-			}
-			else
-				log_err("RG index not fixed.\n");
-			rindex_modified = FALSE;
-			
-		}
-	}
-	/* ------------------------------------------------------------- */
-	/* Read the real RGs and check their integrity.                  */
-	/* Now we can somewhat trust the rindex and the RG addresses,    */
-	/* so let's read them in, check them and optionally fix them.    */
-	/* ------------------------------------------------------------- */
-	for (rg = 0, act = sdp->rglist.next; act != &sdp->rglist;
-	     act = act->next, rg++) {
-		struct rgrp_list *rgd;
-		uint64_t prev_err = 0, errblock;
-		int i;
-
-		/* Now we try repeatedly to read in the rg.  For every block */
-		/* we encounter that has errors, repair it and try again.    */
-		i = 0;
-		do {
-			rgd = osi_list_entry(act, struct rgrp_list, list);
-			errblock = gfs2_rgrp_read(sdp, rgd);
-			if (errblock) {
-				if (errblock == prev_err)
-					break;
-				prev_err = errblock;
-				rewrite_rg_block(sdp, rgd, errblock);
-			}
-			else {
-				gfs2_rgrp_relse(rgd, not_updated);
-				break;
-			}
-			i++;
-		} while (i < rgd->ri.ri_length);
-	}
-	*rg_count = rg;
-	gfs2_rgrp_free(&expected_rglist, not_updated);
-	gfs2_rgrp_free(&sdp->rglist, not_updated);
-	return 0;
-}
diff --git a/gfs2/fsck/test.c b/gfs2/fsck/test.c
deleted file mode 100644
index ae12429..0000000
--- a/gfs2/fsck/test.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <stdio.h>
-
-main()
-{
-	char test[10];
-	
-	printf("%d\n", sizeof(test));
-}
diff --git a/gfs2/fsck/test_bitmap.c b/gfs2/fsck/test_bitmap.c
deleted file mode 100644
index 18e23bd..0000000
--- a/gfs2/fsck/test_bitmap.c
+++ /dev/null
@@ -1,38 +0,0 @@
-#include <stdint.h>
-#include <stdio.h>
-#include "log.h"
-#include "bitmap.h"
-
-int main(int argc, char **argv)
-{
-	struct bmap map;
-	uint8_t val = 0;
-
-	bitmap_create(&map, 1000, 8);
-
-	bitmap_set(&map, 1, 3);
-
-	bitmap_get(&map, 1, &val);
-
-	printf("%d\n", val);
-
-	bitmap_set(&map, 2, 7);
-
-	bitmap_get(&map, 2, &val);
-
-	printf("%d\n", val);
-
-	bitmap_get(&map, 3, &val);
-
-	printf("%d\n", val);
-
-	bitmap_clear(&map, 2);
-
-	bitmap_get(&map, 2, &val);
-
-	printf("%d\n", val);
-
-	bitmap_destroy(&map);
-
-
-}
diff --git a/gfs2/fsck/test_block_list.c b/gfs2/fsck/test_block_list.c
deleted file mode 100644
index cd25f05..0000000
--- a/gfs2/fsck/test_block_list.c
+++ /dev/null
@@ -1,91 +0,0 @@
-#include <stdio.h>
-#include <stdint.h>
-#include "block_list.h"
-
-#define BITS 100
-void print_map(struct block_list *il, int count);
-
-int main(int argc, char **argv)
-{
-	int i;
-	struct block_list *il;
-
-	il = block_list_create(BITS, gbmap);
-
-	/*for(i = 0; i < BITS; i++) {
-		block_check(il, i, &k);
-		printf("Block %d is %lu\n", i, k);
-		}*/
-	print_map(il, BITS);
-
-	block_mark(il, 3, meta_free);
-	block_mark(il, 6, inode_lnk);
-	block_mark(il, 6, bad_block);
-	block_mark(il, BITS-2, meta_inval);
-	block_mark(il, BITS-1, meta_free);
-	if(block_mark(il, BITS, meta_free)) {
-		fprintf(stderr, "Block %d out of bounds\n", BITS);
-	}
-
-	/*for(i = 0; i < BITS; i++) {
-		block_check(il, i, &k);
-		printf("Block %d is %lu\n", i, k);
-		}*/
-	print_map(il, BITS);
-
-	for(i = 70; i < 80; i++) {
-		block_mark(il, i, meta_free);
-	}
-
-	block_clear(il, BITS-2, meta_free);
-
-	/*for(i = 0; i < BITS; i++) {
-		block_check(il, i, &k);
-		printf("Block %d is %lu\n", i, k);
-		}*/
-	print_map(il, BITS);
-	return 0;
-
-}
-
-void print_map(struct block_list *il, int count)
-{
-	int i, j;
-	struct block_query q;
-
-	printf("Printing map of blocks - 60 blocks per row\n");
-	j = 0;
-	for(i = 0; i < count; i++) {
-
-		if(j > 59) {
-			printf("\n");
-			j = 0;
-		}
-		else if(!(j %10) && j != 0) {
-			printf(" ");
-		}
-		j++;
-		block_check(il, i, &q);
-		printf("%X", q.block_type);
-
-	}
-	printf("\n");
-
-	printf("Printing map of bad blocks - 60 blocks per row\n");
-	j = 0;
-	for(i = 0; i < count; i++) {
-
-		if(j > 59) {
-			printf("\n");
-			j = 0;
-		}
-		else if(!(j %10) && j != 0) {
-			printf(" ");
-		}
-		j++;
-		block_check(il, i, &q);
-		printf("%X", q.bad_block);
-
-	}
-	printf("\n");
-}
diff --git a/gfs2/fsck/util.c b/gfs2/fsck/util.c
deleted file mode 100644
index 54bc54d..0000000
--- a/gfs2/fsck/util.c
+++ /dev/null
@@ -1,81 +0,0 @@
-#include <inttypes.h>
-#include <linux_endian.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/time.h>
-#include <stdio.h>
-
-#include "libgfs2.h"
-#include "fs_bits.h"
-#include "util.h"
-
-/**
- * compute_height
- * @sdp:
- * @sz:
- *
- */
-int compute_height(struct gfs2_sbd *sdp, uint64_t sz)
-{
-	unsigned int height;
-	uint64_t space, old_space;
-	unsigned int bsize = sdp->sd_sb.sb_bsize;
-	
-	if (sz <= (bsize - sizeof(struct gfs2_dinode)))
-		return 0;
-	
-	height = 1;
-	space = sdp->sd_diptrs * bsize;
-	
-	while (sz > space) {
-		old_space = space;
-		
-		height++;
-		space *= sdp->sd_inptrs;
-		
-		if (space / sdp->sd_inptrs != old_space ||
-			space % sdp->sd_inptrs != 0)
-			break;
-	}
-	return height;
-}
-
-/* Put out a warm, fuzzy message every second so the user     */
-/* doesn't think we hung.  (This may take a long time).       */
-void warm_fuzzy_stuff(uint64_t block)
-{
-	static uint64_t one_percent = 0;
-	static struct timeval tv;
-	static uint32_t seconds = 0;
-	
-	if (!one_percent)
-		one_percent = last_fs_block / 100;
-	if (block - last_reported_block >= one_percent) {
-		last_reported_block = block;
-		gettimeofday(&tv, NULL);
-		if (!seconds)
-			seconds = tv.tv_sec;
-		if (tv.tv_sec - seconds) {
-			static uint64_t percent;
-
-			seconds = tv.tv_sec;
-			if (last_fs_block) {
-				percent = (block * 100) / last_fs_block;
-				log_notice("\r%" PRIu64 " percent complete.\r", percent);
-			}
-		}
-	}
-}
-
-const char *block_type_string(struct gfs2_block_query *q)
-{
-	const char *blktyp[] = {"free", "used", "indirect data", "inode",
-							"file", "symlink", "block dev", "char dev",
-							"fifo", "socket", "dir leaf", "journ data",
-							"other meta", "eattribute", "unused",
-							"invalid"};
-	if (q->block_type < 16)
-		return (blktyp[q->block_type]);
-	return blktyp[15];
-}
diff --git a/gfs2/fsck/util.h b/gfs2/fsck/util.h
deleted file mode 100644
index 96d7c46..0000000
--- a/gfs2/fsck/util.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef __UTIL_H__
-#define __UTIL_H__
-
-#include "libgfs2.h"
-
-#define fsck_lseek(fd, off) \
-  ((lseek((fd), (off), SEEK_SET) == (off)) ? 0 : -1)
-
-int compute_height(struct gfs2_sbd *sdp, uint64_t sz);
-struct di_info *search_list(osi_list_t *list, uint64_t addr);
-void warm_fuzzy_stuff(uint64_t block);
-const char *block_type_string(struct gfs2_block_query *q);
-
-#endif /* __UTIL_H__ */
diff --git a/gfs2/include/gfs2_disk_hash.h b/gfs2/include/gfs2_disk_hash.h
deleted file mode 100644
index caa5e09..0000000
--- a/gfs2/include/gfs2_disk_hash.h
+++ /dev/null
@@ -1,73 +0,0 @@
-#ifndef __GFS2_DISK_HASH_DOT_H__
-#define __GFS2_DISK_HASH_DOT_H__
-
-static const uint32_t crc_32_tab[] =
-{
-  0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
-  0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
-  0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
-  0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
-  0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
-  0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
-  0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
-  0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
-  0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
-  0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
-  0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
-  0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
-  0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
-  0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
-  0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
-  0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
-  0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
-  0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
-  0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
-  0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
-  0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
-  0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
-  0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
-  0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
-  0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
-  0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
-  0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
-  0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
-  0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
-  0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
-  0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
-  0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
-};
-
-/**
- * gfs2_disk_hash - hash an array of data
- * @data: the data to be hashed
- * @len: the length of data to be hashed
- *
- * This function must produce the same results as the one in the kernel:
- *   crc32_le(0xFFFFFFFF, data, len) ^ 0xFFFFFFFF
- *
- * Take some data and convert it to a 32-bit hash.
- *
- * The hash function is a 32-bit CRC of the data.  The algorithm uses
- * the crc_32_tab table above.
- *
- * This may not be the fastest hash function, but it does a fair bit better
- * at providing uniform results than the others I've looked at.  That's
- * really important for efficient directories.
- *
- * Returns: the hash
- */
-
-uint32_t gfs2_disk_hash(const char *data, int len)
-{
-	uint32_t hash = 0xFFFFFFFF;
-
-	for (; len--; data++)
-		hash = crc_32_tab[(hash ^ *data) & 0xFF] ^ (hash >> 8);
-
-	hash = ~hash;
-
-	return hash;
-}
-
-#endif
-
diff --git a/gfs2/include/global.h b/gfs2/include/global.h
deleted file mode 100644
index 02c3eff..0000000
--- a/gfs2/include/global.h
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef __GLOBAL_DOT_H__
-#define __GLOBAL_DOT_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-#if defined(__KERNEL__) || defined(_KERNEL)
-#error "don't use global.h in kernel space"
-#endif
-
-
-
-#ifndef TRUE
-#define TRUE (1)
-#endif
-
-#ifndef FALSE
-#define FALSE (0)
-#endif
-
-
-
-#include <inttypes.h>
-
-typedef uint64_t          uint64;
-typedef uint32_t          uint32;
-typedef uint16_t          uint16;
-typedef uint8_t           uint8;
-typedef int64_t           int64;
-typedef int32_t           int32;
-typedef int16_t           int16;
-typedef int8_t            int8;
-
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __GLOBAL_H__ */
diff --git a/gfs2/include/linux_endian.h b/gfs2/include/linux_endian.h
deleted file mode 100644
index 43089d2..0000000
--- a/gfs2/include/linux_endian.h
+++ /dev/null
@@ -1,68 +0,0 @@
-#ifndef __LINUX_ENDIAN_DOT_H__
-#define __LINUX_ENDIAN_DOT_H__
-
-
-#include <endian.h>
-#include <byteswap.h>
-
-
-/*  I'm not sure which versions of alpha glibc/gcc are broken,
-    so fix all of them.  */
-#ifdef __alpha__
-#undef bswap_64
-static __inline__ unsigned long bswap_64(unsigned long x)
-{
-  unsigned int h = x >> 32;
-  unsigned int l = x;
-
-  h = bswap_32(h);
-  l = bswap_32(l);
-
-  return ((unsigned long)l << 32) | h;
-}
-#endif  /*  __alpha__  */
-
-
-#if __BYTE_ORDER == __BIG_ENDIAN
-
-#define be16_to_cpu(x) (x)
-#define be32_to_cpu(x) (x)
-#define be64_to_cpu(x) (x)
-
-#define cpu_to_be16(x) (x)
-#define cpu_to_be32(x) (x)
-#define cpu_to_be64(x) (x)
-
-#define le16_to_cpu(x) (bswap_16((x)))
-#define le32_to_cpu(x) (bswap_32((x)))
-#define le64_to_cpu(x) (bswap_64((x)))
-
-#define cpu_to_le16(x) (bswap_16((x)))
-#define cpu_to_le32(x) (bswap_32((x)))
-#define cpu_to_le64(x) (bswap_64((x)))
-
-#endif  /*  __BYTE_ORDER == __BIG_ENDIAN  */
-
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-
-#define be16_to_cpu(x) (bswap_16((x)))
-#define be32_to_cpu(x) (bswap_32((x)))
-#define be64_to_cpu(x) (bswap_64((x)))
-
-#define cpu_to_be16(x) (bswap_16((x)))
-#define cpu_to_be32(x) (bswap_32((x)))
-#define cpu_to_be64(x) (bswap_64((x))) 
-
-#define le16_to_cpu(x) (x)
-#define le32_to_cpu(x) (x)
-#define le64_to_cpu(x) (x)
-
-#define cpu_to_le16(x) (x)
-#define cpu_to_le32(x) (x)
-#define cpu_to_le64(x) (x)
-
-#endif  /*  __BYTE_ORDER == __LITTLE_ENDIAN  */
-
-
-#endif  /*  __LINUX_ENDIAN_DOT_H__  */
diff --git a/gfs2/include/osi_list.h b/gfs2/include/osi_list.h
deleted file mode 100644
index 3b1483b..0000000
--- a/gfs2/include/osi_list.h
+++ /dev/null
@@ -1,84 +0,0 @@
-#ifndef __OSI_LIST_DOT_H__
-#define __OSI_LIST_DOT_H__
-
-
-
-struct osi_list
-{
-  struct osi_list *next, *prev;
-};
-typedef struct osi_list osi_list_t;
-
-
-
-#define osi_list_decl(var) osi_list_t var = { &var, &var }
-
-#define osi_list_empty(var) ((var)->next == (var))
-#define osi_list_entry(var, type, mem) ((type *)((unsigned long)(var) - (unsigned long)(&((type *)NULL)->mem)))
-
-
-
-#define osi_list_init(head) \
-do \
-{ \
-  osi_list_t *osi_list_var = (head); \
-  osi_list_var->next = osi_list_var->prev = osi_list_var; \
-} \
-while (0)
-
-#define osi_list_add(new, head) \
-do \
-{ \
-  osi_list_t *osi_list_var_new = (new); \
-  osi_list_t *osi_list_var_head = (head); \
-  osi_list_var_new->next = osi_list_var_head->next; \
-  osi_list_var_new->prev = osi_list_var_head; \
-  osi_list_var_head->next->prev = osi_list_var_new; \
-  osi_list_var_head->next = osi_list_var_new; \
-} \
-while (0)
-
-#define osi_list_add_next osi_list_add
-
-#define osi_list_add_prev(new, head) \
-do \
-{ \
-  osi_list_t *osi_list_var_new = (new); \
-  osi_list_t *osi_list_var_head = (head); \
-  osi_list_var_new->prev = osi_list_var_head->prev; \
-  osi_list_var_new->next = osi_list_var_head; \
-  osi_list_var_head->prev->next = osi_list_var_new; \
-  osi_list_var_head->prev = osi_list_var_new; \
-} \
-while (0)
-
-#define osi_list_del(var) \
-do \
-{ \
-  osi_list_t *osi_list_var = (var); \
-  osi_list_var->next->prev = osi_list_var->prev; \
-  osi_list_var->prev->next = osi_list_var->next; \
-} \
-while (0)
-
-#define osi_list_del_init(var) \
-do \
-{ \
-  osi_list_t *osi_list_var = (var); \
-  osi_list_var->next->prev = osi_list_var->prev; \
-  osi_list_var->prev->next = osi_list_var->next; \
-  osi_list_var->next = osi_list_var->prev = osi_list_var; \
-} \
-while (0)
-
-#define osi_list_foreach(tmp, head) \
-  for ((tmp) = (head)->next; (tmp) != (head); (tmp) = (tmp)->next) 
-
-#define osi_list_foreach_safe(tmp, head, x) \
-  for ((tmp) = (head)->next, (x) = (tmp)->next; \
-       (tmp) != (head); \
-       (tmp) = (x), (x) = (x)->next)
-
-
-
-#endif  /*  __OSI_LIST_DOT_H__  */
diff --git a/gfs2/include/osi_user.h b/gfs2/include/osi_user.h
deleted file mode 100644
index 34964ed..0000000
--- a/gfs2/include/osi_user.h
+++ /dev/null
@@ -1,421 +0,0 @@
-#ifndef __OSI_USER_DOT_H__
-#define __OSI_USER_DOT_H__
-
-/*  Include Files
-    These should only be the ones necessary to compile the common code.  */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <errno.h>
-#include <string.h>
-#include <time.h>
-#include <sys/ioctl.h>
-
-#include "global.h"
-#include "osi_list.h"
-
-
-
-/*  Memory allocation abstraction  */
-
-static __inline__ void *osi_malloc(unsigned int size)
-{
-  return malloc(size);
-}
-
-static __inline__ void osi_free(void *data, unsigned int size)
-{
-  free(data);
-}
-
-
-
-/*  Memory copy abstraction  */
-
-#define osi_copy_to_user(uaddr, kaddr, len) (memcpy((uaddr), (kaddr), (len)) ? 0 : -EFAULT)
-#define osi_clear_user(uaddr, len) ((memset((uaddr), 0, (len))) ? 0 : -EFAULT)
-#define osi_copy_from_user(kaddr, uaddr, len) ((memcpy((kaddr), (uaddr), (len))) ? 0 : -EFAULT)
-#define osi_strncpy_from_user(kaddr, uaddr, len) ((strncpy((kaddr), (uaddr), (len))) ? 0 : -EFAULT)
-
-#define osi_read_access_ok(uaddr, len) (TRUE)
-#define osi_write_access_ok(uaddr, len) (TRUE)
-
-#define osi_memset memset
-#define osi_memcpy memcpy
-#define osi_memcmp memcmp
-
-#define osi_strlen strlen
-#define osi_strstr strstr
-#define osi_strcmp strcmp
-#define osi_strncmp strncmp
-#define osi_strtok strtok
-#define osi_strchr strchr
-#define osi_strcpy strcpy
-#define osi_strncpy strncpy
-#define osi_strcasecmp strcasecmp
-#define osi_strtod strtod
-#define osi_strtol strtol
-
-
-
-/*  printf() abstraction  */
-
-#define osi_printf printf
-#define osi_sprintf sprintf
-#define osi_snprintf snprintf
-#define osi_vsnprintf vsnprintf
-
-#define osi_sscanf sscanf
-
-#define osi_fprintf fprintf
-
-#define osi_tty_printf printf
-
-
-
-/*  panic abstractions  */
-
-#define panic(fmt, args...) \
-{ \
-  fprintf(stderr, "%s: ", prog_name); \
-  fprintf(stderr, fmt, ## args); \
-  exit(-1); \
-}
-
-#define osi_panic panic
-#define osi_bug(x) \
-{ \
-  fprintf(stderr, "%s: BUG: %s\n", prog_name, (x)); \
-  exit(-1); \
-}
-
-
-
-/*  GFS to VFS abstraction  */
-
-typedef int osi_vfs_t;
-typedef int osi_vnode_t;
-typedef int osi_vfile_t;
-
-#define vf2vn(vfile) ((osi_vnode_t *)(vfile))
-#define vn2vfs(vnode) ((osi_vfs_t *)(vnode))
-
-
-
-/*  I/O abstraction  */
-
-struct buffer_head
-{
-  unsigned long b_blocknr;
-  unsigned long b_size;
-  unsigned long b_state;
-  char *b_data;
-  char *b_pdata;
-  osi_list_t b_list;
-};
-typedef struct buffer_head osi_buf_t;
-
-
-
-/*  Device type abstraction  */
-
-typedef unsigned short osi_dev_t;
-
-#define osi_make_dev MKDEV
-#define osi_u2k_dev
-#define osi_k2u_dev
-
-
-
-/*  Atomic Bit Manipulation interface  */
-
-struct osi_bitfield
-{
-  unsigned long bitfield;
-};
-typedef struct osi_bitfield osi_bitfield_t;
-
-#define osi_test_bit(nr, addr) ((addr)->bitfield & (1 << nr))
-#define osi_set_bit(nr, addr) ((addr)->bitfield |= (1 << nr))
-#define osi_clear_bit(nr, addr) ((addr)->bitfield &= ~(1 << nr))
-#define osi_test_and_set_bit(nr, addr) ((addr)->bitfield |= (1 << nr))
-#define osi_test_and_clear_bit(nr, addr) ((addr)->bitfield &= ~(1 << nr))
-
-
-
-/*  Atomic Counter Interface  */
-
-struct osi_atomic
-{
-  int atomic;
-};
-typedef struct osi_atomic osi_atomic_t;
-
-#define osi_atomic_inc(x) ((x)->atomic += 1)
-#define osi_atomic_dec(x) ((x)->atomic -= 1)
-#define osi_atomic_read(x) ((x)->atomic)
-#define osi_atomic_dec_and_test(x) ((x)->atomic -= 1)
-#define osi_atomic_set(x, y) ((x)->atomic = (y))
-
-
-
-/*  Endianness conversion abstraction  */
-
-#include "linux_endian.h"
-
-
-
-/*  Filename structure  */
-
-struct osi_filename
-{
-  unsigned char *name;
-  unsigned int len;
-};
-typedef struct osi_filename osi_filename_t;
-
-
-
-/*  Sleeping mutual exclusion primitive abstraction
-
-    All macros take a pointer to a osi_mutex_t structure.
-    osi_mutex_down_try() returns TRUE if the down() succeeds 
-    */
-
-typedef int osi_mutex_t;
-
-#define osi_mutex_init(x)
-#define osi_mutex_init_lkd(x)
-
-#define osi_mutex_lock(x) 
-#define osi_mutex_lock_intr(x)
-#define osi_mutex_trylock(x) (TRUE)
-#define osi_mutex_unlock(x)
-
-
-
-/*  Reader/writer Sleeping mutual exclusion primitive abstraction  */
-
-typedef int osi_mutex_rw_t;
-
-#define osi_mutex_rw_init(x)
-
-#define osi_mutex_read_lock(x)
-#define osi_mutex_write_lock(x)
-#define osi_mutex_read_trylock(x) (0)
-#define osi_mutex_write_trylock(x) (0)
-#define osi_mutex_read_unlock(x)
-#define osi_mutex_write_unlock(x)
-
-
-
-/*  Spinlock abstraction  */
-
-typedef int osi_spin_t;
-
-#define osi_spin_init(lock)
-
-#define osi_spin_lock(lock)
-#define osi_spin_unlock(lock)
-#define osi_spin_trylock(lock) (TRUE)
-
-
-
-/*  RW-Spinlock abstraction  */
-
-typedef int osi_spin_rw_t;
-
-#define osi_spin_rw_init(lock)
-
-#define osi_spin_read_lock(lock)
-#define osi_spin_write_lock(lock)
-#define osi_spin_read_unlock(lock)
-#define osi_spin_write_unlock(lock)
-#define osi_spin_write_trylock(lock) (TRUE)
-
-
-
-/*  Process abstraction  */
-
-#define osi_pid() 1
-#define osi_pname() ("main")
-
-typedef int osi_task_t;
-
-#define osi_task_is_set(taskp) (*(taskp))
-#define osi_task_is_me(taskp) (TRUE)
-#define osi_task_is_equal(task1p, task2p) (TRUE)
-#define osi_task_to_pid(taskp) (1)
-#define osi_task_to_pname(taskp) ("main")
-
-#define osi_task_clear(taskp) do { *(taskp) = 0; } while (0)
-#define osi_task_remember_me(taskp) do { *(taskp) = 1; } while (0)
-#define osi_task_sleep(taskp, x) do { } while (0)
-#define osi_task_wakeup(taskp) do { } while (0)
-
-
-
-/*  Kernel Thead code  */
-
-#define osi_daemonize(thread_name)
-#define osi_undaemonize()
-
-
-
-/*  Time abstraction  */
-
-#define osi_current_time() time(NULL)
-
-static __inline__ uint64 osi_gettimeofday(void)
-{
-  struct timeval tv;
-  gettimeofday(&tv, NULL);
-  return (uint64)tv.tv_sec * 1000000 + tv.tv_usec;
-}
-
-struct osi_clock_ticks
-{
-  unsigned long value;
-};
-typedef struct osi_clock_ticks osi_clock_ticks_t;
-
-static __inline__ void osi_time_stamp(osi_clock_ticks_t *stamp)
-{
-}
-
-static __inline__ int osi_check_timeout(osi_clock_ticks_t *stamp, int seconds)
-{
-  return 0;
-}
-
-static __inline__ unsigned int osi_time_diff(osi_clock_ticks_t *stamp)
-{
-  return FALSE;
-}
-
-static __inline__ int osi_time_valid(osi_clock_ticks_t *stamp)
-{
-  return FALSE;
-}
-
-
-
-/*  Timer abstraction  */
-
-
-typedef int osi_timer_t;
-typedef void (osi_timer_func)(void *);
-typedef void (linux_timer_func)(unsigned long);
-
-static __inline__ void osi_init_timer(osi_timer_t *t, osi_timer_func *fp, void *data)
-{
-}
-
-static __inline__ void osi_del_timer(osi_timer_t *t)
-{
-}
-
-static __inline__ void osi_set_timer(osi_timer_t *t, unsigned long sec)
-{
-}
-
-static __inline__ void osi_set_deci_timer(osi_timer_t *t, unsigned long dsec)
-{
-}
-
-static __inline__ int osi_timer_pending(osi_timer_t *t)
-{
-  return -ENOSYS;
-}
-
-
-
-/*  Schedule abstraction - Macro that makes a process temporarily
-    give up control of the processor and lets other processes have
-    a change to run. 
-    Sleep abstraction - Sleep for x number of sections.  */
-
-#define osi_schedule()
-#define osi_sleep(x)
-#define osi_sleep_intr(x)
-
-
-
-/*  Wait queue abstraction  */
-
-typedef int osi_wchan_t;
-
-#define osi_wchan_init(x) do { } while (0)
-#define osi_wchan_cond_sleep(chan, sleep_cond) do { } while (0)
-#define osi_wchan_cond_sleep_intr(chan, sleep_cond) do { } while (0)
-#define osi_wchan_wakeup(x) do { } while (0)
-
-
-
-/*  Completion events  */
-
-struct osi_completion
-{
-};
-typedef struct osi_completion osi_completion_t;
-
-#define osi_completion_init(x) do { } while (0)
-
-#define osi_wait_for_completion(x) do { } while (0)
-#define osi_complete(x) do { } while (0)
-
-
-
-/*  Credentials structure  */
-
-struct osi_cred
-{
-  uint32 cr_uid;
-  uint32 cr_gid;
-};
-typedef struct osi_cred osi_cred_t;
-
-#define osi_cred_to_uid(credp) ((credp) ? (credp)->cr_uid : 0)
-#define osi_cred_to_gid(credp) ((credp) ? (credp)->cr_gid : 0)
-#define osi_cred_in_group(credp, gid) ((credp) ? ((cred)->cr_gid == (gid)) : FALSE)
-
-
-
-/*  Signals abstraction  */
-
-#define osi_pending_signals() FALSE
-
-
-
-/*  Weird errnos  */
-
-#define ERESTARTSYS EINTR
-
-
-
-/*  Module stuff  */
-
-typedef int osi_module_t;
-
-#define osi_module_this (NULL)
-
-#define osi_module_init(mod) do { } while (0)
-#define osi_module_inc(mod) do { } while (0)
-#define osi_module_inc_cond(mod) (FALSE)
-#define osi_module_dec(mod) do { } while (0)
-#define osi_module_busy(mod) (TRUE)
-
-
-
-/*  Other Stuff  */
-
-extern char *prog_name;
-
-#define OSI_CACHE_ALIGNED
-
-
-
-#endif  /*  __OSI_USER_DOT_H__  */
-
diff --git a/gfs2/init.d/Makefile b/gfs2/init.d/Makefile
deleted file mode 100644
index fe50c3f..0000000
--- a/gfs2/init.d/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-TARGET= gfs2
-
-INITDT=$(TARGET)
-
-all: $(TARGET)
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-$(TARGET): $(S)/$(TARGET).in
-	cat $(S)/$(TARGET).in | sed \
-		-e 's#@INITDDIR@#${initddir}#g' \
-	> $(TARGET)
-
-clean: generalclean
diff --git a/gfs2/init.d/gfs2.in b/gfs2/init.d/gfs2.in
deleted file mode 100644
index 35688a0..0000000
--- a/gfs2/init.d/gfs2.in
+++ /dev/null
@@ -1,149 +0,0 @@
-#!/bin/bash
-#
-# gfs2 mount/unmount helper
-#
-# chkconfig: - 26 74
-# description: mount/unmount gfs2 filesystems configured in /etc/fstab
-
-### BEGIN INIT INFO
-# Provides:		gfs2
-# Required-Start:	$network cman
-# Required-Stop:	$network cman
-# Default-Start:
-# Default-Stop:
-# Short-Description:	mount/unmount gfs2 filesystems configured in /etc/fstab
-# Description:		mount/unmount gfs2 filesystems configured in /etc/fstab
-### END INIT INFO
-
-# rpm based distros
-if [ -d /etc/sysconfig ]; then
-	[ -f @INITDDIR@/functions ] && . @INITDDIR@/functions
-	[ -f /etc/sysconfig/cluster ] && . /etc/sysconfig/cluster
-	[ -f /etc/sysconfig/gfs2 ] && . /etc/sysconfig/gfs2
-	[ -z "$LOCK_FILE" ] && LOCK_FILE="/var/lock/subsys/gfs2"
-	success=success
-	failure=failure
-fi
-
-# deb based distros
-if [ -d /etc/default ]; then
-	[ -f /etc/default/cluster ] && . /etc/default/cluster
-	[ -f /etc/default/gfs2 ] && . /etc/default/gfs2
-	[ -z "$LOCK_FILE" ] && LOCK_FILE="/var/lock/gfs2"
-	success=success
-	failure=failure
-fi
-
-local_success()
-{
-    echo -ne "[  OK  ]\r"
-}
-
-local_failure()
-{
-    echo -ne "[FAILED]\r"
-}
-
-#
-# This script's behavior is modeled closely after the netfs script.  
-#
-GFS2FSTAB=$(LC_ALL=C awk '!/^#/ && $3 == "gfs2" && $4 !~ /noauto/ { print $2 }' /etc/fstab)
-GFS2MTAB=$(LC_ALL=C awk '!/^#/ && $3 == "gfs2" && $2 != "/" { print $2 }' /proc/mounts)
-
-# See how we were called.
-case "$1" in
-  start)
-        if [ -n "$GFS2FSTAB" ] 
-	then
-		echo -n "Mounting GFS2 filesystems: "
-		mount -a -t gfs2
-		rtrn=$?
-		if [ $rtrn = 0 ]; then
-			touch $LOCK_FILE
-			$success
-			echo
-		else
-			$failure
-			echo
-		fi
-	fi
-	;;
-
-  stop)
-  	if [ -n "$GFS2MTAB" ] 
-	then
-		sig=
-		retry=6
-		remaining=`LC_ALL=C awk '!/^#/ && $3 == "gfs2" && $2 != "/" {print $2}' /proc/mounts`
-		while [ -n "$remaining" -a "$retry" -gt 0 ]
-		do
-			echo -n "Unmounting GFS2 filesystems: "
-			umount -a -t gfs2
-			rtrn=$?
-			if [ $rtrn = 0 ]; then
-				$success
-				echo
-			else
-				$failure
-				echo
-			fi
-			
-			if [ $retry -eq 0 ] 
-			then
-				echo -n "Unmounting GFS2 filesystems (lazy): "
-				umount -l -a -t gfs2
-				rtrn=$?
-				if [ $rtrn = 0 ]; then
-					$success
-					echo
-				else
-					$failure
-					echo
-				fi
-				break
-			fi
-
-			sleep 2
-			remaining=`LC_ALL=C awk '!/^#/ && $3 == "gfs2" && $2 != "/" {print $2}' /proc/mounts`
-			[ -z "$remaining" ] && break
-			fuser -k -m $sig $remaining > /dev/null 2>&1
-			sleep 10
-			retry=$(($retry - 1))
-			sig=-9
-		done
-	fi
-
-	modprobe -r gfs2
-	rm -f $LOCK_FILE
-	;;
-
-  status)
-	if [ -f /proc/mounts ]
-	then
-	        [ -n "$GFS2FSTAB" ] && {
-		     echo "Configured GFS2 mountpoints: "
-		     for fs in $GFS2FSTAB; do echo $fs ; done
-		}
-		[ -n "$GFS2MTAB" ] && {
-                      echo "Active GFS2 mountpoints: "
-		      for fs in $GFS2MTAB; do echo $fs ; done
-		}
-	else
-		echo "/proc filesystem unavailable"
-	fi
-	;;
-
-  restart)
-	$0 stop
-	$0 start
-	;;
-
-  reload)
-        $0 start
-	;;
-  *)
-	echo $"Usage: $0 {start|stop|restart|reload|status}"
-	exit 1
-esac
-
-exit 0
diff --git a/gfs2/libgfs2/Makefile b/gfs2/libgfs2/Makefile
deleted file mode 100644
index c327aef..0000000
--- a/gfs2/libgfs2/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-TARGET= libgfs2
-
-MAKESTATICLIB = 1
-
-OBJS=	bitmap.o \
-	block_list.o \
-	buf.o \
-	device_geometry.o \
-	fs_bits.o \
-	fs_geometry.o \
-	fs_ops.o \
-	gfs1.o \
-	locking.o \
-	gfs2_log.o \
-	misc.o \
-	ondisk.o \
-	recovery.o \
-	size.o \
-	structures.o \
-	super.o \
-	rgrp.o
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/libs.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_GNU_SOURCE
-CFLAGS += -I${KERNEL_SRC}/fs/gfs2/ -I${KERNEL_SRC}/include/
-CFLAGS += -I$(S)/../include
-CFLAGS += -I${incdir}
-CFLAGS += -fPIC
diff --git a/gfs2/libgfs2/bitmap.c b/gfs2/libgfs2/bitmap.c
deleted file mode 100644
index 79b6eee..0000000
--- a/gfs2/libgfs2/bitmap.c
+++ /dev/null
@@ -1,145 +0,0 @@
-/* Basic bitmap manipulation */
-#include <inttypes.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-#include "libgfs2.h"
-
-#define BITMAP_SIZE(size, cpb) (size / cpb)
-#define BITMAP_SIZE1(size) (size >> 3)
-#define BITMAP_SIZE4(size) (size >> 1)
-
-#define BITMAP_BYTE_OFFSET(x, map) ((x % map->chunks_per_byte) \
-                                    * map->chunksize )
-
-/* BITMAP_BYTE_OFFSET1 is for chunksize==1, which implies chunks_per_byte==8 */
-/* Reducing the math, we get:                                                */
-/* #define BITMAP_BYTE_OFFSET1(x) ((x % 8) * 1)                              */
-/* #define BITMAP_BYTE_OFFSET1(x) (x % 8)                                    */
-/* #define BITMAP_BYTE_OFFSET1(x) (x & 0x0000000000000007)                   */
-#define BITMAP_BYTE_OFFSET1(x) (x & 0x0000000000000007)
-
-/* BITMAP_BYTE_OFFSET4 is for chunksize==4, which implies chunks_per_byte==2 */
-/* Reducing the math, we get:                                                */
-/* #define BITMAP_BYTE_OFFSET4(x) ((x % 2) * 4)                              */
-/* #define BITMAP_BYTE_OFFSET4(x) ((x & 0x0000000000000001) * 4)             */
-/* #define BITMAP_BYTE_OFFSET4(x) ((x & 0x0000000000000001) << 2)            */
-#define BITMAP_BYTE_OFFSET4(x) ((x & 0x0000000000000001) << 2)
-
-#define BITMAP_MASK(chunksize) ((2 << (chunksize - 1)) - 1)
-/* BITMAP_MASK1 is  for chunksize==1                                         */
-/* Reducing the math, we get:                                                */
-/* #define BITMAP_MASK1(chunksize) ((2 << (1 - 1)) - 1)                      */
-/* #define BITMAP_MASK1(chunksize) ((2 << 0) - 1)                            */
-/* #define BITMAP_MASK1(chunksize) ((2) - 1)                                 */
-#define BITMAP_MASK1(chunksize) (1)
-
-/* BITMAP_MASK4 is  for chunksize==4                                         */
-/* #define BITMAP_MASK(chunksize) ((2 << (4 - 1)) - 1)                       */
-/* #define BITMAP_MASK(chunksize) ((2 << 3) - 1)                             */
-/* #define BITMAP_MASK(chunksize) (0x10 - 1)                                 */
-#define BITMAP_MASK4(chunksize) (0xf)
-
-uint64_t gfs2_bitmap_size(struct gfs2_bmap *bmap) {
-	return bmap->size;
-}
-
-int gfs2_bitmap_create(struct gfs2_bmap *bmap, uint64_t size,
-					   uint8_t chunksize)
-{
-	if((((chunksize >> 1) << 1) != chunksize) && chunksize != 1)
-		return -1;
-	if(chunksize > 8)
-		return -1;
-	bmap->chunksize = chunksize;
-	bmap->chunks_per_byte = 8 / chunksize;
-
-	bmap->size = size;
-
-	/* Have to add 1 to BITMAP_SIZE since it's 0-based and mallocs
-	 * must be 1-based */
-	bmap->mapsize = BITMAP_SIZE(size, bmap->chunks_per_byte)+1;
-
-	if(!(bmap->map = malloc(sizeof(char) * bmap->mapsize)))
-		return -ENOMEM;
-	if(!memset(bmap->map, 0, sizeof(char) * bmap->mapsize)) {
-		free(bmap->map);
-		bmap->map = NULL;
-		return -ENOMEM;
-	}
-	return 0;
-}
-
-int gfs2_bitmap_set(struct gfs2_bmap *bmap, uint64_t offset, uint8_t val)
-{
-	static char *byte;
-	static uint64_t b;
-
-	if(offset < bmap->size) {
-		if (bmap->chunksize == 1) {
-			byte = bmap->map + BITMAP_SIZE1(offset);
-			b = BITMAP_BYTE_OFFSET1(offset);
-			*byte |= (val & BITMAP_MASK1(bmap->chunksize));
-		} else {
-			byte = bmap->map + BITMAP_SIZE4(offset);
-			b = BITMAP_BYTE_OFFSET4(offset);
-			*byte |= (val & BITMAP_MASK4(bmap->chunksize)) << b;
-		}
-		return 0;
-	}
-	return -1;
-}
-
-int gfs2_bitmap_get(struct gfs2_bmap *bmap, uint64_t bit, uint8_t *val)
-{
-	static char *byte;
-	static uint64_t b;
-
-	if(bit < bmap->size) {
-		if (bmap->chunksize == 1) {
-			byte = bmap->map + BITMAP_SIZE1(bit);
-			b = BITMAP_BYTE_OFFSET1(bit);
-			*val = (*byte & (BITMAP_MASK1(bmap->chunksize) << b )) >> b;
-		} else {
-			byte = bmap->map + BITMAP_SIZE4(bit);
-			b = BITMAP_BYTE_OFFSET4(bit);
-			*val = (*byte & (BITMAP_MASK4(bmap->chunksize) << b )) >> b;
-		}
-		return 0;
-	}
-	return -1;
-}
-
-int gfs2_bitmap_clear(struct gfs2_bmap *bmap, uint64_t offset)
-{
-	static char *byte;
-	static uint64_t b;
-
-	if(offset < bmap->size) {
-		if (bmap->chunksize == 1) {
-			byte = bmap->map + BITMAP_SIZE1(offset);
-			b = BITMAP_BYTE_OFFSET1(offset);
-			*byte &= ~(BITMAP_MASK1(bmap->chunksize) << b);
-		} else {
-			byte = bmap->map + BITMAP_SIZE4(offset);
-			b = BITMAP_BYTE_OFFSET4(offset);
-			*byte &= ~(BITMAP_MASK4(bmap->chunksize) << b);
-		}
-		return 0;
-	}
-	return -1;
-
-}
-
-void gfs2_bitmap_destroy(struct gfs2_bmap *bmap)
-{
-	if(bmap->map)
-		free(bmap->map);
-	bmap->size = 0;
-	bmap->mapsize = 0;
-	bmap->chunksize = 0;
-	bmap->chunks_per_byte = 0;
-}
diff --git a/gfs2/libgfs2/block_list.c b/gfs2/libgfs2/block_list.c
deleted file mode 100644
index f8790b9..0000000
--- a/gfs2/libgfs2/block_list.c
+++ /dev/null
@@ -1,175 +0,0 @@
-#include <inttypes.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-#include "libgfs2.h"
-
-/* Must be kept in sync with mark_block enum in block_list.h */
-/* FIXME: Fragile */
-static int mark_to_gbmap[16] = {
-	FREE, BLOCK_IN_USE, DIR_INDIR_BLK, DIR_INODE, FILE_INODE,
-	LNK_INODE, BLK_INODE, CHR_INODE, FIFO_INODE, SOCK_INODE,
-	DIR_LEAF_INODE, JOURNAL_BLK, OTHER_META, EATTR_META,
-	INVALID_META, INVALID_META
-};
-
-struct gfs2_block_list *gfs2_block_list_create(struct gfs2_sbd *sdp,
-					       uint64_t size,
-					       uint64_t *addl_mem_needed)
-{
-	struct gfs2_block_list *il;
-
-	*addl_mem_needed = 0L;
-	il = malloc(sizeof(*il));
-	if (!il || !memset(il, 0, sizeof(*il)))
-		return NULL;
-
-	if(gfs2_bitmap_create(&il->list.gbmap.group_map, size, 4)) {
-		*addl_mem_needed = il->list.gbmap.group_map.mapsize;
-		free(il);
-		il = NULL;
-	}
-	osi_list_init(&sdp->bad_blocks.list);
-	osi_list_init(&sdp->dup_blocks.list);
-	osi_list_init(&sdp->eattr_blocks.list);
-	return il;
-}
-
-void gfs2_special_free(struct special_blocks *blist)
-{
-	struct special_blocks *f;
-
-	while(!osi_list_empty(&blist->list)) {
-		f = osi_list_entry(blist->list.next, struct special_blocks,
-				   list);
-		osi_list_del(&f->list);
-		free(f);
-	}
-}
-
-struct special_blocks *blockfind(struct special_blocks *blist, uint64_t num)
-{
-	osi_list_t *head = &blist->list;
-	osi_list_t *tmp;
-	struct special_blocks *b;
-
-	for (tmp = head->next; tmp != head; tmp = tmp->next) {
-		b = osi_list_entry(tmp, struct special_blocks, list);
-		if (b->block == num)
-			return b;
-	}
-	return NULL;
-}
-
-void gfs2_special_set(struct special_blocks *blocklist, uint64_t block)
-{
-	struct special_blocks *b;
-
-	if (blockfind(blocklist, block))
-		return;
-	b = malloc(sizeof(struct special_blocks));
-	if (b) {
-		b->block = block;
-		osi_list_add(&b->list, &blocklist->list);
-	}
-	return;
-}
-
-void gfs2_special_clear(struct special_blocks *blocklist, uint64_t block)
-{
-	struct special_blocks *b;
-
-	b = blockfind(blocklist, block);
-	if (b) {
-		osi_list_del(&b->list);
-		free(b);
-	}
-}
-
-int gfs2_block_mark(struct gfs2_sbd *sdp, struct gfs2_block_list *il,
-		    uint64_t block, enum gfs2_mark_block mark)
-{
-	int err = 0;
-
-	if(mark == gfs2_bad_block)
-		gfs2_special_set(&sdp->bad_blocks, block);
-	else if(mark == gfs2_dup_block)
-		gfs2_special_set(&sdp->dup_blocks, block);
-	else if(mark == gfs2_eattr_block)
-		gfs2_special_set(&sdp->eattr_blocks, block);
-	else
-		err = gfs2_bitmap_set(&il->list.gbmap.group_map, block,
-				      mark_to_gbmap[mark]);
-	return err;
-}
-
-int gfs2_block_clear(struct gfs2_sbd *sdp, struct gfs2_block_list *il,
-		     uint64_t block, enum gfs2_mark_block m)
-{
-	int err = 0;
-
-	switch (m) {
-	case gfs2_dup_block:
-		gfs2_special_clear(&sdp->dup_blocks, block);
-		break;
-	case gfs2_bad_block:
-		gfs2_special_clear(&sdp->bad_blocks, block);
-		break;
-	case gfs2_eattr_block:
-		gfs2_special_clear(&sdp->eattr_blocks, block);
-		break;
-	default:
-		/* FIXME: check types */
-		err = gfs2_bitmap_clear(&il->list.gbmap.group_map, block);
-		break;
-	}
-	return err;
-}
-
-int gfs2_block_set(struct gfs2_sbd *sdp, struct gfs2_block_list *il,
-		   uint64_t block, enum gfs2_mark_block mark)
-{
-	int err;
-
-	err = gfs2_block_clear(sdp, il, block, mark);
-	if(!err)
-		err = gfs2_block_mark(sdp, il, block, mark);
-	return err;
-}
-
-int gfs2_block_check(struct gfs2_sbd *sdp, struct gfs2_block_list *il,
-		     uint64_t block, struct gfs2_block_query *val)
-{
-	int err = 0;
-
-	val->bad_block = 0;
-	val->dup_block = 0;
-	val->eattr_block = 0;
-	if((err = gfs2_bitmap_get(&il->list.gbmap.group_map, block,
-				  &val->block_type)))
-		return err;
-	if (blockfind(&sdp->bad_blocks, block))
-		val->bad_block = 1;
-	if (blockfind(&sdp->dup_blocks, block))
-		val->dup_block = 1;
-	if (blockfind(&sdp->eattr_blocks, block))
-		val->eattr_block = 1;
-	return 0;
-}
-
-void *gfs2_block_list_destroy(struct gfs2_sbd *sdp, struct gfs2_block_list *il)
-{
-	if(il) {
-		gfs2_bitmap_destroy(&il->list.gbmap.group_map);
-		free(il);
-		il = NULL;
-	}
-	gfs2_special_free(&sdp->bad_blocks);
-	gfs2_special_free(&sdp->dup_blocks);
-	gfs2_special_free(&sdp->eattr_blocks);
-	return il;
-}
diff --git a/gfs2/libgfs2/buf.c b/gfs2/libgfs2/buf.c
deleted file mode 100644
index b43d335..0000000
--- a/gfs2/libgfs2/buf.c
+++ /dev/null
@@ -1,206 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include <linux/types.h>
-
-#include "libgfs2.h"
-
-static __inline__ osi_list_t *
-blkno2head(struct buf_list *bl, uint64_t blkno)
-{
-	return bl->buf_hash +
-		(gfs2_disk_hash((char *)&blkno, sizeof(uint64_t)) & BUF_HASH_MASK);
-}
-
-static void write_buffer(struct buf_list *bl, struct gfs2_buffer_head *bh)
-{
-	struct gfs2_sbd *sdp = bl->sbp;
-
-	osi_list_del(&bh->b_list);
-	osi_list_del(&bh->b_hash);
-	bl->num_bufs--;
-	if (bh->b_changed) {
-		do_lseek(sdp->device_fd, bh->b_blocknr * sdp->bsize);
-		do_write(sdp->device_fd, bh->b_data, sdp->bsize);
-		sdp->writes++;
-	}
-	free(bh);
-}
-
-void init_buf_list(struct gfs2_sbd *sdp, struct buf_list *bl, uint32_t limit)
-{
-	int i;
-
-	bl->num_bufs = 0;
-	bl->spills = 0;
-	bl->limit = limit;
-	bl->sbp = sdp;
-	osi_list_init(&bl->list);
-	for(i = 0; i < BUF_HASH_SIZE; i++)
-		osi_list_init(&bl->buf_hash[i]);
-}
-
-static void
-add_buffer(struct buf_list *bl, struct gfs2_buffer_head *bh)
-{
-	osi_list_t *head = blkno2head(bl, bh->b_blocknr);
-
-	osi_list_add(&bh->b_list, &bl->list);
-	osi_list_add(&bh->b_hash, head);
-	bl->num_bufs++;
-
-	if (bl->num_bufs * bl->sbp->bsize > bl->limit) {
-		int found = 0;
-		osi_list_t *tmp, *x;
-
-		for (tmp = bl->list.prev, x = tmp->prev; tmp != &bl->list;
-		     tmp = x, x = x->prev) {
-			bh = osi_list_entry(tmp, struct gfs2_buffer_head,
-					    b_list);
-			if (!bh->b_count) {
-				write_buffer(bl, bh);
-				found++;
-				if (found >= 10)
-					break;
-			}
-		}
-		bl->spills++;
-	}
-}
-
-struct gfs2_buffer_head *bfind(struct buf_list *bl, uint64_t num)
-{
-	osi_list_t *head = blkno2head(bl, num);
-	osi_list_t *tmp;
-	struct gfs2_buffer_head *bh;
-
-	for (tmp = head->next; tmp != head; tmp = tmp->next) {
-		bh = osi_list_entry(tmp, struct gfs2_buffer_head, b_hash);
-		if (bh->b_blocknr == num) {
-			osi_list_del(&bh->b_list);
-			osi_list_add(&bh->b_list, &bl->list);
-			osi_list_del(&bh->b_hash);
-			osi_list_add(&bh->b_hash, head);
-			bh->b_count++;
-			return bh;
-		}
-	}
-
-	return NULL;
-}
-
-struct gfs2_buffer_head *bget_generic(struct buf_list *bl, uint64_t num,
-				      int find_existing, int read_disk)
-{
-	struct gfs2_buffer_head *bh;
-	struct gfs2_sbd *sdp = bl->sbp;
-
-	if (find_existing) {
-		bh = bfind(bl, num);
-		if (bh)
-			return bh;
-	}
-	zalloc(bh, sizeof(struct gfs2_buffer_head) + sdp->bsize);
-
-	bh->b_count = 1;
-	bh->b_blocknr = num;
-	bh->b_data = (char *)bh + sizeof(struct gfs2_buffer_head);
-	if (read_disk) {
-		do_lseek(sdp->device_fd, num * sdp->bsize);
-		do_read(sdp->device_fd, bh->b_data, sdp->bsize);
-	}
-	add_buffer(bl, bh);
-	bh->b_changed = FALSE;
-
-	return bh;
-}
-
-struct gfs2_buffer_head *bget(struct buf_list *bl, uint64_t num)
-{
-	return bget_generic(bl, num, TRUE, FALSE);
-}
-
-struct gfs2_buffer_head *bread(struct buf_list *bl, uint64_t num)
-{
-	return bget_generic(bl, num, TRUE, TRUE);
-}
-
-struct gfs2_buffer_head *bget_zero(struct buf_list *bl, uint64_t num)
-{
-	return bget_generic(bl, num, FALSE, FALSE);
-}
-
-struct gfs2_buffer_head *bhold(struct gfs2_buffer_head *bh)
-{
-	if (!bh->b_count)
-		die("buffer hold error for block %" PRIu64 " (0x%" PRIx64")\n",
-			bh->b_blocknr, bh->b_blocknr);
-	bh->b_count++;
-	return bh;
-}
-
-void brelse(struct gfs2_buffer_head *bh, enum update_flags updated)
-{
-    /* We can't just say b_changed = updated because we don't want to     */
-	/* set it FALSE if it's TRUE until we write the changed data to disk. */
-	if (updated)
-		bh->b_changed = TRUE;
-	if (!bh->b_count)
-		die("buffer count underflow for block %" PRIu64 " (0x%" PRIx64")\n",
-			bh->b_blocknr, bh->b_blocknr);
-	bh->b_count--;
-}
-
-void bsync(struct buf_list *bl)
-{
-	struct gfs2_buffer_head *bh;
-
-	while (!osi_list_empty(&bl->list)) {
-		bh = osi_list_entry(bl->list.prev, struct gfs2_buffer_head,
-							b_list);
-		if (bh->b_count)
-			die("buffer still held for block: %" PRIu64 " (0x%" PRIx64")\n",
-				bh->b_blocknr, bh->b_blocknr);
-		write_buffer(bl, bh);
-	}
-}
-
-/* commit buffers to disk but do not discard */
-void bcommit(struct buf_list *bl)
-{
-	osi_list_t *tmp, *x;
-	struct gfs2_buffer_head *bh;
-	struct gfs2_sbd *sdp = bl->sbp;
-
-	osi_list_foreach_safe(tmp, &bl->list, x) {
-		bh = osi_list_entry(tmp, struct gfs2_buffer_head, b_list);
-		if (!bh->b_count)             /* if not reserved for later */
-			write_buffer(bl, bh);/* write the data & free memory */
-		else if (bh->b_changed) {     /* if buffer has changed */
-			do_lseek(sdp->device_fd, bh->b_blocknr * sdp->bsize);
-			do_write(sdp->device_fd, bh->b_data, sdp->bsize);
-			bh->b_changed = FALSE;    /* no longer changed */
-		}
-	}
-	fsync(sdp->device_fd);
-}
-
-/* Check for unreleased buffers */
-void bcheck(struct buf_list *bl)
-{
-	osi_list_t *tmp;
-	struct gfs2_buffer_head *bh;
-
-	osi_list_foreach(tmp, &bl->list) {
-		bh = osi_list_entry(tmp, struct gfs2_buffer_head, b_list);
-		if (bh->b_count)
-			die("buffer still held: %"PRIu64"\n", bh->b_blocknr);
-	}
-}
diff --git a/gfs2/libgfs2/device_geometry.c b/gfs2/libgfs2/device_geometry.c
deleted file mode 100644
index f27f71b..0000000
--- a/gfs2/libgfs2/device_geometry.c
+++ /dev/null
@@ -1,90 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <linux/types.h>
-#include "libgfs2.h"
-
-/**
- * device_geometry - Get the size of a device
- * @w: the command line
- *
- */
-
-void
-device_geometry(struct gfs2_sbd *sdp)
-{
-	struct device *device = &sdp->device;
-	uint64_t bytes;
-	int error;
-
-	error = device_size(sdp->device_fd, &bytes);
-	if (error)
-		die("can't determine size of %s: %s\n",
-		    sdp->device_name, strerror(errno));
-
-	if (sdp->debug)
-		printf("\nPartition size = %"PRIu64"\n",
-		       bytes >> GFS2_BASIC_BLOCK_SHIFT);
-
-	device->start = 0;
-	device->length = bytes >> GFS2_BASIC_BLOCK_SHIFT;
-}
-
-/**
- * fix_device_geometry - round off address and lengths and convert to FS blocks
- * @w: the command line
- *
- */
-
-void
-fix_device_geometry(struct gfs2_sbd *sdp)
-{
-	struct device *device = &sdp->device;
-	unsigned int bbsize = sdp->bsize >> GFS2_BASIC_BLOCK_SHIFT;
-	uint64_t start, length;
-	unsigned int remainder;
-
-	if (sdp->debug) {
-		printf("\nDevice Geometry:  (in basic blocks)\n");
-		printf("  start = %"PRIu64", length = %"PRIu64", rgf_flags = 0x%.8X\n",
-		       device->start,
-		       device->length,
-		       device->rgf_flags);
-	}
-
-	start = device->start;
-	length = device->length;
-
-	if (length < 1 << (20 - GFS2_BASIC_BLOCK_SHIFT))
-		die("device is way too small (%"PRIu64" bytes)\n",
-		    length << GFS2_BASIC_BLOCK_SHIFT);
-
-	remainder = start % bbsize;
-	if (remainder) {
-		length -= bbsize - remainder;
-		start += bbsize - remainder;
-	}
-
-	start /= bbsize;
-	length /= bbsize;
-
-	device->start = start;
-	device->length = length;
-	sdp->device_size = start + length;
-
-	if (sdp->debug) {
-		printf("\nDevice Geometry:  (in FS blocks)\n");
-		printf("  start = %"PRIu64", length = %"
-		       PRIu64", rgf_flags = 0x%.8X\n",
-		       device->start, device->length, device->rgf_flags);
-		printf("\nDevice Size: %"PRIu64"\n", sdp->device_size);
-	}
-}
diff --git a/gfs2/libgfs2/fs_bits.c b/gfs2/libgfs2/fs_bits.c
deleted file mode 100644
index 0a31b0b..0000000
--- a/gfs2/libgfs2/fs_bits.c
+++ /dev/null
@@ -1,273 +0,0 @@
-#include <inttypes.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include "libgfs2.h"
-
-/**
- * fs_setbit - Set a bit in the bitmaps
- * @buffer: the buffer that holds the bitmaps
- * @buflen: the length (in bytes) of the buffer
- * @block: the block to set
- * @new_state: the new state of the block
- *
- */
-static void gfs2_setbit(unsigned char *buffer, unsigned int buflen,
-						uint32_t block, unsigned char new_state)
-{
-	unsigned char *byte, *end, cur_state;
-	unsigned int bit;
-
-	byte = buffer + (block / GFS2_NBBY);
-	bit = (block % GFS2_NBBY) * GFS2_BIT_SIZE;
-	end = buffer + buflen;
-
-	if(byte < end) {
-		cur_state = (*byte >> bit) & GFS2_BIT_MASK;
-
-		*byte ^= cur_state << bit;
-		*byte |= new_state << bit;
-	}
-}
-
-uint32_t gfs2_bitfit_core(struct gfs2_sbd *sbp, uint64_t goal, uint64_t start,
-						  uint64_t len, unsigned char old_state,
-						  struct gfs2_block_list *bl)
-{
-	uint64_t block;
-	struct gfs2_block_query q;
-
-	for(block = start+goal; block < start+len; block++) {
-		gfs2_block_check(sbp, bl, block, &q);
-		switch(old_state) {
-			/* FIXME Make sure these are handled correctly */
-		case GFS2_BLKST_FREE:
-			switch(q.block_type) {
-			case gfs2_block_free:
-				return block - start;
-			}
-			break;
-		case GFS2_BLKST_DINODE:
-			switch(q.block_type) {
-			case gfs2_inode_dir:
-			case gfs2_inode_file:
-			case gfs2_inode_lnk:
-			case gfs2_inode_blk:
-			case gfs2_inode_chr:
-			case gfs2_inode_fifo:
-			case gfs2_inode_sock:
-				return block - start;
-			}
-			break;
-		case GFS2_BLKST_USED:
-			switch(q.block_type) {
-			case gfs2_indir_blk:
-			case gfs2_leaf_blk:
-			case gfs2_journal_blk:
-			case gfs2_meta_other:
-			case gfs2_meta_eattr:
-			case gfs2_block_used:
-				return block - start;
-			}
-			break;
-		case GFS2_BLKST_UNLINKED:
-		default:
-			break;
-		}
-	}
-	return BFITNOENT;
-}
-/**
- * gfs2_bitfit - Find a free block in the bitmaps
- * @buffer: the buffer that holds the bitmaps
- * @buflen: the length (in bytes) of the buffer
- * @goal: the block to try to allocate
- * @old_state: the state of the block we're looking for
- *
- * Return: the block number that was allocated
- */
-uint32_t gfs2_bitfit(unsigned char *buffer, unsigned int buflen,
-					 uint32_t goal, unsigned char old_state)
-{
-	unsigned char *byte, *end, alloc;
-	uint32_t blk = goal;
-	unsigned int bit;
-
-	byte = buffer + (goal / GFS2_NBBY);
-	bit = (goal % GFS2_NBBY) * GFS2_BIT_SIZE;
-	end = buffer + buflen;
-	alloc = (old_state & 1) ? 0 : 0x55;
-
-	while (byte < end){
-		if ((*byte & 0x55) == alloc){
-			blk += (8 - bit) >> 1;
-			bit = 0;
-			byte++;
-			continue;
-		}
-
-		if (((*byte >> bit) & GFS2_BIT_MASK) == old_state)
-			return blk;
-
-		bit += GFS2_BIT_SIZE;
-		if (bit >= 8){
-			bit = 0;
-			byte++;
-		}
-		blk++;
-	}
-	return BFITNOENT;
-}
-
-/**
- * fs_bitcount - count the number of bits in a certain state
- * @buffer: the buffer that holds the bitmaps
- * @buflen: the length (in bytes) of the buffer
- * @state: the state of the block we're looking for
- *
- * Returns: The number of bits
- */
-uint32_t gfs2_bitcount(unsigned char *buffer, unsigned int buflen,
-		     unsigned char state)
-{
-	unsigned char *byte, *end;
-	unsigned int bit;
-	uint32_t count = 0;
-
-	byte = buffer;
-	bit = 0;
-	end = buffer + buflen;
-
-	while (byte < end){
-		if (((*byte >> bit) & GFS2_BIT_MASK) == state)
-			count++;
-
-		bit += GFS2_BIT_SIZE;
-		if (bit >= 8){
-			bit = 0;
-			byte++;
-		}
-	}
-	return count;
-}
-
-/*
- * check_range - check if blkno is within FS limits
- * @sdp: super block
- * @blkno: block number
- *
- * Returns: 0 if ok, -1 if out of bounds
- */
-int gfs2_check_range(struct gfs2_sbd *sdp, uint64_t blkno)
-{
-	if((blkno > sdp->fssize) || (blkno <= sdp->sb_addr))
-		return -1;
-	return 0;
-}
-
-/*
- * fs_get_bitmap - get value of FS bitmap
- * @sdp: super block
- * @blkno: block number relative to file system
- *
- * This function gets the value of a bit of the
- * file system bitmap.
- * Possible state values for a block in the bitmap are:
- *  GFS_BLKST_FREE     (0)
- *  GFS_BLKST_USED     (1)
- *  GFS_BLKST_INVALID  (2)
- *  GFS_BLKST_DINODE   (3)
- *
- * Returns: state on success, -1 on error
- */
-int gfs2_get_bitmap(struct gfs2_sbd *sdp, uint64_t blkno,
-					struct rgrp_list *rgd)
-{
-	int           buf, val;
-	uint32_t        rgrp_block;
-	struct gfs2_bitmap	*bits = NULL;
-	unsigned int  bit;
-	unsigned char *byte;
-	int local_rgd = 0;
-
-	if(gfs2_check_range(sdp, blkno))
-		return -1;
-	if(rgd == NULL) {
-		local_rgd = 1;
-		rgd = gfs2_blk2rgrpd(sdp, blkno);
-	}
-	if(rgd == NULL)
-		return -1;
-	if(gfs2_rgrp_read(sdp, rgd))
-		return -1;
-
-	rgrp_block = (uint32_t)(blkno - rgd->ri.ri_data0);
-
-	for(buf= 0; buf < rgd->ri.ri_length; buf++){
-		bits = &(rgd->bits[buf]);
-		if(rgrp_block < ((bits->bi_start + bits->bi_len)*GFS2_NBBY)){
-			break;
-		}
-	}
-
-	if(buf >= rgd->ri.ri_length){
-		gfs2_rgrp_relse(rgd, not_updated);
-		return -1;
-	}
-
-	byte = (unsigned char *)(rgd->bh[buf]->b_data + bits->bi_offset) +
-		(rgrp_block/GFS2_NBBY - bits->bi_start);
-	bit = (rgrp_block % GFS2_NBBY) * GFS2_BIT_SIZE;
-
-	val = ((*byte >> bit) & GFS2_BIT_MASK);
-	if(local_rgd)
-		gfs2_rgrp_relse(rgd, not_updated);
-
-	return val;
-}
-
-
-/*
- * fs_set_bitmap
- * @sdp: super block
- * @blkno: block number relative to file system
- * @state: one of three possible states
- *
- * This function sets the value of a bit of the
- * file system bitmap.
- *
- * Returns: 0 on success, -1 on error
- */
-int gfs2_set_bitmap(struct gfs2_sbd *sdp, uint64_t blkno, int state)
-{
-	int           buf;
-	uint32_t        rgrp_block;
-	struct gfs2_bitmap *bits = NULL;
-	struct rgrp_list *rgd;
-
-	/* FIXME: should GFS2_BLKST_INVALID be allowed */
-	if((state != GFS2_BLKST_FREE) && (state != GFS2_BLKST_USED) &&
-	   (state != GFS2_BLKST_DINODE)){
-		return -1;
-	}
-
-	rgd = gfs2_blk2rgrpd(sdp, blkno);
-
-	if(!rgd)
-		return -1;
-
-	if(gfs2_rgrp_read(sdp, rgd))
-		return -1;
-	rgrp_block = (uint32_t)(blkno - rgd->ri.ri_data0);
-	for(buf= 0; buf < rgd->ri.ri_length; buf++){
-		bits = &(rgd->bits[buf]);
-		if(rgrp_block < ((bits->bi_start + bits->bi_len)*GFS2_NBBY))
-			break;
-	}
-
-	gfs2_setbit((unsigned char *)rgd->bh[buf]->b_data + bits->bi_offset,
-				bits->bi_len, (rgrp_block - (bits->bi_start * GFS2_NBBY)),
-				state);
-	gfs2_rgrp_relse(rgd, updated);
-	return 0;
-}
diff --git a/gfs2/libgfs2/fs_geometry.c b/gfs2/libgfs2/fs_geometry.c
deleted file mode 100644
index f8a2695..0000000
--- a/gfs2/libgfs2/fs_geometry.c
+++ /dev/null
@@ -1,233 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <linux/types.h>
-#include "libgfs2.h"
-
-/**
- * how_many_rgrps - figure out how many RG to put in a subdevice
- * @w: the command line
- * @dev: the device
- *
- * Returns: the number of RGs
- */
-
-uint64_t
-how_many_rgrps(struct gfs2_sbd *sdp, struct device *dev, int rgsize_specified)
-{
-	uint64_t nrgrp;
-
-	while (TRUE) {
-		nrgrp = DIV_RU(dev->length, (sdp->rgsize << 20) / sdp->bsize);
-
-		if (rgsize_specified || /* If user specified an rg size or */
-			nrgrp <= GFS2_EXCESSIVE_RGS || /* not an excessive # of rgs or  */
-			sdp->rgsize >= 2048)     /* we've reached the max rg size */
-			break;
-
-		sdp->rgsize += GFS2_DEFAULT_RGSIZE; /* Try again w/bigger rgs */
-	}
-
-	if (sdp->debug)
-		printf("  rg sz = %"PRIu32"\n  nrgrp = %"PRIu64"\n", sdp->rgsize,
-			   nrgrp);
-
-	return nrgrp;
-}
-
-/**
- * compute_rgrp_layout - figure out where the RG in a FS are
- * @w: the command line
- *
- * Returns: a list of rgrp_list_t structures
- */
-
-void
-compute_rgrp_layout(struct gfs2_sbd *sdp, int rgsize_specified)
-{
-	struct device *dev;
-	struct rgrp_list *rl, *rlast = NULL, *rlast2 = NULL;
-	osi_list_t *tmp, *head = &sdp->rglist;
-	unsigned int rgrp = 0, nrgrp;
-	uint64_t rglength;
-
-	sdp->new_rgrps = 0;
-	dev = &sdp->device;
-
-	/* Reserve space for the superblock */
-	dev->start += sdp->sb_addr + 1;
-
-	/* If this is a new file system, compute the length and number */
-	/* of rgs based on the size of the device.                     */
-	/* If we have existing RGs (i.e. gfs2_grow) find the last one. */
-	if (osi_list_empty(&sdp->rglist)) {
-		dev->length -= sdp->sb_addr + 1;
-		nrgrp = how_many_rgrps(sdp, dev, rgsize_specified);
-		rglength = dev->length / nrgrp;
-		sdp->new_rgrps = nrgrp;
-	} else {
-		uint64_t old_length, new_chunk;
-
-		log_info("Existing resource groups:\n");
-		rgsize_specified = TRUE; /* consistently use existing size */
-		for (rgrp = 0, tmp = head->next; tmp != head;
-		     tmp = tmp->next, rgrp++) {
-			rl = osi_list_entry(tmp, struct rgrp_list, list);
-			log_info("%d: start: %" PRIu64 " (0x%"
-				 PRIx64 "), length = %"PRIu64" (0x%"
-				 PRIx64 ")\n", rgrp + 1, rl->start, rl->start,
-				 rl->length, rl->length);
-			rlast2 = rlast;
-			rlast = rl;
-		}
-		rlast->start = rlast->ri.ri_addr;
-		rglength = rlast->ri.ri_addr - rlast2->ri.ri_addr;
-		rlast->length = rglength;
-		old_length = rlast->ri.ri_addr + rglength;
-		new_chunk = dev->length - old_length;
-		sdp->new_rgrps = new_chunk / rglength;
-		nrgrp = rgrp + sdp->new_rgrps;
-	}
-
-	log_info("\nNew resource groups:\n");
-	for (; rgrp < nrgrp; rgrp++) {
-		zalloc(rl, sizeof(struct rgrp_list));
-
-		if (rgrp) {
-			rl->start = rlast->start + rlast->length;
-			rl->length = rglength;
-		} else {
-			rl->start = dev->start;
-			rl->length = dev->length -
-				(nrgrp - 1) * (dev->length / nrgrp);
-		}
-		rl->rgf_flags = dev->rgf_flags;
-
-		log_info("%d: start: %" PRIu64 " (0x%"
-			 PRIx64 "), length = %"PRIu64" (0x%"
-			 PRIx64 ")\n", rgrp + 1, rl->start, rl->start,
-			 rl->length, rl->length);
-		osi_list_add_prev(&rl->list, head);
-		rlast = rl;
-	}
-
-	sdp->rgrps = nrgrp;
-
-	if (sdp->debug) {
-		log_info("\n");
-
-		for (tmp = head->next; tmp != head; tmp = tmp->next) {
-			rl = osi_list_entry(tmp, struct rgrp_list, list);
-			log_info("rg_o = %llu, rg_l = %llu\n",
-				 rl->start, rl->length);
-		}
-	}
-}
-
-/**
- * rgblocks2bitblocks -
- * @bsize:
- * @rgblocks:
- * @bitblocks:
- *
- * Given a number of blocks in a RG, figure out the number of blocks
- * needed for bitmaps.
- *
- */
-
-void
-rgblocks2bitblocks(unsigned int bsize, uint32_t *rgblocks, uint32_t *bitblocks)
-{
-	unsigned int bitbytes_provided, last = 0;
-	unsigned int bitbytes_needed;
-
-	*bitblocks = 1;
-	bitbytes_provided = bsize - sizeof(struct gfs2_rgrp);
-
-	for (;;) {
-	        bitbytes_needed = (*rgblocks - *bitblocks) / GFS2_NBBY;
-
-		if (bitbytes_provided >= bitbytes_needed) {
-			if (last >= bitbytes_needed)
-				(*bitblocks)--;
-			break;
-		}
-
-		last = bitbytes_provided;
-		(*bitblocks)++;
-		bitbytes_provided += bsize - sizeof(struct gfs2_meta_header);
-	}
-
-	*rgblocks = bitbytes_needed * GFS2_NBBY;
-}
-
-/**
- * build_rgrps - write a bunch of resource groups to disk.
- * If fd > 0, write the data to the given file handle.
- * Otherwise, use gfs2 buffering in buf.c.
- */
-void build_rgrps(struct gfs2_sbd *sdp, int write)
-{
-	osi_list_t *tmp, *head;
-	struct rgrp_list *rl;
-	uint32_t rgblocks, bitblocks;
-	struct gfs2_rindex *ri;
-	struct gfs2_rgrp *rg;
-	struct gfs2_meta_header mh;
-	unsigned int x;
-	struct gfs2_buffer_head *bh;
-
-	mh.mh_magic = GFS2_MAGIC;
-	mh.mh_type = GFS2_METATYPE_RB;
-	mh.mh_format = GFS2_FORMAT_RB;
-
-	for (head = &sdp->rglist, tmp = head->next;
-	     tmp != head;
-	     tmp = tmp->next) {
-		rl = osi_list_entry(tmp, struct rgrp_list, list);
-		ri = &rl->ri;
-		rg = &rl->rg;
-
-		rgblocks = rl->length;
-		rgblocks2bitblocks(sdp->bsize, &rgblocks, &bitblocks);
-
-		ri->ri_addr = rl->start;
-		ri->ri_length = bitblocks;
-		ri->ri_data0 = rl->start + bitblocks;
-		ri->ri_data = rgblocks;
-		ri->ri_bitbytes = rgblocks / GFS2_NBBY;
-
-		rg->rg_header.mh_magic = GFS2_MAGIC;
-		rg->rg_header.mh_type = GFS2_METATYPE_RG;
-		rg->rg_header.mh_format = GFS2_FORMAT_RG;
-		rg->rg_flags = rl->rgf_flags;
-		rg->rg_free = rgblocks;
-
-		if (write) {
-			for (x = 0; x < bitblocks; x++) {
-				bh = bget(&sdp->nvbuf_list, rl->start + x);
-				if (x)
-					gfs2_meta_header_out(&mh, bh->b_data);
-				else
-					gfs2_rgrp_out(rg, bh->b_data);
-				brelse(bh, updated);
-			}
-		}
-
-		if (sdp->debug) {
-			printf("\n");
-			gfs2_rindex_print(ri);
-		}
-
-		sdp->blks_total += rgblocks;
-		sdp->fssize = ri->ri_data0 + ri->ri_data;
-	}
-}
diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c
deleted file mode 100644
index 0402e85..0000000
--- a/gfs2/libgfs2/fs_ops.c
+++ /dev/null
@@ -1,1632 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-
-#include <linux/types.h>
-#include "libgfs2.h"
-
-/* Detect directory is a stuffed inode */
-int inode_is_stuffed(struct gfs2_inode *ip)
-{
-	return !ip->i_di.di_height;
-}
-
-struct gfs2_inode *inode_get(struct gfs2_sbd *sdp, struct gfs2_buffer_head *bh)
-{
-	struct gfs2_inode *ip;
-
-	zalloc(ip, sizeof(struct gfs2_inode));
-	gfs2_dinode_in(&ip->i_di, bh->b_data);
-	ip->i_bh = bh;
-	ip->i_sbd = sdp;
-	return ip;
-}
-
-void inode_put(struct gfs2_inode *ip, enum update_flags updated)
-{
-	if (updated)
-		gfs2_dinode_out(&ip->i_di, ip->i_bh->b_data);
-	brelse(ip->i_bh, updated);
-	free(ip);
-}
-
-uint64_t blk_alloc_i(struct gfs2_sbd *sdp, unsigned int type)
-{
-	osi_list_t *tmp, *head;
-	struct rgrp_list *rl = NULL;
-	struct gfs2_rindex *ri;
-	struct gfs2_rgrp *rg;
-	unsigned int block, bn = 0, x = 0, y = 0;
-	struct gfs2_buffer_head *bh;
-	unsigned int state;
-
-	for (head = &sdp->rglist, tmp = head->next;
-	     tmp != head;
-	     tmp = tmp->next) {
-		rl = osi_list_entry(tmp, struct rgrp_list, list);
-		if (rl->rg.rg_free)
-			break;
-	}
-
-	if (tmp == head)
-		die("out of space\n");
-
-	ri = &rl->ri;
-	rg = &rl->rg;
-
-	for (block = 0; block < ri->ri_length; block++) {
-		bh = bread(&sdp->nvbuf_list, ri->ri_addr + block);
-		x = (block) ? sizeof(struct gfs2_meta_header) : sizeof(struct gfs2_rgrp);
-
-		for (; x < sdp->bsize; x++)
-			for (y = 0; y < GFS2_NBBY; y++) {
-				state = (bh->b_data[x] >> (GFS2_BIT_SIZE * y)) & 0x03;
-				if (state == GFS2_BLKST_FREE)
-					goto found;
-				bn++;
-			}
-
-		brelse(bh, FALSE);
-	}
-
-	die("allocation is broken (1): %"PRIu64" %u\n",
-	    (uint64_t)rl->ri.ri_addr, rl->rg.rg_free);
-
- found:
-	if (bn >= ri->ri_bitbytes * GFS2_NBBY)
-		die("allocation is broken (2): %u %u %"PRIu64" %u\n",
-		    bn, ri->ri_bitbytes * GFS2_NBBY,
-		    (uint64_t)rl->ri.ri_addr, rl->rg.rg_free);
-
-	switch (type) {
-	case DATA:
-	case META:
-		state = GFS2_BLKST_USED;
-		break;
-	case DINODE:
-		state = GFS2_BLKST_DINODE;
-		rg->rg_dinodes++;
-		break;
-	default:
-		die("bad state\n");
-	}
-
-	bh->b_data[x] &= ~(0x03 << (GFS2_BIT_SIZE * y));
-	bh->b_data[x] |= state << (GFS2_BIT_SIZE * y);
-	rg->rg_free--;
-
-	brelse(bh, updated);
-
-	bh = bread(&sdp->nvbuf_list, ri->ri_addr);
-	gfs2_rgrp_out(rg, bh->b_data);
-	brelse(bh, updated);
-
-	sdp->blks_alloced++;
-
-	return ri->ri_data0 + bn;
-}
-
-uint64_t data_alloc(struct gfs2_inode *ip)
-{
-	uint64_t x;
-	x = blk_alloc_i(ip->i_sbd, DATA);
-	ip->i_di.di_goal_data = x;
-	return x;
-}
-
-uint64_t meta_alloc(struct gfs2_inode *ip)
-{
-	uint64_t x;
-	x = blk_alloc_i(ip->i_sbd, META);
-	ip->i_di.di_goal_meta = x;
-	return x;
-}
-
-uint64_t dinode_alloc(struct gfs2_sbd *sdp)
-{
-	sdp->dinodes_alloced++;
-	return blk_alloc_i(sdp, DINODE);
-}
-
-static __inline__ void buffer_clear_tail(struct gfs2_sbd *sdp,
-					 struct gfs2_buffer_head *bh, int head)
-{
-	memset(bh->b_data + head, 0, sdp->bsize - head);
-}
-
-static __inline__ void
-buffer_copy_tail(struct gfs2_sbd *sdp,
-		 struct gfs2_buffer_head *to_bh, int to_head,
-		 struct gfs2_buffer_head *from_bh, int from_head)
-{
-	memcpy(to_bh->b_data + to_head, from_bh->b_data + from_head,
-	       sdp->bsize - from_head);
-	memset(to_bh->b_data + sdp->bsize + to_head - from_head, 0,
-	       from_head - to_head);
-}
-
-static void unstuff_dinode(struct gfs2_inode *ip)
-{
-	struct gfs2_sbd *sdp = ip->i_sbd;
-	struct gfs2_buffer_head *bh;
-	uint64_t block = 0;
-	int isdir = !!(S_ISDIR(ip->i_di.di_mode));
-
-	if (ip->i_di.di_size) {
-		if (isdir) {
-			block = meta_alloc(ip);
-			bh = bget(&sdp->buf_list, block);
-			{
-				struct gfs2_meta_header mh;
-				mh.mh_magic = GFS2_MAGIC;
-				mh.mh_type = GFS2_METATYPE_JD;
-				mh.mh_format = GFS2_FORMAT_JD;
-				gfs2_meta_header_out(&mh, bh->b_data);
-			}
-
-			buffer_copy_tail(sdp, bh,
-					 sizeof(struct gfs2_meta_header),
-					 ip->i_bh, sizeof(struct gfs2_dinode));
-
-			brelse(bh, updated);
-		} else {
-			block = data_alloc(ip);
-			bh = bget(&sdp->buf_list, block);
-
-			buffer_copy_tail(sdp, bh, 0,
-					 ip->i_bh, sizeof(struct gfs2_dinode));
-
-			brelse(bh, updated);
-		}
-	}
-
-	buffer_clear_tail(sdp, ip->i_bh, sizeof(struct gfs2_dinode));
-
-	if (ip->i_di.di_size) {
-		*(uint64_t *)(ip->i_bh->b_data + sizeof(struct gfs2_dinode)) = cpu_to_be64(block);
-		ip->i_di.di_blocks++;
-	}
-
-	ip->i_di.di_height = 1;
-}
-
-unsigned int calc_tree_height(struct gfs2_inode *ip, uint64_t size)
-{
-	struct gfs2_sbd *sdp = ip->i_sbd;
-	uint64_t *arr;
-	unsigned int max, height;
-
-	if (ip->i_di.di_size > size)
-		size = ip->i_di.di_size;
-
-	if (S_ISDIR(ip->i_di.di_mode)) {
-		arr = sdp->sd_jheightsize;
-		max = sdp->sd_max_jheight;
-	} else {
-		arr = sdp->sd_heightsize;
-		max = sdp->sd_max_height;
-	}
-
-	for (height = 0; height < max; height++)
-		if (arr[height] >= size)
-			break;
-
-	return height;
-}
-
-void build_height(struct gfs2_inode *ip, int height)
-{
-	struct gfs2_sbd *sdp = ip->i_sbd;
-	struct gfs2_buffer_head *bh;
-	uint64_t block = 0, *bp;
-	unsigned int x;
-	int new_block;
-
-	while (ip->i_di.di_height < height) {
-		new_block = FALSE;
-		bp = (uint64_t *)(ip->i_bh->b_data + sizeof(struct gfs2_dinode));
-		for (x = 0; x < sdp->sd_diptrs; x++, bp++)
-			if (*bp) {
-				new_block = TRUE;
-				break;
-			}
-
-		if (new_block) {
-			block = meta_alloc(ip);
-			bh = bget(&sdp->buf_list, block);
-			{
-				struct gfs2_meta_header mh;
-				mh.mh_magic = GFS2_MAGIC;
-				mh.mh_type = GFS2_METATYPE_IN;
-				mh.mh_format = GFS2_FORMAT_IN;
-				gfs2_meta_header_out(&mh, bh->b_data);
-			}
-			buffer_copy_tail(sdp, bh,
-					 sizeof(struct gfs2_meta_header),
-					 ip->i_bh, sizeof(struct gfs2_dinode));
-
-			brelse(bh, updated);
-		}
-
-		buffer_clear_tail(sdp, ip->i_bh, sizeof(struct gfs2_dinode));
-
-		if (new_block) {
-			*(uint64_t *)(ip->i_bh->b_data + sizeof(struct gfs2_dinode)) = cpu_to_be64(block);
-			ip->i_di.di_blocks++;
-		}
-
-		ip->i_di.di_height++;
-	}
-}
-
-struct metapath *find_metapath(struct gfs2_inode *ip, uint64_t block)
-{
-	struct gfs2_sbd *sdp = ip->i_sbd;
-	struct metapath *mp;
-	uint64_t b = block;
-	unsigned int i;
-
-	zalloc(mp, sizeof(struct metapath));
-
-	for (i = ip->i_di.di_height; i--;)
-		mp->mp_list[i] = do_div(b, sdp->sd_inptrs);
-
-	return mp;
-}
-
-static void lookup_block(struct gfs2_inode *ip,
-	     struct gfs2_buffer_head *bh, unsigned int height, struct metapath *mp,
-	     int create, int *new, uint64_t *block)
-{
-	uint64_t *ptr = metapointer(bh, height, mp);
-
-	if (*ptr) {
-		*block = be64_to_cpu(*ptr);
-		return;
-	}
-
-	*block = 0;
-
-	if (!create)
-		return;
-
-	if (height == ip->i_di.di_height - 1&&
-	    !(S_ISDIR(ip->i_di.di_mode)))
-		*block = data_alloc(ip);
-	else
-		*block = meta_alloc(ip);
-
-	*ptr = cpu_to_be64(*block);
-	ip->i_di.di_blocks++;
-
-	*new = 1;
-}
-
-void block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
-	       uint64_t *dblock, uint32_t *extlen, int prealloc,
-	       enum update_flags if_changed)
-{
-	struct gfs2_sbd *sdp = ip->i_sbd;
-	struct gfs2_buffer_head *bh;
-	struct metapath *mp;
-	int create = *new;
-	unsigned int bsize;
-	unsigned int height;
-	unsigned int end_of_metadata;
-	unsigned int x;
-
-	*new = 0;
-	*dblock = 0;
-	if (extlen)
-		*extlen = 0;
-
-	if (inode_is_stuffed(ip)) {
-		if (!lblock) {
-			*dblock = ip->i_di.di_num.no_addr;
-			if (extlen)
-				*extlen = 1;
-		}
-		return;
-	}
-
-	bsize = (S_ISDIR(ip->i_di.di_mode)) ? sdp->sd_jbsize : sdp->bsize;
-
-	height = calc_tree_height(ip, (lblock + 1) * bsize);
-	if (ip->i_di.di_height < height) {
-		if (!create)
-			return;
-
-		build_height(ip, height);
-	}
-
-	mp = find_metapath(ip, lblock);
-	end_of_metadata = ip->i_di.di_height - 1;
-
-	bh = bhold(ip->i_bh);
-
-	for (x = 0; x < end_of_metadata; x++) {
-		lookup_block(ip, bh, x, mp, create, new, dblock);
-		brelse(bh, if_changed);
-		if (!*dblock)
-			goto out;
-
-		if (*new) {
-			struct gfs2_meta_header mh;
-			bh = bget(&sdp->buf_list, *dblock);
-			mh.mh_magic = GFS2_MAGIC;
-			mh.mh_type = GFS2_METATYPE_IN;
-			mh.mh_format = GFS2_FORMAT_IN;
-			gfs2_meta_header_out(&mh, bh->b_data);
-		} else
-			bh = bread(&sdp->buf_list, *dblock);
-	}
-
-	if (!prealloc)
-		lookup_block(ip, bh, end_of_metadata, mp, create, new, dblock);
-
-	if (extlen && *dblock) {
-		*extlen = 1;
-
-		if (!*new) {
-			uint64_t tmp_dblock;
-			int tmp_new;
-			unsigned int nptrs;
-
-			nptrs = (end_of_metadata) ? sdp->sd_inptrs : sdp->sd_diptrs;
-
-			while (++mp->mp_list[end_of_metadata] < nptrs) {
-				lookup_block(ip, bh, end_of_metadata, mp, FALSE, &tmp_new,
-							 &tmp_dblock);
-
-				if (*dblock + *extlen != tmp_dblock)
-					break;
-
-				(*extlen)++;
-			}
-		}
-	}
-
-	brelse(bh, if_changed);
-
- out:
-	free(mp);
-}
-
-static void
-copy2mem(struct gfs2_buffer_head *bh, void **buf, unsigned int offset,
-	 unsigned int size)
-{
-	char **p = (char **)buf;
-
-	if (bh)
-		memcpy(*p, bh->b_data + offset, size);
-	else
-		memset(*p, 0, size);
-
-	*p += size;
-}
-
-int gfs2_readi(struct gfs2_inode *ip, void *buf,
-			   uint64_t offset, unsigned int size)
-{
-	struct gfs2_sbd *sdp = ip->i_sbd;
-	struct gfs2_buffer_head *bh;
-	uint64_t lblock, dblock;
-	unsigned int o;
-	uint32_t extlen = 0;
-	unsigned int amount;
-	int not_new = 0;
-	int isdir = !!(S_ISDIR(ip->i_di.di_mode));
-	int copied = 0;
-
-	if (offset >= ip->i_di.di_size)
-		return 0;
-
-	if ((offset + size) > ip->i_di.di_size)
-		size = ip->i_di.di_size - offset;
-
-	if (!size)
-		return 0;
-
-	if (isdir) {
-		lblock = offset;
-		o = do_div(lblock, sdp->sd_jbsize);
-	} else {
-		lblock = offset >> sdp->sd_sb.sb_bsize_shift;
-		o = offset & (sdp->bsize - 1);
-	}
-
-	if (inode_is_stuffed(ip))
-		o += sizeof(struct gfs2_dinode);
-	else if (isdir)
-		o += sizeof(struct gfs2_meta_header);
-
-	while (copied < size) {
-		amount = size - copied;
-		if (amount > sdp->bsize - o)
-			amount = sdp->bsize - o;
-
-		if (!extlen)
-			block_map(ip, lblock, &not_new, &dblock, &extlen,
-				  FALSE, not_updated);
-
-		if (dblock) {
-			bh = bread(&sdp->buf_list, dblock);
-			dblock++;
-			extlen--;
-		} else
-			bh = NULL;
-
-		copy2mem(bh, &buf, o, amount);
-		if (bh)
-			brelse(bh, not_updated);
-
-		copied += amount;
-		lblock++;
-
-		o = (isdir) ? sizeof(struct gfs2_meta_header) : 0;
-	}
-
-	return copied;
-}
-
-static void copy_from_mem(struct gfs2_buffer_head *bh, void **buf,
-						  unsigned int offset, unsigned int size)
-{
-	char **p = (char **)buf;
-
-	memcpy(bh->b_data + offset, *p, size);
-	*p += size;
-}
-
-int gfs2_writei(struct gfs2_inode *ip, void *buf,
-				uint64_t offset, unsigned int size)
-{
-	struct gfs2_sbd *sdp = ip->i_sbd;
-	struct gfs2_buffer_head *bh;
-	uint64_t lblock, dblock;
-	unsigned int o;
-	uint32_t extlen = 0;
-	unsigned int amount;
-	int new;
-	int isdir = !!(S_ISDIR(ip->i_di.di_flags));
-	const uint64_t start = offset;
-	int copied = 0;
-
-	if (!size)
-		return 0;
-
-	if (inode_is_stuffed(ip) &&
-	    ((start + size) > (sdp->bsize - sizeof(struct gfs2_dinode))))
-		unstuff_dinode(ip);
-
-	if (isdir) {
-		lblock = offset;
-		o = do_div(lblock, sdp->sd_jbsize);
-	} else {
-		lblock = offset >> sdp->sd_sb.sb_bsize_shift;
-		o = offset & (sdp->bsize - 1);
-	}
-
-	if (inode_is_stuffed(ip))
-		o += sizeof(struct gfs2_dinode);
-	else if (isdir)
-		o += sizeof(struct gfs2_meta_header);
-
-	while (copied < size) {
-		amount = size - copied;
-		if (amount > sdp->bsize - o)
-			amount = sdp->bsize - o;
-
-		if (!extlen) {
-			new = TRUE;
-			block_map(ip, lblock, &new, &dblock, &extlen, FALSE,
-				  updated);
-		}
-
-		if (new) {
-			bh = bget(&sdp->buf_list, dblock);
-			if (isdir) {
-				struct gfs2_meta_header mh;
-				mh.mh_magic = GFS2_MAGIC;
-				mh.mh_type = GFS2_METATYPE_JD;
-				mh.mh_format = GFS2_FORMAT_JD;
-				gfs2_meta_header_out(&mh, bh->b_data);
-			}
-		} else
-			bh = bread(&sdp->buf_list, dblock);
-		copy_from_mem(bh, &buf, o, amount);
-		brelse(bh, updated);
-
-		copied += amount;
-		lblock++;
-		dblock++;
-		extlen--;
-
-		o = (isdir) ? sizeof(struct gfs2_meta_header) : 0;
-	}
-
-	if (ip->i_di.di_size < start + copied)
-		ip->i_di.di_size = start + copied;
-
-	return copied;
-}
-
-struct gfs2_buffer_head *get_file_buf(struct gfs2_inode *ip, uint64_t lbn,
-				      int prealloc)
-{
-	struct gfs2_sbd *sdp = ip->i_sbd;
-	uint64_t dbn;
-	int new = TRUE;
-
-	if (inode_is_stuffed(ip))
-		unstuff_dinode(ip);
-
-	block_map(ip, lbn, &new, &dbn, NULL, prealloc, updated);
-	if (!dbn)
-		die("get_file_buf\n");
-
-	if (!prealloc && new &&
-	    ip->i_di.di_size < (lbn + 1) << sdp->sd_sb.sb_bsize_shift)
-		ip->i_di.di_size = (lbn + 1) << sdp->sd_sb.sb_bsize_shift;
-
-	if (new)
-		return bget(&sdp->buf_list, dbn);
-	else
-		return bread(&sdp->buf_list, dbn);
-}
-
-int gfs2_dirent_first(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
-					  struct gfs2_dirent **dent)
-{
-	struct gfs2_meta_header *h = (struct gfs2_meta_header *)bh->b_data;
-
-	if (be32_to_cpu(h->mh_type) == GFS2_METATYPE_LF) {
-		*dent = (struct gfs2_dirent *)(bh->b_data + sizeof(struct gfs2_leaf));
-		return IS_LEAF;
-	} else {
-		*dent = (struct gfs2_dirent *)(bh->b_data + sizeof(struct gfs2_dinode));
-		return IS_DINODE;
-	}
-}
-
-int gfs2_dirent_next(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
-					 struct gfs2_dirent **dent)
-{
-	char *bh_end;
-	uint16_t cur_rec_len;
-
-	bh_end = bh->b_data + dip->i_sbd->bsize;
-	cur_rec_len = be16_to_cpu((*dent)->de_rec_len);
-
-	if ((char *)(*dent) + cur_rec_len >= bh_end)
-		return -ENOENT;
-
-	*dent = (struct gfs2_dirent *)((char *)(*dent) + cur_rec_len);
-
-	return 0;
-}
-
-static int
-dirent_alloc(struct gfs2_inode *dip, struct gfs2_buffer_head *bh, int name_len,
-			 struct gfs2_dirent **dent_out)
-{
-	struct gfs2_dirent *dent, *new;
-	unsigned int rec_len = GFS2_DIRENT_SIZE(name_len);
-	unsigned int entries = 0, offset = 0;
-	int type;
-
-	type = gfs2_dirent_first(dip, bh, &dent);
-
-	if (type == IS_LEAF) {
-		struct gfs2_leaf *leaf = (struct gfs2_leaf *)bh->b_data;
-		entries = be16_to_cpu(leaf->lf_entries);
-		offset = sizeof(struct gfs2_leaf);
-	} else {
-		struct gfs2_dinode *dinode = (struct gfs2_dinode *)bh->b_data;
-		entries = be32_to_cpu(dinode->di_entries);
-		offset = sizeof(struct gfs2_dinode);
-	}
-
-	if (!entries) {
-		dent->de_rec_len = cpu_to_be16(dip->i_sbd->bsize - offset);
-		dent->de_name_len = cpu_to_be16(name_len);
-
-		*dent_out = dent;
-		return 0;
-	}
-
-	do {
-		uint16_t cur_rec_len;
-		uint16_t cur_name_len;
-
-		cur_rec_len = be16_to_cpu(dent->de_rec_len);
-		cur_name_len = be16_to_cpu(dent->de_name_len);
-
-		if ((!dent->de_inum.no_formal_ino && cur_rec_len >= rec_len) ||
-		    (cur_rec_len >= GFS2_DIRENT_SIZE(cur_name_len) + rec_len)) {
-
-			if (dent->de_inum.no_formal_ino) {
-				new = (struct gfs2_dirent *)((char *)dent +
-							    GFS2_DIRENT_SIZE(cur_name_len));
-				memset(new, 0, sizeof(struct gfs2_dirent));
-
-				new->de_rec_len = cpu_to_be16(cur_rec_len -
-											  GFS2_DIRENT_SIZE(cur_name_len));
-				new->de_name_len = cpu_to_be16(name_len);
-				dent->de_rec_len = cpu_to_be16(cur_rec_len -
-											   be16_to_cpu(new->de_rec_len));
-				*dent_out = new;
-				return 0;
-			}
-
-			dent->de_name_len = cpu_to_be16(name_len);
-
-			*dent_out = dent;
-			return 0;
-		}
-	} while (gfs2_dirent_next(dip, bh, &dent) == 0);
-
-	return -ENOSPC;
-}
-
-void dirent2_del(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
-				struct gfs2_dirent *prev, struct gfs2_dirent *cur)
-{
-	uint16_t cur_rec_len, prev_rec_len;
-
-	if (!prev) {
-		cur->de_inum.no_formal_ino = 0;
-		return;
-	}
-
-	prev_rec_len = be16_to_cpu(prev->de_rec_len);
-	cur_rec_len = be16_to_cpu(cur->de_rec_len);
-
-	prev_rec_len += cur_rec_len;
-	prev->de_rec_len = cpu_to_be16(prev_rec_len);
-}
-
-void gfs2_get_leaf_nr(struct gfs2_inode *dip, uint32_t index,
-					  uint64_t *leaf_out)
-{
-	uint64_t leaf_no;
-	int count;
-
-	count = gfs2_readi(dip, (char *)&leaf_no,
-		      index * sizeof(uint64_t),
-		      sizeof(uint64_t));
-	if (count != sizeof(uint64_t))
-		die("gfs2_get_leaf_nr:  Bad internal read.\n");
-
-	*leaf_out = be64_to_cpu(leaf_no);
-}
-
-void gfs2_put_leaf_nr(struct gfs2_inode *dip, uint32_t inx, uint64_t leaf_out)
-{
-	uint64_t leaf_no;
-	int count;
-
-	leaf_no = cpu_to_be64(leaf_out);
-	count = gfs2_writei(dip, (char *)&leaf_no, inx * sizeof(uint64_t),
-			    sizeof(uint64_t));
-	if (count != sizeof(uint64_t))
-		die("gfs2_put_leaf_nr:  Bad internal write.\n");
-}
-
-static void
-dir_split_leaf(struct gfs2_inode *dip, uint32_t index, uint64_t leaf_no)
-{
-	struct gfs2_buffer_head *nbh, *obh;
-	struct gfs2_leaf *nleaf, *oleaf;
-	struct gfs2_dirent *dent, *prev = NULL, *next = NULL, *new;
-	uint32_t start, len, half_len, divider;
-	uint64_t bn, *lp;
-	uint32_t name_len;
-	int x, moved = FALSE;
-	int count;
-
-	bn = meta_alloc(dip);
-	nbh = bget(&dip->i_sbd->buf_list, bn);
-	{
-		struct gfs2_meta_header mh;
-		mh.mh_magic = GFS2_MAGIC;
-		mh.mh_type = GFS2_METATYPE_LF;
-		mh.mh_format = GFS2_FORMAT_LF;
-		gfs2_meta_header_out(&mh, nbh->b_data);
-	}
-
-	nleaf = (struct gfs2_leaf *)nbh->b_data;
-	nleaf->lf_dirent_format = cpu_to_be32(GFS2_FORMAT_DE);
-
-	obh = bread(&dip->i_sbd->buf_list, leaf_no);
-	oleaf = (struct gfs2_leaf *)obh->b_data;
-
-	len = 1 << (dip->i_di.di_depth - be16_to_cpu(oleaf->lf_depth));
-	half_len = len >> 1;
-
-	start = (index & ~(len - 1));
-
-	zalloc(lp, half_len * sizeof(uint64_t));
-
-	count = gfs2_readi(dip, (char *)lp, start * sizeof(uint64_t),
-		      half_len * sizeof(uint64_t));
-	if (count != half_len * sizeof(uint64_t))
-		die("dir_split_leaf (1)\n");
-
-	for (x = 0; x < half_len; x++)
-		lp[x] = cpu_to_be64(bn);
-
-	count = gfs2_writei(dip, (char *)lp, start * sizeof(uint64_t),
-		       half_len * sizeof(uint64_t));
-	if (count != half_len * sizeof(uint64_t))
-		die("dir_split_leaf (2)\n");
-
-	free(lp);
-
-	divider = (start + half_len) << (32 - dip->i_di.di_depth);
-
-	gfs2_dirent_first(dip, obh, &dent);
-
-	do {
-		next = dent;
-		if (gfs2_dirent_next(dip, obh, &next))
-			next = NULL;
-
-		if (dent->de_inum.no_formal_ino &&
-		    be32_to_cpu(dent->de_hash) < divider) {
-			name_len = be16_to_cpu(dent->de_name_len);
-
-			dirent_alloc(dip, nbh, name_len, &new);
-
-			new->de_inum = dent->de_inum;
-			new->de_hash = dent->de_hash;
-			new->de_type = dent->de_type;
-			memcpy((char *)(new + 1), (char *)(dent + 1), name_len);
-
-			nleaf->lf_entries = be16_to_cpu(nleaf->lf_entries) + 1;
-			nleaf->lf_entries = cpu_to_be16(nleaf->lf_entries);
-
-			dirent2_del(dip, obh, prev, dent);
-
-			oleaf->lf_entries = be16_to_cpu(oleaf->lf_entries) - 1;
-			oleaf->lf_entries = cpu_to_be16(oleaf->lf_entries);
-
-			if (!prev)
-				prev = dent;
-
-			moved = TRUE;
-		} else
-			prev = dent;
-
-		dent = next;
-	} while (dent);
-
-	if (!moved) {
-		dirent_alloc(dip, nbh, 0, &new);
-		new->de_inum.no_formal_ino = 0;
-	}
-
-	oleaf->lf_depth = be16_to_cpu(oleaf->lf_depth) + 1;
-	oleaf->lf_depth = cpu_to_be16(oleaf->lf_depth);
-	nleaf->lf_depth = oleaf->lf_depth;
-
-	dip->i_di.di_blocks++;
-
-	brelse(obh, not_updated);
-	brelse(nbh, updated);
-}
-
-static void
-dir_double_exhash(struct gfs2_inode *dip)
-{
-	struct gfs2_sbd *sdp = dip->i_sbd;
-	uint64_t *buf;
-	uint64_t *from, *to;
-	uint64_t block;
-	int x;
-	int count;
-
-	zalloc(buf, 3 * sdp->sd_hash_bsize);
-
-	for (block = dip->i_di.di_size >> sdp->sd_hash_bsize_shift; block--;) {
-		count = gfs2_readi(dip, (char *)buf,
-			      block * sdp->sd_hash_bsize,
-			      sdp->sd_hash_bsize);
-		if (count != sdp->sd_hash_bsize)
-			die("dir_double_exhash (1)\n");
-
-		from = buf;
-		to = (uint64_t *)((char *)buf + sdp->sd_hash_bsize);
-
-		for (x = sdp->sd_hash_ptrs; x--; from++) {
-			*to++ = *from;
-			*to++ = *from;
-		}
-
-		count = gfs2_writei(dip, (char *)buf + sdp->sd_hash_bsize,
-							block * sdp->bsize, sdp->bsize);
-		if (count != sdp->bsize)
-			die("dir_double_exhash (2)\n");
-
-	}
-
-	free(buf);
-
-	dip->i_di.di_depth++;
-}
-
-/**
- * get_leaf - Get leaf
- * @dip:
- * @leaf_no:
- * @bh_out:
- *
- * Returns: 0 on success, error code otherwise
- */
-
-int gfs2_get_leaf(struct gfs2_inode *dip, uint64_t leaf_no,
-				  struct gfs2_buffer_head **bhp)
-{
-	int error = 0;
-
-	*bhp = bread(&dip->i_sbd->buf_list, leaf_no);
-	if (error)
-		return error;
-	error = gfs2_check_meta(*bhp, GFS2_METATYPE_LF);
-	if(error)
-		brelse(*bhp, not_updated);
-	return error;
-}
-
-/**
- * get_first_leaf - Get first leaf
- * @dip: The GFS2 inode
- * @index:
- * @bh_out:
- *
- * Returns: 0 on success, error code otherwise
- */
-
-static int get_first_leaf(struct gfs2_inode *dip, uint32_t index,
-						  struct gfs2_buffer_head **bh_out)
-{
-	uint64_t leaf_no;
-
-	gfs2_get_leaf_nr(dip, index, &leaf_no);
-	*bh_out = bread(&dip->i_sbd->buf_list, leaf_no);
-	return 0;
-}
-
-/**
- * get_next_leaf - Get next leaf
- * @dip: The GFS2 inode
- * @bh_in: The buffer
- * @bh_out:
- *
- * Returns: 0 on success, error code otherwise
- */
-
-static int get_next_leaf(struct gfs2_inode *dip,struct gfs2_buffer_head *bh_in,
-						 struct gfs2_buffer_head **bh_out)
-{
-	struct gfs2_leaf *leaf;
-
-	leaf = (struct gfs2_leaf *)bh_in->b_data;
-
-	if (!leaf->lf_next)
-		return -1;
-	*bh_out = bread(&dip->i_sbd->buf_list, be64_to_cpu(leaf->lf_next));
-	return 0;
-}
-
-static void
-dir_e_add(struct gfs2_inode *dip, char *filename, int len,
-		  struct gfs2_inum *inum, unsigned int type)
-{
-	struct gfs2_buffer_head *bh, *nbh;
-	struct gfs2_leaf *leaf, *nleaf;
-	struct gfs2_dirent *dent;
-	uint32_t index;
-	uint32_t hash;
-	uint64_t leaf_no, bn;
-
- restart:
-	hash = gfs2_disk_hash(filename, len);
-	/* Have to kludge because (hash >> 32) gives hash for some reason. */
-	if (dip->i_di.di_depth)
-		index = hash >> (32 - dip->i_di.di_depth);
-	else
-		index = 0;
-
-	gfs2_get_leaf_nr(dip, index, &leaf_no);
-
-	for (;;) {
-		bh = bread(&dip->i_sbd->buf_list, leaf_no);
-		leaf = (struct gfs2_leaf *)bh->b_data;
-
-		if (dirent_alloc(dip, bh, len, &dent)) {
-
-			if (be16_to_cpu(leaf->lf_depth) < dip->i_di.di_depth) {
-				brelse(bh, not_updated);
-				dir_split_leaf(dip, index, leaf_no);
-				goto restart;
-
-			} else if (dip->i_di.di_depth < GFS2_DIR_MAX_DEPTH) {
-				brelse(bh, not_updated);
-				dir_double_exhash(dip);
-				goto restart;
-
-			} else if (leaf->lf_next) {
-				leaf_no = be64_to_cpu(leaf->lf_next);
-				brelse(bh, not_updated);
-				continue;
-
-			} else {
-				bn = meta_alloc(dip);
-				nbh = bget(&dip->i_sbd->buf_list, bn);
-				{
-					struct gfs2_meta_header mh;
-					mh.mh_magic = GFS2_MAGIC;
-					mh.mh_type = GFS2_METATYPE_LF;
-					mh.mh_format = GFS2_FORMAT_LF;
-					gfs2_meta_header_out(&mh, nbh->b_data);
-				}
-
-				leaf->lf_next = cpu_to_be64(bn);
-
-				nleaf = (struct gfs2_leaf *)nbh->b_data;
-				nleaf->lf_depth = leaf->lf_depth;
-				nleaf->lf_dirent_format = cpu_to_be32(GFS2_FORMAT_DE);
-
-				dirent_alloc(dip, nbh, len, &dent);
-				dip->i_di.di_blocks++;
-				brelse(bh, updated);
-				bh = nbh;
-				leaf = nleaf;
-			}
-		}
-
-		gfs2_inum_out(inum, (char *)&dent->de_inum);
-		dent->de_hash = cpu_to_be32(hash);
-		dent->de_type = cpu_to_be16(type);
-		memcpy((char *)(dent + 1), filename, len);
-
-		leaf->lf_entries = be16_to_cpu(leaf->lf_entries) + 1;
-		leaf->lf_entries = cpu_to_be16(leaf->lf_entries);
-
-		brelse(bh, updated);
-
-		dip->i_di.di_entries++;
-
-		return;
-	}
-}
-
-static void
-dir_make_exhash(struct gfs2_inode *dip)
-{
-	struct gfs2_sbd *sdp = dip->i_sbd;
-	struct gfs2_dirent *dent;
-	struct gfs2_buffer_head *bh;
-	struct gfs2_leaf *leaf;
-	int y;
-	uint32_t x;
-	uint64_t *lp, bn;
-
-	bn = meta_alloc(dip);
-	bh = bget(&sdp->buf_list, bn);
-	{
-		struct gfs2_meta_header mh;
-		mh.mh_magic = GFS2_MAGIC;
-		mh.mh_type = GFS2_METATYPE_LF;
-		mh.mh_format = GFS2_FORMAT_LF;
-		gfs2_meta_header_out(&mh, bh->b_data);
-	}
-
-	leaf = (struct gfs2_leaf *)bh->b_data;
-	leaf->lf_dirent_format = cpu_to_be32(GFS2_FORMAT_DE);
-	leaf->lf_entries = cpu_to_be16(dip->i_di.di_entries);
-
-	buffer_copy_tail(sdp, bh, sizeof(struct gfs2_leaf),
-			 dip->i_bh, sizeof(struct gfs2_dinode));
-
-	x = 0;
-	gfs2_dirent_first(dip, bh, &dent);
-
-	do {
-		if (!dent->de_inum.no_formal_ino)
-			continue;
-		if (++x == dip->i_di.di_entries)
-			break;
-	} while (gfs2_dirent_next(dip, bh, &dent) == 0);
-
-	dent->de_rec_len = cpu_to_be16(be16_to_cpu(dent->de_rec_len) +
-		sizeof(struct gfs2_dinode) - sizeof(struct gfs2_leaf));
-
-	brelse(bh, updated);
-
-	buffer_clear_tail(sdp, dip->i_bh, sizeof(struct gfs2_dinode));
-
-	lp = (uint64_t *)(dip->i_bh->b_data + sizeof(struct gfs2_dinode));
-
-	for (x = sdp->sd_hash_ptrs; x--; lp++)
-		*lp = cpu_to_be64(bn);
-
-	dip->i_di.di_size = sdp->bsize / 2;
-	dip->i_di.di_blocks++;
-	dip->i_di.di_flags |= GFS2_DIF_EXHASH;
-	dip->i_di.di_payload_format = 0;
-
-	for (x = sdp->sd_hash_ptrs, y = -1; x; x >>= 1, y++) ;
-	dip->i_di.di_depth = y;
-}
-
-static void dir_l_add(struct gfs2_inode *dip, char *filename, int len,
-					  struct gfs2_inum *inum, unsigned int type)
-{
-	struct gfs2_dirent *dent;
-
-	if (dirent_alloc(dip, dip->i_bh, len, &dent)) {
-		dir_make_exhash(dip);
-		dir_e_add(dip, filename, len, inum, type);
-		return;
-	}
-
-	gfs2_inum_out(inum, (char *)&dent->de_inum);
-	dent->de_hash = gfs2_disk_hash(filename, len);
-	dent->de_hash = cpu_to_be32(dent->de_hash);
-	dent->de_type = cpu_to_be16(type);
-	memcpy((char *)(dent + 1), filename, len);
-
-	dip->i_di.di_entries++;
-}
-
-void dir_add(struct gfs2_inode *dip, char *filename, int len,
-			 struct gfs2_inum *inum, unsigned int type)
-{
-	if (dip->i_di.di_flags & GFS2_DIF_EXHASH)
-		dir_e_add(dip, filename, len, inum, type);
-	else
-		dir_l_add(dip, filename, len, inum, type);
-}
-
-struct gfs2_buffer_head *
-init_dinode(struct gfs2_sbd *sdp, struct gfs2_inum *inum,
-	    unsigned int mode, uint32_t flags,
-	    struct gfs2_inum *parent)
-{
-	struct gfs2_buffer_head *bh;
-	struct gfs2_dinode di;
-
-	bh = bget(&sdp->buf_list, inum->no_addr);
-
-	memset(&di, 0, sizeof(struct gfs2_dinode));
-	di.di_header.mh_magic = GFS2_MAGIC;
-	di.di_header.mh_type = GFS2_METATYPE_DI;
-	di.di_header.mh_format = GFS2_FORMAT_DI;
-	di.di_num = *inum;
-	di.di_mode = mode;
-	di.di_nlink = 1;
-	di.di_blocks = 1;
-	di.di_atime = di.di_mtime = di.di_ctime = sdp->time;
-	di.di_goal_meta = di.di_goal_data = bh->b_blocknr;
-	di.di_flags = flags;
-
-	if (S_ISDIR(mode)) {
-		struct gfs2_dirent de1, de2;
-
-		memset(&de1, 0, sizeof(struct gfs2_dirent));
-		de1.de_inum = di.di_num;
-		de1.de_hash = gfs2_disk_hash(".", 1);
-		de1.de_rec_len = GFS2_DIRENT_SIZE(1);
-		de1.de_name_len = 1;
-		de1.de_type = IF2DT(S_IFDIR);
-
-		memset(&de2, 0, sizeof(struct gfs2_dirent));
-		de2.de_inum = *parent;
-		de2.de_hash = gfs2_disk_hash("..", 2);
-		de2.de_rec_len = sdp->bsize - sizeof(struct gfs2_dinode) - de1.de_rec_len;
-		de2.de_name_len = 2;
-		de2.de_type = IF2DT(S_IFDIR);
-
-		gfs2_dirent_out(&de1, bh->b_data + sizeof(struct gfs2_dinode));
-		memcpy(bh->b_data +
-		       sizeof(struct gfs2_dinode) +
-		       sizeof(struct gfs2_dirent),
-		       ".", 1);
-		gfs2_dirent_out(&de2, bh->b_data + sizeof(struct gfs2_dinode) + de1.de_rec_len);
-		memcpy(bh->b_data +
-		       sizeof(struct gfs2_dinode) +
-		       de1.de_rec_len +
-		       sizeof(struct gfs2_dirent),
-		       "..", 2);
-
-		di.di_nlink = 2;
-		di.di_size = sdp->bsize - sizeof(struct gfs2_dinode);
-		di.di_flags |= GFS2_DIF_JDATA;
-		di.di_payload_format = GFS2_FORMAT_DE;
-		di.di_entries = 2;
-	}
-
-	gfs2_dinode_out(&di, bh->b_data);
-
-	return bh;
-}
-
-struct gfs2_inode *createi(struct gfs2_inode *dip, char *filename,
-						   unsigned int mode, uint32_t flags)
-{
-	struct gfs2_sbd *sdp = dip->i_sbd;
-	uint64_t bn;
-	struct gfs2_inum inum;
-	struct gfs2_buffer_head *bh;
-	struct gfs2_inode *ip;
-
-	gfs2_lookupi(dip, filename, strlen(filename), &ip);
-	if (!ip) {
-		bn = dinode_alloc(sdp);
-
-		inum.no_formal_ino = sdp->md.next_inum++;
-		inum.no_addr = bn;
-
-		dir_add(dip, filename, strlen(filename), &inum, IF2DT(mode));
-
-		if(S_ISDIR(mode))
-			dip->i_di.di_nlink++;
-
-		bh = init_dinode(sdp, &inum, mode, flags, &dip->i_di.di_num);
-		ip = inode_get(sdp, bh);
-	}
-	return ip;
-}
-
-/**
- * gfs2_filecmp - Compare two filenames
- * @file1: The first filename
- * @file2: The second filename
- * @len_of_file2: The length of the second file
- *
- * This routine compares two filenames and returns 1 if they are equal.
- *
- * Returns: 1 if the files are the same, otherwise 0.
- */
-int gfs2_filecmp(const char *file1, const char *file2, int len_of_file2)
-{
-	if (strlen(file1) != len_of_file2)
-		return 0;
-	if (memcmp(file1, file2, len_of_file2))
-		return 0;
-	return 1;
-}
-
-/**
- * leaf_search
- * @bh:
- * @id:
- * @dent_out:
- * @dent_prev:
- *
- * Returns:
- */
-static int leaf_search(struct gfs2_inode *dip,
-					   struct gfs2_buffer_head *bh, 
-					   const char *filename, int len,
-                       struct gfs2_dirent **dent_out,
-					   struct gfs2_dirent **dent_prev)
-{
-	uint32_t hash;
-	struct gfs2_dirent *dent, *prev = NULL;
-	unsigned int entries = 0, x = 0;
-	int type;
-
-	type = gfs2_dirent_first(dip, bh, &dent);
-
-	if (type == IS_LEAF){
-		struct gfs2_leaf *leaf = (struct gfs2_leaf *)bh->b_data;
-		entries = be16_to_cpu(leaf->lf_entries);
-	} else if (type == IS_DINODE) {
-		struct gfs2_dinode *dinode = (struct gfs2_dinode *)bh->b_data;
-		entries = be32_to_cpu(dinode->di_entries);
-	} else
-		return -1;
-
-	hash = gfs2_disk_hash(filename, len);
-
-	do{
-		if (!dent->de_inum.no_formal_ino){
-			prev = dent;
-			continue;
-		}
-		
-		if (be32_to_cpu(dent->de_hash) == hash &&
-			gfs2_filecmp(filename, (char *)(dent + 1),
-						 be16_to_cpu(dent->de_name_len))){
-			*dent_out = dent;
-			if (dent_prev)
-				*dent_prev = prev;
-			return 0;
-		}
-		
-		if(x >= entries)
-			return -1;
-		x++;
-		prev = dent;
-	} while (gfs2_dirent_next(dip, bh, &dent) == 0);
-
-	return -ENOENT;
-}
-
-/**
- * linked_leaf_search - Linked leaf search
- * @dip: The GFS2 inode
- * @id:
- * @dent_out:
- * @dent_prev:
- * @bh_out:
- *
- * Returns: 0 on sucess, error code otherwise
- */
-static int linked_leaf_search(struct gfs2_inode *dip,
-							  const char *filename, int len,
-                              struct gfs2_dirent **dent_out,
-							  struct gfs2_dirent **dent_prev,
-							  struct gfs2_buffer_head **bh_out)
-{
-	struct gfs2_buffer_head *bh = NULL, *bh_next;
-	uint32_t hsize, index;
-	uint32_t hash;
-	int error = 0;
-
-	hsize = 1 << dip->i_di.di_depth;
-	if(hsize * sizeof(uint64_t) != dip->i_di.di_size)
-		return -1;
-
-	/*  Figure out the address of the leaf node.  */
-
-	hash = gfs2_disk_hash(filename, len);
-	index = hash >> (32 - dip->i_di.di_depth);
-
-	error = get_first_leaf(dip, index, &bh_next);
-	if (error)
-		return error;
-
-	/*  Find the entry  */
-	do{
-		if (bh)
-			brelse(bh, not_updated);
-
-		bh = bh_next;
-		
-		error = leaf_search(dip, bh, filename, len, dent_out, dent_prev);
-		switch (error){
-		case 0:
-			*bh_out = bh;
-			return 0;
-			
-		case -ENOENT:
-			break;
-			
-		default:
-			brelse(bh, not_updated);
-			return error;
-		}
-		
-		error = get_next_leaf(dip, bh, &bh_next);
-	}while (!error);
-	
-	brelse(bh, not_updated);
-	
-	return error;
-}
-
-/**
- * dir_e_search -
- * @dip: The GFS2 inode
- * @id:
- * @inode:
- *
- * Returns:
- */
-static int dir_e_search(struct gfs2_inode *dip, const char *filename,
-						int len, unsigned int *type, struct gfs2_inum *inum)
-{
-	struct gfs2_buffer_head *bh = NULL;
-	struct gfs2_dirent *dent;
-	int error;
-
-	error = linked_leaf_search(dip, filename, len, &dent, NULL, &bh);
-	if (error)
-		return error;
-
-	gfs2_inum_in(inum, (char *)&dent->de_inum);
-	if (type)
-		*type = be16_to_cpu(dent->de_type);
-
-	brelse(bh, not_updated);
-
-	return 0;
-}
-
-
-/**
- * dir_l_search -
- * @dip: The GFS2 inode
- * @id:
- * @inode:
- *
- * Returns:
- */
-static int dir_l_search(struct gfs2_inode *dip, const char *filename,
-						int len, unsigned int *type, struct gfs2_inum *inum)
-{
-	struct gfs2_buffer_head *dibh;
-	struct gfs2_dirent *dent;
-	int error;
-
-	if(!inode_is_stuffed(dip))
-		return -1;
-
-	dibh = bread(&dip->i_sbd->buf_list, dip->i_di.di_num.no_addr);
-	error = leaf_search(dip, dibh, filename, len, &dent, NULL);
-	if (!error) {
-		gfs2_inum_in(inum, (char *)&dent->de_inum);
-		if(type)
-			*type = be16_to_cpu(dent->de_type);
-	}
-	brelse(dibh, not_updated);
-	return error;
-}
-
-/**
- * dir_search - Search a directory
- * @dip: The GFS inode
- * @id
- * @type:
- *
- * This routine searches a directory for a file or another directory
- * given its filename.  The component of the identifier that is
- * not being used to search will be filled in and must be freed by
- * the caller.
- *
- * Returns: 0 if found, -1 on failure, -ENOENT if not found.
- */
-int dir_search(struct gfs2_inode *dip, const char *filename, int len,
-			   unsigned int *type, struct gfs2_inum *inum)
-{
-	int error;
-
-	if(!S_ISDIR(dip->i_di.di_mode))
-		return -1;
-
-	if (dip->i_di.di_flags & GFS2_DIF_EXHASH)
-		error = dir_e_search(dip, filename, len, type, inum);
-	else
-		error = dir_l_search(dip, filename, len, type, inum);
-
-	return error;
-}
-
-static int dir_e_del(struct gfs2_inode *dip, const char *filename, int len)
-{
-	int index;
-	int error;
-	int found = 0;
-	uint64_t leaf_no;
-	struct gfs2_buffer_head *bh = NULL;
-	struct gfs2_dirent *cur, *prev;
-
-	index = (1 << (dip->i_di.di_depth))-1;
-
-	for(; (index >= 0) && !found; index--){
-		gfs2_get_leaf_nr(dip, index, &leaf_no);
-
-		while(leaf_no && !found){
-			bh = bread(&dip->i_sbd->buf_list, leaf_no);
-			error = leaf_search(dip, bh, filename, len, &cur, &prev);
-			if (error) {
-				if(error != -ENOENT){
-					brelse(bh, updated);
-					return -1;
-				}
-				leaf_no = be64_to_cpu(((struct gfs2_leaf *)bh->b_data)->lf_next);
-				brelse(bh, updated);
-			} else
-				found = 1;
-		}
-	}
-
-	if(!found)
-		return 1;
-
-	if (bh) {
-		dirent2_del(dip, bh, prev, cur);
-		brelse(bh, updated);
-	}
-	return 0;
-}
-
-static int dir_l_del(struct gfs2_inode *dip, struct gfs2_buffer_head *dibh,
-					 const char *filename, int len){
-	int error=0;
-	int got_buf = 0;
-	struct gfs2_dirent *cur, *prev;
-
-	if(!inode_is_stuffed(dip))
-		return -1;
-
-	if(!dibh) {
-		dibh = bread(&dip->i_sbd->buf_list, dip->i_di.di_num.no_addr);
-		if (error)
-			return -1;
-		got_buf = 1;
-	}
-
-	error = leaf_search(dip, dibh, filename, len, &cur, &prev);
-	if (error) {
-		if (got_buf)
-			brelse(dibh, not_updated);
-		if (error == -ENOENT)
-			return 1;
-		else
-			return -1;
-	}
-
-	dirent2_del(dip, dibh, prev, cur);
-	if (got_buf)
-		brelse(dibh, updated);
-	return 0;
-}
-
-
-/*
- * gfs2_dirent_del
- * @dip
- * filename
- *
- * Delete a directory entry from a directory.  This _only_
- * removes the directory entry - leaving the dinode in
- * place.  (Likely without a link.)
- *
- * Returns: 0 on success (or if it doesn't already exist), -1 on failure
- */
-int gfs2_dirent_del(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
-					const char *filename, int len){
-	int error;
-
-	if(!S_ISDIR(dip->i_di.di_mode))
-		return -1;
-
-	if (dip->i_di.di_flags & GFS2_DIF_EXHASH)
-		error = dir_e_del(dip, filename, len);
-	else
-		error = dir_l_del(dip, bh, filename, len);
-
-	return error;
-}
-
-/**
- * gfs2_lookupi - Look up a filename in a directory and return its inode
- * @dip: The directory to search
- * @name: The name of the inode to look for
- * @ipp: Used to return the found inode if any
- *
- * Returns: 0 on success, -EXXXX on failure
- */
-int gfs2_lookupi(struct gfs2_inode *dip, const char *filename, int len,
-				 struct gfs2_inode **ipp)
-{
-	struct gfs2_sbd *sdp = dip->i_sbd;
-	int error = 0;
-	struct gfs2_inum inum;
-
-	*ipp = NULL;
-
-	if (!len || len > GFS2_FNAMESIZE)
-		return -ENAMETOOLONG;
-	if (gfs2_filecmp(filename, (char *)".", 1)) {
-		*ipp = dip;
-		return 0;
-	}
-	error = dir_search(dip, filename, len, NULL, &inum);
-	if (error) {
-		if (error == -ENOENT)
-			return 0;
-	}
-	else
-		*ipp = gfs2_load_inode(sdp, inum.no_addr);
-
-	return error;
-}
-
-/**
- * gfs2_free_block - free up a block given its block number
- */
-void gfs2_free_block(struct gfs2_sbd *sdp, uint64_t block)
-{
-	struct gfs2_buffer_head *bh;
-	struct rgrp_list *rgd;
-
-	gfs2_set_bitmap(sdp, block, GFS2_BLKST_FREE);
-	/* Adjust the free space count for the freed block */
-	rgd = gfs2_blk2rgrpd(sdp, block); /* find the rg for indir block */
-	bh = bget(&sdp->nvbuf_list, rgd->ri.ri_addr); /* get the rg buffer */
-	rgd->rg.rg_free++; /* adjust the free count */
-	gfs2_rgrp_out(&rgd->rg, bh->b_data); /* back to the buffer */
-	brelse(bh, updated); /* release the buffer */
-}
-
-/**
- * gfs2_freedi - unlink a disk inode by block number.
- * Note: currently only works for regular files.
- */
-int gfs2_freedi(struct gfs2_sbd *sdp, uint64_t diblock)
-{
-	struct gfs2_inode *ip;
-	struct gfs2_buffer_head *bh, *nbh;
-	int h, head_size;
-	uint64_t *ptr, block;
-	struct rgrp_list *rgd;
-	uint32_t height;
-	osi_list_t metalist[GFS2_MAX_META_HEIGHT];
-	osi_list_t *cur_list, *next_list, *tmp;
-
-	for (h = 0; h < GFS2_MAX_META_HEIGHT; h++)
-		osi_list_init(&metalist[h]);
-
-	bh = bread(&sdp->buf_list, diblock);
-	ip = inode_get(sdp, bh);
-	height = ip->i_di.di_height;
-	osi_list_add(&bh->b_altlist, &metalist[0]);
-
-	for (h = 0; h < height; h++){
-		cur_list = &metalist[h];
-		next_list = &metalist[h + 1];
-		head_size = (h > 0 ? sizeof(struct gfs2_meta_header) :
-			     sizeof(struct gfs2_dinode));
-
-		for (tmp = cur_list->next; tmp != cur_list; tmp = tmp->next){
-			bh = osi_list_entry(tmp, struct gfs2_buffer_head,
-					    b_altlist);
-
-			for (ptr = (uint64_t *)(bh->b_data + head_size);
-			     (char *)ptr < (bh->b_data + sdp->bsize); ptr++) {
-				if (!*ptr)
-					continue;
-
-				block = be64_to_cpu(*ptr);
-				gfs2_free_block(sdp, block);
-				if (h == height - 1) /* if not metadata */
-					continue; /* don't queue it up */
-				/* Read the next metadata block in the chain.
-				   First see if it's on the nvbuf_list. */
-				nbh = bfind(&sdp->nvbuf_list, block);
-				if (!nbh)
-					nbh = bread(&sdp->buf_list, block);
-				osi_list_add(&nbh->b_altlist, next_list);
-				brelse(nbh, not_updated);
-			}
-		}
-	}
-	/* Set the bitmap type for inode to free space: */
-	gfs2_set_bitmap(sdp, ip->i_di.di_num.no_addr, GFS2_BLKST_FREE);
-	inode_put(ip, updated);
-	/* Now we have to adjust the rg freespace count and inode count: */
-	rgd = gfs2_blk2rgrpd(sdp, diblock);
-	/* The rg itself is in memory as rgd->rg, but there's most likely a  */
-	/* buffer in memory for the rg on disk because we used it to fix the */
-	/* bitmaps, some of which are on the same block on disk.             */
-	bh = bread(&sdp->nvbuf_list, rgd->ri.ri_addr); /* get the buffer */
-	rgd->rg.rg_free++;
-	rgd->rg.rg_dinodes--; /* one less inode in use */
-	gfs2_rgrp_out(&rgd->rg, bh->b_data);
-	brelse(bh, updated); /* release the buffer */
-	return 0;
-}
diff --git a/gfs2/libgfs2/gfs1.c b/gfs2/libgfs2/gfs1.c
deleted file mode 100644
index c518e5a..0000000
--- a/gfs2/libgfs2/gfs1.c
+++ /dev/null
@@ -1,395 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <string.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <linux/types.h>
-#include <linux/gfs2_ondisk.h>
-
-#include "osi_list.h"
-#include "libgfs2.h"
-
-/* GFS1 compatibility functions - so that programs like gfs2_convert
-   and gfs2_edit can examine/manipulate GFS1 file systems. */
-
-static __inline__ int fs_is_jdata(struct gfs2_inode *ip)
-{
-        return ip->i_di.di_flags & GFS2_DIF_JDATA;
-}
-
-static __inline__ uint64_t *
-gfs1_metapointer(struct gfs2_buffer_head *bh, unsigned int height,
-		 struct metapath *mp)
-{
-	unsigned int head_size = (height > 0) ?
-		sizeof(struct gfs_indirect) : sizeof(struct gfs_dinode);
-
-	return ((uint64_t *)(bh->b_data + head_size)) + mp->mp_list[height];
-}
-
-void gfs1_lookup_block(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
-		  unsigned int height, struct metapath *mp,
-		  int create, int *new, uint64_t *block)
-{
-	uint64_t *ptr = gfs1_metapointer(bh, height, mp);
-
-	if (*ptr) {
-		*block = be64_to_cpu(*ptr);
-		return;
-	}
-
-	*block = 0;
-
-	if (!create)
-		return;
-
-	if (height == ip->i_di.di_height - 1&&
-	    !(S_ISDIR(ip->i_di.di_mode)))
-		*block = data_alloc(ip);
-	else
-		*block = meta_alloc(ip);
-
-	*ptr = cpu_to_be64(*block);
-	ip->i_di.di_blocks++;
-
-	*new = 1;
-}
-
-void gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
-		    uint64_t *dblock, uint32_t *extlen, int prealloc)
-{
-	struct gfs2_sbd *sdp = ip->i_sbd;
-	struct gfs2_buffer_head *bh;
-	struct metapath *mp;
-	int create = *new;
-	unsigned int bsize;
-	unsigned int height;
-	unsigned int end_of_metadata;
-	unsigned int x;
-	enum update_flags f;
-
-	f = not_updated;
-	*new = 0;
-	*dblock = 0;
-	if (extlen)
-		*extlen = 0;
-
-	if (!ip->i_di.di_height) { /* stuffed */
-		if (!lblock) {
-			*dblock = ip->i_di.di_num.no_addr;
-			if (extlen)
-				*extlen = 1;
-		}
-		return;
-	}
-
-	bsize = (fs_is_jdata(ip)) ? sdp->sd_jbsize : sdp->bsize;
-
-	height = calc_tree_height(ip, (lblock + 1) * bsize);
-	if (ip->i_di.di_height < height) {
-		if (!create)
-			return;
-
-		build_height(ip, height);
-	}
-
-	mp = find_metapath(ip, lblock);
-	end_of_metadata = ip->i_di.di_height - 1;
-
-	bh = bhold(ip->i_bh);
-
-	for (x = 0; x < end_of_metadata; x++) {
-		gfs1_lookup_block(ip, bh, x, mp, create, new, dblock);
-		brelse(bh, f);
-		if (!*dblock)
-			goto out;
-
-		if (*new) {
-			struct gfs2_meta_header mh;
-
-			bh = bget(&sdp->buf_list, *dblock);
-			mh.mh_magic = GFS2_MAGIC;
-			mh.mh_type = GFS2_METATYPE_IN;
-			mh.mh_format = GFS2_FORMAT_IN;
-			gfs2_meta_header_out(&mh, bh->b_data);
-			f = updated;
-		} else {
-			bh = bread(&sdp->buf_list, *dblock);
-			f = not_updated;
-		}
-	}
-
-	if (!prealloc)
-		gfs1_lookup_block(ip, bh, end_of_metadata, mp, create, new,
-				  dblock);
-
-	if (extlen && *dblock) {
-		*extlen = 1;
-
-		if (!*new) {
-			uint64_t tmp_dblock;
-			int tmp_new;
-			unsigned int nptrs;
-
-			nptrs = (end_of_metadata) ? sdp->sd_inptrs : sdp->sd_diptrs;
-
-			while (++mp->mp_list[end_of_metadata] < nptrs) {
-				gfs1_lookup_block(ip, bh, end_of_metadata, mp,
-						  FALSE, &tmp_new,
-						  &tmp_dblock);
-
-				if (*dblock + *extlen != tmp_dblock)
-					break;
-
-				(*extlen)++;
-			}
-		}
-	}
-
-	brelse(bh, f);
-
- out:
-	free(mp);
-}
-
-int gfs1_readi(struct gfs2_inode *ip, void *buf,
-	       uint64_t offset, unsigned int size)
-{
-	struct gfs2_sbd *sdp = ip->i_sbd;
-	struct gfs2_buffer_head *bh;
-	uint64_t lblock, dblock = 0;
-	uint32_t extlen = 0;
-	unsigned int amount;
-	int not_new = 0;
-	int journaled = fs_is_jdata(ip);
-	int copied = 0;
-
-	if (offset >= ip->i_di.di_size)
-		return 0;
-
-	if ((offset + size) > ip->i_di.di_size)
-		size = ip->i_di.di_size - offset;
-
-	if (!size)
-		return 0;
-
-	if (journaled) {
-		lblock = offset / sdp->sd_jbsize;
-		offset %= sdp->sd_jbsize;
-	} else {
-		lblock = offset >> sdp->sd_sb.sb_bsize_shift;
-		offset &= sdp->sd_sb.sb_bsize - 1;
-	}
-
-	if (!ip->i_di.di_height) /* stuffed */
-		offset += sizeof(struct gfs_dinode);
-	else if (journaled)
-		offset += sizeof(struct gfs2_meta_header);
-
-	while (copied < size) {
-		amount = size - copied;
-		if (amount > sdp->bsize - offset)
-			amount = sdp->bsize - offset;
-
-		if (!extlen)
-			gfs1_block_map(ip, lblock, &not_new, &dblock,
-				       &extlen, FALSE);
-
-		if (dblock) {
-			bh = bread(&sdp->buf_list, dblock);
-			dblock++;
-			extlen--;
-		} else
-			bh = NULL;
-
-
-		if (bh) {
-			memcpy(buf+copied, bh->b_data + offset, amount);
-			brelse(bh, not_updated);
-		} else
-			memset(buf+copied, 0, amount);
-		copied += amount;
-		lblock++;
-
-		offset = (journaled) ? sizeof(struct gfs2_meta_header) : 0;
-	}
-
-	return copied;
-}
-
-/**
- * gfs1_rindex_read - read in the rg index file
- *                  Stolen from libgfs2/super.c, but modified to handle gfs1.
- * @sdp: the incore superblock pointer
- * fd: optional file handle for rindex file (if meta_fs file system is mounted)
- *     (if fd is <= zero, it will read from raw device)
- * @count1: return count of the rgs.
- *
- * Returns: 0 on success, -1 on failure
- */
-int gfs1_rindex_read(struct gfs2_sbd *sdp, int fd, int *count1)
-{
-	unsigned int rg;
-	int error;
-	struct gfs2_rindex buf;
-	struct rgrp_list *rgd, *prev_rgd;
-	uint64_t prev_length = 0;
-
-	*count1 = 0;
-	prev_rgd = NULL;
-	for (rg = 0; ; rg++) {
-		if (fd > 0)
-			error = read(fd, &buf, sizeof(struct gfs2_rindex));
-		else
-			error = gfs1_readi(sdp->md.riinode, (char *)&buf,
-					   (rg * sizeof(struct gfs2_rindex)),
-					   sizeof(struct gfs2_rindex));
-		if (!error)
-			break;
-		if (error != sizeof(struct gfs2_rindex))
-			return -1;
-
-		rgd = (struct rgrp_list *)malloc(sizeof(struct rgrp_list));
-		if (!rgd) {
-			log_crit("Cannot allocate memory for rindex.\n");
-			exit(-1);
-		}
-		memset(rgd, 0, sizeof(struct rgrp_list));
-		osi_list_add_prev(&rgd->list, &sdp->rglist);
-
-		gfs2_rindex_in(&rgd->ri, (char *)&buf);
-
-		rgd->start = rgd->ri.ri_addr;
-		if (prev_rgd) {
-			prev_length = rgd->start - prev_rgd->start;
-			prev_rgd->length = prev_length;
-		}
-
-		if(gfs2_compute_bitstructs(sdp, rgd))
-			return -1;
-
-		(*count1)++;
-		prev_rgd = rgd;
-	}
-	if (prev_rgd)
-		prev_rgd->length = prev_length;
-	return 0;
-}
-
-/**
- * gfs1_ri_update - attach rgrps to the super block
- *                  Stolen from libgfs2/super.c, but modified to handle gfs1.
- * @sdp:
- *
- * Given the rgrp index inode, link in all rgrps into the super block
- * and be sure that they can be read.
- *
- * Returns: 0 on success, -1 on failure.
- */
-int gfs1_ri_update(struct gfs2_sbd *sdp, int fd, int *rgcount)
-{
-	struct rgrp_list *rgd;
-	osi_list_t *tmp;
-	int count1 = 0, count2 = 0;
-	uint64_t errblock = 0;
-
-	if (gfs1_rindex_read(sdp, fd, &count1))
-	    goto fail;
-	for (tmp = sdp->rglist.next; tmp != &sdp->rglist; tmp = tmp->next) {
-		enum update_flags f;
-
-		f = not_updated;
-		rgd = osi_list_entry(tmp, struct rgrp_list, list);
-		errblock = gfs2_rgrp_read(sdp, rgd);
-		if (errblock)
-			return errblock;
-		count2++;
-		if (count2 % 100 == 0) {
-			printf(".");
-			fflush(stdout);
-		}
-	}
-
-	*rgcount = count1;
-	if (count1 != count2)
-		goto fail;
-
-	return 0;
-
- fail:
-	gfs2_rgrp_free(&sdp->rglist, not_updated);
-	return -1;
-}
-
-/* ------------------------------------------------------------------------ */
-/* gfs_dinode_in */
-/* ------------------------------------------------------------------------ */
-void gfs_dinode_in(struct gfs_dinode *di, char *buf)
-{
-	struct gfs_dinode *str = (struct gfs_dinode *)buf;
-
-	gfs2_meta_header_in(&di->di_header, buf);
-	gfs2_inum_in(&di->di_num, (char *)&str->di_num);
-
-	di->di_mode = be32_to_cpu(str->di_mode);
-	di->di_uid = be32_to_cpu(str->di_uid);
-	di->di_gid = be32_to_cpu(str->di_gid);
-	di->di_nlink = be32_to_cpu(str->di_nlink);
-	di->di_size = be64_to_cpu(str->di_size);
-	di->di_blocks = be64_to_cpu(str->di_blocks);
-	di->di_atime = be64_to_cpu(str->di_atime);
-	di->di_mtime = be64_to_cpu(str->di_mtime);
-	di->di_ctime = be64_to_cpu(str->di_ctime);
-	di->di_major = be32_to_cpu(str->di_major);
-	di->di_minor = be32_to_cpu(str->di_minor);
-	di->di_goal_dblk = be64_to_cpu(str->di_goal_dblk);
-	di->di_goal_mblk = be64_to_cpu(str->di_goal_mblk);
-	di->di_flags = be32_to_cpu(str->di_flags);
-	di->di_payload_format = be32_to_cpu(str->di_payload_format);
-	di->di_type = be16_to_cpu(str->di_type);
-	di->di_height = be16_to_cpu(str->di_height);
-	di->di_depth = be16_to_cpu(str->di_depth);
-	di->di_entries = be32_to_cpu(str->di_entries);
-	di->di_eattr = be64_to_cpu(str->di_eattr);
-}
-
-struct gfs2_inode *gfs_inode_get(struct gfs2_sbd *sdp,
-				 struct gfs2_buffer_head *bh)
-{
-	struct gfs_dinode gfs1_dinode;
-	struct gfs2_inode *ip;
-
-	zalloc(ip, sizeof(struct gfs2_inode));
-	gfs_dinode_in(&gfs1_dinode, bh->b_data);
-	memcpy(&ip->i_di.di_header, &gfs1_dinode.di_header,
-	       sizeof(struct gfs2_meta_header));
-	memcpy(&ip->i_di.di_num, &gfs1_dinode.di_num,
-	       sizeof(struct gfs2_inum));
-	ip->i_di.di_mode = gfs1_dinode.di_mode;
-	ip->i_di.di_uid = gfs1_dinode.di_uid;
-	ip->i_di.di_gid = gfs1_dinode.di_gid;
-	ip->i_di.di_nlink = gfs1_dinode.di_nlink;
-	ip->i_di.di_size = gfs1_dinode.di_size;
-	ip->i_di.di_blocks = gfs1_dinode.di_blocks;
-	ip->i_di.di_atime = gfs1_dinode.di_atime;
-	ip->i_di.di_mtime = gfs1_dinode.di_mtime;
-	ip->i_di.di_ctime = gfs1_dinode.di_ctime;
-	ip->i_di.di_major = gfs1_dinode.di_major;
-	ip->i_di.di_minor = gfs1_dinode.di_minor;
-	ip->i_di.di_goal_data = gfs1_dinode.di_goal_dblk;
-	ip->i_di.di_goal_meta = gfs1_dinode.di_goal_mblk;
-	ip->i_di.di_flags = gfs1_dinode.di_flags;
-	ip->i_di.di_payload_format = gfs1_dinode.di_payload_format;
-	ip->i_di.__pad1 = gfs1_dinode.di_type;
-	ip->i_di.di_height = gfs1_dinode.di_height;
-	ip->i_di.di_depth = gfs1_dinode.di_depth;
-	ip->i_di.di_entries = gfs1_dinode.di_entries;
-	ip->i_di.di_eattr = gfs1_dinode.di_eattr;
-	ip->i_bh = bh;
-	ip->i_sbd = sdp;
-	return ip;
-}
diff --git a/gfs2/libgfs2/gfs2_log.c b/gfs2/libgfs2/gfs2_log.c
deleted file mode 100644
index 06203fb..0000000
--- a/gfs2/libgfs2/gfs2_log.c
+++ /dev/null
@@ -1,203 +0,0 @@
-#include <stdio.h>
-#include <stdarg.h>
-#include <ctype.h>
-#include <libintl.h>
-#include <sys/select.h>
-#include <signal.h>
-#include <string.h>
-#include <termios.h>
-#include <unistd.h>
-
-#include "libgfs2.h"
-
-#define _(String) gettext(String)
-
-struct log_state {
-	int print_level;
-};
-static struct log_state _state = {MSG_NOTICE};
-
-void increase_verbosity(void)
-{
-	_state.print_level++;
-}
-
-void decrease_verbosity(void)
-{
-	_state.print_level--;
-}
-
-void print_msg(int priority, char *file, int line, const char *format,
-			   va_list args) {
-
-	switch (priority) {
-
-	case MSG_DEBUG:
-		printf("(%s:%d)\t", file, line);
-		vprintf(format, args);
-		fflush(NULL);
-		break;
-	case MSG_INFO:
-	case MSG_NOTICE:
-	case MSG_WARN:
-		vprintf(format, args);
-		fflush(NULL);
-		break;
-	case MSG_ERROR:
-	case MSG_CRITICAL:
-	default:
-		vfprintf(stderr, format, args);
-		break;
-	}
-	return;
-}
-
-
-void print_fsck_log(int iif, int priority, char *file, int line,
-					const char *format, ...)
-{
-
-	va_list args;
-	const char *transform;
-
-        va_start(args, format);
-
-	transform = _(format);
-
-	if((_state.print_level == priority) ||
-	   (!iif && (_state.print_level >= priority)))
-		print_msg(priority, file, line, transform, args);
-
-	va_end(args);
-}
-
-char gfs2_getch(void)
-{
-	struct termios termattr, savetermattr;
-	char ch;
-	ssize_t size;
-
-	tcgetattr (STDIN_FILENO, &termattr);
-	savetermattr = termattr;
-	termattr.c_lflag &= ~(ICANON | IEXTEN | ISIG);
-	termattr.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON);
-	termattr.c_cflag &= ~(CSIZE | PARENB);
-	termattr.c_cflag |= CS8;
-	termattr.c_oflag &= ~(OPOST);
-   	termattr.c_cc[VMIN] = 0;
-	termattr.c_cc[VTIME] = 0;
-
-	tcsetattr (STDIN_FILENO, TCSANOW, &termattr);
-	do {
-		size = read(STDIN_FILENO, &ch, 1);
-		if (size)
-			break;
-		usleep(50000);
-	} while (!size);
-
-	tcsetattr (STDIN_FILENO, TCSANOW, &savetermattr);
-	return ch;
-}
-
-char generic_interrupt(const char *caller, const char *where,
-		       const char *progress, const char *question,
-		       const char *answers)
-{
-	fd_set rfds;
-	struct timeval tv;
-	char response;
-	int err, i;
-
-	FD_ZERO(&rfds);
-	FD_SET(STDIN_FILENO, &rfds);
-
-	tv.tv_sec = 0;
-	tv.tv_usec = 0;
-	/* Make sure there isn't extraneous input before asking the
-	 * user the question */
-	while((err = select(STDIN_FILENO + 1, &rfds, NULL, NULL, &tv))) {
-		if(err < 0) {
-			log_debug("Error in select() on stdin\n");
-			break;
-		}
-		if(read(STDIN_FILENO, &response, sizeof(char)) < 0) {
-			log_debug("Error in read() on stdin\n");
-			break;
-		}
-	}
-	while (TRUE) {
-		printf("\n%s interrupted during %s:  ", caller, where);
-		if (progress)
-			printf("%s.\n", progress);
-		printf("%s", question);
-
-		/* Make sure query is printed out */
-		fflush(NULL);
-		response = gfs2_getch();
-		printf("\n");
-		fflush(NULL);
-		if (strchr(answers, response))
-			break;
-		printf("Bad response, please type ");
-		for (i = 0; i < strlen(answers) - 1; i++)
-			printf("'%c', ", answers[i]);
-		printf(" or '%c'.\n", answers[i]);
-	}
-	return response;
-}
-
-int gfs2_query(int *setonabort, struct gfs2_options *opts,
-	       const char *format, ...)
-{
-
-	va_list args;
-	const char *transform;
-	char response;
-	int ret = 0;
-
-	*setonabort = 0;
-	if(opts->yes)
-		return 1;
-	if(opts->no)
-		return 0;
-
-	opts->query = TRUE;
-	while (1) {
-		va_start(args, format);
-		transform = _(format);
-		vprintf(transform, args);
-		va_end(args);
-
-		/* Make sure query is printed out */
-		fflush(NULL);
-		response = gfs2_getch();
-
-		printf("\n");
-		fflush(NULL);
-		if (response == 0x3) { /* if interrupted, by ctrl-c */
-			response = generic_interrupt("Question", "response",
-						     NULL,
-						     "Do you want to abort " \
-						     "or continue (a/c)?",
-						     "ac");
-			if (response == 'a') {
-				ret = 0;
-				*setonabort = 1;
-				break;
-			}
-			printf("Continuing.\n");
-		} else if(tolower(response) == 'y') {
-                        ret = 1;
-                        break;
- 		} else if (tolower(response) == 'n') {
-			ret = 0;
-			break;
-		} else {
-			printf("Bad response %d, please type 'y' or 'n'.\n",
-			       response);
-		}
-	}
-
-	opts->query = FALSE;
-	return ret;
-}
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
deleted file mode 100644
index 7fe530c..0000000
--- a/gfs2/libgfs2/libgfs2.h
+++ /dev/null
@@ -1,717 +0,0 @@
-#ifndef __LIBGFS2_DOT_H__
-#define __LIBGFS2_DOT_H__
-
-#include <inttypes.h>
-#include <sys/types.h>
-#include <linux/types.h>
-#include <linux/limits.h>
-
-#include "linux_endian.h"
-#include <linux/gfs2_ondisk.h>
-#include "osi_list.h"
-#include "copyright.cf"
-#include "ondisk.h"
-
-#ifndef TRUE
-#define TRUE (1)
-#endif
-
-#ifndef FALSE
-#define FALSE (0)
-#endif
-
-#define die(fmt, args...) \
-do { \
-	fprintf(stderr, "%s: ", prog_name); \
-	fprintf(stderr, fmt, ##args); \
-	exit(EXIT_FAILURE); \
-} while (0)
-
-#define do_lseek(fd, off) \
-{ \
-  if (lseek((fd), (off), SEEK_SET) != (off)) \
-    die("bad seek: %s on line %d of file %s\n", \
-	strerror(errno),__LINE__, __FILE__); \
-}
-
-#define do_read(fd, buff, len) \
-{ \
-  if (read((fd), (buff), (len)) < 0) \
-    die("bad read: %s on line %d of file %s\n", \
-	strerror(errno), __LINE__, __FILE__); \
-}
-
-#define do_write(fd, buff, len) \
-{ \
-  if (write((fd), (buff), (len)) != (len)) \
-    die("bad write: %s on line %d of file %s\n", \
-	strerror(errno), __LINE__, __FILE__); \
-}
-
-#define zalloc(ptr, size) \
-do { \
-	(ptr) = malloc((size)); \
-	if ((ptr)) \
-		memset((ptr), 0, (size)); \
-	else \
-		die("unable to allocate memory on line %d of file %s\n", \
-		    __LINE__, __FILE__); \
-} while (0)
-
-#define DIV_RU(x, y) (((x) + (y) - 1) / (y))
-
-static __inline__ uint64_t do_div_i(uint64_t *num, unsigned int den)
-{
-	unsigned int m = *num % den;
-	*num /= den;
-	return m;
-}
-#define do_div(n, d) do_div_i(&(n), (d))
-
-#define SRANDOM do { srandom(time(NULL) ^ getpid()); } while (0)
-#define RANDOM(values) ((values) * (random() / (RAND_MAX + 1.0)))
-
-struct device {
-	uint64_t start;
-	uint64_t length;
-	uint32_t rgf_flags;
-};
-
-struct gfs2_bitmap
-{
-	uint32_t   bi_offset;  /* The offset in the buffer of the first byte */
-	uint32_t   bi_start;   /* The position of the first byte in this block */
-	uint32_t   bi_len;     /* The number of bytes in this block */
-};
-typedef struct gfs2_bitmap gfs2_bitmap_t;
-
-struct rgrp_list {
-	osi_list_t list;
-	uint64_t start;	   /* The offset of the beginning of this resource group */
-	uint64_t length;	/* The length of this resource group */
-	uint32_t rgf_flags;
-
-	struct gfs2_rindex ri;
-	struct gfs2_rgrp rg;
-	gfs2_bitmap_t *bits;
-	struct gfs2_buffer_head **bh;
-};
-
-struct gfs2_buffer_head {
-	osi_list_t b_list;
-	osi_list_t b_hash;
-	osi_list_t b_altlist; /* alternate list */
-
-	unsigned int b_count;
-	uint64_t b_blocknr;
-	char *b_data;
-
-	int b_changed;
-};
-
-struct special_blocks {
-	osi_list_t list;
-	uint64_t block;
-};
-
-struct gfs2_sbd;
-struct gfs2_inode {
-	struct gfs2_dinode i_di;
-	struct gfs2_buffer_head *i_bh;
-	struct gfs2_sbd *i_sbd;
-};
-
-#define BUF_HASH_SHIFT       (13)    /* # hash buckets = 8K */
-#define BUF_HASH_SIZE        (1 << BUF_HASH_SHIFT)
-#define BUF_HASH_MASK        (BUF_HASH_SIZE - 1)
-
-/* FIXME not sure that i want to keep a record of the inodes or the
- * contents of them, or both ... if I need to write back to them, it
- * would be easier to hold the inode as well  */
-struct per_node
-{
-	struct gfs2_inode *inum;
-	struct gfs2_inum_range inum_range;
-	struct gfs2_inode *statfs;
-	struct gfs2_statfs_change statfs_change;
-	struct gfs2_inode *unlinked;
-	struct gfs2_inode *quota;
-	struct gfs2_quota_change quota_change;
-};
-
-struct master_dir
-{
-	struct gfs2_inode *inum;
-	uint64_t next_inum;
-	struct gfs2_inode *statfs;
-	struct gfs2_statfs_change statfs_change;
-
-	struct gfs2_rindex rindex;
-	struct gfs2_inode *qinode;
-	struct gfs2_quota quotas;
-
-	struct gfs2_inode       *jiinode;
-	struct gfs2_inode       *riinode;
-	struct gfs2_inode       *rooti;
-	struct gfs2_inode       *pinode;
-	
-	struct gfs2_inode **journal;      /* Array of journals */
-	uint32_t journals;                /* Journal count */
-	struct per_node *pn;              /* Array of per_node entries */
-};
-
-struct buf_list {
-	unsigned int num_bufs;
-	unsigned int spills;
-	uint32_t limit;
-	osi_list_t list;
-	struct gfs2_sbd *sbp;
-	osi_list_t buf_hash[BUF_HASH_SIZE];
-};
-
-struct gfs2_sbd {
-	struct gfs2_sb sd_sb;    /* a copy of the ondisk structure */
-	char lockproto[GFS2_LOCKNAME_LEN];
-	char locktable[GFS2_LOCKNAME_LEN];
-
-	unsigned int bsize;	     /* The block size of the FS (in bytes) */
-	unsigned int jsize;	     /* Size of journals (in MB) */
-	unsigned int rgsize;     /* Size of resource groups (in MB) */
-	unsigned int utsize;     /* Size of unlinked tag files (in MB) */
-	unsigned int qcsize;     /* Size of quota change files (in MB) */
-
-	int debug;
-	int quiet;
-	int expert;
-	int override;
-
-	char device_name[PATH_MAX];
-	char *path_name;
-
-	/* Constants */
-
-	uint32_t sd_fsb2bb;
-	uint32_t sd_fsb2bb_shift;
-	uint32_t sd_diptrs;
-	uint32_t sd_inptrs;
-	uint32_t sd_jbsize;
-	uint32_t sd_hash_bsize;
-	uint32_t sd_hash_bsize_shift;
-	uint32_t sd_hash_ptrs;
-	uint32_t sd_max_dirres;
-	uint32_t sd_max_height;
-	uint64_t sd_heightsize[GFS2_MAX_META_HEIGHT];
-	uint32_t sd_max_jheight;
-	uint64_t sd_jheightsize[GFS2_MAX_META_HEIGHT];
-
-	/* Not specified on the command line, but... */
-
-	int64_t time;
-
-	struct device device;
-	uint64_t device_size;
-
-	int device_fd;
-	int path_fd;
-
-	uint64_t sb_addr;
-
-	uint64_t orig_fssize;
-	uint64_t fssize;
-	uint64_t blks_total;
-	uint64_t blks_alloced;
-	uint64_t dinodes_alloced;
-
-	uint64_t orig_rgrps;
-	uint64_t rgrps;
-	uint64_t new_rgrps;
-	osi_list_t rglist;
-
-	unsigned int orig_journals;
-
-	struct buf_list buf_list;   /* transient buffer list */
-	struct buf_list nvbuf_list; /* non-volatile buffer list */
-
-	struct gfs2_inode *master_dir;
-	struct master_dir md;
-
-	unsigned int writes;
-	int metafs_fd;
-	char metafs_path[PATH_MAX]; /* where metafs is mounted */
-	struct special_blocks bad_blocks;
-	struct special_blocks dup_blocks;
-	struct special_blocks eattr_blocks;
-};
-
-struct metapath {
-	unsigned int mp_list[GFS2_MAX_META_HEIGHT];
-};
-
-extern char *prog_name;
-
-#define GFS2_DEFAULT_BSIZE          (4096)
-#define GFS2_DEFAULT_JSIZE          (128)
-#define GFS2_DEFAULT_RGSIZE         (256)
-#define GFS2_DEFAULT_UTSIZE         (1)
-#define GFS2_DEFAULT_QCSIZE         (1)
-#define GFS2_DEFAULT_LOCKPROTO      "lock_dlm"
-#define GFS2_MIN_GROW_SIZE          (10)
-#define GFS2_EXCESSIVE_RGS          (10000)
-
-#define DATA (1)
-#define META (2)
-#define DINODE (3)
-
-#define NOT_UPDATED (0)
-#define UPDATED (1)
-
-/* A bit of explanation is in order: */
-/* updated flag means the buffer was updated from THIS function before */
-/*         brelse was called. */
-/* not_updated flag means the buffer may or may not have been updated  */
-/*         by a function called within this one, but it wasn't updated */
-/*         by this function. */
-enum update_flags {
-	not_updated = NOT_UPDATED,
-	updated = UPDATED
-};
-
-/* bitmap.c */
-struct gfs2_bmap {
-        uint64_t size;
-        uint64_t mapsize;
-        int chunksize;
-        int chunks_per_byte;
-        char *map;
-};
-
-int gfs2_bitmap_create(struct gfs2_bmap *bmap, uint64_t size, uint8_t bitsize);
-int gfs2_bitmap_set(struct gfs2_bmap *bmap, uint64_t offset, uint8_t val);
-int gfs2_bitmap_get(struct gfs2_bmap *bmap, uint64_t bit, uint8_t *val);
-int gfs2_bitmap_clear(struct gfs2_bmap *bmap, uint64_t offset);
-void gfs2_bitmap_destroy(struct gfs2_bmap *bmap);
-uint64_t gfs2_bitmap_size(struct gfs2_bmap *bmap);
-
-/* block_list.c */
-#define FREE	        (0x0)  /*   0000 */
-#define BLOCK_IN_USE    (0x1)  /*   0001 */
-#define DIR_INDIR_BLK   (0x2)  /*   0010 */
-#define DIR_INODE       (0x3)  /*   0011 */
-#define FILE_INODE      (0x4)  /*   0100 */
-#define LNK_INODE       (0x5)
-#define BLK_INODE       (0x6)
-#define CHR_INODE       (0x7)
-#define FIFO_INODE      (0x8)
-#define SOCK_INODE      (0x9)
-#define DIR_LEAF_INODE  (0xA)  /*   1010 */
-#define JOURNAL_BLK     (0xB)  /*   1011 */
-#define OTHER_META      (0xC)  /*   1100 */
-#define EATTR_META      (0xD)  /*   1101 */
-#define UNUSED1         (0xE)  /*   1110 */
-#define INVALID_META    (0xF)  /*   1111 */
-
-/* Must be kept in sync with mark_to_bitmap array in block_list.c */
-enum gfs2_mark_block {
-	gfs2_block_free = FREE,
-	gfs2_block_used = BLOCK_IN_USE,
-	gfs2_indir_blk = DIR_INDIR_BLK,
-	gfs2_inode_dir = DIR_INODE,
-	gfs2_inode_file = FILE_INODE,
-	gfs2_inode_lnk = LNK_INODE,
-	gfs2_inode_blk = BLK_INODE,
-	gfs2_inode_chr = CHR_INODE,
-	gfs2_inode_fifo = FIFO_INODE,
-	gfs2_inode_sock = SOCK_INODE,
-	gfs2_leaf_blk = DIR_LEAF_INODE,
-	gfs2_journal_blk = JOURNAL_BLK,
-	gfs2_meta_other = OTHER_META,
-	gfs2_meta_eattr = EATTR_META,
-	gfs2_meta_unused = UNUSED1,
-	gfs2_meta_inval = INVALID_META,
-	gfs2_bad_block,      /* Contains at least one bad block */
-	gfs2_dup_block,      /* Contains at least one duplicate block */
-	gfs2_eattr_block,    /* Contains an eattr */
-};
-
-struct gfs2_block_query {
-        uint8_t block_type;
-        uint8_t bad_block;
-        uint8_t dup_block;
-        uint8_t eattr_block;
-};
-
-struct gfs2_gbmap {
-        struct gfs2_bmap group_map;
-        struct gfs2_bmap bad_map;
-        struct gfs2_bmap dup_map;
-        struct gfs2_bmap eattr_map;
-};
-
-union gfs2_block_lists {
-        struct gfs2_gbmap gbmap;
-};
-
-/* bitmap implementation */
-struct gfs2_block_list {
-        union gfs2_block_lists list;
-};
-
-struct gfs2_block_list *gfs2_block_list_create(struct gfs2_sbd *sdp,
-					       uint64_t size,
-					       uint64_t *addl_mem_needed);
-struct special_blocks *blockfind(struct special_blocks *blist, uint64_t num);
-void gfs2_special_set(struct special_blocks *blocklist, uint64_t block);
-void gfs2_special_clear(struct special_blocks *blocklist, uint64_t block);
-void gfs2_special_free(struct special_blocks *blist);
-int gfs2_block_mark(struct gfs2_sbd *sdp, struct gfs2_block_list *il,
-		    uint64_t block, enum gfs2_mark_block mark);
-int gfs2_block_set(struct gfs2_sbd *sdp, struct gfs2_block_list *il,
-		   uint64_t block, enum gfs2_mark_block mark);
-int gfs2_block_clear(struct gfs2_sbd *sdp, struct gfs2_block_list *il,
-		     uint64_t block, enum gfs2_mark_block m);
-int gfs2_block_check(struct gfs2_sbd *sdp, struct gfs2_block_list *il,
-		     uint64_t block, struct gfs2_block_query *val);
-void *gfs2_block_list_destroy(struct gfs2_sbd *sdp,
-			      struct gfs2_block_list *il);
-
-/* buf.c */
-void init_buf_list(struct gfs2_sbd *sdp, struct buf_list *bl, uint32_t limit);
-struct gfs2_buffer_head *bfind(struct buf_list *bl, uint64_t num);
-struct gfs2_buffer_head *bget_generic(struct buf_list *bl, uint64_t num,
-				      int find_existing, int read_disk);
-struct gfs2_buffer_head *bget(struct buf_list *bl, uint64_t num);
-struct gfs2_buffer_head *bread(struct buf_list *bl, uint64_t num);
-struct gfs2_buffer_head *bget_zero(struct buf_list *bl, uint64_t num);
-struct gfs2_buffer_head *bhold(struct gfs2_buffer_head *bh);
-void brelse(struct gfs2_buffer_head *bh, enum update_flags updated);
-void bsync(struct buf_list *bl);
-void bcommit(struct buf_list *bl);
-void bcheck(struct buf_list *bl);
-
-/* device_geometry.c */
-void device_geometry(struct gfs2_sbd *sdp);
-void fix_device_geometry(struct gfs2_sbd *sdp);
-
-/* fs_bits.c */
-#define BFITNOENT (0xFFFFFFFF)
-
-/* functions with blk #'s that are buffer relative */
-uint32_t gfs2_bitcount(unsigned char *buffer, unsigned int buflen,
-                     unsigned char state);
-uint32_t gfs2_bitfit(unsigned char *buffer, unsigned int buflen,
-		     uint32_t goal, unsigned char old_state);
-
-/* functions with blk #'s that are rgrp relative */
-uint32_t gfs2_blkalloc_internal(struct rgrp_list *rgd, uint32_t goal,
-				unsigned char old_state,
-				unsigned char new_state, int do_it);
-int gfs2_check_range(struct gfs2_sbd *sdp, uint64_t blkno);
-
-/* functions with blk #'s that are file system relative */
-int gfs2_get_bitmap(struct gfs2_sbd *sdp, uint64_t blkno,
-                                        struct rgrp_list *rgd);
-int gfs2_set_bitmap(struct gfs2_sbd *sdp, uint64_t blkno, int state);
-
-/* fs_geometry.c */
-void rgblocks2bitblocks(unsigned int bsize, uint32_t *rgblocks,
-			uint32_t *bitblocks);
-uint64_t how_many_rgrps(struct gfs2_sbd *sdp, struct device *dev,
-			int rgsize_specified);
-void compute_rgrp_layout(struct gfs2_sbd *sdp, int rgsize_specified);
-void build_rgrps(struct gfs2_sbd *sdp, int write);
-
-/* fs_ops.c */
-#define IS_LEAF     (1)
-#define IS_DINODE   (2)
-
-static __inline__ uint64_t *
-metapointer(struct gfs2_buffer_head *bh, unsigned int height,
-	    struct metapath *mp)
-{
-	unsigned int head_size = (height > 0) ?
-		sizeof(struct gfs2_meta_header) : sizeof(struct gfs2_dinode);
-
-	return ((uint64_t *)(bh->b_data + head_size)) + mp->mp_list[height];
-}
-
-struct metapath *find_metapath(struct gfs2_inode *ip, uint64_t block);
-struct gfs2_inode *inode_get(struct gfs2_sbd *sdp,
-			     struct gfs2_buffer_head *bh);
-void inode_put(struct gfs2_inode *ip, enum update_flags updated);
-uint64_t data_alloc(struct gfs2_inode *ip);
-uint64_t meta_alloc(struct gfs2_inode *ip);
-uint64_t dinode_alloc(struct gfs2_sbd *sdp);
-int gfs2_readi(struct gfs2_inode *ip, void *buf,
-			   uint64_t offset, unsigned int size);
-int gfs2_writei(struct gfs2_inode *ip, void *buf,
-				uint64_t offset, unsigned int size);
-struct gfs2_buffer_head *get_file_buf(struct gfs2_inode *ip, uint64_t lbn,
-				      int prealloc);
-struct gfs2_buffer_head *init_dinode(struct gfs2_sbd *sdp,
-				     struct gfs2_inum *inum,
-				     unsigned int mode, uint32_t flags,
-				     struct gfs2_inum *parent);
-struct gfs2_inode *createi(struct gfs2_inode *dip, char *filename,
-			   unsigned int mode, uint32_t flags);
-void dirent2_del(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
-		 struct gfs2_dirent *prev, struct gfs2_dirent *cur);
-struct gfs2_inode *gfs2_load_inode(struct gfs2_sbd *sbp, uint64_t block);
-int gfs2_lookupi(struct gfs2_inode *dip, const char *filename, int len,
-		 struct gfs2_inode **ipp);
-void dir_add(struct gfs2_inode *dip, char *filename, int len,
-			 struct gfs2_inum *inum, unsigned int type);
-int gfs2_dirent_del(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
-		    const char *filename, int filename_len);
-void block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
-	       uint64_t *dblock, uint32_t *extlen, int prealloc,
-	       enum update_flags if_changed);
-void gfs2_get_leaf_nr(struct gfs2_inode *dip, uint32_t index,
-					  uint64_t *leaf_out);
-void gfs2_put_leaf_nr(struct gfs2_inode *dip, uint32_t inx, uint64_t leaf_out);
-void gfs2_free_block(struct gfs2_sbd *sdp, uint64_t block);
-int gfs2_freedi(struct gfs2_sbd *sdp, uint64_t block);
-int gfs2_get_leaf(struct gfs2_inode *dip, uint64_t leaf_no,
-				  struct gfs2_buffer_head **bhp);
-int gfs2_dirent_first(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
-					  struct gfs2_dirent **dent);
-int gfs2_dirent_next(struct gfs2_inode *dip, struct gfs2_buffer_head *bh,
-					 struct gfs2_dirent **dent);
-void build_height(struct gfs2_inode *ip, int height);
-unsigned int calc_tree_height(struct gfs2_inode *ip, uint64_t size);
-void write_journal(struct gfs2_sbd *sdp, struct gfs2_inode *ip, unsigned int j,
-				   unsigned int blocks);
-
-/**
- * device_size - figure out a device's size
- * @fd: the file descriptor of a device
- * @bytes: the number of bytes the device holds
- *
- * Returns: -1 on error (with errno set), 0 on success (with @bytes set)
- */
-
-int device_size(int fd, uint64_t *bytes);
-
-/* gfs1.c - GFS1 backward compatibility functions */
-struct gfs_indirect {
-	struct gfs2_meta_header in_header;
-
-	char in_reserved[64];
-};
-
-struct gfs_dinode {
-	struct gfs2_meta_header di_header;
-
-	struct gfs2_inum di_num; /* formal inode # and block address */
-
-	uint32_t di_mode;	/* mode of file */
-	uint32_t di_uid;	/* owner's user id */
-	uint32_t di_gid;	/* owner's group id */
-	uint32_t di_nlink;	/* number (qty) of links to this file */
-	uint64_t di_size;	/* number (qty) of bytes in file */
-	uint64_t di_blocks;	/* number (qty) of blocks in file */
-	int64_t di_atime;	/* time last accessed */
-	int64_t di_mtime;	/* time last modified */
-	int64_t di_ctime;	/* time last changed */
-
-	/*  Non-zero only for character or block device nodes  */
-	uint32_t di_major;	/* device major number */
-	uint32_t di_minor;	/* device minor number */
-
-	/*  Block allocation strategy  */
-	uint64_t di_rgrp;	/* dinode rgrp block number */
-	uint64_t di_goal_rgrp;	/* rgrp to alloc from next */
-	uint32_t di_goal_dblk;	/* data block goal */
-	uint32_t di_goal_mblk;	/* metadata block goal */
-
-	uint32_t di_flags;	/* GFS_DIF_... */
-
-	/*  struct gfs_rindex, struct gfs_jindex, or struct gfs_dirent */
-	uint32_t di_payload_format;  /* GFS_FORMAT_... */
-	uint16_t di_type;	/* GFS_FILE_... type of file */
-	uint16_t di_height;	/* height of metadata (0 == stuffed) */
-	uint32_t di_incarn;	/* incarnation (unused, see gfs_meta_header) */
-	uint16_t di_pad;
-
-	/*  These only apply to directories  */
-	uint16_t di_depth;	/* Number of bits in the table */
-	uint32_t di_entries;	/* The # (qty) of entries in the directory */
-
-	/*  This formed an on-disk chain of unused dinodes  */
-	struct gfs2_inum di_next_unused;  /* used in old versions only */
-
-	uint64_t di_eattr;	/* extended attribute block number */
-
-	char di_reserved[56];
-};
-
-void gfs1_lookup_block(struct gfs2_inode *ip, struct gfs2_buffer_head *bh,
-		  unsigned int height, struct metapath *mp,
-		       int create, int *new, uint64_t *block);
-void gfs1_block_map(struct gfs2_inode *ip, uint64_t lblock, int *new,
-		    uint64_t *dblock, uint32_t *extlen, int prealloc);
-int gfs1_readi(struct gfs2_inode *ip, void *buf, uint64_t offset,
-	       unsigned int size);
-int gfs1_rindex_read(struct gfs2_sbd *sdp, int fd, int *count1);
-int gfs1_ri_update(struct gfs2_sbd *sdp, int fd, int *rgcount);
-struct gfs2_inode *gfs_inode_get(struct gfs2_sbd *sdp,
-				 struct gfs2_buffer_head *bh);
-
-/* locking.c */
-void test_locking(char *lockproto, char *locktable);
-
-/* gfs2_log.c */
-struct gfs2_options {
-	char *device;
-	int yes:1;
-	int no:1;
-	int query:1;
-};
-
-#define MSG_DEBUG       7
-#define MSG_INFO        6
-#define MSG_NOTICE      5
-#define MSG_WARN        4
-#define MSG_ERROR       3
-#define MSG_CRITICAL    2
-#define MSG_NULL        1
-
-#define print_log(iif, priority, format...)     \
-do { print_fsck_log(iif, priority, __FILE__, __LINE__, ## format); } while(0)
-
-#define log_debug(format...) \
-do { print_log(0, MSG_DEBUG, format); } while(0)
-#define log_info(format...) \
-do { print_log(0, MSG_INFO, format); } while(0)
-
-#define log_notice(format...) \
-do { print_log(0, MSG_NOTICE, format); } while(0)
-
-#define log_warn(format...) \
-do { print_log(0, MSG_WARN, format); } while(0)
-
-#define log_err(format...) \
-do { print_log(0, MSG_ERROR, format); } while(0)
-
-#define log_crit(format...) \
-do { print_log(0, MSG_CRITICAL, format); } while(0)
-
-#define stack log_debug("<backtrace> - %s()\n", __func__)
-
-#define log_at_debug(format...)         \
-do { print_log(1, MSG_DEBUG, format); } while(0)
-
-#define log_at_info(format...) \
-do { print_log(1, MSG_INFO, format); } while(0)
-
-#define log_at_notice(format...) \
-do { print_log(1, MSG_NOTICE, format); } while(0)
-
-#define log_at_warn(format...) \
-do { print_log(1, MSG_WARN, format); } while(0)
-
-#define log_at_err(format...) \
-do { print_log(1, MSG_ERROR, format); } while(0)
-
-#define log_at_crit(format...) \
-do { print_log(1, MSG_CRITICAL, format); } while(0)
-
-void increase_verbosity(void);
-void decrease_verbosity(void);
-void print_fsck_log(int iif, int priority, char *file, int line,
-					const char *format, ...);
-char gfs2_getch(void);
-
-char generic_interrupt(const char *caller, const char *where,
-		       const char *progress, const char *question,
-		       const char *answers);
-int gfs2_query(int *setonabort, struct gfs2_options *opts,
-	       const char *format, ...);
-
-/* misc.c */
-#define SYS_BASE "/sys/fs/gfs2"
-
-uint32_t compute_heightsize(struct gfs2_sbd *sdp, uint64_t *heightsize,
-			    uint32_t bsize1, int diptrs, int inptrs);
-void compute_constants(struct gfs2_sbd *sdp);
-int find_gfs2_meta(struct gfs2_sbd *sdp);
-int dir_exists(const char *dir);
-void check_for_gfs2(struct gfs2_sbd *sdp);
-void mount_gfs2_meta(struct gfs2_sbd *sdp);
-void cleanup_metafs(struct gfs2_sbd *sdp);
-char *get_list(void);
-char **str2lines(char *str);
-char *find_debugfs_mount(void);
-char *mp2fsname(char *mp);
-char *name2value(char *str, char *name);
-uint32_t name2u32(char *str, char *name);
-uint64_t name2u64(char *str, char *name);
-char *__get_sysfs(char *fsname, char *filename);
-char *get_sysfs(char *fsname, char *filename);
-unsigned int get_sysfs_uint(char *fsname, char *filename);
-void set_sysfs(char *fsname, char *filename, char *val);
-char *do_basename(char *device);
-char *mp2devname(char *mp);
-int is_fsname(char *name);
-
-/* recovery.c */
-void gfs2_replay_incr_blk(struct gfs2_inode *ip, unsigned int *blk);
-int gfs2_replay_read_block(struct gfs2_inode *ip, unsigned int blk,
-			   struct gfs2_buffer_head **bh);
-int gfs2_revoke_add(struct gfs2_sbd *sdp, uint64_t blkno, unsigned int where);
-int gfs2_revoke_check(struct gfs2_sbd *sdp, uint64_t blkno,
-		      unsigned int where);
-void gfs2_revoke_clean(struct gfs2_sbd *sdp);
-int get_log_header(struct gfs2_inode *ip, unsigned int blk,
-		   struct gfs2_log_header *head);
-int find_good_lh(struct gfs2_inode *ip, unsigned int *blk,
-		 struct gfs2_log_header *head);
-int jhead_scan(struct gfs2_inode *ip, struct gfs2_log_header *head);
-int gfs2_find_jhead(struct gfs2_inode *ip, struct gfs2_log_header *head);
-int clean_journal(struct gfs2_inode *ip, struct gfs2_log_header *head);
-
-/* rgrp.c */
-int gfs2_compute_bitstructs(struct gfs2_sbd *sdp, struct rgrp_list *rgd);
-struct rgrp_list *gfs2_blk2rgrpd(struct gfs2_sbd *sdp, uint64_t blk);
-uint64_t gfs2_rgrp_read(struct gfs2_sbd *sdp, struct rgrp_list *rgd);
-void gfs2_rgrp_relse(struct rgrp_list *rgd, enum update_flags updated);
-void gfs2_rgrp_free(osi_list_t *rglist, enum update_flags updated);
-
-/* structures.c */
-void build_master(struct gfs2_sbd *sdp);
-void build_sb(struct gfs2_sbd *sdp);
-void build_jindex(struct gfs2_sbd *sdp);
-void build_per_node(struct gfs2_sbd *sdp);
-void build_inum(struct gfs2_sbd *sdp);
-void build_statfs(struct gfs2_sbd *sdp);
-void build_rindex(struct gfs2_sbd *sdp);
-void build_quota(struct gfs2_sbd *sdp);
-void build_root(struct gfs2_sbd *sdp);
-void do_init(struct gfs2_sbd *sdp);
-int gfs2_check_meta(struct gfs2_buffer_head *bh, int type);
-int gfs2_set_meta(struct gfs2_buffer_head *bh, int type, int format);
-int gfs2_next_rg_meta(struct rgrp_list *rgd, uint64_t *block, int first);
-int gfs2_next_rg_meta_free(struct rgrp_list *rgd, uint64_t *block, int first,
-						   int *mfree);
-int gfs2_next_rg_metatype(struct gfs2_sbd *sdp, struct rgrp_list *rgd,
-						  uint64_t *block, uint32_t type, int first);
-/* super.c */
-int check_sb(struct gfs2_sb *sb);
-int read_sb(struct gfs2_sbd *sdp);
-int ji_update(struct gfs2_sbd *sdp);
-int rindex_read(struct gfs2_sbd *sdp, int fd, int *count1);
-int ri_update(struct gfs2_sbd *sdp, int fd, int *rgcount);
-int write_sb(struct gfs2_sbd *sdp);
-
-/* ondisk.c */
-uint32_t gfs2_disk_hash(const char *data, int len);
-
-extern void print_it(const char *label, const char *fmt,
-					 const char *fmt2, ...);
-#define pv(struct, member, fmt, fmt2) do {				   \
-		print_it("  "#member, fmt, fmt2, struct->member); \
-        } while (FALSE);
-#define pv2(struct, member, fmt, fmt2) do {		 \
-		print_it("  ", fmt, fmt2, struct->member);	\
-        } while (FALSE);
-
-#endif /* __LIBGFS2_DOT_H__ */
diff --git a/gfs2/libgfs2/locking.c b/gfs2/libgfs2/locking.c
deleted file mode 100644
index 6e1fa5a..0000000
--- a/gfs2/libgfs2/locking.c
+++ /dev/null
@@ -1,57 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <ctype.h>
-
-#include <linux/types.h>
-#include "libgfs2.h"
-
-/**
- * test_locking - Make sure the GFS2 is set up to use the right lock protocol
- * @lockproto: the lock protocol to mount
- * @locktable: the locktable name
- *
- */
-
-void
-test_locking(char *lockproto, char *locktable)
-{
-	char *c;
-
-	if (strcmp(lockproto, "lock_nolock") == 0) {
-		/*  Nolock is always ok.  */
-	} else if (strcmp(lockproto, "lock_gulm") == 0 ||
-		   strcmp(lockproto, "lock_dlm") == 0) {
-		for (c = locktable; *c; c++) {
-			if (isspace(*c))
-				die("locktable error: contains space characters\n");
-			if (!isprint(*c))
-				die("locktable error: contains unprintable characters\n");
-		}
-
-		c = strstr(locktable, ":");
-		if (!c)
-			die("locktable error: missing colon in the locktable\n");
-
-		if (c == locktable)
-			die("locktable error: missing cluster name\n");
-		if (c - locktable > 16)
-			die("locktable error: cluster name too long\n");
-
-		c++;
-		if (!c)
-			die("locktable error: missing filesystem name\n");
-
-		if (strstr(c, ":"))
-			die("locktable error: more than one colon present\n");
-
-		if (!strlen(c))
-			die("locktable error: missing filesystem name\n");
-		if (strlen(c) > 16)
-			die("locktable error: filesystem name too long\n");
-	} else {
-		die("lockproto error: %s unknown\n", lockproto);
-	}
-}
diff --git a/gfs2/libgfs2/misc.c b/gfs2/libgfs2/misc.c
deleted file mode 100644
index 61ea65b..0000000
--- a/gfs2/libgfs2/misc.c
+++ /dev/null
@@ -1,636 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <time.h>
-#include <errno.h>
-#include <sys/mount.h>
-#include <linux/types.h>
-#include <sys/file.h>
-#include <dirent.h>
-#include <linux/kdev_t.h>
-#include <sys/sysmacros.h>
-
-#include "libgfs2.h"
-
-#define PAGE_SIZE (4096)
-
-static char sysfs_buf[PAGE_SIZE];
-
-uint32_t compute_heightsize(struct gfs2_sbd *sdp, uint64_t *heightsize,
-			    uint32_t bsize1, int diptrs, int inptrs)
-{
-	int x;
-
-	heightsize[0] = sdp->bsize - sizeof(struct gfs2_dinode);
-	heightsize[1] = bsize1 * diptrs;
-	for (x = 2;; x++) {
-		uint64_t space, d;
-		uint32_t m;
-
-		space = heightsize[x - 1] * inptrs;
-		d = space;
-		m = do_div(d, inptrs);
-
-		if (d != heightsize[x - 1] || m)
-			break;
-		heightsize[x] = space;
-	}
-	if (x > GFS2_MAX_META_HEIGHT)
-		die("bad constants (1)\n");
-	return x;
-}
-
-void
-compute_constants(struct gfs2_sbd *sdp)
-{
-	uint32_t hash_blocks, ind_blocks, leaf_blocks;
-	uint32_t tmp_blocks;
-
-	sdp->md.next_inum = 1;
-
-	sdp->sd_sb.sb_bsize_shift = ffs(sdp->bsize) - 1;
-	sdp->sb_addr = GFS2_SB_ADDR * GFS2_BASIC_BLOCK / sdp->bsize;
-
-	sdp->sd_fsb2bb_shift = sdp->sd_sb.sb_bsize_shift -
-		GFS2_BASIC_BLOCK_SHIFT;
-	sdp->sd_fsb2bb = 1 << sdp->sd_fsb2bb_shift;
-	sdp->sd_diptrs = (sdp->bsize - sizeof(struct gfs2_dinode)) /
-		sizeof(uint64_t);
-	sdp->sd_inptrs = (sdp->bsize - sizeof(struct gfs2_meta_header)) /
-		sizeof(uint64_t);
-	sdp->sd_jbsize = sdp->bsize - sizeof(struct gfs2_meta_header);
-	sdp->sd_hash_bsize = sdp->bsize / 2;
-	sdp->sd_hash_bsize_shift = sdp->sd_sb.sb_bsize_shift - 1;
-	sdp->sd_hash_ptrs = sdp->sd_hash_bsize / sizeof(uint64_t);
-
-	/*  Compute maximum reservation required to add a entry to a directory  */
-
-	hash_blocks = DIV_RU(sizeof(uint64_t) * (1 << GFS2_DIR_MAX_DEPTH),
-			     sdp->sd_jbsize);
-
-	ind_blocks = 0;
-	for (tmp_blocks = hash_blocks; tmp_blocks > sdp->sd_diptrs;) {
-		tmp_blocks = DIV_RU(tmp_blocks, sdp->sd_inptrs);
-		ind_blocks += tmp_blocks;
-	}
-
-	leaf_blocks = 2 + GFS2_DIR_MAX_DEPTH;
-
-	sdp->sd_max_dirres = hash_blocks + ind_blocks + leaf_blocks;
-
-	sdp->sd_max_height = compute_heightsize(sdp, sdp->sd_heightsize,
-						sdp->bsize, sdp->sd_diptrs,
-						sdp->sd_inptrs);
-	sdp->sd_max_jheight = compute_heightsize(sdp, sdp->sd_jheightsize,
-						 sdp->sd_jbsize,
-						 sdp->sd_diptrs,
-						 sdp->sd_inptrs);
-}
-
-void
-check_for_gfs2(struct gfs2_sbd *sdp)
-{
-	FILE *fp = fopen("/proc/mounts", "r");
-	char buffer[PATH_MAX];
-	char fstype[80];
-	int fsdump, fspass, ret;
-	char fspath[PATH_MAX];
-	char fsoptions[PATH_MAX];
-	char *realname;
-
-	realname = realpath(sdp->path_name, NULL);
-	if (!realname) {
-		perror(sdp->path_name);
-		return;
-	}
-	if (fp == NULL) {
-		perror("open: /proc/mounts");
-		exit(EXIT_FAILURE);
-	}
-	while ((fgets(buffer, PATH_MAX - 1, fp)) != NULL) {
-		buffer[PATH_MAX - 1] = 0;
-
-		if (strstr(buffer, "0") == 0)
-			continue;
-
-		if ((ret = sscanf(buffer, "%s %s %s %s %d %d",
-				  sdp->device_name, fspath, 
-				  fstype, fsoptions, &fsdump, &fspass)) != 6) 
-			continue;
-
-		if (strcmp(fstype, "gfs2") != 0)
-			continue;
-
-		/* Check if they specified the device instead of mnt point */
-		if (strcmp(sdp->device_name, realname) == 0)
-			strcpy(sdp->path_name, fspath); /* fix it */
-		else if (strcmp(fspath, realname) != 0)
-			continue;
-
-		fclose(fp);
-		if (strncmp(sdp->device_name, "/dev/loop", 9) == 0)
-			die("Cannot perform this operation on a loopback GFS2 mount.\n");
-
-		free(realname);
-		return;
-	}
-	free(realname);
-	fclose(fp);
-	die("gfs2 Filesystem %s is not mounted.\n", sdp->path_name);
-}
-
-static void
-lock_for_admin(struct gfs2_sbd *sdp)
-{
-	int error;
-
-	if (sdp->debug)
-		printf("\nTrying to get admin lock...\n");
-
-	sdp->metafs_fd = open(sdp->metafs_path, O_RDONLY | O_NOFOLLOW);
-	if (sdp->metafs_fd < 0)
-		die("can't open %s: %s\n",
-		    sdp->metafs_path, strerror(errno));
-	
-	error = flock(sdp->metafs_fd, LOCK_EX);
-	if (error)
-		die("can't flock %s: %s\n", sdp->metafs_path, strerror(errno));
-	if (sdp->debug)
-		printf("Got it.\n");
-}
-
-
-void 
-mount_gfs2_meta(struct gfs2_sbd *sdp)
-{
-	int ret;
-
-	memset(sdp->metafs_path, 0, PATH_MAX);
-	snprintf(sdp->metafs_path, PATH_MAX - 1, "/tmp/.gfs2meta.XXXXXX");
-
-	if(!mkdtemp(sdp->metafs_path))
-		die("Couldn't create %s : %s\n", sdp->metafs_path,
-		    strerror(errno));
-
-	ret = mount(sdp->path_name, sdp->metafs_path, "gfs2meta", 0, NULL);
-	if (ret) {
-		rmdir(sdp->metafs_path);
-		die("Couldn't mount %s : %s\n", sdp->metafs_path,
-		    strerror(errno));
-	}
-	lock_for_admin(sdp);
-}
-
-void
-cleanup_metafs(struct gfs2_sbd *sdp)
-{
-	int ret;
-
-	if (sdp->metafs_fd <= 0)
-		return;
-
-	fsync(sdp->metafs_fd);
-	close(sdp->metafs_fd);
-	ret = umount(sdp->metafs_path);
-	if (ret)
-		fprintf(stderr, "Couldn't unmount %s : %s\n",
-			sdp->metafs_path, strerror(errno));
-	else
-		rmdir(sdp->metafs_path);
-}
-
-char *__get_sysfs(char *fsname, char *filename)
-{
-	char path[PATH_MAX];
-	int fd, rv;
-
-	memset(path, 0, PATH_MAX);
-	memset(sysfs_buf, 0, PAGE_SIZE);
-	snprintf(path, PATH_MAX - 1, "%s/%s/%s", SYS_BASE, fsname, filename);
-
-	fd = open(path, O_RDONLY);
-	if (fd < 0)
-		die("can't open %s: %s\n", path, strerror(errno));
-	rv = read(fd, sysfs_buf, PAGE_SIZE);
-	if (rv < 0)
-		die("can't read from %s: %s\n", path, strerror(errno));
-
-	close(fd);
-	return sysfs_buf;
-}
-
-char *
-get_sysfs(char *fsname, char *filename)
-{
-	char *p = strchr(__get_sysfs(fsname, filename), '\n');
-	if (p)
-		*p = '\0';
-	return sysfs_buf;
-}
-
-unsigned int
-get_sysfs_uint(char *fsname, char *filename)
-{
-	unsigned int x;
-	sscanf(__get_sysfs(fsname, filename), "%u", &x);
-	return x;
-}
-
-void
-set_sysfs(char *fsname, char *filename, char *val)
-{
-	char path[PATH_MAX];
-	int fd, rv, len;
-
-	len = strlen(val) + 1;
-	if (len > PAGE_SIZE)
-		die("value for %s is too larger for sysfs\n", path);
-
-	memset(path, 0, PATH_MAX);
-	snprintf(path, PATH_MAX - 1, "%s/%s/%s", SYS_BASE, fsname, filename);
-
-	fd = open(path, O_WRONLY);
-	if (fd < 0)
-		die("can't open %s: %s\n", path, strerror(errno));
-
-	rv = write(fd, val, len);
-	if (rv != len){
-		if (rv < 0)
-			die("can't write to %s: %s", path, strerror(errno));
-		else
-			die("tried to write %d bytes to path, wrote %d\n",
-			    len, rv);
-	}
-	close(fd);
-}
-
-/**
- * get_list - Get the list of GFS2 filesystems
- *
- * Returns: a NULL terminated string
- */
-
-#define LIST_SIZE 1048576
-
-char *
-get_list(void)
-{
-	char path[PATH_MAX];
-	char s_id[PATH_MAX];
-	char *list, *p;
-	int rv, fd, x = 0, total = 0;
-	DIR *d;
-	struct dirent *de;
-
-	list = malloc(LIST_SIZE);
-	if (!list)
-		die("out of memory\n");
-
-	memset(path, 0, PATH_MAX);
-	snprintf(path, PATH_MAX, "%s", SYS_BASE);
-
-	d = opendir(path);
-	if (!d)
-		die("can't open %s: %s\n", SYS_BASE, strerror(errno));
-
-	while ((de = readdir(d))) {
-		if (de->d_name[0] == '.')
-			continue;
-
-		memset(path, 0, PATH_MAX);
-		snprintf(path, PATH_MAX, "%s/%s/id", SYS_BASE, de->d_name);
-
-		fd = open(path, O_RDONLY);
-		if (fd < 0)
-			die("can't open %s: %s\n", path, strerror(errno));
-
-		memset(s_id, 0, PATH_MAX);
-
-		rv = read(fd, s_id, sizeof(s_id));
-		if (rv < 0)
-			die("can't read %s: %s\n", path, strerror(errno));
-
-		close(fd);
-
-		p = strstr(s_id, "\n");
-		if (p)
-			*p = '\0';
-
-		total += strlen(s_id) + strlen(de->d_name) + 2;
-		if (total > LIST_SIZE)
-			break;
-
-		x += sprintf(list + x, "%s %s\n", s_id, de->d_name);
-
-	}
-
-	closedir(d);
-
-	return list;
-}
-
-/**
- * str2lines - parse a string into lines
- * @list: the list
- *
- * Returns: An array of character pointers
- */
-
-char **
-str2lines(char *str)
-{
-	char *p;
-	unsigned int n = 0;
-	char **lines;
-	unsigned int x = 0;
-
-	for (p = str; *p; p++)
-		if (*p == '\n')
-			n++;
-
-	lines = malloc((n + 1) * sizeof(char *));
-	if (!lines)
-		die("out of memory\n");
-
-	for (lines[x] = p = str; *p; p++)
-		if (*p == '\n') {
-			*p = 0;
-			lines[++x] = p + 1;
-		}
-
-	return lines;
-}
-
-/**
- * do_basename - Create dm-N style name for the device
- * @device:
- *
- * Returns: Pointer to dm name or basename
- */
-
-char *
-do_basename(char *device)
-{
-	FILE *file;
-	int found = FALSE;
-	char line[PATH_MAX], major_name[PATH_MAX];
-	unsigned int major_number;
-	struct stat st;
-
-	file = fopen("/proc/devices", "r");
-	if (!file)
-		goto punt;
-
-	while (fgets(line, PATH_MAX, file)) {
-		if (sscanf(line, "%u %s", &major_number, major_name) != 2)
-			continue;
-		if (strcmp(major_name, "device-mapper") != 0)
-			continue;
-		found = TRUE;
-		break;
-	}
-
-	fclose(file);
-
-	if (!found)
-		goto punt;
-
-	if (stat(device, &st))
-		goto punt;
-	if (major(st.st_rdev) == major_number) {
-		static char realname[16];
-		snprintf(realname, 16, "dm-%u", minor(st.st_rdev));
-		return realname;
-	}
-
- punt:
-	return basename(device);
-}
-
-char *
-mp2devname(char *mp)
-{
-	FILE *file;
-	char line[PATH_MAX];
-	static char device[PATH_MAX];
-	char *name = NULL;
-	char *realname;
-
-	realname = realpath(mp, NULL);
-	if (!realname)
-		die("Unable to allocate memory for name resolution.\n");
-	file = fopen("/proc/mounts", "r");
-	if (!file)
-		die("can't open /proc/mounts: %s\n", strerror(errno));
-
-	while (fgets(line, PATH_MAX, file)) {
-		char path[PATH_MAX], type[PATH_MAX];
-
-		if (sscanf(line, "%s %s %s", device, path, type) != 3)
-			continue;
-		if (strcmp(path, realname))
-			continue;
-		if (strcmp(type, "gfs2"))
-			die("%s is not a GFS2 filesystem\n", mp);
-
-		name = do_basename(device);
-
-		break;
-	}
-
-	free(realname);
-	fclose(file);
-
-	return name;
-}
-
-char *
-find_debugfs_mount(void)
-{
-	FILE *file;
-	char line[PATH_MAX];
-	char device[PATH_MAX], type[PATH_MAX];
-	char *path;
-
-	file = fopen("/proc/mounts", "rt");
-	if (!file)
-		die("can't open /proc/mounts: %s\n", strerror(errno));
-
-	path = malloc(PATH_MAX);
-	if (!path)
-		die("Can't allocate memory for debugfs.\n");
-	while (fgets(line, PATH_MAX, file)) {
-
-		if (sscanf(line, "%s %s %s", device, path, type) != 3)
-			continue;
-		if (!strcmp(type, "debugfs")) {
-			fclose(file);
-			return path;
-		}
-	}
-
-	free(path);
-	fclose(file);
-	return NULL;
-}
-
-/* The fsname can be substituted for the mountpoint on the command line.
-   This is necessary when we can't resolve a devname from /proc/mounts
-   to a fsname. */
-
-int is_fsname(char *name)
-{
-	int rv = 0;
-	DIR *d;
-	struct dirent *de;
-
-	d = opendir(SYS_BASE);
-	if (!d)
-		die("can't open %s: %s\n", SYS_BASE, strerror(errno));
-
-	while ((de = readdir(d))) {
-		if (de->d_name[0] == '.')
-			continue;
-
-		if (strcmp(de->d_name, name) == 0) {
-			rv = 1;
-			break;
-		}
-	}
-
-	closedir(d);
-
-	return rv;
-}
-
-/**
- * mp2fsname - Find the name for a filesystem given its mountpoint
- *
- * We do this by iterating through gfs2 dirs in /sys/fs/gfs2/ looking for
- * one where the "id" attribute matches the device id returned by stat for
- * the mount point.  The reason we go through all this is simple: the
- * kernel's sysfs is named after the VFS s_id, not the device name.
- * So it's perfectly legal to do something like this to simulate user
- * conditions without the proper hardware:
- *    # rm /dev/sdb1
- *    # mkdir /dev/cciss
- *    # mknod /dev/cciss/c0d0p1 b 8 17
- *    # mount -tgfs2 /dev/cciss/c0d0p1 /mnt/gfs2
- *    # gfs2_tool gettune /mnt/gfs2
- * In this example the tuning variables are in a directory named after the
- * VFS s_id, which in this case would be /sys/fs/gfs2/sdb1/
- *
- * Returns: the fsname
- */
-
-char *
-mp2fsname(char *mp)
-{
-	char device_id[PATH_MAX], *fsname = NULL;
-	struct stat statbuf;
-	DIR *d;
-	struct dirent *de;
-
-	if (stat(mp, &statbuf))
-		return NULL;
-
-	memset(device_id, 0, sizeof(device_id));
-	sprintf(device_id, "%i:%i", major(statbuf.st_dev),
-		minor(statbuf.st_dev));
-
-	d = opendir(SYS_BASE);
-	if (!d)
-		die("can't open %s: %s\n", SYS_BASE, strerror(errno));
-
-	while ((de = readdir(d))) {
-		if (de->d_name[0] == '.')
-			continue;
-
-		if (strcmp(get_sysfs(de->d_name, "id"), device_id) == 0) {
-			fsname = strdup(de->d_name);
-			break;
-		}
-	}
-
-	closedir(d);
-
-	return fsname;
-}
-
-/**
- * name2value - find the value of a name-value pair in a string
- * @str_in:
- * @name:
- *
- * Returns: the value string in a static buffer
- */
-
-char *
-name2value(char *str_in, char *name)
-{
-	char str[strlen(str_in) + 1];
-	static char value[PATH_MAX];
-	char **lines;
-	unsigned int x;
-	unsigned int len = strlen(name);
-
-	strcpy(str, str_in);
-	value[0] = 0;
-
-	lines = str2lines(str);
-
-	for (x = 0; *lines[x]; x++)
-		if (memcmp(lines[x], name, len) == 0 &&
-		    lines[x][len] == ' ') {
-			strcpy(value, lines[x] + len + 1);
-			break;
-		}
-
-	free(lines);
-
-	return value;
-}
-
-/**
- * name2u32 - find the value of a name-value pair in a string
- * @str_in:
- * @name:
- *
- * Returns: the value uint32
- */
-
-uint32_t
-name2u32(char *str, char *name)
-{
-	char *value = name2value(str, name);
-	uint32_t x = 0;
-
-	sscanf(value, "%u", &x);
-
-	return x;
-}
-
-/**
- * name2u64 - find the value of a name-value pair in a string
- * @str_in:
- * @name:
- *
- * Returns: the value uint64
- */
-
-uint64_t
-name2u64(char *str, char *name)
-{
-	char *value = name2value(str, name);
-	uint64_t x = 0;
-
-	sscanf(value, "%"SCNu64, &x);
-
-	return x;
-}
diff --git a/gfs2/libgfs2/ondisk.c b/gfs2/libgfs2/ondisk.c
deleted file mode 100644
index d80c9bb..0000000
--- a/gfs2/libgfs2/ondisk.c
+++ /dev/null
@@ -1,599 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-#include <inttypes.h>
-
-#include <linux/types.h>
-#include "libgfs2.h"
-
-#include "gfs2_disk_hash.h"
-
-
-#define CPIN_08(s1, s2, member, count) {memcpy((s1->member), (s2->member), (count));}
-#define CPOUT_08(s1, s2, member, count) {memcpy((s2->member), (s1->member), (count));}
-#define CPIN_16(s1, s2, member) {(s1->member) = be16_to_cpu((s2->member));}
-#define CPOUT_16(s1, s2, member) {(s2->member) = cpu_to_be16((s1->member));}
-#define CPIN_32(s1, s2, member) {(s1->member) = be32_to_cpu((s2->member));}
-#define CPOUT_32(s1, s2, member) {(s2->member) = cpu_to_be32((s1->member));}
-#define CPIN_64(s1, s2, member) {(s1->member) = be64_to_cpu((s2->member));}
-#define CPOUT_64(s1, s2, member) {(s2->member) = cpu_to_be64((s1->member));}
-
-/*
- * gfs2_xxx_in - read in an xxx struct
- * first arg: the cpu-order structure
- * buf: the disk-order buffer
- *
- * gfs2_xxx_out - write out an xxx struct
- * first arg: the cpu-order structure
- * buf: the disk-order buffer
- *
- * gfs2_xxx_print - print out an xxx struct
- * first arg: the cpu-order structure
- */
-
-void gfs2_inum_in(struct gfs2_inum *no, char *buf)
-{
-	struct gfs2_inum *str = (struct gfs2_inum *)buf;
-
-	CPIN_64(no, str, no_formal_ino);
-	CPIN_64(no, str, no_addr);
-}
-
-void gfs2_inum_out(struct gfs2_inum *no, char *buf)
-{
-	struct gfs2_inum *str = (struct gfs2_inum *)buf;
-
-	CPOUT_64(no, str, no_formal_ino);
-	CPOUT_64(no, str, no_addr);
-}
-
-void gfs2_inum_print(struct gfs2_inum *no)
-{
-	pv(no, no_formal_ino, "%llu", "0x%llx");
-	pv(no, no_addr, "%llu", "0x%llx");
-}
-
-void gfs2_meta_header_in(struct gfs2_meta_header *mh, char *buf)
-{
-	struct gfs2_meta_header *str = (struct gfs2_meta_header *)buf;
-
-	CPIN_32(mh, str, mh_magic);
-	CPIN_32(mh, str, mh_type);
-	CPIN_32(mh, str, mh_format);
-}
-
-void gfs2_meta_header_out(struct gfs2_meta_header *mh, char *buf)
-{
-	struct gfs2_meta_header *str = (struct gfs2_meta_header *)buf;
-
-	CPOUT_32(mh, str, mh_magic);
-	CPOUT_32(mh, str, mh_type);
-	CPOUT_32(mh, str, mh_format);
-	str->__pad0 = 0;
-	str->__pad1 = 0;
-}
-
-void gfs2_meta_header_print(struct gfs2_meta_header *mh)
-{
-	pv(mh, mh_magic, "0x%.8X", NULL);
-	pv(mh, mh_type, "%u", "0x%x");
-	pv(mh, mh_format, "%u", "0x%x");
-}
-
-void gfs2_sb_in(struct gfs2_sb *sb, char *buf)
-{
-	struct gfs2_sb *str = (struct gfs2_sb *)buf;
-
-	gfs2_meta_header_in(&sb->sb_header, buf);
-
-	CPIN_32(sb, str, sb_fs_format);
-	CPIN_32(sb, str, sb_multihost_format);
-
-	CPIN_32(sb, str, sb_bsize);
-	CPIN_32(sb, str, sb_bsize_shift);
-
-	gfs2_inum_in(&sb->sb_master_dir, (char *)&str->sb_master_dir);
-	gfs2_inum_in(&sb->sb_root_dir, (char *)&str->sb_root_dir);
-
-	CPIN_08(sb, str, sb_lockproto, GFS2_LOCKNAME_LEN);
-	CPIN_08(sb, str, sb_locktable, GFS2_LOCKNAME_LEN);
-}
-
-void gfs2_sb_out(struct gfs2_sb *sb, char *buf)
-{
-	struct gfs2_sb *str = (struct gfs2_sb *)buf;
-
-	gfs2_meta_header_out(&sb->sb_header, buf);
-
-	CPOUT_32(sb, str, sb_fs_format);
-	CPOUT_32(sb, str, sb_multihost_format);
-
-	CPOUT_32(sb, str, sb_bsize);
-	CPOUT_32(sb, str, sb_bsize_shift);
-
-	gfs2_inum_out(&sb->sb_master_dir, (char *)&str->sb_master_dir);
-	gfs2_inum_out(&sb->sb_root_dir, (char *)&str->sb_root_dir);
-
-	CPOUT_08(sb, str, sb_lockproto, GFS2_LOCKNAME_LEN);
-	CPOUT_08(sb, str, sb_locktable, GFS2_LOCKNAME_LEN);
-#ifdef GFS2_HAS_UUID
-	memcpy(str->sb_uuid, sb->sb_uuid, 16);
-#endif
-}
-
-void gfs2_sb_print(struct gfs2_sb *sb)
-{
-	gfs2_meta_header_print(&sb->sb_header);
-
-	pv(sb, sb_fs_format, "%u", "0x%x");
-	pv(sb, sb_multihost_format, "%u", "0x%x");
-
-	pv(sb, sb_bsize, "%u", "0x%x");
-	pv(sb, sb_bsize_shift, "%u", "0x%x");
-
-	gfs2_inum_print(&sb->sb_master_dir);
-	gfs2_inum_print(&sb->sb_root_dir);
-
-	pv(sb, sb_lockproto, "%s", NULL);
-	pv(sb, sb_locktable, "%s", NULL);
-}
-
-void gfs2_rindex_in(struct gfs2_rindex *ri, char *buf)
-{
-	struct gfs2_rindex *str = (struct gfs2_rindex *)buf;
-
-	CPIN_64(ri, str, ri_addr);
-	CPIN_32(ri, str, ri_length);
-
-	CPIN_64(ri, str, ri_data0);
-	CPIN_32(ri, str, ri_data);
-
-	CPIN_32(ri, str, ri_bitbytes);
-
-	CPIN_08(ri, str, ri_reserved, 64);
-}
-
-void gfs2_rindex_out(struct gfs2_rindex *ri, char *buf)
-{
-	struct gfs2_rindex *str = (struct gfs2_rindex *)buf;
-
-	CPOUT_64(ri, str, ri_addr);
-	CPOUT_32(ri, str, ri_length);
-	ri->__pad = 0;
-
-	CPOUT_64(ri, str, ri_data0);
-	CPOUT_32(ri, str, ri_data);
-
-	CPOUT_32(ri, str, ri_bitbytes);
-
-	CPOUT_08(ri, str, ri_reserved, 64);
-}
-
-void gfs2_rindex_print(struct gfs2_rindex *ri)
-{
-	pv(ri, ri_addr, "%llu", "0x%llx");
-	pv(ri, ri_length, "%u", "0x%x");
-
-	pv(ri, ri_data0, "%llu", "0x%llx");
-	pv(ri, ri_data, "%u", "0x%x");
-
-	pv(ri, ri_bitbytes, "%u", "0x%x");
-}
-
-void gfs2_rgrp_in(struct gfs2_rgrp *rg, char *buf)
-{
-	struct gfs2_rgrp *str = (struct gfs2_rgrp *)buf;
-
-	gfs2_meta_header_in(&rg->rg_header, buf);
-	CPIN_32(rg, str, rg_flags);
-	CPIN_32(rg, str, rg_free);
-	CPIN_32(rg, str, rg_dinodes);
-
-	CPIN_08(rg, str, rg_reserved, 36);
-}
-
-void gfs2_rgrp_out(struct gfs2_rgrp *rg, char *buf)
-{
-	struct gfs2_rgrp *str = (struct gfs2_rgrp *)buf;
-
-	gfs2_meta_header_out(&rg->rg_header, buf);
-	CPOUT_32(rg, str, rg_flags);
-	CPOUT_32(rg, str, rg_free);
-	CPOUT_32(rg, str, rg_dinodes);
-
-	CPOUT_08(rg, str, rg_reserved, 36);
-}
-
-void gfs2_rgrp_print(struct gfs2_rgrp *rg)
-{
-	gfs2_meta_header_print(&rg->rg_header);
-	pv(rg, rg_flags, "%u", "0x%x");
-	pv(rg, rg_free, "%u", "0x%x");
-	pv(rg, rg_dinodes, "%u", "0x%x");
-}
-
-void gfs2_quota_in(struct gfs2_quota *qu, char *buf)
-{
-	struct gfs2_quota *str = (struct gfs2_quota *)buf;
-
-	CPIN_64(qu, str, qu_limit);
-	CPIN_64(qu, str, qu_warn);
-	CPIN_64(qu, str, qu_value);
-	CPIN_32(qu, str, qu_ll_next);
-	CPIN_08(qu, str, qu_reserved, 60);
-}
-
-void gfs2_quota_out(struct gfs2_quota *qu, char *buf)
-{
-	struct gfs2_quota *str = (struct gfs2_quota *)buf;
-
-	CPOUT_64(qu, str, qu_limit);
-	CPOUT_64(qu, str, qu_warn);
-	CPOUT_64(qu, str, qu_value);
-	CPOUT_32(qu, str, qu_ll_next);
-	CPOUT_08(qu, str, qu_reserved, 60);
-}
-
-void gfs2_quota_print(struct gfs2_quota *qu)
-{
-	pv(qu, qu_limit, "%llu", "0x%llx");
-	pv(qu, qu_warn, "%llu", "0x%llx");
-	pv(qu, qu_value, "%lld", "0x%llx");
-}
-
-void gfs2_dinode_in(struct gfs2_dinode *di, char *buf)
-{
-	struct gfs2_dinode *str = (struct gfs2_dinode *)buf;
-
-	gfs2_meta_header_in(&di->di_header, buf);
-	gfs2_inum_in(&di->di_num, (char *)&str->di_num);
-
-	CPIN_32(di, str, di_mode);
-	CPIN_32(di, str, di_uid);
-	CPIN_32(di, str, di_gid);
-	CPIN_32(di, str, di_nlink);
-	CPIN_64(di, str, di_size);
-	CPIN_64(di, str, di_blocks);
-	CPIN_64(di, str, di_atime);
-	CPIN_64(di, str, di_mtime);
-	CPIN_64(di, str, di_ctime);
-	CPIN_32(di, str, di_major);
-	CPIN_32(di, str, di_minor);
-
-	CPIN_64(di, str, di_goal_meta);
-	CPIN_64(di, str, di_goal_data);
-
-	CPIN_32(di, str, di_flags);
-	CPIN_32(di, str, di_payload_format);
-	CPIN_16(di, str, __pad1);
-	CPIN_16(di, str, di_height);
-
-	CPIN_16(di, str, di_depth);
-	CPIN_32(di, str, di_entries);
-
-	CPIN_64(di, str, di_eattr);
-
-	CPIN_08(di, str, di_reserved, 32);
-}
-
-void gfs2_dinode_out(struct gfs2_dinode *di, char *buf)
-{
-	struct gfs2_dinode *str = (struct gfs2_dinode *)buf;
-
-	gfs2_meta_header_out(&di->di_header, buf);
-	gfs2_inum_out(&di->di_num, (char *)&str->di_num);
-
-	CPOUT_32(di, str, di_mode);
-	CPOUT_32(di, str, di_uid);
-	CPOUT_32(di, str, di_gid);
-	CPOUT_32(di, str, di_nlink);
-	CPOUT_64(di, str, di_size);
-	CPOUT_64(di, str, di_blocks);
-	CPOUT_64(di, str, di_atime);
-	CPOUT_64(di, str, di_mtime);
-	CPOUT_64(di, str, di_ctime);
-	CPOUT_32(di, str, di_major);
-	CPOUT_32(di, str, di_minor);
-
-	CPOUT_64(di, str, di_goal_meta);
-	CPOUT_64(di, str, di_goal_data);
-
-	CPOUT_32(di, str, di_flags);
-	CPOUT_32(di, str, di_payload_format);
-	CPOUT_16(di, str, di_height);
-
-	CPOUT_16(di, str, di_depth);
-	CPOUT_32(di, str, di_entries);
-
-	CPOUT_64(di, str, di_eattr);
-
-	CPOUT_08(di, str, di_reserved, 32);
-}
-
-void gfs2_dinode_print(struct gfs2_dinode *di)
-{
-	gfs2_meta_header_print(&di->di_header);
-	gfs2_inum_print(&di->di_num);
-
-	pv(di, di_mode, "0%o", NULL);
-	pv(di, di_uid, "%u", "0x%x");
-	pv(di, di_gid, "%u", "0x%x");
-	pv(di, di_nlink, "%u", "0x%x");
-	pv(di, di_size, "%llu", "0x%llx");
-	pv(di, di_blocks, "%llu", "0x%llx");
-	pv(di, di_atime, "%lld", "0x%llx");
-	pv(di, di_mtime, "%lld", "0x%llx");
-	pv(di, di_ctime, "%lld", "0x%llx");
-	pv(di, di_major, "%u", "0x%llx");
-	pv(di, di_minor, "%u", "0x%llx");
-
-	pv(di, di_goal_meta, "%llu", "0x%llx");
-	pv(di, di_goal_data, "%llu", "0x%llx");
-
-	pv(di, di_flags, "0x%.8X", NULL);
-	pv(di, di_payload_format, "%u", "0x%x");
-	pv(di, di_height, "%u", "0x%x");
-
-	pv(di, di_depth, "%u", "0x%x");
-	pv(di, di_entries, "%u", "0x%x");
-
-	pv(di, di_eattr, "%llu", "0x%llx");
-}
-
-void gfs2_dirent_in(struct gfs2_dirent *de, char *buf)
-{
-	struct gfs2_dirent *str = (struct gfs2_dirent *)buf;
-
-	gfs2_inum_in(&de->de_inum, buf);
-	CPIN_32(de, str, de_hash);
-	CPIN_16(de, str, de_rec_len);
-	CPIN_16(de, str, de_name_len);
-	CPIN_16(de, str, de_type);
-}
-
-void gfs2_dirent_out(struct gfs2_dirent *de, char *buf)
-{
-	struct gfs2_dirent *str = (struct gfs2_dirent *)buf;
-
-	gfs2_inum_out(&de->de_inum, buf);
-	CPOUT_32(de, str, de_hash);
-	CPOUT_16(de, str, de_rec_len);
-	CPOUT_16(de, str, de_name_len);
-	CPOUT_16(de, str, de_type);
-	memset(str->__pad, 0, sizeof(str->__pad));
-}
-
-void gfs2_dirent_print(struct gfs2_dirent *de, char *name)
-{
-	char buf[GFS2_FNAMESIZE + 1];
-
-	gfs2_inum_print(&de->de_inum);
-	pv(de, de_hash, "0x%.8X", NULL);
-	pv(de, de_rec_len, "%u", "0x%x");
-	pv(de, de_name_len, "%u", "0x%x");
-	pv(de, de_type, "%u", "0x%x");
-
-	memset(buf, 0, GFS2_FNAMESIZE + 1);
-	memcpy(buf, name, de->de_name_len);
-	print_it("  name", "%s", NULL, buf);
-}
-
-void gfs2_leaf_in(struct gfs2_leaf *lf, char *buf)
-{
-	struct gfs2_leaf *str = (struct gfs2_leaf *)buf;
-
-	gfs2_meta_header_in(&lf->lf_header, buf);
-	CPIN_16(lf, str, lf_depth);
-	CPIN_16(lf, str, lf_entries);
-	CPIN_32(lf, str, lf_dirent_format);
-	CPIN_64(lf, str, lf_next);
-
-	CPIN_08(lf, str, lf_reserved, 32);
-}
-
-void gfs2_leaf_out(struct gfs2_leaf *lf, char *buf)
-{
-	struct gfs2_leaf *str = (struct gfs2_leaf *)buf;
-
-	gfs2_meta_header_out(&lf->lf_header, buf);
-	CPOUT_16(lf, str, lf_depth);
-	CPOUT_16(lf, str, lf_entries);
-	CPOUT_32(lf, str, lf_dirent_format);
-	CPOUT_64(lf, str, lf_next);
-
-	CPOUT_08(lf, str, lf_reserved, 32);
-}
-
-void gfs2_leaf_print(struct gfs2_leaf *lf)
-{
-	gfs2_meta_header_print(&lf->lf_header);
-	pv(lf, lf_depth, "%u", "0x%x");
-	pv(lf, lf_entries, "%u", "0x%x");
-	pv(lf, lf_dirent_format, "%u", "0x%x");
-	pv(lf, lf_next, "%llu", "0x%llx");
-}
-
-void gfs2_ea_header_in(struct gfs2_ea_header *ea, char *buf)
-{
-	struct gfs2_ea_header *str = (struct gfs2_ea_header *)buf;
-
-	CPIN_32(ea, str, ea_rec_len);
-	CPIN_32(ea, str, ea_data_len);
-	ea->ea_name_len = str->ea_name_len;
-	ea->ea_type = str->ea_type;
-	ea->ea_flags = str->ea_flags;
-	ea->ea_num_ptrs = str->ea_num_ptrs;
-}
-
-void gfs2_ea_header_out(struct gfs2_ea_header *ea, char *buf)
-{
-	struct gfs2_ea_header *str = (struct gfs2_ea_header *)buf;
-
-	CPOUT_32(ea, str, ea_rec_len);
-	CPOUT_32(ea, str, ea_data_len);
-	str->ea_name_len = ea->ea_name_len;
-	str->ea_type = ea->ea_type;
-	str->ea_flags = ea->ea_flags;
-	str->ea_num_ptrs = ea->ea_num_ptrs;
-	str->__pad = 0;
-}
-
-void gfs2_ea_header_print(struct gfs2_ea_header *ea, char *name)
-{
-	char buf[GFS2_EA_MAX_NAME_LEN + 1];
-
-	pv(ea, ea_rec_len, "%u", "0x%x");
-	pv(ea, ea_data_len, "%u", "0x%x");
-	pv(ea, ea_name_len, "%u", "0x%x");
-	pv(ea, ea_type, "%u", "0x%x");
-	pv(ea, ea_flags, "%u", "0x%x");
-	pv(ea, ea_num_ptrs, "%u", "0x%x");
-
-	memset(buf, 0, GFS2_EA_MAX_NAME_LEN + 1);
-	memcpy(buf, name, ea->ea_name_len);
-	print_it("  name", "%s", NULL, buf);
-}
-
-void gfs2_log_header_in(struct gfs2_log_header *lh, char *buf)
-{
-	struct gfs2_log_header *str = (struct gfs2_log_header *)buf;
-
-	gfs2_meta_header_in(&lh->lh_header, buf);
-	CPIN_64(lh, str, lh_sequence);
-	CPIN_32(lh, str, lh_flags);
-	CPIN_32(lh, str, lh_tail);
-	CPIN_32(lh, str, lh_blkno);
-	CPIN_32(lh, str, lh_hash);
-}
-
-void gfs2_log_header_out(struct gfs2_log_header *lh, char *buf)
-{
-	struct gfs2_log_header *str = (struct gfs2_log_header *)buf;
-
-	gfs2_meta_header_out(&lh->lh_header, buf);
-	CPOUT_64(lh, str, lh_sequence);
-	CPOUT_32(lh, str, lh_flags);
-	CPOUT_32(lh, str, lh_tail);
-	CPOUT_32(lh, str, lh_blkno);
-	CPOUT_32(lh, str, lh_hash);
-}
-
-void gfs2_log_header_print(struct gfs2_log_header *lh)
-{
-	gfs2_meta_header_print(&lh->lh_header);
-	pv(lh, lh_sequence, "%llu", "0x%llx");
-	pv(lh, lh_flags, "0x%.8X", NULL);
-	pv(lh, lh_tail, "%u", "0x%x");
-	pv(lh, lh_blkno, "%u", "0x%x");
-	pv(lh, lh_hash, "0x%.8X", NULL);
-}
-
-void gfs2_log_descriptor_in(struct gfs2_log_descriptor *ld, char *buf)
-{
-	struct gfs2_log_descriptor *str = (struct gfs2_log_descriptor *)buf;
-
-	gfs2_meta_header_in(&ld->ld_header, buf);
-	CPIN_32(ld, str, ld_type);
-	CPIN_32(ld, str, ld_length);
-	CPIN_32(ld, str, ld_data1);
-	CPIN_32(ld, str, ld_data2);
-
-	CPIN_08(ld, str, ld_reserved, 32);
-}
-
-void gfs2_log_descriptor_out(struct gfs2_log_descriptor *ld, char *buf)
-{
-	struct gfs2_log_descriptor *str = (struct gfs2_log_descriptor *)buf;
-
-	gfs2_meta_header_out(&ld->ld_header, buf);
-	CPOUT_32(ld, str, ld_type);
-	CPOUT_32(ld, str, ld_length);
-	CPOUT_32(ld, str, ld_data1);
-	CPOUT_32(ld, str, ld_data2);
-
-	CPOUT_08(ld, str, ld_reserved, 32);
-}
-
-void gfs2_log_descriptor_print(struct gfs2_log_descriptor *ld)
-{
-	gfs2_meta_header_print(&ld->ld_header);
-	pv(ld, ld_type, "%u", "0x%x");
-	pv(ld, ld_length, "%u", "0x%x");
-	pv(ld, ld_data1, "%u", "0x%x");
-	pv(ld, ld_data2, "%u", "0x%x");
-}
-
-void gfs2_inum_range_in(struct gfs2_inum_range *ir, char *buf)
-{
-	struct gfs2_inum_range *str = (struct gfs2_inum_range *)buf;
-
-	CPIN_64(ir, str, ir_start);
-	CPIN_64(ir, str, ir_length);
-}
-
-void gfs2_inum_range_out(struct gfs2_inum_range *ir, char *buf)
-{
-	struct gfs2_inum_range *str = (struct gfs2_inum_range *)buf;
-
-	CPOUT_64(ir, str, ir_start);
-	CPOUT_64(ir, str, ir_length);
-}
-
-void gfs2_inum_range_print(struct gfs2_inum_range *ir)
-{
-	pv(ir, ir_start, "%llu", "0x%llx");
-	pv(ir, ir_length, "%llu", "0x%llx");
-}
-
-void gfs2_statfs_change_in(struct gfs2_statfs_change *sc, char *buf)
-{
-	struct gfs2_statfs_change *str = (struct gfs2_statfs_change *)buf;
-
-	CPIN_64(sc, str, sc_total);
-	CPIN_64(sc, str, sc_free);
-	CPIN_64(sc, str, sc_dinodes);
-}
-
-void gfs2_statfs_change_out(struct gfs2_statfs_change *sc, char *buf)
-{
-	struct gfs2_statfs_change *str = (struct gfs2_statfs_change *)buf;
-
-	CPOUT_64(sc, str, sc_total);
-	CPOUT_64(sc, str, sc_free);
-	CPOUT_64(sc, str, sc_dinodes);
-}
-
-void gfs2_statfs_change_print(struct gfs2_statfs_change *sc)
-{
-	pv(sc, sc_total, "%lld", "0x%llx");
-	pv(sc, sc_free, "%lld", "0x%llx");
-	pv(sc, sc_dinodes, "%lld", "0x%llx");
-}
-
-void gfs2_quota_change_in(struct gfs2_quota_change *qc, char *buf)
-{
-	struct gfs2_quota_change *str = (struct gfs2_quota_change *)buf;
-
-	CPIN_64(qc, str, qc_change);
-	CPIN_32(qc, str, qc_flags);
-	CPIN_32(qc, str, qc_id);
-}
-
-void gfs2_quota_change_out(struct gfs2_quota_change *qc, char *buf)
-{
-	struct gfs2_quota_change *str = (struct gfs2_quota_change *)buf;
-
-	CPOUT_64(qc, str, qc_change);
-	CPOUT_32(qc, str, qc_flags);
-	CPOUT_32(qc, str, qc_id);
-}
-
-void gfs2_quota_change_print(struct gfs2_quota_change *qc)
-{
-	pv(qc, qc_change, "%lld", "0x%llx");
-	pv(qc, qc_flags, "0x%.8X", NULL);
-	pv(qc, qc_id, "%u", "0x%x");
-}
-
-
diff --git a/gfs2/libgfs2/ondisk.h b/gfs2/libgfs2/ondisk.h
deleted file mode 100644
index dcd6318..0000000
--- a/gfs2/libgfs2/ondisk.h
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef __ONDISK_DOT_H__
-#define __ONDISK_DOT_H__
-
-
-/* Translation functions */
-
-extern void gfs2_inum_in(struct gfs2_inum *no, char *buf);
-extern void gfs2_inum_out(struct gfs2_inum *no, char *buf);
-extern void gfs2_meta_header_in(struct gfs2_meta_header *mh, char *buf);
-extern void gfs2_meta_header_out(struct gfs2_meta_header *mh, char *buf);
-extern void gfs2_sb_in(struct gfs2_sb *sb, char *buf);
-extern void gfs2_sb_out(struct gfs2_sb *sb, char *buf);
-extern void gfs2_rindex_in(struct gfs2_rindex *ri, char *buf);
-extern void gfs2_rindex_out(struct gfs2_rindex *ri, char *buf);
-extern void gfs2_rgrp_in(struct gfs2_rgrp *rg, char *buf);
-extern void gfs2_rgrp_out(struct gfs2_rgrp *rg, char *buf);
-extern void gfs2_quota_in(struct gfs2_quota *qu, char *buf);
-extern void gfs2_quota_out(struct gfs2_quota *qu, char *buf);
-extern void gfs2_dinode_in(struct gfs2_dinode *di, char *buf);
-extern void gfs2_dinode_out(struct gfs2_dinode *di, char *buf);
-extern void gfs2_dirent_in(struct gfs2_dirent *de, char *buf);
-extern void gfs2_dirent_out(struct gfs2_dirent *de, char *buf);
-extern void gfs2_leaf_in(struct gfs2_leaf *lf, char *buf);
-extern void gfs2_leaf_out(struct gfs2_leaf *lf, char *buf);
-extern void gfs2_ea_header_in(struct gfs2_ea_header *ea, char *buf);
-extern void gfs2_ea_header_out(struct gfs2_ea_header *ea, char *buf);
-extern void gfs2_log_header_in(struct gfs2_log_header *lh, char *buf);
-extern void gfs2_log_header_out(struct gfs2_log_header *lh, char *buf);
-extern void gfs2_log_descriptor_in(struct gfs2_log_descriptor *ld, char *buf);
-extern void gfs2_log_descriptor_out(struct gfs2_log_descriptor *ld, char *buf);
-extern void gfs2_inum_range_in(struct gfs2_inum_range *ir, char *buf);
-extern void gfs2_inum_range_out(struct gfs2_inum_range *ir, char *buf);
-extern void gfs2_statfs_change_in(struct gfs2_statfs_change *sc, char *buf);
-extern void gfs2_statfs_change_out(struct gfs2_statfs_change *sc, char *buf);
-extern void gfs2_quota_change_in(struct gfs2_quota_change *qc, char *buf);
-extern void gfs2_quota_change_out(struct gfs2_quota_change *qc, char *buf);
-
-/* Printing functions */
-
-extern void gfs2_inum_print(struct gfs2_inum *no);
-extern void gfs2_meta_header_print(struct gfs2_meta_header *mh);
-extern void gfs2_sb_print(struct gfs2_sb *sb);
-extern void gfs2_rindex_print(struct gfs2_rindex *ri);
-extern void gfs2_rgrp_print(struct gfs2_rgrp *rg);
-extern void gfs2_quota_print(struct gfs2_quota *qu);
-extern void gfs2_dinode_print(struct gfs2_dinode *di);
-extern void gfs2_dirent_print(struct gfs2_dirent *de, char *name);
-extern void gfs2_leaf_print(struct gfs2_leaf *lf);
-extern void gfs2_ea_header_print(struct gfs2_ea_header *ea, char *name);
-extern void gfs2_log_header_print(struct gfs2_log_header *lh);
-extern void gfs2_log_descriptor_print(struct gfs2_log_descriptor *ld);
-extern void gfs2_inum_range_print(struct gfs2_inum_range *ir);
-extern void gfs2_statfs_change_print(struct gfs2_statfs_change *sc);
-#if 0
-extern void gfs2_unlinked_tag_print(struct gfs2_unlinked_tag *ut);
-#endif
-extern void gfs2_quota_change_print(struct gfs2_quota_change *qc);
-
-#endif /* __ONDISK_DOT_H__ */
diff --git a/gfs2/libgfs2/recovery.c b/gfs2/libgfs2/recovery.c
deleted file mode 100644
index b10fe77..0000000
--- a/gfs2/libgfs2/recovery.c
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * NOTE:
- *
- * This code was pilfered from the gfs2 kernel and adapted to userland.
- * If you change this part, you should evaluate whether the upstream kernel
- * version of recovery.c should be changed as well.  Likewise, if the
- * upstream version changes, this part should be kept in sync.
- * 
- */
-
-#include <errno.h>
-#include <string.h>
-#include "libgfs2.h"
-
-void gfs2_replay_incr_blk(struct gfs2_inode *ip, unsigned int *blk)
-{
-	uint32_t jd_blocks = ip->i_di.di_size / ip->i_sbd->sd_sb.sb_bsize;
-
-        if (++*blk == jd_blocks)
-                *blk = 0;
-}
-
-int gfs2_replay_read_block(struct gfs2_inode *ip, unsigned int blk,
-			   struct gfs2_buffer_head **bh)
-{
-	int new = 0;
-	uint64_t dblock;
-	uint32_t extlen;
-
-	block_map(ip, blk, &new, &dblock, &extlen, FALSE, not_updated);
-	if (!dblock)
-		return -EIO;
-
-	*bh = bread(&ip->i_sbd->buf_list, dblock);
-	return 0;
-}
-
-/**
- * get_log_header - read the log header for a given segment
- * @ip: the journal incore inode
- * @blk: the block to look at
- * @lh: the log header to return
- *
- * Read the log header for a given segement in a given journal.  Do a few
- * sanity checks on it.
- *
- * Returns: 0 on success,
- *          1 if the header was invalid or incomplete,
- *          errno on error
- */
-
-int get_log_header(struct gfs2_inode *ip, unsigned int blk,
-		   struct gfs2_log_header *head)
-{
-	struct gfs2_buffer_head *bh;
-	struct gfs2_log_header lh, *tmp;
-	uint32_t hash, saved_hash;
-	int error;
-
-	error = gfs2_replay_read_block(ip, blk, &bh);
-	if (error)
-		return error;
-
-	tmp = (struct gfs2_log_header *)bh->b_data;
-	saved_hash = tmp->lh_hash;
-	tmp->lh_hash = 0;
-	hash = gfs2_disk_hash(bh->b_data, sizeof(struct gfs2_log_header));
-	tmp->lh_hash = saved_hash;
-	gfs2_log_header_in(&lh, bh->b_data);
-	brelse(bh, not_updated);
-
-	if (error || lh.lh_blkno != blk || lh.lh_hash != hash)
-		return 1;
-
-	*head = lh;
-
-	return 0;
-}
-
-/**
- * find_good_lh - find a good log header
- * @ip: the journal incore inode
- * @blk: the segment to start searching from
- * @lh: the log header to fill in
- * @forward: if true search forward in the log, else search backward
- *
- * Call get_log_header() to get a log header for a segment, but if the
- * segment is bad, either scan forward or backward until we find a good one.
- *
- * Returns: errno
- */
-
-int find_good_lh(struct gfs2_inode *ip, unsigned int *blk,
-		 struct gfs2_log_header *head)
-{
-	unsigned int orig_blk = *blk;
-	int error;
-	uint32_t jd_blocks = ip->i_di.di_size / ip->i_sbd->sd_sb.sb_bsize;
-
-	for (;;) {
-		error = get_log_header(ip, *blk, head);
-		if (error <= 0)
-			return error;
-
-		if (++*blk == jd_blocks)
-			*blk = 0;
-
-		if (*blk == orig_blk)
-			return -EIO;
-	}
-}
-
-/**
- * jhead_scan - make sure we've found the head of the log
- * @jd: the journal
- * @head: this is filled in with the log descriptor of the head
- *
- * At this point, seg and lh should be either the head of the log or just
- * before.  Scan forward until we find the head.
- *
- * Returns: errno
- */
-
-int jhead_scan(struct gfs2_inode *ip, struct gfs2_log_header *head)
-{
-	unsigned int blk = head->lh_blkno;
-	uint32_t jd_blocks = ip->i_di.di_size / ip->i_sbd->sd_sb.sb_bsize;
-	struct gfs2_log_header lh;
-	int error;
-
-	for (;;) {
-		if (++blk == jd_blocks)
-			blk = 0;
-
-		error = get_log_header(ip, blk, &lh);
-		if (error < 0)
-			return error;
-		if (error == 1)
-			continue;
-
-		if (lh.lh_sequence == head->lh_sequence)
-			return -EIO;
-		if (lh.lh_sequence < head->lh_sequence)
-			break;
-
-		*head = lh;
-	}
-
-	return 0;
-}
-
-/**
- * gfs2_find_jhead - find the head of a log
- * @jd: the journal
- * @head: the log descriptor for the head of the log is returned here
- *
- * Do a binary search of a journal and find the valid log entry with the
- * highest sequence number.  (i.e. the log head)
- *
- * Returns: errno
- */
-
-int gfs2_find_jhead(struct gfs2_inode *ip, struct gfs2_log_header *head)
-{
-	struct gfs2_log_header lh_1, lh_m;
-	uint32_t blk_1, blk_2, blk_m;
-	uint32_t jd_blocks = ip->i_di.di_size / ip->i_sbd->sd_sb.sb_bsize;
-	int error;
-
-	blk_1 = 0;
-	blk_2 = jd_blocks - 1;
-
-	for (;;) {
-		blk_m = (blk_1 + blk_2) / 2;
-
-		error = find_good_lh(ip, &blk_1, &lh_1);
-		if (error)
-			return error;
-
-		error = find_good_lh(ip, &blk_m, &lh_m);
-		if (error)
-			return error;
-
-		if (blk_1 == blk_m || blk_m == blk_2)
-			break;
-
-		if (lh_1.lh_sequence <= lh_m.lh_sequence)
-			blk_1 = blk_m;
-		else
-			blk_2 = blk_m;
-	}
-
-	error = jhead_scan(ip, &lh_1);
-	if (error)
-		return error;
-
-	*head = lh_1;
-
-	return error;
-}
-
-/**
- * clean_journal - mark a dirty journal as being clean
- * @sdp: the filesystem
- * @jd: the journal
- * @head: the head journal to start from
- *
- * Returns: errno
- */
-
-int clean_journal(struct gfs2_inode *ip, struct gfs2_log_header *head)
-{
-	unsigned int lblock;
-	struct gfs2_log_header *lh;
-	uint32_t hash, extlen;
-	struct gfs2_buffer_head *bh;
-	int new = 0;
-	uint64_t dblock;
-
-	lblock = head->lh_blkno;
-	gfs2_replay_incr_blk(ip, &lblock);
-	block_map(ip, lblock, &new, &dblock, &extlen, 0, not_updated);
-	if (!dblock)
-		return -EIO;
-
-	bh = bread(&ip->i_sbd->buf_list, dblock);
-	memset(bh->b_data, 0, ip->i_sbd->bsize);
-
-	lh = (struct gfs2_log_header *)bh->b_data;
-	memset(lh, 0, sizeof(struct gfs2_log_header));
-	lh->lh_header.mh_magic = cpu_to_be32(GFS2_MAGIC);
-	lh->lh_header.mh_type = cpu_to_be32(GFS2_METATYPE_LH);
-	lh->lh_header.mh_format = cpu_to_be32(GFS2_FORMAT_LH);
-	lh->lh_sequence = cpu_to_be64(head->lh_sequence + 1);
-	lh->lh_flags = cpu_to_be32(GFS2_LOG_HEAD_UNMOUNT);
-	lh->lh_blkno = cpu_to_be32(lblock);
-	hash = gfs2_disk_hash((const char *)lh, sizeof(struct gfs2_log_header));
-	lh->lh_hash = cpu_to_be32(hash);
-
-	brelse(bh, updated);
-
-	return 0;
-}
-
diff --git a/gfs2/libgfs2/rgrp.c b/gfs2/libgfs2/rgrp.c
deleted file mode 100644
index 15adb16..0000000
--- a/gfs2/libgfs2/rgrp.c
+++ /dev/null
@@ -1,165 +0,0 @@
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "libgfs2.h"
-
-/**
- * gfs2_compute_bitstructs - Compute the bitmap sizes
- * @rgd: The resource group descriptor
- *
- * Returns: 0 on success, -1 on error
- */
-int gfs2_compute_bitstructs(struct gfs2_sbd *sdp, struct rgrp_list *rgd)
-{
-	struct gfs2_bitmap *bits;
-	uint32_t length = rgd->ri.ri_length;
-	uint32_t bytes_left, bytes;
-	int x;
-
-	/* Max size of an rg is 2GB.  A 2GB RG with (minimum) 512-byte blocks
-	   has 4194304 blocks.  We can represent 4 blocks in one bitmap byte.
-	   Therefore, all 4194304 blocks can be represented in 1048576 bytes.
-	   Subtract a metadata header for each 512-byte block and we get
-	   488 bytes of bitmap per block.  Divide 1048576 by 488 and we can
-	   be assured we should never have more than 2149 of them. */
-	if (length > 2149 || length == 0)
-		return -1;
-	if(rgd->bits == NULL && !(rgd->bits = (struct gfs2_bitmap *)
-		 malloc(length * sizeof(struct gfs2_bitmap))))
-		return -1;
-	if(!memset(rgd->bits, 0, length * sizeof(struct gfs2_bitmap)))
-		return -1;
-	
-	bytes_left = rgd->ri.ri_bitbytes;
-
-	for (x = 0; x < length; x++){
-		bits = &rgd->bits[x];
-
-		if (length == 1){
-			bytes = bytes_left;
-			bits->bi_offset = sizeof(struct gfs2_rgrp);
-			bits->bi_start = 0;
-			bits->bi_len = bytes;
-		}
-		else if (x == 0){
-			bytes = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_rgrp);
-			bits->bi_offset = sizeof(struct gfs2_rgrp);
-			bits->bi_start = 0;
-			bits->bi_len = bytes;
-		}
-		else if (x + 1 == length){
-			bytes = bytes_left;
-			bits->bi_offset = sizeof(struct gfs2_meta_header);
-			bits->bi_start = rgd->ri.ri_bitbytes - bytes_left;
-			bits->bi_len = bytes;
-		}
-		else{
-			bytes = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_meta_header);
-			bits->bi_offset = sizeof(struct gfs2_meta_header);
-			bits->bi_start = rgd->ri.ri_bitbytes - bytes_left;
-			bits->bi_len = bytes;
-		}
-
-		bytes_left -= bytes;
-	}
-
-	if(bytes_left)
-		return -1;
-
-	if((rgd->bits[length - 1].bi_start +
-	    rgd->bits[length - 1].bi_len) * GFS2_NBBY != rgd->ri.ri_data)
-		return -1;
-
-	if (rgd->bh)      /* If we already have a bh allocated */
-		return 0; /* don't want to allocate another */
-	if(!(rgd->bh = (struct gfs2_buffer_head **)
-		 malloc(length * sizeof(struct gfs2_buffer_head *))))
-		return -1;
-	if(!memset(rgd->bh, 0, length * sizeof(struct gfs2_buffer_head *)))
-		return -1;
-
-	return 0;
-}
-
-
-/**
- * blk2rgrpd - Find resource group for a given data block number
- * @sdp: The GFS superblock
- * @n: The data block number
- *
- * Returns: Ths resource group, or NULL if not found
- */
-struct rgrp_list *gfs2_blk2rgrpd(struct gfs2_sbd *sdp, uint64_t blk)
-{
-	osi_list_t *tmp;
-	struct rgrp_list *rgd = NULL;
-	struct gfs2_rindex *ri;
-
-	for(tmp = sdp->rglist.next; tmp != &sdp->rglist; tmp = tmp->next){
-		rgd = osi_list_entry(tmp, struct rgrp_list, list);
-		ri = &rgd->ri;
-
-		if (ri->ri_data0 <= blk && blk < ri->ri_data0 + ri->ri_data){
-			break;
-		} else
-			rgd = NULL;
-	}
-	return rgd;
-}
-
-/**
- * fs_rgrp_read - read in the resource group information from disk.
- * @rgd - resource group structure
- * returns: 0 if no error, otherwise the block number that failed
- */
-uint64_t gfs2_rgrp_read(struct gfs2_sbd *sdp, struct rgrp_list *rgd)
-{
-	int x, length = rgd->ri.ri_length;
-
-	for (x = 0; x < length; x++){
-		rgd->bh[x] = bread(&sdp->nvbuf_list, rgd->ri.ri_addr + x);
-		if(gfs2_check_meta(rgd->bh[x],
-				   (x) ? GFS2_METATYPE_RB : GFS2_METATYPE_RG))
-		{
-			uint64_t error;
-
-			error = rgd->ri.ri_addr + x;
-			for (; x >= 0; x--)
-				brelse(rgd->bh[x], not_updated);
-			return error;
-		}
-	}
-
-	gfs2_rgrp_in(&rgd->rg, rgd->bh[0]->b_data);
-	return 0;
-}
-
-void gfs2_rgrp_relse(struct rgrp_list *rgd, enum update_flags updated)
-{
-	int x, length = rgd->ri.ri_length;
-
-	for (x = 0; x < length; x++)
-		brelse(rgd->bh[x], updated);
-}
-
-void gfs2_rgrp_free(osi_list_t *rglist, enum update_flags updated)
-{
-	struct rgrp_list *rgd;
-
-	while(!osi_list_empty(rglist->next)){
-		rgd = osi_list_entry(rglist->next, struct rgrp_list, list);
-		if (rgd->bh && rgd->bh[0] && /* if a buffer exists and       */
-			rgd->bh[0]->b_count) /* the 1st buffer is allocated */
-			gfs2_rgrp_relse(rgd, updated); /* free them all. */
-		if(rgd->bits)
-			free(rgd->bits);
-		if(rgd->bh) {
-			free(rgd->bh);
-			rgd->bh = NULL;
-		}
-		osi_list_del(&rgd->list);
-		free(rgd);
-	}
-}
diff --git a/gfs2/libgfs2/size.c b/gfs2/libgfs2/size.c
deleted file mode 100644
index 8fc0da6..0000000
--- a/gfs2/libgfs2/size.c
+++ /dev/null
@@ -1,82 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sys/mount.h>
-
-#include "libgfs2.h"
-
-#ifndef BLKGETSIZE64
-#define BLKGETSIZE64 _IOR(0x12, 114, size_t)
-#endif
-
-/**
- * do_device_size - determine the size of a Linux block device
- * @device: the path to the device node
- *
- * Returns: -1 on error (with errno set), 0 on success (with @bytes set)
- */
-
-static int
-do_device_size(int fd, uint64_t *bytes)
-{
-	off_t off;
-#if 0
-	int error;
-	unsigned long size;
-
-	error = ioctl(fd, BLKGETSIZE64, bytes);	/* Size in bytes */
-	if (!error)
-		return 0;
-
-	error = ioctl(fd, BLKGETSIZE, &size);	/* Size in 512-byte blocks */
-	if (!error) {
-		*bytes = ((uint64_t) size) << 9;
-		return 0;
-	}
-#endif
-	off = lseek(fd, 0, SEEK_END);
-	if (off >= 0) {
-		*bytes = off;
-		return 0;
-	}
-
-	return -1;
-}
-
-/**
- * device_size - figure out a device's size
- * @fd: the file descriptor of a device
- * @bytes: the number of bytes the device holds
- *
- * Returns: -1 on error (with errno set), 0 on success (with @bytes set)
- */
-
-int
-device_size(int fd, uint64_t *bytes)
-{
-	struct stat st;
-	int error;
-
-	error = fstat(fd, &st);
-	if (error)
-		return error;
-
-	if (S_ISREG(st.st_mode)) {
-		*bytes = st.st_size;
-		return 0;
-	} else if (S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode))
-		return do_device_size(fd, bytes);
-	else if (S_ISDIR(st.st_mode))
-		errno = EISDIR;
-	else
-		errno = EINVAL;
-
-	return -1;
-}
diff --git a/gfs2/libgfs2/structures.c b/gfs2/libgfs2/structures.c
deleted file mode 100644
index fdb9bdd..0000000
--- a/gfs2/libgfs2/structures.c
+++ /dev/null
@@ -1,597 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include <linux/types.h>
-
-#include "libgfs2.h"
-
-void build_master(struct gfs2_sbd *sdp)
-{
-	struct gfs2_inum inum;
-	uint64_t bn;
-	struct gfs2_buffer_head *bh;
-
-	bn = dinode_alloc(sdp);
-	inum.no_formal_ino = sdp->md.next_inum++;
-	inum.no_addr = bn;
-
-	bh = init_dinode(sdp, &inum, S_IFDIR | 0755, GFS2_DIF_SYSTEM, &inum);
-	
-	sdp->master_dir = inode_get(sdp, bh);
-
-	if (sdp->debug) {
-		printf("\nMaster dir:\n");
-		gfs2_dinode_print(&sdp->master_dir->i_di);
-	}
-}
-
-void
-build_sb(struct gfs2_sbd *sdp)
-{
-	unsigned int x;
-	struct gfs2_buffer_head *bh;
-	struct gfs2_sb sb;
-
-	/* Zero out the beginning of the device up to the superblock */
-	for (x = 0; x < sdp->sb_addr; x++) {
-		bh = bget(&sdp->buf_list, x);
-		memset(bh->b_data, 0, sdp->bsize);
-		brelse(bh, updated);
-	}
-
-	memset(&sb, 0, sizeof(struct gfs2_sb));
-	sb.sb_header.mh_magic = GFS2_MAGIC;
-	sb.sb_header.mh_type = GFS2_METATYPE_SB;
-	sb.sb_header.mh_format = GFS2_FORMAT_SB;
-	sb.sb_fs_format = GFS2_FORMAT_FS;
-	sb.sb_multihost_format = GFS2_FORMAT_MULTI;
-	sb.sb_bsize = sdp->bsize;
-	sb.sb_bsize_shift = ffs(sdp->bsize) - 1;
-	sb.sb_master_dir = sdp->master_dir->i_di.di_num;
-	sb.sb_root_dir = sdp->md.rooti->i_di.di_num;
-	strcpy(sb.sb_lockproto, sdp->lockproto);
-	strcpy(sb.sb_locktable, sdp->locktable);
-#ifdef GFS2_HAS_UUID
-	{
-		int fd = open("/dev/urandom", O_RDONLY);
-		int n;
-		if (fd >= 0)
-			n = read(fd, &sb.sb_uuid, 16);
-		if (fd < 0 || n != 16)
-			memset(&sb.sb_uuid, 0, 16);
-		close(fd);
-	}
-#endif
-	bh = bget(&sdp->buf_list, sdp->sb_addr);
-	gfs2_sb_out(&sb, bh->b_data);
-	brelse(bh, updated);
-
-	if (sdp->debug) {
-		printf("\nSuper Block:\n");
-		gfs2_sb_print(&sb);
-	}
-}
-
-void write_journal(struct gfs2_sbd *sdp, struct gfs2_inode *ip, unsigned int j,
-				   unsigned int blocks)
-{
-	struct gfs2_log_header lh;
-	unsigned int x;
-	uint64_t seq = RANDOM(blocks);
-	uint32_t hash;
-	unsigned int height;
-
-	/* Build the height up so our journal blocks will be contiguous and */
-	/* not broken up by indirect block pages.                           */
-	height = calc_tree_height(ip, (blocks + 1) * sdp->bsize);
-	build_height(ip, height);
-
-	memset(&lh, 0, sizeof(struct gfs2_log_header));
-	lh.lh_header.mh_magic = GFS2_MAGIC;
-	lh.lh_header.mh_type = GFS2_METATYPE_LH;
-	lh.lh_header.mh_format = GFS2_FORMAT_LH;
-	lh.lh_flags = GFS2_LOG_HEAD_UNMOUNT;
-
-	for (x = 0; x < blocks; x++) {
-		struct gfs2_buffer_head *bh = get_file_buf(ip, x, TRUE);
-		if (!bh)
-			die("write_journal\n");
-		brelse(bh, updated);
-	}
-	for (x = 0; x < blocks; x++) {
-		struct gfs2_buffer_head *bh = get_file_buf(ip, x, FALSE);
-		if (!bh)
-			die("write_journal\n");
-
-		lh.lh_sequence = seq;
-		lh.lh_blkno = x;
-		gfs2_log_header_out(&lh, bh->b_data);
-		hash = gfs2_disk_hash(bh->b_data, sizeof(struct gfs2_log_header));
-		((struct gfs2_log_header *)bh->b_data)->lh_hash = cpu_to_be32(hash);
-
-		brelse(bh, updated);
-
-		if (++seq == blocks)
-			seq = 0;
-	}
-
-	if (sdp->debug) {
-		printf("\nJournal %u:\n", j);
-		gfs2_dinode_print(&ip->i_di);
-	}
-}
-
-void
-build_jindex(struct gfs2_sbd *sdp)
-{
-	struct gfs2_inode *jindex;
-	unsigned int j;
-
-	jindex = createi(sdp->master_dir, "jindex", S_IFDIR | 0700,
-			 GFS2_DIF_SYSTEM);
-
-	for (j = 0; j < sdp->md.journals; j++) {
-		char name[256];
-		struct gfs2_inode *ip;
-
-		sprintf(name, "journal%u", j);
-		ip = createi(jindex, name, S_IFREG | 0600, GFS2_DIF_SYSTEM);
-		write_journal(sdp, ip, j,
-			      sdp->jsize << 20 >> sdp->sd_sb.sb_bsize_shift);
-		inode_put(ip, updated);
-	}
-
-	if (sdp->debug) {
-		printf("\nJindex:\n");
-		gfs2_dinode_print(&jindex->i_di);
-	}
-
-	inode_put(jindex, updated);
-}
-
-static void
-build_inum_range(struct gfs2_inode *per_node, unsigned int j)
-{
-	struct gfs2_sbd *sdp = per_node->i_sbd;
-	char name[256];
-	struct gfs2_inode *ip;
-
-	sprintf(name, "inum_range%u", j);
-	ip = createi(per_node, name, S_IFREG | 0600,
-		     GFS2_DIF_SYSTEM | GFS2_DIF_JDATA);
-	ip->i_di.di_size = sizeof(struct gfs2_inum_range);
-
-	if (sdp->debug) {
-		printf("\nInum Range %u:\n", j);
-		gfs2_dinode_print(&ip->i_di);
-	}
-
-	inode_put(ip, updated);
-}
-
-static void
-build_statfs_change(struct gfs2_inode *per_node, unsigned int j)
-{
-	struct gfs2_sbd *sdp = per_node->i_sbd;
-	char name[256];
-	struct gfs2_inode *ip;
-
-	sprintf(name, "statfs_change%u", j);
-	ip = createi(per_node, name, S_IFREG | 0600,
-		     GFS2_DIF_SYSTEM | GFS2_DIF_JDATA);
-	ip->i_di.di_size = sizeof(struct gfs2_statfs_change);
-
-	if (sdp->debug) {
-		printf("\nStatFS Change %u:\n", j);
-		gfs2_dinode_print(&ip->i_di);
-	}
-
-	inode_put(ip, updated);
-}
-
-static void
-build_quota_change(struct gfs2_inode *per_node, unsigned int j)
-{
-	struct gfs2_sbd *sdp = per_node->i_sbd;
-	struct gfs2_meta_header mh;
-	char name[256];
-	struct gfs2_inode *ip;
-	unsigned int blocks = sdp->qcsize << (20 - sdp->sd_sb.sb_bsize_shift);
-	unsigned int x;
-
-	memset(&mh, 0, sizeof(struct gfs2_meta_header));
-	mh.mh_magic = GFS2_MAGIC;
-	mh.mh_type = GFS2_METATYPE_QC;
-	mh.mh_format = GFS2_FORMAT_QC;
-
-	sprintf(name, "quota_change%u", j);
-	ip = createi(per_node, name, S_IFREG | 0600,
-		     GFS2_DIF_SYSTEM);
-
-	for (x = 0; x < blocks; x++) {
-		struct gfs2_buffer_head *bh = get_file_buf(ip, ip->i_di.di_size >> sdp->sd_sb.sb_bsize_shift, FALSE);
-		if (!bh)
-			die("build_quota_change\n");
-
-		gfs2_meta_header_out(&mh, bh->b_data);
-
-		brelse(bh, updated);
-	}
-
-	if (sdp->debug) {
-		printf("\nQuota Change %u:\n", j);
-		gfs2_dinode_print(&ip->i_di);
-	}
-
-	inode_put(ip, updated);
-}
-
-void
-build_per_node(struct gfs2_sbd *sdp)
-{
-	struct gfs2_inode *per_node;
-	unsigned int j;
-
-	per_node = createi(sdp->master_dir, "per_node", S_IFDIR | 0700,
-			   GFS2_DIF_SYSTEM);
-
-	for (j = 0; j < sdp->md.journals; j++) {
-		build_inum_range(per_node, j);
-		build_statfs_change(per_node, j);
-		build_quota_change(per_node, j);
-	}
-
-	if (sdp->debug) {
-		printf("\nper_node:\n");
-		gfs2_dinode_print(&per_node->i_di);
-	}
-
-	inode_put(per_node, updated);
-}
-
-void
-build_inum(struct gfs2_sbd *sdp)
-{
-	struct gfs2_inode *ip;
-
-	ip = createi(sdp->master_dir, "inum", S_IFREG | 0600,
-		     GFS2_DIF_SYSTEM | GFS2_DIF_JDATA);
-
-	if (sdp->debug) {
-		printf("\nInum Inode:\n");
-		gfs2_dinode_print(&ip->i_di);
-	}
-
-	sdp->md.inum = ip;
-}
-
-void
-build_statfs(struct gfs2_sbd *sdp)
-{
-	struct gfs2_inode *ip;
-
-	ip = createi(sdp->master_dir, "statfs", S_IFREG | 0600,
-		     GFS2_DIF_SYSTEM | GFS2_DIF_JDATA);
-
-	if (sdp->debug) {
-		printf("\nStatFS Inode:\n");
-		gfs2_dinode_print(&ip->i_di);
-	}
-
-	sdp->md.statfs = ip;
-}
-
-void
-build_rindex(struct gfs2_sbd *sdp)
-{
-	struct gfs2_inode *ip;
-	osi_list_t *tmp, *head;
-	struct rgrp_list *rl;
-	char buf[sizeof(struct gfs2_rindex)];
-	int count;
-
-	ip = createi(sdp->master_dir, "rindex", S_IFREG | 0600,
-		     GFS2_DIF_SYSTEM | GFS2_DIF_JDATA);
-	ip->i_di.di_payload_format = GFS2_FORMAT_RI;
-
-	for (head = &sdp->rglist, tmp = head->next;
-	     tmp != head;
-	     tmp = tmp->next) {
-		rl = osi_list_entry(tmp, struct rgrp_list, list);
-
-		gfs2_rindex_out(&rl->ri, buf);
-
-		count = gfs2_writei(ip, buf, ip->i_di.di_size,
-							sizeof(struct gfs2_rindex));
-		if (count != sizeof(struct gfs2_rindex))
-			die("build_rindex\n");
-	}
-
-	if (sdp->debug) {
-		printf("\nResource Index:\n");
-		gfs2_dinode_print(&ip->i_di);
-	}
-
-	inode_put(ip, updated);
-}
-
-void
-build_quota(struct gfs2_sbd *sdp)
-{
-	struct gfs2_inode *ip;
-	struct gfs2_quota qu;
-	char buf[sizeof(struct gfs2_quota)];
-	int count;
-
-	ip = createi(sdp->master_dir, "quota", S_IFREG | 0600,
-		     GFS2_DIF_SYSTEM | GFS2_DIF_JDATA);
-	ip->i_di.di_payload_format = GFS2_FORMAT_QU;
-
-	memset(&qu, 0, sizeof(struct gfs2_quota));
-	qu.qu_value = 1;
-	gfs2_quota_out(&qu, buf);
-
-	count = gfs2_writei(ip, buf, ip->i_di.di_size, sizeof(struct gfs2_quota));
-	if (count != sizeof(struct gfs2_quota))
-		die("do_init (2)\n");
-	count = gfs2_writei(ip, buf, ip->i_di.di_size, sizeof(struct gfs2_quota));
-	if (count != sizeof(struct gfs2_quota))
-		die("do_init (3)\n");
-
-	if (sdp->debug) {
-		printf("\nRoot quota:\n");
-		gfs2_quota_print(&qu);
-	}
-
-	inode_put(ip, updated);
-}
-
-void
-build_root(struct gfs2_sbd *sdp)
-{
-	struct gfs2_inum inum;
-	uint64_t bn;
-	struct gfs2_buffer_head *bh;
-
-	bn = dinode_alloc(sdp);
-	inum.no_formal_ino = sdp->md.next_inum++;
-	inum.no_addr = bn;
-
-	bh = init_dinode(sdp, &inum, S_IFDIR | 0755, 0, &inum);
-	sdp->md.rooti = inode_get(sdp, bh);
-
-	if (sdp->debug) {
-		printf("\nRoot directory:\n");
-		gfs2_dinode_print(&sdp->md.rooti->i_di);
-	}
-}
-
-void
-do_init(struct gfs2_sbd *sdp)
-{
-	{
-		struct gfs2_inode *ip = sdp->md.inum;
-		uint64_t buf;
-		int count;
-
-		buf = cpu_to_be64(sdp->md.next_inum);
-		count = gfs2_writei(ip, &buf, 0, sizeof(uint64_t));
-		if (count != sizeof(uint64_t))
-			die("do_init (1)\n");
-
-		if (sdp->debug)
-			printf("\nNext Inum: %"PRIu64"\n",
-			       sdp->md.next_inum);
-	}
-
-	{
-		struct gfs2_inode *ip = sdp->md.statfs;
-		struct gfs2_statfs_change sc;
-		char buf[sizeof(struct gfs2_statfs_change)];
-		int count;
-
-		sc.sc_total = sdp->blks_total;
-		sc.sc_free = sdp->blks_total - sdp->blks_alloced;
-		sc.sc_dinodes = sdp->dinodes_alloced;
-
-		gfs2_statfs_change_out(&sc, buf);
-		count = gfs2_writei(ip, buf, 0, sizeof(struct gfs2_statfs_change));
-		if (count != sizeof(struct gfs2_statfs_change))
-			die("do_init (2)\n");
-
-		if (sdp->debug) {
-			printf("\nStatfs:\n");
-			gfs2_statfs_change_print(&sc);
-		}
-	}
-}
-
-struct gfs2_inode *gfs2_load_inode(struct gfs2_sbd *sbp, uint64_t block)
-{
-	struct gfs2_buffer_head *bh;
-	struct gfs2_inode *ip;
-
-	bh = bread(&sbp->buf_list, block);
-	ip = inode_get(sbp, bh);
-	return ip;
-}
-
-int gfs2_check_meta(struct gfs2_buffer_head *bh, int type)
-{
-	uint32_t check_magic = ((struct gfs2_meta_header *)(bh->b_data))->mh_magic;
-	uint32_t check_type = ((struct gfs2_meta_header *)(bh->b_data))->mh_type;
-
-	check_magic = be32_to_cpu(check_magic);
-	check_type = be32_to_cpu(check_type);
-	if((check_magic != GFS2_MAGIC) || (type && (check_type != type)))
-		return -1;
-	return 0;
-}
-
-/*
- * set_meta - set the meta header of a buffer
- * @bh
- * @type
- *
- * Returns: 0 if ok, -1 on error
- */
-int gfs2_set_meta(struct gfs2_buffer_head *bh, int type, int format)
-{
-	struct gfs2_meta_header header;
-
-	if(!gfs2_check_meta(bh, 0)){
-		((struct gfs2_meta_header *)bh->b_data)->mh_type = cpu_to_be32(type);
-		((struct gfs2_meta_header *)bh->b_data)->mh_format = 
-			cpu_to_be32(format);
-	} else {
-		memset(&header, 0, sizeof(struct gfs2_meta_header));
-		header.mh_magic = GFS2_MAGIC;
-		header.mh_type = type;
-		header.mh_format = format;
-		
-		gfs2_meta_header_out(&header, bh->b_data);
-	}
-	return 0;
-}
-
-/**
- * gfs2_next_rg_meta
- * @rgd:
- * @block:
- * @first: if set, start at zero and ignore block
- *
- * The position to start looking from is *block.  When a block
- * is found, it is returned in block.
- *
- * Returns: 0 on success, -1 when finished
- */
-int gfs2_next_rg_meta(struct rgrp_list *rgd, uint64_t *block, int first)
-{
-	struct gfs2_bitmap *bits = NULL;
-	uint32_t length = rgd->ri.ri_length;
-	uint32_t blk = (first)? 0: (uint32_t)((*block+1)-rgd->ri.ri_data0);
-	int i;
-
-	if(!first && (*block < rgd->ri.ri_data0)) {
-		log_err("next_rg_meta:  Start block is outside rgrp bounds.\n");
-		exit(1);
-	}
-	for(i=0; i < length; i++){
-		bits = &rgd->bits[i];
-		if(blk < bits->bi_len*GFS2_NBBY)
-			break;
-		blk -= bits->bi_len*GFS2_NBBY;
-	}
-	for(; i < length; i++){
-		bits = &rgd->bits[i];
-		blk = gfs2_bitfit((unsigned char *)rgd->bh[i]->b_data +
-				  bits->bi_offset, bits->bi_len, blk,
-				  GFS2_BLKST_DINODE);
-		if(blk != BFITNOENT){
-			*block = blk + (bits->bi_start * GFS2_NBBY) + rgd->ri.ri_data0;
-			break;
-		}
-		blk=0;
-	}
-	if(i == length)
-		return -1;
-	return 0;
-}
-
-/**
- * gfs2_next_rg_meta_free - finds free or used metadata
- * @rgd:
- * @block:
- * @first: if set, start at zero and ignore block
- *
- * The position to start looking from is *block.  When a block
- * is found, it is returned in block.
- *
- * Returns: 0 on success, -1 when finished
- */
-int gfs2_next_rg_meta_free(struct rgrp_list *rgd, uint64_t *block, int first,
-						   int *mfree)
-{
-	gfs2_bitmap_t *bits = NULL;
-	uint32_t length = rgd->ri.ri_length;
-	uint32_t blk = (first)? 0: (uint32_t)((*block+1)-rgd->ri.ri_data0);
-	uint32_t iblk, ublk, fblk;
-	int i;
-	
-	if(!first && (*block < rgd->ri.ri_data0)) {
-		log_err("next_rg_meta_free:  Start block is outside rgrp bounds.\n");
-		exit(1);
-	}
-	for(i=0; i < length; i++){
-		bits = &rgd->bits[i];
-		if(blk < bits->bi_len*GFS2_NBBY)
-			break;
-		blk -= bits->bi_len*GFS2_NBBY;
-	}
-	for(; i < length; i++){
-		bits = &rgd->bits[i];
-
-		iblk = gfs2_bitfit((unsigned char *)rgd->bh[i]->b_data +
-						   bits->bi_offset, bits->bi_len, blk,
-						   GFS2_BLKST_DINODE);
-		ublk = gfs2_bitfit((unsigned char *)rgd->bh[i]->b_data +
-						   bits->bi_offset, bits->bi_len, blk,
-						   GFS2_BLKST_USED);
-		fblk = gfs2_bitfit((unsigned char *)rgd->bh[i]->b_data +
-						   bits->bi_offset, bits->bi_len, blk,
-						   GFS2_BLKST_FREE);
-		if(ublk < fblk) {
-            blk = ublk;
-            *mfree = 0;
-		}
-		else if(iblk < fblk) {
-            blk = iblk;
-            *mfree = 0;
-		} else {
-            blk = fblk;
-            *mfree = 1;
-		}
-		if(blk != BFITNOENT){
-            *block = blk + (bits->bi_start * GFS2_NBBY) + rgd->ri.ri_data0;
-            break;
-		}
-		blk=0;
-	}
-
-	if(i == length)
-		return -1;
-	return 0;
-}
-
-/**
- * next_rg_metatype
- * @rgd:
- * @block:
- * @type: the type of metadata we're looking for
- * @first: if set we should start at block zero and block is ignored
- *
- * Returns: 0 on success, -1 on error or finished
- */
-int gfs2_next_rg_metatype(struct gfs2_sbd *sdp, struct rgrp_list *rgd,
-						  uint64_t *block, uint32_t type, int first)
-{
-	struct gfs2_buffer_head *bh = NULL;
-
-	do{
-		if (bh)
-			brelse(bh, not_updated);
-		if (gfs2_next_rg_meta(rgd, block, first))
-			return -1;
-		bh = bread(&sdp->buf_list, *block);
-		first = 0;
-	} while(gfs2_check_meta(bh, type));
-	brelse(bh, not_updated);
-	return 0;
-}
diff --git a/gfs2/libgfs2/super.c b/gfs2/libgfs2/super.c
deleted file mode 100644
index d521f99..0000000
--- a/gfs2/libgfs2/super.c
+++ /dev/null
@@ -1,268 +0,0 @@
-#include <unistd.h>
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-#include "libgfs2.h"
-#include "osi_list.h"
-
-/**
- * check_sb - Check superblock
- * @sdp: the filesystem
- * @sb: The superblock
- *
- * Checks the version code of the FS is one that we understand how to
- * read and that the sizes of the various on-disk structures have not
- * changed.
- *
- * Returns: 0 on success, -1 on failure
- */
-int check_sb(struct gfs2_sb *sb)
-{
-	if (sb->sb_header.mh_magic != GFS2_MAGIC ||
-	    sb->sb_header.mh_type != GFS2_METATYPE_SB) {
-		log_crit("Either the super block is corrupted, or this "
-				 "is not a GFS2 filesystem\n");
-		log_debug("Header magic: %X Header Type: %X\n",
-				  sb->sb_header.mh_magic,
-				  sb->sb_header.mh_type);
-		return -EINVAL;
-	}
-	/*  If format numbers match exactly, we're done.  */
-	if (sb->sb_fs_format != GFS2_FORMAT_FS ||
-	    sb->sb_multihost_format != GFS2_FORMAT_MULTI) {
-		log_crit("Old gfs1 file system detected.\n");
-		return -EINVAL;
-	}
-	return 0;
-}
-
-
-/*
- * read_sb: read the super block from disk
- * sdp: in-core super block
- *
- * This function reads in the super block from disk and
- * initializes various constants maintained in the super
- * block
- *
- * Returns: 0 on success, -1 on failure.
- */
-int read_sb(struct gfs2_sbd *sdp)
-{
-	struct gfs2_buffer_head *bh;
-	uint64_t space = 0;
-	unsigned int x;
-	int error;
-
-	bh = bread(&sdp->buf_list, GFS2_SB_ADDR >> sdp->sd_fsb2bb_shift);
-	gfs2_sb_in(&sdp->sd_sb, bh->b_data);
-	brelse(bh, not_updated);
-
-	error = check_sb(&sdp->sd_sb);
-	if (error)
-		goto out;
-
-	sdp->sd_fsb2bb_shift = sdp->sd_sb.sb_bsize_shift - GFS2_BASIC_BLOCK_SHIFT;
-	sdp->bsize = sdp->sd_sb.sb_bsize;
-	sdp->sd_diptrs =
-		(sdp->sd_sb.sb_bsize-sizeof(struct gfs2_dinode)) /
-		sizeof(uint64_t);
-	sdp->sd_inptrs =
-		(sdp->sd_sb.sb_bsize-sizeof(struct gfs2_meta_header)) /
-		sizeof(uint64_t);
-	sdp->sd_jbsize = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_meta_header);
-	sdp->sd_heightsize[0] = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode);
-	sdp->sd_heightsize[1] = sdp->sd_sb.sb_bsize * sdp->sd_diptrs;
-	for (x = 2; ; x++){
-		space = sdp->sd_heightsize[x - 1] * sdp->sd_inptrs;
-		/* FIXME: Do we really need this first check?? */
-		if (space / sdp->sd_inptrs != sdp->sd_heightsize[x - 1] ||
-		    space % sdp->sd_inptrs != 0)
-			break;
-		sdp->sd_heightsize[x] = space;
-	}
-	if (x > GFS2_MAX_META_HEIGHT){
-		log_err("Bad max metadata height.\n");
-		error = -1;
-		goto out;
-	}
-
-	sdp->sd_jheightsize[0] = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode);
-	sdp->sd_jheightsize[1] = sdp->sd_jbsize * sdp->sd_diptrs;
-	for (x = 2; ; x++){
-		space = sdp->sd_jheightsize[x - 1] * sdp->sd_inptrs;
-		if (space / sdp->sd_inptrs != sdp->sd_jheightsize[x - 1] ||
-			space % sdp->sd_inptrs != 0)
-			break;
-		sdp->sd_jheightsize[x] = space;
-	}
-	sdp->sd_max_jheight = x;
-	if(sdp->sd_max_jheight > GFS2_MAX_META_HEIGHT) {
-		log_err("Bad max jheight.\n");
-		error = -1;
-	}
-	sdp->fssize = lseek(sdp->device_fd, 0, SEEK_END) / sdp->sd_sb.sb_bsize;
-
- out:
-
-	return error;
-}
-
-#define JOURNAL_NAME_SIZE 16
-
-/*
- * ji_update - fill in journal info
- * sdp: the incore superblock pointer
- *
- * Given the inode for the journal index, read in all
- * the journal inodes.
- *
- * Returns: 0 on success, -1 on failure
- */
-int ji_update(struct gfs2_sbd *sdp)
-{
-	struct gfs2_inode *jip, *ip = sdp->md.jiinode;
-	char journal_name[JOURNAL_NAME_SIZE];
-	int i;
-
-	if(!ip) {
-		log_crit("Journal inode not found.\n");
-		return -1;
-	}
-
-	if(!(sdp->md.journal = calloc(ip->i_di.di_entries - 2, sizeof(struct gfs2_inode *)))) {
-		log_err("Unable to allocate journal index\n");
-		return -1;
-	}
-	sdp->md.journals = 0;
-	memset(journal_name, 0, sizeof(*journal_name));
-	for(i = 0; i < ip->i_di.di_entries - 2; i++) {
-		/* FIXME check snprintf return code */
-		snprintf(journal_name, JOURNAL_NAME_SIZE, "journal%u", i);
-		gfs2_lookupi(sdp->md.jiinode, journal_name, strlen(journal_name), 
-					 &jip);
-		sdp->md.journal[i] = jip;
-	}
-	sdp->md.journals = ip->i_di.di_entries - 2;
-	return 0;
-
-}
-
-/**
- * rindex_read - read in the rg index file
- * @sdp: the incore superblock pointer
- * fd: optional file handle for rindex file (if meta_fs file system is mounted)
- *     (if fd is <= zero, it will read from raw device)
- * @count1: return count of the rgs.
- *
- * Returns: 0 on success, -1 on failure
- */
-int rindex_read(struct gfs2_sbd *sdp, int fd, int *count1)
-{
-	unsigned int rg;
-	int error;
-	struct gfs2_rindex buf;
-	struct rgrp_list *rgd, *prev_rgd;
-	uint64_t prev_length = 0;
-
-	*count1 = 0;
-	prev_rgd = NULL;
-	for (rg = 0; ; rg++) {
-		if (fd > 0)
-			error = read(fd, &buf, sizeof(struct gfs2_rindex));
-		else
-			error = gfs2_readi(sdp->md.riinode, (char *)&buf,
-					   rg * sizeof(struct gfs2_rindex),
-					   sizeof(struct gfs2_rindex));
-		if (!error)
-			break;
-		if (error != sizeof(struct gfs2_rindex))
-			return -1;
-
-		rgd = (struct rgrp_list *)malloc(sizeof(struct rgrp_list));
-		if (!rgd) {
-			log_crit("Cannot allocate memory for rindex.\n");
-			exit(-1);
-		}
-		memset(rgd, 0, sizeof(struct rgrp_list));
-		osi_list_add_prev(&rgd->list, &sdp->rglist);
-
-		gfs2_rindex_in(&rgd->ri, (char *)&buf);
-
-		rgd->start = rgd->ri.ri_addr;
-		if (prev_rgd) {
-			prev_length = rgd->start - prev_rgd->start;
-			prev_rgd->length = prev_length;
-		}
-
-		if(gfs2_compute_bitstructs(sdp, rgd))
-			return -1;
-
-		(*count1)++;
-		prev_rgd = rgd;
-	}
-	if (prev_rgd)
-		prev_rgd->length = prev_length;
-	return 0;
-}
-
-/**
- * ri_update - attach rgrps to the super block
- * @sdp: incore superblock data
- * fd: optional file handle for rindex (through the meta_fs)
- * @rgcount: returned count of rgs
- *
- * Given the rgrp index inode, link in all rgrps into the super block
- * and be sure that they can be read.
- *
- * Returns: 0 on success, -1 on failure.
- */
-int ri_update(struct gfs2_sbd *sdp, int fd, int *rgcount)
-{
-	struct rgrp_list *rgd;
-	osi_list_t *tmp;
-	int count1 = 0, count2 = 0;
-	uint64_t errblock = 0;
-
-	if (rindex_read(sdp, fd, &count1))
-	    goto fail;
-	for (tmp = sdp->rglist.next; tmp != &sdp->rglist; tmp = tmp->next) {
-		enum update_flags f;
-
-		f = not_updated;
-		rgd = osi_list_entry(tmp, struct rgrp_list, list);
-		errblock = gfs2_rgrp_read(sdp, rgd);
-		if (errblock)
-			return errblock;
-		else
-			gfs2_rgrp_relse(rgd, f);
-		count2++;
-	}
-
-	*rgcount = count1;
-	if (count1 != count2)
-		goto fail;
-
-	return 0;
-
- fail:
-	gfs2_rgrp_free(&sdp->rglist, not_updated);
-	return -1;
-}
-
-int write_sb(struct gfs2_sbd *sbp)
-{
-	struct gfs2_buffer_head *bh;
-
-	bh = bread(&sbp->buf_list, GFS2_SB_ADDR >> sbp->sd_fsb2bb_shift);
-	gfs2_sb_out(&sbp->sd_sb, bh->b_data);
-	brelse(bh, updated);
-	bcommit(&sbp->buf_list); /* make sure the change gets to disk ASAP */
-	bcommit(&sbp->nvbuf_list); /* make sure the change gets to disk ASAP */
-	return 0;
-}
-
diff --git a/gfs2/man/Makefile b/gfs2/man/Makefile
deleted file mode 100644
index cd0b53c..0000000
--- a/gfs2/man/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-TARGET= gfs2.8 \
-	gfs2_convert.8 \
-	gfs2_edit.8 \
-	gfs2_fsck.8 \
-	gfs2_grow.8 \
-	gfs2_jadd.8 \
-	gfs2_mount.8 \
-	gfs2_quota.8 \
-	gfs2_tool.8 \
-	mkfs.gfs2.8
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/man.mk
diff --git a/gfs2/man/gfs2.8 b/gfs2/man/gfs2.8
deleted file mode 100644
index f7fbc42..0000000
--- a/gfs2/man/gfs2.8
+++ /dev/null
@@ -1,40 +0,0 @@
-.TH gfs2 8
-
-.SH NAME
-gfs2 \- GFS2 reference guide
-
-.SH SYNOPSIS
-Overview of manpages and their locations
-
-.SH DESCRIPTION
-The GFS2 documentation has been split into a number of sections.  Please
-refer to the table below to determine which man page coincides with the
-command/feature you are looking for.
-.TP 16
-gfs2
-GFS2 overview (this man page)
-.TP
-gfs2_mount
-Mounting a GFS2 file system
-.TP
-gfs2_edit
-A GFS2 debug tool (use with caution)
-.TP
-gfs2_fsck
-The GFS2 file system checker
-.TP
-gfs2_grow
-Growing a GFS2 file system
-.TP
-gfs2_jadd
-Adding a journal to a GFS2 file system
-.TP
-mkfs.gfs2
-Make a GFS2 file system
-.TP
-gfs2_quota
-Manipulate GFS2 disk quotas 
-.TP
-gfs2_tool
-Tool to manipulate a GFS2 file system
-
diff --git a/gfs2/man/gfs2_convert.8 b/gfs2/man/gfs2_convert.8
deleted file mode 100644
index 059863b..0000000
--- a/gfs2/man/gfs2_convert.8
+++ /dev/null
@@ -1,46 +0,0 @@
-.TH gfs2_convert 8
-
-.SH NAME
-gfs2_convert - Convert a GFS1 filesystem to GFS2
-
-.SH SYNOPSIS
-.B gfs2_convert
-[\fIOPTION\fR]... \fIDEVICE\fR
-
-.SH DESCRIPTION
-gfs2_convert is used to convert a filesystem from GFS1 to GFS2.
-
-.SH OPTIONS
-.TP
-\fB-h\fP
-Help.
-
-This prints out the proper command line usage syntax.
-.TP
-\fB-q\fP
-Quiet.  Print less information while running.
-.TP
-\fB-n\fP
-No to all questions.
-.TP
-\fB-V\fP
-Print program Version information only.
-
-Print out the current version name.
-.TP
-\fB-v\fP
-Verbose operation.
-
-Print more information while running.
-.TP
-\fB-y\fP
-Yes to all questions.
-
-By specifying this option, gfs2_convert will not prompt before making
-changes.
-
-.SH EXAMPLE
-.TP
-gfs2_convert /dev/vg0/lvol0
-This will convert the Global File System on the block device
-"/dev/vg0/lvol0" to gfs2 format.
diff --git a/gfs2/man/gfs2_edit.8 b/gfs2/man/gfs2_edit.8
deleted file mode 100644
index ef2d931..0000000
--- a/gfs2/man/gfs2_edit.8
+++ /dev/null
@@ -1,319 +0,0 @@
-.TH gfs2_edit 8
-
-.SH NAME
-gfs2_edit - Display, print or edit GFS2 or GFS internal structures.
-
-.SH SYNOPSIS
-.B gfs2_edit
-[\fIOPTION\fR]... [\fIDEVICE\fR]
-
-.SH DESCRIPTION
-The gfs2_edit command is a tool used to examine, edit or
-display internal data structures of a GFS2 or GFS file system.
-The gfs2_edit command can be run interactively, as described
-below in INTERACTIVE MODE.
-
-Caution: Several options of the gfs2_edit command alter the
-file system metadata and can cause file system corruption.
-These options should be used with great care.
-
-.SH OPTIONS
-.TP
-\fB-p\fP [\fIstructure\fR | \fIblock\fR]
-Print a gfs2 data structure in human-readable format to stdout.
-You can enter either a block number or a data structure name.  Block numbers
-may be specified in hex (e.g., 0x10) or decimal (e.g., 16).
-
-You can specify the following data structure names with the -p option.
-
-\fIsb\fR, \fIsuperblock\fR - Print the superblock.
-
-\fIroot\fR - Print the root directory.
-
-\fImaster\fR - Print the master system directory.
-
-\fIjindex\fR - Print the journal index system directory.
-
-\fIper_node\fR - Print the per_node system directory.
-
-\fIinum\fR - Print the system inum file.
-
-\fIstatfs\fR - Print the system statfs file.
-
-\fIrindex\fR, \fIrgindex\fR - Print the resource group index system file.
-
-\fIrg X\fR - Print the resource group information for RG X (zero-based).
-
-\fIrgs\fR - Print the resource group information.
-
-\fIquota\fR - Print the contents of the system quota file.
-
-\fIidentify\fR - Identify a data block rather than print the block's contents.
-
-\fIsize\fR - Print the device size information.
-
-\fIjournalX\fR - Print the contents of journal X, where X is a journal
-number from 0 to <the number of journals in your file system - 1>.
-Only the journal headers and journal descriptors are dumped.  For journal
-descriptors, this option prints out every file system block number logged
-in that section of the journal.  The actual journaled blocks are not printed.
-
-If you specify a block number rather than a structure name, gfs2_edit will
-print out a breakdown of the structure for that block.
-For example: \fBgfs2_edit -p sb\fP will print the superblock, but so does
-\fBgfs2_edit -p 0x10\fP and \fBgfs2_edit -p 16\fP.
-
-If you specify -p without a block or structure name, gfs2_edit prints the
-superblock.
-
-You can specify more than one data structure with a single -p option.
-For example, "gfs2_edit -p inum statfs /dev/sda1" prints the system inum
-file and the system statfs file on /dev/sda1.
-
-.TP
-\fB-s\fP [\fIstructure\fR | \fIblock\fR]
-Specify a starting block for interactive mode.  Any of the keywords found
-in the -p option may be specified.  If you want to start on a particular
-resource group, specify it in quotes.  For example, gfs2_edit -s "rg 3"
-.TP
-\fB-h, -help, -usage\fP
-Print help information.
-.TP
-\fB-c\fP [\fI0\fR | \fI1\fR]
-Use alternate color scheme for interactive mode: 0=normal (dark colors on
-white background), or 1 (light colors on black background).
-.TP
-\fB-V\fP
-Print program version information only.
-.TP
-\fB-x\fP
-Print in hex mode.
-
-.TP
-\fBrg\fP \fI<rg>\fR \fI<device>\fR
-Print the contents of Resource Group \fI<rg>\fR on \fI<device>\fR.
-
-\fI<rg>\fR is a number from 0 to X - 1, where X is the number of RGs.
-.TP
-\fBrgcount\fP \fI<device>\fR
-Print the number of Resource Groups in the file system on \fI<device>\fR.
-.TP
-\fBrgflags\fP \fI<rg>\fR [\fInew_value\fR] \fI<device>\fR
-Print and/or modify the rg_flags value of Resource Group \fI<rg>\fR on
-\fI<device>\fR.
-
-\fI<rg>\fR is a number from 0 to X - 1, where X is the number of RGs.
-If \fInew_value\fR is not specified, the current rg_flags value will be
-printed but not modified.  If \fInew_value\fR is specified, the rg_flags
-field will be overwritten with the new value.
-.TP
-\fBprintsavedmeta\fP \fI<filename>\fR
-Print off a list of blocks from <filename> that were saved with the savemeta
-option.
-.TP
-\fBsavemeta\fP \fI<device>\fR \fI<filename>\fR
-Save off the GFS2 metadata (not user data) for the file system on the
-specified device to a file given by <filename>.  You can use this option
-to analyze file system problems without revealing sensitive information
-that may be contained in the files.  This option works quickly by
-using the system bitmap blocks in the resource groups to determine the
-location of all the metadata.  If there is corruption
-in the bitmaps, resource groups or rindex file, this method may fail and
-you may need to use the savemetaslow option.
-The destination file is not compressed.  You may want to compress it
-with a program such as bzip2 before sending it for analysis.
-.TP
-\fBsavemetaslow\fP \fI<device>\fR \fI<filename>\fR
-Save off GFS2 metadata, as with the savemeta option, examining every
-block in the file system for metadata.  This option is less prone to failure
-due to file system corruption than the savemeta option, but it is 
-extremely slow.
-.TP
-\fBsavergs\fP \fI<device>\fR \fI<filename>\fR
-Save off only the GFS2 resource group metadata for the file system on the
-specified device to a file given by <filename>.
-.TP
-\fBrestoremeta\fP \fI<filename>\fR \fI<dest device>\fR
-Take a file created with the savemeta option and restores its
-contents on top of the specified destination device.  \fBWARNING\fP:
-When you use this option, the file system and all data on the 
-destination device is destroyed.  Since only metadata (but no data) 
-is restored, every file in the resulting file system is likely to be
-corrupt.  The ONLY purpose of this option is to examine and debug file
-system problems by restoring and examining the state of the saved metadata.
-If the destination file system is the same size or larger than the source
-file system where the metadata was saved, the resulting file system
-will be the same size as the source.  If the destination device is
-smaller than the source file system, gfs2_edit will restore as much as
-it can, then quit, leaving you with a file system that probably will not
-mount, but from which you might still be able to figure out what is
-wrong with the source file system.
-
-.SH INTERACTIVE MODE
-If you specify a device on the gfs2_edit command line and you specify
-no options other than -c, gfs2_edit will act as an interactive GFS2
-file system editor for the file system you specify.  There
-are three display modes: hex mode, structure mode and pointers mode.
-You use the m key to switch between the modes, as described below.
-The modes are as follows:
-.TP
-Hex mode (default)
-Display or edit blocks of the file system in hexadecimal and ascii.
-
-Lines at the top indicate the currently displayed block in both hex and
-decimal.  If the block contains a GFS2 data structure, the name of that
-structure will appear in the upper right corner of the display.
-If the block is a well-known block, such as the superblock or rindex,
-there will be a line to indicate what it is.
-
-In hex mode, you can edit blocks by pressing \fB<enter>\fP and entering
-hexadecimal digits to replace the highlighted hex digits.  Do NOT precede
-the numbers with "0x".  For example, if you want to change the value at
-offset 0x60 from a 0x12 to 0xef, position your cursor to offset 0x60,
-so that the 12 is highlighted, then press \fB<enter>\fP and type in "ef".
-Press \fB<escape>\fP or \fB<enter>\fP to exit edit mode.
-
-In hex mode, different colors indicate different things.
-For example, in the default color scheme, the GFS2 data structure will
-be black, data offsets will be light blue, and actual data (anything after
-the gfs2 data structure) will be red.
-
-.TP
-Structure mode
-Decode the file system block into its GFS2 structure and
-display the values of that structure.  This mode is most useful for
-jumping around the file system.  For example, you can use the arrow 
-keys to position down to a pointer and press \fBJ\fP to jump to that block.
-
-.TP
-Pointers mode
-Display any additional information appearing on the block.
-For example, if an inode has block pointers, this will display them and
-allow you to scroll through them.  You can also position to one of them
-and press \fBJ\fP to jump to that block.
-
-.SH Interactive mode command keys:
-.TP
-\fBq\fP or \fB<esc>\fP
-The \fBq\fP or \fB<escape>\fP keys are used to exit gfs2_edit.
-
-.TP
-\fB<arrow/movement keys>\fP up, down, right, left, pg-up, pg-down, home, end
-The arrow keys are used to highlight an area of the display.  The \fBJ\fP
-key may be used to jump to the block that is highlighted.
-
-.TP
-\fBm\fP - Mode switch
-The \fBm\fP key is used to switch between the three display modes.
-The initial mode is hex mode.  Pressing the \fBm\fP key once switches to
-structure mode.  Pressing it a second time switches from structure mode
-to pointers mode.  Pressing it a third time takes you back to hex mode again.
-
-.TP
-\fBj\fP - Jump to block
-The \fBj\fP key jumps to the block number that is currently highlighted.
-In hex mode, hitting J will work when any byte of the pointer is highlighted.
-
-.TP
-\fBg\fP - Goto block
-The \fBg\fP key asks for a block number, then jumps there.  Note that
-in many cases, you can also arrow up so that the current block number
-is highlighted, then press \fB<enter>\fP to enter a block number to jump to.
-
-.TP
-\fBh\fP - Help display
-The \fBh\fP key causes the interactive help display to be shown.
-
-.TP
-\fBe\fP - Extended mode
-The \fBe\fP key causes gfs2_edit to switch to extended ("pointers") mode.
-
-.TP
-\fBc\fP - Color scheme
-The \fBc\fP key causes gfs2_edit to switch to its alternate color scheme.
-
-.TP
-\fBf\fP - Forward block
-The \fBf\fP key causes you to scroll forward one block.  This does
-not affect the "jump" status.  In other words, if you use the \fBf\fP
-key to move forward several blocks, pressing \fB<backspace>\fP will
-not roll you back up.
-
-.TP
-\fB<enter>\fP - Edit value
-The \fB<enter>\fP key causes you to go from display mode to edit mode.
-If you are in hex mode and you hit enter, you can type new hex values
-at the cursor's current location.  Note: Currently hitting \fB<enter>\fP
-in structure mode allows you to enter a new value, but it will not actually
-change the value on disk.  That is a future feature.
-
-.TP
-\fB<home>\fP
-If you are in pointers mode, this takes you back to the starts of the
-pointers you are viewing.  Otherwise it takes you back to the superblock.
-
-.TP
-\fB<backspace>\fP
-This takes you back to the block you were displaying before a jump.
-
-.TP
-\fB<space>\fP
-This takes you forward to the block you were displaying when you hit
-\fB<backspace>\fP.
-
-.SH EXAMPLES
-.TP
-gfs2_edit /dev/roth_vg/roth_lv
-Display and optionally edit the file system on /dev/roth_vg/roth_lv
-
-.TP
-gfs2_edit -p sb /dev/vg0/lvol0
-Print the superblock of the gfs2 file system located on
-/dev/vg0/lvol0.
-
-.TP
-gfs2_edit -p identify 2746 2748 /dev/sda2
-Print out what kind of blocks are at block numbers 2746 and 2748 on
-device /dev/sda2.
-
-.TP
-gfs2_edit -p rindex /dev/sda1
-Print the resource group index system file located on device
-/dev/sda1.
-
-.TP
-gfs2_edit savemeta /dev/sda1 /tmp/our_fs
-Save off all metadata (but no user data) to file /tmp/our_fs.
-
-.TP
-gfs2_edit -p root /dev/my_vg/my_lv
-Print the contents of the root directory in /dev/my_vg/my_lv.
-
-.TP
-gfs2-edit -x -p 0x3f7a /dev/sda1
-Print the contents of block 16250 of /dev/sda1 in hex.
-
-.TP
-gfs2_edit -p 12345 /dev/sdc2
-Print the gfs2 data structure at block 12345.
-
-.TP
-gfs2_edit rgcount /dev/sdb1
-Print how many Resource Groups exist for /dev/sdb1.
-
-.TP
-gfs2_edit -p rg 17 /dev/sdb1
-Print the contents of the eighteenth Resource Group on /dev/sdb1.
-
-.TP
-gfs2_edit rgflags 3 /dev/sdb1
-Print the rg_flags value for the fourth Resource Group on /dev/sdb1.
-
-.TP
-gfs2_edit rgflags 3 8 /dev/sdb1
-Set the GFS2_RGF_NOALLOC flag on for the fourth Resource Group on /dev/sdb1.
-
-.SH KNOWN BUGS
-.TP
-The directory code does not work well.  It might be confused
-by directory "sentinel" entries.
diff --git a/gfs2/man/gfs2_fsck.8 b/gfs2/man/gfs2_fsck.8
deleted file mode 100644
index 4d7e612..0000000
--- a/gfs2/man/gfs2_fsck.8
+++ /dev/null
@@ -1,59 +0,0 @@
-.TH gfs2_fsck 8
-
-.SH NAME
-gfs2_fsck - Offline GFS2 file system checker
-
-.SH SYNOPSIS
-.B gfs2_fsck
-[\fIOPTION\fR]... \fIDEVICE\fR
-
-.SH WARNING
-All GFS2 nodes \fImust\fP have the GFS2 filesystem unmounted before running
-gfs2_fsck.  Failure to unmount all nodes may result in filesystem corruption.
-
-.SH DESCRIPTION
-gfs2_fsck will check that the GFS2 file system on a device is structurally valid.
-It should not be run on a mounted file system.  If file system corruption is
-detected, it will attempt to repair the file system.  There is a limit to what
-gfs2_fsck can do.  If important file system structures are destroyed, such that
-the checker cannot determine what the repairs should be, reparations could
-fail.
-
-GFS2 is a journaled file system, and as such should be able to repair damages to
-the file system on its own.  However, faulty hardware has the ability to write
-incomplete blocks to a file system thereby causing corruption that GFS2 cannot
-fix.  The first step to ensuring a healthy file system is the selection of
-reliable hardware (i.e. storage systems that will write complete blocks - even
-in the event of power failure).
-
-.SH OPTIONS
-.TP
-\fB-h\fP
-Help.
-
-This prints out the proper command line usage syntax.
-.TP
-\fB-q\fP
-Quiet.
-.TP
-\fB-n\fP
-No to all questions.
-
-By specifying this option, gfs2_fsck will only show the changes that
-would be made, but not make any changes to the filesystem.
-.TP
-\fB-V\fP
-Version.
-
-Print out the program version information.
-.TP
-\fB-v\fP
-Verbose operation.
-
-Print more information while running.
-.TP
-\fB-y\fP
-Yes to all questions.
-
-By specifying this option, gfs2_fsck will not prompt before making
-changes.
diff --git a/gfs2/man/gfs2_grow.8 b/gfs2/man/gfs2_grow.8
deleted file mode 100644
index acf5c0b..0000000
--- a/gfs2/man/gfs2_grow.8
+++ /dev/null
@@ -1,60 +0,0 @@
-.TH gfs2_grow 8
-
-.SH NAME
-gfs2_grow - Expand a GFS2 filesystem
-
-.SH SYNOPSIS
-.B gfs2_grow
-[\fIOPTION\fR]... <\fIDEVICE\fR|\fIMOINTPOINT\fR>...
-
-.SH DESCRIPTION
-gfs2_grow is used to expand a GFS2 filesystem after the device
-upon which the filesystem resides has also been expanded.  By
-running gfs2_grow on a GFS2 filesystem, you are requesting that
-any spare space between the current end of the filesystem and
-the end of the device is filled with a newly initialized GFS2
-filesystem extension.  When this operation is complete, the resource
-index for the filesystem is updated so that all nodes in the
-cluster can use the extra storage space which has been added.
-
-You may only run gfs2_grow on a mounted filesystem; expansion of 
-unmounted filesystems is not supported.  You only need to
-run gfs2_grow on one node in the cluster.  All the other nodes will
-see the expansion has occurred and automatically start to use the
-newly available space.
-
-You must be superuser to execute \fBgfs2_grow\fP.  The gfs2_grow
-tool tries to prevent you from corrupting your filesystem by checking as
-many of the likely problems as it can.  When expanding a filesystem,
-only the last step of updating the resource index affects the currently
-mounted filesystem and so failure part way through the expansion process
-should leave your filesystem in its original unexpanded state.
-
-You can run gfs2_grow with the \fB-T\fP flag to get a display
-of the current state of a mounted GFS2 filesystem.
-
-.SH OPTIONS
-.TP
-\fB-D\fP
-Print out debugging information about the filesystem layout.
-.TP
-\fB-h\fP
-Prints out a short usage message and exits.
-.TP
-\fB-q\fP
-Be quiet.  Don't print anything.
-.TP
-\fB-r MegaBytes\fP
-gfs2_grow will try to make the new Resource Groups about this big.
-The default is 256 MB.
-.TP
-\fB-T\fP
-Test. Do all calculations, but do not write any data to the disk and do
-not expand the filesystem. This is used to discover what the tool would
-have done were it run without this flag.
-.TP
-\fB-V\fP
-Version. Print out version information, then exit.
-
-.SH SEE ALSO
-gfs2_mkfs(8) gfs2_jadd(8)
diff --git a/gfs2/man/gfs2_jadd.8 b/gfs2/man/gfs2_jadd.8
deleted file mode 100644
index 0e24648..0000000
--- a/gfs2/man/gfs2_jadd.8
+++ /dev/null
@@ -1,60 +0,0 @@
-.TH gfs2_jadd 8
-
-.SH NAME
-gfs2_jadd \- Add journals to a GFS2 filesystem
-
-.SH SYNOPSIS
-.B gfs2_jadd
-[\fIOPTION\fR]... <\fIDEVICE\fR|\fIMOINTPOINT\fR>...
-
-.SH DESCRIPTION
-\fIgfs2_jadd\fR is used to add journals (and a few other per-node
-files) to a GFS2 filesystem.  When this operation is complete, the
-journal index is updated so that machines mounting the filesystem at a
-later date will see the newly created journals in addition to the
-journals already there. Machines which are already running in the
-cluster are unaffected.
-
-You may only run \fIgfs2_jadd\fR on a mounted filesystem, addition of
-journals to unmounted filesystems is not supported.  You only need to
-run \fIgfs2_jadd\fR on one node in the cluster. All the other nodes
-will see the expansion has occurred when required.
-
-You must be superuser to execute \fIgfs2_jadd\fR. The \fIgfs2_jadd\fR
-tool tries to prevent you from corrupting your filesystem by checking
-as many of the likely problems as it can. When growing a filesystem,
-only the last step of updating the journal index affects the currently
-mounted filesystem and so failure part way through the expansion
-process should leave your filesystem in its original state.
-
-.SH OPTIONS
-.TP
-\fB-c MegaBytes\fP
-Initial size of each journal's quota change file
-.TP
-\fB-D\fP
-Print out debugging information about the filesystem layout.
-.TP
-\fB-h\fP
-Prints out a short usage message and exits.
-.TP
-\fB-J size\fP
-The size of the new journals in megabytes. The defaults to 32MB (the
-minimum size allowed is 8MB). If you want to add journals of different
-sizes to the filesystem, you'll need to run gfs2_jadd once for each
-different size of journal.
-.TP
-\fB-j num\fP
-The number of new journals to add.
-.TP
-\fB-q\fP
-Be quiet.  Don't print anything.
-.TP
-\fB-u MegaBytes\fP
-Initial size of each journal's unlinked tag file
-.TP
-\fB-V\fP
-Version. Print version information, then exit.
-.
-.SH SEE ALSO
-gfs2_mkfs(8) gfs2_grow(8)
diff --git a/gfs2/man/gfs2_mount.8 b/gfs2/man/gfs2_mount.8
deleted file mode 100644
index 95284c4..0000000
--- a/gfs2/man/gfs2_mount.8
+++ /dev/null
@@ -1,202 +0,0 @@
-.TH gfs2_mount 8
-
-.SH NAME
-gfs2_mount - GFS2 mount options
-
-.SH SYNOPSIS
-.B mount
-[\fIStandardMountOptions\fR] \fB-t\fP gfs2 \fIDEVICE\fR \fIMOUNTPOINT\fR \fB-o\fP [GFS2Option1,GFS2Option2,GFS2OptionX...]
-
-.SH DESCRIPTION
-GFS2 may be used as a local (single computer) filesystem, but its real purpose
-is in clusters, where multiple computers (nodes) share a common storage device.
-
-Above is the format typically used to mount a GFS2 filesystem, using the
-\fBmount\fP(8) command.  The \fIdevice\fR may be any block device on which you
-have created a GFS2 filesystem.  Examples include a
-single disk partition (e.g. /dev/sdb3), a loopback device, a device exported
-from another node (e.g. an iSCSI device or a \fBgnbd\fP(8) device), or a
-logical volume (typically comprised of a number of individual disks).
-
-\fIdevice\fR does not necessarily need to match the device name as seen on
-another node in the cluster, nor does it need to be a logical volume.  However,
-the use of a cluster-aware volume manager such as CLVM2 (see \fBlvm\fP(8))
-will guarantee that the managed devices are named identically on each node in a
-cluster (for much easier management), and will allow you to configure a very
-large volume from multiple storage units (e.g. disk drives).
-
-\fIdevice\fR must make the entire filesystem storage area visible to the
-computer.  That is, you cannot mount different parts of a single filesystem on
-different computers.  Each computer must see an entire filesystem.  You
-may, however, mount several GFS2 filesystems if you want to distribute your
-data storage in a controllable way.
-
-\fImountpoint\fR is the same as \fIdir\fR in the \fBmount\fP(8) man page.
-
-This man page describes GFS2-specific options that can be passed to the GFS2 
-file system at mount time, using the \fB-o\fP flag.  There are many other
-\fB-o\fP options handled by the generic mount command \fBmount\fP(8).
-However, the options described below are specifically for GFS2, and are not
-interpreted by the mount command nor by the kernel's Virtual File System.  GFS2
-and non-GFS2 options may be intermingled after the \fB-o\fP, separated by
-commas (but no spaces).
-
-As an alternative to mount command line options, you may send mount
-options to gfs2 using "gfs2_tool margs" (after loading the gfs2 kernel
-module, but before mounting GFS2).  For example, you may need to do
-this when working from an initial ramdisk \fBinitrd\fP(4).  The
-options are restricted to the ones described on this man page (no
-general \fBmount\fP(8) options will be recognized), must not be
-preceded by -o, and must be separated by commas (no spaces).  Example:
-
-# gfs2_tool margs "lockproto=lock_nolock,ignore_local_fs"
-
-Options loaded via "gfs2_tool margs" have a lifetime of only one GFS2
-mount.  If you wish to mount another GFS2 filesystem, you must set
-another group of options with "gfs2_tool margs".
-
-The options debug, acl, quota, suiddir, and data can be
-changed after mount using the "mount -o remount,option /mountpoint" command.
-The options debug, acl, and suiddir support the "no"
-prefix.  For example, "noacl" turns off what "acl" turns on.
-
-If you have trouble mounting GFS2, check the syslog (e.g. /var/log/messages)
-for specific error messages.
-
-.SH OPTIONS
-.TP
-\fBlockproto=\fP\fILockModuleName\fR
-This specifies which inter-node lock protocol is used by the GFS2 filesystem
-for this mount, overriding the default lock protocol name stored in the
-filesystem's on-disk superblock.
-
-The \fILockModuleName\fR must be an exact match of the protocol name presented
-by the lock module when it registers with the lock harness.  Traditionally,
-this matches the .o filename of the lock module, e.g. \fIlock_dlm\fR,
-or \fIlock_nolock\fR.
-
-The default lock protocol name is written to disk initially when creating the
-filesystem with \fBgfs2_mkfs\fP(8), -p option.  It can be changed on-disk by
-using the \fBgfs2_tool\fP(8) utility's \fBsb proto\fP command.
-
-The \fBlockproto\fP mount option should be used only under special
-circumstances in which you want to temporarily use a different lock protocol
-without changing the on-disk default.
-.TP
-\fBlocktable=\fP\fILockTableName\fR
-This specifies the identity of the cluster and of the filesystem for this
-mount, overriding the default cluster/filesystem identify stored in the
-filesystem's on-disk superblock.  The cluster/filesystem name is recognized
-globally throughout the cluster, and establishes a unique namespace for
-the inter-node locking system, enabling the mounting of multiple GFS2
-filesystems.
-
-The format of \fILockTableName\fR is lock-module-specific.  For
-lock_dlm, the format is \fIclustername:fsname\fR.  For
-lock_nolock, the field is ignored.
-
-The default cluster/filesystem name is written to disk initially when creating
-the filesystem with \fBgfs2_mkfs\fP(8), -t option.  It can be changed on-disk
-by using the \fBgfs2_tool\fP(8) utility's \fBsb table\fP command.
-
-The \fBlocktable\fP mount option should be used only under special
-circumstances in which you want to mount the filesystem in a different cluster,
-or mount it as a different filesystem name, without changing the on-disk
-default.
-.TP
-\fBlocalcaching\fP
-This flag tells GFS2 that it is running as a local (not clustered) filesystem,
-so it can turn on some block caching optimizations that can't be used when
-running in cluster mode.
-
-This is turned on automatically by the lock_nolock module,
-but can be overridden by using the \fBignore_local_fs\fP option.
-.TP
-\fBlocalflocks\fP
-This flag tells GFS2 that it is running as a local (not clustered) filesystem,
-so it can allow the kernel VFS layer to do all flock and fcntl file locking.
-When running in cluster mode, these file locks require inter-node locks,
-and require the support of GFS2.  When running locally, better performance
-is achieved by letting VFS handle the whole job.
-
-This is turned on automatically by the lock_nolock module,
-but can be overridden by using the \fBignore_local_fs\fP option.
-.TP
-\fBdebug\fP
-Causes GFS2 to oops when encountering an error that would cause the
-mount to withdraw or print an assertion warning.  This option should
-probably not be used in a production system. 
-.TP
-\fBignore_local_fs\fP
-By default, using the nolock lock module automatically turns on the
-\fBlocalcaching\fP and \fBlocalflocks\fP optimizations.  \fBignore_local_fs\fP
-forces GFS2 to treat the filesystem as if it were a multihost (clustered)
-filesystem, with \fBlocalcaching\fP and \fBlocalflocks\fP optimizations
-turned off.
-.TP
-\fBupgrade\fP
-This flag tells GFS2 to upgrade the filesystem's on-disk format to the version
-supported by the current GFS2 software installation on this computer.
-If you try to mount an old-version disk image, GFS2 will notify you via a syslog
-message that you need to upgrade.  Try mounting again, using the
-\fB-o upgrade\fP option.  When upgrading, only one node may mount the GFS2
-filesystem.
-.TP
-\fBnum_glockd=\fP\fINumber\fR
-Tunes GFS2 to alleviate memory pressure when rapidly acquiring many locks (e.g.
-several processes scanning through huge directory trees).  GFS2' glockd kernel
-daemon cleans up memory for no-longer-needed glocks.  Multiple instances
-of the daemon clean up faster than a single instance.  The default value is
-one daemon, with a maximum of 16.  Since this option was introduced, other
-methods of rapid cleanup have been developed within GFS2, so this option may go
-away in the future.
-.TP
-\fBacl\fP
-Enables POSIX Access Control List \fBacl\fP(5) support within GFS2.
-.TP
-\fBspectator\fP
-Mount this filesystem using a special form of read-only mount.  The mount
-does not use one of the filesystem's journals.
-.TP
-\fBsuiddir\fP
-Sets owner of any newly created file or directory to be that of parent
-directory, if parent directory has S_ISUID permission attribute bit set.
-Sets S_ISUID in any new directory, if its parent directory's S_ISUID is set.
-Strips all execution bits on a new file, if parent directory owner is different
-from owner of process creating the file.  Set this option only if you know
-why you are setting it.
-.TP
-\fBquota=\fP\fI[off/account/on]\fR
-Turns quotas on or off for a filesystem.  Setting the quotas to be in
-the "account" state causes the per UID/GID usage statistics to be
-correctly maintained by the filesystem, limit and warn values are
-ignored.  The default value is "off".
-.TP
-\fBdata=\fP\fI[ordered/writeback]\fR
-When data=ordered is set, the user data modified by a transaction is
-flushed to the disk before the transaction is committed to disk.  This
-should prevent the user from seeing uninitialized blocks in a file
-after a crash.  Data=writeback mode writes the user data to the disk
-at any time after it's dirtied.  This doesn't provide the same
-consistency guarantee as ordered mode, but it should be slightly
-faster for some workloads.  The default is ordered mode.
-
-.SH LINKS
-.TP 30
-http://sources.redhat.com/cluster
--- home site of GFS2
-.TP
-http://www.suse.de/~agruen/acl/linux-acls/
--- good writeup on ACL support in Linux
-
-.SH SEE ALSO
-
-\fBgfs2\fP(8), 
-\fBmount\fP(8) for general mount options,
-\fBchmod\fP(1) and \fBchmod\fP(2) for access permission flags,
-\fBacl\fP(5) for access control lists,
-\fBlvm\fP(8) for volume management,
-\fBccs\fP(7) for cluster management,
-\fBumount\fP(8),
-\fBinitrd\fP(4).
-
diff --git a/gfs2/man/gfs2_quota.8 b/gfs2/man/gfs2_quota.8
deleted file mode 100644
index 7b1311c..0000000
--- a/gfs2/man/gfs2_quota.8
+++ /dev/null
@@ -1,105 +0,0 @@
-.TH gfs2_quota 8
-
-.SH NAME
-gfs2_quota - Manipulate GFS2 disk quotas
-
-.SH SYNOPSIS
-.B gfs2_quota
-<list|sync|get|limit|warn|check|init|reset> [\fIOPTION\fR]...
-
-.SH DESCRIPTION
-gfs2_quota is used to examine and change quota values in a GFS2 filesystem.
-This command has a number of different actions.
-
-GFS2(5.1) introduced a new linked list format for the quotas in the quota file.
-This list format allows for faster \fBlist\fP, \fBcheck\fP and \fBinit\fP 
-operations. Older GFS2 quota files may be migrated to this newer format using 
-the \fBgfs2_quota reset\fP command.
-
-.SH ACTIONS
-.TP
-\fBlist\fP
-List the contents of the quota file.  Only IDs that have a non-zero hard limit,
-warn limit, or value are printed.
-.TP
-\fBsync\fP
-Sync any local quota changes to the quota file.
-.TP
-\fBget\fP
-Get the current data for the ID specified by the -u or -g argument.
-.TP
-\fBlimit\fP
-Set the current hard limit for the ID specified by the -u or -g argument to 
-the value specified by the -l argument on the specified filesystem.
-The filesystem won't let the user or group use more than this much space.
-A value of zero here means that no limit is enforced.
-.TP
-\fBwarn\fP
-Set the current warn limit for the ID specified by the -u or -g argument to 
-the value specified by the -l argument on the specified filesystem.
-The filesystem will start complaining to the user or group when more
-than this much space is used.  A value of zero here means that the
-user won't ever be warned.
-.TP
-\fBcheck\fP
-Scan a filesystem and make sure that what's out there on the disk matches
-what's in the quota file.  This is only accurate if the filesystem is
-idle when this is running.  If there is a mismatch, it is printed to
-stdout.  Note: GFS2 quotas are transactional and a quota check is \fBnot\fP
-needed every time there is a system crash.
-.TP
-\fBinit\fP
-Scan a filesystem and initialize the quota file with the values obtained
-from the scan.  The filesystem should be idle when this is run.  You should
-only need to do this if you upgrade a pre-quota GFS2 filesystem (pre-GFS2 5.1).
-.TP
-\fBreset\fP
-The \fBreset\fP operation will truncate the quota file and all quota 
-information (values, limits, warnings) will be lost.  All quota limits and 
-warnings will have to be reassigned after this operation.
-
-.SH OPTIONS
-\fB-b\fP
-The units for disk space are filesystem blocks.
-.TP
-\fB-f\fP \fIDirectory\fR 
-Specifies which filesystem to perform the action on.
-.TP
-\fB-g\fP \fIGID\fR 
-Specifies the group ID for get, limit, or warn.  It can be either
-the group name from the group file, or the GID number.
-.TP
-\fB-h\fP
-Print  out  a  help  message  describing  available
-options, then exit.
-.TP
-\fB-k\fP
-The units for disk space are kilobytes.
-.TP
-\fB-l\fP \fISize\fR 
-Specifies the new value for the limit or warn actions.
-The value is assumed to be in the units specified by the
--m, -k, -s, -b arguments.  The default is megabytes.
-.TP
-\fB-m\fP
-The units for disk space are megabytes.  This is the default.
-.TP
-\fB-n\fP
-Don't try to resolve UIDs and GIDs into user and group names.
-.TP
-\fB-s\fP
-The units for disk space are sectors (512-byte blocks).
-.TP
-\fB-u\fP \fIUID\fR 
-Specifies the user ID for get, limit, or warn.  It can be either
-the username from the password file, or the UID number.
-.TP
-\fB-V\fP
-Print program version information, then exit.
-
-.SH EXAMPLE
-To set the hard limit for user "nobody" to
-1048576 kilobytes on filesystem /gfs20
-
-gfs2_quota limit -l 1048576 -k -u nobody -f /gfs20
-
diff --git a/gfs2/man/gfs2_tool.8 b/gfs2/man/gfs2_tool.8
deleted file mode 100644
index c28356a..0000000
--- a/gfs2/man/gfs2_tool.8
+++ /dev/null
@@ -1,138 +0,0 @@
-.TH gfs2_tool 8
-
-.SH NAME
-gfs2_tool - interface to gfs2 ioctl/sysfs calls
-
-.SH SYNOPSIS
-.B gfs2_tool
-\fICOMMAND\fR [\fIOPTION\fR]...
-
-.SH DESCRIPTION
-gfs2_tool is an interface to a variety of the GFS2 ioctl/sysfs calls.
-
-.SH COMMANDS
-.TP
-\fBclearflag\fP \fIFlag\fR \fIFile1\fR \fIFile2\fR \fI...\fR 
-Clear an attribute flag on a file. See \fBsetflag\fP for available flags.
-.TP
-\fBdf\fP \fIMountPoint\fR 
-Print out a space usage summary of a given filesystem.  The information
-printed is more detailed than a standard "df".
-.\".TP
-.\"\fBflush\fP \fIFile\fR
-.\"Sync out any dirty data for a file and drop its lock.
-.TP
-\fBfreeze\fP \fIMountPoint\fR
-Freeze (quiesce) a GFS2 cluster.
-.TP
-\fBgetargs\fP \fIMountPoint\fR
-Get the GFS-specific mount arguments used to mount a filesystem.
-.\".TP
-.\"\fBgetsb\fP \fIMountPoint\fR
-.\"Print out the superblock of a mounted filesystem.
-.TP
-\fBgettune\fP \fIMountPoint\fR
-Print out the current values of the tuning parameters in a running
-filesystem.
-.TP
-\fBjournals\fP \fIMountPoint\fR
-Print out information about the journals in a mounted filesystem.
-.\".TP
-.\"\fBjindex\fP \fIMountPoint\fR
-.\"Print out the journal index of a mounted filesystem.
-.\".TP
-.\"\fBlayout\fP \fIFile\fR \fI[buffersize]\fR
-.\"Print out on-disk layout information about a file or directory.
-.\"Buffersize is the size of the buffer (in bytes) that gfs2_tool allocates
-.\"to store the file's metadata during processing.  It defaults to 4194304
-.\"bytes.  If you are printing a very big directory you may need to specify
-.\"a bigger size.
-.TP
-\fBlist\fP
-List the currently mounted GFS2 filesystems.  Each line represents
-a filesystem.  The columns represent (in order): 1) An identifier that
-represents the mounted filesystem. 2) The name of the
-device that holds the filesystem (well, the name as the Linux
-kernel knows it).
-.TP
-\fBlockdump\fP \fIMountPoint\fR
-Print out information about the locks this machine holds for a given
-filesystem.
-.\".TP
-.\"\fBmargs\fP \fIarguments\fR
-.\"This loads arguments into the module what will override the mount
-.\"options passed with the -o field on the next mount.  See gfs2_mount(8).
-.\".TP
-.\"\fBquota\fP \fIMountPoint\fR
-.\"Print out the quota file of a mounted filesystem.  Also see
-.\"the "gfs2_quota list" command.
-.\".TP
-.\"\fBrindex\fP \fIMountPoint\fR
-.\"Print out the resource group index of a mounted filesystem.
-.TP
-\fBsb\fP \fIdevice\fR \fBproto\fP \fI[newvalue]\fR
-View (and possibly replace) the name of the locking protocol in the
-file system superblock.  The file system shouldn't be mounted by any
-client when you do this.
-.TP
-\fBsb\fP \fIdevice\fR \fBtable\fP \fI[newvalue]\fR
-View (and possibly replace) the name of the locking table in the
-file system superblock.  The file system shouldn't be mounted by any
-client when you do this.
-.TP
-\fBsb\fP \fIdevice\fR \fBondisk\fP \fI[newvalue]\fR
-View (and possibly replace) the ondisk format number in the
-file system superblock.  The file system shouldn't be mounted by any
-client when you do this.  No one should have to use this.
-.TP
-\fBsb\fP \fIdevice\fR \fBmultihost\fP \fI[newvalue]\fR
-View (and possibly replace) the multihost format number in the
-file system superblock.  The file system shouldn't be mounted by any
-client when you do this.  No one should have to use this.
-.TP
-\fBsb\fP \fIdevice\fR \fBall\fP
-Print out the superblock.
-.TP
-\fBsetflag\fP \fIFlag\fR \fIFile1\fR \fIFile2\fR \fI...\fR 
-Set an attribute flag on a file.  The currently supported flags are 
-jdata, immutable, appendonly, noatime, and sync.  In most cases, the 
-chattr command may be used rather than gfs2_tool to set attributes.
-
-The \fIjdata\fR flag causes all the data written to a file
-to be journaled.  If the \fIjdata\fR flag is set for a directory,
-all files and directories subsequently created within that directory
-are also journaled.  This behavior replaces the old \fIinherit_jdata\fR
-flag from gfs.  Same as chattr +j.
-
-The \fIimmutable\fR flag marks the file immutable. The behavior is 
-similar to the immutable flag in the ext2/3 filesystems.  All write 
-access is denied.  Same as chattr +i.
-
-The \fIappendonly\fR flag causes all data to be written at the end of 
-the file.  Same as chattr +a.
-
-The \fInoatime\fR flag disables updates to the file's access time.
-Same as chattr +A.
-
-The \fIsync\fR flag causes data written to the file to be sync'ed to 
-stable storage immediately.  Same as chattr +S.
-.TP
-\fBsettune\fP \fIMountPoint\fR \fIparameter\fR \fInewvalue\fR
-Set the value of tuning parameter.  Use \fBgettune\fP for a listing of 
-tunable parameters.
-.TP
-\fBshrink\fP \fIMountPoint\fR
-Causes any unused locks to be thrown out of memory.
-.\".TP
-.\"\fBstat\fP \fIFile\fR
-.\"Print out extended stat information about a file.
-.TP
-\fBunfreeze\fP \fIMountPoint\fR
-Unfreeze a GFS2 cluster.
-.TP
-\fBversion\fP
-Print out the version of GFS2 that this program goes with.
-.TP
-\fBwithdraw\fP \fIMountPoint\fR
-Cause GFS2 to abnormally shutdown a given filesystem on this node.
-
diff --git a/gfs2/man/mkfs.gfs2.8 b/gfs2/man/mkfs.gfs2.8
deleted file mode 100644
index 279c12f..0000000
--- a/gfs2/man/mkfs.gfs2.8
+++ /dev/null
@@ -1,95 +0,0 @@
-.TH mkfs.gfs2 8
-
-.SH NAME
-mkfs.gfs2 - Make a GFS2 filesystem
-
-.SH SYNOPSIS
-.B mkfs.gfs2
-[\fIOPTION\fR]... \fIDEVICE\fR \fI[ block-count ]\fR 
-
-.SH DESCRIPTION
-mkfs.gfs2 is used to create a Global File System.
-
-.SH OPTIONS
-.TP
-\fB-b\fP \fIBlockSize\fR 
-Set the filesystem block size to \fIBlockSize\fR (must be a power of
-two).  The minimum block size is 512.  The FS block size cannot exceed
-the machine's memory page size.  On the most architectures (i386,
-x86_64, s390, s390x), the memory page size is 4096 bytes.  On other
-architectures it may be bigger.  The default block size is 4096 bytes.
-In general, GFS2 filesystems should not deviate from the default value.
-.TP
-\fB-c\fP \fIMegaBytes\fR
-Initial size of each journal's quota change file
-.TP
-\fB-D\fP
-Enable debugging output.
-.TP
-\fB-h\fP
-Print  out  a  help  message  describing  available
-options, then exit.
-.TP
-\fB-J\fP \fIMegaBytes\fR 
-The size of the journals in Megabytes. The default journal size is 
-128 megabytes.  The minimum size is 8 megabytes.
-.TP
-\fB-j\fP \fINumber\fR 
-The number of journals for gfs2_mkfs to create.  You need at least one
-journal per machine that will mount the filesystem.  If this option is
-not specified, one journal will be created.
-.TP
-\fB-O\fP
-This option prevents gfs2_mkfs from asking for confirmation before writing
-the filesystem.
-.TP
-\fB-p\fP \fILockProtoName\fR 
-LockProtoName is the name of the  locking  protocol to use.  Acceptable
-locking protocols are \fIlock_dlm\fR (for shared storage) or if you are
-using GFS2 as a local filesystem (\fB1 node only\fP), you can specify the
-\fIlock_nolock\fR protocol.  If this option is not specified,
-\fIlock_dlm\fR protocol will be assumed.
-.TP
-\fB-q\fP
-Be quiet.  Don't print anything.
-.TP
-\fB-r\fP \fIMegaBytes\fR
-gfs2_mkfs will try to make Resource Groups about this big.
-Minimum RG size is 32 MB.  Maximum RG size is 2048 MB.
-A large RG size may increase performance on very large file systems.
-If not specified, mkfs.gfs2 will choose the RG size based on the size
-of the file system: average size file systems will have 256 MB RGs, and
-bigger file systems will have bigger RGs for better performance.
-.TP
-\fB-t\fP \fILockTableName\fR 
-The lock table field appropriate to the lock module you're using.
-It is \fIclustername:fsname\fR.
-Clustername must match that in cluster.conf; only members of this
-cluster are permitted to use this file system.
-Fsname is a unique file system name used to distinguish this GFS2 file
-system from others created (1 to 16 characters).  Lock_nolock doesn't
-use this field.
-.TP
-\fB-u\fP \fIMegaBytes\fR
-Initial size of each journal's unlinked tag file
-.TP
-\fB-V\fP
-Print program version information, then exit.
-
-.TP
-[ \fIblock-count\fR ]
-Make the file system this many blocks in size.  If not specified, the
-entire length of the specified device is used.
-
-.SH EXAMPLE
-.TP
-gfs2_mkfs -t mycluster:mygfs2 -p lock_dlm -j 2 /dev/vg0/mygfs2
-This will make a Global File System on the block device
-"/dev/vg0/mygfs2".  It will belong to "mycluster" and register itself
-as wanting locking for "mygfs2".  It will use DLM for locking and make
-two journals.
-.TP
-gfs2_mkfs -t mycluster:mygfs2 -p lock_nolock -j 3 /dev/vg0/mygfs2
-This will make a Global File System on the block device
-"/dev/vg0/mygfs2".  It will belong to "mycluster" and but have no
-cluster locking.  It will have three journals.
diff --git a/gfs2/mkfs/Makefile b/gfs2/mkfs/Makefile
deleted file mode 100644
index e268c38..0000000
--- a/gfs2/mkfs/Makefile
+++ /dev/null
@@ -1,51 +0,0 @@
-TARGET1= mkfs.gfs2
-TARGET2= gfs2_mkfs
-TARGET3= gfs2_jadd
-TARGET4= gfs2_grow
-
-SBINDIRT=$(TARGET1)
-SBINSYMT=$(TARGET2) $(TARGET3) $(TARGET4)
-
-all: depends ${TARGET1} ${TARGET2} ${TARGET3} ${TARGET4}
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-OBJS=	main.o \
-	main_mkfs.o \
-	main_grow.o \
-	main_jadd.o
-
-CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_GNU_SOURCE
-CFLAGS += -I${KERNEL_SRC}/include/
-CFLAGS += -I${volidincdir}
-CFLAGS += -I$(S)/../include -I$(S)/../libgfs2
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${volidlibdir} -lvolume_id
-LDFLAGS += -L../libgfs2 -lgfs2
-LDFLAGS += -L${libdir}
-
-LDDEPS += ../libgfs2/libgfs2.a
-
-${TARGET1}: ${OBJS} ${LDDEPS}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-${TARGET2}: ${TARGET1}
-	ln -sf ${TARGET1} ${TARGET2}
-
-${TARGET3}: ${TARGET1}
-	ln -sf ${TARGET1} ${TARGET3}
-
-${TARGET4}: ${TARGET1}
-	ln -sf ${TARGET1} ${TARGET4}
-
-depends:
-	$(MAKE) -C ../libgfs2 all
-
-clean: generalclean
-
--include $(OBJS:.o=.d)
diff --git a/gfs2/mkfs/README b/gfs2/mkfs/README
deleted file mode 100644
index 784df7d..0000000
--- a/gfs2/mkfs/README
+++ /dev/null
@@ -1,25 +0,0 @@
-
-#
-# mkfs for GFS2 filesystem
-#
-
-To install:
-
- 1. Edit the Makefile to point at your local copy of the kernel source
-with GFS2 included in it, for my set up that means:
-
-INCLUDEPATH=-I/home/steve/linux-2.6/include/
-
- 2. make
- 3. make install
-
-
-You can then use it just like other mkfs programs (for example):
-
-/sbin/mkfs -t gfs2 -j 1 -p lock_nolock /dev/sdb1
-
-This will create a filesystem with one journal (i.e. mountable by a
-maximum of one node at a time) with the nolock module (single node
-use only) on /dev/sdb1. Running mkfs -f gfs2 -h will produce help
-information.
-
diff --git a/gfs2/mkfs/gfs2_mkfs.h b/gfs2/mkfs/gfs2_mkfs.h
deleted file mode 100644
index 0242c5f..0000000
--- a/gfs2/mkfs/gfs2_mkfs.h
+++ /dev/null
@@ -1,70 +0,0 @@
-#ifndef __GFS2_MKFS_DOT_H__
-#define __GFS2_MKFS_DOT_H__
-
-#include "linux_endian.h"
-#include <linux/gfs2_ondisk.h>
-#include "osi_list.h"
-#include "copyright.cf"
-#include "ondisk.h"
-
-/* main_grow */
-void main_grow(int argc, char *argv[]);
-
-/* main_jadd */
-void main_jadd(int argc, char *argv[]);
-
-/* main_mkfs */
-void main_mkfs(int argc, char *argv[]);
-
-/* main_shrink */
-void main_shrink(int argc, char *argv[]);
-
-/*
- * The following inode IOCTL macros and inode flags 
- * are copied from linux/fs.h, because we have duplicate 
- * definition of symbols when we include both linux/fs.h and 
- * sys/mount.h in our program
- */
-
-#define FS_IOC_GETFLAGS                 _IOR('f', 1, long)
-#define FS_IOC_SETFLAGS                 _IOW('f', 2, long)
-#define FS_IOC_GETVERSION               _IOR('v', 1, long)
-#define FS_IOC_SETVERSION               _IOW('v', 2, long)
-#define FS_IOC32_GETFLAGS               _IOR('f', 1, int)
-#define FS_IOC32_SETFLAGS               _IOW('f', 2, int)
-#define FS_IOC32_GETVERSION             _IOR('v', 1, int)
-#define FS_IOC32_SETVERSION             _IOW('v', 2, int)
-
-/*
- * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS)
- */
-#define FS_SECRM_FL                     0x00000001 /* Secure deletion */
-#define FS_UNRM_FL                      0x00000002 /* Undelete */
-#define FS_COMPR_FL                     0x00000004 /* Compress file */
-#define FS_SYNC_FL                      0x00000008 /* Synchronous updates */
-#define FS_IMMUTABLE_FL                 0x00000010 /* Immutable file */
-#define FS_APPEND_FL                    0x00000020 /* writes to file may only append */
-#define FS_NODUMP_FL                    0x00000040 /* do not dump file */
-#define FS_NOATIME_FL                   0x00000080 /* do not update atime */
-/* Reserved for compression usage... */
-#define FS_DIRTY_FL                     0x00000100
-#define FS_COMPRBLK_FL                  0x00000200 /* One or more compressed clusters */
-#define FS_NOCOMP_FL                    0x00000400 /* Don't compress */
-#define FS_ECOMPR_FL                    0x00000800 /* Compression error */
-/* End compression flags --- maybe not all used */
-#define FS_BTREE_FL                     0x00001000 /* btree format dir */
-#define FS_INDEX_FL                     0x00001000 /* hash-indexed directory */
-#define FS_IMAGIC_FL                    0x00002000 /* AFS directory */
-#define FS_JOURNAL_DATA_FL              0x00004000 /* Reserved for ext3 */
-#define FS_NOTAIL_FL                    0x00008000 /* file tail should not be merged */
-#define FS_DIRSYNC_FL                   0x00010000 /* dirsync behaviour (directories only) */
-#define FS_TOPDIR_FL                    0x00020000 /* Top of directory hierarchies*/
-#define FS_EXTENT_FL                    0x00080000 /* Extents */
-#define FS_DIRECTIO_FL                  0x00100000 /* Use direct i/o */
-#define FS_RESERVED_FL                  0x80000000 /* reserved for ext2 lib */
-
-#define FS_FL_USER_VISIBLE              0x0003DFFF /* User visible flags */
-#define FS_FL_USER_MODIFIABLE           0x000380FF /* User modifiable flags */
-
-
-#endif /* __GFS2_MKFS_DOT_H__ */
diff --git a/gfs2/mkfs/main.c b/gfs2/mkfs/main.c
deleted file mode 100644
index 076ed16..0000000
--- a/gfs2/mkfs/main.c
+++ /dev/null
@@ -1,55 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <time.h>
-#include <errno.h>
-#include <libgen.h>
-
-#include <linux/types.h>
-#include "libgfs2.h"
-#include "gfs2_mkfs.h"
-
-char *prog_name;
-
-/**
- * main - do everything
- * @argc:
- * @argv:
- *
- * Returns: 0 on success, non-0 on failure
- */
-
-int
-main(int argc, char *argv[])
-{
-	char *p, *whoami;
-
-	prog_name = argv[0];
-	SRANDOM;
-
-	p = strdup(prog_name);
-	whoami = basename(p);
-	
-	if (!strcmp(whoami, "gfs2_jadd"))
-		main_jadd(argc, argv);
-	else if (!strcmp(whoami, "gfs2_mkfs") || !strcmp(whoami, "mkfs.gfs2"))
-		main_mkfs(argc, argv);
-	else if (!strcmp(whoami, "gfs2_grow"))
-		main_grow(argc, argv);
-#if 0
-	else if (!strcmp(whoami, "gfs2_shrink"))
-		main_shrink(argc, argv);
-#endif
-	else
-		die("I don't know who I am!\n");
-
-	free(p);
-
-	return EXIT_SUCCESS;
-}
diff --git a/gfs2/mkfs/main_grow.c b/gfs2/mkfs/main_grow.c
deleted file mode 100644
index 7c57a38..0000000
--- a/gfs2/mkfs/main_grow.c
+++ /dev/null
@@ -1,332 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <sys/types.h>
-#include <dirent.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/file.h>
-#include <sys/vfs.h>
-#include <sys/mount.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <time.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <linux/types.h>
-
-#include "libgfs2.h"
-#include "gfs2_mkfs.h"
-
-#define BUF_SIZE 4096
-#define MB (1024 * 1024)
-
-static uint64_t override_device_size = 0;
-static int test = 0;
-static uint64_t fssize = 0, fsgrowth;
-static unsigned int rgsize = 0;
-
-extern int create_new_inode(struct gfs2_sbd *sdp);
-extern int rename2system(struct gfs2_sbd *sdp, char *new_dir, char *new_name);
-
-/**
- * usage - Print out the usage message
- *
- * This function does not include documentation for the -D option
- * since normal users have no use for it at all. The -D option is
- * only for developers. It intended use is in combination with the
- * -T flag to find out what the result would be of trying different
- * device sizes without actually having to try them manually.
- */
-
-static void usage(void)
-{
-	fprintf(stdout,
-		"Usage:\n"
-		"\n"
-		"gfs2_grow [options] /path/to/filesystem\n"
-		"\n"
-		"Options:\n"
-		"  -h               Usage information\n"
-		"  -q               Quiet, reduce verbosity\n"
-		"  -T               Test, do everything except update FS\n"
-		"  -V               Version information\n"
-		"  -v               Verbose, increase verbosity\n");
-}
-
-void decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp)
-{
-	int opt;
-
-	while ((opt = getopt(argc, argv, "VD:hqTv?")) != EOF) {
-		switch (opt) {
-		case 'D':	/* This option is for testing only */
-			override_device_size = atoi(optarg);
-			override_device_size <<= 20;
-			break;
-		case 'V':
-			printf("%s %s (built %s %s)\n", argv[0],
-			       RELEASE_VERSION, __DATE__, __TIME__);
-			printf("%s\n", REDHAT_COPYRIGHT);
-			exit(0);
-		case 'h':
-			usage();
-			exit(0);
-		case 'q':
-			decrease_verbosity();
-			break;
-		case 'T':
-			printf("(Test mode--File system will not "
-			       "be changed)\n");
-			test = 1;
-			break;
-		case 'v':
-			increase_verbosity();
-			break;
-		case ':':
-		case '?':
-			/* Unknown flag */
-			fprintf(stderr, "Please use '-h' for usage.\n");
-			exit(EXIT_FAILURE);
-		default:
-			fprintf(stderr, "Bad programmer! You forgot"
-				" to catch the %c flag\n", opt);
-			exit(EXIT_FAILURE);
-			break;
-		}
-	}
-
-	if (optind == argc) {
-		usage();
-		exit(EXIT_FAILURE);
-	}
-}
-
-/**
- * figure_out_rgsize
- */
-void figure_out_rgsize(struct gfs2_sbd *sdp, unsigned int *rgsize)
-{
-	osi_list_t *head = &sdp->rglist;
-	struct rgrp_list *r1, *r2;
-
-	sdp->rgsize = GFS2_DEFAULT_RGSIZE;
-	r1 = osi_list_entry(head->next->next, struct rgrp_list, list);
-	r2 = osi_list_entry(head->next->next->next, struct rgrp_list, list);
-
-	*rgsize = r2->ri.ri_addr - r1->ri.ri_addr;
-}
-
-/**
- * filesystem_size - Calculate the size of the filesystem
- *
- * Reads the lists of resource groups in order to
- * work out where the last block of the filesystem is located.
- *
- * Returns: The calculated size
- */
-
-uint64_t filesystem_size(struct gfs2_sbd *sdp)
-{
-	osi_list_t *tmp;
-	struct rgrp_list *rgl;
-	uint64_t size = 0, extent;
-
-	tmp = &sdp->rglist;
-	for (;;) {
-		tmp = tmp->next;
-		if (tmp == &sdp->rglist)
-			break;
-		rgl = osi_list_entry(tmp, struct rgrp_list, list);
-		extent = rgl->ri.ri_addr + rgl->ri.ri_length + rgl->ri.ri_data;
-		if (extent > size)
-			size = extent;
-	}
-	return size;
-}
-
-/**
- * initialize_new_portion - Write the new rg information to disk buffers.
- */
-void initialize_new_portion(struct gfs2_sbd *sdp, int *old_rg_count)
-{
-	uint64_t rgrp = 0;
-	osi_list_t *head = &sdp->rglist;
-
-	*old_rg_count = 0;
-	/* Delete the old RGs from the rglist */
-	for (rgrp = 0; !osi_list_empty(head) &&
-		     rgrp < (sdp->rgrps - sdp->new_rgrps); rgrp++) {
-		(*old_rg_count)++;
-		osi_list_del(head->next);
-	}
-	/* Build the remaining resource groups */
-	build_rgrps(sdp, !test);
-
-	/* Note: We do inode_put with not_updated because we only updated */
-	/* the new RGs/bitmaps themselves on disk.  The rindex file must  */
-	/* be updated through the meta_fs so the gfs2 kernel is informed. */
-	inode_put(sdp->md.riinode, not_updated);
-	inode_put(sdp->master_dir, not_updated);
-
-	/* We're done with the libgfs portion, so commit it to disk.      */
-	bsync(&sdp->buf_list);
-	bsync(&sdp->nvbuf_list);
-}
-
-/**
- * fix_rindex - Add the new entries to the end of the rindex file.
- */
-void fix_rindex(struct gfs2_sbd *sdp, int rindex_fd, int old_rg_count)
-{
-	int count, rg;
-	struct rgrp_list *rl;
-	char *buf, *bufptr;
-	osi_list_t *tmp;
-	ssize_t writelen;
-
-	/* Count the number of new RGs. */
-	rg = 0;
-	osi_list_foreach(tmp, &sdp->rglist)
-		rg++;
-	log_info("%d new rindex entries.\n", rg);
-	writelen = rg * sizeof(struct gfs2_rindex);
-	zalloc(buf, writelen);
-	if (!buf)
-		die("Unable to allocate memory for buffers.\n");
-	/* Now add the new rg entries to the rg index.  Here we     */
-	/* need to use the gfs2 kernel code rather than the libgfs2 */
-	/* code so we have a live update while mounted.             */
-	bufptr = buf;
-	osi_list_foreach(tmp, &sdp->rglist) {
-		rg++;
-		rl = osi_list_entry(tmp, struct rgrp_list, list);
-		gfs2_rindex_out(&rl->ri, bufptr);
-		bufptr += sizeof(struct gfs2_rindex);
-	}
-	if (!test) {
-		/* Now write the new RGs to the end of the rindex */
-		lseek(rindex_fd, 0, SEEK_END);
-		count = write(rindex_fd, buf, writelen);
-		if (count != writelen)
-			log_crit("Error writing new rindex entries;"
-				 "aborted.\n");
-		fsync(rindex_fd);
-	}
-	free(buf);
-}
-
-/**
- * print_info - Print out various bits of (interesting?) information
- *
- */
-static void print_info(struct gfs2_sbd *sdp)
-{
-	log_notice("FS: Mount Point: %s\n", sdp->path_name);
-	log_notice("FS: Device:      %s\n", sdp->device_name);
-	log_notice("FS: Size:        %" PRIu64 " (0x%" PRIx64 ")\n",
-		   fssize, fssize);
-	log_notice("FS: RG size:     %u (0x%x)\n", rgsize, rgsize);
-	log_notice("DEV: Size:       %"PRIu64" (0x%" PRIx64")\n",
-		   sdp->device.length, sdp->device.length);
-	log_notice("The file system grew by %" PRIu64 "MB.\n",
-		   fsgrowth / MB);
-}
-
-/**
- * main_grow - do everything
- * @argc:
- * @argv:
- */
-void
-main_grow(int argc, char *argv[])
-{
-	struct gfs2_sbd sbd, *sdp = &sbd;
-	int rgcount, rindex_fd;
-	char rindex_name[PATH_MAX];
-	osi_list_t *head = &sdp->rglist;
-
-	memset(sdp, 0, sizeof(struct gfs2_sbd));
-	sdp->bsize = GFS2_DEFAULT_BSIZE;
-	sdp->rgsize = -1;
-	sdp->jsize = GFS2_DEFAULT_JSIZE;
-	sdp->qcsize = GFS2_DEFAULT_QCSIZE;
-	sdp->md.journals = 1;
-	decode_arguments(argc, argv, sdp);
-	
-	while ((argc - optind) > 0) {
-		sdp->path_name = argv[optind++];
-		sdp->path_fd = open(sdp->path_name, O_RDONLY);
-		if (sdp->path_fd < 0)
-			die("can't open root directory %s: %s\n",
-			    sdp->path_name, strerror(errno));
-
-		check_for_gfs2(sdp);
-		sdp->device_fd = open(sdp->device_name,
-				      (test ? O_RDONLY : O_RDWR));
-		if (sdp->device_fd < 0)
-			die("can't open device %s: %s\n",
-			    sdp->device_name, strerror(errno));
-		device_geometry(sdp);
-		fix_device_geometry(sdp);
-		log_info("Initializing lists...\n");
-		osi_list_init(&sdp->rglist);
-		init_buf_list(sdp, &sdp->buf_list, 128 << 20);
-		init_buf_list(sdp, &sdp->nvbuf_list, 0xffffffff);
-
-		sdp->sd_sb.sb_bsize = GFS2_DEFAULT_BSIZE;
-		sdp->bsize = sdp->sd_sb.sb_bsize;
-		compute_constants(sdp);
-		if(read_sb(sdp) < 0)
-			die("gfs: Error reading superblock.\n");
-
-		mount_gfs2_meta(sdp);
-
-		sprintf(rindex_name, "%s/rindex", sdp->metafs_path);
-		rindex_fd = open(rindex_name, (test ? O_RDONLY : O_RDWR));
-		if (rindex_fd < 0) {
-			cleanup_metafs(sdp);
-			die("GFS2 rindex not found.  Please run gfs2_fsck.\n");
-		}
-		/* Get master dinode */
-		sdp->master_dir =
-			gfs2_load_inode(sdp, sdp->sd_sb.sb_master_dir.no_addr);
-		gfs2_lookupi(sdp->master_dir, "rindex", 6, &sdp->md.riinode);
-		/* Fetch the rindex from disk.  We aren't using gfs2 here,  */
-		/* which means that the bitmaps will most likely be cached  */
-		/* and therefore out of date.  It shouldn't matter because  */
-		/* we're only going to write out new RG information after   */
-		/* the existing RGs, and only write to the index at EOF.    */
-		ri_update(sdp, rindex_fd, &rgcount);
-		fssize = filesystem_size(sdp);
-		figure_out_rgsize(sdp, &rgsize);
-		fsgrowth = ((sdp->device.length - fssize) * sdp->bsize);
-		if (fsgrowth < rgsize * sdp->bsize) {
-			log_err("Error: The device has grown by less than "
-				"one Resource Group (RG).\n");
-			log_err("The device grew by %" PRIu64 "MB.  ",
-				fsgrowth / MB);
-			log_err("One RG is %uMB for this file system.\n",
-				(rgsize * sdp->bsize) / MB);
-		}
-		else {
-			int old_rg_count;
-
-			compute_rgrp_layout(sdp, TRUE);
-			print_info(sdp);
-			initialize_new_portion(sdp, &old_rg_count);
-			fix_rindex(sdp, rindex_fd, old_rg_count);
-		}
-		/* Delete the remaining RGs from the rglist */
-		while (!osi_list_empty(head))
-			osi_list_del(head->next);
-		close(rindex_fd);
-		cleanup_metafs(sdp);
-		close(sdp->device_fd);
-	}
-	close(sdp->path_fd);
-	sync();
-	log_notice("gfs2_grow complete.\n");
-}
diff --git a/gfs2/mkfs/main_jadd.c b/gfs2/mkfs/main_jadd.c
deleted file mode 100644
index f0255d0..0000000
--- a/gfs2/mkfs/main_jadd.c
+++ /dev/null
@@ -1,510 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <sys/types.h>
-#include <dirent.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/file.h>
-#include <sys/vfs.h>
-#include <sys/mount.h>
-//#include <linux/fs.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <time.h>
-#include <errno.h>
-#include <stdarg.h>
-
-#include <linux/types.h>
-#include "libgfs2.h"
-#include "gfs2_mkfs.h"
-
-#define BUF_SIZE 4096
-
-void
-make_jdata(int fd, char *value)
-{
-        int err;
-        uint32_t val;
-
-        err = ioctl(fd, FS_IOC_GETFLAGS, &val);
-        if (err)
-                die("error doing get flags (%d): %s\n", err, strerror(errno));
-        if (strcmp(value, "set") == 0)
-                val |= FS_JOURNAL_DATA_FL;
-        if (strcmp(value, "clear") == 0)
-                val &= ~FS_JOURNAL_DATA_FL;
-        err = ioctl(fd, FS_IOC_SETFLAGS, &val);
-        if (err)
-                die("error doing set flags (%d): %s\n", err, strerror(errno));
-}
-
-int 
-rename2system(struct gfs2_sbd *sdp, char *new_dir, char *new_name)
-{
-	char oldpath[PATH_MAX], newpath[PATH_MAX];
-	int error = 0;
-	error = snprintf(oldpath, PATH_MAX, "%s/new_inode", 
-			 sdp->metafs_path);
-	if (error >= PATH_MAX)
-		die("rename2system (1)\n");
-
-	error = snprintf(newpath, PATH_MAX, "%s/%s/%s",
-			 sdp->metafs_path, new_dir, new_name);
-	if (error >= PATH_MAX)
-		die("rename2system (2)\n");
-	
-	return rename(oldpath, newpath);
-}
-
-/**
- * print_usage - print out usage information
- *
- */
-
-static void 
-print_usage(void)
-{
-	printf("Usage:\n");
-	printf("\n");
-	printf("%s [options] /path/to/filesystem\n", prog_name);
-	printf("\n");
-	printf("Options:\n");
-	printf("\n");
-	printf("  -c <MB>           Size of quota change file\n");
-	printf("  -D                Enable debugging code\n");
-	printf("  -h                Print this help, then exit\n");
-	printf("  -J <MB>           Size of journals\n");
-	printf("  -j <num>          Number of journals\n");
-	printf("  -q                Don't print anything\n");
-	printf("  -V                Print program version information, then exit\n");
-}
-
-/**
- * decode_arguments - decode command line arguments and fill in the struct gfs2_sbd
- * @argc:
- * @argv:
- * @sdp: the decoded command line arguments
- *
- */
-
-static void
-decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp)
-{
-	int cont = TRUE;
-	int optchar;
-	
-	while (cont) {
-		optchar = getopt(argc, argv, "c:DhJ:j:qu:VX");
-		
-		switch (optchar) {
-		case 'c':
-			sdp->qcsize = atoi(optarg);
-			break;
-		case 'D':
-			sdp->debug = TRUE;
-			break;
-		case 'h':
-			print_usage();
-			exit(EXIT_SUCCESS);
-			break;
-		case 'J':
-			sdp->jsize = atoi(optarg);
-			break;
-		case 'j':
-			sdp->md.journals = atoi(optarg);
-			break;
-		case 'q':
-			sdp->quiet = TRUE;
-			break;
-		case 'V':
-			printf("gfs2_jadd %s (built %s %s)\n", RELEASE_VERSION,
-			       __DATE__, __TIME__);
-			printf("%s\n", REDHAT_COPYRIGHT);
-			exit(EXIT_SUCCESS);
-			break;
-		case 'X':
-			sdp->expert = TRUE;
-			break;
-		case ':':
-		case '?':
-			fprintf(stderr, "Please use '-h' for usage.\n");
-			exit(EXIT_FAILURE);
-			break;
-		case EOF:
-			cont = FALSE;
-			break;
-		default:
-			die("unknown option: %c\n", optchar);
-			break;
-		};
-	}
-
-	if (optind < argc) {
-		sdp->path_name = argv[optind];
-		optind++;
-	} else
-		die("no path specified (try -h for help)\n");
-	
-	if (optind < argc)
-		die("Unrecognized option: %s\n", argv[optind]);
-
-	if (sdp->debug) {
-		printf("Command Line Arguments:\n");
-		printf("  qcsize = %u\n", sdp->qcsize);
-		printf("  jsize = %u\n", sdp->jsize);
-		printf("  journals = %u\n", sdp->md.journals);
-		printf("  quiet = %d\n", sdp->quiet);
-		printf("  path = %s\n", sdp->path_name);
-	}
-}
-
-static void 
-verify_arguments(struct gfs2_sbd *sdp)
-{
-	if (!sdp->md.journals)
-		die("no journals specified\n");
-	if (sdp->jsize < 32 || sdp->jsize > 1024)
-		die("bad journal size\n");
-	if (!sdp->qcsize || sdp->qcsize > 64)
-		die("bad quota change size\n");
-}
-
-/**
- * print_results - print out summary information
- * @sdp: the command line
- *
- */
-
-static void 
-print_results(struct gfs2_sbd *sdp)
-{
-	if (sdp->debug)
-		printf("\n");
-	else if (sdp->quiet)
-		return;
-
-	if (sdp->expert)
-		printf("Expert mode:            on\n");
-
-	printf("Filesystem:            %s\n", sdp->path_name);
-	printf("Old Journals           %u\n", sdp->orig_journals);
-	printf("New Journals           %u\n", sdp->md.journals);
-
-}
-
-int 
-create_new_inode(struct gfs2_sbd *sdp)
-{
-	char name[PATH_MAX];
-	int fd;
-	int error;
-
-	error = snprintf(name, PATH_MAX, "%s/new_inode", sdp->metafs_path);
-	if (error >= PATH_MAX)
-		die("create_new_inode (1)\n");
-
-	for (;;) {
-		fd = open(name, O_WRONLY | O_CREAT | O_EXCL | O_NOFOLLOW, 0600);
-		if (fd >= 0)
-			break;
-		if (errno == EEXIST) {
-			error = unlink(name);
-			if (error)
-				die("can't unlink %s: %s\n",
-				    name, strerror(errno));
-		} else
-			die("can't create %s: %s\n", name, strerror(errno));
-	}
-	
-	return fd;
-}
-
-void 
-add_ir(struct gfs2_sbd *sdp)
-{
-	int fd;
-	char new_name[256];
-	int error;
-
-	fd = create_new_inode(sdp);
-
-	{
-		struct gfs2_inum_range ir;
-		make_jdata(fd, "set");
-		memset(&ir, 0, sizeof(struct gfs2_inum_range));
-		do_write(fd, (void*)&ir, sizeof(struct gfs2_inum_range));
-	}
-	
-	close(fd);
-	
-	sprintf(new_name, "inum_range%u", sdp->md.journals);
-	error = rename2system(sdp, "per_node", new_name);
-	if (error < 0 && errno != EEXIST)
-		die("can't rename2system %s (%d): %s\n", 
-		new_name, error, strerror(errno));
-}
-
-void 
-add_sc(struct gfs2_sbd *sdp)
-{
-	int fd;
-	char new_name[256];
-	int error;
-	
-	fd = create_new_inode(sdp);
-	
-	{
-		struct gfs2_statfs_change sc;
-		make_jdata(fd, "set");
-
-		memset(&sc, 0, sizeof(struct gfs2_statfs_change));
-		do_write(fd, (void*)&sc, sizeof(struct gfs2_statfs_change));
-	}
-
-	close(fd);
-	
-	sprintf(new_name, "statfs_change%u", sdp->md.journals);
-	error = rename2system(sdp, "per_node", new_name);
-	if (error < 0 && errno != EEXIST)
-		die("can't rename2system %s (%d): %s\n",
-		    new_name, error, strerror(errno));
-}
-
-void 
-add_qc(struct gfs2_sbd *sdp)
-{
-	int fd;
-	char new_name[256];
-	int error;
-
-	fd = create_new_inode(sdp);
-
-	{
-		char buf[sdp->bsize];
-		unsigned int blocks =
-			sdp->qcsize << (20 - sdp->sd_sb.sb_bsize_shift);
-		unsigned int x;
-		struct gfs2_meta_header mh;
-
-		make_jdata(fd, "clear");
-		memset(buf, 0, sdp->bsize);
-
-		for (x=0; x<blocks; x++) {
-			do_write(fd, buf, sdp->bsize);
-		}
-
-		do_lseek(fd, 0);
-		
-		memset(&mh, 0, sizeof(struct gfs2_meta_header));
-		mh.mh_magic = GFS2_MAGIC;
-		mh.mh_type = GFS2_METATYPE_QC;
-		mh.mh_format = GFS2_FORMAT_QC;
-		gfs2_meta_header_out(&mh, buf);
-
-		for (x=0; x<blocks; x++) {
-			do_write(fd, buf, sdp->bsize);
-		}
-
-		error = fsync(fd);
-		if (error)
-			die("can't fsync: %s\n",
-			    strerror(errno));
-	}
-
-	close(fd);
-	
-	sprintf(new_name, "quota_change%u", sdp->md.journals);
-	error = rename2system(sdp, "per_node", new_name);
-	if (error < 0 && errno != EEXIST)
-		die("can't rename2system %s (%d): %s\n",
-		    new_name, error, strerror(errno));
-}
-
-#if 0 /* FIXME: When we have a mountpoint in sysfs for gfs2meta, enable this 
-       * to get the lock_table name and block size from the ondisk superblock
-       */
-void 
-read_superblock(struct gfs2_sbd *sdp)
-{
-	int fd;
-	char buf[PATH_MAX];
-	
-	fd = open(sdp->device_name, O_RDONLY);
-	if (fd < 0) {
-		die("Could not open the block device %s: %s\n",
-			sdp->device_name, strerror(errno));
-	}
-	do_lseek(fd, 0x10 * 4096);
-	do_read(fd, buf, PATH_MAX);
-	gfs2_sb_in(&(sdp->sd_sb), buf);
-	sdp->bsize = sdp->sd_sb.sb_bsize;
-	strcpy(lock_table,sdp->sd_sb.sb_locktable);
-	sprintf(sdp->meta_mount, "%s%s%s", "/sys/fs/gfs2/", lock_table,
-		"/meta");
-
-	close(fd);
-}
-
-void 
-gather_info(struct gfs2_sbd *sdp)
-{
-	read_superblock(sdp);
-}
-#else
-void 
-gather_info(struct gfs2_sbd *sdp)
-{
-	struct statfs statbuf;
-	if (statfs(sdp->path_name, &statbuf) < 0) {
-		die("Could not statfs the filesystem %s: %s\n",
-		    sdp->path_name, strerror(errno));
-	}
-	sdp->bsize = statbuf.f_bsize;
-}
-#endif 
-
-void 
-find_current_journals(struct gfs2_sbd *sdp)
-{
-	char jindex[PATH_MAX];
-	struct dirent *dp;
-	DIR *dirp;
-	int existing_journals = 0;
-
-	sprintf(jindex, "%s/jindex", sdp->metafs_path);
-	dirp = opendir(jindex);
-	if (!dirp) {
-		die("Could not find the jindex directory "
-		    "in gfs2meta mount! error: %s\n", strerror(errno));
-	}
-	while (dirp) {
-		if ((dp = readdir(dirp)) != NULL) {
-			if (strncmp(dp->d_name, "journal", 7) == 0)
-				existing_journals++;
-		} else
-			goto close;
-	}
-close:
-	closedir(dirp);
-	if (existing_journals <= 0) {
-		die("There are no journals for this "
-		    "gfs2 fs! Did you mkfs.gfs2 correctly?\n");
-	}
-
-	sdp->orig_journals = existing_journals;
-}
-
-void 
-add_j(struct gfs2_sbd *sdp)
-{
-	int fd;
-	char new_name[256];
-	int error;
-
-	fd = create_new_inode(sdp);
-
-	{
-		char buf[sdp->bsize];
-		unsigned int blocks =
-			sdp->jsize << (20 - sdp->sd_sb.sb_bsize_shift);
-		unsigned int x;
-		struct gfs2_log_header lh;
-		uint64_t seq = RANDOM(blocks);
-
-		make_jdata(fd, "clear");
-		memset(buf, 0, sdp->bsize);
-		for (x=0; x<blocks; x++) {
-			do_write(fd, buf, sdp->bsize);
-		}
-
-		do_lseek(fd, 0);
-
-		memset(&lh, 0, sizeof(struct gfs2_log_header));
-		lh.lh_header.mh_magic = GFS2_MAGIC;
-		lh.lh_header.mh_type = GFS2_METATYPE_LH;
-		lh.lh_header.mh_format = GFS2_FORMAT_LH;
-		lh.lh_flags = GFS2_LOG_HEAD_UNMOUNT;
-
-		for (x=0; x<blocks; x++) {
-			uint32_t hash;
-
-			lh.lh_sequence = seq;
-			lh.lh_blkno = x;
-			gfs2_log_header_out(&lh, buf);
-			hash = gfs2_disk_hash(buf, sizeof(struct gfs2_log_header));
-			((struct gfs2_log_header *)buf)->lh_hash = cpu_to_be32(hash);
-
-			do_write(fd, buf, sdp->bsize);
-
-			if (++seq == blocks)
-				seq = 0;
-		}
-
-		error = fsync(fd);
-		if (error)
-			die("can't fsync: %s\n",
-			    strerror(errno));
-	}
-
-	close(fd);
-	
-	sprintf(new_name, "journal%u", sdp->md.journals);
-	error = rename2system(sdp, "jindex", new_name);
-	if (error < 0 && errno != EEXIST)
-		die("can't rename2system %s (%d): %s\n",
-		    new_name, error, strerror(errno));
-}
-
-/**
- * main_jadd - do everything
- * @argc:
- * @argv:
- *
- */
-
-void 
-main_jadd(int argc, char *argv[])
-{
-	struct gfs2_sbd sbd, *sdp = &sbd;
-	unsigned int total;
-
-	memset(sdp, 0, sizeof(struct gfs2_sbd));
-	sdp->jsize = GFS2_DEFAULT_JSIZE;
-	sdp->qcsize = GFS2_DEFAULT_QCSIZE;
-	sdp->md.journals = 1;
-
-	decode_arguments(argc, argv, sdp);
-	verify_arguments(sdp);
-	
-	sdp->path_fd = open(sdp->path_name, O_RDONLY);
-	if (sdp->path_fd < 0)
-		die("can't open root directory %s: %s\n",
-		    sdp->path_name, strerror(errno));
-
-	check_for_gfs2(sdp);
-
-	gather_info(sdp);
-
-	mount_gfs2_meta(sdp);
-
-	compute_constants(sdp);
-	find_current_journals(sdp);
-
-	total = sdp->orig_journals + sdp->md.journals;
-	for (sdp->md.journals = sdp->orig_journals; 
-	     sdp->md.journals < total;
-	     sdp->md.journals++) {
-		add_ir(sdp);
-		add_sc(sdp);
-		add_qc(sdp);
-		add_j(sdp);
-	}
-
-	close(sdp->path_fd);
-	cleanup_metafs(sdp);
-	sync();
-	print_results(sdp);
-}
diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
deleted file mode 100644
index f650163..0000000
--- a/gfs2/mkfs/main_mkfs.c
+++ /dev/null
@@ -1,476 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <time.h>
-#include <errno.h>
-#include <stdarg.h>
-#include <mntent.h>
-#include <ctype.h>
-
-#include <linux/types.h>
-#include "libgfs2.h"
-#include "gfs2_mkfs.h"
-#include "libvolume_id.h"
-
-char *prog_name;
-
-/**
- * This function is for libgfs2's sake.
- */
-void print_it(const char *label, const char *fmt, const char *fmt2, ...)
-{
-	va_list args;
-
-	va_start(args, fmt2);
-	printf("%s: ", label);
-	vprintf(fmt, args);
-	va_end(args);
-}
-
-/**
- * print_usage - print out usage information
- *
- */
-
-static void
-print_usage(void)
-{
-	printf("Usage:\n");
-	printf("\n");
-	printf("%s [options] <device> [ block-count ]\n", prog_name);
-	printf("\n");
-	printf("Options:\n");
-	printf("\n");
-	printf("  -b <bytes>       Filesystem block size\n");
-	printf("  -c <MB>          Size of quota change file\n");
-	printf("  -D               Enable debugging code\n");
-	printf("  -h               Print this help, then exit\n");
-	printf("  -J <MB>          Size of journals\n");
-	printf("  -j <num>         Number of journals\n");
-	printf("  -O               Don't ask for confirmation\n");
-	printf("  -p <name>        Name of the locking protocol\n");
-	printf("  -q               Don't print anything\n");
-	printf("  -r <MB>          Resource Group Size\n");
-	printf("  -t <name>        Name of the lock table\n");
-	printf("  -u <MB>          Size of unlinked file\n");
-	printf("  -V               Print program version information, then exit\n");
-}
-
-/**
- * decode_arguments - decode command line arguments and fill in the struct gfs2_sbd
- * @argc:
- * @argv:
- * @sdp: the decoded command line arguments
- *
- */
-
-static void
-decode_arguments(int argc, char *argv[], struct gfs2_sbd *sdp)
-{
-	int cont = TRUE;
-	int optchar;
-
-	memset(sdp->device_name, 0, sizeof(sdp->device_name));
-	sdp->md.journals = 1;
-	sdp->orig_fssize = 0;
-
-	while (cont) {
-		optchar = getopt(argc, argv, "-b:c:DhJ:j:Op:qr:t:u:VX");
-
-		switch (optchar) {
-		case 'b':
-			sdp->bsize = atoi(optarg);
-			break;
-
-		case 'c':
-			sdp->qcsize = atoi(optarg);
-			break;
-
-		case 'D':
-			sdp->debug = TRUE;
-			break;
-
-		case 'h':
-			print_usage();
-			exit(EXIT_SUCCESS);
-			break;
-
-		case 'J':
-			sdp->jsize = atoi(optarg);
-			break;
-
-		case 'j':
-			sdp->md.journals = atoi(optarg);
-			break;
-
-		case 'O':
-			sdp->override = TRUE;
-			break;
-
-		case 'p':
-			if (strlen(optarg) >= GFS2_LOCKNAME_LEN)
-				die("lock protocol name %s is too long\n",
-				    optarg);
-			strcpy(sdp->lockproto, optarg);
-			break;
-
-		case 'q':
-			sdp->quiet = TRUE;
-			break;
-
-		case 'r':
-			sdp->rgsize = atoi(optarg);
-			break;
-
-		case 't':
-			if (strlen(optarg) >= GFS2_LOCKNAME_LEN)
-				die("lock table name %s is too long\n", optarg);
-			strcpy(sdp->locktable, optarg);
-			break;
-
-		case 'u':
-			sdp->utsize = atoi(optarg);
-			break;
-
-		case 'V':
-			printf("gfs2_mkfs %s (built %s %s)\n", RELEASE_VERSION,
-			       __DATE__, __TIME__);
-			printf("%s\n", REDHAT_COPYRIGHT);
-			exit(EXIT_SUCCESS);
-			break;
-
-		case 'X':
-			sdp->expert = TRUE;
-			break;
-
-		case ':':
-		case '?':
-			fprintf(stderr, "Please use '-h' for usage.\n");
-			exit(EXIT_FAILURE);
-			break;
-
-		case EOF:
-			cont = FALSE;
-			break;
-
-		case 1:
-			if (strcmp(optarg, "gfs2") == 0)
-				continue;
-			if (!sdp->device_name[0])
-				strcpy(sdp->device_name, optarg);
-			else if (!sdp->orig_fssize &&
-				 isdigit(optarg[0]))
-				sdp->orig_fssize = atol(optarg);
-			else
-				die("More than one device specified (try -h for help)\n");
-			break;
-
-		default:
-			die("unknown option: %c\n", optchar);
-			break;
-		};
-	}
-
-	if ((sdp->device_name[0] == 0) && (optind < argc))
-		strcpy(sdp->device_name, argv[optind++]);
-
-	if (sdp->device_name[0] == '\0')
-		die("no device specified (try -h for help)\n");
-
-	if (optind < argc)
-		sdp->orig_fssize = atol(argv[optind++]);
-
-	if (optind < argc)
-		die("Unrecognized argument: %s\n", argv[optind]);
-
-	if (sdp->debug) {
-		printf("Command Line Arguments:\n");
-		printf("  bsize = %u\n", sdp->bsize);
-		printf("  qcsize = %u\n", sdp->qcsize);
-		printf("  jsize = %u\n", sdp->jsize);
-		printf("  journals = %u\n", sdp->md.journals);
-		printf("  override = %d\n", sdp->override);
-		printf("  proto = %s\n", sdp->lockproto);
-		printf("  quiet = %d\n", sdp->quiet);
-		if (sdp->rgsize==-1)
-			printf("  rgsize = optimize for best performance\n");
-		else
-			printf("  rgsize = %u\n", sdp->rgsize);
-		printf("  table = %s\n", sdp->locktable);
-		printf("  utsize = %u\n", sdp->utsize);
-		printf("  device = %s\n", sdp->device_name);
-		if (sdp->orig_fssize)
-			printf("  block-count = %llu\n",
-			       (unsigned long long)sdp->orig_fssize);
-	}
-}
-
-static void
-verify_arguments(struct gfs2_sbd *sdp)
-{
-	unsigned int x;
-
-	if (!sdp->expert)
-		test_locking(sdp->lockproto, sdp->locktable);
-
-	/* Block sizes must be a power of two from 512 to 65536 */
-
-	for (x = 512; x; x <<= 1)
-		if (x == sdp->bsize)
-			break;
-
-	if (!x || sdp->bsize > 65536)
-		die("block size must be a power of two between 512 and 65536\n");
-
-	/* Look at this!  Why can't we go bigger than 2GB? */
-	if (sdp->expert) {
-		if (1 > sdp->rgsize || sdp->rgsize > 2048)
-			die("bad resource group size\n");
-	} else {
-		if (32 > sdp->rgsize || sdp->rgsize > 2048)
-			die("bad resource group size\n");
-	}
-
-	if (!sdp->md.journals)
-		die("no journals specified\n");
-
-	if (sdp->jsize < 8 || sdp->jsize > 1024)
-		die("bad journal size\n");
-
-	if (!sdp->utsize || sdp->utsize > 64)
-		die("bad unlinked size\n");
-
-	if (!sdp->qcsize || sdp->qcsize > 64)
-		die("bad quota change size\n");
-}
-
-/**
- * are_you_sure - protect lusers from themselves
- * @sdp: the command line
- *
- */
-
-static void are_you_sure(struct gfs2_sbd *sdp)
-{
-	char input[32];
-	struct volume_id *vid = NULL;
-	int fd;
-
-	fd = open(sdp->device_name, O_RDONLY);
-	if (fd < 0)
-		die("Error: device %s not found.\n", sdp->device_name);
-	vid = volume_id_open_fd(fd);
-	if (vid == NULL) {
-		close(fd);
-		die("error identifying the contents of %s: %s\n",
-		    sdp->device_name, strerror(errno));
-	}
-	printf("This will destroy any data on %s.\n", sdp->device_name);
-	if (volume_id_probe_all(vid, 0, sdp->device_size) == 0) {
-		const char *fstype, *fsusage;
-		int rc;
-
-		rc = volume_id_get_type(vid, &fstype);
-		if (rc) {
-			rc = volume_id_get_usage(vid, &fsusage);
-			if (!rc || strncmp(fsusage, "other", 5) == 0)
-				fsusage = "partition";
-			printf("  It appears to contain a %s %s.\n", fstype,
-			       fsusage);
-		}
-	}
-	volume_id_close(vid);
-	close(fd);
-	printf("\nAre you sure you want to proceed? [y/n] ");
-	if(!fgets(input, 32, stdin))
-		die("unable to read from stdin\n");
-
-	if (input[0] != 'y')
-		die("aborted\n");
-	else
-		printf("\n");
-}
-
-/**
- * check_mount - check to see if device is mounted/busy
- * @device: the device to create the filesystem on
- *
- */
-
-void check_mount(char *device)
-{
-	struct stat st_buf;
-	int fd;
-
-	if (stat(device, &st_buf) < 0)
-		die("could not stat device %s\n", device);
-	if (!S_ISBLK(st_buf.st_mode))
-		die("%s is not a block device\n", device);
-
-	fd = open(device, O_RDONLY | O_NONBLOCK | O_EXCL);
-
-	if (fd < 0) {
-		if (errno == EBUSY) {
-			die("device %s is busy\n", device);
-		}
-	}
-	else {
-		close(fd);
-	}
-
-	return;
-}
-
-/**
- * print_results - print out summary information
- * @sdp: the command line
- *
- */
-
-static void
-print_results(struct gfs2_sbd *sdp, uint64_t real_device_size)
-{
-	if (sdp->debug)
-		printf("\n");
-	else if (sdp->quiet)
-		return;
-
-	if (sdp->expert)
-		printf("Expert mode:               on\n");
-
-	printf("Device:                    %s\n", sdp->device_name);
-
-	printf("Blocksize:                 %u\n", sdp->bsize);
-	printf("Device Size                %.2f GB (%"PRIu64" blocks)\n",
-	       real_device_size / ((float)(1 << 30)),
-	       real_device_size / sdp->bsize);
-	printf("Filesystem Size:           %.2f GB (%"PRIu64" blocks)\n",
-	       sdp->fssize / ((float)(1 << 30)) * sdp->bsize, sdp->fssize);
-
-	printf("Journals:                  %u\n", sdp->md.journals);
-	printf("Resource Groups:           %"PRIu64"\n", sdp->rgrps);
-
-	printf("Locking Protocol:          \"%s\"\n", sdp->lockproto);
-	printf("Lock Table:                \"%s\"\n", sdp->locktable);
-
-	if (sdp->debug) {
-		printf("\n");
-		printf("Spills:                    %u\n",
-		       sdp->buf_list.spills);
-		printf("Writes:                    %u\n", sdp->writes);
-	}
-
-	printf("\n");
-}
-
-/**
- * main_mkfs - do everything
- * @argc:
- * @argv:
- *
- */
-
-void
-main_mkfs(int argc, char *argv[])
-{
-	struct gfs2_sbd sbd, *sdp = &sbd;
-	int error;
-	int rgsize_specified = 0;
-	uint64_t real_device_size;
-
-	memset(sdp, 0, sizeof(struct gfs2_sbd));
-	sdp->bsize = GFS2_DEFAULT_BSIZE;
-	sdp->jsize = GFS2_DEFAULT_JSIZE;
-	sdp->rgsize = -1;
-	sdp->utsize = GFS2_DEFAULT_UTSIZE;
-	sdp->qcsize = GFS2_DEFAULT_QCSIZE;
-	strcpy(sdp->lockproto, GFS2_DEFAULT_LOCKPROTO);
-	sdp->time = time(NULL);
-	osi_list_init(&sdp->rglist);
-	init_buf_list(sdp, &sdp->buf_list, 128 << 20);
-	init_buf_list(sdp, &sdp->nvbuf_list, 0xffffffff);
-
-	decode_arguments(argc, argv, sdp);
-	if (sdp->rgsize == -1)                 /* if rg size not specified */
-		sdp->rgsize = GFS2_DEFAULT_RGSIZE; /* default it for now */
-	else
-		rgsize_specified = TRUE;
-
-	verify_arguments(sdp);
-
-	check_mount(sdp->device_name);
-
-	sdp->device_fd = open(sdp->device_name, O_RDWR);
-	if (sdp->device_fd < 0)
-		die("can't open device %s: %s\n",
-		    sdp->device_name, strerror(errno));
-
-	if (!sdp->override)
-		are_you_sure(sdp);
-
-	compute_constants(sdp);
-
-	/* Get the device geometry */
-
-	device_size(sdp->device_fd, &real_device_size);
-	device_geometry(sdp);
-	/* Convert optional block-count to basic blocks */
-	if (sdp->orig_fssize) {
-		sdp->orig_fssize *= sdp->bsize;
-		sdp->orig_fssize >>= GFS2_BASIC_BLOCK_SHIFT;
-		if (sdp->orig_fssize > sdp->device.length) {
-			fprintf(stderr, "%s: Specified block count is bigger "
-				"than the actual device.\n", prog_name);
-			die("Device Size is %.2f GB (%"PRIu64" blocks)\n",
-			       real_device_size / ((float)(1 << 30)),
-			       real_device_size / sdp->bsize);
-		}
-		sdp->device.length = sdp->orig_fssize;
-	}
-	fix_device_geometry(sdp);
-
-	/* Compute the resource group layouts */
-
-	compute_rgrp_layout(sdp, rgsize_specified);
-
-	/* Build ondisk structures */
-
-	build_rgrps(sdp, TRUE);
-	build_root(sdp);
-	build_master(sdp);
-	build_sb(sdp);
-	build_jindex(sdp);
-	build_per_node(sdp);
-	build_inum(sdp);
-	build_statfs(sdp);
-	build_rindex(sdp);
-	build_quota(sdp);
-
-	do_init(sdp);
-
-	/* Cleanup */
-
-	inode_put(sdp->md.rooti, updated);
-	inode_put(sdp->master_dir, updated);
-	inode_put(sdp->md.inum, updated);
-	inode_put(sdp->md.statfs, updated);
-	bsync(&sdp->buf_list);
-	bsync(&sdp->nvbuf_list);
-
-	error = fsync(sdp->device_fd);
-	if (error)
-		die("can't fsync device (%d): %s\n",
-		    error, strerror(errno));
-	error = close(sdp->device_fd);
-	if (error)
-		die("error closing device (%d): %s\n",
-		    error, strerror(errno));
-
-	print_results(sdp, real_device_size);
-}
diff --git a/gfs2/mount/Makefile b/gfs2/mount/Makefile
deleted file mode 100644
index 8706b17..0000000
--- a/gfs2/mount/Makefile
+++ /dev/null
@@ -1,38 +0,0 @@
-TARGET1= mount.gfs2
-
-all: ${TARGET1}
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-
-OBJS1=	mount.gfs2.o \
-	ondisk1.o \
-	util.o \
-	mtab.o
-
-CFLAGS += -DHELPER_PROGRAM -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
-CFLAGS += -I${gfskincdir}
-CFLAGS += -I${KERNEL_SRC}/fs/gfs2/ -I${KERNEL_SRC}/include/
-CFLAGS += -I$(SRCDIR)/group/libgfscontrol
-CFLAGS += -I$(S)/../include
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L../../group/libgfscontrol -lgfscontrol
-LDFLAGS += -L${libdir}
-
-LDDEPS += ../../group/libgfscontrol/libgfscontrol.a
-
-${TARGET1}: ${OBJS1} ${LDDEPS}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-install:
-	mkdir -p ${DESTDIR}/sbin
-	install ${TARGET1} ${DESTDIR}/sbin
-
-uninstall:
-	${UNINSTALL} ${TARGET1} ${DESTDIR}/sbin
-
-clean: generalclean
-
--include $(OBJS1:.o=.d)
diff --git a/gfs2/mount/mount.gfs2.c b/gfs2/mount/mount.gfs2.c
deleted file mode 100644
index 1bf18d0..0000000
--- a/gfs2/mount/mount.gfs2.c
+++ /dev/null
@@ -1,261 +0,0 @@
-#include "util.h"
-
-char *prog_name;
-char *fsname;
-int verbose, fake_mount = 0, no_mtab = 0;
-static sigset_t old_sigset;
-
-static void print_version(void)
-{
-	printf("mount.gfs2 %s (built %s %s)\n", RELEASE_VERSION,
-	       __DATE__, __TIME__);
-}
-
-static void print_usage(void)
-{
-	printf("Usage:\n");
-	printf("This program is called by mount(8), it should not be used directly.\n");
-}
-
-static void block_sigint(void)
-{
-	sigset_t new;
-
-	sigemptyset(&new);
-	sigaddset(&new, SIGINT);
-	sigprocmask(SIG_BLOCK, &new, &old_sigset);
-}
-
-static void unblock_sigint(void)
-{
-	sigprocmask(SIG_SETMASK, &old_sigset, NULL);
-}
-
-static void read_options(int argc, char **argv, struct mount_options *mo)
-{
-	int cont = 1;
-	int optchar;
-	char *real;
-
-	/* FIXME: check for "quiet" option and don't print in that case */
-
-	while (cont) {
-		optchar = getopt(argc, argv, "hVo:t:vfn");
-
-		switch (optchar) {
-		case EOF:
-			cont = 0;
-			break;
-
-		case 'h':
-			print_usage();
-			exit(EXIT_SUCCESS);
-
-		case 'V':
-			print_version();
-			exit(EXIT_SUCCESS);
-
-		case 'v':
-			++verbose;
-			break;
-
-		case 'o':
-			if (optarg)
-				strncpy(mo->opts, optarg, PATH_MAX);
-			break;
-
-		case 't':
-			if (optarg)
-				strncpy(mo->type, optarg, 4);
-			break;
-
-		case 'f':
-			fake_mount = 1;
-			break;
-			
-		case 'n':
-			no_mtab = 1;
-			break;
-
-		default:
-			break;
-		}
-	}
-
-	if (optind < argc && argv[optind]) {
-		real = realpath(argv[optind], NULL);
-		if (!real)
-			die("invalid device path \"%s\"\n", argv[optind]);
-		strncpy(mo->dev, real, PATH_MAX);
-		free(real);
-	}
-
-	++optind;
-
-	if (optind < argc && argv[optind]) {
-		real = realpath(argv[optind], NULL);
-		if (!real)
-			die("invalid mount point path \"%s\"\n", argv[optind]);
-		strncpy(mo->dir, real, PATH_MAX);
-		free(real);
-	}
-
-	log_debug("mount %s %s", mo->dev, mo->dir);
-}
-
-static void check_options(struct mount_options *mo)
-{
-	struct stat buf;
-
-	if (!strlen(mo->dev))
-		die("no device name specified\n");
-
-	if (!strlen(mo->dir))
-		die("no mount point specified\n");
-
-	if (strlen(mo->type) && strcmp(mo->type, fsname))
-		die("unknown file system type \"%s\"\n", mo->type);
-
-	if (stat(mo->dir, &buf) < 0)
-		die("mount point %s does not exist\n", mo->dir);
-
-	if (!S_ISDIR(buf.st_mode))
-		die("mount point %s is not a directory\n", mo->dir);
-}
-
-static int mount_lockproto(char *proto, struct mount_options *mo,
-			   struct gen_sb *sb)
-{
-	int rv = 0;
-
-	if (!strcmp(proto, "lock_dlm")) {
-		if (mo->flags & MS_REMOUNT) {
-			rv = lock_dlm_remount(mo, sb);
-			strncpy(mo->extra_plus, mo->extra, PATH_MAX);
-		}
-		else
-			rv = lock_dlm_join(mo, sb);
-	} else
-		strncpy(mo->extra_plus, mo->extra, PATH_MAX);
-
-	return rv;
-}
-
-static void mount_done_lockproto(char *proto, struct mount_options *mo,
-			     	    struct gen_sb *sb, int result)
-{
-	if (!strcmp(proto, "lock_dlm"))
-		lock_dlm_mount_done(mo, sb, result);
-}
-
-static void umount_lockproto(char *proto, struct mount_options *mo,
-			     struct gen_sb *sb, int mnterr)
-{
-	if (!strcmp(proto, "lock_dlm"))
-		lock_dlm_leave(mo, sb, mnterr);
-}
-
-#if 0
-static void check_sys_fs(char *fsname)
-{
-	DIR *d;
-	struct dirent *de;
-
-	d = opendir("/sys/fs/");
-	if (!d)
-		die("no /sys/fs/ directory found: %d\n", errno);
-
-	while ((de = readdir(d))) {
-		if (strnlen(fsname, 5) != strnlen(de->d_name, 5))
-			continue;
-		if (!strncmp(fsname, de->d_name, strnlen(fsname, 5))) {
-			closedir(d);
-			return;
-		}
-	}
-	closedir(d);
-	die("fs type \"%s\" not found in /sys/fs/, is the module loaded?\n",
-	    fsname);
-}
-#endif
-
-int main(int argc, char **argv)
-{
-	struct mount_options mo;
-	struct gen_sb sb;
-	char *proto;
-	int rv = 0;
-
-	memset(&mo, 0, sizeof(mo));
-	memset(&sb, 0, sizeof(sb));
-
-	prog_name = argv[0];
-
-	if (!strstr(prog_name, "gfs"))
-		die("invalid mount helper name \"%s\"\n", prog_name);
-
-	fsname = (strstr(prog_name, "gfs2")) ? "gfs2" : "gfs";
-	strcpy(mo.type, fsname);
-
-	if (argc < 2) {
-		print_usage();
-		exit(EXIT_SUCCESS);
-	}
-
-	/* This breaks on-demand fs module loading from the kernel; could we
-	   try to load the module first here and then check again and fail if
-	   nothing?  I'd really like to avoid joining the group and then
-	   backing out if the mount fails to load the module. */
-	/* check_sys_fs(fsname); */
-
-	read_options(argc, argv, &mo);
-	check_options(&mo);
-	get_sb(mo.dev, &sb);
-	parse_opts(&mo);
-
-	proto = select_lockproto(&mo, &sb);
-
-	/* there are three parts to the mount and we want all three or none
-	   to happen:  joining the mountgroup, doing the kernel mount, and
-	   adding the mtab entry */
-	block_sigint();
-
-	if (fake_mount)
-		goto do_mtab;
-
-	rv = mount_lockproto(proto, &mo, &sb);
-	if (rv < 0)
-		die("error mounting lockproto %s\n", proto);
-
-	rv = mount(mo.dev, mo.dir, fsname, mo.flags, mo.extra_plus);
-	if (rv) {
-		log_debug("mount(2) failed error %d errno %d", rv, errno);
-		mount_done_lockproto(proto, &mo, &sb, rv);
-
-		if (!(mo.flags & MS_REMOUNT))
-			umount_lockproto(proto, &mo, &sb, errno);
-
-		if (errno == EBUSY)
-			die("%s already mounted or %s busy\n", mo.dev, mo.dir);
-		die("error mounting %s on %s: %s\n", mo.dev, mo.dir,
-		    strerror(errno));
-	}
-	log_debug("mount(2) ok");
-	mount_done_lockproto(proto, &mo, &sb, 0);
-
- do_mtab:
-	if (no_mtab)
-		goto out;
-
-	if (mo.flags & MS_REMOUNT) {
-                del_mtab_entry(&mo);
-                add_mtab_entry(&mo);
-        } else
-		add_mtab_entry(&mo);
-
- out:
-	unblock_sigint();
-
-	return rv ? 1 : 0;
-}
-
diff --git a/gfs2/mount/mtab.c b/gfs2/mount/mtab.c
deleted file mode 100644
index 9d6dba1..0000000
--- a/gfs2/mount/mtab.c
+++ /dev/null
@@ -1,198 +0,0 @@
-#include "util.h"
-
-extern char *prog_name;
-extern char *fsname;
-extern int verbose;
-static int ignoring_mtab;
-
-/* Don't bother with /etc/mtab if:
-   - /etc/mtab is a link to /proc/mounts
-   - there is no /etc/mtab file
-   - we can't write to /etc/mtab */
-
-static int ignore_mtab(void)
-{
-	struct stat sbuf;
-	int fd;
-
-	if (ignoring_mtab)
-		return 1;
-
-	if (lstat("/etc/mtab", &sbuf) < 0)
-		goto do_ignore;
-
-	if (S_ISLNK(sbuf.st_mode))
-		goto do_ignore;
-
-	fd = open("/etc/mtab", O_RDWR, 0644);
-	if (fd < 0)
-		goto do_ignore;
-
-	close(fd);
-	return 0;
-
- do_ignore:
-	ignoring_mtab = 1;
-	return 1;
-}
-
-/* Whichever process successfully links their own /etc/mtab~pid file to
-   /etc/mtab~ gets the lock.  We just sleep/retry until we get the lock.
-   This is the locking method used by util-linux/mount/fstab.c which we
-   need to keep in sync with. */
-
-static void lock_mtab(void)
-{
-	char fname[32];
-	int rv, fd, e, retries = 0;
-
-	if (ignore_mtab())
-		return;
-
-	sprintf(fname, "/etc/mtab~%d", getpid());
- retry:
-	fd = open(fname, O_WRONLY|O_CREAT, 0);
-	e = errno;
-	if (fd < 0)
-		die("can't create mtab lock file %s: %s\n", fname, strerror(e));
-	close(fd);
-
-	rv = link(fname, "/etc/mtab~");
-	e = errno;
-
-	unlink(fname);
-
-	if (rv < 0 && e != EEXIST)
-		die("can't link %s to /etc/mtab~: %s\n", fname, strerror(e));
-
-	if (rv < 0) {
-		if (++retries > 5)
-			warn("waiting to lock /etc/mtab~: try unlinking "
-			     "stale /etc/mtab~ file\n");
-		sleep(1);
-		goto retry;
-	}
-}
-
-static void unlock_mtab(void)
-{
-	if (ignore_mtab())
-		return;
-	unlink("/etc/mtab~");
-}
-
-void add_mtab_entry(struct mount_options *mo)
-{
-	FILE *file;
-
-	read_proc_mounts(mo);
-
-	if (ignore_mtab())
-		return;
-
-	lock_mtab();
-
-	file = fopen("/etc/mtab", "a");
-	if (!file) {
-		warn("can't add entry to /etc/mtab");
-		return;
-	}
-
-	fprintf(file, "%s", mo->proc_entry);
-
-	fclose(file);
-
-	unlock_mtab();
-}
-
-/* This follows what util-linux/mount/fstab.c does wrt writing new mtab.tmp
-   and replacing /etc/mtab with it, we need to keep in sync with fstab.c's
-   procedure for this. */
-
-void del_mtab_entry(struct mount_options *mo)
-{
-	char line[PATH_MAX];
-	char device[PATH_MAX];
-	char path[PATH_MAX];
-	char type[16];
-	FILE *mtab, *mtmp;
-	mode_t old_umask;
-	struct stat sbuf;
-	int found = 0;
-
-	if (ignore_mtab())
-		return;
-
-	lock_mtab();
-
-	old_umask = umask(077);
-
-	mtmp = fopen("/etc/mtab.tmp", "w");
-	mtab = fopen("/etc/mtab", "r");
-
-	umask(old_umask);
-
-	if (!mtmp || !mtab)
-		goto fail;
-
-	while (fgets(line, PATH_MAX, mtab)) {
-		/* exclude the line matching the fs being unmounted
-		   from the next version of mtab */
-
-		if ((sscanf(line, "%s %s %s", device, path, type) == 3) &&
-		    (strncmp(type, "gfs", 3) == 0) &&
-		    (strcmp(path, mo->dir) == 0) &&
-		    (strcmp(device, mo->dev) == 0)) {
-			found = 1;
-			continue;
-		}
-
-		/* all other lines from mtab are included in
-		   the next version of mtab */
-
-		if (fprintf(mtmp, "%s", line) < 0) {
-			int e = errno;
-			warn("error writing to /etc/mtab.tmp: %s", strerror(e));
-		}
-	}
-
-	if (!found) {
-		warn("file system mounted on %s not found in mtab", mo->dir);
-		goto fail;
-	}
-
-	if (fchmod(fileno(mtmp), S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) < 0) {
-		int e = errno;
-		warn("error changing mode of /etc/mtab.tmp: %s", strerror(e));
-	}
-
-	if (stat("/etc/mtab", &sbuf) < 0) {
-		int e = errno;
-		warn("error stating /etc/mtab: %s", strerror(e));
-	} else
-		if(chown("/etc/mtab.tmp", sbuf.st_uid, sbuf.st_gid) < 0) {
-			int e = errno;
-			warn("error changing owner of /etc/mtab.tmp: %s", strerror(e));
-		}
-
-	fclose(mtmp);
-	fclose(mtab);
-
-	if (rename("/etc/mtab.tmp", "/etc/mtab") < 0) {
-		int e = errno;
-		warn("can't rename /etc/mtab.tmp to /etc/mtab: %s",
-		     strerror(e));
-		goto fail_unlink;
-	}
-
-	unlock_mtab();
-	return;
-
- fail:
-	fclose(mtmp);
-	fclose(mtab);
- fail_unlink:
-	unlink("/etc/mtab.tmp");
-	unlock_mtab();
-}
-
diff --git a/gfs2/mount/ondisk1.c b/gfs2/mount/ondisk1.c
deleted file mode 100644
index 0a64021..0000000
--- a/gfs2/mount/ondisk1.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-#include <inttypes.h>
-
-#include "linux_endian.h"
-
-#define printk printf
-#define pv(struct, member, fmt) printf("  "#member" = "fmt"\n", struct->member);
-
-#define ENTER(x)
-#define EXIT(x)
-#define RET(x) return
-#define RETURN(x, y) return y
-
-#define WANT_GFS_CONVERSION_FUNCTIONS
-#include "gfs_ondisk.h"
-
diff --git a/gfs2/mount/util.c b/gfs2/mount/util.c
deleted file mode 100644
index 782e5e8..0000000
--- a/gfs2/mount/util.c
+++ /dev/null
@@ -1,572 +0,0 @@
-#include "util.h"
-#include "libgfscontrol.h"
-
-extern char *prog_name;
-extern char *fsname;
-extern int verbose;
-
-static int gfs_controld_fd;
-
-/* opt_map stuff from util-linux */
-
-struct opt_map {
-	char *opt;      /* option name */
-	int skip;       /* skip in mtab option string (gfs: not used) */
-	int inv;	/* true if flag value should be inverted */
-	int mask;       /* flag mask value */
-};
-
-static struct opt_map opt_map[] = {
-  { "defaults", 0, 0, 0	 },      /* default options */
-  { "ro",       1, 0, MS_RDONLY },      /* read-only */
-  { "rw",       1, 1, MS_RDONLY },      /* read-write */
-  { "exec",     0, 1, MS_NOEXEC },      /* permit execution of binaries */
-  { "noexec",   0, 0, MS_NOEXEC },      /* don't execute binaries */
-  { "suid",     0, 1, MS_NOSUID },      /* honor suid executables */
-  { "nosuid",   0, 0, MS_NOSUID },      /* don't honor suid executables */
-  { "dev",      0, 1, MS_NODEV  },      /* interpret device files  */
-  { "nodev",    0, 0, MS_NODEV  },      /* don't interpret devices */
-  { "sync",     0, 0, MS_SYNCHRONOUS},  /* synchronous I/O */
-  { "async",    0, 1, MS_SYNCHRONOUS},  /* asynchronous I/O */
-  { "remount",  0, 0, MS_REMOUNT},      /* Alter flags of mounted FS */
-  { "bind",     0, 0, MS_BIND   },      /* Remount part of tree elsewhere */
-  { "mand",     0, 0, MS_MANDLOCK },    /* Allow mandatory locks on this FS */
-  { "nomand",   0, 1, MS_MANDLOCK },    /* Forbid mandatory locks on this FS */
-  { "atime",    0, 1, MS_NOATIME },     /* Update access time */
-  { "noatime",  0, 0, MS_NOATIME },     /* Do not update access time */
-  { "diratime", 0, 1, MS_NODIRATIME },  /* Update dir access times */
-  { "nodiratime", 0, 0, MS_NODIRATIME },/* Do not update dir access times */
-
-  /* options used by the mount command only (not in sys/mount.h): */
-  { "dirsync",  0, 0, 0  },           /* synchronous directory modifications */
-  { "loop",     1, 0, 0  },             /* use a loop device */
-  { "auto",     0, 1, 0  },             /* Can be mounted using -a */
-  { "noauto",   0, 0, 0  },             /* Can  only be mounted explicitly */
-  { "users",    0, 0, 0  },             /* Allow ordinary user to mount */
-  { "nousers",  0, 1, 0  },             /* Forbid ordinary user to mount */
-  { "user",     0, 0, 0  },             /* Allow ordinary user to mount */
-  { "nouser",   0, 1, 0  },             /* Forbid ordinary user to mount */
-  { "owner",    0, 0, 0  },             /* Let the owner of the device mount */
-  { "noowner",  0, 1, 0  },             /* Device owner has no special privs */
-  { "_netdev",  0, 0, 0  },             /* Network device required (netfs) */
-  { NULL,       0, 0, 0	 }
-};
-
-/* if option has a corresponding MS_XXX, set the bit in the flags */
-
-static int set_flag(char *o, int *flags)
-{
-	struct opt_map *om;
-
-	for (om = opt_map; om->opt; om++) {
-		if (strcmp(om->opt, o))
-			continue;
-
-		if (om->inv)
-			*flags &= ~om->mask;
-		else
-			*flags |= om->mask;
-
-		log_debug("  %s flag %x for \"%s\", flags = %x",
-		       	  om->inv ? "clear" : "set", om->mask, om->opt, *flags);
-
-		return 1;
-	}
-
-	return 0;
-}
-
-/* opts is the string of all mount options, this function finds
-   the options that have MS_XXX flags and sets the appropriate flag
-   bit.  The options without an MS_ flag are copied into the extra
-   string.  The values of some specific options are saved for later
-   internal use. */
-
-void parse_opts(struct mount_options *mo)
-{
-	char data[PATH_MAX+1];
-	char *options, *o, *v;
-	int extra_len = 0;
-
-	log_debug("parse_opts: opts = \"%s\"", mo->opts);
-
-	memset(data, 0, sizeof(data));
-	strncpy(data, mo->opts, PATH_MAX);
-
-	for (options = data; (o = strsep(&options, ",")); ) {
-		if (!*o)
-			continue;
-
-		if (set_flag(o, &mo->flags))
-			continue;
-
-		if (!strncmp("hostdata", o, 8)) {
-			if (mo->hostdata[0])
-				warn("duplicate hostdata strings");
-			else
-				strcat(mo->hostdata, o);
-			continue;
-		}
-
-		if (extra_len + 1 + strlen(o) > PATH_MAX)
-			die("extra options string is too long\n");
-
-		if (mo->extra[0]) {
-			strcat(mo->extra, ",");
-			extra_len += 1;
-		}
-
-		log_debug("  add extra %s", o);
-
-		strcat(mo->extra, o);
-		extra_len += strlen(o);
-
-		v = strchr(o, '=');
-		if (v)
-			*v++ = 0;
-
-		/* we grab these now so we don't have to parse them out
-		   again later when doing proto-specific stuff */
-
-		if (!strcmp(o, "lockproto")) {
-			if (!v)
-				die("option lockproto needs value\n");
-			strncpy(mo->lockproto, v, 255);
-		}
-
-		if (!strcmp(o, "locktable")) {
-			if (!v)
-				die("option locktable needs value\n");
-			strncpy(mo->locktable, v, 255);
-		}
-	}
-
-	/* Hack to get the noatime/nodiratime option through to gfs */
-	if ((mo->flags & (MS_NOATIME | MS_NODIRATIME)) &&
-	    (strcmp(mo->type, "gfs") == 0)) {
-		strcat(mo->extra, "gfs_noatime");
-		extra_len += strlen("gfs_noatime");
-	}
-
-	log_debug("parse_opts: flags = %x", mo->flags);
-	log_debug("parse_opts: extra = \"%s\"", mo->extra);
-	log_debug("parse_opts: hostdata = \"%s\"", mo->hostdata);
-	log_debug("parse_opts: lockproto = \"%s\"", mo->lockproto);
-	log_debug("parse_opts: locktable = \"%s\"", mo->locktable);
-}
-
-/* - when unmounting, we don't know the dev and need this function to set it;
-   we also want to select the _last_ line with a matching dir since it will
-   be the top-most fs that the umount(2) will unmount
-   - when mounting, we do know the dev and need this function to use it in the
-   comparison (for multiple fs's with the same mountpoint) */
-
-void read_proc_mounts(struct mount_options *mo)
-{
-	FILE *file;
-	char line[PATH_MAX];
-	char path[PATH_MAX];
-	char type[PATH_MAX];
-	char opts[PATH_MAX];
-	char device[PATH_MAX];
-	char save_line[PATH_MAX];
-	char save_opts[PATH_MAX];
-	char save_device[PATH_MAX];
-	int found = 0;
-
-	file = fopen("/proc/mounts", "r");
-	if (!file)
-		die("can't open /proc/mounts: %s\n", strerror(errno));
-
-	while (fgets(line, PATH_MAX, file)) {
-		if (sscanf(line, "%s %s %s %s", device, path, type, opts) != 4)
-			continue;
-		if (strcmp(path, mo->dir))
-			continue;
-		if (mo->dev[0] && strcmp(device, mo->dev))
-			continue;
-		if (strcmp(type, fsname))
-			die("%s is not a %s filesystem\n", mo->dir, fsname);
-
-		/* when there is an input dev specified (mount), we should get
-		   only one matching line; when there is no input dev specified
-		   (umount), we want the _last_ matching line */
-
-		strncpy(save_device, device, PATH_MAX);
-		strncpy(save_opts, opts, PATH_MAX);
-		strncpy(save_line, line, PATH_MAX);
-		found = 1;
-	}
-
-	fclose(file);
-
-	if (!found)
-		die("can't find /proc/mounts entry for directory %s\n", mo->dir);
-	else {
-		strncpy(mo->dev, save_device, PATH_MAX);
-		strncpy(mo->opts, save_opts, PATH_MAX);
-		strncpy(mo->proc_entry, save_line, PATH_MAX);
-	}
-
-	log_debug("read_proc_mounts: device = \"%s\"", mo->dev);
-	log_debug("read_proc_mounts: opts = \"%s\"", mo->opts);
-}
-
-void gfs2_inum_in(struct gfs2_inum *no, char *buf)
-{
-	struct gfs2_inum *str = (struct gfs2_inum *)buf;
-
-	no->no_formal_ino = be64_to_cpu(str->no_formal_ino);
-	no->no_addr = be64_to_cpu(str->no_addr);
-}
-
-void gfs2_meta_header_in(struct gfs2_meta_header *mh, char *buf)
-{
-	struct gfs2_meta_header *str = (struct gfs2_meta_header *)buf;
-
-	mh->mh_magic = be32_to_cpu(str->mh_magic);
-	mh->mh_type = be32_to_cpu(str->mh_type);
-	mh->mh_format = be32_to_cpu(str->mh_format);
-}
-
-void gfs2_sb_in(struct gfs2_sb *sb, char *buf)
-{
-	struct gfs2_sb *str = (struct gfs2_sb *)buf;
-
-	gfs2_meta_header_in(&sb->sb_header, buf);
-
-	sb->sb_fs_format = be32_to_cpu(str->sb_fs_format);
-	sb->sb_multihost_format = be32_to_cpu(str->sb_multihost_format);
-	sb->sb_bsize = be32_to_cpu(str->sb_bsize);
-	sb->sb_bsize_shift = be32_to_cpu(str->sb_bsize_shift);
-
-	gfs2_inum_in(&sb->sb_master_dir, (char *)&str->sb_master_dir);
-	gfs2_inum_in(&sb->sb_root_dir, (char *)&str->sb_root_dir);
-
-	memcpy(sb->sb_lockproto, str->sb_lockproto, GFS2_LOCKNAME_LEN);
-	memcpy(sb->sb_locktable, str->sb_locktable, GFS2_LOCKNAME_LEN);
-}
-
-int get_sb(char *device, struct gen_sb *sb_out)
-{
-	int fd;
-
-	fd = open(device, O_RDONLY);
-	if (fd < 0)
-		die("can't open %s: %s\n", device, strerror(errno));
-
-	if (!strcmp(fsname, "gfs2")) {
-		char buf[GFS2_BASIC_BLOCK];
-		struct gfs2_sb sb;
-
-		do_lseek(fd, GFS2_SB_ADDR * GFS2_BASIC_BLOCK);
-		do_read(fd, buf, GFS2_BASIC_BLOCK);
-		gfs2_sb_in(&sb, buf);
-
-		if (sb.sb_header.mh_magic != GFS2_MAGIC ||
-	    	    sb.sb_header.mh_type != GFS2_METATYPE_SB) {
-			die("there isn't a GFS2 filesystem on %s, "
-			    "magic=%x type=%x\n", device,
-			    sb.sb_header.mh_magic, sb.sb_header.mh_type);
-		}
-
-		if (sb.sb_fs_format != GFS2_FORMAT_FS ||
-		    sb.sb_multihost_format != GFS2_FORMAT_MULTI) {
-			die("there appears to be a GFS, not GFS2, filesystem "
-			    "on %s\n", device);
-		}
-
-		strncpy(sb_out->lockproto, sb.sb_lockproto, 256);
-		strncpy(sb_out->locktable, sb.sb_locktable, 256);
-
-	} else if (!strcmp(fsname, "gfs")) {
-		char buf[GFS_BASIC_BLOCK];
-		struct gfs_sb sb;
-
-		do_lseek(fd, GFS_SB_ADDR * GFS_BASIC_BLOCK);
-		do_read(fd, buf, GFS2_BASIC_BLOCK);
-		gfs_sb_in(&sb, buf);
-
-		if (sb.sb_header.mh_magic != GFS_MAGIC ||
-		    sb.sb_header.mh_type != GFS_METATYPE_SB) {
-			die("there isn't a GFS filesystem on %s\n", device);
-		}
-
-		if (sb.sb_fs_format != GFS_FORMAT_FS ||
-		    sb.sb_multihost_format != GFS_FORMAT_MULTI) {
-			die("there appears to be a GFS2, not GFS, filesystem "
-			    "on %s\n", device);
-		}
-
-		strncpy(sb_out->lockproto, sb.sb_lockproto, 256);
-		strncpy(sb_out->locktable, sb.sb_locktable, 256);
-	}
-
-	close(fd);
-	return 0;
-}
-
-char *select_lockproto(struct mount_options *mo, struct gen_sb *sb)
-{
-	/* find the effective lockproto, proto specified in mount options
-	   overrides the sb lockproto */
-
-	if (mo->lockproto[0])
-		return mo->lockproto;
-	else
-		return sb->lockproto;
-}
-
-int lock_dlm_join(struct mount_options *mo, struct gen_sb *sb)
-{
-	struct gfsc_mount_args ma;
-	int fd, rv, result;
-
-	memset(&ma, 0, sizeof(ma));
-
-	strncpy(ma.dir, mo->dir, PATH_MAX);
-	strncpy(ma.type, fsname, PATH_MAX);
-	strncpy(ma.proto, "lock_dlm", PATH_MAX);
-	strncpy(ma.options, mo->opts, PATH_MAX);
-	strncpy(ma.dev, mo->dev, PATH_MAX);
-	if (mo->locktable[0])
-		strncpy(ma.table, mo->locktable, PATH_MAX);
-	else
-		strncpy(ma.table, sb->locktable, PATH_MAX);
-
-	fd = gfsc_fs_connect();
-	if (fd < 0) {
-		warn("gfs_controld join connect error: %s", strerror(errno));
-		return fd;
-	}
-
-	/* tell gfs_controld to join the mountgroup */
-
-	rv = gfsc_fs_join(fd, &ma);
-	if (rv < 0) {
-		warn("gfs_controld join write error: %s", strerror(errno));
-		goto fail;
-	}
-
-	/* read the result of the join from gfs_controld */
-
-	rv = gfsc_fs_result(fd, &result, &ma);
-	if (rv < 0) {
-		warn("gfs_controld result read error: %s", strerror(errno));
-		goto fail;
-	}
-
-	rv = result;
-
-	switch (rv) {
-	case 0:
-	case -EALREADY:
-		break;
-
-	case -EPROTONOSUPPORT:
-		warn("lockproto not supported");
-		goto fail;
-
-	case -EOPNOTSUPP:
-		warn("jid, first and id are reserved options");
-		goto fail;
-
-	case -EBADFD:
-		warn("no colon found in table name");
-		goto fail;
-
-	case -ENAMETOOLONG:
-		warn("fs name too long");
-		goto fail;
-
-	case -ESTALE:
-		warn("fs is being unmounted");
-		goto fail;
-
-	case -EADDRINUSE:
-		warn("different fs appears to exist with the same name");
-		goto fail;
-
-	case -EBUSY:
-		warn("mount point already used or other mount in progress");
-		goto fail;
-
-	case -ENOMEM:
-		warn("out of memory");
-		goto fail;
-
-	case -EBADR:
-		warn("fs is for a different cluster");
-		goto fail;
-
-	case -ENOANO:
-		warn("node not a member of the default fence domain");
-		goto fail;
-
-	case -EROFS:
-		warn("read-only mount invalid with spectator option");
-		goto fail;
-
-	case -EMLINK:
-		warn("option string too long");
-		goto fail;
-
-	default:
-		warn("gfs_controld join error: %d", rv);
-		goto fail;
-	}
-
-	/*
-	 * In addition to the result, gfs_controld also returns
-	 * "hostdata=jid=X:id=Y:first=Z" in ma.hostdata.
-	 * This is first combined with any hostdata the user gave on
-	 * the command line and then the full hostdata is combined
-	 * with the "extra" mount otions into the "extra_plus" string.
-	 */
-
-	if (strlen(mo->hostdata) + strlen(ma.hostdata) + 1 > PATH_MAX) {
-		warn("hostdata too long");
-		rv = -1;
-		goto fail;
-	}
-
-	if (!mo->hostdata[0])
-		snprintf(mo->hostdata, PATH_MAX, "%s", ma.hostdata);
-	else {
-		char *p = strstr(ma.hostdata, "=") + 1;
-		strcat(mo->hostdata, ":");
-		strcat(mo->hostdata, p);
-	}
-
-	log_debug("lock_dlm_join: hostdata: \"%s\"", mo->hostdata);
-
-	if (strlen(mo->extra) == 0)
-		snprintf(mo->extra_plus, PATH_MAX, "%s", mo->hostdata);
-	else
-		snprintf(mo->extra_plus, PATH_MAX, "%s,%s",
-			 mo->extra, mo->hostdata);
-
-	/* keep gfs_controld connection open and reuse it below to
-	   send the result of mount(2) to gfs_controld, except in
-	   the case of another mount (EALREADY) */
-	   
-	if (rv == -EALREADY)
-		gfsc_fs_disconnect(fd);
-	else
-		gfs_controld_fd = fd;
-
-	return 0;
-
- fail:
-	gfsc_fs_disconnect(fd);
-	return rv;
-}
-
-void lock_dlm_mount_done(struct mount_options *mo, struct gen_sb *sb,
-			 int result)
-{
-	struct gfsc_mount_args ma;
-	int rv;
-
-	if (!gfs_controld_fd)
-		return;
-
-	memset(&ma, 0, sizeof(ma));
-
-	strncpy(ma.dir, mo->dir, PATH_MAX);
-	strncpy(ma.type, fsname, PATH_MAX);
-	strncpy(ma.proto, "lock_dlm", PATH_MAX);
-	strncpy(ma.options, mo->opts, PATH_MAX);
-	strncpy(ma.dev, mo->dev, PATH_MAX);
-	if (mo->locktable[0])
-		strncpy(ma.table, mo->locktable, PATH_MAX);
-	else
-		strncpy(ma.table, sb->locktable, PATH_MAX);
-
-	/* tell gfs_controld the result of mount(2) */
-
-	rv = gfsc_fs_mount_done(gfs_controld_fd, &ma, result);
-	if (rv)
-		warn("gfs_controld mount_done write error: %s", strerror(errno));
-
-	gfsc_fs_disconnect(gfs_controld_fd);
-}
-
-int lock_dlm_leave(struct mount_options *mo, struct gen_sb *sb, int mnterr)
-{
-	struct gfsc_mount_args ma;
-	int rv;
-
-	memset(&ma, 0, sizeof(ma));
-
-	strncpy(ma.dir, mo->dir, PATH_MAX);
-	strncpy(ma.type, fsname, PATH_MAX);
-	if (mo->locktable[0])
-		strncpy(ma.table, mo->locktable, PATH_MAX);
-	else
-		strncpy(ma.table, sb->locktable, PATH_MAX);
-
-	rv = gfsc_fs_leave(&ma, mnterr);
-	if (rv)
-		warn("leave: gfs_controld leave error: %s", strerror(errno));
-
-	return rv;
-}
-
-int lock_dlm_remount(struct mount_options *mo, struct gen_sb *sb)
-{
-	struct gfsc_mount_args ma;
-	char *mode;
-	int fd, rv, result;
-
-	memset(&ma, 0, sizeof(ma));
-
-	if (strstr(mo->extra, "spectator")) {
-		warn("spectator remounts not allowed");
-		return -1;
-	}
-
-	if (mo->flags & MS_RDONLY)
-		mode = "ro";
-	else
-		mode = "rw";
-
-	strncpy(ma.dir, mo->dir, PATH_MAX);
-	strncpy(ma.type, fsname, PATH_MAX);
-	strncpy(ma.options, mode, PATH_MAX);
-	if (mo->locktable[0])
-		strncpy(ma.table, mo->locktable, PATH_MAX);
-	else
-		strncpy(ma.table, sb->locktable, PATH_MAX);
-
-
-	fd = gfsc_fs_connect();
-	if (fd < 0) {
-		warn("gfs_controld remount connect error: %s", strerror(errno));
-		return fd;
-	}
-
-	/* tell gfs_controld about the new mount options */
-
-	rv = gfsc_fs_remount(fd, &ma);
-	if (rv) {
-		warn("gfs_controld remount write error: %s", strerror(errno));
-		goto out;
-	}
-
-	/* read the result of the remount from gfs_controld */
-
-	rv = gfsc_fs_result(fd, &result, &ma);
-	if (rv < 0) {
-		warn("gfs_controld result read error: %s", strerror(errno));
-		goto out;
-	}
-
-	rv = result;
-	if (rv)
-		warn("remount not allowed from gfs_controld");
- out:
-	gfsc_fs_disconnect(fd);
-	return rv;
-}
-
diff --git a/gfs2/mount/util.h b/gfs2/mount/util.h
deleted file mode 100644
index 14c5182..0000000
--- a/gfs2/mount/util.h
+++ /dev/null
@@ -1,93 +0,0 @@
-#ifndef __MOUNT_DOT_H__
-#define __MOUNT_DOT_H__
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mount.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <limits.h>
-#include <dirent.h>
-#include <errno.h>
-#include <signal.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <linux/types.h>
-#include <linux/gfs2_ondisk.h>
-#include "gfs_ondisk.h"
-#include "linux_endian.h"
-
-#define die(fmt, args...) \
-do { \
-	fprintf(stderr, "%s: ", prog_name); \
-	fprintf(stderr, fmt, ##args); \
-	exit(EXIT_FAILURE); \
-} while (0)
-
-#define warn(fmt, args...) \
-do { \
-	fprintf(stderr, "%s: " fmt "\n", prog_name, ##args); \
-} while (0)
-
-#define log_debug(fmt, args...) \
-do { \
-	if (verbose) \
-		printf("%s: " fmt "\n", prog_name, ##args); \
-} while (0)
-
-#define do_lseek(fd, off) \
-do { \
-	if (lseek((fd), (off), SEEK_SET) != (off)) \
-		die("bad seek: %s on line %d of file %s\n", \
-		    strerror(errno),__LINE__, __FILE__); \
-} while (0)
-
-#define do_read(fd, buff, len) \
-do { \
-	if (read((fd), (buff), (len)) != (len)) \
-		die("bad read: %s on line %d of file %s\n", \
-		    strerror(errno), __LINE__, __FILE__); \
-} while (0)
-
-struct mount_options {
-	char dev[PATH_MAX+1];
-	char dir[PATH_MAX+1];
-	char opts[PATH_MAX+1];
-	char hostdata[PATH_MAX+1];
-	char extra[PATH_MAX+1];
-	char extra_plus[PATH_MAX+1];
-	char type[5]; 
-	char lockproto[256];
-	char locktable[256];
-	char proc_entry[PATH_MAX+1];
-	int flags;
-};
-
-struct gen_sb {
-	char lockproto[256];
-	char locktable[256];
-};
-
-/* util.c */
-
-char *select_lockproto(struct mount_options *mo, struct gen_sb *sb);
-void parse_opts(struct mount_options *mo);
-void read_proc_mounts(struct mount_options *mo);
-int get_sb(char *device, struct gen_sb *sb_out);
-int lock_dlm_join(struct mount_options *mo, struct gen_sb *sb);
-void lock_dlm_mount_done(struct mount_options *mo, struct gen_sb *sb, int result);
-int lock_dlm_leave(struct mount_options *mo, struct gen_sb *sb, int mnterr);
-int lock_dlm_remount(struct mount_options *mo, struct gen_sb *sb);
-
-/* mtab.c */
-
-void add_mtab_entry(struct mount_options *mo);
-void del_mtab_entry(struct mount_options *mo);
-
-#endif
-
diff --git a/gfs2/quota/Makefile b/gfs2/quota/Makefile
deleted file mode 100644
index 165df2d..0000000
--- a/gfs2/quota/Makefile
+++ /dev/null
@@ -1,35 +0,0 @@
-TARGET= gfs2_quota
-
-SBINDIRT=$(TARGET)
-
-all: depends ${TARGET}
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-OBJS=	main.o \
-	names.o \
-	check.o
-
-CFLAGS += -DHELPER_PROGRAM -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
-CFLAGS += -I${KERNEL_SRC}/fs/gfs2/ -I${KERNEL_SRC}/include/
-CFLAGS += -I$(S)/../include -I$(S)/../libgfs2
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L../libgfs2 -lgfs2
-LDFLAGS += -L${libdir}
-
-LDDEPS += ../libgfs2/libgfs2.a
-
-${TARGET}: ${OBJS} ${LDDEPS}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-depends:
-	$(MAKE) -C ../libgfs2 all
-
-clean: generalclean
-
--include $(OBJS:.o=.d)
diff --git a/gfs2/quota/check.c b/gfs2/quota/check.c
deleted file mode 100644
index da32742..0000000
--- a/gfs2/quota/check.c
+++ /dev/null
@@ -1,549 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sys/ioctl.h>
-#include <time.h>
-#include <dirent.h>
-#include <limits.h>
-#include <stdint.h>
-#include <inttypes.h>
-
-#define __user
-#include "osi_list.h"
-
-#include "gfs2_quota.h"
-
-struct values {
-	osi_list_t v_list;
-
-	uint32_t v_id;
-	int64_t v_blocks;
-};
-typedef struct values values_t;
-
-struct hardlinks {
-	osi_list_t hl_list;
-
-	ino_t hl_ino;
-};
-typedef struct hardlinks hardlinks_t;
-
-/**
- * add_value - add a ID / Allocated Blocks pair to the list
- * @list: the list
- * @id: the ID number
- * @blocks: the number of blocks to add
- *
- */
-
-static void
-add_value(osi_list_t *list, uint32_t id, int64_t blocks)
-{
-	osi_list_t *tmp;
-	values_t *v;
-
-	for (tmp = list->next; tmp != list; tmp = tmp->next) {
-		v = osi_list_entry(tmp, values_t, v_list);
-		if (v->v_id != id)
-			continue;
-
-		v->v_blocks += blocks;
-
-		osi_list_del(&v->v_list);
-		osi_list_add(&v->v_list, list);
-
-		return;
-	}
-
-	type_zalloc(v, values_t, 1);
-
-	v->v_id = id;
-	v->v_blocks = blocks;
-
-	osi_list_add(&v->v_list, list);
-}
-
-/**
- * test_and_add_hard_link - Add a inode that has hard links to the list
- * @list: the list of inodes with hard links
- * @ino: the number of the inode to add
- *
- * Returns: Returns TRUE if the inode was already on the list, FALSE if it wasn't
- */
-
-static int
-test_and_add_hard_link(osi_list_t *list, ino_t ino)
-{
-	osi_list_t *tmp;
-	hardlinks_t *hl;
-
-	for (tmp = list->next; tmp != list; tmp = tmp->next) {
-		hl = osi_list_entry(tmp, hardlinks_t, hl_list);
-		if (hl->hl_ino != ino)
-			continue;
-
-		return TRUE;
-	}
-
-	type_zalloc(hl, hardlinks_t, 1);
-
-	hl->hl_ino = ino;
-
-	osi_list_add(&hl->hl_list, list);
-
-	return FALSE;
-}
-
-/**
- * scan_fs - recursively scan a filesystem and figure out what IDs have what
- * @device: the device the filesystem is on
- * @dirname: the name of the directory to read
- * @uid: returned list of UIDs for this FS
- * @gid: returned list of GIDs for this FS
- * @hl: returned list of hard links for this FS
- *
- */
-
-static void
-scan_fs(dev_t device, char *dirname,
-	osi_list_t *uid, osi_list_t *gid, osi_list_t *hl)
-{
-	DIR *dir;
-	struct dirent *de;
-	struct stat st;
-	char *name;
-	int error;
-
-	dir = opendir(dirname);
-	if (!dir)
-		die("can't open directory %s: %s\n", dirname, strerror(errno));
-
-	while ((de = readdir(dir))) {
-		if (strcmp(de->d_name, "..") == 0)
-			continue;
-
-		type_alloc(name, char,
-			   strlen(dirname) + strlen(de->d_name) + 2);
-		if (dirname[strlen(dirname) - 1] == '/')
-			sprintf(name, "%s%s", dirname, de->d_name);
-		else
-			sprintf(name, "%s/%s", dirname, de->d_name);
-
-		error = lstat(name, &st);
-		if (error)
-			die("can't stat file %s: %s\n", name, strerror(errno));
-
-		if (st.st_dev != device)
-			die("umount %s and try again\n", name);
-
-		if (S_ISDIR(st.st_mode)) {
-			if (strcmp(de->d_name, ".") == 0) {
-				add_value(uid, st.st_uid, st.st_blocks);
-				add_value(gid, st.st_gid, st.st_blocks);
-			} else
-				scan_fs(device, name, uid, gid, hl);
-		} else if (st.st_nlink == 1 ||
-			   !test_and_add_hard_link(hl, st.st_ino)) {
-			add_value(uid, st.st_uid, st.st_blocks);
-			add_value(gid, st.st_gid, st.st_blocks);
-		}
-
-		free(name);
-	}
-
-	closedir(dir);
-}
-
-/**
- * read_quota_file - read the quota file and return list of its contents
- * @comline: the command line arguments
- * @uid: returned list of UIDs for the filesystem
- * @gid: returned list of GIDs for the filesystem
- *
- */
-static void
-read_quota_file(struct gfs2_sbd *sdp, commandline_t *comline,
-		osi_list_t *uid, osi_list_t *gid)
-{
-	int fd;
-	char buf[sizeof(struct gfs2_quota)];
-	struct gfs2_quota q;
-	uint64_t offset = 0;
-	uint32_t id, prev, maxid;
-	int error, pass, id_type;
-	char quota_file[BUF_SIZE];
-	
-	strcpy(sdp->path_name, comline->filesystem);
-	check_for_gfs2(sdp);
-	read_superblock(&sdp->sd_sb, sdp);
-	mount_gfs2_meta(sdp);
-
-	strcpy(quota_file, sdp->metafs_path);
-	strcat(quota_file, "/quota");
-
-	fd = open(quota_file, O_RDONLY);
-	if (fd < 0) {
-		close(sdp->metafs_fd);
-		cleanup_metafs(sdp);
-		die("can't open file %s: %s\n", comline->filesystem,
-		    strerror(errno));
-	}
-
-	if (!is_valid_quota_list(fd)) {
-		print_quota_list_warning();
-		goto do_old_school;
-	}
-	get_last_quota_id(fd, &maxid);
-	
-	for (pass=0; pass<2; pass++) {
-		id = 0;
-		id_type = pass ? GQ_ID_GROUP : GQ_ID_USER;
-		
-		do {
-			read_quota_internal(fd, id, id_type, &q);
-			prev = id;
-			q.qu_value <<= sdp->sd_sb.sb_bsize_shift - 9;
-			
-			if (q.qu_value) {
-				if (pass)
-					add_value(gid, id, q.qu_value);
-				else
-					add_value(uid, id, q.qu_value);
-			}
-			id = q.qu_ll_next;
-		} while(id && id > prev && id <= maxid);
-	}
-	goto out;
-	
-do_old_school:
-	do {
-		
-		memset(buf, 0, sizeof(struct gfs2_quota));
-		/* read hidden quota file here */
-		lseek(fd, offset, SEEK_SET);
-		error = read(fd, buf, sizeof(struct gfs2_quota));
-		if (error < 0) {
-			close(fd);
-			close(sdp->metafs_fd);
-			cleanup_metafs(sdp);
-			die("can't read quota file (%d): %s\n",
-			    error, strerror(errno));
-		}
-		gfs2_quota_in(&q, buf);
-
-		id = (offset / sizeof(struct gfs2_quota)) >> 1;
-		q.qu_value <<= sdp->sd_sb.sb_bsize_shift - 9;
-
-		if (q.qu_value) {
-			if (id * sizeof(struct gfs2_quota) * 2 == offset)
-				add_value(uid, id, q.qu_value);
-			else
-				add_value(gid, id, q.qu_value);
-		}
-
-		offset += sizeof(struct gfs2_quota);
-	} while (error == sizeof(struct gfs2_quota));
-
-out:
-	close(fd);
-	close(sdp->metafs_fd);
-	cleanup_metafs(sdp);
-}
-
-/**
- * print_list - print the contents of an ID list
- * @str: a string describing the list
- * @list: the list
- *
- */
-
-static void
-print_list(char *str, osi_list_t *list)
-{
-#if 0
-	osi_list_t *tmp;
-	values_t *v;
-
-	for (tmp = list->next; tmp != list; tmp = tmp->next) {
-		v = osi_list_entry(tmp, values_t, v_list);
-		printf("%s %10u: %"PRId64"\n", str, v->v_id, v->v_blocks);
-	}
-#endif
-}
-
-/**
- * do_compare - compare to ID lists and see if they match
- * @type: the type of list (UID or GID)
- * @fs_list: the list derived from scaning the FS
- * @qf_list: the list derived from reading the quota file
- *
- * Returns: TRUE if there was a mismatch
- */
-
-static int
-do_compare(char *type, osi_list_t *fs_list, osi_list_t *qf_list)
-{
-	osi_list_t *tmp1, *tmp2;
-	values_t *v1, *v2;
-	int found;
-	int mismatch = FALSE;
-
-	for (tmp1 = fs_list->next; tmp1 != fs_list; tmp1 = tmp1->next) {
-		v1 = osi_list_entry(tmp1, values_t, v_list);
-
-		found = FALSE;
-
-		for (tmp2 = qf_list->next; tmp2 != qf_list; tmp2 = tmp2->next) {
-			v2 = osi_list_entry(tmp2, values_t, v_list);
-			if (v1->v_id != v2->v_id)
-				continue;
-
-			if (v1->v_blocks != v2->v_blocks) {
-				printf("mismatch: %s %u: scan = %"PRId64", quotafile = %"PRId64"\n",
-				       type, v1->v_id,
-				       v1->v_blocks, v2->v_blocks);
-				mismatch = TRUE;
-			}
-
-			osi_list_del(&v2->v_list);
-			free(v2);
-
-			found = TRUE;
-			break;
-		}
-
-		if (!found) {
-			printf("mismatch: %s %u: scan = %"PRId64", quotafile = %"PRId64"\n",
-			       type, v1->v_id,
-			       v1->v_blocks, (int64_t)0);
-			mismatch = TRUE;
-		}
-	}
-
-	for (tmp2 = qf_list->next; tmp2 != qf_list; tmp2 = tmp2->next) {
-		v2 = osi_list_entry(tmp2, values_t, v_list);
-
-		printf("mismatch: %s %u: scan = %"PRId64", quotafile = %"PRId64"\n",
-		       type, v2->v_id,
-		       (int64_t)0, v2->v_blocks);
-		mismatch = TRUE;
-	}
-
-	return mismatch;
-}
-
-/**
- * verify_pathname - make sure the path on the command line is a mount point
- * @comline: the command line arguments
- *
- * Returns: the device the filesystem is on
- */
-
-static dev_t
-verify_pathname(commandline_t *comline)
-{
-	struct stat st1, st2;
-	dev_t device;
-	char *name;
-	int error;
-
-	if (!*comline->filesystem)
-		die("need a filesystem to work on\n");
-
-	error = lstat(comline->filesystem, &st1);
-	if (error)
-		die("can't stat %s: %s\n", comline->filesystem,
-		    strerror(errno));
-
-	if (!S_ISDIR(st1.st_mode))
-		die("%s must be a directory\n", comline->filesystem);
-
-	device = st1.st_dev;
-
-	for (;;) {
-		type_alloc(name, char, strlen(comline->filesystem) + 4);
-		sprintf(name, "%s/..", comline->filesystem);
-
-		error = lstat(name, &st2);
-		if (error)
-			die("can't stat %s: %s\n", name, strerror(errno));
-
-		if (st2.st_dev != device || st2.st_ino == st1.st_ino) {
-			free(name);
-			break;
-		}
-
-		if (!realpath(name, comline->filesystem))
-			die("error resolving filesystem pathname: %s\n",
-			    strerror(errno));
-
-		free(name);
-
-		st1 = st2;
-	}
-
-	return device;
-}
-
-/**
- * do_check - Check what's in the quota file
- * @comline: the struct containing the parsed command line arguments
- *
- */
-
-void
-do_check(struct gfs2_sbd *sdp, commandline_t *comline)
-{
-	dev_t device;
-	osi_list_t fs_uid, fs_gid, qf_uid, qf_gid;
-	osi_list_t hl;
-	int mismatch;
-
-	osi_list_init(&fs_uid);
-	osi_list_init(&fs_gid);
-	osi_list_init(&qf_uid);
-	osi_list_init(&qf_gid);
-	osi_list_init(&hl);
-
-	device = verify_pathname(comline);
-
-	scan_fs(device, comline->filesystem, &fs_uid, &fs_gid, &hl);
-	read_quota_file(sdp, comline, &qf_uid, &qf_gid);
-
-	print_list("fs user ", &fs_uid);
-	print_list("fs group", &fs_gid);
-	print_list("qf user ", &qf_uid);
-	print_list("qf group", &qf_gid);
-
-	mismatch = do_compare("user", &fs_uid, &qf_uid);
-	mismatch |= do_compare("group", &fs_gid, &qf_gid);
-
-	if (mismatch)
-		exit(EXIT_FAILURE);
-}
-
-/**
- * set_list - write a list of IDs into the quota file
- * @comline: the command line arguments
- * @user: TRUE if this is a list of UIDs, FALSE if it is a list of GIDs
- * @list: the list of IDs and block counts
- * @multiplier: multiply block counts by this
- *
- */
-
-static void
-set_list(struct gfs2_sbd *sdp, commandline_t *comline, int user, 
-	 osi_list_t *list, int64_t multiplier)
-{
-	int fd;
-	osi_list_t *tmp;
-	values_t *v;
-	uint64_t offset;
-	int64_t value;
-	int error;
-	char quota_file[BUF_SIZE];
-	char id_str[16];
-	char *fs;
-
-	strcpy(sdp->path_name, comline->filesystem);
-	check_for_gfs2(sdp);
-	read_superblock(&sdp->sd_sb, sdp);
-	mount_gfs2_meta(sdp);
-
-	strcpy(quota_file, sdp->metafs_path);
-	strcat(quota_file, "/quota");
-
-	fd = open(quota_file, O_WRONLY);
-	if (fd < 0) {
-		close(sdp->metafs_fd);
-		cleanup_metafs(sdp);
-		die("can't open file %s: %s\n", comline->filesystem,
-		    strerror(errno));
-	}
-
-	for (tmp = list->next; tmp != list; tmp = tmp->next) {
-		v = osi_list_entry(tmp, values_t, v_list);
-
-		offset = (2 * (uint64_t)v->v_id + ((user) ? 0 : 1)) *
-			sizeof(struct gfs2_quota);
-		offset += (unsigned long)(&((struct gfs2_quota *)NULL)->qu_value);
-
-		value = v->v_blocks * multiplier;
-		value >>= sdp->sd_sb.sb_bsize_shift - 9;
-		value = cpu_to_be64(value);
-
-		lseek(fd, offset, SEEK_SET);
-		error = write(fd, (char*)&value, sizeof(uint64_t));
-		if (error != sizeof(uint64_t)) {
-			fprintf(stderr, "can't write quota file (%d): %s\n",
-			    error, strerror(errno));
-			goto out;
-		}
-
-		/* Write the id to sysfs quota refresh file to refresh gfs quotas */
-		fs = mp2fsname(comline->filesystem);
-		sprintf(id_str, "%d", comline->id);
-		set_sysfs(fs, (user) ? "quota_refresh_user" :
-			  "quota_refresh_group", id_str);
-	}
-
-out:
-	close(fd);
-	close(sdp->metafs_fd);
-	cleanup_metafs(sdp);
-}
-
-/**
- * do_quota_init - initialize the quota file
- * @comline: the command line arguments
- *
- */
-
-void
-do_quota_init(struct gfs2_sbd *sdp, commandline_t *comline)
-{
-	dev_t device;
-	osi_list_t fs_uid, fs_gid, qf_uid, qf_gid;
-	osi_list_t hl;
-	values_t *v;
-
-	osi_list_init(&fs_uid);
-	osi_list_init(&fs_gid);
-	osi_list_init(&qf_uid);
-	osi_list_init(&qf_gid);
-	osi_list_init(&hl);
-
-	device = verify_pathname(comline);
-
-	scan_fs(device, comline->filesystem, &fs_uid, &fs_gid, &hl);
-	read_quota_file(sdp, comline, &qf_uid, &qf_gid);
-
-	type_zalloc(v, values_t, 1);
-	v->v_id = 0;
-	v->v_blocks = 0;
-	osi_list_add(&v->v_list, &qf_uid);
-
-	type_zalloc(v, values_t, 1);
-	v->v_id = 0;
-	v->v_blocks = 0;
-	osi_list_add(&v->v_list, &qf_gid);
-
-	print_list("fs user ", &fs_uid);
-	print_list("fs group", &fs_gid);
-	print_list("qf user ", &qf_uid);
-	print_list("qf group", &qf_gid);
-
-	set_list(sdp, comline, TRUE, &qf_uid, 0);
-	set_list(sdp, comline, FALSE, &qf_gid, 0);
-	set_list(sdp, comline, TRUE, &fs_uid, 1);
-	set_list(sdp, comline, FALSE, &fs_gid, 1);
-	
-	do_sync(sdp, comline);
-
-	do_check(sdp, comline);
-}
diff --git a/gfs2/quota/gfs2_quota.h b/gfs2/quota/gfs2_quota.h
deleted file mode 100644
index 7e31e4f..0000000
--- a/gfs2/quota/gfs2_quota.h
+++ /dev/null
@@ -1,88 +0,0 @@
-#ifndef __GFS2_QUOTA_DOT_H__
-#define __GFS2_QUOTA_DOT_H__
-
-#include "libgfs2.h"
-#include "linux_endian.h"
-#include <linux/gfs2_ondisk.h>
-
-#define type_zalloc(ptr, type, count) \
-do { \
-	(ptr) = (type *)malloc(sizeof(type) * (count)); \
-	if ((ptr)) \
-		memset((char *)(ptr), 0, sizeof(type) * (count)); \
-	else \
-		die("unable to allocate memory on line %d of file %s\n", \
-		    __LINE__, __FILE__); \
-} while (0)
-
-#define type_alloc(ptr, type, count) \
-do { \
-	(ptr) = (type *)malloc(sizeof(type) * (count)); \
-	if (!(ptr)) \
-		die("unable to allocate memory on line %d of file %s\n", \
-		    __LINE__, __FILE__); \
-} while (0)
-
-#define GQ_OP_LIST           (12)
-#define GQ_OP_SYNC           (13)
-#define GQ_OP_GET            (14)
-#define GQ_OP_LIMIT          (15)
-#define GQ_OP_WARN           (16)
-#define GQ_OP_CHECK          (17)
-#define GQ_OP_INIT           (18)
-#define GQ_OP_RESET           (19)
-
-#define GQ_ID_USER           (23)
-#define GQ_ID_GROUP          (24)
-
-#define GQ_UNITS_MEGABYTE    (0)
-#define GQ_UNITS_KILOBYTE    (34)
-#define GQ_UNITS_FSBLOCK     (35)
-#define GQ_UNITS_BASICBLOCK  (36)
-
-#define BUF_SIZE 4096
-
-struct commandline {
-	unsigned int operation;
-
-	uint64_t new_value;
-	int new_value_set;
-
-	unsigned int id_type;
-	uint32_t id;
-
-	unsigned int units;
-
-	int numbers;
-
-	char filesystem[PATH_MAX];
-};
-typedef struct commandline commandline_t;
-
-extern char *prog_name;
-
-/*  main.c  */
-
-void do_get_super(int fd, struct gfs2_sb *sb);
-void do_sync(struct gfs2_sbd *sdp, commandline_t *comline);
-void cleanup();
-void read_superblock(struct gfs2_sb *sb, struct gfs2_sbd *sdp);
-void get_last_quota_id(int fd, uint32_t *max_id);
-int is_valid_quota_list(int fd);
-inline void read_quota_internal(int fd, unsigned int id, int id_type, 
-				struct gfs2_quota *q);
-inline void write_quota_internal(int fd, unsigned int id, int id_type, 
-				 struct gfs2_quota *q);
-void print_quota_list_warning();
-
-/*  check.c  */
-
-void do_check(struct gfs2_sbd *sdp, commandline_t *comline);
-void do_quota_init(struct gfs2_sbd *sdp, commandline_t *comline);
-
-/*  names.c  */
-
-uint32_t name_to_id(int user, char *name, int numbers);
-char *id_to_name(int user, uint32_t id, int numbers);
-
-#endif /* __GFS2_QUOTA_DOT_H__ */
diff --git a/gfs2/quota/main.c b/gfs2/quota/main.c
deleted file mode 100644
index 773c250..0000000
--- a/gfs2/quota/main.c
+++ /dev/null
@@ -1,1016 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/file.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sys/ioctl.h>
-#include <time.h>
-#include <limits.h>
-#include <sys/param.h>
-#include <sys/mount.h>
-#include <stdint.h>
-#include <inttypes.h>
-
-#include <linux/types.h>
-#include "gfs2_quota.h"
-
-#define __user
-
-#include "copyright.cf"
-
-
-/*  Constants  */
-
-#define OPTION_STRING ("bdf:g:hkl:mnsu:V")
-
-char *prog_name;
-
-/**
- * This function is for libgfs2's sake.
- */
-void print_it(const char *label, const char *fmt, const char *fmt2, ...)
-{
-        va_list args;
-
-        va_start(args, fmt2);
-        printf("%s: ", label);
-        vprintf(fmt, args);
-        va_end(args);
-}
-
-/**
- * print_usage - print usage info to the user
- *
- */
-
-static void
-print_usage()
-{
-	printf("Usage:\n");
-	printf("\n");
-	printf("%s <list|sync|get|limit|warn|check|init> [options]\n",
-	       prog_name);
-	printf("\n");
-	printf("Actions:\n");
-	printf("  list             list the whole quota file\n");
-	printf("  sync             sync out unsynced quotas\n");
-	printf("  get              get quota values for an ID\n");
-	printf("  limit            set a quota limit value for an ID\n");
-	printf("  warn             set a quota warning value for an ID\n");
-	printf("  check            check the quota file\n");
-	printf("  init             initialize the quota file\n");
-	printf("  reset            reset the quota file\n");
-	printf("\n");
-	printf("Options:\n");
-	printf("  -b               sizes are in FS blocks\n");
-	printf("  -f <directory>   the filesystem to work on\n");
-	printf("  -g <gid>         get/set a group ID\n");
-	printf("  -h               Print this help, then exit\n");
-	printf("  -k               sizes are in KB\n");
-	printf("  -l <size>        the new limit or warn value\n");
-	printf("  -m               sizes are in MB\n");
-	printf("  -n               print out UID/GID numbers instead of names\n");
-	printf("  -s               sizes are in 512-byte blocks\n");
-	printf("  -u <uid>         get/set a user ID\n");
-	printf("  -V               Print program version information, then exit\n");
-}
-
-/**
- * decode_arguments - parse command line arguments
- * @argc: well, it's argc...
- * @argv: well, it's argv...
- * @comline: the structure filled in with the parsed arguments
- *
- * Function description
- *
- * Returns: what is returned
- */
-
-static void
-decode_arguments(int argc, char *argv[], commandline_t *comline)
-{
-	int cont = TRUE;
-	int optchar;
-
-	while (cont) {
-		optchar = getopt(argc, argv, OPTION_STRING);
-
-		switch (optchar) {
-		case 'u':
-			comline->id_type = GQ_ID_USER;
-			comline->id = name_to_id(TRUE, optarg, comline->numbers);
-			break;
-
-		case 'g':
-			comline->id_type = GQ_ID_GROUP;
-			comline->id = name_to_id(FALSE, optarg, comline->numbers);
-			break;
-
-		case 'l':
-			if (!isdigit(*optarg))
-				die("argument to -l must be a number\n");
-			sscanf(optarg, "%"SCNu64, &comline->new_value);
-			comline->new_value_set = TRUE;
-			break;
-
-		case 'f':
-			if (!realpath(optarg, comline->filesystem))
-				die("can't find %s: %s\n", optarg,
-				    strerror(errno));
-			break;
-
-		case 'm':
-			comline->units = GQ_UNITS_MEGABYTE;
-			break;
-
-		case 'k':
-			comline->units = GQ_UNITS_KILOBYTE;
-			break;
-
-		case 'b':
-			comline->units = GQ_UNITS_FSBLOCK;
-			break;
-
-		case 's':
-			comline->units = GQ_UNITS_BASICBLOCK;
-			break;
-
-		case 'n':
-			comline->numbers = TRUE;
-			break;
-
-		case 'V':
-			printf("gfs2_quota %s (built %s %s)\n", RELEASE_VERSION,
-			       __DATE__, __TIME__);
-			printf("%s\n", REDHAT_COPYRIGHT);
-			exit(EXIT_SUCCESS);
-			break;
-
-		case 'h':
-			print_usage();
-			exit(EXIT_SUCCESS);
-			break;
-
-		case ':':
-		case '?':
-			fprintf(stderr, "Please use '-h' for usage.\n");
-			exit(EXIT_FAILURE);
-			break;
-
-		case EOF:
-			cont = FALSE;
-			break;
-
-		default:
-			die("unknown option: %c\n", optchar);
-			break;
-		};
-	}
-
-	while (optind < argc) {
-		if (strcmp(argv[optind], "list") == 0 ||
-		    strcmp(argv[optind], "dump") == 0) {
-			if (comline->operation)
-				die("can't specify two operations\n");
-			comline->operation = GQ_OP_LIST;
-		} else if (strcmp(argv[optind], "sync") == 0) {
-			if (comline->operation)
-				die("can't specify two operations\n");
-			comline->operation = GQ_OP_SYNC;
-		} else if (strcmp(argv[optind], "get") == 0) {
-			if (comline->operation)
-				die("can't specify two operations\n");
-			comline->operation = GQ_OP_GET;
-		} else if (strcmp(argv[optind], "limit") == 0) {
-			if (comline->operation)
-				die("can't specify two operations\n");
-			comline->operation = GQ_OP_LIMIT;
-		} else if (strcmp(argv[optind], "warn") == 0) {
-			if (comline->operation)
-				die("can't specify two operations\n");
-			comline->operation = GQ_OP_WARN;
-		} else if (strcmp(argv[optind], "check") == 0) {
-			if (comline->operation)
-				die("can't specify two operations\n");
-			comline->operation = GQ_OP_CHECK;
-		} else if (strcmp(argv[optind], "init") == 0) {
-			if (comline->operation)
-				die("can't specify two operations\n");
-			comline->operation = GQ_OP_INIT;
-		} else if (strcmp(argv[optind], "reset") == 0) {
-			if (comline->operation)
-				die("can't specify two operations\n");
-			comline->operation = GQ_OP_RESET;
-		} else
-			die("unknown option %s\n", argv[optind]);
-
-		optind++;
-	}
-}
-
-/**
- * print_quota - Print out a quota entry
- * @comline: the struct containing the parsed command line arguments
- * @user: TRUE if this is a user quota, FALSE if it's a group quota
- * @id: the ID
- * @q: the quota value
- * @sb: the superblock of the filesystem this quota belongs to
- *
- */
-
-static void
-print_quota(commandline_t *comline,
-	    int user, uint32_t id,
-	    struct gfs2_quota *q,
-	    struct gfs2_sb *sb)
-{
-	printf("%-5s %10s:  ", (user) ? "user" : "group",
-	       id_to_name(user, id, comline->numbers));
-
-	switch (comline->units) {
-	case GQ_UNITS_MEGABYTE:
-		printf("limit: %-10.1f warn: %-10.1f value: %-10.1f\n",
-		       (double) q->qu_limit * sb->sb_bsize / 1048576,
-		       (double) q->qu_warn * sb->sb_bsize / 1048576,
-		       (double) q->qu_value * sb->sb_bsize / 1048576);
-		break;
-
-	case GQ_UNITS_KILOBYTE:
-		if (sb->sb_bsize == 512)
-			printf("limit: %-10llu warn: %-10lluvalue: %-10llu\n",
-			       (unsigned long long)q->qu_limit / 2,
-			       (unsigned long long)q->qu_warn / 2,
-			       (unsigned long long)q->qu_value / 2);
-		else
-			printf("limit: %-10llu warn: %-10lluvalue: %-10llu\n",
-			       (unsigned long long)
-			       q->qu_limit << (sb->sb_bsize_shift - 10),
-			       (unsigned long long)
-			       q->qu_warn << (sb->sb_bsize_shift - 10),
-			       (unsigned long long)
-			       q->qu_value << (sb->sb_bsize_shift - 10));
-		break;
-
-	case GQ_UNITS_FSBLOCK:
-		printf("limit: %-10llu warn: %-10llu value: %-10llu\n",
-		       (unsigned long long)q->qu_limit,
-		       (unsigned long long)q->qu_warn,
-		       (unsigned long long)q->qu_value);
-		break;
-
-	case GQ_UNITS_BASICBLOCK:
-		printf("limit: %-10llu warn: %-10llu value: %-10llu\n",
-		       (unsigned long long)
-		       q->qu_limit << (sb->sb_bsize_shift - 9),
-		       (unsigned long long)
-		       q->qu_warn << (sb->sb_bsize_shift - 9),
-		       (unsigned long long)
-		       q->qu_value << (sb->sb_bsize_shift - 9));
-		break;
-
-	default:
-		die("bad units\n");
-		break;
-	}
-}
-
-void 
-read_superblock(struct gfs2_sb *sb, struct gfs2_sbd *sdp)
-{
-	int fd;
-	char buf[PATH_MAX];
-	
-	fd = open(sdp->device_name, O_RDONLY);
-	if (fd < 0) {
-		die("Could not open the block device %s: %s\n",
-			sdp->device_name, strerror(errno));
-	}
-	do_lseek(fd, 0x10 * 4096);
-	do_read(fd, buf, PATH_MAX);
-	gfs2_sb_in(sb, buf);
-
-	close(fd);
-}
-
-inline void 
-read_quota_internal(int fd, uint32_t id, int id_type, struct gfs2_quota *q)
-{
-	/* seek to the appropriate offset in the quota file and read the 
-	   quota info */
-	uint64_t offset;
-	char buf[256];
-	int error;
-	if (id_type == GQ_ID_USER)
-		offset = (2 * (uint64_t)id) * sizeof(struct gfs2_quota);
-	else
-		offset = (2 * (uint64_t)id + 1) * sizeof(struct gfs2_quota);
-	lseek(fd, offset, SEEK_SET);
-	error = read(fd, buf, sizeof(struct gfs2_quota));
-	if (error < 0)
-		die("failed to read from quota file: %s\n", strerror(errno));
-	if (error != sizeof(struct gfs2_quota))
-		die("Couldn't read %lu bytes from quota file at offset %llu\n",
-		    (unsigned long)sizeof(struct gfs2_quota),
-		    (unsigned long long)offset);
-	gfs2_quota_in(q, buf);
-}
-
-inline void 
-write_quota_internal(int fd, uint32_t id, int id_type, struct gfs2_quota *q)
-{
-	/* seek to the appropriate offset in the quota file and read the
-	   quota info */
-	uint64_t offset;
-	char buf[256];
-	int error;
-	if (id_type == GQ_ID_USER)
-		offset = (2 * (uint64_t)id) * sizeof(struct gfs2_quota);
-	else
-		offset = (2 * (uint64_t)id + 1) * sizeof(struct gfs2_quota);
-	lseek(fd, offset, SEEK_SET);
-	gfs2_quota_out(q, buf);
-	error = write(fd, buf, sizeof(struct gfs2_quota));
-	if (error != sizeof(struct gfs2_quota))
-		die("failed to write to quota file: %s\n", strerror(errno));
-}
-
-/**
- * get_last_quota_id - Get the last quota in the quota file
- * @fd: an open file descriptor of the quota file
- * @id_type: GQ_ID_USER or GQ_ID_GROUP
- * @max_id: return the maximum id obtained
- */
-void 
-get_last_quota_id(int fd, uint32_t *max_id)
-{
-	/* stat(2) the quota file to find how big it is. This will give us a
-	 * a rough idea of what the last valid quota uid/gid is. It is possible 
-	 * that the last quota in the file belongs to a group with gid:x and 
-	 * the corresponding user quota with uid:x doesn't exist. In such cases
-	 * we still return x as max_id. This max_id is ONLY A HINT. If used 
-	 * as a terminating condition of a loop, another condition should also
-	 * be specified.
-	 */
-	struct stat st;
-	uint32_t qsize = sizeof(struct gfs2_quota);
-	uint64_t size;
-	if (fstat(fd, &st))
-		die("failed to stat the quota file: %s\n", strerror(errno));
-	size = st.st_size;
-	if (!size)
-		die("error: quota file is truncated to zero!\n");
-	if (size % qsize) {
-		printf("warning: quota file size not a multiple of "
-		       "struct gfs2_quota\n");
-		size = qsize * (size / qsize);
-	}
-	*max_id = (size - 1) / (2 * qsize);
-}
-
-/**
- * is_valid_quota_list - Check if we have a valid quota list
- * @fd: an open file descriptor of the quota file
- * Returns 0 or 1.
- */
-int 
-is_valid_quota_list(int fd)
-{
-	/* This is a slow test to determine if the quotas are in a 
-	 * linked list. We should come up with something better
-	 * Quota linked list format is identified by the following.
-	 * step1: Get the maximum groupid and userid having valid
-	 *        quotas in the quota file.
-	 * step2: Obtain the size of the quota file. The size of the 
-	 *        quota file (position of the last valid quota) 
-	 *        determines the last user/group id.
-	 * step3: If we can obtain the last valid quota through the 
-	 *        lists, then our lists are good. Else, the lists are 
-	 *        either corrupt or an older quota file format is in use
-	 */
-	int id_type = GQ_ID_GROUP;
-	uint32_t id = 0, prev, ulast = 0, glast = 0, max;
-	struct gfs2_quota q;
-
-	get_last_quota_id(fd, &max);
-again:
-	do {
-		read_quota_internal(fd, id, id_type, &q);
-		prev = id;
-		id = q.qu_ll_next;
-		if (id > max)
-			return 0;
-	} while (id && id > prev);
-
-	if (id && id <= prev)
-		return 0;
-
-	if (id_type == GQ_ID_GROUP)
-		glast = prev;
-	else
-		ulast = prev;
-
-	if (id_type == GQ_ID_GROUP) {
-		id_type = GQ_ID_USER;
-		id = 0;
-		goto again;
-	}
-
-	if (glast != max && ulast != max)
-		return 0;
-	
-	return 1;
-}
-
-void 
-print_quota_list_warning()
-{
-	printf("\nWarning: This filesystem doesn't seem to have the new quota "
-	       "list format or the quota list is corrupt. list, check and init "
-	       "operation performance will suffer due to this. It is recommended "
-	       "that you run the 'gfs2_quota reset' operation to reset the quota "
-	       "file. All current quota information will be lost and you will "
-	       "have to reassign all quota limits and warnings\n\n"); 
-}
-
-/**
- * adjust_quota_list - Adjust the quota linked list
- * @fd: The quota file descriptor
- * @comline: the struct containing the parsed command line arguments
- */
-static void
-adjust_quota_list(int fd, commandline_t *comline)
-{
-	uint32_t prev = 0, next = 0, id = comline->id;
-	struct gfs2_quota tmpq, q;
-	int id_type = comline->id_type;
-	
-	if (id == 0) /* root quota, don't do anything */
-		goto out;
-	/* We just wrote the quota for id in do_set(). Get it */
-	next = 0;
-	do {
-		read_quota_internal(fd, next, id_type, &q);
-		prev = next;
-		next = q.qu_ll_next;
-		if (prev == id) /* no duplicates, bail */
-			goto out;
-		if (prev < id && id < next) /* gotcha! */
-			break;
-	} while(next && next > prev);
-	read_quota_internal(fd, id, id_type, &tmpq);
-	tmpq.qu_ll_next = next;
-	q.qu_ll_next = id;
-	write_quota_internal(fd, id, id_type, &tmpq);
-	write_quota_internal(fd, prev, id_type, &q);
-
-out:
-	return;
-}
-
-/**
- * do_reset - Reset all the quota data for a filesystem
- * @comline: the struct containing the parsed command line arguments
- */
-
-static void
-do_reset(struct gfs2_sbd *sdp, commandline_t *comline)
-{
-	int fd;
-	char quota_file[BUF_SIZE], c;
-	struct gfs2_quota q;
-
-	if (!*comline->filesystem)
-		die("need a filesystem to work on\n");
-
-	printf("This operation will permanently erase all quota information. "
-	       "You will have to re-assign all quota limit/warn values. "
-	       "Proceed [y/N]? ");
-	c = getchar();
-	if (c != 'y' && c != 'Y')
-		return;
-
-	strcpy(sdp->path_name, comline->filesystem);
-	check_for_gfs2(sdp);
-	read_superblock(&sdp->sd_sb, sdp);
-	mount_gfs2_meta(sdp);
-
-	strcpy(quota_file, sdp->metafs_path);
-	strcat(quota_file, "/quota");
-
-	fd = open(quota_file, O_RDWR);
-	if (fd < 0) {
-		close(sdp->metafs_fd);
-		cleanup_metafs(sdp);
-		die("can't open file %s: %s\n", quota_file,
-		    strerror(errno));
-	}
-
-	read_quota_internal(fd, 0, GQ_ID_USER, &q);
-	q.qu_ll_next = 0;
-	write_quota_internal(fd, 0, GQ_ID_USER, &q);
-
-	read_quota_internal(fd, 0, GQ_ID_GROUP, &q);
-	q.qu_ll_next = 0;
-	write_quota_internal(fd, 0, GQ_ID_GROUP, &q);
-
-	/* truncate the quota file such that only the first
-	 * two quotas(uid=0 and gid=0) remain.
-	 */
-	if (ftruncate(fd, (sizeof(struct gfs2_quota)) * 2))
-		die("couldn't truncate quota file %s\n", strerror(errno));
-	
-	close(fd);
-	close(sdp->metafs_fd);
-	cleanup_metafs(sdp);
-}
-
-/**
- * do_list - List all the quota data for a filesystem
- * @comline: the struct containing the parsed command line arguments
- *
- */
-
-static void 
-do_list(struct gfs2_sbd *sdp, commandline_t *comline)
-{
-	int fd;
-	struct gfs2_quota q;
-	char buf[sizeof(struct gfs2_quota)];
-	uint64_t offset;
-	uint32_t id, prev, maxid;
-	int pass = 0;
-	int error = 0;
-	char quota_file[BUF_SIZE];
-	int id_type = comline->id_type;
-	
-	if (!*comline->filesystem)
-		die("need a filesystem to work on\n");
-
-	strcpy(sdp->path_name, comline->filesystem);
-	check_for_gfs2(sdp);
-	read_superblock(&sdp->sd_sb, sdp);
-	mount_gfs2_meta(sdp);
-
-	strcpy(quota_file, sdp->metafs_path);
-	strcat(quota_file, "/quota");
-
-	fd = open(quota_file, O_RDONLY);
-	if (fd < 0) {
-		close(sdp->metafs_fd);
-		cleanup_metafs(sdp);
-		die("can't open file %s: %s\n", quota_file,
-		    strerror(errno));
-	}
-	
-	if (!is_valid_quota_list(fd)) {
-		print_quota_list_warning();
-		goto do_old_school;
-	}
-	get_last_quota_id(fd, &maxid);
-	
-	for (pass=0; pass<2; pass++) {
-		id = 0;
-		id_type = pass ? GQ_ID_GROUP : GQ_ID_USER;
-		
-		do {
-			read_quota_internal(fd, id, id_type, &q);
-			prev = id;
-			if (q.qu_limit || q.qu_warn || q.qu_value)
-				print_quota(comline, 
-					    id_type == GQ_ID_USER ? TRUE : FALSE, 
-					    id, &q, &sdp->sd_sb);
-			id = q.qu_ll_next;
-		} while(id && id > prev && id <= maxid);
-	}
-	goto out;
-
-do_old_school:
-	for (pass=0; pass<2; pass++) {
-		if (!pass)
-			offset = 0;
-		else
-			offset = sizeof(struct gfs2_quota);
-
-		do {
-			memset(buf, 0, sizeof(struct gfs2_quota));
-
-			/* read hidden quota file here */
-			lseek(fd, offset, SEEK_SET);
-			error = read(fd, buf, sizeof(struct gfs2_quota));
-
-			gfs2_quota_in(&q, buf);
-
-			id = (offset / sizeof(struct gfs2_quota)) >> 1;
-
-			if (q.qu_limit || q.qu_warn || q.qu_value)
-				print_quota(comline, (pass) ? FALSE : TRUE, id,
-					    &q, &sdp->sd_sb);
-
-			offset += 2 * sizeof(struct gfs2_quota);
-		} while (error == sizeof(struct gfs2_quota));
-	}
-out:
-	close(fd);
-	close(sdp->metafs_fd);
-	cleanup_metafs(sdp);
-}
-
-/**
- * do_get_one - Get a quota value from one FS
- * @comline: the struct containing the parsed command line arguments
- * @filesystem: the filesystem to get from
- *
- */
-
-static void 
-do_get_one(struct gfs2_sbd *sdp, commandline_t *comline, char *filesystem)
-{
-	int fd;
-	char buf[256];
-	struct gfs2_quota q;
-	uint64_t offset;
-	int error;
-	uint32_t maxid;
-	char quota_file[BUF_SIZE];
-
-	strcpy(sdp->path_name, filesystem);
-	check_for_gfs2(sdp);
-	read_superblock(&sdp->sd_sb, sdp);
-	mount_gfs2_meta(sdp);
-
-	strcpy(quota_file, sdp->metafs_path);
-	strcat(quota_file, "/quota");
-
-	fd = open(quota_file, O_RDONLY);
-	if (fd < 0) {
-		close(sdp->metafs_fd);
-		cleanup_metafs(sdp);
-		die("can't open file %s: %s\n", quota_file,
-		    strerror(errno));
-	}
-
-	if (comline->id_type == GQ_ID_USER)
-		offset = (2 * (uint64_t)comline->id) * sizeof(struct gfs2_quota);
-	else
-		offset = (2 * (uint64_t)comline->id + 1) * sizeof(struct gfs2_quota);
-
-	memset(&q, 0, sizeof(struct gfs2_quota));
-	
-	get_last_quota_id(fd, &maxid);
-	if (comline->id > maxid)
-		goto print_empty_quota;
-
-	lseek(fd, offset, SEEK_SET);
-	error = read(fd, buf, sizeof(struct gfs2_quota));
-	if (error < 0) {
-		close(fd);
-		close(sdp->metafs_fd);
-		cleanup_metafs(sdp);
-		die("can't get quota info (%d): %s\n",
-		    error, strerror(errno));
-	}
-
-	gfs2_quota_in(&q, buf);
-
-
-print_empty_quota:
-	print_quota(comline,
-		    (comline->id_type == GQ_ID_USER), comline->id,
-		    &q, &sdp->sd_sb);
-
-	close(fd);
-	close(sdp->metafs_fd);
-	cleanup_metafs(sdp);	
-}
-
-/**
- * do_get - Get a quota value
- * @comline: the struct containing the parsed command line arguments
- *
- */
-
-static void
-do_get(struct gfs2_sbd *sdp, commandline_t *comline)
-{
-	int first = TRUE;
-
-	if (*comline->filesystem)
-		do_get_one(sdp, comline, comline->filesystem);
-	else {
-		char buf[256], device[256], path[256], type[256];
-		FILE *file;
-
-		file = fopen("/proc/mounts", "r");
-		if (!file)
-			die("can't open /proc/mounts: %s\n", strerror(errno));
-
-		while (fgets(buf, 256, file)) {
-			if (sscanf(buf, "%s %s %s", device, path, type) != 3)
-				continue;
-			if (strcmp(type, "gfs2") != 0)
-				continue;
-
-			if (first)
-				first = FALSE;
-			else
-				printf("\n");
-
-			printf("%s\n", path);
-			do_get_one(sdp, comline, path);
-		}
-
-		fclose(file);
-	}
-}
-
-/**
- * do_sync_one - sync the quotas on one GFS2 filesystem
- * @path: a file/directory in the filesystem
- *
- */
-static void 
-do_sync_one(struct gfs2_sbd *sdp, char *filesystem)
-{
-	char *fsname;
-
-	fsname = mp2fsname(filesystem);
-	set_sysfs(fsname, "quota_sync", "1");
-}
-
-/**
- * do_sync - sync out unsyned quotas
- * @comline: the struct containing the parsed command line arguments
- *
- */
-
-void
-do_sync(struct gfs2_sbd *sdp, commandline_t *comline)
-{
-	sync();
-
-	if (*comline->filesystem)
-		do_sync_one(sdp, comline->filesystem);
-	else {
-		char buf[256], device[256], path[256], type[256];
-		FILE *file;
-
-		file = fopen("/proc/mounts", "r");
-		if (!file)
-			die("can't open /proc/mounts: %s\n", strerror(errno));
-
-		while (fgets(buf, 256, file)) {
-			if (sscanf(buf, "%s %s %s", device, path, type) != 3)
-				continue;
-			if (strcmp(type, "gfs2") != 0)
-				continue;
-
-			do_sync_one(sdp, path);
-		}
-
-		fclose(file);
-	}
-}
-
-/**
- * do_set - Set a quota value
- * @comline: the struct containing the parsed command line arguments
- *
- */
-
-static void
-do_set(struct gfs2_sbd *sdp, commandline_t *comline)
-{
-	int fd;
-	uint64_t offset;
-	uint64_t new_value;
-	int error, adj_flag = 0;;
-	char quota_file[BUF_SIZE];
-	char id_str[16];
-	struct stat stat_buf;
-	char *fs;
-	
-	if (!*comline->filesystem)
-		die("need a filesystem to work on\n");
-	if (!comline->new_value_set)
-		die("need a new value\n");
-
-	strcpy(sdp->path_name, comline->filesystem);
-	check_for_gfs2(sdp);
-	read_superblock(&sdp->sd_sb, sdp);
-	mount_gfs2_meta(sdp);
-
-	strcpy(quota_file, sdp->metafs_path);
-	strcat(quota_file, "/quota");
-
-	fd = open(quota_file, O_RDWR);
-	if (fd < 0) {
-		close(sdp->metafs_fd);
-		cleanup_metafs(sdp);
-		die("can't open file %s: %s\n", quota_file,
-		    strerror(errno));
-	}
-	
-	if (is_valid_quota_list(fd))
-		adj_flag = 1;
-	else
-		print_quota_list_warning();
-
-	switch (comline->id_type) {
-	case GQ_ID_USER:
-		offset = (2 * (uint64_t)comline->id) * sizeof(struct gfs2_quota);
-		break;
-
-	case GQ_ID_GROUP:
-		offset = (2 * (uint64_t)comline->id + 1) * sizeof(struct gfs2_quota);
-		break;
-
-	default:
-		fprintf(stderr, "invalid user/group ID\n");
-		goto out;
-	}
-
-	switch (comline->units) {
-	case GQ_UNITS_MEGABYTE:
-		new_value =
-			comline->new_value << (20 - sdp->sd_sb.sb_bsize_shift);
-		break;
-
-	case GQ_UNITS_KILOBYTE:
-		if (sdp->sd_sb.sb_bsize == 512)
-			new_value = comline->new_value * 2;
-		else
-			new_value = comline->new_value >>
-				(sdp->sd_sb.sb_bsize_shift - 10);
-		break;
-
-	case GQ_UNITS_FSBLOCK:
-		new_value = comline->new_value;
-		break;
-
-	case GQ_UNITS_BASICBLOCK:
-		new_value = comline->new_value >>
-			(sdp->sd_sb.sb_bsize_shift - 9);
-		break;
-
-	default:
-		fprintf(stderr, "bad units\n");
-		goto out;
-	}
-
-	new_value = cpu_to_be64(new_value);
-	/*
-	 * Hack to force writing the entire gfs2_quota structure to 
-	 * the quota file instead of just the limit or warn values.
-	 * This is because of a bug in gfs2 which doesn't extend 
-	 * the quotafile appropriately to write the usage value of a 
-	 * given id. For instance, if you write a limit value (8 bytes) 
-	 * for userid x at offset 2*x, gfs2 will not extend the file and write 
-	 * 8 bytes at offset (2*x + 16) when it has to update the usage 
-	 * value for id x. Therefore, we extend the quota file to 
-	 * a struct gfs2_quota boundary. i.e. The size of the quota file
-	 * will always be a multiple of sizeof(struct gfs2_quota)
-	 */
-	if (fstat(fd, &stat_buf)) {
-		fprintf(stderr, "stat failed: %s\n", strerror(errno));
-		goto out;
-	}
-	if (stat_buf.st_size < (offset + sizeof(struct gfs2_quota))) {
-		struct gfs2_quota tmp;
-		memset((void*)(&tmp), 0, sizeof(struct gfs2_quota));
-		switch (comline->operation) {
-		case GQ_OP_LIMIT:
-			tmp.qu_limit = new_value; break;
-		case GQ_OP_WARN:
-			tmp.qu_warn = new_value; break;
-		}
-		
-		lseek(fd, offset, SEEK_SET);
-		error = write(fd, (void*)(&tmp), sizeof(struct gfs2_quota));
-		if (error != sizeof(struct gfs2_quota)) {
-			fprintf(stderr, "can't write quota file (%d): %s\n", 
-				error, strerror(errno));
-			goto out;
-		}
-		/* Also, if the id type is USER, append another empty 
-		 * struct gfs2_quota for the GROUP with the same id
-		 */
-		if (comline->id_type == GQ_ID_USER) {
-			memset((void*)(&tmp), 0, sizeof(struct gfs2_quota));
-			error = write(fd, (void*)(&tmp), sizeof(struct gfs2_quota));
-			if (error != sizeof(struct gfs2_quota)) {
-				fprintf(stderr, "can't write quota file (%d): %s\n", 
-					error, strerror(errno));
-				goto out;
-			}
-		}
-	} else {
-		switch (comline->operation) {
-		case GQ_OP_LIMIT:
-			offset += (unsigned long)(&((struct gfs2_quota *) NULL)->qu_limit);
-			break;
-			
-		case GQ_OP_WARN:
-			offset += (unsigned long)(&((struct gfs2_quota *) NULL)->qu_warn);
-			break;
-			
-		default:
-			fprintf(stderr, "invalid operation\n");
-			goto out;
-		};
-
-		lseek(fd, offset, SEEK_SET);
-		error = write(fd, (char*)&new_value, sizeof(uint64_t));
-		if (error != sizeof(uint64_t)) {
-			fprintf(stderr, "can't write quota file (%d): %s\n",
-				error, strerror(errno));
-			goto out;
-		}
-	}
-
-	fs = mp2fsname(comline->filesystem);
-	sprintf(id_str, "%d", comline->id);
-	set_sysfs(fs, comline->id_type == GQ_ID_USER ?
-		  "quota_refresh_user" : "quota_refresh_group", id_str);
-	
-	if (adj_flag)
-		adjust_quota_list(fd, comline);
-out:
-	close(fd);
-	close(sdp->metafs_fd);
-	cleanup_metafs(sdp);
-}
-
-/**
- * main - Do everything
- * @argc: well, it's argc...
- * @argv: well, it's argv...
- *
- * Returns: exit status
- */
-
-int
-main(int argc, char *argv[])
-{
-    struct gfs2_sbd sbd, *sdp = &sbd;
-	commandline_t comline;
-
-	prog_name = argv[0];
-
-	memset(sdp, 0, sizeof(struct gfs2_sbd));
-	memset(&comline, 0, sizeof(commandline_t));
-
-	decode_arguments(argc, argv, &comline);
-	sdp->path_name = (char*) malloc(512);
-	if (!sdp->path_name)
-		die("Can't malloc! %s\n", strerror(errno));
-
-	switch (comline.operation) {
-	case GQ_OP_LIST:
-		do_list(sdp, &comline);
-		break;
-
-	case GQ_OP_GET:
-		do_get(sdp, &comline);
-		break;
-
-	case GQ_OP_LIMIT:
-	case GQ_OP_WARN:
-		do_set(sdp, &comline);
-		break;
-
-	case GQ_OP_SYNC:
-		do_sync(sdp, &comline);
-		break;
-
-	case GQ_OP_CHECK:
-		do_sync(sdp, &comline);
-		do_check(sdp, &comline);
-		break;
-
-	case GQ_OP_INIT:
-		do_sync(sdp, &comline);
-		do_quota_init(sdp, &comline);
-		break;
-
-	case GQ_OP_RESET:
-		do_reset(sdp, &comline);
-		break;
-	default:
-		if (!comline.id_type) {
-			comline.id_type = GQ_ID_USER;
-			comline.id = geteuid();
-		}
-		do_get(sdp, &comline);
-		break;
-	}
-	
-	free(sdp->path_name);
-
-	exit(EXIT_SUCCESS);
-}
diff --git a/gfs2/quota/names.c b/gfs2/quota/names.c
deleted file mode 100644
index fd3c589..0000000
--- a/gfs2/quota/names.c
+++ /dev/null
@@ -1,81 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sys/ioctl.h>
-#include <time.h>
-#include <dirent.h>
-#include <limits.h>
-#include <pwd.h>
-#include <grp.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include "gfs2_quota.h"
-
-uint32_t
-name_to_id(int user, char *name, int numbers)
-{
-	struct passwd *u;
-	struct group *g;
-	uint32_t id;
-	int ok = FALSE;
-
-	if (numbers) {
-	} else if (user) {
-		u = getpwnam(name);
-		if (u) {
-			id = u->pw_uid;
-			ok = TRUE;
-		}
-	} else {
-		g = getgrnam(name);
-		if (g) {
-			id = g->gr_gid;
-			ok = TRUE;
-		}
-	}
-
-	if (!ok) {
-		if (!isdigit(name[0]))
-			die("can't find %s %s\n",
-			    (user) ? "user" : "group",
-			    name);
-		sscanf(name, "%u", &id);
-	}
-
-	return id;
-}
-
-char *
-id_to_name(int user, uint32_t id, int numbers)
-{
-	struct passwd *u;
-	struct group *g;
-	static char name[256];
-	int ok = FALSE;
-
-	if (numbers) {
-	} else if (user) {
-		u = getpwuid(id);
-		if (u) {
-			strcpy(name, u->pw_name);
-			ok = TRUE;
-		}
-	} else {
-		g = getgrgid(id);
-		if (g) {
-			strcpy(name, g->gr_name);
-			ok = TRUE;
-		}
-	}
-
-	if (!ok)
-		sprintf(name, "%u", id);
-
-	return name;
-}
diff --git a/gfs2/tool/Makefile b/gfs2/tool/Makefile
deleted file mode 100644
index 9012dc8..0000000
--- a/gfs2/tool/Makefile
+++ /dev/null
@@ -1,39 +0,0 @@
-TARGET= gfs2_tool
-
-SBINDIRT=$(TARGET)
-
-all: depends ${TARGET}
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-OBJS=	df.o \
-	layout.o \
-	main.o \
-	misc.o \
-	ondisk.o \
-	sb.o \
-	tune.o
-
-CFLAGS += -D_FILE_OFFSET_BITS=64
-CFLAGS += -I${KERNEL_SRC}/fs/gfs2/ -I${KERNEL_SRC}/include/
-CFLAGS += -I$(S)/../include -I$(S)/../libgfs2
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L../libgfs2 -lgfs2
-LDFLAGS += -L${libdir}
-
-LDDEPS += ../libgfs2/libgfs2.a
-
-${TARGET}: ${OBJS} ${LDDEPS}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-depends:
-	$(MAKE) -C ../libgfs2 all
-
-clean: generalclean
-
--include $(OBJS:.o=.d)
diff --git a/gfs2/tool/decipher_lockstate_dump b/gfs2/tool/decipher_lockstate_dump
deleted file mode 100644
index 96afcd7..0000000
--- a/gfs2/tool/decipher_lockstate_dump
+++ /dev/null
@@ -1,175 +0,0 @@
-#!/usr/bin/perl
-
-foreach $arg (@ARGV)
-{
-    if ($arg eq '-nosort')
-    {
-	$nosort = 1;
-    }
-    else
-    {
-	push(@files, $arg);
-    }
-}
-
-
-foreach $file (@files)
-{
-    open(FILE, "< $file") || die "decipher_lockstate_dump: can't open file %s: $!\n";
-
-    while ($line = <FILE>)
-    {
-	$line =~ s/\n/ \n/;
-
-	if ($line =~ /^Glock/)
-	{
-	    $ln++ if ($notfirst++);
-	    $line =~ s/\((0),/\(reserved[$1],/;
-	    $line =~ s/\((1),/\(nondisk[$1],/;
-	    $line =~ s/\((2),/\(inode[$1],/;
-	    $line =~ s/\((3),/\(rgrp[$1],/;
-	    $line =~ s/\((4),/\(meta[$1],/;
-	    $line =~ s/\((5),/\(iopen[$1],/;
-	    $line =~ s/\((6),/\(flock[$1],/;
-	    $line =~ s/\((7),/\(jid[$1],/;
-	    $line =~ s/\((8),/\(quota[$1],/;
-	    $line =~ s/\((9),/\(journal[$1],/;
-
-	    $line =~ s/\(nondisk(\S+), (0)\)/\(nondisk$1, mount[$2]\)/;
-	    $line =~ s/\(nondisk(\S+), (1)\)/\(nondisk$1, live[$2]\)/;
-	    $line =~ s/\(nondisk(\S+), (2)\)/\(nondisk$1, trans[$2]\)/;
-	    $line =~ s/\(nondisk(\S+), (3)\)/\(nondisk$1, rename[$2]\)/;
-
-	    $line =~ s/\(meta(\S+), (0)\)/\(meta$1, super[$2]\)/;
-	    $line =~ s/\(meta(\S+), (1)\)/\(meta$1, crap[$2]\)/;
-
-	    if ($line =~ /\(quota\S+, (\d+)\)/)
-	    {
-		$qid = (($1 % 2) ? "Group" : "User") . int($1 / 2) . "[$1]";
-		$line =~ s/\(quota(\S+), \d+\)/\(quota$1, $qid\)/;
-	    }
-	}
-	if ($line =~ /gl_flags/)
-	{
-	    $line =~ s/ (0) / plug[$1] /;
-	    $line =~ s/ (1) / lock[$1] /;
-	    $line =~ s/ (2) / sticky[$1] /;
-	    $line =~ s/ (3) / prefetch[$1]/;
-	    $line =~ s/ (4) / sync[$1] /;
-	    $line =~ s/ (5) / dirty[$1] /;
-	    $line =~ s/ (6) / skip_waiters2[$1] /;
-	    $line =~ s/ (7) / greedy[$1] /;
-	}
-	if ($line =~ /state/)
-	{
-	    $line =~ s/(0)/unlocked[$1]/;
-	    $line =~ s/(1)/exclusive[$1]/;
-	    $line =~ s/(2)/deferred[$1]/;
-	    $line =~ s/(3)/shared[$1]/;
-	}
-	if ($line =~ /gh_flags/)
-	{
-	    $line =~ s/ (0) / try[$1] /;
-	    $line =~ s/ (1) / try_1cb[$1] /;
-	    $line =~ s/ (2) / noexp[$1] /;
-	    $line =~ s/ (3) / any[$1] /;
-	    $line =~ s/ (4) / priority[$1] /;
-	    $line =~ s/ (5) / local_excl[$1] /;
-	    $line =~ s/ (6) / async[$1] /;
-	    $line =~ s/ (7) / exact[$1] /;
-	    $line =~ s/ (8) / skip[$1] /;
-	    $line =~ s/ (9) / atime[$1] /;
-	    $line =~ s/ (10) / nocache[$1] /;
-	    $line =~ s/ (11) / sync[$1] /;
-	    $line =~ s/ (12) / nocancel[$1] /;
-	    $line =~ s/ (13) / never_recurse[$1] /;
-	}
-	if ($line =~ /gh_iflags/)
-	{
-	    $line =~ s/ (0) / mutex[$1] /;
-	    $line =~ s/ (1) / promote[$1] /;
-	    $line =~ s/ (2) / demote[$1] /;
-	    $line =~ s/ (3) / greedy[$1] /;
-	    $line =~ s/ (4) / alloced[$1] /;
-	    $line =~ s/ (5) / dealloc[$1] /;
-	    $line =~ s/ (6) / holder[$1] /;
-	    $line =~ s/ (7) / first[$1] /;
-	    $line =~ s/ (8) / recurse[$1] /;
-	    $line =~ s/ (9) / aborted[$1] /;
-	}
-	if ($line =~ /owner/)
-	{
-	    $line =~ s/(-1)/none[$1]/;
-	}
-	if ($line =~ /type/)
-	{
-	    $line =~ s/(0)/unknown[$1]/;
-	    $line =~ s/(1)/fifo[$1]/;
-	    $line =~ s/(2)/character device[$1]/;
-	    $line =~ s/(4)/dirctory[$1]/;
-	    $line =~ s/(6)/block device[$1]/;
-	    $line =~ s/(8)/regular file[$1]/;
-	    $line =~ s/(10)/symlink[$1]/;
-	    $line =~ s/(12)/socket[$1]/;
-	    $line =~ s/(14)/whiteout[$1]/;
-	}
-	if ($line =~ /i_flags/)
-	{
-	    $line =~ s/ (0) / qd_locked[$1] /;
-	    $line =~ s/ (1) / paged[$1] /;
-	    $line =~ s/ (2) / sw_paged[$1] /;
-	}
-    
-	$locks[$ln] .= $line;
-    }
-
-    close(FILE);
-}
-
-
-@locks = sort funky @locks unless ($nosort);
-
-
-foreach $lock (@locks)
-{
-    print $lock;
-    print "\n" unless ($nosort);
-}
-
-
-
-sub funky
-{
-    my($a_iopen, $b_iopen) = (0, 0);
-    my($a_locked, $b_locked) = (0, 0);
-    my($a_queued, $b_queued) = (0, 0);
-    my($a_unlocked, $b_unlocked) = (0, 0);
-
-
-    $a_iopen = 1 if ($a =~ /iopen/);
-    $b_iopen = 1 if ($b =~ /iopen/);
-
-    $a_locked = 1 if ($a =~ /gl_flags.*lock.*\n/);
-    $b_locked = 1 if ($b =~ /gl_flags.*lock.*\n/);
-
-    $a_queued = 1 if ($a =~ /Request/ ||
-		      $a =~ /Holder/ ||
-		      $a =~ /Waiter/);
-    $b_queued = 1 if ($b =~ /Request/ ||
-		      $b =~ /Holder/ ||
-		      $b =~ /Waiter/);
-
-    $a_unlocked = 1 if ($a =~ /gl_state.*unlocked.*\n/);
-    $b_unlocked = 1 if ($b =~ /gl_state.*unlocked.*\n/);
-
-
-    return ($a_iopen <=> $b_iopen) if ($a_iopen != $b_iopen);
-    return -($a_locked <=> $b_locked) if ($a_locked != $b_locked);
-    return -($a_queued <=> $b_queued) if ($a_queued != $b_queued);
-    return ($a_unlocked <=> $b_unlocked) if ($a_unlocked != $b_unlocked);
- 
-
-    return 0;
-}
-
-
diff --git a/gfs2/tool/df.c b/gfs2/tool/df.c
deleted file mode 100644
index 8174a92..0000000
--- a/gfs2/tool/df.c
+++ /dev/null
@@ -1,182 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <linux/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <limits.h>
-#include <errno.h>
-
-#define __user
-#include <linux/gfs2_ondisk.h>
-
-#include "gfs2_tool.h"
-#include "libgfs2.h"
-
-/**
- * do_df_one - print out information about one filesystem
- * @path: the path to the filesystem
- *
- */
-
-static void
-do_df_one(char *path)
-{
-	unsigned int percentage;
-	unsigned int journals;
-	uint64_t rgrps;
-	unsigned int flags;
-	char *value, *fs;
-	int statfs_fd;
-	struct gfs2_sbd sbd;
-	char buf[GFS2_DEFAULT_BSIZE], statfs_fn[PATH_MAX];
-	struct gfs2_statfs_change sc;
-
-	memset(&sbd, 0, sizeof(struct gfs2_sbd));
-	sbd.path_name = path;
-	check_for_gfs2(&sbd);
-	fs = mp2fsname(sbd.path_name);
-
-	sbd.device_fd = open(sbd.device_name, O_RDONLY);
-	if (sbd.device_fd < 0)
-		die("can't open %s: %s\n", path, strerror(errno));
-
-	sbd.bsize = GFS2_DEFAULT_BSIZE;
-	sbd.jsize = GFS2_DEFAULT_JSIZE;
-	sbd.rgsize = GFS2_DEFAULT_RGSIZE;
-	sbd.utsize = GFS2_DEFAULT_UTSIZE;
-	sbd.qcsize = GFS2_DEFAULT_QCSIZE;
-	osi_list_init(&sbd.rglist);
-	init_buf_list(&sbd, &sbd.buf_list, 128 << 20);
-	init_buf_list(&sbd, &sbd.nvbuf_list, 0xffffffff);
-
-	do_lseek(sbd.device_fd, 0x10 * sbd.bsize);
-	do_read(sbd.device_fd, buf, sbd.bsize); /* read in the superblock */
-
-	compute_constants(&sbd);
-	gfs2_sb_in(&sbd.sd_sb, buf); /* parse it out into the sb structure */
-
-	sbd.master_dir = gfs2_load_inode(&sbd,
-					 sbd.sd_sb.sb_master_dir.no_addr);
-
-	gfs2_lookupi(sbd.master_dir, "rindex", 6, &sbd.md.riinode);
-	gfs2_lookupi(sbd.master_dir, "jindex", 6, &sbd.md.jiinode);
-	close(sbd.device_fd);
-
-	journals = sbd.md.jiinode->i_di.di_entries - 2;
-
-	rgrps = sbd.md.riinode->i_di.di_size;
-	if (rgrps % sizeof(struct gfs2_rindex))
-		die("bad rindex size\n");
-	rgrps /= sizeof(struct gfs2_rindex);
-
-	printf("%s:\n", path);
-	printf("  SB lock proto = \"%s\"\n", sbd.sd_sb.sb_lockproto);
-	printf("  SB lock table = \"%s\"\n", sbd.sd_sb.sb_locktable);
-	printf("  SB ondisk format = %u\n", sbd.sd_sb.sb_fs_format);
-	printf("  SB multihost format = %u\n", sbd.sd_sb.sb_multihost_format);
-	printf("  Block size = %u\n", sbd.sd_sb.sb_bsize);
-	printf("  Journals = %u\n", journals);
-	printf("  Resource Groups = %"PRIu64"\n", rgrps);
-	printf("  Mounted lock proto = \"%s\"\n",
-	       ((value = get_sysfs(fs, "args/lockproto"))[0])
-	       ? value : sbd.sd_sb.sb_lockproto);
-	printf("  Mounted lock table = \"%s\"\n",
-	       ((value = get_sysfs(fs, "args/locktable"))[0])
-	       ? value : sbd.sd_sb.sb_locktable);
-	printf("  Mounted host data = \"%s\"\n",
-	       get_sysfs(fs, "args/hostdata"));
-	printf("  Journal number = %s\n", get_sysfs(fs, "lockstruct/jid"));
-	flags = get_sysfs_uint(fs, "lockstruct/flags");
-	printf("  Lock module flags = %x", flags);
-	printf("\n");
-	printf("  Local flocks = %s\n",
-	       (get_sysfs_uint(fs, "args/localflocks")) ? "TRUE" : "FALSE");
-	printf("  Local caching = %s\n",
-		(get_sysfs_uint(fs, "args/localcaching")) ? "TRUE" : "FALSE");
-
-	/* Read the master statfs file */
-	mount_gfs2_meta(&sbd);
-
-	sprintf(statfs_fn, "%s/statfs", sbd.metafs_path);
-	statfs_fd = open(statfs_fn, O_RDONLY);
-	do_read(statfs_fd, buf, sizeof(struct gfs2_statfs_change));
-	gfs2_statfs_change_in(&sc, (char *)&buf);
-
-	close(statfs_fd);
-
-	cleanup_metafs(&sbd);
-
-	printf("\n");
-	printf("  %-15s%-15s%-15s%-15s%-15s\n", "Type", "Total", "Used", "Free", "use%");
-	printf("  ------------------------------------------------------------------------\n");
-
-	percentage = sc.sc_total ?
-		(100.0 * (sc.sc_total - sc.sc_free)) / sc.sc_total + 0.5 : 0;
-	printf("  %-15s%-15llu%-15llu%-15llu%u%%\n", "data",
-	       (unsigned long long)sc.sc_total,
-	       (unsigned long long)sc.sc_total - sc.sc_free,
-	       (unsigned long long)sc.sc_free, percentage);
-
-	percentage = (sc.sc_dinodes + sc.sc_free) ?
-		(100.0 * sc.sc_dinodes / (sc.sc_dinodes + sc.sc_free)) + 0.5 :
-		0;
-	printf("  %-15s%-15llu%-15llu%-15llu%u%%\n", "inodes",
-	       (unsigned long long)sc.sc_dinodes + sc.sc_free,
-	       (unsigned long long)sc.sc_dinodes,
-	       (unsigned long long)sc.sc_free, percentage);
-}
-
-
-/**
- * print_df - print out information about filesystems
- * @argc:
- * @argv:
- *
- */
-
-void
-print_df(int argc, char **argv)
-{
-	if (optind < argc) {
-		char buf[PATH_MAX];
-
-		if (!realpath(argv[optind], buf))
-			die("can't determine real path: %s\n", strerror(errno));
-
-		do_df_one(buf);
-
-		return;
-	}
-
-	{
-		FILE *file;
-		char buf[256], device[256], path[256], type[256];
-		int first = TRUE;
-
-		file = fopen("/proc/mounts", "r");
-		if (!file)
-			die("can't open /proc/mounts: %s\n", strerror(errno));
-
-		while (fgets(buf, 256, file)) {
-			if (sscanf(buf, "%s %s %s", device, path, type) != 3)
-				continue;
-			if (strcmp(type, "gfs2") != 0)
-				continue;
-
-			if (first)
-				first = FALSE;
-			else
-				printf("\n");
-
-			do_df_one(path);
-		}
-
-		fclose(file);
-	}
-}
diff --git a/gfs2/tool/gfs2_tool.h b/gfs2/tool/gfs2_tool.h
deleted file mode 100644
index b0c7e9a..0000000
--- a/gfs2/tool/gfs2_tool.h
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef __GFS2_TOOL_DOT_H__
-#define __GFS2_TOOL_DOT_H__
-
-
-extern char *prog_name;
-extern char *action;
-extern int override;
-extern int expert;
-extern int debug;
-extern int continuous;
-extern int interval;
-
-
-/* From counters.c */
-
-void print_counters(int argc, char **argv);
-
-
-/* From df.c */
-
-void print_df(int argc, char **argv);
-
-
-/* From layout.c */
-
-void print_layout(int argc, char **argv);
-
-
-/* From main.c */
-
-void print_usage(void);
-
-
-/* From misc.c */
-
-void do_file_flush(int argc, char **argv);
-void do_freeze(int argc, char **argv);
-void margs(int argc, char **argv);
-void print_lockdump(int argc, char **argv);
-void set_flag(int argc, char **argv);
-void print_stat(int argc, char **argv);
-void print_sb(int argc, char **argv);
-void print_args(int argc, char **argv);
-void print_jindex(int argc, char **argv);
-void print_journals(int argc, char **argv);
-void print_rindex(int argc, char **argv);
-void print_quota(int argc, char **argv);
-void print_list(void);
-void do_shrink(int argc, char **argv);
-void do_withdraw(int argc, char **argv);
-
-
-/* From sb.c */
-
-void do_sb(int argc, char **argv);
-
-
-/* From tune.c */
-
-void get_tune(int argc, char **argv);
-void set_tune(int argc, char **argv);
-
-#endif /* __GFS2_TOOL_DOT_H__ */
diff --git a/gfs2/tool/iflags.h b/gfs2/tool/iflags.h
deleted file mode 100644
index 2d6cf18..0000000
--- a/gfs2/tool/iflags.h
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef __IFLAGS_DOT_H__
-#define __IFLAGS_DOT_H__
-
-#define FS_IOC_GETFLAGS                 _IOR('f', 1, long)
-#define FS_IOC_SETFLAGS                 _IOW('f', 2, long)
-#define FS_IOC32_GETFLAGS               _IOR('f', 1, int)
-#define FS_IOC32_SETFLAGS               _IOW('f', 2, int)
-
-/*
- * Inode flags (FS_IOC_GETFLAGS / FS_IOC_SETFLAGS)
- */
-#define FS_SECRM_FL                     0x00000001 /* Secure deletion */
-#define FS_UNRM_FL                      0x00000002 /* Undelete */
-#define FS_COMPR_FL                     0x00000004 /* Compress file */
-#define FS_SYNC_FL                      0x00000008 /* Synchronous updates */
-#define FS_IMMUTABLE_FL                 0x00000010 /* Immutable file */
-#define FS_APPEND_FL                    0x00000020 /* writes to file may only append */
-#define FS_NODUMP_FL                    0x00000040 /* do not dump file */
-#define FS_NOATIME_FL                   0x00000080 /* do not update atime */
-/* Reserved for compression usage... */
-#define FS_DIRTY_FL                     0x00000100
-#define FS_COMPRBLK_FL                  0x00000200 /* One or more compressed clusters */
-#define FS_NOCOMP_FL                    0x00000400 /* Don't compress */
-#define FS_ECOMPR_FL                    0x00000800 /* Compression error */
-/* End compression flags --- maybe not all used */
-#define FS_BTREE_FL                     0x00001000 /* btree format dir */
-#define FS_INDEX_FL                     0x00001000 /* hash-indexed directory */
-#define FS_IMAGIC_FL                    0x00002000 /* AFS directory */
-#define FS_JOURNAL_DATA_FL              0x00004000 /* Reserved for ext3 */
-#define FS_NOTAIL_FL                    0x00008000 /* file tail should not be merged */
-#define FS_DIRSYNC_FL                   0x00010000 /* dirsync behaviour (directories only) */
-#define FS_TOPDIR_FL                    0x00020000 /* Top of directory hierarchies*/
-#define FS_EXTENT_FL                    0x00080000 /* Extents */
-#define FS_DIRECTIO_FL                  0x00100000 /* Use direct i/o */
-#define FS_RESERVED_FL                  0x80000000 /* reserved for ext2 lib */
-
-#define FS_FL_USER_VISIBLE              0x0003DFFF /* User visible flags */
-#define FS_FL_USER_MODIFIABLE           0x000380FF /* User modifiable flags */
-
-#endif /* __IFLAGS_DOT_H__ */
diff --git a/gfs2/tool/layout.c b/gfs2/tool/layout.c
deleted file mode 100644
index 34eec90..0000000
--- a/gfs2/tool/layout.c
+++ /dev/null
@@ -1,848 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <sys/types.h>
-#include <linux/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <limits.h>
-#include <errno.h>
-
-#define __user
-#include <linux/gfs2_ondisk.h>
-
-#include "osi_list.h"
-#include "linux_endian.h"
-
-#include "gfs2_tool.h"
-#include "libgfs2.h"
-
-#define LAYOUT_DATA_QUANTUM (4194304)
-
-struct extent {
-	osi_list_t list;
-
-	uint64_t offset;
-	uint64_t start;
-	unsigned int len;
-};
-typedef struct extent extent_t;
-
-struct buffer {
-	osi_list_t list;
-	uint64_t blkno;
-	char *data;
-
-	int touched;
-};
-typedef struct buffer buffer_t;
-
-struct world {
-	char *buf_data;
-	unsigned int buf_size;
-	int buf_count;
-	osi_list_t blist;
-	osi_list_t elist;
-
-	struct gfs2_sb sb;
-	unsigned int diptrs;
-	unsigned int inptrs;
-	unsigned int jbsize;
-	unsigned int hash_bsize;
-	unsigned int hash_ptrs;
-
-	buffer_t *dibh;
-	struct gfs2_dinode di;
-};
-typedef struct world world_t;
-
-typedef void (*pointer_call_t) (world_t *w,
-				unsigned int height, uint64_t bn, void *data);
-typedef void (*leaf_call_t) (world_t *w,
-			     uint32_t index, uint32_t len, uint64_t leaf_no,
-			     void *data);
-
-#if GFS2_TOOL_FEATURE_IMPLEMENTED
-/**
- * build_list - build a list of buffer_t's to represent the data from the kernel
- * @w: the world structure
- *
- */
-
-static void
-build_list(world_t *w)
-{
-	buffer_t *b;
-	unsigned int x;
-
-	for (x = 0; x < w->buf_count; x += sizeof(uint64_t) + w->sb.sb_bsize) {
-		b = malloc(sizeof(buffer_t));
-		if (!b)
-			die("out of memory\n");
-
-		memset(b, 0, sizeof(buffer_t));
-
-		b->blkno = *(uint64_t *) (w->buf_data + x);
-		b->data = w->buf_data + x + sizeof(uint64_t);
-
-		osi_list_add_prev(&b->list, &w->blist);
-	}
-
-	if (x != w->buf_count)
-		die("the kernel passed back unaligned data\n");
-}
-
-/**
- * check_list - check the buffers passed back by the kernel
- * @w: the world
- *
- */
-
-static void
-check_list(world_t *w)
-{
-	osi_list_t *tmp;
-	buffer_t *b;
-	struct gfs2_meta_header mh;
-	char *type;
-
-	for (tmp = w->blist.next; tmp != &w->blist; tmp = tmp->next) {
-		b = osi_list_entry(tmp, buffer_t, list);
-
-		gfs2_meta_header_in(&mh, b->data);
-
-		if (mh.mh_magic != GFS2_MAGIC)
-			die("bad magic number on block\n");
-
-		switch (mh.mh_type) {
-		case GFS2_METATYPE_DI:
-			type = "GFS2_METATYPE_DI";
-
-			if (w->dibh)
-				die("more than one dinode in file\n");
-			else {
-				w->dibh = b;
-				gfs2_dinode_in(&w->di, b->data);
-
-				b->touched = TRUE;
-			}
-
-			break;
-		case GFS2_METATYPE_IN:
-			type = "GFS2_METATYPE_IN";
-			break;
-		case GFS2_METATYPE_LF:
-			type = "GFS2_METATYPE_LF";
-			break;
-		case GFS2_METATYPE_JD:
-			type = "GFS2_METATYPE_JD";
-			break;
-		case GFS2_METATYPE_EA:
-			type = "GFS2_METATYPE_EA";
-			break;
-		case GFS2_METATYPE_ED:
-			die("GFS2_METATYPE_ED shouldn't be present\n");
-		default:
-			die("strange meta type\n");
-		}
-	}
-
-	if (!w->dibh)
-		die("no dinode\n");
-}
-
-/**
- * getbuf - get the buffer_t for a given block number
- * @w: the world
- * @blkno: the block number
- *
- * Returns: the buffer_t
- */
-
-static buffer_t *
-getbuf(world_t *w, uint64_t blkno)
-{
-	osi_list_t *tmp;
-	buffer_t *b;
-
-	for (tmp = w->blist.next; tmp != &w->blist; tmp = tmp->next) {
-		b = osi_list_entry(tmp, buffer_t, list);
-		if (b->blkno == blkno) {
-			osi_list_del(&b->list);
-			osi_list_add(&b->list, &w->blist);
-
-			b->touched = TRUE;
-
-			return b;
-		}
-	}
-
-	die("buffer not found\n");
-}
-
-/**
- * recursive_scan - call a function for each block pointer in a file
- * @w: the world
- * @height: the height of the block being pointed to
- * @block: the block being pointed to
- * @pc: the function to call
- * @data: private data for the @pc function
- *
- */
-
-static void
-recursive_scan(world_t *w,
-	       unsigned int height, uint64_t block, pointer_call_t pc, void *data)
-{
-	buffer_t *b = NULL;
-	uint64_t *top, *bottom;
-	uint64_t bn;
-
-	if (!height) {
-		b = w->dibh;
-
-		top = (uint64_t *) (b->data + sizeof(struct gfs2_dinode));
-		bottom =
-		    (uint64_t *) (b->data + sizeof(struct gfs2_dinode)) +
-		    w->diptrs;
-	} else {
-		b = getbuf(w, block);
-
-		top = (uint64_t *) (b->data + sizeof(struct gfs2_meta_header));
-		bottom =
-		    (uint64_t *) (b->data + sizeof(struct gfs2_meta_header)) +
-		    w->inptrs;
-	}
-
-	for (; top < bottom; top++) {
-		bn = le64_to_cpu(*top);
-
-		pc(w, height, bn, data);
-
-		if (bn && height < w->di.di_height - 1)
-			recursive_scan(w, height + 1, bn, pc, data);
-	}
-}
-
-/**
- * bmap - return the buffer_t for a given logical block in the file
- * @w: the world
- * @lbn: the logical block number
- *
- * Returns: the buffer_t
- */
-
-static buffer_t *
-bmap(world_t *w, uint64_t lbn)
-{
-	osi_list_t *tmp;
-	extent_t *e;
-
-	for (tmp = w->elist.next; tmp != &w->elist; tmp = tmp->next) {
-		e = osi_list_entry(tmp, extent_t, list);
-
-		if (e->offset <= lbn && lbn < e->offset + e->len)
-			return getbuf(w, e->start + lbn - e->offset);
-	}
-
-	return NULL;
-}
-
-/**
- * journaled_read - read some of the contents of a journaled file
- * @w: the world
- * @buf: the buffer to read into
- * @offset: the offset to read from
- * @size: the number of bytes to read
- *
- */
-
-static void
-journaled_read(world_t *w, char *buf, uint64_t offset, unsigned int size)
-{
-	buffer_t *b;
-	uint64_t lbn;
-	unsigned int o, chunk;
-
-	if (!(w->di.di_flags & GFS2_DIF_JDATA))
-		die("not a journaled file\n");
-
-	if (!w->di.di_height) {
-		if (offset >= w->sb.sb_bsize - sizeof(struct gfs2_dinode))
-			memset(buf, 0, size);
-		else {
-			chunk =
-			    w->sb.sb_bsize - sizeof(struct gfs2_dinode) -
-			    offset;
-			if (chunk > size)
-				chunk = size;
-			memcpy(buf,
-			       w->dibh->data + sizeof(struct gfs2_dinode) +
-			       offset, chunk);
-			if (chunk < size)
-				memset(buf + chunk, 0, size - chunk);
-		}
-	} else
-		while (size) {
-			lbn = offset / w->jbsize;
-			o = offset % w->jbsize;
-			chunk = (size > w->jbsize - o) ? (w->jbsize - o) : size;
-
-			b = bmap(w, lbn);
-			if (b)
-				memcpy(buf,
-				       b->data +
-				       sizeof(struct gfs2_meta_header) + o,
-				       chunk);
-			else
-				memset(buf, 0, chunk);
-
-			buf += chunk;
-			offset += chunk;
-			size -= chunk;
-		}
-}
-
-/**
- * foreach_leaf - call a function for each leaf in a directory
- * @w: the world
- * @lc: the function to call for each each
- * @data: private data to pass to it
- *
- * Returns: 0 on success, -EXXX on failure
- */
-
-static void
-foreach_leaf(world_t *w, leaf_call_t lc, void *data)
-{
-	buffer_t *b;
-	struct gfs2_leaf leaf;
-	uint32_t hsize, len;
-	uint32_t ht_offset, lp_offset, ht_offset_cur = -1;
-	uint32_t index = 0;
-	uint64_t lp[w->hash_ptrs];
-	uint64_t leaf_no;
-
-	hsize = 1 << w->di.di_depth;
-	if (hsize * sizeof(uint64_t) != w->di.di_size)
-		die("bad hash table size\n");
-
-	while (index < hsize) {
-		lp_offset = index % w->hash_ptrs;
-		ht_offset = index - lp_offset;
-
-		if (ht_offset_cur != ht_offset) {
-			journaled_read(w, (char *) lp,
-				       ht_offset * sizeof(uint64_t),
-				       w->hash_bsize);
-			ht_offset_cur = ht_offset;
-		}
-
-		leaf_no = le64_to_cpu(lp[lp_offset]);
-		if (!leaf_no)
-			die("NULL leaf pointer\n");
-
-		b = getbuf(w, leaf_no);
-		gfs2_leaf_in(&leaf, b->data);
-
-		len = 1 << (w->di.di_depth - leaf.lf_depth);
-
-		lc(w, index, len, leaf_no, data);
-
-		index += len;
-	}
-
-	if (index != hsize)
-		die("screwed up directory\n");
-}
-
-/**
- * add_extent - add an extend to the list of the file's data extents
- * @w: the world
- * @offset: the starting logical block of the extent
- * @start: the starting disk block of the extent
- * @len: the number of blocks in the extent
- *
- */
-
-static void
-add_extent(world_t *w, uint64_t offset, uint64_t start, unsigned int len)
-{
-	extent_t *e;
-
-	e = malloc(sizeof(extent_t));
-	if (!e)
-		die("out of memory\n");
-
-	memset(e, 0, sizeof(extent_t));
-
-	e->offset = offset;
-	e->start = start;
-	e->len = len;
-
-	osi_list_add_prev(&e->list, &w->elist);
-}
-
-struct do_pf_s {
-	unsigned int height;
-	uint64_t offset;
-	uint64_t start;
-	uint64_t skip;
-	unsigned int len;
-};
-typedef struct do_pf_s do_pf_t;
-
-/**
- * do_pf: called for every pointer in the file (prints/collects extent info)
- * @w: the world
- * @height: the height of the block containing the pointer
- * @bn: the contents of the pointer
- * @data: a do_pf_t structure
- *
- */
-
-static void
-do_pf(world_t *w, unsigned int height, uint64_t bn, void *data)
-{
-	do_pf_t *pf = (do_pf_t *) data;
-	unsigned int x;
-	uint64_t skip;
-
-	if (pf->height < height + 1)
-		return;
-
-	if (!bn) {
-		if (pf->height == height + 1)
-			pf->skip++;
-		else {
-			x = pf->height - height - 1;
-			skip = w->inptrs;
-			while (--x)
-				skip *= w->inptrs;
-			pf->skip += skip;
-		}
-
-		return;
-	}
-
-	if (pf->height == height + 1) {
-		if (pf->start + pf->len == bn && pf->len == pf->skip) {
-			pf->len++;
-			pf->skip++;
-		} else {
-			if (pf->start) {
-				printf("  %-20" PRIu64 " %-20" PRIu64 " %-20"
-				       PRIu64 " %u\n", pf->offset,
-				       pf->offset + pf->len - 1, pf->start,
-				       pf->len);
-				if (pf->height == w->di.di_height)
-					add_extent(w, pf->offset, pf->start,
-						   pf->len);
-			}
-
-			pf->offset += pf->skip;
-			pf->start = bn;
-			pf->len = 1;
-			pf->skip = 1;
-		}
-	}
-}
-
-/**
- * print_file - print out the extent lists for all the heights of a file
- * @w: the world
- *
- */
-
-static void
-print_file(world_t *w)
-{
-	do_pf_t pf;
-	unsigned int h;
-	char *type;
-
-	switch (w->di.di_mode & S_IFMT) {
-	case 0:
-		type = "Unknown";
-		break;
-	case S_IFREG:
-		type = "File";
-		break;
-	case S_IFDIR:
-		type = "Directory";
-		break;
-	case S_IFLNK:
-		type = "Symbolic Link";
-		break;
-	case S_IFBLK:
-		type = "Block Device";
-		break;
-	case S_IFCHR:
-		type = "Character Device";
-		break;
-	case S_IFIFO:
-		type = "FIFO";
-		break;
-	case S_IFSOCK:
-		type = "Socket";
-		break;
-	default:
-		die("strange file type\n");
-	};
-
-	printf("%s dinode:\n", type);
-	printf("  %" PRIu64 "\n", w->di.di_num.no_addr);
-
-	if (!w->di.di_height) {
-		if (S_ISDIR(w->di.di_mode)) {
-			if (w->di.di_flags & GFS2_DIF_EXHASH)
-				printf("\nStuffed hash table\n");
-		} else
-			printf("\nStuffed file data\n");
-
-		return;
-	}
-
-	for (h = 1; h <= w->di.di_height; h++) {
-		if (S_ISDIR(w->di.di_mode))
-			type =
-			    (h == w->di.di_height) ? "hash table" : "indirect";
-		else
-			type = (h == w->di.di_height) ? "data" : "indirect";
-
-		printf("\n");
-		printf("At height %u (%s):\n", h, type);
-		printf("  %-20s %-20s %-20s %s\n",
-		       "From LBlock", "To LBlock", "DBlock", "Blocks");
-
-		memset(&pf, 0, sizeof(do_pf_t));
-		pf.height = h;
-
-		recursive_scan(w, 0, 0, do_pf, &pf);
-
-		if (pf.start) {
-			printf("  %-20" PRIu64 " %-20" PRIu64 " %-20" PRIu64
-			       " %u\n", pf.offset, pf.offset + pf.len - 1,
-			       pf.start, pf.len);
-			if (h == w->di.di_height)
-				add_extent(w, pf.offset, pf.start, pf.len);
-		}
-	}
-}
-
-/**
- * do_lc - print out info about a leaf block
- * @w: the world
- * @index: the index of the leaf
- * @len: the number of pointers to the leaf
- * @leaf_no: the leaf block number
- * @data: unused
- *
- */
-
-static void
-do_lc(world_t *w, uint32_t index, uint32_t len, uint64_t leaf_no, void *data)
-{
-	buffer_t *b;
-	struct gfs2_leaf leaf;
-	uint64_t blk;
-
-	for (blk = leaf_no; blk; blk = leaf.lf_next) {
-		b = getbuf(w, blk);
-		gfs2_leaf_in(&leaf, b->data);
-
-		printf("  %.8X             %.8X             %-20" PRIu64
-		       " %u\n", index << (32 - w->di.di_depth),
-		       ((index + len) << (32 - w->di.di_depth)) - 1, blk,
-		       leaf.lf_entries);
-	}
-
-}
-
-/**
- * print_leaves - print out the location of the exhash leaves
- * @w: the world
- *
- */
-
-static void
-print_leaves(world_t *w)
-{
-	printf("\n");
-
-	if (w->di.di_flags & GFS2_DIF_EXHASH) {
-		printf("Leaves:\n");
-		printf("  %-20s %-20s %-20s %s\n",
-		       "From Hash", "To Hash", "DBlock", "Entries");
-		foreach_leaf(w, do_lc, NULL);
-	} else
-		printf("Stuffed directory data\n");
-}
-
-/**
- * print_eattr_data - print out the locations of the eattr data blocks
- * @w: the world
- *
- */
-
-#define MAKE_MULT8(x) (((x) + 7) & ~7)
-#define GFS2_EA_REC_LEN(ea) le32_to_cpu((ea)->ea_rec_len)
-#define GFS2_EA_IS_STUFFED(ea) (!(ea)->ea_num_ptrs)
-#define GFS2_EA_IS_LAST(ea) ((ea)->ea_flags & GFS2_EAFLAG_LAST)
-#define GFS2_EA2NAME(ea) ((char *)((struct gfs2_ea_header *)(ea) + 1))
-#define GFS2_EA2DATAPTRS(ea) \
-((uint64_t *)(GFS2_EA2NAME(ea) + MAKE_MULT8((ea)->ea_name_len)))
-#define GFS2_EA2NEXT(ea) \
-((struct gfs2_ea_header *)((char *)(ea) + GFS2_EA_REC_LEN(ea)))
-#define GFS2_EA_BH2FIRST(b) \
-((struct gfs2_ea_header *)((b)->data + \
-			  sizeof(struct gfs2_meta_header)))
-
-static void
-print_eattr_data(world_t *w, uint64_t blkno, int *first)
-{
-	buffer_t *b = getbuf(w, blkno);
-	struct gfs2_ea_header *ea;
-
-	ea = GFS2_EA_BH2FIRST(b);
-	for (;;) {
-		if (!GFS2_EA_IS_STUFFED(ea)) {
-			char name[300];
-			uint64_t *p, blkno;
-			uint64_t b;
-			unsigned int l;
-			unsigned int x;
-			int c;
-
-			if (*first) {
-				printf("\nExtended Attributes data blocks:\n");
-				printf("  %-20s %-10s %s\n",
-				       "DBlock", "Blocks", "Name");
-				*first = FALSE;
-			}
-
-			if (ea->ea_type == GFS2_EATYPE_UNUSED)
-				strcpy(name, "unused");
-			else {
-				unsigned int x;
-				switch (ea->ea_type) {
-				case GFS2_EATYPE_USR:
-					strcpy(name, "user.");
-					break;
-				case GFS2_EATYPE_SYS:
-					strcpy(name, "system.");
-					break;
-				default:
-					strcpy(name, "unknown.");
-					break;
-				}
-				x = strlen(name);
-				memcpy(name + x,
-				       GFS2_EA2NAME(ea), ea->ea_name_len);
-				name[x + ea->ea_name_len] = 0;
-			}
-
-			b = 0;
-			l = 0;
-			c = FALSE;
-
-			p = GFS2_EA2DATAPTRS(ea);
-			for (x = 0; x < ea->ea_num_ptrs; x++) {
-				blkno = le64_to_cpu(*p);
-				if (b + l == blkno)
-					l++;
-				else {
-					if (b) {
-						printf("  %-20" PRIu64
-						       " %-10u %s\n", b, l,
-						       name);
-						if (!c) {
-							strcat(name, " (cont)");
-							c = TRUE;
-						}
-					}
-					b = blkno;
-					l = 1;
-				}
-				p++;
-			}
-			printf("  %-20" PRIu64 " %-10u %s\n", b, l, name);
-		}
-		if (GFS2_EA_IS_LAST(ea))
-			break;
-		ea = GFS2_EA2NEXT(ea);
-	}
-}
-
-/**
- * print_eattr - print out the locations of the eattr blocks
- * @w: the world
- *
- */
-
-static void
-print_eattr(world_t *w)
-{
-	int first = TRUE;
-
-	if (w->di.di_flags & GFS2_DIF_EA_INDIRECT) {
-		buffer_t *b = getbuf(w, w->di.di_eattr);
-		uint64_t *blkno;
-		unsigned int x;
-
-		printf("\nExtended Attribute indirect block:\n");
-		printf("  %" PRIu64 "\n", w->di.di_eattr);
-
-		printf("\nExtended Attribute blocks:\n");
-		blkno = (uint64_t *) (b->data + sizeof(struct gfs2_meta_header));
-		for (x = 0; x < w->inptrs; x++) {
-			if (!*blkno)
-				break;
-			printf("  %" PRIu64 "\n", le64_to_cpu(*blkno));
-			blkno++;
-		}
-
-		blkno = (uint64_t *) (b->data + sizeof(struct gfs2_meta_header));
-		for (x = 0; x < w->inptrs; x++) {
-			if (!*blkno)
-				break;
-			print_eattr_data(w, le64_to_cpu(*blkno), &first);
-			blkno++;
-		}
-	} else {
-		printf("\nExtended Attribute block:\n");
-		printf("  %" PRIu64 "\n", w->di.di_eattr);
-
-		print_eattr_data(w, w->di.di_eattr, &first);
-	}
-}
-
-/**
- * check_for_untouched_buffers - 
- * @w: the world
- *
- */
-
-static void
-check_for_untouched_buffers(world_t *w)
-{
-	osi_list_t *tmp;
-	buffer_t *b;
-
-	for (tmp = w->blist.next; tmp != &w->blist; tmp = tmp->next) {
-		b = osi_list_entry(tmp, buffer_t, list);
-		if (b->touched)
-			continue;
-
-		printf("Buffer %" PRIu64 " untouched\n", b->blkno);
-	}
-}
-
-/**
- * print_layout - print out the ondisk layout of a file
- * @argc:
- * @argv:
- *
- */
-
-void
-print_layout(int argc, char **argv)
-{
-	world_t w;
-	int retry = TRUE;
-	struct gfs2_ioctl gi;
-	int error;
-	struct gfs2_sbd sbd;
-
-	memset(&w, 0, sizeof(world_t));
-	w.buf_size = LAYOUT_DATA_QUANTUM;
-	osi_list_init(&w.blist);
-	osi_list_init(&w.elist);
-
-	if (optind == argc)
-		die("Usage: gfs2_tool layout <filename> [buffersize]\n");
-
-	sbd.path_name = argv[optind++];
-	if (optind < argc ) {
-		w.buf_size = atoi(argv[3]);
-		retry = FALSE;
-	}
-
-	sbd.device_fd = open(sbd.path_name, O_RDONLY);
-	if (sbd.device_fd < 0)
-		die("can't open %s: %s\n", sbd.path_name, strerror(errno));
-
-	check_for_gfs2(&sbd);
-
-	{
-		char *argv[] = { "get_super" };
-
-		gi.gi_argc = 1;
-		gi.gi_argv = argv;
-		gi.gi_data = (char *)&w.sb;
-		gi.gi_size = sizeof(struct gfs2_sb);
-
-		error = ioctl(sbd.device_fd, GFS2_IOCTL_SUPER, &gi);
-		if (error != gi.gi_size)
-			die("error doing get_super (%d): %s\n",
-			    error, strerror(errno));
-	}
-
-	w.diptrs = (w.sb.sb_bsize - sizeof(struct gfs2_dinode)) /
-		sizeof(uint64_t);
-	w.inptrs = (w.sb.sb_bsize - sizeof(struct gfs2_meta_header)) /
-		sizeof(uint64_t);
-	w.jbsize = w.sb.sb_bsize - sizeof(struct gfs2_meta_header);
-	w.hash_bsize = w.sb.sb_bsize / 2;
-	w.hash_ptrs = w.hash_bsize / sizeof(uint64_t);
-
-	for (;;) {
-		char *argv[] = { "get_file_meta" };
-
-		w.buf_data = malloc(w.buf_size);
-		if (!w.buf_data)
-			die("out of memory\n");
-
-		gi.gi_argc = 1;
-		gi.gi_argv = argv;
-		gi.gi_data = w.buf_data;
-		gi.gi_size = w.buf_size;
-
-		w.buf_count = ioctl(sbd.device_fd, GFS2_IOCTL_SUPER, &gi);
-		if (w.buf_count >= 0)
-			break;
-
-		if (errno == ENOMEM) {
-			if (retry) {
-				free(w.buf_data);
-				w.buf_size += LAYOUT_DATA_QUANTUM;
-				continue;
-			} else
-				die("%u bytes isn't enough memory\n",
-				    w.buf_size);
-		}
-		die("error doing get_file_meta: %s\n",
-		    strerror(errno));
-	}
-
-	build_list(&w);
-	check_list(&w);
-
-	print_file(&w);
-
-	if (S_ISDIR(w.di.di_mode))
-		print_leaves(&w);
-
-	if (w.di.di_eattr)
-		print_eattr(&w);
-
-	check_for_untouched_buffers(&w);
-
-	close(sbd.device_fd);
-}
-#endif /* #if GFS2_TOOL_FEATURE_IMPLEMENTED */
-
diff --git a/gfs2/tool/main.c b/gfs2/tool/main.c
deleted file mode 100644
index 55df698..0000000
--- a/gfs2/tool/main.c
+++ /dev/null
@@ -1,269 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <limits.h>
-#include <errno.h>
-#include <linux/types.h>
-
-#include "copyright.cf"
-
-#include "gfs2_tool.h"
-#include "libgfs2.h"
-
-char *prog_name;
-char *action = NULL;
-int override = FALSE;
-int expert = FALSE;
-int debug = FALSE;
-int continuous = FALSE;
-int interval = 1;
-
-static const char *usage[] = {
-	"Clear a flag on a inode\n",
-	"  gfs2_tool clearflag flag <filenames>\n",
-	"\n",
-	"Do a GFS2 specific \"df\":\n",
-	"  gfs2_tool df <mountpoint>\n",
-	"\n",
-	"Freeze a GFS2 cluster:\n",
-	"  gfs2_tool freeze <mountpoint>\n",
-	"\n",
-	"Print the current mount arguments of a mounted filesystem:\n",
-	"  gfs2_tool getargs <mountpoint>\n",
-	"\n",
-	"Get tuneable parameters for a filesystem\n",
-	"  gfs2_tool gettune <mountpoint>\n",
-	"\n",
-	"List the file system's journals:\n",
-	"  gfs2_tool journals <mountpoint>\n",
-	"\n",
-	"List filesystems:\n",
-	"  gfs2_tool list\n",
-	"\n",
-	"Have GFS2 dump its lock state:\n",
-	"  gfs2_tool lockdump <mountpoint> [buffersize]\n",
-	"\n",
-	"Provide arguments for next mount:\n",
-	"  gfs2_tool margs <mountarguments>\n",
-	"\n",
-	"Tune a GFS2 superblock\n",
-	"  gfs2_tool sb <device> proto [newval]\n",
-	"  gfs2_tool sb <device> table [newval]\n",
-	"  gfs2_tool sb <device> ondisk [newval]\n",
-	"  gfs2_tool sb <device> multihost [newval]\n",
-	"  gfs2_tool sb <device> all\n",
-	"\n",
-	"Set a flag on a inode\n",
-	"  gfs2_tool setflag flag <filenames>\n",
-	"\n",
-	"Tune a running filesystem\n",
-	"  gfs2_tool settune <mountpoint> <parameter> <value>\n",
-	"\n",
-	"Shrink a filesystem's inode cache:\n",
-	"  gfs2_tool shrink <mountpoint>\n",
-	"\n",
-	"Unfreeze a GFS2 cluster:\n",
-	"  gfs2_tool unfreeze <mountpoint>\n",
-	"\n",
-	"Print tool version information\n",
-	"  gfs2_tool version\n",
-	"\n",
-	"Withdraw this machine from participating in a filesystem:\n",
-	"  gfs2_tool withdraw <mountpoint>\n",
-#if GFS2_TOOL_FEATURE_IMPLEMENTED
-	"\n",
-	"Force files from a machine's cache\n",
-	"  gfs2_tool flush <filenames>\n",
-	"\n",
-	"Print the superblock of a mounted filesystem:\n",
-	"  gfs2_tool getsb <mountpoint>\n",
-	"\n",
-	"Print the journal index of a mounted filesystem:\n",
-	"  gfs2_tool jindex <mountpoint>\n",
-	"\n",
-	"Print out the ondisk layout for a file:\n",
-	"  gfs2_tool layout <filename> [buffersize]\n",
-	"\n",
-	"Print the quota file of a mounted filesystem:\n",
-	"  gfs2_tool quota <mountpoint>\n",
-	"\n",
-	"Print the resource group index of a mounted filesystem:\n",
-	"  gfs2_tool rindex <mountpoint>\n",
-	"\n",
-	"Print file stat data:\n",
-	"  gfs2_tool stat <filename>\n",
-	"\n",
-#endif /* GFS2_TOOL_FEATURE_IMPLEMENTED */
-	"",
-};
-
-/**
- * print_usage - print out usage information
- *
- */
-
-void
-print_usage(void)
-{
-	int x;
-
-	for (x = 0; usage[x][0]; x++)
-		printf("%s", usage[x]);
-}
-
-/**
- * print_version -
- *
- */
-
-static void
-print_version(void)
-{
-	printf("gfs2_tool %s (built %s %s)\n",
-	       RELEASE_VERSION,
-	       __DATE__, __TIME__);
-	printf("%s\n",
-	       REDHAT_COPYRIGHT);
-}
-
-/**
- * decode_arguments -
- * @argc:
- * @argv:
- *
- */
-
-static void
-decode_arguments(int argc, char *argv[])
-{
-	int cont = TRUE;
-	int optchar;
-
-	while (cont) {
-		optchar = getopt(argc, argv, "cDhi:OVX");
-
-		switch (optchar) {
-		case 'c':
-			continuous = TRUE;
-			break;
-
-		case 'D':
-			debug = TRUE;
-			break;
-
-		case 'h':
-			print_usage();
-			exit(EXIT_SUCCESS);
-
-		case 'i':
-			sscanf(optarg, "%u", &interval);
-			break;
-
-		case 'O':
-			override = TRUE;
-			break;
-
-		case 'V':
-			print_version();
-			exit(EXIT_SUCCESS);
-
-		case 'X':
-			expert = TRUE;
-			break;
-
-		case EOF:
-			cont = FALSE;
-			break;
-
-		default:
-			die("unknown option: %c\n", optchar);
-		};
-	}
-
-	if (optind < argc) {
-		action = argv[optind];
-		optind++;
-	} else
-		die("no action specified\n");
-}
-
-/**
- * main - Do everything
- * @argc:
- * @argv:
- *
- */
-
-int
-main(int argc, char *argv[])
-{
-	prog_name = argv[0];
-
-	if (argc < 2) {
-		print_usage();
-		exit(EXIT_SUCCESS);
-	}
-
-	decode_arguments(argc, argv);
-
-	if (strcmp(action, "clearflag") == 0)
-		set_flag(argc, argv);
-	else if (strcmp(action, "df") == 0)
-		print_df(argc, argv);
-	else if (strcmp(action, "freeze") == 0)
-		do_freeze(argc, argv);
-	else if (strcmp(action, "getargs") == 0)
-		print_args(argc, argv);
-	else if (strcmp(action, "gettune") == 0)
-		get_tune(argc, argv);
-	else if (strcmp(action, "journals") == 0)
-		print_journals(argc, argv);
-	else if (strcmp(action, "list") == 0)
-		print_list();
-	else if (strcmp(action, "lockdump") == 0)
-		print_lockdump(argc, argv);
-	else if (strcmp(action, "margs") == 0)
-		margs(argc, argv);
-	else if (strcmp(action, "sb") == 0)
-		do_sb(argc, argv);
-	else if (strcmp(action, "setflag") == 0)
-		set_flag(argc, argv);
-	else if (strcmp(action, "settune") == 0)
-		set_tune(argc, argv);
-	else if (strcmp(action, "shrink") == 0)
-		do_shrink(argc, argv);
-	else if (strcmp(action, "unfreeze") == 0)
-		do_freeze(argc, argv);
-	else if (strcmp(action, "version") == 0)
-		print_version();
-	else if (strcmp(action, "withdraw") == 0)
-		do_withdraw(argc, argv);
-#if GFS2_TOOL_FEATURE_IMPLEMENTED
-	else if (strcmp(action, "flush") == 0)
-		do_file_flush(argc, argv);
-	else if (strcmp(action, "getsb") == 0)
-		print_sb(argc, argv);
-	else if (strcmp(action, "jindex") == 0)
-		print_jindex(argc, argv);
-	else if (strcmp(action, "layout") == 0)
-		print_layout(argc, argv);
-	else if (strcmp(action, "quota") == 0)
-		print_quota(argc, argv);
-	else if (strcmp(action, "rindex") == 0)
-		print_rindex(argc, argv);
-	else if (strcmp(action, "stat") == 0)
-		print_stat(argc, argv);
-#endif /* #if GFS2_TOOL_FEATURE_IMPLEMENTED */
-	else
-		die("unknown action: %s\n",
-		    action);
-
-	exit(EXIT_SUCCESS);
-}
diff --git a/gfs2/tool/misc.c b/gfs2/tool/misc.c
deleted file mode 100644
index eeaa091..0000000
--- a/gfs2/tool/misc.c
+++ /dev/null
@@ -1,721 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <sys/types.h>
-#include <linux/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <limits.h>
-#include <errno.h>
-#include <dirent.h>
-
-#define __user
-#include <linux/gfs2_ondisk.h>
-#include <sys/mount.h>
-
-#include "libgfs2.h"
-#include "gfs2_tool.h"
-#include "iflags.h"
-
-#if GFS2_TOOL_FEATURE_IMPLEMENTED
-/**
- * do_file_flush - 
- * @argc:
- * @argv:
- *
- */
-
-void
-do_file_flush(int argc, char **argv)
-{
-	char *gi_argv[] = { "do_file_flush" };
-	struct gfs2_ioctl gi;
-	int fd;
-	int error;
-	struct gfs2_sbd sbd;
-
-	if (optind == argc)
-		die("Usage: gfs2_tool flush <filenames>\n");
-
-	gi.gi_argc = 1;
-	gi.gi_argv = gi_argv;
-
-	for (; optind < argc; optind++) {
-		fd = open(argv[optind], O_RDONLY);
-		if (fd < 0)
-			die("can't open %s: %s\n", argv[optind], strerror(errno));
-
-		sbd.path_name = argv[optind];
-		check_for_gfs2(&sbd);
-
-		error = ioctl(fd, GFS2_IOCTL_SUPER, &gi);
-		if (error)
-			die("error doing do_file_flush (%d): %s\n",
-			    error, strerror(errno));
-
-		close(fd);
-	}
-}
-#endif /* #if GFS2_TOOL_FEATURE_IMPLEMENTED */
-
-/**
- * do_freeze - freeze a GFS2 filesystem
- * @argc:
- * @argv:
- *
- */
-
-void
-do_freeze(int argc, char **argv)
-{
-	char *command = argv[optind - 1];
-	char *name;
-
-	if (optind == argc)
-		die("Usage: gfs2_tool %s <mountpoint>\n", command);
-
-	name = mp2fsname(argv[optind]);
-
-	if (strcmp(command, "freeze") == 0)
-		set_sysfs(name, "freeze", "1");
-	else if (strcmp(command, "unfreeze") == 0)
-		set_sysfs(name, "freeze", "0");
-
-	sync();
-}
-
-/**
- * print_lockdump -
- * @argc:
- * @argv:
- *
- */
-
-void
-print_lockdump(int argc, char **argv)
-{
-	char path[PATH_MAX];
-	char *name, line[PATH_MAX];
-	char *debugfs;
-	FILE *file;
-	int rc = -1;
-
-	/* See if debugfs is mounted, and if not, mount it. */
-	debugfs = find_debugfs_mount();
-	if (!debugfs) {
-		debugfs = malloc(PATH_MAX);
-		if (!debugfs)
-			die("Can't allocate memory for debugfs.\n");
-
-		memset(debugfs, 0, PATH_MAX);
-		sprintf(debugfs, "/tmp/debugfs.XXXXXX");
-
-		if (!mkdtemp(debugfs)) {
-			fprintf(stderr,
-				"Can't create %s mount point.\n",
-				debugfs);
-			free(debugfs);
-			exit(-1);
-		}
-
-		rc = mount("none", debugfs, "debugfs", 0, NULL);
-		if (rc) {
-			fprintf(stderr,
-				"Can't mount debugfs.  "
-				"Maybe your kernel doesn't support it.\n");
-				free(debugfs);
-				exit(-1);
-		}
-	}
-	name = mp2fsname(argv[optind]);
-	if (name) {
-		sprintf(path, "%s/gfs2/%s/glocks", debugfs, name);
-		free(name);
-		file = fopen(path, "rt");
-		if (file) {
-			while (fgets(line, PATH_MAX, file)) {
-				printf("%s", line);
-			}
-			fclose(file);
-		} else {
-			fprintf(stderr, "Can't open %s: %s\n", path,
-				strerror(errno));
-		}
-	} else {
-		fprintf(stderr, "Unable to locate sysfs for mount point %s.\n",
-			argv[optind]);
-	}
-	/* Check if we mounted the debugfs and if so, unmount it. */
-	if (!rc) {
-		umount(debugfs);
-		rmdir(debugfs);
-	}
-	free(debugfs);
-}
-
-/**
- * margs -
- * @argc:
- * @argv:
- *
- */
-
-void
-margs(int argc, char **argv)
-{
-	die("margs not implemented\n");
-}
-
-/**
- * print_flags - print the flags in a dinode's di_flags field
- * @di: the dinode structure
- *
- */
-
-static void
-print_flags(struct gfs2_dinode *di)
-{
-	if (di->di_flags) {
-		printf("Flags:\n");
-		if (di->di_flags & GFS2_DIF_JDATA)
-			printf("  jdata\n");
-		if (di->di_flags & GFS2_DIF_EXHASH)
-			printf("  exhash\n");
-		if (di->di_flags & GFS2_DIF_EA_INDIRECT)
-			printf("  ea_indirect\n");
-		if (di->di_flags & GFS2_DIF_IMMUTABLE)
-			printf("  immutable\n");
-		if (di->di_flags & GFS2_DIF_APPENDONLY)
-			printf("  appendonly\n");
-		if (di->di_flags & GFS2_DIF_NOATIME)
-			printf("  noatime\n");
-		if (di->di_flags & GFS2_DIF_SYNC)
-			printf("  sync\n");
-		if (di->di_flags & GFS2_DIF_TRUNC_IN_PROG)
-			printf("  trunc_in_prog\n");
-	}
-}
-
-/*
- * Use FS_XXX_FL flags defined in <linux/fs.h> which correspond to
- * GFS2_DIF_XXX
- */
-static unsigned int 
-get_flag_from_name(char *name)
-{
-	if (strncmp(name, "jdata", 5) == 0)
-		return FS_JOURNAL_DATA_FL;
-	else if (strncmp(name, "exhash", 6) == 0)
-		return FS_INDEX_FL;
-	else if (strncmp(name, "immutable", 9) == 0)
-		return FS_IMMUTABLE_FL;
-	else if (strncmp(name, "appendonly", 10) == 0)
-		return FS_APPEND_FL;
-	else if (strncmp(name, "noatime", 7) == 0)
-		return FS_NOATIME_FL;
-	else if (strncmp(name, "sync", 4) == 0)
-		return FS_SYNC_FL;
-	else 
-		return 0;
-}
-
-/**
- * set_flag - set or clear flags in some dinodes
- * @argc:
- * @argv:
- *
- */
-void
-set_flag(int argc, char **argv)
-{
-	struct gfs2_dinode di;
-	char *flstr;
-	int fd, error, set;
-	unsigned int newflags = 0;
-	unsigned int flag;
-	if (optind == argc) {
-		di.di_flags = 0xFFFFFFFF;
-		print_flags(&di);
-		return;
-	}
-	
-	set = (strcmp(argv[optind -1], "setflag") == 0) ? 1 : 0;
-	flstr = argv[optind++];
-	if (!(flag = get_flag_from_name(flstr)))
-		die("unrecognized flag %s\n", argv[optind -1]);
-	
-	for (; optind < argc; optind++) {
-		fd = open(argv[optind], O_RDONLY);
-		if (fd < 0)
-			die("can't open %s: %s\n", argv[optind], strerror(errno));
-		/* first get the existing flags on the file */
-		error = ioctl(fd, FS_IOC_GETFLAGS, &newflags);
-		if (error)
-			die("can't get flags on %s: %s\n", 
-			    argv[optind], strerror(errno));
-		newflags = set ? newflags | flag : newflags & ~flag;
-		/* new flags */
-		error = ioctl(fd, FS_IOC_SETFLAGS, &newflags);
-		if (error)
-			die("can't set flags on %s: %s\n", 
-			    argv[optind], strerror(errno));
-		close(fd);
-	}
-}
-
-#if GFS2_TOOL_FEATURE_IMPLEMENTED
-/**
- * print_stat - print out the struct gfs2_dinode for a file
- * @argc:
- * @argv:
- *
- */
-
-void
-print_stat(int argc, char **argv)
-{
-	char *gi_argv[] = { "get_file_stat" };
-	struct gfs2_ioctl gi;
-	struct gfs2_dinode di;
-	int error;
-	struct gfs2_sbd sbd;
-
-	if (optind == argc)
-		die("Usage: gfs2_tool stat <filename>\n");
-
-	sbd.device_fd = open(argv[optind], O_RDONLY);
-	if (sbd.device_fd < 0)
-		die("can't open %s: %s\n", argv[optind], strerror(errno));
-
-	sbd.path_name = argv[optind];
-	check_for_gfs2(&sbd);
-
-	gi.gi_argc = 1;
-	gi.gi_argv = gi_argv;
-	gi.gi_data = (char *)&di;
-	gi.gi_size = sizeof(struct gfs2_dinode);
-
-	error = ioctl(sbd.device_fd, GFS2_IOCTL_SUPER, &gi);
-	if (error != gi.gi_size)
-		die("error doing get_file_stat (%d): %s\n",
-		    error, strerror(errno));
-
-	close(sbd.device_fd);
-
-	gfs2_dinode_print(&di);
-	printf("\n");
-	print_flags(&di);
-}
-
-/**
- * print_sb - the superblock
- * @argc:
- * @argv:
- *
- */
-
-void
-print_sb(int argc, char **argv)
-{
-	char *gi_argv[] = { "get_super" };
-	struct gfs2_ioctl gi;
-	struct gfs2_sb sb;
-	int error;
-	struct gfs2_sbd sbd;
-
-	if (optind == argc)
-		die("Usage: gfs2_tool getsb <mountpoint>\n");
-
-	sbd.device_fd = open(argv[optind], O_RDONLY);
-	if (sbd.device_fd < 0)
-		die("can't open %s: %s\n", argv[optind], strerror(errno));
-	
-	sbd.path_name = argv[optind];
-	check_for_gfs2(&sbd);
-
-	gi.gi_argc = 1;
-	gi.gi_argv = gi_argv;
-	gi.gi_data = (char *)&sb;
-	gi.gi_size = sizeof(struct gfs2_sb);
-
-	error = ioctl(sbd.device_fd, GFS2_IOCTL_SUPER, &gi);
-	if (error != gi.gi_size)
-		die("error doing get_super (%d): %s\n",
-		    error, strerror(errno));
-
-	close(sbd.device_fd);
-
-	gfs2_sb_print(&sb);
-}
-#endif /* #if GFS2_TOOL_FEATURE_IMPLEMENTED */
-
-/**
- * print_args -
- * @argc:
- * @argv:
- *
- */
-
-
-void
-print_args(int argc, char **argv)
-{
-	char *fs;
-	DIR *d;
-	struct dirent *de;
-	char path[PATH_MAX];
-	struct gfs2_sbd sbd;
-
-	if (optind == argc)
-		die("Usage: gfs2_tool getargs <mountpoint>\n");
-
-	sbd.path_name = argv[optind];
-	check_for_gfs2(&sbd);
-	fs = mp2fsname(argv[optind]);
-
-	memset(path, 0, PATH_MAX);
-	snprintf(path, PATH_MAX - 1, "%s/%s/args/", SYS_BASE, fs);
-
-	d = opendir(path);
-	if (!d)
-		die("can't open %s: %s\n", path, strerror(errno));
-
-	while((de = readdir(d))) {
-		if (de->d_name[0] == '.')
-			continue;
-
-		snprintf(path, PATH_MAX - 1, "args/%s", de->d_name);
-		printf("%s %s\n", de->d_name, get_sysfs(fs, path));
-	}
-
-	closedir(d);
-	
-}
-
-/**
- * print_journals - print out the file system journal information
- * @argc:
- * @argv:
- *
- */
-
-void
-print_journals(int argc, char **argv)
-{
-	struct gfs2_sbd sbd;
-	DIR *jindex;
-	struct dirent *journal;
-	char jindex_name[PATH_MAX], jname[PATH_MAX];
-	int jcount;
-	struct stat statbuf;
-
-	memset(&sbd, 0, sizeof(struct gfs2_sbd));
-	sbd.bsize = GFS2_DEFAULT_BSIZE;
-	sbd.rgsize = -1;
-	sbd.jsize = GFS2_DEFAULT_JSIZE;
-	sbd.qcsize = GFS2_DEFAULT_QCSIZE;
-	sbd.md.journals = 1;
-
-	sbd.path_name = argv[optind];
-	sbd.path_fd = open(sbd.path_name, O_RDONLY);
-	if (sbd.path_fd < 0)
-		die("can't open root directory %s: %s\n",
-		    sbd.path_name, strerror(errno));
-	check_for_gfs2(&sbd);
-	sbd.device_fd = open(sbd.device_name, O_RDONLY);
-	if (sbd.device_fd < 0)
-		die("can't open device %s: %s\n",
-		    sbd.device_name, strerror(errno));
-	mount_gfs2_meta(&sbd);
-
-	sprintf(jindex_name, "%s/jindex", sbd.metafs_path);
-	jindex = opendir(jindex_name);
-	if (!jindex) {
-		die("Can't open %s\n", jindex_name);
-	} else {
-		jcount = 0;
-		while ((journal = readdir(jindex))) {
-			if (journal->d_name[0] == '.')
-				continue;
-			sprintf(jname, "%s/%s", jindex_name, journal->d_name);
-			if (stat(jname, &statbuf)) {
-				statbuf.st_size = 0;
-				perror(jname);
-			}
-			jcount++;
-			printf("%s - %lluMB\n", journal->d_name,
-			       (unsigned long long)statbuf.st_size / 1048576);
-		}
-
-		printf("%d journal(s) found.\n", jcount);
-		closedir(jindex);
-	}
-	cleanup_metafs(&sbd);
-	close(sbd.device_fd);
-	close(sbd.path_fd);
-}
-
-#if GFS2_TOOL_FEATURE_IMPLEMENTED 
-/**
- * print_jindex - print out the journal index
- * @argc:
- * @argv:
- *
- */
-
-void
-print_jindex(int argc, char **argv)
-{
-	struct gfs2_ioctl gi;
-	int error;
-	struct gfs2_sbd sbd;
-
-	if (optind == argc)
-		die("Usage: gfs2_tool jindex <mountpoint>\n");
-
-	sbd.device_fd = open(argv[optind], O_RDONLY);
-	if (sbd.device_fd < 0)
-		die("can't open %s: %s\n", argv[optind], strerror(errno));
-
-	sbd.path_name = argv[optind];
-	check_for_gfs2(&sdp);
-
-
-	{
-		char *argv[] = { "get_hfile_stat",
-				 "jindex" };
-		struct gfs2_dinode di;
-
-		gi.gi_argc = 2;
-		gi.gi_argv = argv;
-		gi.gi_data = (char *)&di;
-		gi.gi_size = sizeof(struct gfs2_dinode);
-
-		error = ioctl(sbd.device_fd, GFS2_IOCTL_SUPER, &gi);
-		if (error != gi.gi_size)
-			die("error doing get_hfile_stat (%d): %s\n",
-			    error, strerror(errno));
-
-		printf("Jindex\n");
-		gfs2_dinode_print(&di);
-	}
-
-
-	close(sbd.device_fd);
-}
-
-/**
- * print_rindex - print out the journal index
- * @argc:
- * @argv:
- *
- */
-
-void
-print_rindex(int argc, char **argv)
-{
-	struct gfs2_ioctl gi;
-	uint64_t offset;
-	unsigned int x;
-	int error;
-	struct gfs2_sbd sbd;
-
-	if (optind == argc)
-		die("Usage: gfs2_tool rindex <mountpoint>\n");
-
-	sbd.device_fd = open(argv[optind], O_RDONLY);
-	if (sbd.device_fd < 0)
-		die("can't open %s: %s\n", argv[optind], strerror(errno));
-
-	sbd.path_name = argv[optind];
-	check_for_gfs2(&sdp);
-
-
-	{
-		char *argv[] = { "get_hfile_stat",
-				 "rindex" };
-		struct gfs2_dinode di;
-
-		gi.gi_argc = 2;
-		gi.gi_argv = argv;
-		gi.gi_data = (char *)&di;
-		gi.gi_size = sizeof(struct gfs2_dinode);
-
-		error = ioctl(sbd.device_fd, GFS2_IOCTL_SUPER, &gi);
-		if (error != gi.gi_size)
-			die("error doing get_hfile_stat (%d): %s\n",
-			    error, strerror(errno));
-
-		gfs2_dinode_print(&di);
-	}
-
-
-	for (offset = 0, x = 0; ; offset += sizeof(struct gfs2_rindex), x++) {
-		char *argv[] = { "do_hfile_read",
-				 "rindex" };
-		char buf[sizeof(struct gfs2_rindex)];
-		struct gfs2_rindex ri;
-		
-		gi.gi_argc = 2;
-		gi.gi_argv = argv;
-		gi.gi_data = buf;
-		gi.gi_size = sizeof(struct gfs2_rindex);
-		gi.gi_offset = offset;
-
-		error = ioctl(sbd.device_fd, GFS2_IOCTL_SUPER, &gi);
-		if (!error)
-			break;
-		if (error != sizeof(struct gfs2_rindex))
-			die("error doing do_hfile_read (%d): %s\n",
-			    error, strerror(errno));
-
-		gfs2_rindex_in(&ri, buf);
-
-		printf("\nRG %u:\n\n", x);
-		gfs2_rindex_print(&ri);
-	}
-
-
-	close(sbd.device_fd);
-}
-
-/**
- * print_quota - print out the quota file
- * @argc:
- * @argv:
- *
- */
-
-void
-print_quota(int argc, char **argv)
-{
-	struct gfs2_ioctl gi;
-	uint64_t offset;
-	unsigned int x;
-	int error;
-	struct gfs2_sbd sbd;
-
-	if (optind == argc)
-		die("Usage: gfs2_tool quota <mountpoint>\n");
-
-	sbd.device_fd = open(argv[optind], O_RDONLY);
-	if (sbd.device_fd < 0)
-		die("can't open %s: %s\n", argv[optind], strerror(errno));
-
-	sbd.path_name = argv[optind];
-	check_for_gfs2(&sdp);
-
-
-	{
-		char *argv[] = { "get_hfile_stat",
-				 "quota" };
-		struct gfs2_dinode di;
-
-		gi.gi_argc = 2;
-		gi.gi_argv = argv;
-		gi.gi_data = (char *)&di;
-		gi.gi_size = sizeof(struct gfs2_dinode);
-
-		error = ioctl(sbd.device_fd, GFS2_IOCTL_SUPER, &gi);
-		if (error != gi.gi_size)
-			die("error doing get_hfile_stat (%d): %s\n",
-			    error, strerror(errno));
-
-		gfs2_dinode_print(&di);
-	}
-
-
-	for (offset = 0, x = 0; ; offset += sizeof(struct gfs2_quota), x++) {
-		char *argv[] = { "do_hfile_read",
-				 "quota" };
-		char buf[sizeof(struct gfs2_quota)];
-		struct gfs2_quota q;
-		
-		gi.gi_argc = 2;
-		gi.gi_argv = argv;
-		gi.gi_data = buf;
-		gi.gi_size = sizeof(struct gfs2_quota);
-		gi.gi_offset = offset;
-
-		error = ioctl(sbd.device_fd, GFS2_IOCTL_SUPER, &gi);
-		if (!error)
-			break;
-		if (error != sizeof(struct gfs2_quota))
-			die("error doing do_hfile_read (%d): %s\n",
-			    error, strerror(errno));
-
-		gfs2_quota_in(&q, buf);
-
-		if (q.qu_limit || q.qu_warn || q.qu_value) {
-			printf("\nQuota %s %u:\n\n", (x & 1) ? "group" : "user", x >> 1);
-			gfs2_quota_print(&q);
-		}
-	}
-
-
-	close(sbd.device_fd);
-}
-#endif /* #if GFS2_TOOL_FEATURE_IMPLEMENTED */
-
-/**
- * print_list - print the list of mounted filesystems
- *
- */
-
-void
-print_list(void)
-{
-	char *list = get_list();
-	printf("%s", list);
-}
-
-/**
- * do_shrink - shrink the inode cache for a filesystem
- * @argc:
- * @argv:
- *
- */
-
-void
-do_shrink(int argc, char **argv)
-{
-	char *fs;
-	struct gfs2_sbd sbd;
-
-	if (optind == argc)
-		die("Usage: gfs2_tool shrink <mountpoint>\n");
-
-	sbd.path_name = argv[optind];
-	check_for_gfs2(&sbd);
-	fs = mp2fsname(argv[optind]);
-	
-	set_sysfs(fs, "shrink", "1");
-}
-
-/**
- * do_withdraw - withdraw a GFS2 filesystem
- * @argc:
- * @argv:
- *
- */
-
-void
-do_withdraw(int argc, char **argv)
-{
-	char *name;
-	struct gfs2_sbd sbd;
-
-	if (optind == argc)
-		die("Usage: gfs2_tool withdraw <mountpoint>\n");
-
-	sbd.path_name = argv[optind];
-	check_for_gfs2(&sbd);
-	name = mp2fsname(argv[optind]);
-
-	set_sysfs(name, "withdraw", "1");
-}
-
diff --git a/gfs2/tool/ondisk.c b/gfs2/tool/ondisk.c
deleted file mode 100644
index 6a31832..0000000
--- a/gfs2/tool/ondisk.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <linux/types.h>
-
-#include "linux_endian.h"
-
-#define printk printf
-
-#define WANT_GFS2_CONVERSION_FUNCTIONS
-#include <linux/gfs2_ondisk.h>
diff --git a/gfs2/tool/parse_lockdump b/gfs2/tool/parse_lockdump
deleted file mode 100644
index 9e77599..0000000
--- a/gfs2/tool/parse_lockdump
+++ /dev/null
@@ -1,158 +0,0 @@
-#!/usr/bin/perl
-
-&do_input(@ARGV);
-
-print 'Entries:  ', scalar(@gl), "\n";
-print 'Glocks:  ', scalar(keys(%gl)), "\n";
-print 'PIDs:  ', scalar(keys(%pid)), "\n";
-print "\n";
-
-for ($x = 0; $x < @gl; $x++)
-{
-    if (!$done[$x])
-    {
-	@chain = &find_chain($x);
-	$req = 0;
-
-	print scalar(@chain), " chain:\n";
-
-	foreach $y (@chain)
-	{
-	    print $gl[$y];
-	    $req++ if ($gl[$y] =~ /request/i);
-	    $done[$y]++;
-	}
-	
-	print "$req requests\n";
-	print "\n";
-
-	$chains++;
-    }
-}
-
-for ($x = 0; $x < @gl; $x++)
-{
-    die "parse_lockdump: something is hosed\n" unless ($done[$x] == 1);
-}
-
-print "Chains:  $chains\n";
-
-
-
-
-
-sub do_input
-{
-    my(@host) = @_;
-    my($host);
-    local(*FILE);
-    my($line);
-    my($gl);
-
-    foreach $host (@host)
-    {
-	open(FILE, "< $host") || die;
-
-	while ($line = <FILE>)
-	{
-	    if ($line eq "\n")
-	    {
-		&file($host, $gl);
-		$gl = '';
-	    }
-	    else
-	    {
-		$gl .= $line;
-	    }
-	}
-
-	if ($gl ne '')
-	{
-	    &file($host, $gl);
-	    $gl = '';
-	}
-
-	close(FILE);
-    }
-}
-
-
-#  Builds:
-#
-#  @gl:      A list of all the glock sections read in
-#  @name:    Contains the name of the glock of each member of @gl
-#  @pid:     Contains the pids contained in each member of @gl
-#  %gl:      Maps a lockname to the members of @gl that coorespond to that name
-#  %pid:     Maps a pid to the members of @gl that correspond to that pid
-
-sub file
-{
-    my($host, $gl) = @_;
-    my($x);
-    my($name, $pid);
-
-    ($name) = $gl =~ /^Glock (\(.*\))/;
-
-    push(@gl, "$host $gl");
-    $x = @gl - 1;
-    push(@name, $name);
-
-    $gl{$name} .= "$x ";
-
-    foreach (split("\n", $gl))
-    {
-	if (/owner = (\d+)/)
-	{
-	    $pid = "$host:$1";
-
-	    if (!&is_in($pid, split(' ', $pid[$x])))
-	    {
-		$pid[$x] .= "$pid ";
-		$pid{$pid} .= "$x ";
-	    }
-	}
-    }
-}
-
-
-sub find_chain
-{
-    my($x, @chain) = @_;
-    my($y, $z);
-    my($name, $pid);
-
-    $name = $name[$x];
-
-    foreach $y (split(' ', $gl{$name}))
-    {
-	push(@chain, $y);
-    }
-
-    foreach $y (split(' ', $gl{$name}))
-    {
-	foreach $pid (split(' ', $pid[$y]))
-	{
-	    foreach $z (split(' ', $pid{$pid}))
-	    {
-		@chain = &find_chain($z, @chain) unless (&is_in($z, @chain));
-	    }
-	}
-    }
-
-    return @chain;
-}
-
-
-sub is_in
-{
-    my($val, @list) = @_;
-
-    foreach (@list)
-    {
-        return 1 if ($_ eq $val);
-    }
-
-    return 0;
-}
-
-
diff --git a/gfs2/tool/sb.c b/gfs2/tool/sb.c
deleted file mode 100644
index 21bfe2e..0000000
--- a/gfs2/tool/sb.c
+++ /dev/null
@@ -1,147 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <sys/types.h>
-#include <linux/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <limits.h>
-#include <errno.h>
-
-#include <linux/gfs2_ondisk.h>
-
-#include "gfs2_tool.h"
-#include "libgfs2.h"
-
-void print_it(const char *label, const char *fmt, const char *fmt2, ...)
-{
-	va_list args;
-
-	va_start(args, fmt2);
-	printf("%s = ", label);
-	vprintf(fmt, args);
-	printf("\n");
-	va_end(args);
-}
-
-/**
- * do_sb - examine/modify a unmounted FS' superblock
- * @argc:
- * @argv:
- *
- */
-
-void
-do_sb(int argc, char **argv)
-{
-	char *device, *field, *newval = NULL;
-	int fd;
-	unsigned char buf[GFS2_BASIC_BLOCK], input[256];
-	struct gfs2_sb sb;
-
-	if (optind == argc)
-		die("Usage: gfs2_tool sb <device> <field> [newval]\n");
-
-	device = argv[optind++];
-
-	if (optind == argc)
-		die("Usage: gfs2_tool sb <device> <field> [newval]\n");
-
-	field = argv[optind++];
-
-	if (optind < argc) {
-		if (strcmp(field, "all") == 0)
-			die("can't specify new value for \"all\"\n");
-		newval = argv[optind++];
-	}
-
-
-	fd = open(device, (newval) ? O_RDWR : O_RDONLY);
-	if (fd < 0)
-		die("can't open %s: %s\n", device, strerror(errno));
-
-	if (newval && !override) {
-		printf("You shouldn't change any of these values if the filesystem is mounted.\n");
-		printf("\nAre you sure? [y/n] ");
-		if(!fgets((char*)input, 255, stdin))
-			die("unable to read from stdin\n");
-
-		if (input[0] != 'y')
-			die("aborted\n");
-
-		printf("\n");
-	}
-
-	do_lseek(fd, GFS2_SB_ADDR * GFS2_BASIC_BLOCK);
-	do_read(fd, buf, GFS2_BASIC_BLOCK);
-
-	gfs2_sb_in(&sb, (char*) buf);
-
-	if (sb.sb_header.mh_magic != GFS2_MAGIC ||
-	    sb.sb_header.mh_type != GFS2_METATYPE_SB)
-		die("there isn't a GFS2 filesystem on %s\n", device);
-
-	if (strcmp(field, "proto") == 0) {
-		printf("current lock protocol name = \"%s\"\n",
-		       sb.sb_lockproto);
-
-		if (newval) {
-			if (strlen(newval) >= GFS2_LOCKNAME_LEN)
-				die("new lockproto name is too long\n");
-			strcpy(sb.sb_lockproto, newval);
-			printf("new lock protocol name = \"%s\"\n",
-			       sb.sb_lockproto);
-		}
-	} else if (strcmp(field, "table") == 0) {
-		printf("current lock table name = \"%s\"\n",
-		       sb.sb_locktable);
-
-		if (newval) {
-			if (strlen(newval) >= GFS2_LOCKNAME_LEN)
-				die("new locktable name is too long\n");
-			strcpy(sb.sb_locktable, newval);
-			printf("new lock table name = \"%s\"\n",
-			       sb.sb_locktable);
-		}
-	} else if (strcmp(field, "ondisk") == 0) {
-		printf("current ondisk format = %u\n",
-		       sb.sb_fs_format);
-
-		if (newval) {
-			sb.sb_fs_format = atoi(newval);
-			printf("new ondisk format = %u\n",
-			       sb.sb_fs_format);
-		}
-	} else if (strcmp(field, "multihost") == 0) {
-		printf("current multihost format = %u\n",
-		       sb.sb_multihost_format);
-
-		if (newval) {
-			sb.sb_multihost_format = atoi(newval);
-			printf("new multihost format = %u\n",
-			       sb.sb_multihost_format);
-		}
-	} else if (strcmp(field, "all") == 0) {
-		gfs2_sb_print(&sb);
-		newval = FALSE;
-	} else
-		die("unknown field %s\n", field);
-
-	if (newval) {
-		gfs2_sb_out(&sb,(char*) buf);
-
-		do_lseek(fd, GFS2_SB_ADDR * GFS2_BASIC_BLOCK);
-		do_write(fd, buf, GFS2_BASIC_BLOCK);
-
-		fsync(fd);
-
-		printf("Done\n");
-	}
-
-	close(fd);
-}
diff --git a/gfs2/tool/tune.c b/gfs2/tool/tune.c
deleted file mode 100644
index 48b0e33..0000000
--- a/gfs2/tool/tune.c
+++ /dev/null
@@ -1,106 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <sys/types.h>
-#include <linux/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <limits.h>
-#include <errno.h>
-#include <dirent.h>
-
-#define __user
-
-#include "gfs2_tool.h"
-#include "libgfs2.h"
-
-#define SIZE (65536)
-
-/**
- * get_tune - print out the current tuneable parameters for a filesystem
- * @argc:
- * @argv:
- *
- */
-
-void
-get_tune(int argc, char **argv)
-{
-	char path[PATH_MAX];
-	char *fs;
-	DIR *d;
-	struct dirent *de;
-	double ratio;
-	unsigned int num, den;
-	struct gfs2_sbd sbd;
-
-	if (optind == argc)
-		die("Usage: gfs2_tool gettune <mountpoint>\n");
-
-	sbd.path_name = argv[optind];
-	check_for_gfs2(&sbd);
-	fs = mp2fsname(argv[optind]);
-	memset(path, 0, PATH_MAX);
-	snprintf(path, PATH_MAX - 1, "%s/%s/tune", SYS_BASE, fs);
-
-	d = opendir(path);
-	if (!d)
-		die("can't open %s: %s\n", path, strerror(errno));
-
-	while((de = readdir(d))) {
-		if (de->d_name[0] == '.')
-			continue;
-		snprintf(path, PATH_MAX - 1, "tune/%s", de->d_name);
-		if (strcmp(de->d_name, "quota_scale") == 0) {
-			sscanf(get_sysfs(fs, "tune/quota_scale"), "%u %u",
-			       &num, &den);
-			ratio = (double)num / den;
-			printf("quota_scale = %.4f   (%u, %u)\n", ratio, num,
-			       den);
-		} else
-			printf("%s = %s\n", de->d_name, get_sysfs(fs, path));
-	}
-	closedir(d);
-}
-
-/**
- * set_tune - set a tuneable parameter
- * @argc:
- * @argv:
- *
- */
-
-void
-set_tune(int argc, char **argv)
-{
-	char *param, *value;
-	char tune_base[SIZE] = "tune/";
-	char buf[256];
-	char *fs;
-	struct gfs2_sbd sbd;
-
-	if (optind == argc)
-		die("Usage: gfs2_tool settune <mountpoint> <parameter> <value>\n");
-	sbd.path_name = argv[optind++];
-	if (optind == argc)
-		die("Usage: gfs2_tool settune <mountpoint> <parameter> <value>\n");
-	param = argv[optind++];
-	if (optind == argc)
-		die("Usage: gfs2_tool settune <mountpoint> <parameter> <value>\n");
-	value = argv[optind++];
-
-	check_for_gfs2(&sbd);
-	fs = mp2fsname(sbd.path_name);
-
-	if (strcmp(param, "quota_scale") == 0) {
-		float s;
-		sscanf(value, "%f", &s);
-		sprintf(buf, "%u %u", (unsigned int)(s * 10000.0 + 0.5), 10000);
-		value = buf;
-	}
-	set_sysfs(fs, strcat(tune_base, param), value);
-}
diff --git a/group/Makefile b/group/Makefile
deleted file mode 100644
index 2717fb7..0000000
--- a/group/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-include ../make/defines.mk
-include $(OBJDIR)/make/passthrough.mk
-
-SUBDIRS = lib dlm_controld
-
-ifndef enable_pacemaker
-SUBDIRS += libgfscontrol gfs_control gfs_controld tool daemon man
-endif
diff --git a/group/daemon/Makefile b/group/daemon/Makefile
deleted file mode 100644
index 36268db..0000000
--- a/group/daemon/Makefile
+++ /dev/null
@@ -1,35 +0,0 @@
-TARGET= groupd
-
-SBINDIRT=$(TARGET)
-
-all: ${TARGET}
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-OBJS=	app.o \
-	cpg.o \
-	cman.o \
-	joinleave.o \
-	main.o \
-	logging.o
-
-CFLAGS += -I${ccsincdir} -I${cmanincdir} -I${logtincdir} -I${corosyncincdir}
-CFLAGS += -I$(S) -I$(S)/../include/ -I$(S)/../lib/
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${ccslibdir} -lccs 
-LDFLAGS += -L${cmanlibdir} -lcman
-LDFLAGS += -L${logtlibdir} -llogthread
-LDFLAGS += -L${corosynclibdir} -lcpg -lpthread
-LDFLAGS += -L${libdir}
-
-${TARGET}: ${OBJS}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-clean: generalclean
-
--include $(OBJS:.o=.d)
diff --git a/group/daemon/app.c b/group/daemon/app.c
deleted file mode 100644
index 9ca2801..0000000
--- a/group/daemon/app.c
+++ /dev/null
@@ -1,1842 +0,0 @@
-
-/* Apply queued events to apps */
-
-#include "gd_internal.h"
-
-struct list_head recovery_sets;
-
-struct nodeid {
-	struct list_head list;
-	int nodeid;
-};
-
-char *msg_type(int type)
-{
-	switch (type) {
-	case MSG_APP_STOPPED:
-		return "stopped";
-	case MSG_APP_STARTED:
-		return "started";
-	case MSG_APP_RECOVER:
-		return "recover";
-	case MSG_APP_INTERNAL:
-		return "internal";
-	case MSG_GLOBAL_ID:
-		return "global_id";
-	}
-	return "unknown";
-}
-
-void msg_bswap_out(msg_t *msg)
-{
-	msg->ms_version[0]	= cpu_to_le32(MSG_VER_MAJOR);
-	msg->ms_version[1]	= cpu_to_le32(MSG_VER_MINOR);
-	msg->ms_version[2]	= cpu_to_le32(MSG_VER_PATCH);
-	msg->ms_type		= cpu_to_le16(msg->ms_type);
-	msg->ms_level		= cpu_to_le16(msg->ms_level);
-	msg->ms_length		= cpu_to_le32(msg->ms_length);
-	msg->ms_global_id	= cpu_to_le32(msg->ms_global_id);
-	msg->ms_event_id	= cpu_to_le64(msg->ms_event_id);
-}
-
-void msg_bswap_in(msg_t *msg)
-{
-	msg->ms_version[0]	= le32_to_cpu(MSG_VER_MAJOR);
-	msg->ms_version[1]	= le32_to_cpu(MSG_VER_MINOR);
-	msg->ms_version[2]	= le32_to_cpu(MSG_VER_PATCH);
-	msg->ms_type		= le16_to_cpu(msg->ms_type);
-	msg->ms_level		= le16_to_cpu(msg->ms_level);
-	msg->ms_length		= le32_to_cpu(msg->ms_length);
-	msg->ms_global_id	= le32_to_cpu(msg->ms_global_id);
-	msg->ms_event_id	= le64_to_cpu(msg->ms_event_id);
-}
-
-uint64_t make_event_id(group_t *g, int state, int nodeid)
-{
-	uint64_t id;
-	uint32_t n = nodeid;
-	uint32_t memb_count = g->memb_count;
-	uint16_t type = 0;
-
-	if (state == EST_JOIN_BEGIN)
-		type = 1;
-	else if (state == EST_LEAVE_BEGIN)
-		type = 2;
-	else if (state == EST_FAIL_BEGIN)
-		type = 3;
-	else
-		log_error(g, "make_event_id invalid state %d", state);
-
-	id = n;
-	id = id << 32;
-	memb_count = memb_count << 16;
-	id = id | memb_count;
-	id = id | type;
-
-	log_group(g, "make_event_id %llx nodeid %d memb_count %d type %u",
-		  (unsigned long long)id, nodeid, g->memb_count, type);
-
-	return id;
-}
-
-void free_event(event_t *ev)
-{
-	struct nodeid *id, *id_safe;
-
-	list_for_each_entry_safe(id, id_safe, &ev->extended, list) {
-		list_del(&id->list);
-		free(id);
-	}
-	free(ev);
-}
-
-int event_id_to_nodeid(uint64_t id)
-{
-	int nodeid;
-	uint64_t n = id >> 32;
-	nodeid = n & 0xFFFFFFFF;
-	return nodeid;
-}
-
-int event_id_to_type(uint64_t id)
-{
-	uint64_t n;
-	n = id & 0x000000000000FFFF;
-	return ((int) n);
-}
-
-/*
- * Free queued message if:
- * - the id indicates a join for node X and X is a member
- * - the id indicates a leave for node X and X is not a member
- *
- * Note sure if all these cases are relevant, currently we only
- * purge messages after we join.
- */
-
-static void purge_messages(group_t *g)
-{
-	struct save_msg *save, *tmp;
-	node_t *node;
-	int nodeid, type;
-	char *state_str;
-
-	list_for_each_entry_safe(save, tmp, &g->messages, list) {
-		if (save->msg.ms_type == MSG_APP_INTERNAL)
-			continue;
-
-		nodeid = event_id_to_nodeid(save->msg.ms_event_id);
-		type = event_id_to_type(save->msg.ms_event_id);
-		node = find_app_node(g->app, nodeid);
-
-		if ((type == 1 && node) || (type != 1 && !node) ||
-		    (save->msg.ms_type == MSG_APP_RECOVER)) {
-
-			if (save->msg.ms_type == MSG_APP_RECOVER)
-				state_str = "MSG_APP_RECOVER";
-			else if (type == 1)
-				state_str = "EST_JOIN_BEGIN";
-			else if (type == 2)
-				state_str = "EST_LEAVE_BEGIN";
-			else if (type == 3)
-				state_str = "EST_FAIL_BEGIN";
-			else
-				state_str = "error";
-
-			log_group(g, "purge msg %llx from %d %s",
-				  (unsigned long long)save->msg.ms_event_id,
-				  nodeid, state_str);
-
-			list_del(&save->list);
-			if (save->msg_long)
-				free(save->msg_long);
-			free(save);
-		}
-	}
-}
-
-/* For a recovery event where multiple nodes have failed, the event id
-   is based on the lowest nodeid of all the failed nodes.  The event
-   id is also based on the number of remaining group members which
-   changes as failed nodes are added to the recovery event. */
-
-void extend_recover_event(group_t *g, event_t *ev, int nodeid)
-{
-	struct nodeid *id;
-	int new_id_nodeid = nodeid;
-
-	log_group(g, "extend_recover_event for %d with node %d",
-		  ev->nodeid, nodeid);
-
-	/* the lowest nodeid in a recovery event is kept in ev->nodeid,
-	   the other nodeid's are kept in the extended list */
-
-	if (nodeid < ev->nodeid) {
-		new_id_nodeid = ev->nodeid;
-		ev->nodeid = nodeid;
-		ev->id = make_event_id(g, EST_FAIL_BEGIN, nodeid);
-	}
-
-	id = malloc(sizeof(struct nodeid));
-	// FIXME: handle failed malloc
-	id->nodeid = new_id_nodeid;
-	list_add(&id->list, &ev->extended);
-}
-
-struct recovery_set *get_recovery_set(int nodeid)
-{
-	struct recovery_set *rs;
-
-	list_for_each_entry(rs, &recovery_sets, list) {
-		if (rs->nodeid == nodeid)
-			return rs;
-	}
-
-	rs = malloc(sizeof(*rs));
-	ASSERT(rs);
-	memset(rs, 0, sizeof(struct recovery_set));
-	rs->nodeid = nodeid;
-	rs->cman_update = 0;
-	rs->cpg_update = 0;
-	INIT_LIST_HEAD(&rs->entries);
-
-	list_add_tail(&rs->list, &recovery_sets);
-
-	return rs;
-}
-
-/* When a node fails, all the groups that that node was in are tracked by
-   one of these recovery_sets.  These are the groups that will need layered
-   recovery, i.e. all effected groups must be completely stopped (the app
-   stopped on all nodes) before any are restarted.  When restarted, the groups
-   must be restarted in order from lowest level first.  All groups on each
-   level must complete recovery (on all nodes) before recovery can begin for
-   the next level. */
-
-/* FIXME: do we need to worry about the case where we get an
-   add_recovery_set_cman() that finds an old rs, the old rs completes
-   and goes away, and then we get the add_recovery_set_cpg() matching
-   the _cman() variant that we ignored? */
-
-void add_recovery_set_cman(int nodeid)
-{
-	struct recovery_set *rs;
-
-	log_debug("add_recovery_set_cman nodeid %d", nodeid);
-
-	rs = get_recovery_set(nodeid);
-	if (rs->cman_update) {
-		log_debug("old recovery for %d still in progress", nodeid);
-		return;
-	}
-	rs->cman_update = 1;
-
-	if (!rs->cpg_update && !in_groupd_cpg(nodeid)) {
-		log_debug("free recovery set %d not running groupd", nodeid);
-		list_del(&rs->list);
-		free(rs);
-		return;
-	}
-
-	if (list_empty(&rs->entries) && rs->cpg_update) {
-		log_debug("free unused recovery set %d cman", nodeid);
-		list_del(&rs->list);
-		free(rs);
-	}
-}
-
-/* procdown of 1 means the groupd daemon process exited, but the node didn't
-   fail.  when only the process fails, we won't get a cman callback which is
-   only for nodedown.  if the node wasn't in any groups we don't add a recovery
-   set and don't care about the exited groupd; if the node with the failed
-   groupd _was_ in any groups, we add a rs and process_groupd_confchg() will do
-   cman_kill_node() to make the node really fail (and we'll get an
-   add_recovery_set_cman()). */
-
-struct recovery_set *add_recovery_set_cpg(int nodeid, int procdown)
-{
-	struct recovery_set *rs;
-	struct recovery_entry *re;
-	group_t *g;
-	node_t *node;
-
-	log_debug("add_recovery_set_cpg nodeid %d procdown %d",
-		  nodeid, procdown);
-
-	rs = get_recovery_set(nodeid);
-	if (rs->cpg_update) {
-		log_debug("old recovery for %d still in progress", nodeid);
-		return rs;
-	}
-	rs->cpg_update = 1;
-
-	list_for_each_entry(g, &gd_groups, list) {
-		list_for_each_entry(node, &g->app->nodes, list) {
-			if (node->nodeid == nodeid) {
-				log_group(g, "add to recovery set %d", nodeid);
-				re = malloc(sizeof(*re));
-				// FIXME: handle failed malloc
-				memset(re, 0, sizeof(struct recovery_entry));
-				re->group = g;
-				list_add_tail(&re->list, &rs->entries);
-				break;
-			}
-		}
-	}
-
-	if (list_empty(&rs->entries)) {
-		if (rs->cman_update || procdown) {
-			log_debug("free unused recovery set %d cpg", nodeid);
-			list_del(&rs->list);
-			free(rs);
-			return NULL;
-		}
-	}
-
-	return rs;
-}
-
-void _del_recovery_set(group_t *g, int nodeid, int purge)
-{
-	struct recovery_set *rs, *rs2;
-	struct recovery_entry *re, *re2;
-	int found = 0, entries_not_recovered;
-
-	list_for_each_entry_safe(rs, rs2, &recovery_sets, list) {
-		if (rs->nodeid != nodeid)
-			continue;
-
-		entries_not_recovered = 0;
-
-		list_for_each_entry_safe(re, re2, &rs->entries, list) {
-			if (re->group == g) {
-				if (purge) {
-					list_del(&re->list);
-					free(re);
-					log_group(g, "purged from rs %d",
-						  rs->nodeid);
-				} else {
-					re->recovered = 1;
-					log_group(g, "done in recovery set %d",
-					  	  rs->nodeid);
-					found++;
-				}
-			} else {
-				if (re->recovered == 0)
-					entries_not_recovered++;
-			}
-		}
-
-		if (entries_not_recovered) {
-			log_debug("recovery set %d has %d entries not done",
-				  rs->nodeid, entries_not_recovered);
-			continue;
-		}
-
-		/* all entries in this rs are recovered, free it */
-		log_debug("recovery set %d is all done", rs->nodeid);
-
-		list_for_each_entry_safe(re, re2, &rs->entries, list) {
-			list_del(&re->list);
-			free(re);
-		}
-		list_del(&rs->list);
-		free(rs);
-	}
-
-	if (!found)
-		log_group(g, "not found in any recovery sets for %d", nodeid);
-}
-
-/* A group has finished recovery for given event (which can encompass more than
-   one failed nodeid).  Remove this group from recovery sets for those nodeids
-   and free any recovery sets that are now completed. */
-
-void del_recovery_set(group_t *g, event_t *ev, int purge)
-{
-	struct nodeid *id;
-
-	log_group(g, "rev %llx done, remove group from rs %d",
-		  (unsigned long long)ev->id, ev->nodeid);
-	_del_recovery_set(g, ev->nodeid, purge);
-
-	list_for_each_entry(id, &ev->extended, list) {
-		log_group(g, "rev %llx done, remove group from rs %d",
-			  (unsigned long long)ev->id, id->nodeid);
-		_del_recovery_set(g, id->nodeid, purge);
-	}
-}
-
-/* go through all recovery sets and check that all failed nodes have
-   been removed by cman callbacks; if they haven't then cman may be
-   inquorate and we just haven't gotten the cman callback yet that
-   will set cman_quorate = 0  [group recoveries are driven by cpg
-   callbacks, not cman callbacks, so that's why we might be trying
-   to do recovery without having heard from cman yet.] */
-
-int cman_quorum_updated(void)
-{
-	struct recovery_set *rs;
-
-	list_for_each_entry(rs, &recovery_sets, list) {
-		if (rs->cman_update)
-			continue;
-		log_debug("no cman update for recovery_set %d quorate %d",
-			  rs->nodeid, cman_quorate);
-		return 0;
-	}
-	return 1;
-}
-
-int is_recovery_event(event_t *ev)
-{
-	if (event_id_to_type(ev->id) == 3)
-		return 1;
-	return 0;
-}
-
-/* all groups referenced by a recovery set are stopped on all nodes,
-   and stopped for recovery */
-
-static int set_is_all_stopped(struct recovery_set *rs, event_t *rev)
-{
-	struct recovery_entry *re;
-	event_t *ev;
-
-	list_for_each_entry(re, &rs->entries, list) {
-		ev = re->group->app->current_event;
-
-		/* we need to use ev->fail_all_stopped instead of checking
-		   ev->state == FAIL_ALL_STOPPED because if two groups are at
-		   the low level, one will detect all_levels_all_stopped first
-		   and then immediately move on to starting before the other,
-		   also checking all_levels_all_stopped, can see it's in
-		   FAIL_ALL_STOPPED */
-
-		if (ev && is_recovery_event(ev) && ev->fail_all_stopped)
-			continue;
-		else
-			return 0;
-	}
-	return 1;
-}
-
-/* for every recovery set that this group is in, are all other groups in
-   each of those sets in the "all stopped" state for recovery? */
-
-static int all_levels_all_stopped(group_t *g, event_t *rev)
-{
-	struct recovery_set *rs;
-	struct recovery_entry *re;
-	int found = 0;
-
-	list_for_each_entry(rs, &recovery_sets, list) {
-		list_for_each_entry(re, &rs->entries, list) {
-			if (re->group == g) {
-				found = 1;
-				if (set_is_all_stopped(rs, rev))
-					break;
-				else
-					return 0;
-			}
-		}
-	}
-
-	if (!found)
-		return 0;
-	return 1;
-}
-
-void dump_recovery_sets(void)
-{
-	struct recovery_set *rs;
-	struct recovery_entry *re;
-
-	list_for_each_entry(rs, &recovery_sets, list) {
-		log_debug("recovery_set %d", rs->nodeid);
-		list_for_each_entry(re, &rs->entries, list) {
-			log_debug("  recovery_entry %d:%s recovered %d",
-				  re->group->level, re->group->name,
-				  re->recovered);
-		}
-	}
-}
-
-static int group_in_recovery_set(struct recovery_set *rs, group_t *g)
-{
-	struct recovery_entry *re;
-
-	list_for_each_entry(rs, &recovery_sets, list) {
-		list_for_each_entry(re, &rs->entries, list) {
-			if (re->group == g)
-				return 1;
-		}
-	}
-	return 0;
-}
-
-static int rs_lower_levels_recovered(struct recovery_set *rs, int level)
-{
-	struct recovery_entry *re;
-
-	list_for_each_entry(re, &rs->entries, list) {
-		if (re->group->level < level && !re->recovered)
-			return 0;
-	}
-	return 1;
-}
-
-/* lower level groups should be recovered in each rs this group is in */
-
-static int lower_levels_recovered(group_t *g)
-{
-	struct recovery_set *rs;
-
-	list_for_each_entry(rs, &recovery_sets, list) {
-		if (!group_in_recovery_set(rs, g))
-			continue;
-
-		if (rs_lower_levels_recovered(rs, g->level))
-			continue;
-
-		log_group(g, "lower levels not recovered in rs %d", rs->nodeid);
-		return 0;
-	}
-	return 1;
-}
-
-/* We're interested in any unrecovered group at a lower level than g, not
-   just lower groups in the same recovery set. */
-
-static int lower_groups_need_recovery(group_t *g)
-{
-	struct recovery_set *rs;
-
-	list_for_each_entry(rs, &recovery_sets, list) {
-		if (rs_lower_levels_recovered(rs, g->level))
-			continue;
-		log_group(g, "lower group not recovered in rs %d", rs->nodeid);
-		return 1;
-	}
-	return 0;
-}
-
-static int level_is_lowest(struct recovery_set *rs, int level)
-{
-	struct recovery_entry *re;
-
-	list_for_each_entry(re, &rs->entries, list) {
-		if (re->group->level < level)
-			return 0;
-	}
-	return 1;
-}
-
-/* this group is at the lowest level in any recovery sets it's in */
-
-static int lowest_level(group_t *g)
-{
-	struct recovery_set *rs;
-
-	list_for_each_entry(rs, &recovery_sets, list) {
-		if (!group_in_recovery_set(rs, g))
-			continue;
-		if (level_is_lowest(rs, g->level))
-			continue;
-		return 0;
-	}
-	return 1;
-}
-
-static event_t *create_event(group_t *g)
-{
-	event_t *ev;
-
-	ev = malloc(sizeof(event_t));
-	ASSERT(ev);
-
-	memset(ev, 0, sizeof(event_t));
-
-	INIT_LIST_HEAD(&ev->memb);
-	INIT_LIST_HEAD(&ev->extended);
-	ev->event_nr = ++gd_event_nr;
-
-	return ev;
-}
-
-int queue_app_recover(group_t *g, int nodeid)
-{
-	event_t *ev;
-
-	ev = create_event(g);
-	ev->nodeid = nodeid;
-	ev->state = EST_FAIL_BEGIN;
-	ev->fail_all_stopped = 0;
-	ev->id = make_event_id(g, EST_FAIL_BEGIN, nodeid);
-
-	log_group(g, "queue recover event for nodeid %d", nodeid);
-
-	list_add_tail(&ev->list, &g->app->events);
-	return 0;
-}
-
-void del_event_nodes(event_t *ev)
-{
-	node_t *node, *n;
-
-	list_for_each_entry_safe(node, n, &ev->memb, list) {
-		list_del(&node->list);
-		free(node);
-	}
-}
-
-static void add_event_nodes(group_t *g, event_t *ev)
-{
-	node_t *node, *n;
-
-	list_for_each_entry(node, &g->memb, list) {
-		n = new_node(node->nodeid);
-		list_add(&n->list, &ev->memb);
-	}
-}
-
-event_t *search_event(group_t *g, int nodeid)
-{
-	event_t *ev;
-
-	list_for_each_entry(ev, &g->app->events, list) {
-		if (ev->nodeid == nodeid)
-			return ev;
-	}
-	return NULL;
-}
-
-void dump_queued_events(group_t *g)
-{
-	event_t *ev;
-
-	list_for_each_entry(ev, &g->app->events, list) {
-		log_group(g, "    queued ev %d %llx %s",
-			  ev->nodeid, (unsigned long long)ev->id,
-			  ev_state_str(ev));
-	}
-}
-
-int queue_app_join(group_t *g, int nodeid)
-{
-	event_t *ev;
-
-	/* sanity check */
-	ev = g->app->current_event;
-	if (ev && ev->nodeid == nodeid) {
-		log_group(g, "queue_app_join: current event %d %llx %s",
-			  nodeid, (unsigned long long)ev->id, ev_state_str(ev));
-	}
-
-	/* sanity check */
-	ev = search_event(g, nodeid);
-	if (ev) {
-		log_group(g, "queue_app_join: queued event %d %llx %s",
-			  nodeid, (unsigned long long)ev->id, ev_state_str(ev));
-	}
-
-	ev = create_event(g);
-	ev->nodeid = nodeid;
-	ev->state = EST_JOIN_BEGIN;
-	ev->id = make_event_id(g, EST_JOIN_BEGIN, nodeid);
-
-	log_group(g, "queue join event for nodeid %d", nodeid);
-	dump_queued_events(g);
-
-	if (nodeid == our_nodeid)
-		add_event_nodes(g, ev);
-
-	list_add_tail(&ev->list, &g->app->events);
-	return 0;
-}
-
-int queue_app_leave(group_t *g, int nodeid)
-{
-	event_t *ev;
-
-	/* sanity check */
-	ev = g->app->current_event;
-	if (ev && ev->nodeid == nodeid) {
-		log_group(g, "queue_app_leave: current event %d %llx %s",
-			  nodeid, (unsigned long long)ev->id, ev_state_str(ev));
-	}
-
-	/* sanity check */
-	ev = search_event(g, nodeid);
-	if (ev) {
-		log_group(g, "queue_app_leave: queued event %d %llx %s",
-			  nodeid, (unsigned long long)ev->id, ev_state_str(ev));
-	}
-
-	ev = create_event(g);
-	ev->nodeid = nodeid;
-	ev->state = EST_LEAVE_BEGIN;
-	ev->id = make_event_id(g, EST_LEAVE_BEGIN, nodeid);
-
-	log_group(g, "queue leave event for nodeid %d", nodeid);
-	dump_queued_events(g);
-
-	list_add_tail(&ev->list, &g->app->events);
-	return 0;
-}
-
-int queue_app_message(group_t *g, struct save_msg *save)
-{
-	/* log_group(g, "queue message %s from %d",
-	             msg_type(save->msg.ms_type), save->nodeid); */
-	list_add_tail(&save->list, &g->messages);
-	return 0;
-}
-
-/* This is called when we get the nodedown for the per-group cpg; we know
-   that after the cpg nodedown we won't get any further messages. bz 436984
-   It's conceivable but unlikely that the nodedown processing (initiated by
-   the groupd cpg nodedown) could begin before the per-group cpg nodedown
-   is received where this purging occurs.  If it does, then we may need to
-   add code to wait for the nodedown to happen in both the groupd cpg and the
-   per-group cpg before processing the nodedown. */
-
-void purge_node_messages(group_t *g, int nodeid)
-{
-	struct save_msg *save, *tmp;
-
-	list_for_each_entry_safe(save, tmp, &g->messages, list) {
-		if (save->nodeid != nodeid)
-			continue;
-
-		log_group(g, "purge msg from dead node %d", nodeid);
-
-		list_del(&save->list);
-		if (save->msg_long)
-			free(save->msg_long);
-		free(save);
-	}
-}
-
-static void del_app_nodes(app_t *a)
-{
-	node_t *node, *tmp;
-
-	list_for_each_entry_safe(node, tmp, &a->nodes, list) {
-		list_del(&node->list);
-		free(node);
-	}
-}
-
-node_t *find_app_node(app_t *a, int nodeid)
-{
-	node_t *node;
-
-	list_for_each_entry(node, &a->nodes, list) {
-		if (node->nodeid == nodeid)
-			return node;
-	}
-	return NULL;
-}
-
-int is_our_join(event_t *ev)
-{
-	return (ev->nodeid == our_nodeid);
-}
-
-static int is_our_leave(event_t *ev)
-{
-	return (ev->nodeid == our_nodeid);
-}
-
-/* Called after all nodes have acked that they're stopped for our
-   leave.  We get their stopped messages even though we've left the
-   cpg because the messages are sent through the groupd cpg.
-   groupd_down() will fill in stops for us for nodes that fail before
-   sending stopped for our leave. */
-
-void finalize_our_leave(group_t *g)
-{
-	struct recovery_set *rs;
-	struct recovery_entry *re, *re2;
-	app_t *a = g->app;
-
-	log_group(g, "finalize_our_leave");
-
-	app_terminate(a);
-	cpg_finalize(g->cpg_handle);
-	client_dead(g->cpg_client);
-	g->app = NULL;
-	del_app_nodes(a);
-	free(a);
-
-	/* this group shouldn't be in any recovery sets... sanity check
-	   and avoid future segfault by removing re's referencing this g */
-
-	list_for_each_entry(rs, &recovery_sets, list) {
-		list_for_each_entry_safe(re, re2, &rs->entries, list) {
-			if (re->group == g) {
-				log_error(g, "finalize: still in recovery "
-					  "set %d", rs->nodeid);
-				list_del(&re->list);
-				free(re);
-			}
-		}
-	}
-
-	remove_group(g);
-}
-
-static int send_stopped(group_t *g)
-{
-	msg_t msg;
-	event_t *ev = g->app->current_event;
-
-	memset(&msg, 0, sizeof(msg));
-	msg.ms_type = MSG_APP_STOPPED;
-	msg.ms_global_id = g->global_id;
-	msg.ms_event_id = ev->id;
-	msg.ms_level = g->level;
-	memcpy(&msg.ms_name, &g->name, MAX_NAMELEN);
-
-	msg_bswap_out(&msg);
-
-	log_group(g, "send stopped");
-	return send_message_groupd(g, &msg, sizeof(msg), MSG_APP_STOPPED);
-}
-
-static int send_started(group_t *g)
-{
-	msg_t msg;
-	event_t *ev = g->app->current_event;
-
-	memset(&msg, 0, sizeof(msg));
-	msg.ms_type = MSG_APP_STARTED;
-	msg.ms_global_id = g->global_id;
-	msg.ms_event_id = ev->id;
-	msg.ms_level = g->level;
-	memcpy(&msg.ms_name, &g->name, MAX_NAMELEN);
-
-	msg_bswap_out(&msg);
-
-	log_group(g, "send started");
-	return send_message_groupd(g, &msg, sizeof(msg), MSG_APP_STARTED);
-}
-
-static int send_recover(group_t *g, event_t *rev)
-{
-	msg_t msg;
-
-	memset(&msg, 0, sizeof(msg));
-	msg.ms_type = MSG_APP_RECOVER;
-	msg.ms_global_id = g->global_id;
-	msg.ms_event_id = rev->id;
-	msg.ms_level = g->level;
-	memcpy(&msg.ms_name, &g->name, MAX_NAMELEN);
-
-	msg_bswap_out(&msg);
-
-	log_group(g, "send recover");
-	return send_message_groupd(g, &msg, sizeof(msg), MSG_APP_RECOVER);
-}
-
-int do_stopdone(char *name, int level)
-{
-	group_t *g;
-	g = find_group_level(name, level);
-	return send_stopped(g);
-}
-
-int do_startdone(char *name, int level, int event_nr)
-{
-	group_t *g;
-	event_t *ev;
-	char *state;
-
-	g = find_group_level(name, level);
-	if (!g) {
-		log_print("do_startdone: no group level %d name %s",
-			  level, name);
-		return -1;
-	}
-
-	ev = g->app->current_event;
-
-	state = ev ? ev_state_str(ev) : "no-event";
-
-	if (!ev || ev->event_nr != event_nr) {
-		log_group(g, "ignore startdone %d state %s", event_nr, state);
-		return 0;
-	}
-
-	if (!event_state_starting(g->app)) {
-		log_error(g, "IGNORE startdone %d state %s", event_nr, state);
-		return 0;
-	}
-
-	return send_started(g);
-}
-
-char *ev_state_str(event_t *ev)
-{
-	switch (ev->state) {
-	case EST_JOIN_BEGIN:
-		return "JOIN_BEGIN";
-	case EST_JOIN_STOP_WAIT:
-		return "JOIN_STOP_WAIT";
-	case EST_JOIN_ALL_STOPPED:
-		return "JOIN_ALL_STOPPED";
-	case EST_JOIN_START_WAIT:
-		return "JOIN_START_WAIT";
-	case EST_JOIN_ALL_STARTED:
-		return "JOIN_ALL_STARTED";
-	case EST_LEAVE_BEGIN:
-		return "LEAVE_BEGIN";
-	case EST_LEAVE_STOP_WAIT:
-		return "LEAVE_STOP_WAIT";
-	case EST_LEAVE_ALL_STOPPED:
-		return "LEAVE_ALL_STOPPED";
-	case EST_LEAVE_START_WAIT:
-		return "LEAVE_START_WAIT";
-	case EST_LEAVE_ALL_STARTED:
-		return "LEAVE_ALL_STARTED";
-	case EST_FAIL_BEGIN:
-		return "FAIL_BEGIN";
-	case EST_FAIL_STOP_WAIT:
-		return "FAIL_STOP_WAIT";
-	case EST_FAIL_ALL_STOPPED:
-		return "FAIL_ALL_STOPPED";
-	case EST_FAIL_START_WAIT:
-		return "FAIL_START_WAIT";
-	case EST_FAIL_ALL_STARTED:
-		return "FAIL_ALL_STARTED";
-	default:
-		return "unknown";
-	}
-}
-
-static int count_nodes_not_stopped(app_t *a)
-{
-	node_t *node;
-	int i = 0;
-
-	list_for_each_entry(node, &a->nodes, list) {
-		if (!node->stopped)
-			i++;
-	}
-	return i;
-}
-
-int event_state_begin(app_t *a)
-{
-	if (a->current_event->state == EST_JOIN_BEGIN ||
-	    a->current_event->state == EST_LEAVE_BEGIN ||
-	    a->current_event->state == EST_FAIL_BEGIN)
-		return TRUE;
-	return FALSE;
-}
-
-int event_state_stopping(app_t *a)
-{
-	if (a->current_event->state == EST_JOIN_STOP_WAIT ||
-	    a->current_event->state == EST_LEAVE_STOP_WAIT ||
-	    a->current_event->state == EST_FAIL_STOP_WAIT)
-		return TRUE;
-	return FALSE;
-}
-
-int event_state_starting(app_t *a)
-{
-	if (a->current_event->state == EST_JOIN_START_WAIT ||
-	    a->current_event->state == EST_LEAVE_START_WAIT ||
-	    a->current_event->state == EST_FAIL_START_WAIT)
-		return TRUE;
-	return FALSE;
-}
-
-int event_state_all_stopped(app_t *a)
-{
-	if (a->current_event->state == EST_JOIN_ALL_STOPPED ||
-	    a->current_event->state == EST_LEAVE_ALL_STOPPED ||
-	    a->current_event->state == EST_FAIL_ALL_STOPPED)
-		return TRUE;
-	return FALSE;
-}
-
-int event_state_all_started(app_t *a)
-{
-	if (a->current_event->state == EST_JOIN_ALL_STARTED ||
-	    a->current_event->state == EST_LEAVE_ALL_STARTED ||
-	    a->current_event->state == EST_FAIL_ALL_STARTED)
-		return TRUE;
-	return FALSE;
-}
-
-static int process_current_event(group_t *g)
-{
-	app_t *a = g->app;
-	event_t *ev = a->current_event;
-	node_t *node, *n;
-	struct nodeid *id;
-	int rv = 0, do_start = 0, count;
-
-	if (!(event_state_stopping(a) || event_state_starting(a)))
-		log_group(g, "process_current_event %llx %d %s",
-			  (unsigned long long)ev->id, ev->nodeid,
-			  ev_state_str(ev));
-
-	switch (ev->state) {
-
-	case EST_JOIN_BEGIN:
-		ev->state = EST_JOIN_STOP_WAIT;
-
-		if (is_our_join(ev)) {
-			/* the initial set of members that we've joined,
-			   includes us */
-
-			list_for_each_entry_safe(node, n, &ev->memb, list) {
-				list_move(&node->list, &a->nodes);
-				a->node_count++;
-				log_group(g, "app node init: add %d total %d",
-					  node->nodeid, a->node_count);
-			}
-
-			/* we could have the joining node send out a stopped
-			   message here for all to receive and count but
-			   that's unnecessary, we just have everyone
-			   set the joining node as stopped initially */
-
-			node = find_app_node(a, our_nodeid);
-			ASSERT(node);
-			node->stopped = 1;
-
-			/* if we're the first node to be joining, move
-			   ahead to the JOIN_ALL_STOPPED state */
-
-			if (a->node_count == 1)
-				ev->state++;
-
-			rv = 1;
-		} else {
-			app_stop(a);
-
-			node = new_node(ev->nodeid);
-			list_add(&node->list, &a->nodes);
-			a->node_count++;
-			log_group(g, "app node join: add %d total %d",
-				  node->nodeid, a->node_count);
-			node->stopped = 1;
-		}
-		break;
-
-	case EST_JOIN_STOP_WAIT:
-		count = count_nodes_not_stopped(a);
-		log_group(g, "waiting for %d more stopped messages "
-			  "before JOIN_ALL_STOPPED %d", count, ev->nodeid);
-		break;
-
-	case EST_JOIN_ALL_STOPPED:
-		if (!cman_quorate) {
-			log_group(g, "wait for quorum before starting app");
-			break;
-		}
-
-		/* We want to move ahead to start here if this ev is to be
-		   started before a pending rev that will abort it.  Once
-		   started, the rev becomes current and stops the app
-		   immediately. */
-
-		if (lower_groups_need_recovery(g) &&
-		    !ev->start_app_before_pending_rev) {
-			log_group(g, "wait for lower_groups_need_recovery "
-				  "before starting app");
-			break;
-		}
-		ev->start_app_before_pending_rev = 0;
-
-		ev->state = EST_JOIN_START_WAIT;
-
-		if (!g->have_set_id) {
-			g->have_set_id = 1;
-			app_setid(a);
-		}
-
-		app_start(a);
-		break;
-
-	case EST_JOIN_ALL_STARTED:
-		app_finish(a);
-
-		if (is_our_join(ev)) {
-			purge_messages(g);
-			g->joining = 0;
-		}
-		free_event(ev);
-		a->current_event = NULL;
-		rv = 1;
-		break;
-
-	case EST_LEAVE_BEGIN:
-		ev->state = EST_LEAVE_STOP_WAIT;
-		app_stop(a);
-		break;
-
-	case EST_LEAVE_STOP_WAIT:
-		count = count_nodes_not_stopped(a);
-		log_group(g, "waiting for %d more stopped messages "
-			  "before LEAVE_ALL_STOPPED %d", count, ev->nodeid);
-		break;
-
-	case EST_LEAVE_ALL_STOPPED:
-		if (is_our_leave(ev)) {
-			/* frees group structure */
-			finalize_our_leave(g);
-			rv = -1;
-			break;
-		}
-		ev->state = EST_LEAVE_START_WAIT;
-
-		node = find_app_node(a, ev->nodeid);
-		list_del(&node->list);
-		a->node_count--;
-		log_group(g, "app node leave: del %d total %d",
-			  node->nodeid, a->node_count);
-		free(node);
-		app_start(a);
-		break;
-
-	case EST_LEAVE_ALL_STARTED:
-		app_finish(a);
-		free_event(ev);
-		a->current_event = NULL;
-		rv = 1;
-		break;
-
-	case EST_FAIL_BEGIN:
-		ev->state = EST_FAIL_STOP_WAIT;
-		app_stop(a);
-
-		/* set the failed nodes as stopped since we won't
-		   be getting a "stopped" message from them.  the node
-		   may already have been removed in the case where one
-		   rev interrupts another */
-
-		node = find_app_node(a, ev->nodeid);
-		if (node)
-			node->stopped = 1;
-
-		/* multiple nodes failed together making an extended event */
-		list_for_each_entry(id, &ev->extended, list) {
-			node = find_app_node(a, id->nodeid);
-			if (node)
-				node->stopped = 1;
-		}
-
-		break;
-
-	case EST_FAIL_STOP_WAIT:
-		count = count_nodes_not_stopped(a);
-		log_group(g, "waiting for %d more stopped messages "
-			  "before FAIL_ALL_STOPPED %d", count, ev->nodeid);
-		break;
-
-	case EST_FAIL_ALL_STOPPED:
-		ev->fail_all_stopped = 1;
-
-		/* when recovering for failed nodes, we immediately stop all
-		   apps the node was involved with but wait for quorum before
-		   starting them again  */
-
-		/* we make sure that cman has updated our quorum status since
-		   the last node failure */
-
-		if (!cman_quorum_updated())
-			break;
-
-		if (!cman_quorate)
-			break;
-
-		if (lowest_level(g)) {
-			if (all_levels_all_stopped(g, ev)) {
-				ev->state = EST_FAIL_START_WAIT;
-				do_start = 1;
-			} else
-				log_group(g, "wait for all_levels_all_stopped");
-		} else {
-			if (lower_levels_recovered(g)) {
-				ev->state = EST_FAIL_START_WAIT;
-				do_start = 1;
-			} else
-				log_group(g, "wait for lower_levels_recovered");
-		}
-
-		if (!do_start)
-			break;
-
-		node = find_app_node(a, ev->nodeid);
-		if (node) {
-			a->node_count--;
-			log_group(g, "app node fail: del node %d total %d",
-			  	  node->nodeid, a->node_count);
-			list_del(&node->list);
-			free(node);
-		} else
-			log_group(g, "app node fail: %d prev removed",
-				  ev->nodeid);
-
-		list_for_each_entry(id, &ev->extended, list) {
-			node = find_app_node(a, id->nodeid);
-			if (node) {
-				a->node_count--;
-				log_group(g, "app node fail: del node %d "
-					  "total %d, ext", node->nodeid,
-					  a->node_count);
-				list_del(&node->list);
-				free(node);
-			} else
-				log_group(g, "app node fail: %d prev removed",
-					  id->nodeid);
-		}
-
-		app_start(a);
-		break;
-
-	case EST_FAIL_ALL_STARTED:
-		app_finish(a);
-		del_recovery_set(g, ev, 0);
-		free_event(ev);
-		a->current_event = NULL;
-		rv = 1;
-		break;
-
-	default:
-		/*
-		log_group(g, "nothing to do: %llx %d %s",
-			  (unsigned long long)ev->id, ev->nodeid,
-			  ev_state_str(ev));
-		*/
-		break;
-	}
-
-	return rv;
-}
-
-static void clear_all_nodes_stopped(app_t *a)
-{
-	node_t *node;
-	log_group(a->g, "clear_all_nodes_stopped");
-	list_for_each_entry(node, &a->nodes, list)
-		node->stopped = 0;
-}
-
-static int mark_node_stopped(app_t *a, int nodeid)
-{
-	node_t *node;
-
-	/* we might get a stopped message from another node who's going
-	   through X_BEGIN before we get to X_BEGIN ourselves, so we need
-	   to accept their message if we're in X_BEGIN, too */
-
-	if (!event_state_stopping(a) && !event_state_begin(a)) {
-		log_error(a->g, "mark_node_stopped: event not stopping/begin: "
-			  "state %s from %d",
-			  ev_state_str(a->current_event), nodeid);
-		return -1;
-	}
-
-	node = find_app_node(a, nodeid);
-	if (!node) {
-		log_error(a->g, "mark_node_stopped: no nodeid %d", nodeid);
-		return -1;
-	}
-
-	log_group(a->g, "mark node %d stopped", nodeid);
-
-	node->stopped = 1;
-	node->started = 0;
-
-	return 0;
-}
-
-static int mark_node_started(app_t *a, int nodeid)
-{
-	node_t *node;
-
-	if (!event_state_starting(a))
-		log_group(a->g, "mark_node_started: event not starting %d "
-			  "from %d", a->current_event->state, nodeid);
-
-	node = find_app_node(a, nodeid);
-	if (!node) {
-		log_error(a->g, "mark_node_started: no nodeid %d", nodeid);
-		return -1;
-	}
-
-	log_group(a->g, "mark node %d started", nodeid);
-
-	node->stopped = 0;
-	node->started = 1;
-
-	return 0;
-}
-
-static int all_nodes_stopped(app_t *a)
-{
-	node_t *node;
-
-	list_for_each_entry(node, &a->nodes, list) {
-		if (!node->stopped) {
-			/* ASSERT(node->started); */
-			return FALSE;
-		}
-	}
-	return TRUE;
-}
-
-static int all_nodes_started(app_t *a)
-{
-	node_t *node;
-
-	list_for_each_entry(node, &a->nodes, list) {
-		if (!node->started) {
-			/* ASSERT(node->stopped); */
-			return FALSE;
-		}
-	}
-	return TRUE;
-}
-
-static int process_app_messages(group_t *g)
-{
-	app_t *a = g->app;
-	struct save_msg *save, *tmp;
-	event_t *ev;
-	int rv = 0;
-
-	list_for_each_entry_safe(save, tmp, &g->messages, list) {
-
-		/* internal messages, sent not by groupd but by apps
-		   to each other, are delivered to the apps in
-		   deliver_app_messages() */
-
-		if (save->msg.ms_type == MSG_APP_INTERNAL)
-			continue;
-
-		ev = a->current_event;
-
-		if (save->msg.ms_type == MSG_APP_RECOVER) {
-			if (ev && ev->state == EST_JOIN_STOP_WAIT &&
-			    is_our_join(ev)) {
-				/* keep this msg around for
-				   recover_current_event() to see, it will
-				   be purged later */
-				if (!save->print_ignore) {
-					log_group(g, "rev %llx taken on node %d",
-						   (unsigned long long)save->msg.ms_event_id,
-						   save->nodeid);
-					save->print_ignore = 1;
-				}
-				continue;
-			} else {
-				goto free_save;
-			}
-		}
-
-
-		if (!ev || ev->id != save->msg.ms_event_id) {
-			if (!save->print_ignore) {
-				log_group(g, "ignore msg from %d id %llx %s",
-				  	  save->nodeid,
-					  (unsigned long long)save->msg.ms_event_id,
-				  	  msg_type(save->msg.ms_type));
-				save->print_ignore = 1;
-			}
-			continue;
-		}
-
-		switch (save->msg.ms_type) {
-
-		case MSG_APP_STOPPED:
-			mark_node_stopped(a, save->nodeid);
-			break;
-
-		case MSG_APP_STARTED:
-			mark_node_started(a, save->nodeid);
-			break;
-
-		default:
-			log_error(g, "process_app_messages: invalid type %d "
-				  "from %d", save->msg.ms_type, save->nodeid);
-		}
-
-		if (g->global_id == 0 && save->msg.ms_global_id != 0) {
-			g->global_id = save->msg.ms_global_id;
-			log_group(g, "set global_id %x from %d",
-				  g->global_id, save->nodeid);
-		}
-	 free_save:
-		list_del(&save->list);
-		if (save->msg_long)
-			free(save->msg_long);
-		free(save);
-		rv = 1;
-	}
-
-	/* state changes to X_ALL_STOPPED or X_ALL_STARTED */
-
-	if (event_state_stopping(a) && all_nodes_stopped(a))
-		a->current_event->state++;
-
-	if (event_state_starting(a) && all_nodes_started(a))
-		a->current_event->state++;
-
-	return rv;
-}
-
-static void deliver_app_messages(group_t *g)
-{
-	app_t *a = g->app;
-	struct save_msg *save, *tmp;
-
-	list_for_each_entry_safe(save, tmp, &g->messages, list) {
-		switch (save->msg.ms_type) {
-		case MSG_APP_INTERNAL:
-			app_deliver(a, save);
-			break;
-		default:
-			continue;
-		}
-
-		list_del(&save->list);
-		if (save->msg_long)
-			free(save->msg_long);
-		free(save);
-	}
-}
-
-event_t *find_queued_recover_event(group_t *g)
-{
-	event_t *ev;
-
-	list_for_each_entry(ev, &g->app->events, list) {
-		if (ev->state == EST_FAIL_BEGIN)
-			return ev;
-	}
-	return NULL;
-}
-
-#if 0
-static int group_started(event_t *ev)
-{
-	switch (ev->state) {
-	case EST_JOIN_BEGIN:
-	case EST_JOIN_STOP_WAIT:
-	case EST_JOIN_ALL_STOPPED:
-	case EST_LEAVE_BEGIN:
-	case EST_LEAVE_STOP_WAIT:
-	case EST_LEAVE_ALL_STOPPED:
-	case EST_FAIL_BEGIN:
-	case EST_FAIL_STOP_WAIT:
-	case EST_FAIL_ALL_STOPPED:
-		return 0;
-	default:
-		return 1;
-	};
-}
-#endif
-
-void dump_group(group_t *g)
-{
-	app_t *a = g->app;
-	node_t *node;
-	struct save_msg *save;
-	event_t *ev;
-
-	printf("---\n");
-	printf("name: %s\n", g->name);
-	printf("level: %d\n", g->level);
-	printf("global_id: %u\n", g->global_id);
-	printf("cpg handle: %llx\n", (unsigned long long)g->cpg_handle);
-	printf("cpg client: %d\n", g->cpg_client);
-	printf("app client: %d\n", g->app->client);
-
-	printf("memb count: %u\n", g->memb_count);
-	printf("memb list: ");
-	list_for_each_entry(node, &g->memb, list)
-		printf("%d ", node->nodeid);
-	printf("\n");
-
-	printf("app node count: %u\n", g->app->node_count);
-	printf("app node list: ");
-	list_for_each_entry(node, &g->app->nodes, list)
-		printf("%d ", node->nodeid);
-	printf("\n");
-
-	printf("saved messages: ");
-	list_for_each_entry(save, &g->messages, list)
-		printf("%d/%d ", save->nodeid, save->msg.ms_type);
-	printf("\n");
-
-	if (a->current_event)
-		printf("current_event %d-%d\n", a->current_event->nodeid, a->current_event->state);
-
-	printf("events: ");
-	list_for_each_entry(ev, &a->events, list)
-		printf("%d-%d ", ev->nodeid, ev->state);
-	printf("\n");
-
-	printf("---\n");
-}
-
-void dump_all_groups(void)
-{
-	group_t *g;
-	list_for_each_entry(g, &gd_groups, list)
-		dump_group(g);
-}
-
-/* handle a node failure while processing an event. returning > 0 means
-   we want process_current_event() to be called for the group */
-
-int recover_current_event(group_t *g)
-{
-	app_t *a = g->app;
-	event_t *ev, *rev;
-	node_t *node, *us;
-	struct save_msg *save;
-	struct nodeid *id, *safe;
-	int rv = 0;
-
-	ev = a->current_event;
-	if (!ev)
-		return 0;
-
-	rev = find_queued_recover_event(g);
-	if (!rev)
-		return 0;
-
-	/* if the current ev is for recovery, we merge the new rev into it;
-	   if the current ev is still stopping (or all stopped), it just
-	   continues as usual; if the current ev is starting, the state is
-	   reset back to FAIL_BEGIN so it goes through a stopping cycle for
-	   the new node failure that's been added to it */
-
-	if (is_recovery_event(ev)) {
-		log_group(g, "merge new rev %d into current rev %d %s",
-			  rev->nodeid, ev->nodeid, ev_state_str(ev));
-
-		if (ev->state > EST_FAIL_ALL_STOPPED) {
-			ev->state = EST_FAIL_BEGIN;
-			ev->fail_all_stopped = 0;
-			clear_all_nodes_stopped(a);
-		} else if (event_state_stopping(a)) {
-			mark_node_stopped(a, rev->nodeid);
-			list_for_each_entry(id, &rev->extended, list)
-				mark_node_stopped(a, id->nodeid);
-		}
-
-		id = malloc(sizeof(struct nodeid));
-		// FIXME: handle failed malloc
-		id->nodeid = rev->nodeid;
-		list_add(&id->list, &ev->extended);
-		log_group(g, "extend active rev %d with failed node %d",
-			  ev->nodeid, rev->nodeid);
-		list_for_each_entry_safe(id, safe, &rev->extended, list) {
-			list_del(&id->list);
-			list_add(&id->list, &ev->extended);
-			log_group(g, "extend active rev %d with failed node %d",
-				  ev->nodeid, id->nodeid);
-		}
-
-		send_recover(g, rev);
-		list_del(&rev->list);
-		free_event(rev);
-		return 1;
-	}
-
-	/* This is a really gross situation, wish I could find a better way
-	   to deal with it... (rev's skip ahead of other queued ev's, I think
-	   that's the root of the difficulties here, we don't know if the
-	   rev has skipped ahead of our join on remote nodes or not).
-
-	   If our own join event is current on other nodes, then we want a
-	   rev (which will replace our join ev once it's starting).  If our
-	   join event isn't current on other nodes, then recovery will occur
-	   before we're added to the app group and the rev doesn't apply to us
-	   (apart from needing to remove the failed node from the memb list).
-
-	   We won't know if our join ev is current on other nodes, though,
-	   until we see a message -- if the message event id is for our join,
-	   then our ev is current and we'll process the rev after our ev, if
-	   the message event id is for the rev, then the rev is being done
-	   by the current members without us and our ev will be done later;
-	   the rev doesn't apply to us.
-
-	   Do nothing until we see a message indicating whether other nodes
-	   are on our join ev (in which case go to "rev will abort curr" code),
-	   or whether they're processing this rev (before our join ev comes
-	   up) in which case we can drop the rev (NB attend to rs, too). */
-
-	if (ev->state == EST_JOIN_STOP_WAIT && is_our_join(ev)) {
-
-		log_group(g, "rev %d is for group we're waiting to join",
-			  rev->nodeid);
-
-		/* If the failed node is the only other app member apart
-		   from us in the pending membership list, then we must go
-		   ahead with our own join event, there will be no remote nodes
-		   processing a rev or an ev for this group.  We send a recover
-		   message so other nodes waiting to join after us will purge
-		   their rev on the group. */
-
-		if (a->node_count == 2) {
-			node = find_app_node(a, rev->nodeid);
-			us = find_app_node(a, our_nodeid);
-
-			if (node && us) {
-				log_group(g, "joining group with one other node"
-					  " now dead rev %d", rev->nodeid);
-				a->node_count--;
-				list_del(&node->list);
-				free(node);
-				send_recover(g, rev);
-				del_recovery_set(g, rev, 1);
-				list_del(&rev->list);
-				free_event(rev);
-				return 0;
-			}
-		}
-
-		/* Look for a remote node with stopped of 1, if we find one,
-		   then fall through to the 'else if (event_state_stopping)'
-		   below.  A remote node with stopped of 1 means we've received
-		   a stopped message with an event_id of our join event. */
-
-		list_for_each_entry(node, &a->nodes, list) {
-			if (node->nodeid == our_nodeid)
-				continue;
-			if (node->stopped) {
-				log_group(g, "our join is current on %d",
-					  node->nodeid);
-				log_group(g, "rev %d behind our join ev %llx",
-					  rev->nodeid,
-					  (unsigned long long)ev->id);
-				goto next;
-			}
-		}
-
-		/* Look through saved messages for one with an event_id
-		   matching the rev, if we find one, then we get rid of this
-		   rev and clear this group (that we're joining) from any
-		   recovery sets that are sequencing recovery of groups the
-		   failed node was in.  The other nodes are processing the
-		   rev before processing our join ev. */
-		   
-		list_for_each_entry(save, &g->messages, list) {
-			if (save->msg.ms_type == MSG_APP_INTERNAL)
-				continue;
-			if (save->msg.ms_event_id != rev->id)
-				continue;
-
-			log_group(g, "rev %d %llx ahead of our join ev %llx",
-				  rev->nodeid,
-				  (unsigned long long)rev->id,
-				  (unsigned long long)ev->id);
-
-			node = find_app_node(a, rev->nodeid);
-			if (node) {
-				a->node_count--;
-				log_group(g, "not joined, remove %d rev %d",
-					  node->nodeid, rev->nodeid);
-				list_del(&node->list);
-				free(node);
-			}
-			list_for_each_entry(id, &rev->extended, list) {
-				node = find_app_node(a, id->nodeid);
-				if (node) {
-					a->node_count--;
-					log_group(g, "not joined, remove %d "
-						  "rev %d", id->nodeid,
-						  rev->nodeid);
-					list_del(&node->list);
-					free(node);
-				}
-			}
-
-			del_recovery_set(g, rev, 1);
-			list_del(&rev->list);
-			log_group(g, "got rid of rev %d for unjoined group",
-				  rev->nodeid);
-			free_event(rev);
-			return 0;
-		}
-
-		log_group(g, "no messages indicating remote state of group");
-		return 0;
-	}
-
- next:
-	/* Before starting the rev we need to apply the node addition/removal
-	 * of the current ev to the app.  This means processing the current ev
-	 * up through the starting stage.  So, we're sending the app the start
-	 * to inform it of the ev node change, knowing that the start won't
-	 * complete due to the node failure (pending rev), and knowing that
-	 * we'll shortly be sending it a stop and new start for the rev.
-	 *
-	 * If the current event is waiting for a "stopped" message from failed
-	 * node(s), fill in those stopped messages so we move along to the
-	 * starting state so the recovery event can then take over. */
-
-	if (event_state_starting(a) || event_state_all_started(a)) {
-		log_group(g, "rev %d replaces current ev %d %s",
-			  rev->nodeid, ev->nodeid, ev_state_str(ev));
-
-		/* what we do for our own join when reaching JOIN_ALL_STARTED */
-		if (is_our_join(ev)) {
-			purge_messages(g);
-			g->joining = 0;
-		}
-		clear_all_nodes_stopped(a);
-		list_del(&rev->list);
-		a->current_event = rev;
-		free_event(ev);
-		send_recover(g, rev);
-		rv = 1;
-	} else if (event_state_stopping(a)) {
-		/* We'll come back through here multiple times until all the
-		   stopped messages are received; we need to continue to
-		   process this event that's stopping so it will get to the
-		   starting state at which point the rev can replace it. */
-
-		log_group(g, "rev %d will abort current ev %d %s",
-			  rev->nodeid, ev->nodeid, ev_state_str(ev));
-
-		ev->start_app_before_pending_rev = 1;
-
-		mark_node_stopped(a, rev->nodeid);
-		list_for_each_entry(id, &rev->extended, list)
-			mark_node_stopped(a, id->nodeid);
-		rv = 1;
-	} else {
-		log_group(g, "rev %d delayed for ev %d %s",
-			  rev->nodeid, ev->nodeid, ev_state_str(ev));
-	}
-
-	/* FIXME: does the code above work ok if ev->nodeid == rev->noded
-	   (joining node failed) */
-
-	/* FIXME: if the current event is a leave and the leaving node has
-	   failed, then replace the current event with the rev */
-
-	return rv;
-}
-
-int process_app(group_t *g)
-{
-	app_t *a = g->app;
-	event_t *ev = NULL;
-	int rv = 0, ret;
-
-	if (a->current_event) {
-		rv += process_app_messages(g);
-
-		ret = process_current_event(g);
-		if (ret < 0)
-			goto out;
-		rv += ret;
-
-		ret = recover_current_event(g);
-		if (ret <= 0)
-			goto out;
-
-		ret = process_current_event(g);
-		if (ret < 0)
-			goto out;
-		rv += ret;
-	} else {
-
-		/* We only take on a new non-recovery event if there are
-		   no recovery sets outstanding.  The new event may be
-		   to mount gfs X where there are no living mounters of X,
-		   and the pending recovery set is to fence a node that
-		   had X mounted.  update: relax this so events are taken
-		   if there are unrecovered groups _at a lower level_. */
-
-		ev = find_queued_recover_event(g);
-		if (ev) {
-			log_group(g, "set current event to recovery for %d",
-				  ev->nodeid);
-			list_del(&ev->list);
-		} else if (!list_empty(&a->events)) {
-#if 0
-			if (!cman_quorate) {
-				log_group(g, "no new event while inquorate");
-			} else if (lower_groups_need_recovery(g)) {
-				log_group(g, "no new event while lower level "
-					  "groups need recovery");
-			} else {
-				ev = list_entry(a->events.next, event_t, list);
-				list_del(&ev->list);
-			}
-#endif
-			ev = list_entry(a->events.next, event_t, list);
-			list_del(&ev->list);
-		}
-
-		if (ev) {
-			a->need_first_event = 0;
-			a->current_event = ev;
-			rv = process_current_event(g);
-		} else if (a->need_first_event) {
-			log_group(g, "waiting for first cpg event");
-		}
-	}
- out:
-	return rv;
-}
-
-/* process_apps() will be called again immediately if it returns > 0 */
-
-int process_apps(void)
-{
-	group_t *g, *safe;
-	int rv = 0;
-
-	if (group_mode != GROUP_LIBGROUP)
-		return 0;
-
-	list_for_each_entry_safe(g, safe, &gd_groups, list) {
-		rv += process_app(g);
-		deliver_app_messages(g);
-	}
-
-	return rv;
-}
-
-/* This is a bit of a hack that may not be entirely necessary.  The problem
-   we're solving with this function is when a node leaves a group and is
-   collecting all the "stopped" messages from the remaining members, some
-   of those members may fail, so we wouldn't get a stopped message from
-   them and never finalize_our_leave (terminate the group).  I'm not entirely
-   sure that we _need_ to wait for stopped messages from remaining members
-   before we do the finalize_our_leave/terminate... The reasoning at this
-   point is that when gfs is withdrawing, we want to be sure gfs is
-   suspended everywhere before we leave the lockspace (which happens at
-   terminate for the withdraw/leave) */
-
-void groupd_down(int nodeid)
-{
-	group_t *g;
-
-	list_for_each_entry(g, &gd_groups, list) {
-		if (g->app &&
-		    g->app->current_event &&
-		    g->app->current_event->state == EST_LEAVE_STOP_WAIT &&
-		    is_our_leave(g->app->current_event)) {
-			log_group(g, "groupd down on %d, push our leave",
-				  nodeid);
-			mark_node_stopped(g->app, nodeid);
-		}
-	}
-}
-
diff --git a/group/daemon/cman.c b/group/daemon/cman.c
deleted file mode 100644
index 0c0bbfa..0000000
--- a/group/daemon/cman.c
+++ /dev/null
@@ -1,206 +0,0 @@
-
-/* Interface with corosync's cman API */
-
-#include <libcman.h>
-#include "gd_internal.h"
-
-static cman_handle_t	ch;
-static cman_handle_t	ch_admin;
-static int		old_quorate;
-static cman_node_t	old_nodes[MAX_NODES];
-static int		old_node_count;
-static cman_node_t	cman_nodes[MAX_NODES];
-static int		cman_node_count;
-static char		name_buf[CMAN_MAX_NODENAME_LEN+1];
-
-
-int kill_cman(int nodeid)
-{
-	return cman_kill_node(ch_admin, nodeid);
-}
-
-static int is_member(cman_node_t *node_list, int count, int nodeid)
-{
-	int i;
-
-	for (i = 0; i < count; i++) {
-		if (node_list[i].cn_nodeid == nodeid)
-			return node_list[i].cn_member;
-	}
-	return 0;
-}
-
-static int is_old_member(int nodeid)
-{
-	return is_member(old_nodes, old_node_count, nodeid);
-}
-
-static int is_cman_member(int nodeid)
-{
-	return is_member(cman_nodes, cman_node_count, nodeid);
-}
-
-static void statechange(void)
-{
-	int i, rv;
-
-	old_quorate = cman_quorate;
-	old_node_count = cman_node_count;
-	memcpy(&old_nodes, &cman_nodes, sizeof(old_nodes));
-
-	cman_quorate = cman_is_quorate(ch);
-
-	cman_node_count = 0;
-	memset(&cman_nodes, 0, sizeof(cman_nodes));
-	rv = cman_get_nodes(ch, MAX_NODES, &cman_node_count, cman_nodes);
-	if (rv < 0) {
-		log_print("cman_get_nodes error %d %d", rv, errno);
-		return;
-	}
-
-	/*
-	printf("cman: %d old nodes:\n", old_node_count);
-	for (i = 0; i < old_node_count; i++)
-		printf("%d:%d ", old_nodes[i].cn_nodeid,
-				 old_nodes[i].cn_member);
-	printf("\n");
-
-	printf("cman: %d new nodes:\n", cman_node_count);
-	for (i = 0; i < cman_node_count; i++)
-		printf("%d:%d ", cman_nodes[i].cn_nodeid,
-				 cman_nodes[i].cn_member);
-	printf("\n");
-	*/
-
-	if (old_quorate && !cman_quorate)
-		log_debug("cman: lost quorum");
-	if (!old_quorate && cman_quorate)
-		log_debug("cman: have quorum");
-
-	for (i = 0; i < old_node_count; i++) {
-		if (old_nodes[i].cn_member &&
-		    !is_cman_member(old_nodes[i].cn_nodeid)) {
-
-			log_debug("cman: node %d removed",
-				  old_nodes[i].cn_nodeid);
-			add_recovery_set_cman(old_nodes[i].cn_nodeid);
-		}
-	}
-
-	for (i = 0; i < cman_node_count; i++) {
-		if (cman_nodes[i].cn_member &&
-		    !is_old_member(cman_nodes[i].cn_nodeid))
-			log_debug("cman: node %d added",
-				  cman_nodes[i].cn_nodeid);
-	}
-}
-
-static void cman_callback(cman_handle_t h, void *private, int reason, int arg)
-{
-	switch (reason) {
-	case CMAN_REASON_TRY_SHUTDOWN:
-		cman_replyto_shutdown(ch, 1);
-		break;
-	case CMAN_REASON_STATECHANGE:
-		statechange();
-		break;
-	case CMAN_REASON_CONFIG_UPDATE:
-		setup_logging();
-		break;
-	}
-}
-
-void process_cman(int ci)
-{
-	int rv;
-
-	rv = cman_dispatch(ch, CMAN_DISPATCH_ALL);
-	if (rv == -1 && errno == EHOSTDOWN)
-		cluster_dead(0);
-}
-
-int setup_cman(void)
-{
-	cman_node_t node;
-	int rv, fd;
-	int init = 0, active = 0;
-
- retry_init:
-	ch = cman_init(NULL);
-	if (!ch) {
-		if (init++ < 2) {
-			sleep(1);
-			goto retry_init;
-		}
-		log_print("cman_init error %d", errno);
-		return -ENOTCONN;
-	}
-
- retry_active:
-	rv = cman_is_active(ch);
-	if (!rv) {
-		if (active++ < 2) {
-			sleep(1);
-			goto retry_active;
-		}
-		log_print("cman_is_active error %d", errno);
-		cman_finish(ch);
-		return -ENOTCONN;
-	}
-
-	ch_admin = cman_admin_init(NULL);
-	if (!ch_admin) {
-		log_print("cman_admin_init error %d", errno);
-		cman_finish(ch);
-		return -ENOTCONN;
-	}
-
-	rv = cman_start_notification(ch, cman_callback);
-	if (rv < 0) {
-		log_print("cman_start_notification error %d %d", rv, errno);
-		cman_finish(ch);
-		cman_finish(ch_admin);
-		return rv;
-	}
-
-	memset(&node, 0, sizeof(node));
-	rv = cman_get_node(ch, CMAN_NODEID_US, &node);
-	if (rv < 0) {
-		log_print("cman_get_node us error %d %d", rv, errno);
-		cman_stop_notification(ch);
-		cman_finish(ch);
-		cman_finish(ch_admin);
-		return rv;
-	}
-
-	cman_node_count = 0;
-	memset(&cman_nodes, 0, sizeof(cman_nodes));
-	rv = cman_get_nodes(ch, MAX_NODES, &cman_node_count, cman_nodes);
-	if (rv < 0) {
-		log_print("cman_get_nodes error %d %d", rv, errno);
-		cman_stop_notification(ch);
-		cman_finish(ch);
-		cman_finish(ch_admin);
-		return rv;
-	}
-
-	cman_quorate = cman_is_quorate(ch);
-
-	memset(name_buf, 0, sizeof(name_buf));
-	strncpy(name_buf, node.cn_name, CMAN_MAX_NODENAME_LEN);
-	our_name = name_buf;
-	our_nodeid = node.cn_nodeid;
-	log_debug("cman: our nodeid %d name %s quorum %d",
-		  our_nodeid, our_name, cman_quorate);
-
-	fd = cman_get_fd(ch);
-
-	return fd;
-}
-
-void close_cman(void)
-{
-	cman_finish(ch);
-	cman_finish(ch_admin);
-}
-
diff --git a/group/daemon/cpg.c b/group/daemon/cpg.c
deleted file mode 100644
index 6195d49..0000000
--- a/group/daemon/cpg.c
+++ /dev/null
@@ -1,1072 +0,0 @@
-
-/* Interface with corosync's closed-process-group (cpg) API */
-
-#include "gd_internal.h"
-
-static cpg_handle_t groupd_handle;
-static struct cpg_name groupd_name;
-static int global_id_counter = 0;
-static int groupd_joined = 0;
-static int groupd_ci;
-
-static int			got_confchg;
-static struct cpg_address	groupd_cpg_member[MAX_GROUP_MEMBERS];
-static int			groupd_cpg_member_count;
-static struct cpg_address	saved_member[MAX_GROUP_MEMBERS];
-static struct cpg_address	saved_joined[MAX_GROUP_MEMBERS];
-static struct cpg_address	saved_left[MAX_GROUP_MEMBERS];
-static int			saved_member_count;
-static int			saved_joined_count;
-static int			saved_left_count;
-static cpg_handle_t		saved_handle;
-static struct cpg_name		saved_name;
-static int			message_flow_control_on;
-static struct list_head		group_nodes;
-static uint64_t			send_version_first;
-
-#define CLUSTER2		2
-#define CLUSTER3		3
-
-struct group_version {
-	uint32_t nodeid;
-	uint16_t cluster;
-	uint16_t group_mode;
-	uint16_t groupd_compat;
-	uint16_t groupd_count;
-	uint32_t unused;
-};
-
-struct group_node {
-	uint32_t nodeid;
-	uint32_t got_from;
-	int got_version;
-	uint64_t add_time;
-	struct group_version ver;
-	struct list_head list;
-};
-
-static void block_old_nodes(void);
-
-static char *mode_str(int m)
-{
-	switch (m) {
-	case GROUP_PENDING:
-		return "PENDING";
-	case GROUP_LIBGROUP:
-		return "LIBGROUP";
-	case GROUP_LIBCPG:
-		return "LIBCPG";
-	default:
-		return "UNKNOWN";
-	}
-}
-
-static struct group_node *get_group_node(int nodeid)
-{
-	struct group_node *node;
-
-	list_for_each_entry(node, &group_nodes, list) {
-		if (node->nodeid == nodeid)
-			return node;
-	}
-	return NULL;
-}
-
-static void group_node_add(int nodeid)
-{
-	struct group_node *node;
-
-	node = get_group_node(nodeid);
-	if (node)
-		return;
-
-	node = malloc(sizeof(struct group_node));
-	if (!node)
-		return;
-	memset(node, 0, sizeof(struct group_node));
-
-	node->nodeid = nodeid;
-	node->add_time = time(NULL);
-	list_add_tail(&node->list, &group_nodes);
-}
-
-static void group_node_del(int nodeid)
-{
-	struct group_node *node;
-
-	node = get_group_node(nodeid);
-	if (!node) {
-		log_print("group_node_del %d no node", nodeid);
-		return;
-	}
-
-	list_del(&node->list);
-	free(node);
-}
-
-static void version_copy_in(struct group_version *ver)
-{
-	ver->nodeid        = le32_to_cpu(ver->nodeid);
-	ver->cluster       = le16_to_cpu(ver->cluster);
-	ver->group_mode    = le16_to_cpu(ver->group_mode);
-	ver->groupd_compat = le16_to_cpu(ver->groupd_compat);
-	ver->groupd_count  = le16_to_cpu(ver->groupd_count);
-}
-
-static void _send_version(int nodeid, int cluster, int mode, int compat)
-{
-	group_t g, *gp;
-	char *buf;
-	msg_t *msg;
-	int len;
-	int count = 0;
-	struct group_version *ver;
-
-	list_for_each_entry(gp, &gd_groups, list)
-		count++;
-
-	/* just so log_group will work */
-	memset(&g, 0, sizeof(group_t));
-	strcpy(g.name, "groupd");
-
-	len = sizeof(msg_t) + sizeof(struct group_version);
-
-	buf = malloc(len);
-	if (!buf)
-		return;
-	memset(buf, 0, len);
-
-	msg = (msg_t *)buf;
-	ver = (struct group_version *)(buf + sizeof(msg_t));
-
-	msg->ms_type = MSG_GROUP_VERSION;
-	msg_bswap_out(msg);
-
-	log_debug("send_version nodeid %d cluster %d mode %s compat %d",
-		  nodeid, cluster, mode_str(mode), compat);
-
-	ver->nodeid        = cpu_to_le32(nodeid);
-	ver->cluster       = cpu_to_le16(cluster);
-	ver->group_mode    = cpu_to_le16(mode);
-	ver->groupd_compat = cpu_to_le16(compat);
-	ver->groupd_count  = cpu_to_le16(count);
-
-	send_message_groupd(&g, buf, len, MSG_GROUP_VERSION);
-}
-
-static void send_version(void)
-{
-	_send_version(our_nodeid, CLUSTER3, group_mode, cfgd_groupd_compat);
-}
-
-static void set_group_mode(void)
-{
-	struct group_node *node;
-	int need_version, pending_count;
-
-	need_version = 0;
-	pending_count = 0;
-
-	list_for_each_entry(node, &group_nodes, list) {
-		if (!node->got_version) {
-			need_version++;
-			continue;
-		}
-		if (node->ver.group_mode == GROUP_PENDING) {
-			pending_count++;
-			continue;
-		}
-
-		/* If we receive any non-pending group mode, adopt it
-		   immediately. */
-
-		group_mode = node->ver.group_mode;
-
-		switch (group_mode) {
-		case GROUP_PENDING:
-			/* shouldn't happen */
-			log_level(LOG_INFO, "groupd compatibility mode 2 ver");
-			break;
-		case GROUP_LIBGROUP:
-			log_level(LOG_INFO, "groupd compatibility mode 1 ver");
-			break;
-		case GROUP_LIBCPG:
-			log_level(LOG_INFO, "groupd compatibility mode 0 ver");
-			break;
-		default:
-			log_level(LOG_INFO, "groupd compatibility mode %d ver",
-				  group_mode);
-			break;
-		}
-
-		log_debug("set_group_mode %s matching nodeid %d got_from %d",
-			  mode_str(group_mode), node->nodeid, node->got_from);
-		break;
-	}
-
-	if (group_mode == GROUP_LIBCPG)
-		block_old_nodes();
-}
-
-static void receive_version(int from, msg_t *msg, int len)
-{
-	struct group_node *node;
-	struct group_version *ver;
-
-	if (group_mode != GROUP_PENDING)
-		return;
-
-	ver = (struct group_version *)((char *)msg + sizeof(msg_t));
-
-	version_copy_in(ver);
-
-	node = get_group_node(ver->nodeid);
-	if (!node) {
-		log_print("receive_version from %d nodeid %d not found",
-			  from, ver->nodeid);
-		return;
-	}
-
-	/* ignore a repeat of what we've seen before */
-
-	if (node->got_version && from == node->got_from &&
-	    node->ver.group_mode == ver->group_mode)
-		return;
-
-	log_debug("receive_version from %d nodeid %d cluster %d mode %s "
-		  "compat %d", from, ver->nodeid, ver->cluster,
-		  mode_str(ver->group_mode), ver->groupd_compat);
-
-	node->got_version = 1;
-	node->got_from = from;
-	memcpy(&node->ver, ver, sizeof(struct group_version));
-
-	set_group_mode();
-}
-
-void group_mode_check_timeout(void)
-{
-	struct group_node *node;
-	int need_version, pending_count;
-	uint64_t now;
-
-	if (group_mode != GROUP_PENDING)
-		return;
-
-	if (!send_version_first)
-		return;
-
-	/* Wait for cfgd_groupd_wait seconds to receive a version message from
-	   an added node, after which we'll send a version message for it,
-	   calling it a cluster2 node; receiving this will cause everyone to
-	   immediately set mode to LIBGROUP. */
-
-	need_version = 0;
-	pending_count = 0;
-	now = time(NULL);
-
-	list_for_each_entry(node, &group_nodes, list) {
-		if (node->got_version) {
-			pending_count++;
-			continue;
-		}
-		need_version++;
-
-		if (now - node->add_time >= cfgd_groupd_wait) {
-			log_print("send version for nodeid %d times %llu %llu",
-				  node->nodeid,
-				  (unsigned long long)node->add_time,
-				  (unsigned long long)now);
-			_send_version(node->nodeid, CLUSTER2, GROUP_LIBGROUP,1);
-		}
-	}
-
-	if (need_version) {
-		log_debug("group_mode_check_timeout need %d pending %d",
-			  need_version, pending_count);
-		return;
-	}
-
-	/* we have a version from everyone, and they all are pending;
-	   wait for cfgd_groupd_mode_delay to give any old cluster2 nodes
-	   a chance to join and cause us to use LIBGROUP */
-
-	if (now - send_version_first < cfgd_groupd_mode_delay) {
-		log_debug("group_mode_check_timeout delay times %llu %llu",
-			  (unsigned long long)send_version_first,
-			  (unsigned long long)now);
-		return;
-	}
-
-	/* everyone is cluster3/pending so we can use LIBCPG; receiving
-	   this will cause everyone to immediately set mode to LIBCPG */
-
-	log_debug("send version LIBCPG all %d pending", pending_count);
-
-	_send_version(our_nodeid, CLUSTER3, GROUP_LIBCPG, cfgd_groupd_compat);
-}
-
-static node_t *find_group_node(group_t *g, int nodeid)
-{
-	node_t *node;
-
-	list_for_each_entry(node, &g->memb, list) {
-		if (node->nodeid == nodeid)
-			return node;
-	}
-	return NULL;
-}
-
-static void process_node_down(group_t *g, int nodeid)
-{
-	node_t *node;
-	event_t *ev, *ev_safe;
-	int no_rev = 0;
-
-	node = find_group_node(g, nodeid);
-	if (!node)
-		return;
-
-	log_group(g, "process_node_down %d", nodeid);
-
-	list_del(&node->list);
-	g->memb_count--;
-	free(node);
-
-	log_group(g, "cpg del node %d total %d - down",
-		  nodeid, g->memb_count);
-
-	/* purge any queued join/leave events from the dead node */
-
-	list_for_each_entry_safe(ev, ev_safe, &g->app->events, list) {
-		if (ev->nodeid != nodeid)
-			continue;
-
-		if (ev->state == EST_JOIN_BEGIN ||
-		    ev->state == EST_LEAVE_BEGIN) {
-			if (ev->state == EST_JOIN_BEGIN)
-				no_rev = 1;
-
-			log_group(g, "purge event %s from %d", ev_state_str(ev),
-			  	  nodeid);
-			del_event_nodes(ev);
-			list_del(&ev->list);
-			free(ev);
-		}
-	}
-
-	/* the failed node was never added to the app, so the app
-	   doesn't need to be recovered for it */
-	if (no_rev)
-		return;
-
-	ev = find_queued_recover_event(g);
-	if (ev)
-		extend_recover_event(g, ev, nodeid);
-	else
-		queue_app_recover(g, nodeid);
-}
-
-static void process_node_join(group_t *g, int nodeid)
-{
-	node_t *node;
-	int i;
-
-	log_group(g, "process_node_join %d", nodeid);
-
-	if (nodeid == our_nodeid) {
-		for (i = 0; i < saved_member_count; i++) {
-			node = new_node(saved_member[i].nodeid);
-			list_add_tail(&node->list, &g->memb);
-			g->memb_count++;
-			log_group(g, "cpg add node %d total %d",
-				  node->nodeid, g->memb_count);
-		}
-
-		/* if we're the first one to join (create) the group,
-		   then set its global_id */
-
-		if (saved_member_count == 1) {
-			g->global_id = (++global_id_counter << 16) |
-				       (0x0000FFFF & our_nodeid);
-			log_group(g, "create group id %x our_nodeid %d",
-				  g->global_id, our_nodeid);
-		}
-	} else {
-		node = new_node(nodeid);
-		list_add_tail(&node->list, &g->memb);
-		g->memb_count++;
-		log_group(g, "cpg add node %d total %d",
-			  node->nodeid, g->memb_count);
-	}
-
-	queue_app_join(g, nodeid);
-
-	/* if this is for our own join, then make it current immediately;
-	   other code gets confused if we're not joined and have no current
-	   event */
-	if (nodeid == our_nodeid)
-		process_app(g);
-}
-
-static void process_node_leave(group_t *g, int nodeid)
-{
-	node_t *node;
-
-	log_group(g, "process_node_leave %d", nodeid);
-
-	node = find_group_node(g, nodeid);
-	if (!node) {
-		log_error(g, "process_node_leave: no member %d", nodeid);
-		return;
-	}
-
-	list_del(&node->list);
-	g->memb_count--;
-	free(node);
-
-	log_group(g, "cpg del node %d total %d", nodeid, g->memb_count);
-
-	queue_app_leave(g, nodeid);
-}
-
-static uint32_t max_global_id(uint32_t add_nodeid)
-{
-	group_t *g;
-	uint32_t nodeid, counter, max_counter = 0, max_gid = 0;
-
-	list_for_each_entry(g, &gd_groups, list) {
-		nodeid = g->global_id & 0x0000FFFF;
-		counter = (g->global_id >> 16) & 0x0000FFFF;
-		if (nodeid != add_nodeid)
-			continue;
-		if (!max_counter || counter > max_counter) {
-			max_counter = counter;
-			max_gid = g->global_id;
-		}
-	}
-	return max_gid;
-}
-
-static int send_gid(uint32_t gid)
-{
-	group_t g;
-	msg_t msg;
-
-	/* just so log_group will work */
-	memset(&g, 0, sizeof(group_t));
-	strcpy(g.name, "groupd");
-
-	memset(&msg, 0, sizeof(msg));
-	msg.ms_type = MSG_GLOBAL_ID;
-	msg.ms_global_id = gid;
-
-	msg_bswap_out(&msg);
-
-	return send_message_groupd(&g, &msg, sizeof(msg), MSG_GLOBAL_ID);
-}
-
-void process_groupd_confchg(void)
-{
-	group_t *g;
-	struct recovery_set *rs;
-	int i, found = 0;
-	uint32_t gid;
-
-	log_debug("groupd confchg total %d left %d joined %d",
-		  saved_member_count, saved_left_count, saved_joined_count);
-
-	if (!send_version_first) {
-		for (i = 0; i < saved_member_count; i++) {
-			group_node_add(saved_member[i].nodeid);
-			log_debug("groupd init %d", saved_member[i].nodeid);
-		}
-
-		send_version_first = time(NULL);
-	} else {
-		for (i = 0; i < saved_left_count; i++) {
-			group_node_del(saved_left[i].nodeid);
-			log_debug("groupd del %d", saved_left[i].nodeid);
-		}
-		for (i = 0; i < saved_joined_count; i++) {
-			group_node_add(saved_joined[i].nodeid);
-			log_debug("groupd add %d", saved_joined[i].nodeid);
-		}
-	}
-
-	if (saved_joined_count)
-		send_version();
-
-	memcpy(&groupd_cpg_member, &saved_member, sizeof(saved_member));
-	groupd_cpg_member_count = saved_member_count;
-
-	if (group_mode != GROUP_LIBGROUP)
-		return;
-
-	for (i = 0; i < saved_member_count; i++) {
-		if (saved_member[i].nodeid == our_nodeid &&
-		    saved_member[i].pid == (uint32_t) getpid()) {
-			found = 1;
-		}
-	}
-
-	if (!groupd_joined)
-		goto next;
-
-	/* find any groups that were created in the past by a new node
-	   and send it the id it used so it can initialize global_id_counter
-	   to avoid creating a new group with a duplicate id */
-
-	for (i = 0; i < saved_joined_count; i++) {
-		gid = max_global_id(saved_joined[i].nodeid);
-		if (!gid)
-			continue;
-		log_debug("joined node %d had old max gid %x",
-			  saved_joined[i].nodeid, gid);
-		send_gid(gid);
-	}
-
- next:
-	if (found)
-		groupd_joined = 1;
-	else
-		log_print("we are not in groupd confchg: %u %u",
-			  our_nodeid, (uint32_t) getpid());
-
-	for (i = 0; i < saved_left_count; i++) {
-		if (saved_left[i].reason == CPG_REASON_LEAVE)
-			continue;
-
-		if (saved_left[i].reason == CPG_REASON_NODEDOWN) {
-			/* a nice clean failure */
-			add_recovery_set_cpg(saved_left[i].nodeid, 0);
-		} else if (saved_left[i].reason == CPG_REASON_PROCDOWN) {
-			/* groupd failed, but the node is still up; if
-			   the node was in any groups (non-NULL rs is
-			   returned), then kill the node so it'll be a
-			   real nodedown */
-			rs = add_recovery_set_cpg(saved_left[i].nodeid, 1);
-			if (rs) {
-				log_print("kill node %d - groupd PROCDOWN",
-					  saved_left[i].nodeid);
-				kill_cman(saved_left[i].nodeid);
-			}
-		}
-		groupd_down(saved_left[i].nodeid);
-	}
-
-	/* we call process_node_down from here, instead of from the other cpg
-	   confchg's because we want everyone to see the same order of
-	   confchg's with respect to messages.  see bz 258121 */
-
-	for (i = 0; i < saved_left_count; i++) {
-		if (saved_left[i].reason == CPG_REASON_NODEDOWN ||
-		    saved_left[i].reason == CPG_REASON_PROCDOWN) {
-			list_for_each_entry(g, &gd_groups, list)
-				process_node_down(g, saved_left[i].nodeid);
-		}
-	}
-}
-
-void copy_groupd_data(group_data_t *data)
-{
-	int i;
-
-	data->level = -1;
-	data->member_count = groupd_cpg_member_count;
-	for (i = 0; i < groupd_cpg_member_count; i++)
-		data->members[i] = groupd_cpg_member[i].nodeid;
-}
-
-int in_groupd_cpg(int nodeid)
-{
-	int i;
-	for (i = 0; i < groupd_cpg_member_count; i++) {
-		if (nodeid == groupd_cpg_member[i].nodeid)
-			return 1;
-	}
-	return 0;
-}
-
-group_t *find_group_by_handle(cpg_handle_t h)
-{
-	group_t *g;
-
-	list_for_each_entry(g, &gd_groups, list) {
-		if (g->cpg_handle == h)
-			return g;
-	}
-	return NULL;
-}
-
-void deliver_cb(cpg_handle_t handle, struct cpg_name *group_name,
-		uint32_t nodeid, uint32_t pid, void *data, int data_len)
-{
-	group_t *g;
-	struct save_msg *save;
-	msg_t *msg = (msg_t *) data;
-	char *buf;
-	char name[MAX_NAMELEN+1];
-	uint32_t to_nodeid, counter;
-	int len;
-
-	memset(&name, 0, sizeof(name));
-
-	msg_bswap_in(msg);
-
-	if (msg->ms_type == MSG_GROUP_VERSION) {
-		receive_version(nodeid, msg, data_len);
-		return;
-	}
-
-	if (msg->ms_type == MSG_GLOBAL_ID) {
-		to_nodeid = msg->ms_global_id & 0x0000FFFF;
-		counter = (msg->ms_global_id >> 16) & 0x0000FFFF;
-
-		if (to_nodeid == our_nodeid) {
-			log_debug("recv global_id %x from %u cur counter %u",
-			  	  msg->ms_global_id, nodeid, global_id_counter);
-			if (counter > global_id_counter)
-				global_id_counter = counter;
-		}
-		return;
-	}
-
-	if (handle == groupd_handle) {
-		memcpy(&name, &msg->ms_name, MAX_NAMELEN);
-
-		g = find_group_level(name, msg->ms_level);
-		if (!g) {
-			if (daemon_debug_verbose > 1) {
-				log_print("%d:%s RECV len %d %s from %d, "
-					  "no group",
-				  	  msg->ms_level, name, data_len,
-				  	  msg_type(msg->ms_type), nodeid);
-			}
-			return;
-		}
-	} else {
-		if (group_mode != GROUP_LIBGROUP)
-			return;
-
-		g = find_group_by_handle(handle);
-		if (!g) {
-			len = group_name->length;
-			if (len > MAX_NAMELEN)
-				len = MAX_NAMELEN;
-			memcpy(&name, &group_name->value, len);
-
-			log_print("deliver_cb no group handle %llx name %s",
-				  (unsigned long long)handle, name);
-			return;
-		}
-	}
-
-	if (daemon_debug_verbose > 1)
-		log_group(g, "RECV len %d %s from %d", data_len,
-			  msg_type(msg->ms_type), nodeid);
-
-	save = malloc(sizeof(struct save_msg));
-	// FIXME: handle failed malloc
-	memset(save, 0, sizeof(struct save_msg));
-	save->nodeid = nodeid;
-	save->msg_len = data_len;
-
-	if (data_len > sizeof(msg_t)) {
-		buf = malloc(data_len);
-		// FIXME: handle failed malloc
-		memcpy(buf, data, data_len);
-		save->msg_long = buf;
-		memcpy(&save->msg, data, sizeof(msg_t));
-	} else
-		memcpy(&save->msg, data, sizeof(msg_t));
-
-	queue_app_message(g, save);
-}
-
-void process_confchg(void)
-{
-	group_t *g;
-	int i;
-
-	if (saved_handle == groupd_handle) {
-		process_groupd_confchg();
-		return;
-	}
-
-	if (group_mode != GROUP_LIBGROUP)
-		return;
-
-	g = find_group_by_handle(saved_handle);
-	if (!g) {
-		log_debug("confchg: no group for handle %llx name %s",
-			  (unsigned long long)saved_handle,
-			  saved_name.value);
-		return;
-	}
-
-	log_group(g, "confchg left %d joined %d total %d",
-		  saved_left_count, saved_joined_count, saved_member_count);
-
-	for (i = 0; i < saved_joined_count; i++)
-		process_node_join(g, saved_joined[i].nodeid);
-
-	for (i = 0; i < saved_left_count; i++) {
-		log_group(g, "confchg removed node %d reason %d",
-			  saved_left[i].nodeid, saved_left[i].reason);
-
-		switch (saved_left[i].reason) {
-		case CPG_REASON_LEAVE:
-			process_node_leave(g, saved_left[i].nodeid);
-			break;
-		case CPG_REASON_NODEDOWN:
-		case CPG_REASON_PROCDOWN:
-			/* process_node_down(g, saved_left[i].nodeid); */
-			purge_node_messages(g, saved_left[i].nodeid);
-			break;
-		default:
-			log_error(g, "unknown leave reason %d node %d",
-				  saved_left[i].reason,
-				  saved_joined[i].nodeid);
-		}
-	}
-}
-
-void confchg_cb(cpg_handle_t handle, struct cpg_name *group_name,
-		struct cpg_address *member_list, int member_list_entries,
-		struct cpg_address *left_list, int left_list_entries,
-		struct cpg_address *joined_list, int joined_list_entries)
-{
-	group_t *g;
-	char *name = "unknown";
-	int i, level = -1;
-
-	if (handle == groupd_handle)
-		name = "groupd";
-	else {
-		g = find_group_by_handle(handle);
-		if (g) {
-			name = g->name;
-			level = g->level;
-		}
-	}
-
-	/*
-	log_debug("%d:%s confchg_cb total %d left %d joined %d", level, name,
-		  member_list_entries, left_list_entries, joined_list_entries);
-	*/
-
-	saved_handle = handle;
-
-	if (left_list_entries > MAX_GROUP_MEMBERS) {
-		log_debug("left_list_entries %d", left_list_entries);
-		left_list_entries = MAX_GROUP_MEMBERS;
-	}
-	if (joined_list_entries > MAX_GROUP_MEMBERS) {
-		log_debug("joined_list_entries %d", joined_list_entries);
-		joined_list_entries = MAX_GROUP_MEMBERS;
-	}
-	if (member_list_entries > MAX_GROUP_MEMBERS) {
-		log_debug("member_list_entries %d", joined_list_entries);
-		member_list_entries = MAX_GROUP_MEMBERS;
-	}
-
-	saved_left_count = left_list_entries;
-	saved_joined_count = joined_list_entries;
-	saved_member_count = member_list_entries;
-
-	memset(&saved_name, 0, sizeof(saved_name));
-	saved_name.length = group_name->length;
-	memcpy(&saved_name.value, &group_name->value, group_name->length);
-
-	for (i = 0; i < left_list_entries; i++)
-		saved_left[i] = left_list[i];
-
-	for (i = 0; i < joined_list_entries; i++)
-		saved_joined[i] = joined_list[i];
-
-	for (i = 0; i < member_list_entries; i++)
-		saved_member[i] = member_list[i];
-
-	got_confchg = 1;
-}
-
-cpg_callbacks_t callbacks = {
-	.cpg_deliver_fn = deliver_cb,
-	.cpg_confchg_fn = confchg_cb,
-};
-
-void process_cpg(int ci)
-{
-	group_t *g = NULL;
-	cpg_error_t error;
-	cpg_handle_t handle;
-	int found = 0;
-	cpg_flow_control_state_t flow_control_state;
-
-	if (ci == groupd_ci) {
-		handle = groupd_handle;
-		goto dispatch;
-	}
-
-	list_for_each_entry(g, &gd_groups, list) {
-		if (g->cpg_client == ci) {
-			handle = g->cpg_handle;
-			found = 1;
-			break;
-		}
-	}
-
-	if (!found) {
-		log_print("process_cpg: no group found for ci %d", ci);
-		sleep(1);
-		return;
-	}
-
- dispatch:
-	got_confchg = 0;
-
-	error = cpg_dispatch(handle, CPG_DISPATCH_ONE);
-	if (error != CPG_OK) {
-		log_print("cpg_dispatch error %d", error);
-		return;
-	}
-
-	error = cpg_flow_control_state_get(handle, &flow_control_state);
-	if (error != CPG_OK)
-		log_error(g, "cpg_flow_control_state_get %d", error);
-	else if (flow_control_state == CPG_FLOW_CONTROL_ENABLED) {
-		message_flow_control_on = 1;
-		log_debug("flow control on");
-	} else {
-		if (message_flow_control_on)
-			log_debug("flow control off");
-		message_flow_control_on = 0;
-	}
-
-	if (got_confchg)
-		process_confchg();
-}
-
-int setup_cpg(void)
-{
-	cpg_error_t error;
-	int fd;
-
-	INIT_LIST_HEAD(&group_nodes);
-
-	error = cpg_initialize(&groupd_handle, &callbacks);
-	if (error != CPG_OK) {
-		log_print("cpg_initialize error %d", error);
-		return error;
-	}
-
-	cpg_fd_get(groupd_handle, &fd);
-
-	groupd_ci = client_add(fd, process_cpg, NULL);
-
-	memset(&groupd_name, 0, sizeof(groupd_name));
-	strcpy(groupd_name.value, "groupd");
-	groupd_name.length = 7;
-
- retry:
-	error = cpg_join(groupd_handle, &groupd_name);
-	if (error == CPG_ERR_TRY_AGAIN) {
-		log_debug("setup_cpg cpg_join retry");
-		sleep(1);
-		goto retry;
-	}
-	if (error != CPG_OK) {
-		log_print("cpg_join error %d", error);
-		cpg_finalize(groupd_handle);
-		return error;
-	}
-
-	log_debug("setup_cpg groupd_handle %llx",
-		  (unsigned long long)groupd_handle);
-
-	return 0;
-}
-
-int do_cpg_join(group_t *g)
-{
-	cpg_error_t error;
-	cpg_handle_t h;
-	struct cpg_name name;
-	int fd, ci, i = 0;
-
-	error = cpg_initialize(&h, &callbacks);
-	if (error != CPG_OK) {
-		log_group(g, "cpg_initialize error %d", error);
-		return error;
-	}
-
-	cpg_fd_get(h, &fd);
-
-	ci = client_add(fd, process_cpg, NULL);
-
-	g->cpg_client = ci;
-	g->cpg_handle = h;
-	g->cpg_fd = fd;
-
-	memset(&name, 0, sizeof(name));
-	sprintf(name.value, "%d_%s", g->level, g->name);
-	name.length = strlen(name.value) + 1;
-
-	log_group(g, "is cpg client %d name %s handle %llx", ci, name.value,
-		  (unsigned long long)h);
-
- retry:
-	error = cpg_join(h, &name);
-	if (error == CPG_ERR_TRY_AGAIN) {
-		log_debug("cpg_join error retry");
-		sleep(1);
-		if (!(++i % 10))
-			log_error(g, "cpg_join error retrying");
-		goto retry;
-	}
-	if (error != CPG_OK) {
-		log_group(g, "cpg_join error %d", error);
-		cpg_finalize(h);
-		return error;
-	}
-
-	log_group(g, "cpg_join ok");
-	return 0;
-}
-
-int do_cpg_leave(group_t *g)
-{
-	cpg_error_t error;
-	struct cpg_name name;
-	int i = 0;
-
-	memset(&name, 0, sizeof(name));
-	sprintf(name.value, "%d_%s", g->level, g->name);
-	name.length = strlen(name.value) + 1;
-
- retry:
-	error = cpg_leave(g->cpg_handle, &name);
-	if (error == CPG_ERR_TRY_AGAIN) {
-		log_debug("cpg_leave error retry");
-		sleep(1);
-		if (!(++i % 10))
-			log_error(g, "cpg_leave error retrying");
-		goto retry;
-	}
-	if (error != CPG_OK) {
-		log_group(g, "cpg_leave error %d", error);
-		return error;
-	}
-
-	log_group(g, "cpg_leave ok");
-	return 0;
-}
-
-static int _send_message(cpg_handle_t h, group_t *g, void *buf, int len)
-{
-	struct iovec iov;
-	cpg_error_t error;
-	int retries = 0;
-
-	iov.iov_base = buf;
-	iov.iov_len = len;
-
- retry:
-	error = cpg_mcast_joined(h, CPG_TYPE_AGREED, &iov, 1);
-	if (error == CPG_ERR_TRY_AGAIN) {
-		retries++;
-		usleep(1000);
-		if (!(retries % 100))
-			log_error(g, "cpg_mcast_joined retry %d", retries);
-		goto retry;
-	} else if (error != CPG_OK)
-		log_error(g, "cpg_mcast_joined error %d handle %llx", error,
-			  (unsigned long long)h);
-
-	if (retries)
-		log_group(g, "cpg_mcast_joined retried %d", retries);
-
-	return 0;
-}
-
-int send_message_groupd(group_t *g, void *buf, int len, int type)
-{
-	if (daemon_debug_verbose > 1)
-		log_group(g, "SEND len %d %s", len, msg_type(type));
-
-	return _send_message(groupd_handle, g, buf, len);
-}
-
-int send_message(group_t *g, void *buf, int len)
-{
-	return _send_message(g->cpg_handle, g, buf, len);
-}
-
-static void block_old_group(char *name, int level)
-{
-	group_t *g;
-	app_t *a;
-	cpg_error_t error;
-	cpg_handle_t h;
-	struct cpg_name cpgname;
-	int rv, fd, ci, i = 0;
-
-	rv = create_group(name, level, &g);
-	if (rv)
-		return;
-	a = create_app(g);
-	if (!a)
-		return;
-
-	error = cpg_initialize(&h, &callbacks);
-	if (error != CPG_OK) {
-		log_print("cpg_initialize error %d", error);
-		return;
-	}
-
-	cpg_fd_get(h, &fd);
-
-	ci = client_add(fd, process_cpg, NULL);
-
-	g->cpg_client = ci;
-	g->cpg_handle = h;
-	g->cpg_fd = fd;
-	g->joining = 1;
-	a->client = ci;
-
-	memset(&cpgname, 0, sizeof(cpgname));
-	sprintf(cpgname.value, "%d_%s", level, name);
-	cpgname.length = strlen(cpgname.value) + 1;
-
- retry:
-	error = cpg_join(h, &cpgname);
-	if (error == CPG_ERR_TRY_AGAIN) {
-		log_debug("cpg_join error retry");
-		sleep(1);
-		if (!(++i % 10))
-			log_print("cpg_join error retrying");
-		goto retry;
-	}
-	if (error != CPG_OK) {
-		log_print("cpg_join error %d", error);
-		cpg_finalize(h);
-		return;
-	}
-}
-
-/* Problem: GROUP_LIBCPG is selected during version detection, then
-   an old cluster2 node starts (people aren't supposed to do this, but it may
-   happen, so it's nice to do what we can to address it).  groupd on the old
-   cluster2 node, using libgroup, will allow new groups to be formed on it.
-   Solution is a hack: when the cluster3 nodes select LIBCPG mode, they also
-   create unused/placeholder cpg's with the names of old known cluster2 groups,
-   which blocks them being fully joined by old groupd's that may come along. */
-
-static void block_old_nodes(void)
-{
-	block_old_group("default", 0);
-	block_old_group("clvmd", 1);
-	block_old_group("rgmanager", 1);
-}
-
diff --git a/group/daemon/gd_internal.h b/group/daemon/gd_internal.h
deleted file mode 100644
index 1927104..0000000
--- a/group/daemon/gd_internal.h
+++ /dev/null
@@ -1,323 +0,0 @@
-#ifndef __GD_INTERNAL_DOT_H__
-#define __GD_INTERNAL_DOT_H__
-
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <stddef.h>
-#include <fcntl.h>
-#include <string.h>
-#include <strings.h>
-#include <ctype.h>
-#include <dirent.h>
-#include <syslog.h>
-#include <time.h>
-#include <sched.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <sys/types.h>
-#include <sys/errno.h>
-#include <sys/poll.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <corosync/cpg.h>
-#include <liblogthread.h>
-
-#include "list.h"
-#include "linux_endian.h"
-#include "groupd.h"
-#include "libgroup.h"
-
-#define MAX_NAMELEN		32	/* should match libgroup.h */
-#define MAX_LEVELS		4
-#define MAX_NODES		128
-
-extern int daemon_debug_opt;
-extern int daemon_debug_verbose;
-extern int daemon_quit;
-extern int cman_quorate;
-extern int our_nodeid;
-extern char *our_name;
-extern char daemon_debug_buf[256];
-extern char dump_buf[GROUPD_DUMP_SIZE];
-extern int dump_point;
-extern int dump_wrap;
-extern struct list_head gd_groups;
-extern struct list_head gd_levels[MAX_LEVELS];
-extern uint32_t gd_event_nr;
-
-#define GROUP_PENDING		1
-#define GROUP_LIBGROUP          2
-#define GROUP_LIBCPG            3
-
-extern int group_mode;
-
-#define DEFAULT_GROUPD_COMPAT		2
-#define DEFAULT_GROUPD_WAIT		5
-#define DEFAULT_GROUPD_MODE_DELAY	2
-#define DEFAULT_DEBUG_LOGFILE		0
-
-extern int optd_groupd_compat;
-extern int optd_groupd_wait;
-extern int optd_groupd_mode_delay;
-extern int optd_debug_logfile;
-
-extern int cfgd_groupd_compat;
-extern int cfgd_groupd_wait;
-extern int cfgd_groupd_mode_delay;
-extern int cfgd_debug_logfile;
-
-void daemon_dump_save(void);
-
-#define log_level(lvl, fmt, args...) \
-do { \
-	snprintf(daemon_debug_buf, 255, "%ld " fmt "\n", time(NULL), ##args); \
-	daemon_dump_save(); \
-	logt_print(lvl, fmt "\n", ##args); \
-	if (daemon_debug_opt) \
-		fprintf(stderr, "%s", daemon_debug_buf); \
-} while (0)
-
-#define log_debug(fmt, args...) log_level(LOG_DEBUG, fmt, ##args)
-#define log_print(fmt, args...) log_level(LOG_ERR, fmt, ##args)
-
-#define log_group(g, fmt, args...) \
-do { \
-	snprintf(daemon_debug_buf, 255, "%ld %d:%s " fmt "\n", time(NULL), \
-		 (g)->level, (g)->name, ##args); \
-	daemon_dump_save(); \
-	logt_print(LOG_DEBUG, fmt "\n", ##args); \
-	if (daemon_debug_opt) \
-		fprintf(stderr, "%s", daemon_debug_buf); \
-} while (0)
-
-#define log_error(g, fmt, args...) \
-do { \
-	snprintf(daemon_debug_buf, 255, "%ld %d:%s " fmt "\n", time(NULL), \
-		 (g)->level, (g)->name, ##args); \
-	daemon_dump_save(); \
-	logt_print(LOG_ERR, fmt "\n", ##args); \
-	if (daemon_debug_opt) \
-		fprintf(stderr, "%s", daemon_debug_buf); \
-} while (0)
-
-#define ASSERT(x) \
-do { \
-	if (!(x)) { \
-		log_print("Assertion failed on line %d of file %s\n" \
-			  "Assertion:  \"%s\"\n", __LINE__, __FILE__, #x); \
-	} \
-} while (0)
-
-#ifndef TRUE
-#define TRUE (1)
-#endif
-#ifndef FALSE
-#define FALSE (0)
-#endif
-
-struct group;
-struct app;
-struct event;
-struct node;
-struct msg;
-typedef struct group group_t;
-typedef struct app app_t;
-typedef struct event event_t;
-typedef struct node node_t;
-typedef struct msg msg_t;
-
-
-/*
- * Event - manages nodes joining/leaving/failing
- */
-
-#define EST_JOIN_BEGIN         1
-#define EST_JOIN_STOP_WAIT     2
-#define EST_JOIN_ALL_STOPPED   3
-#define EST_JOIN_START_WAIT    4
-#define EST_JOIN_ALL_STARTED   5
-#define EST_LEAVE_BEGIN        6
-#define EST_LEAVE_STOP_WAIT    7
-#define EST_LEAVE_ALL_STOPPED  8
-#define EST_LEAVE_START_WAIT   9
-#define EST_LEAVE_ALL_STARTED 10
-#define EST_FAIL_BEGIN        11
-#define EST_FAIL_STOP_WAIT    12
-#define EST_FAIL_ALL_STOPPED  13
-#define EST_FAIL_START_WAIT   14
-#define EST_FAIL_ALL_STARTED  15
-
-struct event {
-	struct list_head 	list;
-	struct list_head	memb;
-	int			event_nr;
-	int 			state;
-	int			nodeid;
-	uint64_t		id;
-	struct list_head	extended;
-	int			start_app_before_pending_rev;
-	int			fail_all_stopped;
-};
-
-/*
- * Group
- */
-
-struct group {
-	struct list_head 	list;		/* list of groups */
-	struct list_head	level_list;
-	uint16_t 		level;
-	uint32_t		global_id;
-	struct list_head 	memb;
-	int 			memb_count;
-	int 			namelen;
-	char 			name[MAX_NAMELEN+1];
-	app_t 			*app;
-	struct list_head  	messages;
-	cpg_handle_t		cpg_handle;
-	int			cpg_fd;
-	int			cpg_client;
-	int			have_set_id;
-	int			joining;
-	int			leaving;
-};
-
-struct app {
-	int			client;
-	int 			node_count;
-	struct list_head 	nodes;
-	struct list_head	events;
-	event_t			*current_event;
-	group_t			*g;
-	int			need_first_event; /* for debugging */
-};
-
-#define MSG_APP_STOPPED        1
-#define MSG_APP_STARTED        2
-#define MSG_APP_RECOVER        3
-#define MSG_APP_INTERNAL       4
-#define MSG_GLOBAL_ID          5
-#define MSG_GROUP_VERSION      6
-
-#define MSG_VER_MAJOR          1
-#define MSG_VER_MINOR          1
-#define MSG_VER_PATCH          0
-
-struct msg {
-	uint32_t		ms_version[3];
-	uint16_t 		ms_type;
-	uint16_t		ms_level;
-	uint32_t 		ms_length;
-	uint32_t 		ms_global_id;
-	uint64_t		ms_event_id;
-	char			ms_name[MAX_NAMELEN];
-};
-
-struct save_msg {
-	struct list_head	list;
-	int			nodeid;
-	int			print_ignore;
-	int			msg_len;
-	msg_t			msg;
-	char			*msg_long;
-};
-
-struct node {
-	struct list_head 	list;
-	int			nodeid;
-	int			stopped;
-	int			started;
-};
-
-struct recovery_set {
-	struct list_head	list;
-	struct list_head	entries;
-	int			nodeid;
-	int			cman_update;
-	int			cpg_update;
-};
-
-struct recovery_entry {
-	struct list_head	list;
-	group_t			*group;
-	int			recovered;
-};
-
-
-/* app.c */
-void add_recovery_set_cman(int nodeid);
-struct recovery_set *add_recovery_set_cpg(int nodeid, int procdown);
-int queue_app_recover(group_t *g, int nodeid);
-int queue_app_join(group_t *g, int nodeid);
-int queue_app_leave(group_t *g, int nodeid);
-int queue_app_message(group_t *g, struct save_msg *save);
-int do_stopdone(char *name, int level);
-int do_startdone(char *name, int level, int event_nr);
-char *ev_state_str(event_t *ev);
-event_t *find_queued_recover_event(group_t *g);
-void extend_recover_event(group_t *g, event_t *ev, int nodeid);
-int process_apps(void);
-void del_event_nodes(event_t *ev);
-void dump_group(group_t *g);
-void dump_all_groups(void);
-node_t *find_app_node(app_t *a, int nodeid);
-int event_state_stopping(app_t *a);
-int event_state_starting(app_t *a);
-void msg_bswap_out(msg_t *msg);
-void msg_bswap_in(msg_t *msg);
-struct recovery_set *get_recovery_set(int nodeid);
-void groupd_down(int nodeid);
-char *msg_type(int type);
-int process_app(group_t *g);
-int is_our_join(event_t *ev);
-void purge_node_messages(group_t *g, int nodeid);
-
-/* main.c */
-void read_ccs_name(char *path, char *name);
-void read_ccs_yesno(char *path, int *yes, int *no);
-void read_ccs_int(char *path, int *config_val);
-void app_stop(app_t *a);
-void app_setid(app_t *a);
-void app_start(app_t *a);
-void app_finish(app_t *a);
-void app_terminate(app_t *a);
-void app_deliver(app_t *a, struct save_msg *save);
-int client_add(int fd, void (*workfn)(int ci), void (*deadfn)(int ci));
-void client_dead(int ci);
-void cluster_dead(int ci);
-
-/* cman.c */
-int setup_cman(void);
-void close_cman(void);
-void process_cman(int ci);
-int kill_cman(int nodeid);
-
-/* cpg.c */
-int setup_cpg(void);
-int do_cpg_join(group_t *g);
-int do_cpg_leave(group_t *g);
-int send_message(group_t *g, void *buf, int len);
-int send_message_groupd(group_t *g, void *buf, int len, int type);
-void copy_groupd_data(group_data_t *data);
-int in_groupd_cpg(int nodeid);
-void group_mode_check_timeout(void);
-
-/* joinleave.c */
-void remove_group(group_t *g);
-int do_join(char *name, int level, int ci);
-int do_leave(char *name, int level);
-node_t *new_node(int nodeid);
-group_t *find_group_level(char *name, int level);
-int create_group(char *name, int level, group_t **g_out);
-app_t *create_app(group_t *g);
-
-/* logging.c */
-
-void init_logging(void);
-void setup_logging();
-void close_logging(void);
-
-#endif				/* __GD_INTERNAL_DOT_H__ */
-
diff --git a/group/daemon/groupd.h b/group/daemon/groupd.h
deleted file mode 100644
index 69bd1fc..0000000
--- a/group/daemon/groupd.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef __GROUPD_DOT_H__
-#define __GROUPD_DOT_H__
-
-#define GROUPD_SOCK_PATH        ("groupd_socket")
-#define NODE_FAILED		(1)
-#define NODE_JOIN		(2)
-#define NODE_LEAVE		(3)
-#define GROUPD_MSGLEN		(2200) /* should be enough to permit
-					  group_send() of up to 2048 bytes
-					  of data plus header info */
-#define GROUPD_DUMP_SIZE	(1024 * 1024)
-
-#endif
diff --git a/group/daemon/joinleave.c b/group/daemon/joinleave.c
deleted file mode 100644
index 95cc444..0000000
--- a/group/daemon/joinleave.c
+++ /dev/null
@@ -1,165 +0,0 @@
-
-/* Initiate join/leave requests from apps */
-
-#include "gd_internal.h"
-
-
-group_t *find_group_level(char *name, int level)
-{
-	group_t *g;
-
-	list_for_each_entry(g, &gd_levels[level], level_list) {
-		if (!strcmp(g->name, name))
-			return g;
-	}
-	return NULL;
-}
-
-int create_group(char *name, int level, group_t **g_out)
-{
-	group_t *g;
-
-	g = malloc(sizeof(*g));
-	if (!g)
-		return -ENOMEM;
-
-	memset(g, 0, sizeof(*g));
-
-	strcpy(g->name, name);
-	g->namelen = strlen(name);
-	g->level = level;
-	INIT_LIST_HEAD(&g->memb);
-	INIT_LIST_HEAD(&g->messages);
-
-	list_add_tail(&g->list, &gd_groups);
-	list_add_tail(&g->level_list, &gd_levels[level]);
-
-	*g_out = g;
-	return 0;
-}
-
-void free_group_memb(group_t *g)
-{
-	node_t *node, *n;
-
-	list_for_each_entry_safe(node, n, &g->memb, list) {
-		list_del(&node->list);
-		free(node);
-	}
-}
-
-void remove_group(group_t *g)
-{
-	list_del(&g->list);
-	list_del(&g->level_list);
-	free_group_memb(g);
-	free(g);
-}
-
-app_t *create_app(group_t *g)
-{
-	app_t *a;
-
-	a = malloc(sizeof(app_t));
-	if (!a)
-		return NULL;
-	memset(a, 0, sizeof(app_t));
-
-	a->need_first_event = 1;
-	INIT_LIST_HEAD(&a->nodes);
-	INIT_LIST_HEAD(&a->events);
-	a->g = g;
-	g->app = a;
-
-	return a;
-}
-
-int do_join(char *name, int level, int ci)
-{
-	group_t *g;
-	app_t *a;
-	int rv;
-
-	g = find_group_level(name, level);
-	if (g) {
-		log_group(g, "%d:%s can't join existing group", level, name);
-		rv = -EEXIST;
-		goto out;
-	}
-
-	rv = create_group(name, level, &g);
-	if (rv)
-		goto out;
-
-	a = create_app(g);
-	if (!a) {
-		rv = -ENOMEM;
-		goto out;
-	}
-
-	a->client = ci;
-
-	log_debug("%d:%s got join", level, name);
-	g->joining = 1;
-	rv = do_cpg_join(g);
- out:
-	return rv;
-}
-
-int do_leave(char *name, int level)
-{
-	group_t *g;
-	event_t *ev;
-	int rv;
-
-	g = find_group_level(name, level);
-	if (!g)
-		return -ENOENT;
-
-	if (!g->app) {
-		log_group(g, "leave: no app");
-		return -EINVAL;
-	}
-
-	if (g->joining) {
-		log_error(g, "leave: still joining");
-		return -EAGAIN;
-	}
-
-	if (g->leaving) {
-		log_error(g, "leave: already leaving");
-		return -EBUSY;
-	}
-
-	ev = g->app->current_event;
-
-	if (ev && ev->nodeid == our_nodeid) {
-		log_error(g, "leave: busy event %llx state %s",
-			  (unsigned long long)ev->id,
-			  ev_state_str(ev));
-		return -EAGAIN;
-	}
-
-	list_for_each_entry(ev, &g->app->events, list) {
-		ASSERT(ev->nodeid != our_nodeid);
-		log_group(g, "do_leave: found queued event id %llx",
-			  (unsigned long long)ev->id);
-	}
-
-	log_debug("%d:%s got leave", level, name);
-	g->leaving = 1;
-	rv = do_cpg_leave(g);
-	return rv;
-}
-
-node_t *new_node(int nodeid)
-{
-	node_t *node;
-
-	node = malloc(sizeof(*node));
-	// FIXME: handle failed malloc
-	memset(node, 0, sizeof(*node));
-	node->nodeid = nodeid;
-	return node;
-}
-
diff --git a/group/daemon/logging.c b/group/daemon/logging.c
deleted file mode 100644
index e3cd636..0000000
--- a/group/daemon/logging.c
+++ /dev/null
@@ -1,60 +0,0 @@
-#include "gd_internal.h"
-#include "ccs.h"
-
-extern int ccs_handle;
-
-#define DAEMON_NAME "groupd"
-#define DEFAULT_LOG_MODE LOG_MODE_OUTPUT_FILE|LOG_MODE_OUTPUT_SYSLOG
-#define DEFAULT_SYSLOG_FACILITY		SYSLOGFACILITY
-#define DEFAULT_SYSLOG_PRIORITY		SYSLOGLEVEL
-#define DEFAULT_LOGFILE_PRIORITY	LOG_INFO /* ? */
-#define DEFAULT_LOGFILE			LOGDIR "/" DAEMON_NAME ".log"
-
-static int log_mode;
-static int syslog_facility;
-static int syslog_priority;
-static int logfile_priority;
-static char logfile[PATH_MAX];
-
-void init_logging(void)
-{
-	log_mode = DEFAULT_LOG_MODE;
-	syslog_facility = DEFAULT_SYSLOG_FACILITY;
-	syslog_priority = DEFAULT_SYSLOG_PRIORITY;
-	logfile_priority = DEFAULT_LOGFILE_PRIORITY;
-	strcpy(logfile, DEFAULT_LOGFILE);
-
-	/* logfile_priority is the only one of these options that
-	   can be controlled from command line or environment variable */
-
-	if (cfgd_debug_logfile)
-		logfile_priority = LOG_DEBUG;
-
-	log_debug("logging mode %d syslog f %d p %d logfile p %d %s",
-		  log_mode, syslog_facility, syslog_priority,
-		  logfile_priority, logfile);
-
-	logt_init(DAEMON_NAME, log_mode, syslog_facility, syslog_priority,
-		  logfile_priority, logfile);
-}
-
-void setup_logging(void)
-{
-	ccs_read_logging(ccs_handle, DAEMON_NAME,
-			 &cfgd_debug_logfile, &log_mode,
-			 &syslog_facility, &syslog_priority,
-			 &logfile_priority, logfile);
-
-	log_debug("logging mode %d syslog f %d p %d logfile p %d %s",
-		  log_mode, syslog_facility, syslog_priority,
-		  logfile_priority, logfile);
-
-	logt_conf(DAEMON_NAME, log_mode, syslog_facility, syslog_priority,
-		  logfile_priority, logfile);
-}
-
-void close_logging(void)
-{
-	logt_exit();
-}
-
diff --git a/group/daemon/main.c b/group/daemon/main.c
deleted file mode 100644
index 5b07505..0000000
--- a/group/daemon/main.c
+++ /dev/null
@@ -1,1082 +0,0 @@
-#include <signal.h>
-#include <time.h>
-
-#include "gd_internal.h"
-#include "ccs.h"
-#include "copyright.cf"
-
-#define LOCKFILE_NAME	"/var/run/groupd.pid"
-#define CLIENT_NALLOC	32
-
-extern struct list_head recovery_sets;
-
-static int client_maxi;
-static int client_size = 0;
-static struct client *client = NULL;
-static struct pollfd *pollfd = NULL;
-static char last_action[16];
-int ccs_handle;
-
-struct client {
-	int fd;
-	int level;
-	char type[32];
-	void *workfn;
-	void *deadfn;
-};
-
-static int do_read(int fd, void *buf, size_t count)
-{
-	int rv, off = 0;
-
-	while (off < count) {
-		rv = read(fd, buf + off, count - off);
-		if (rv == 0)
-			return -1;
-		if (rv == -1 && errno == EINTR)
-			continue;
-		if (rv == -1)
-			return -1;
-		off += rv;
-	}
-	return 0;
-}
-
-static int do_write(int fd, void *buf, size_t count)
-{
-	int rv, off = 0;
-
- retry:
-	rv = write(fd, buf + off, count);
-	if (rv == -1 && errno == EINTR)
-		goto retry;
-	if (rv < 0) {
-		log_print("write fd %d errno %d", fd, errno);
-		return rv;
-	}
-
-	if (rv != count) {
-		count -= rv;
-		off += rv;
-		goto retry;
-	}
-	return 0;
-}
-
-void read_ccs_name(char *path, char *name)
-{
-	char *str;
-	int error;
-
-	error = ccs_get(ccs_handle, path, &str);
-	if (error || !str)
-		return;
-
-	strcpy(name, str);
-
-	free(str);
-}
-
-void read_ccs_yesno(char *path, int *yes, int *no)
-{
-	char *str;
-	int error;
-
-	*yes = 0;
-	*no = 0;
-
-	error = ccs_get(ccs_handle, path, &str);
-	if (error || !str)
-		return;
-
-	if (!strcmp(str, "yes"))
-		*yes = 1;
-
-	else if (!strcmp(str, "no"))
-		*no = 1;
-
-	free(str);
-}
-
-void read_ccs_int(char *path, int *config_val)
-{
-	char *str;
-	int val;
-	int error;
-
-	error = ccs_get(ccs_handle, path, &str);
-	if (error || !str)
-		return;
-
-	val = atoi(str);
-
-	if (val < 0) {
-		log_print("ignore invalid value %d for %s", val, path);
-		return;
-	}
-
-	*config_val = val;
-	log_debug("%s is %u", path, val);
-	free(str);
-}
-
-#define GROUPD_COMPAT_PATH "/cluster/group/@groupd_compat"
-#define GROUPD_WAIT_PATH "/cluster/group/@groupd_wait"
-#define GROUPD_MODE_DELAY_PATH "/cluster/group/@groupd_mode_delay"
-
-int setup_ccs(void)
-{
-	int cd;
-
-	cd = ccs_connect();
-	if (cd < 0) {
-		log_print("ccs_connect error %d %d", cd, errno);
-		return -1;
-	}
-	ccs_handle = cd;
-
-	/* These config values are set from cluster.conf only if they haven't
-	   already been set on the command line. */
-
-	if (!optd_groupd_compat)
-		read_ccs_int(GROUPD_COMPAT_PATH, &cfgd_groupd_compat);
-
-	if (!optd_groupd_wait)
-		read_ccs_int(GROUPD_WAIT_PATH, &cfgd_groupd_wait);
-
-	if (!optd_groupd_mode_delay)
-		read_ccs_int(GROUPD_MODE_DELAY_PATH, &cfgd_groupd_mode_delay);
-
-	return 0;
-}
-
-void close_ccs(void)
-{
-	ccs_disconnect(ccs_handle);
-}
-
-static void app_action(app_t *a, char *buf)
-{
-	int rv;
-
-	log_group(a->g, "action for app: %s", buf);
-
-	rv = do_write(client[a->client].fd, buf, GROUPD_MSGLEN);
-	if (rv < 0)
-		log_error(a->g, "app_action write error");
-}
-
-void app_deliver(app_t *a, struct save_msg *save)
-{
-	char buf[GROUPD_MSGLEN];
-	int rv;
-
-	rv = snprintf(buf, sizeof(buf), "deliver %s %d %d",
-		      a->g->name, save->nodeid,
-		      (int)(save->msg_len - sizeof(msg_t)));
-
-	log_group(a->g, "deliver to app: %s", buf);
-
-	memcpy(buf + rv + 1, save->msg_long + sizeof(msg_t),
-	       save->msg_len - sizeof(msg_t));
-
-	/*
-	log_group(a->g, "app_deliver body len %d \"%s\"",
-		  save->msg_len - sizeof(msg_t),
-		  save->msg_long + sizeof(msg_t));
-	*/
-
-	rv = do_write(client[a->client].fd, buf, GROUPD_MSGLEN);
-	if (rv < 0)
-		log_error(a->g, "app_deliver write error");
-}
-
-void app_terminate(app_t *a)
-{
-	char buf[GROUPD_MSGLEN];
-	snprintf(buf, sizeof(buf), "terminate %s", a->g->name);
-	app_action(a, buf);
-}
-
-void app_stop(app_t *a)
-{
-	char buf[GROUPD_MSGLEN];
-	snprintf(buf, sizeof(buf), "stop %s", a->g->name);
-	app_action(a, buf);
-}
-
-void app_setid(app_t *a)
-{
-	char buf[GROUPD_MSGLEN];
-	snprintf(buf, sizeof(buf), "setid %s %u", a->g->name, a->g->global_id);
-	app_action(a, buf);
-}
-
-void app_start(app_t *a)
-{
-	char buf[GROUPD_MSGLEN];
-	int len = 0, type, count = 0;
-	node_t *node;
-
-	if (a->current_event->state == EST_JOIN_START_WAIT)
-		type = NODE_JOIN;
-	else if (a->current_event->state == EST_LEAVE_START_WAIT)
-		type = NODE_LEAVE;
-	else if (a->current_event->state == EST_FAIL_START_WAIT)
-		type = NODE_FAILED;
-	else {
-		/* report error */
-		type = -1;
-	}
-
-	/* start <name> <event_nr> <type> <count> <memb0> <memb1>... */
-
-	list_for_each_entry(node, &a->nodes, list)
-		count++;
-
-	len = snprintf(buf, sizeof(buf), "start %s %d %d %d",
-		       a->g->name, a->current_event->event_nr, type, count);
-
-	list_for_each_entry(node, &a->nodes, list)
-		len += sprintf(buf+len, " %d", node->nodeid);
-
-	app_action(a, buf);
-}
-
-void app_finish(app_t *a)
-{
-	char buf[GROUPD_MSGLEN];
-	snprintf(buf, sizeof(buf), "finish %s %d",
-		 a->g->name, a->current_event->event_nr);
-	app_action(a, buf);
-}
-
-#define MAXARGS 16
-
-static char *get_args(char *buf, int *argc, char **argv, char sep, int want)
-{
-	char *p = buf, *rp = NULL;
-	int i;
-
-	argv[0] = p;
-
-	for (i = 1; i < MAXARGS; i++) {
-		p = strchr(buf, sep);
-		if (!p)
-			break;
-		*p = '\0';
-
-		if (want == i) {
-			rp = p + 1;
-			break;
-		}
-
-		argv[i] = p + 1;
-		buf = p + 1;
-	}
-	*argc = i;
-
-	/* we ended by hitting \0, return the point following that */
-	if (!rp)
-		rp = strchr(buf, '\0') + 1;
-
-	return rp;
-}
-
-enum {
-	DO_SETUP = 1,
-	DO_JOIN,
-	DO_LEAVE,
-	DO_STOP_DONE,
-	DO_START_DONE,
-	DO_SEND,
-	DO_GET_GROUPS,
-	DO_GET_GROUP,
-	DO_DUMP,
-	DO_LOG,
-	DO_GET_VERSION,
-};
-
-int get_action(char *buf)
-{
-	char act[16];
-	int i;
-
-	memset(act, 0, 16);
-
-	for (i = 0; i < 16; i++) {
-		if (isalnum(buf[i]) || ispunct(buf[i]))
-			act[i] = buf[i];
-		else
-			break;
-	}
-
-	/* for debug message */
-	memset(&last_action, 0, 16);
-	memcpy(last_action, act, 16);
-
-	if (!strncmp(act, "setup", 16))
-		return DO_SETUP;
-
-	if (!strncmp(act, "join", 16))
-		return DO_JOIN;
-
-	if (!strncmp(act, "leave", 16))
-		return DO_LEAVE;
-
-	if (!strncmp(act, "stop_done", 16))
-		return DO_STOP_DONE;
-
-	if (!strncmp(act, "start_done", 16))
-		return DO_START_DONE;
-
-	if (!strncmp(act, "send", 16))
-		return DO_SEND;
-
-	if (!strncmp(act, "get_groups", 16))
-		return DO_GET_GROUPS;
-
-	if (!strncmp(act, "get_group", 16))
-		return DO_GET_GROUP;
-
-	if (!strncmp(act, "get_version", 16))
-		return DO_GET_VERSION;
-
-	if (!strncmp(act, "dump", 16))
-		return DO_DUMP;
-
-	if (!strncmp(act, "log", 16))
-		return DO_LOG;
-
-	return -1;
-}
-
-static void client_alloc(void)
-{
-	int i;
-
-	if (!client) {
-		client = malloc(CLIENT_NALLOC * sizeof(struct client));
-		pollfd = malloc(CLIENT_NALLOC * sizeof(struct pollfd));
-	} else {
-		client = realloc(client, (client_size + CLIENT_NALLOC) *
-					 sizeof(struct client));
-		pollfd = realloc(pollfd, (client_size + CLIENT_NALLOC) *
-					 sizeof(struct pollfd));
-		if (!pollfd)
-			log_print("can't alloc for pollfd");
-	}
-	if (!client || !pollfd)
-		log_print("can't alloc for client array");
-
-	for (i = client_size; i < client_size + CLIENT_NALLOC; i++) {
-		client[i].workfn = NULL;
-		client[i].deadfn = NULL;
-		client[i].fd = -1;
-		client[i].level = -1;
-		memset(client[i].type, 0, sizeof(client[i].type));
-		pollfd[i].fd = -1;
-		pollfd[i].revents = 0;
-	}
-	client_size += CLIENT_NALLOC;
-}
-
-void client_dead(int ci)
-{
-	close(client[ci].fd);
-	client[ci].workfn = NULL;
-	client[ci].fd = -1;
-	pollfd[ci].fd = -1;
-}
-
-int client_add(int fd, void (*workfn)(int ci), void (*deadfn)(int ci))
-{
-	int i;
-
-	if (!client)
-		client_alloc();
- again:
-	for (i = 0; i < client_size; i++) {
-		if (client[i].fd == -1) {
-			client[i].workfn = workfn;
-			if (deadfn)
-				client[i].deadfn = deadfn;
-			else
-				client[i].deadfn = client_dead;
-			client[i].fd = fd;
-			pollfd[i].fd = fd;
-			pollfd[i].events = POLLIN;
-			if (i > client_maxi)
-				client_maxi = i;
-			return i;
-		}
-	}
-
-	client_alloc();
-	goto again;
-}
-
-static void sigterm_handler(int sig)
-{
-	daemon_quit = 1;
-}
-
-static void do_setup(int ci, int argc, char **argv)
-{
-	log_debug("setup %s %s", argv[1], argv[2]);
-
-	strcpy(client[ci].type, argv[1]);
-	client[ci].level = atoi(argv[2]);
-}
-
-static void copy_group_data(group_t *g, group_data_t *data)
-{
-	node_t *node;
-	event_t *ev;
-	int i = 0;
-
-	strncpy(data->client_name, client[g->app->client].type, 32);
-	strncpy(data->name, g->name, MAX_GROUP_NAME_LEN);
-	data->level = g->level;
-	data->id = g->global_id;
-
-	if (g->app && g->app->current_event) {
-		event_t *ev = g->app->current_event;
-		data->event_state = ev->state;
-		data->event_nodeid = ev->nodeid;
-		data->event_id = ev->id;
-		data->event_local_status = -2;
-
-		node = find_app_node(g->app, our_nodeid);
-		if (node) {
-			if (event_state_stopping(g->app))
-				data->event_local_status = node->stopped;
-			else if (event_state_starting(g->app))
-				data->event_local_status = node->started;
-			else
-				data->event_local_status = -1;
-		}
-	}
-
-	data->member_count = g->app->node_count;
-	list_for_each_entry(node, &g->app->nodes, list) {
-		data->members[i] = node->nodeid;
-		i++;
-
-		if (node->nodeid == our_nodeid)
-			data->member = 1;
-	}
-
-	/* we're in the member list but are still joining */
-	if (data->member) {
-		ev = g->app->current_event;
-		if (ev && is_our_join(ev) &&
-		    (ev->state <= EST_JOIN_ALL_STARTED))
-			data->member = 0;
-	}
-}
-
-static int do_get_groups(int ci, int argc, char **argv)
-{
-	group_t *g;
-	group_data_t *data;
-	int rv, count = 0, max = atoi(argv[1]);
-
-	data = malloc(sizeof(group_data_t));
-	// FIXME: handle failed malloc
-	count = 0;
-
-	list_for_each_entry(g, &gd_groups, list) {
-		memset(data, 0, sizeof(group_data_t));
-		copy_group_data(g, data);
-		rv = do_write(client[ci].fd, data, sizeof(group_data_t));
-		if (rv < 0) {
-			log_print("do_get_groups write error");
-			break;
-		}
-		count++;
-		if (count >= max)
-			break;
-	}
-	/* Now write an empty one indicating there aren't anymore: */
-	memset(data, 0, sizeof(group_data_t));
-	rv = do_write(client[ci].fd, data, sizeof(group_data_t));
-	free(data);
-	return 0;
-}
-
-static int do_get_group(int ci, int argc, char **argv)
-{
-	group_t *g;
-	group_data_t data;
-	int rv;
-
-	memset(&data, 0, sizeof(data));
-
-	/* special case to get members of groupd cpg */
-	if (atoi(argv[1]) == -1 && !strncmp(argv[2], "groupd", 6)) {
-		copy_groupd_data(&data);
-		goto out;
-	}
-
-	g = find_group_level(argv[2], atoi(argv[1]));
-	if (!g)
-		goto out;
-
-	copy_group_data(g, &data);
- out:
-	rv = do_write(client[ci].fd, &data, sizeof(data));
-	if (rv < 0)
-		log_print("do_get_group write error");
-
-	return 0;
-}
-
-static int do_get_version(int ci)
-{
-	int mode;
-	int rv;
-
-	if (group_mode == GROUP_PENDING)
-		mode = -EAGAIN;
-	else
-		mode = group_mode;
-
-	rv = do_write(client[ci].fd, &mode, sizeof(mode));
-	if (rv < 0)
-		log_print("do_get_version write error");
-
-	return 0;
-}
-
-static int do_dump(int fd)
-{
-	int len;
-
-	if (dump_wrap) {
-		len = GROUPD_DUMP_SIZE - dump_point;
-		do_write(fd, dump_buf + dump_point, len);
-		len = dump_point;
-	} else
-		len = dump_point;
-
-	/* NUL terminate the debug string */
-	dump_buf[dump_point] = '\0';
-
-	do_write(fd, dump_buf, len);
-
-	return 0;
-}
-
-static int do_log(int fd, const char *comment)
-{
-	log_print("%s", comment);
-	return 0;
-}
-
-static void do_send(char *name, int level, int len, char *data)
-{
-	group_t *g;
-	msg_t *msg;
-	char *buf;
-	int total;
-
-	g = find_group_level(name, level);
-	if (!g)
-		return;
-
-	total = sizeof(msg_t) + len;
-	buf = malloc(total);
-	// FIXME: handle failed malloc
-	memset(buf, 0, total);
-
-	memcpy(buf + sizeof(msg_t), data, len);
-
-	msg = (msg_t *) buf;
-	msg->ms_type = MSG_APP_INTERNAL;
-	msg->ms_global_id = g->global_id;
-
-	log_debug("%d:%s do_send %d bytes", level, name, total);
-
-	send_message(g, msg, total);
-
-	free(buf);
-}
-
-static void process_connection(int ci)
-{
-	char buf[GROUPD_MSGLEN], *argv[MAXARGS], *p;
-	int argc = 0, rv, act;
-
-	memset(buf, 0, sizeof(buf));
-	memset(argv, 0, sizeof(char *) * MAXARGS);
-
-	rv = do_read(client[ci].fd, buf, GROUPD_MSGLEN);
-	if (rv < 0) {
-		client_dead(ci);
-		return;
-	}
-
-	act = get_action(buf);
-
-	log_debug("got client %d %s", ci, last_action);
-
-	switch (act) {
-
-	case DO_SETUP:
-		get_args(buf, &argc, argv, ' ', 3);
-		do_setup(ci, argc, argv);
-		break;
-
-	case DO_JOIN:
-		get_args(buf, &argc, argv, ' ', 2);
-		do_join(argv[1], client[ci].level, ci);
-		break;
-
-	case DO_LEAVE:
-		get_args(buf, &argc, argv, ' ', 2);
-		do_leave(argv[1], client[ci].level);
-		break;
-
-	case DO_STOP_DONE:
-		get_args(buf, &argc, argv, ' ', 2);
-		do_stopdone(argv[1], client[ci].level);
-		break;
-
-	case DO_START_DONE:
-		get_args(buf, &argc, argv, ' ', 3);
-		do_startdone(argv[1], client[ci].level, atoi(argv[2]));
-		break;
-
-	case DO_SEND:
-		p = get_args(buf, &argc, argv, ' ', 3);
-		do_send(argv[1], client[ci].level, atoi(argv[2]), p);
-		break;
-
-	case DO_GET_GROUPS:
-		get_args(buf, &argc, argv, ' ', 2);
-		do_get_groups(ci, argc, argv);
-		break;
-
-	case DO_GET_GROUP:
-		get_args(buf, &argc, argv, ' ', 3);
-		do_get_group(ci, argc, argv);
-		break;
-
-	case DO_GET_VERSION:
-		do_get_version(ci);
-		break;
-
-	case DO_DUMP:
-		do_dump(client[ci].fd);
-		close(client[ci].fd);
-		break;
-
-	case DO_LOG:
-		do_log(client[ci].fd, &buf[4]);
-		break;
-
-	default:
-		log_print("unknown action %d client %d", act, ci);
-		log_print("invalid message: \"%s\"", buf);
-	}
-}
-
-static void process_listener(int ci)
-{
-	int fd, i;
-
-	fd = accept(client[ci].fd, NULL, NULL);
-	if (fd < 0) {
-		log_print("process_listener: accept error %d %d", fd, errno);
-		return;
-	}
-	
-	i = client_add(fd, process_connection, NULL);
-
-	log_debug("client connection %d fd %d", i, fd);
-}
-
-static int setup_listener(char *sock_path)
-{
-	struct sockaddr_un addr;
-	socklen_t addrlen;
-	int rv, s;
-
-	/* we listen for new client connections on socket s */
-
-	s = socket(AF_LOCAL, SOCK_STREAM, 0);
-	if (s < 0) {
-		log_print("socket error %d %d", s, errno);
-		return s;
-	}
-
-	memset(&addr, 0, sizeof(addr));
-	addr.sun_family = AF_LOCAL;
-	strcpy(&addr.sun_path[1], sock_path);
-	addrlen = sizeof(sa_family_t) + strlen(addr.sun_path+1) + 1;
-
-	rv = bind(s, (struct sockaddr *) &addr, addrlen);
-	if (rv < 0) {
-		log_print("bind error %d %d", rv, errno);
-		close(s);
-		return rv;
-	}
-
-	rv = listen(s, 5);
-	if (rv < 0) {
-		log_print("listen error %d %d", rv, errno);
-		close(s);
-		return rv;
-	}
-	return s;
-}
-
-void cluster_dead(int ci)
-{
-	log_print("cluster is down, exiting");
-	daemon_quit = 1;
-}
-
-#define min(x, y) ({                            \
-	typeof(x) _min1 = (x);                  \
-	typeof(y) _min2 = (y);                  \
-	(void) (&_min1 == &_min2);              \
-	_min1 < _min2 ? _min1 : _min2; })
-
-static void loop(void)
-{
-	int poll_timeout = -1;	
-	int rv, i;
-	void (*workfn) (int ci);
-	void (*deadfn) (int ci);
-
-	rv = setup_listener(GROUPD_SOCK_PATH);
-	if (rv < 0)
-		goto out;
-	client_add(rv, process_listener, NULL);
-
-	rv = setup_cman();
-	if (rv < 0)
-		goto out;
-	client_add(rv, process_cman, cluster_dead);
-
-	rv = setup_ccs();
-	if (rv < 0)
-		goto out;
-
-	setup_logging();
-
-	if (cfgd_groupd_compat == 0) {
-		group_mode = GROUP_LIBCPG;
-		log_level(LOG_INFO, "groupd compatibility mode 0 cfg");
-	} else if (cfgd_groupd_compat == 1) {
-		group_mode = GROUP_LIBGROUP;
-		log_level(LOG_INFO, "groupd compatibility mode 1 cfg");
-	} else if (cfgd_groupd_compat == 2) {
-		group_mode = GROUP_PENDING;
-		/* report the mode in set_group_mode() */
-	}
-
-	rv = setup_cpg();
-	if (rv < 0)
-		goto out;
-
-	for (;;) {
-		rv = poll(pollfd, client_maxi + 1, poll_timeout);
-		if (rv == -1 && errno == EINTR) {
-			if (daemon_quit && (group_mode == GROUP_LIBCPG ||
-					    list_empty(&gd_groups)))
-				goto out;
-			daemon_quit = 0;
-			continue;
-		}
-		if (rv < 0) {
-			log_print("poll errno %d", errno);
-			goto out;
-		}
-
-		for (i = 0; i <= client_maxi; i++) {
-			if (client[i].fd < 0)
-				continue;
-			if (pollfd[i].revents & POLLIN) {
-				workfn = client[i].workfn;
-				workfn(i);
-			}
-			if (pollfd[i].revents & (POLLERR | POLLHUP | POLLNVAL)) {
-				deadfn = client[i].deadfn;
-				deadfn(i);
-			}
-		}
-
-		if (daemon_quit)
-			break;
-
-		/* process_apps() returns non-zero if there may be
-		   more work to do */
-
-		do {
-			rv = 0;
-			rv += process_apps();
-		} while (rv);
-
-		poll_timeout = -1;
-
-		if (group_mode == GROUP_PENDING) {
-			group_mode_check_timeout();
-			poll_timeout = 1000 * min(cfgd_groupd_wait, cfgd_groupd_mode_delay);
-		}
-	}
- out:
-	close_ccs();
-	close_cman();
-
-	/* in LIBCPG mode, gd_groups is not empty because of the groups we
-	   add to "block" old versions of groupd */
-	if ((group_mode == GROUP_LIBGROUP) && !list_empty(&gd_groups))
-		log_print("groups abandoned");
-}
-
-static void lockfile(void)
-{
-	int fd, error;
-	struct flock lock;
-	char buf[33];
-
-	memset(buf, 0, 33);
-
-	fd = open(LOCKFILE_NAME, O_CREAT|O_WRONLY,
-		  S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
-	if (fd < 0) {
-		fprintf(stderr, "cannot open/create lock file %s\n",
-			LOCKFILE_NAME);
-		exit(EXIT_FAILURE);
-	}
-
-	lock.l_type = F_WRLCK;
-	lock.l_start = 0;
-	lock.l_whence = SEEK_SET;
-	lock.l_len = 0;
-
-	error = fcntl(fd, F_SETLK, &lock);
-	if (error) {
-		fprintf(stderr, "groupd is already running\n");
-		exit(EXIT_FAILURE);
-	}
-
-	error = ftruncate(fd, 0);
-	if (error) {
-		fprintf(stderr, "cannot clear lock file %s\n", LOCKFILE_NAME);
-		exit(EXIT_FAILURE);
-	}
-
-	sprintf(buf, "%d\n", getpid());
-
-	error = write(fd, buf, strlen(buf));
-	if (error <= 0) {
-		fprintf(stderr, "cannot write lock file %s\n", LOCKFILE_NAME);
-		exit(EXIT_FAILURE);
-	}
-}
-
-static void print_usage(void)
-{
-	printf("Usage:\n");
-	printf("\n");
-	printf("groupd [options]\n");
-	printf("\n");
-	printf("Options:\n");
-	printf("\n");
-	printf("  -D	       Enable debugging to stderr and don't fork\n");
-	printf("  -L           Enable debugging to log file\n");
-	printf("  -g <num>     group compatibility mode, 0 off, 1 on, 2 detect\n");
-	printf("               0: use libcpg, no backward compat, best performance\n");
-	printf("               1: use libgroup for compat with cluster2/rhel5\n");
-	printf("               2: detect old, or mode 1, nodes that require compat,\n"
-	       "               use libcpg if none found\n");
-	printf("               Default is %d\n", DEFAULT_GROUPD_COMPAT);
-	printf("  -w <secs>    seconds to wait for a node's version message before\n"
-	       "               assuming an old version requiring compat mode\n");
-	printf("               Default is %d\n", DEFAULT_GROUPD_WAIT);
-	printf("  -d <secs>    seconds to delay the mode selection to give time\n"
-	       "               for an old version to join and force compat mode\n");
-	printf("               Default is %d\n", DEFAULT_GROUPD_MODE_DELAY);
-	printf("  -h	       Print this help, then exit\n");
-	printf("  -V	       Print program version information, then exit\n");
-}
-
-#define OPTION_STRING "LDg:w:d:hVv"
-
-static void read_arguments(int argc, char **argv)
-{
-	int cont = 1;
-	int optchar;
-
-	while (cont) {
-		optchar = getopt(argc, argv, OPTION_STRING);
-
-		switch (optchar) {
-
-		case 'D':
-			daemon_debug_opt = 1;
-			break;
-
-		case 'L':
-			optd_debug_logfile = 1;
-			cfgd_debug_logfile = 1;
-			break;
-
-		case 'g':
-			optd_groupd_compat = 1;
-			cfgd_groupd_compat = atoi(optarg);
-			break;
-
-		case 'w':
-			optd_groupd_wait = 1;
-			cfgd_groupd_wait = atoi(optarg);
-			break;
-
-		case 'd':
-			optd_groupd_mode_delay = 1;
-			cfgd_groupd_mode_delay = atoi(optarg);
-			break;
-
-		case 'h':
-			print_usage();
-			exit(EXIT_SUCCESS);
-			break;
-
-		case 'v':
-			daemon_debug_verbose++;
-			break;
-
-		case 'V':
-			printf("groupd %s (built %s %s)\n",
-				RELEASE_VERSION, __DATE__, __TIME__);
-			printf("%s\n", REDHAT_COPYRIGHT);
-			exit(EXIT_SUCCESS);
-			break;
-
-		case ':':
-		case '?':
-			fprintf(stderr, "Please use '-h' for usage.\n");
-			exit(EXIT_FAILURE);
-			break;
-
-		case EOF:
-			cont = FALSE;
-			break;
-
-		default:
-			fprintf(stderr, "unknown option: %c\n", optchar);
-			exit(EXIT_FAILURE);
-			break;
-		};
-	}
-
-	if (getenv("GROUPD_DEBUG")) {
-		optd_debug_logfile = 1;
-		cfgd_debug_logfile = 1;
-	}
-}
-
-static void set_oom_adj(int val)
-{
-	FILE *fp;
-
-	fp = fopen("/proc/self/oom_adj", "w");
-	if (!fp)
-		return;
-
-	fprintf(fp, "%i", val);
-	fclose(fp);
-}
-
-static void set_scheduler(void)
-{
-	struct sched_param sched_param;
-	int rv;
-
-	rv = sched_get_priority_max(SCHED_RR);
-	if (rv != -1) {
-		sched_param.sched_priority = rv;
-		rv = sched_setscheduler(0, SCHED_RR, &sched_param);
-		if (rv == -1)
-			log_print("could not set SCHED_RR priority %d err %d",
-				   sched_param.sched_priority, errno);
-	} else {
-		log_print("could not get maximum scheduler priority err %d",
-			  errno);
-	}
-}
-
-int main(int argc, char *argv[])
-{
-	int i;
-
-	INIT_LIST_HEAD(&recovery_sets);
-	INIT_LIST_HEAD(&gd_groups);
-	for (i = 0; i < MAX_LEVELS; i++)
-		INIT_LIST_HEAD(&gd_levels[i]);
-
-	read_arguments(argc, argv);
-	lockfile();
-
-	if (!daemon_debug_opt) {
-		if (daemon(0, 0) < 0) {
-			perror("daemon error");
-			exit(EXIT_FAILURE);
-		}
-	}
-	init_logging();
-	log_level(LOG_INFO, "groupd %s", RELEASE_VERSION);
-	signal(SIGTERM, sigterm_handler);
-	set_scheduler();
-	set_oom_adj(-16);
-
-	loop();
-
-	return 0;
-}
-
-void daemon_dump_save(void)
-{
-	int len, i;
-
-	len = strlen(daemon_debug_buf);
-
-	for (i = 0; i < len; i++) {
-		dump_buf[dump_point++] = daemon_debug_buf[i];
-
-		if (dump_point == GROUPD_DUMP_SIZE) {
-			dump_point = 0;
-			dump_wrap = 1;
-		}
-	}
-}
-
-int daemon_debug_opt;
-int daemon_debug_verbose;
-int daemon_quit;
-int cman_quorate;
-int our_nodeid;
-char *our_name;
-char daemon_debug_buf[256];
-char dump_buf[GROUPD_DUMP_SIZE];
-int dump_point;
-int dump_wrap;
-struct list_head gd_groups;
-struct list_head gd_levels[MAX_LEVELS];
-uint32_t gd_event_nr;
-int group_mode;
-
-int optd_groupd_compat;
-int optd_groupd_wait;
-int optd_groupd_mode_delay;
-int optd_debug_logfile;
-
-int cfgd_groupd_compat     = DEFAULT_GROUPD_COMPAT;
-int cfgd_groupd_wait       = DEFAULT_GROUPD_WAIT;
-int cfgd_groupd_mode_delay = DEFAULT_GROUPD_MODE_DELAY;
-int cfgd_debug_logfile     = DEFAULT_DEBUG_LOGFILE;
-
diff --git a/group/dlm_controld/Makefile b/group/dlm_controld/Makefile
deleted file mode 100644
index e5766ed..0000000
--- a/group/dlm_controld/Makefile
+++ /dev/null
@@ -1,76 +0,0 @@
-include ../../make/defines.mk
-
-ifdef enable_pacemaker
-TARGET = dlm_controld.pcmk
-SBINDIRT = dlm_controld.pcmk
-else
-TARGET = dlm_controld
-SBINDIRT = dlm_controld
-endif
-
-all: depends ${TARGET}
-
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-OBJS=	action.o \
-	cpg.o \
-	crc.o \
-	deadlock.o \
-	main.o \
-	netlink.o \
-	plock.o \
-	group.o
-
-ifdef enable_pacemaker
-OBJS +=	pacemaker.o
-else
-OBJS +=	config.o \
-	member_cman.o \
-	logging.o
-endif
-
-CFLAGS += -I${ccsincdir} -I${cmanincdir} -I${logtincdir} 
-CFLAGS += -I${dlmincdir} -I${dlmcontrolincdir}
-CFLAGS += -I${corosyncincdir} -I${openaisincdir}
-CFLAGS += -I$(SRCDIR)/fence/libfenced/
-CFLAGS += -I${KERNEL_SRC}/include/
-CFLAGS += -I$(S)/../lib/ -I$(S)/../include/
-ifdef enable_pacemaker
-CFLAGS += -I${incdir}/heartbeat -I${incdir}/pacemaker
-CFLAGS += `pkg-config glib-2.0 --cflags`
-CFLAGS += `xml2-config --cflags`
-endif
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${dlmlibdir} -ldlm 
-LDFLAGS += -L${logtlibdir} -llogthread
-LDFLAGS += -L${openaislibdir} -lSaCkpt
-LDFLAGS += -L${corosynclibdir} -lcpg 
-LDFLAGS += -L../lib -lgroup
-LDFLAGS += -L${libdir}
-
-LDDEPS += ../lib/libgroup.a
-
-PCMK_LDFLAGS += -lcib -lcrmcommon -lcrmcluster -ltotem_pg
-PCMK_LDFLAGS += `pkg-config glib-2.0 --libs`
-PCMK_LDFLAGS += `xml2-config --libs`
-
-CMAN_LDFLAGS += -L${ccslibdir} -L${cmanlibdir} -lccs -lcman
-CMAN_LDFLAGS += -L../../fence/libfenced/ -lfenced
-CMAN_LDDEPS += ../../fence/libfenced/libfenced.a
-
-dlm_controld: ${OBJS} ${LDDEPS} ${CMAN_LDDEPS}
-	$(CC) -o $@ $^ $(LDFLAGS) $(CMAN_LDFLAGS)
-
-dlm_controld.pcmk: ${OBJS} ${LDDEPS} ${PCMK_LDDEPS}
-	$(CC) -o $@ $^ $(LDFLAGS) $(PCMK_LDFLAGS)
-
-depends:
-	$(MAKE) -C ../lib all
-
-clean: generalclean
-
--include $(OBJS:.o=.d)
diff --git a/group/dlm_controld/action.c b/group/dlm_controld/action.c
deleted file mode 100644
index e4180d4..0000000
--- a/group/dlm_controld/action.c
+++ /dev/null
@@ -1,936 +0,0 @@
-#include "dlm_daemon.h"
-#include "config.h"
-
-static int dir_members[MAX_NODES];
-static int dir_members_count;
-static int comms_nodes[MAX_NODES];
-static int comms_nodes_count;
-static char mg_name[DLM_LOCKSPACE_LEN+1];
-
-#define DLM_SYSFS_DIR "/sys/kernel/dlm"
-#define CLUSTER_DIR   "/sys/kernel/config/dlm/cluster"
-#define SPACES_DIR    "/sys/kernel/config/dlm/cluster/spaces"
-#define COMMS_DIR     "/sys/kernel/config/dlm/cluster/comms"
-
-/* look for an id that matches in e.g. /sys/fs/gfs/bull\:x/lock_module/id
-   and then extract the "x" as the name */
-
-static int get_mountgroup_name(uint32_t mg_id)
-{
-	char path[PATH_MAX];
-	char *fsname, *fsdir;
-	DIR *d;
-	FILE *file;
-	struct dirent *de;
-	uint32_t id;
-	int retry_gfs2 = 1;
-	int rv, error;
-
-	fsdir = "/sys/fs/gfs";
- retry:
-	rv = -1;
-
-	d = opendir(fsdir);
-	if (!d) {
-		log_debug("%s: opendir failed: %d", path, errno);
-		goto out;
-	}
-
-	while ((de = readdir(d))) {
-		if (de->d_name[0] == '.')
-			continue;
-
-		id = 0;
-		memset(path, 0, PATH_MAX);
-		snprintf(path, PATH_MAX, "%s/%s/lock_module/id",
-			 fsdir, de->d_name);
-
-		file = fopen(path, "r");
-		if (!file) {
-			log_error("can't open %s %d", path, errno);
-			continue;
-		}
-
-		error = fscanf(file, "%u", &id);
-		fclose(file);
-
-		if (error != 1) {
-			log_error("bad read %s %d", path, errno);
-			continue;
-		}
-		if (id != mg_id) {
-			log_debug("get_mountgroup_name skip %x %s",
-				  id, de->d_name);
-			continue;
-		}
-
-		/* take the fsname out of clustername:fsname */
-		fsname = strstr(de->d_name, ":");
-		if (!fsname) {
-			log_debug("get_mountgroup_name skip2 %x %s",
-				  id, de->d_name);
-			continue;
-		}
-		fsname++;
-
-		log_debug("get_mountgroup_name found %x %s %s",
-			  id, de->d_name, fsname);
-		strncpy(mg_name, fsname, sizeof(mg_name));
-		rv = 0;
-		break;
-	}
-
-	closedir(d);
-
- out:
-	if (rv && retry_gfs2) {
-		retry_gfs2 = 0;
-		fsdir = "/sys/fs/gfs2";
-		goto retry;
-	}
-
-	return rv;
-}
-
-/* This is for the case where dlm_controld exits/fails, abandoning dlm
-   lockspaces in the kernel, and then dlm_controld is restarted.  When
-   dlm_controld exits and abandons lockspaces, that node needs to be
-   rebooted to clear the uncontrolled lockspaces from the kernel. */
-
-int check_uncontrolled_lockspaces(void)
-{
-	DIR *d;
-	struct dirent *de;
-	int count = 0;
-
-	d = opendir(DLM_SYSFS_DIR);
-	if (!d)
-		return 0;
-
-	while ((de = readdir(d))) {
-		if (de->d_name[0] == '.')
-			continue;
-
-		log_error("found uncontrolled lockspace %s", de->d_name);
-		count++;
-	}
-	closedir(d);
-
-	if (count) {
-		kick_node_from_cluster(our_nodeid);
-		return -1;
-	}
-	return 0;
-}
-
-/* find the mountgroup with "mg_id" in sysfs, get it's name, then look for
-   the ls with with the same name in lockspaces list, return its id */
-
-void set_associated_id(uint32_t mg_id)
-{
-	struct lockspace *ls;
-	int rv;
-
-	log_debug("set_associated_id mg_id %x %d", mg_id, mg_id);
-
-	memset(&mg_name, 0, sizeof(mg_name));
-
-	rv = get_mountgroup_name(mg_id);
-	if (rv) {
-		log_error("no mountgroup found with id %x", mg_id);
-		return;
-	}
-
-	ls = find_ls(mg_name);
-	if (!ls) {
-		log_error("no lockspace found with name %s for mg_id %x",
-			   mg_name, mg_id);
-		return;
-	}
-
-	log_debug("set_associated_id mg %x is ls %x", mg_id, ls->global_id);
-
-	ls->associated_mg_id = mg_id;
-}
-
-static int do_sysfs(char *name, char *file, char *val)
-{
-	char fname[512];
-	int rv, fd;
-
-	sprintf(fname, "%s/%s/%s", DLM_SYSFS_DIR, name, file);
-
-	fd = open(fname, O_WRONLY);
-	if (fd < 0) {
-		log_error("open \"%s\" error %d %d", fname, fd, errno);
-		return -1;
-	}
-
-	log_debug("write \"%s\" to \"%s\"", val, fname);
-
-	rv = do_write(fd, val, strlen(val) + 1);
-	close(fd);
-	return rv;
-}
-
-int set_sysfs_control(char *name, int val)
-{
-	char buf[32];
-
-	memset(buf, 0, sizeof(buf));
-	snprintf(buf, 32, "%d", val);
-
-	return do_sysfs(name, "control", buf);
-}
-
-int set_sysfs_event_done(char *name, int val)
-{
-	char buf[32];
-
-	memset(buf, 0, sizeof(buf));
-	snprintf(buf, 32, "%d", val);
-
-	return do_sysfs(name, "event_done", buf);
-}
-
-int set_sysfs_id(char *name, uint32_t id)
-{
-	char buf[32];
-
-	memset(buf, 0, sizeof(buf));
-	snprintf(buf, 32, "%u", id);
-
-	return do_sysfs(name, "id", buf);
-}
-
-static int update_dir_members(char *name)
-{
-	char path[PATH_MAX];
-	DIR *d;
-	struct dirent *de;
-	int i = 0;
-
-	memset(path, 0, PATH_MAX);
-	snprintf(path, PATH_MAX, "%s/%s/nodes", SPACES_DIR, name);
-
-	d = opendir(path);
-	if (!d) {
-		log_debug("%s: opendir failed: %d", path, errno);
-		return -1;
-	}
-
-	memset(dir_members, 0, sizeof(dir_members));
-	dir_members_count = 0;
-
-	/* FIXME: we should probably read the nodeid in each dir instead */
-
-	while ((de = readdir(d))) {
-		if (de->d_name[0] == '.')
-			continue;
-		dir_members[i++] = atoi(de->d_name);
-		log_debug("dir_member %d", dir_members[i-1]);
-	}
-	closedir(d);
-
-	dir_members_count = i;
-	return 0;
-}
-
-static int id_exists(int id, int count, int *array)
-{
-	int i;
-	for (i = 0; i < count; i++) {
-		if (array[i] == id)
-			return 1;
-	}
-	return 0;
-}
-
-static int create_path(char *path)
-{
-	mode_t old_umask;
-	int rv;
-
-	old_umask = umask(0022);
-	rv = mkdir(path, 0777);
-	umask(old_umask);
-
-	if (rv < 0) {
-		log_error("%s: mkdir failed: %d", path, errno);
-		if (errno == EEXIST)
-			rv = 0;
-	}
-	return rv;
-}
-
-static int path_exists(const char *path)
-{
-	struct stat buf;
-
-	if (stat(path, &buf) < 0) {
-		if (errno != ENOENT)
-			log_error("%s: stat failed: %d", path, errno);
-		return 0;
-	}
-	return 1;
-}
-
-/* The "renew" nodes are those that have left and rejoined since the last
-   call to set_members().  We rmdir/mkdir for these nodes so dlm-kernel
-   can notice they've left and rejoined. */
-
-int set_configfs_members(char *name, int new_count, int *new_members,
-			 int renew_count, int *renew_members)
-{
-	char path[PATH_MAX];
-	char buf[32];
-	int i, w, fd, rv, id, old_count, *old_members;
-	int do_renew;
-
-	/*
-	 * create lockspace dir if it doesn't exist yet
-	 */
-
-	memset(path, 0, PATH_MAX);
-	snprintf(path, PATH_MAX, "%s/%s", SPACES_DIR, name);
-
-	if (!path_exists(path)) {
-		if (create_path(path))
-			return -1;
-	}
-
-	/*
-	 * remove/add lockspace members
-	 */
-
-	rv = update_dir_members(name);
-	if (rv)
-		return rv;
-
-	old_members = dir_members;
-	old_count = dir_members_count;
-
-	for (i = 0; i < old_count; i++) {
-		id = old_members[i];
-		if (id_exists(id, new_count, new_members))
-			continue;
-
-		memset(path, 0, PATH_MAX);
-		snprintf(path, PATH_MAX, "%s/%s/nodes/%d",
-			 SPACES_DIR, name, id);
-
-		log_debug("set_members rmdir \"%s\"", path);
-
-		rv = rmdir(path);
-		if (rv) {
-			log_error("%s: rmdir failed: %d", path, errno);
-			goto out;
-		}
-	}
-
-	/*
-	 * remove lockspace dir after we've removed all the nodes
-	 * (when we're shutting down and adding no new nodes)
-	 */
-
-	if (!new_count) {
-		memset(path, 0, PATH_MAX);
-		snprintf(path, PATH_MAX, "%s/%s", SPACES_DIR, name);
-
-		log_debug("set_members lockspace rmdir \"%s\"", path);
-
-		rv = rmdir(path);
-		if (rv)
-			log_error("%s: rmdir failed: %d", path, errno);
-	}
-
-	for (i = 0; i < new_count; i++) {
-		id = new_members[i];
-
-		do_renew = 0;
-
-		if (id_exists(id, renew_count, renew_members))
-			do_renew = 1;
-		else if (id_exists(id, old_count, old_members))
-			continue;
-
-		if (!is_cluster_member(id))
-			update_cluster();
-		/*
-		 * create node's dir
-		 */
-
-		memset(path, 0, PATH_MAX);
-		snprintf(path, PATH_MAX, "%s/%s/nodes/%d",
-			 SPACES_DIR, name, id);
-
-		if (do_renew) {
-			log_debug("set_members renew rmdir \"%s\"", path);
-			rv = rmdir(path);
-			if (rv) {
-				log_error("%s: renew rmdir failed: %d",
-					  path, errno);
-				goto out;
-			}
-		}
-
-		log_debug("set_members mkdir \"%s\"", path);
-
-		rv = create_path(path);
-		if (rv)
-			goto out;
-
-		/*
-		 * set node's nodeid
-		 */
-
-		memset(path, 0, PATH_MAX);
-		snprintf(path, PATH_MAX, "%s/%s/nodes/%d/nodeid",
-			 SPACES_DIR, name, id);
-
-		rv = fd = open(path, O_WRONLY);
-		if (rv < 0) {
-			log_error("%s: open failed: %d", path, errno);
-			goto out;
-		}
-
-		memset(buf, 0, 32);
-		snprintf(buf, 32, "%d", id);
-
-		rv = do_write(fd, buf, strlen(buf));
-		if (rv < 0) {
-			log_error("%s: write failed: %d, %s", path, errno, buf);
-			close(fd);
-			goto out;
-		}
-		close(fd);
-
-		/*
-		 * set node's weight
-		 */
-
-		w = get_weight(id, name);
-
-		memset(path, 0, PATH_MAX);
-		snprintf(path, PATH_MAX, "%s/%s/nodes/%d/weight",
-			 SPACES_DIR, name, id);
-
-		rv = fd = open(path, O_WRONLY);
-		if (rv < 0) {
-			log_error("%s: open failed: %d", path, errno);
-			goto out;
-		}
-
-		memset(buf, 0, 32);
-		snprintf(buf, 32, "%d", w);
-
-		rv = do_write(fd, buf, strlen(buf));
-		if (rv < 0) {
-			log_error("%s: write failed: %d, %s", path, errno, buf);
-			close(fd);
-			goto out;
-		}
-		close(fd);
-	}
-
-	rv = 0;
- out:
-	return rv;
-}
-
-#if 0
-char *str_ip(char *addr)
-{
-	static char ip[256];
-	struct sockaddr_in *sin = (struct sockaddr_in *) addr;
-	memset(ip, 0, sizeof(ip));
-	inet_ntop(AF_INET, &sin->sin_addr, ip, 256);
-	return ip;
-}
-#endif
-
-static char *str_ip(char *addr)
-{
-	static char str_ip_buf[INET6_ADDRSTRLEN];
-	struct sockaddr_storage *ss = (struct sockaddr_storage *)addr;
-	struct sockaddr_in *sin = (struct sockaddr_in *)addr;
-	struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)addr;
-	void *saddr;
-
-	if (ss->ss_family == AF_INET6)
-		saddr = &sin6->sin6_addr;
-	else
-		saddr = &sin->sin_addr;
-
-	inet_ntop(ss->ss_family, saddr, str_ip_buf, sizeof(str_ip_buf));
-	return str_ip_buf;
-}
-
-/* record the nodeids that are currently listed under
-   config/dlm/cluster/comms/ so that we can remove all of them */
-
-static int update_comms_nodes(void)
-{
-	char path[PATH_MAX];
-	DIR *d;
-	struct dirent *de;
-	int i = 0;
-
-	memset(path, 0, PATH_MAX);
-	snprintf(path, PATH_MAX, COMMS_DIR);
-
-	d = opendir(path);
-	if (!d) {
-		log_debug("%s: opendir failed: %d", path, errno);
-		return -1;
-	}
-
-	memset(comms_nodes, 0, sizeof(comms_nodes));
-	comms_nodes_count = 0;
-
-	while ((de = readdir(d))) {
-		if (de->d_name[0] == '.')
-			continue;
-		comms_nodes[i++] = atoi(de->d_name);
-	}
-	closedir(d);
-
-	comms_nodes_count = i;
-	return 0;
-}
-
-/* clear out everything under config/dlm/cluster/comms/ */
-
-static void clear_configfs_comms(void)
-{
-	char path[PATH_MAX];
-	int i, rv;
-
-	rv = update_comms_nodes();
-	if (rv < 0)
-		return;
-
-	for (i = 0; i < comms_nodes_count; i++) {
-		memset(path, 0, PATH_MAX);
-		snprintf(path, PATH_MAX, "%s/%d", COMMS_DIR, comms_nodes[i]);
-
-		log_debug("clear_configfs_nodes rmdir \"%s\"", path);
-
-		rv = rmdir(path);
-		if (rv)
-			log_error("%s: rmdir failed: %d", path, errno);
-	}
-}
-
-static void clear_configfs_space_nodes(char *name)
-{
-	char path[PATH_MAX];
-	int i, rv;
-
-	rv = update_dir_members(name);
-	if (rv < 0)
-		return;
-
-	for (i = 0; i < dir_members_count; i++) {
-		memset(path, 0, PATH_MAX);
-		snprintf(path, PATH_MAX, "%s/%s/nodes/%d",
-			 SPACES_DIR, name, dir_members[i]);
-
-		log_debug("clear_configfs_space_nodes rmdir \"%s\"", path);
-
-		rv = rmdir(path);
-		if (rv)
-			log_error("%s: rmdir failed: %d", path, errno);
-	}
-}
-
-/* clear out everything under config/dlm/cluster/spaces/ */
-
-static void clear_configfs_spaces(void)
-{
-	char path[PATH_MAX];
-	DIR *d;
-	struct dirent *de;
-	int rv;
-
-	memset(path, 0, PATH_MAX);
-	snprintf(path, PATH_MAX, "%s", SPACES_DIR);
-
-	d = opendir(path);
-	if (!d) {
-		log_debug("%s: opendir failed: %d", path, errno);
-		return;
-	}
-
-	while ((de = readdir(d))) {
-		if (de->d_name[0] == '.')
-			continue;
-
-		clear_configfs_space_nodes(de->d_name);
-
-		memset(path, 0, PATH_MAX);
-		snprintf(path, PATH_MAX, "%s/%s", SPACES_DIR, de->d_name);
-		
-		log_debug("clear_configfs_spaces rmdir \"%s\"", path);
-
-		rv = rmdir(path);
-		if (rv)
-			log_error("%s: rmdir failed: %d", path, errno);
-	}
-	closedir(d);
-}
-
-static int add_configfs_base(void)
-{
-	int rv = 0;
-
-	if (!path_exists("/sys/kernel/config")) {
-		log_error("No /sys/kernel/config, is configfs loaded?");
-		return -1;
-	}
-
-	if (!path_exists("/sys/kernel/config/dlm")) {
-		log_error("No /sys/kernel/config/dlm, is the dlm loaded?");
-		return -1;
-	}
-
-	if (!path_exists("/sys/kernel/config/dlm/cluster"))
-		rv = create_path("/sys/kernel/config/dlm/cluster");
-
-	return rv;
-}
-
-int add_configfs_node(int nodeid, char *addr, int addrlen, int local)
-{
-	char path[PATH_MAX];
-	char padded_addr[sizeof(struct sockaddr_storage)];
-	char buf[32];
-	int rv, fd;
-
-	log_debug("set_configfs_node %d %s local %d",
-		  nodeid, str_ip(addr), local);
-
-	/*
-	 * create comm dir for this node
-	 */
-
-	memset(path, 0, PATH_MAX);
-	snprintf(path, PATH_MAX, "%s/%d", COMMS_DIR, nodeid);
-
-	rv = create_path(path);
-	if (rv)
-		return -1;
-
-	/*
-	 * set the nodeid
-	 */
-
-	memset(path, 0, PATH_MAX);
-	snprintf(path, PATH_MAX, "%s/%d/nodeid", COMMS_DIR, nodeid);
-
-	fd = open(path, O_WRONLY);
-	if (fd < 0) {
-		log_error("%s: open failed: %d", path, errno);
-		return -1;
-	}
-
-	memset(buf, 0, sizeof(buf));
-	snprintf(buf, 32, "%d", nodeid);
-
-	rv = do_write(fd, buf, strlen(buf));
-	if (rv < 0) {
-		log_error("%s: write failed: %d, %s", path, errno, buf);
-		close(fd);
-		return -1;
-	}
-	close(fd);
-
-	/*
-	 * set the address
-	 */
-
-	memset(padded_addr, 0, sizeof(padded_addr));
-	memcpy(padded_addr, addr, addrlen);
-
-	memset(path, 0, PATH_MAX);
-	snprintf(path, PATH_MAX, "%s/%d/addr", COMMS_DIR, nodeid);
-
-	fd = open(path, O_WRONLY);
-	if (fd < 0) {
-		log_error("%s: open failed: %d", path, errno);
-		return -1;
-	}
-
-	rv = do_write(fd, padded_addr, sizeof(struct sockaddr_storage));
-	if (rv < 0) {
-		log_error("%s: write failed: %d %d", path, errno, rv);
-		close(fd);
-		return -1;
-	}
-	close(fd);
-
-	/*
-	 * set local
-	 */
-
-	if (!local)
-		goto out;
-
-	memset(path, 0, PATH_MAX);
-	snprintf(path, PATH_MAX, "%s/%d/local", COMMS_DIR, nodeid);
-
-	fd = open(path, O_WRONLY);
-	if (fd < 0) {
-		log_error("%s: open failed: %d", path, errno);
-		return -1;
-	}
-
-	rv = do_write(fd, "1", strlen("1"));
-	if (rv < 0) {
-		log_error("%s: write failed: %d", path, errno);
-		close(fd);
-		return -1;
-	}
-	close(fd);
- out:
-	return 0;
-}
-
-void del_configfs_node(int nodeid)
-{
-	char path[PATH_MAX];
-	int rv;
-
-	memset(path, 0, PATH_MAX);
-	snprintf(path, PATH_MAX, "%s/%d", COMMS_DIR, nodeid);
-
-	log_debug("del_configfs_node rmdir \"%s\"", path);
-
-	rv = rmdir(path);
-	if (rv)
-		log_error("%s: rmdir failed: %d", path, errno);
-}
-
-static int set_configfs_protocol(int proto)
-{
-	char path[PATH_MAX];
-	char buf[32];
-	int fd, rv;
-
-	memset(path, 0, PATH_MAX);
-	snprintf(path, PATH_MAX, "%s/protocol", CLUSTER_DIR);
-
-	fd = open(path, O_WRONLY);
-	if (fd < 0) {
-		log_error("%s: open failed: %d", path, errno);
-		return fd;
-	}
-
-	memset(buf, 0, sizeof(buf));
-	snprintf(buf, 32, "%d", proto);
-
-	rv = do_write(fd, buf, strlen(buf));
-	if (rv < 0) {
-		log_error("%s: write failed: %d", path, errno);
-		return rv;
-	}
-	close(fd);
-	log_debug("set protocol %d", proto);
-	return 0;
-}
-
-static int set_configfs_timewarn(int cs)
-{
-	char path[PATH_MAX];
-	char buf[32];
-	int fd, rv;
-
-	memset(path, 0, PATH_MAX);
-	snprintf(path, PATH_MAX, "%s/timewarn_cs", CLUSTER_DIR);
-
-	fd = open(path, O_WRONLY);
-	if (fd < 0) {
-		log_error("%s: open failed: %d", path, errno);
-		return fd;
-	}
-
-	memset(buf, 0, sizeof(buf));
-	snprintf(buf, 32, "%d", cs);
-
-	rv = do_write(fd, buf, strlen(buf));
-	if (rv < 0) {
-		log_error("%s: write failed: %d", path, errno);
-		return rv;
-	}
-	close(fd);
-	log_debug("set timewarn_cs %d", cs);
-	return 0;
-}
-
-static int set_configfs_debug(int val)
-{
-	char path[PATH_MAX];
-	char buf[32];
-	int fd, rv;
-
-	memset(path, 0, PATH_MAX);
-	snprintf(path, PATH_MAX, "%s/log_debug", CLUSTER_DIR);
-
-	fd = open(path, O_WRONLY);
-	if (fd < 0) {
-		log_error("%s: open failed: %d", path, errno);
-		return fd;
-	}
-
-	memset(buf, 0, sizeof(buf));
-	snprintf(buf, 32, "%d", val);
-
-	rv = do_write(fd, buf, strlen(buf));
-	if (rv < 0) {
-		log_error("%s: write failed: %d", path, errno);
-		return rv;
-	}
-	close(fd);
-	log_debug("set log_debug %d", val);
-	return 0;
-}
-
-void clear_configfs(void)
-{
-	clear_configfs_comms();
-	clear_configfs_spaces();
-	rmdir("/sys/kernel/config/dlm/cluster");
-}
-
-int setup_configfs(void)
-{
-	int rv;
-
-	clear_configfs();
-
-	rv = add_configfs_base();
-	if (rv < 0)
-		return rv;
-
-	/* add configfs entries for existing nodes */
-	update_cluster();
-
-	/* the kernel has its own defaults for these values which we
-	   don't want to change unless these have been set; -1 means
-	   they have not been set on command line or config file */
-
-	if (cfgk_debug != -1)
-		set_configfs_debug(cfgk_debug);
-	if (cfgk_timewarn != -1)
-		set_configfs_timewarn(cfgk_timewarn);
-	if (cfgk_protocol != -1)
-		set_configfs_protocol(cfgk_protocol);
-
-	return 0;
-}
-
-static void find_minors(void)
-{
-	FILE *fl;
-	char name[256];
-	uint32_t number;
-	int found = 0;
-	int c;
-
-	control_minor = 0;
-	monitor_minor = 0;
-	plock_minor = 0;
-	old_plock_minor = 0;
-
-	if (!(fl = fopen("/proc/misc", "r"))) {
-		log_error("/proc/misc fopen failed: %s", strerror(errno));
-		return;
-	}
-
-	while (!feof(fl)) {
-		if (fscanf(fl, "%d %255s\n", &number, &name[0]) == 2) {
-
-			if (!strcmp(name, "dlm-control")) {
-				control_minor = number;
-				found++;
-			} else if (!strcmp(name, "dlm-monitor")) {
-				monitor_minor = number;
-				found++;
-			} else if (!strcmp(name, "dlm_plock")) {
-				plock_minor = number;
-				found++;
-			} else if (!strcmp(name, "lock_dlm_plock")) {
-				old_plock_minor = number;
-				found++;
-			}
-
-		} else do {
-			c = fgetc(fl);
-		} while (c != EOF && c != '\n');
-
-		if (found == 3)
-			break;
-	}
-	fclose(fl);
-
-	if (!found)
-		log_error("Is dlm missing from kernel? No misc devices found.");
-}
-
-static int find_udev_device(char *path, uint32_t minor)
-{
-	struct stat st;
-	int i;
-
-	for (i = 0; i < 10; i++) {
-		if (stat(path, &st) == 0 && minor(st.st_rdev) == minor)
-			return 0;
-		sleep(1);
-	}
-
-	log_error("cannot find device %s with minor %d", path, minor);
-	return -1;
-}
-
-int setup_misc_devices(void)
-{
-	int rv;
-
-	find_minors();
-
-	if (control_minor) {
-		rv = find_udev_device("/dev/misc/dlm-control", control_minor);
-		if (rv < 0)
-			return rv;
-		log_debug("found /dev/misc/dlm-control minor %u",
-			  control_minor);
-	}
-
-	if (monitor_minor) {
-		rv = find_udev_device("/dev/misc/dlm-monitor", monitor_minor);
-		if (rv < 0)
-			return rv;
-		log_debug("found /dev/misc/dlm-monitor minor %u",
-			  monitor_minor);
-	}
-
-	if (plock_minor) {
-		rv = find_udev_device("/dev/misc/dlm_plock", plock_minor);
-		if (rv < 0)
-			return rv;
-		log_debug("found /dev/misc/dlm_plock minor %u",
-			  plock_minor);
-	}
-
-	if (!plock_minor && old_plock_minor) {
-		rv = find_udev_device("/dev/misc/lock_dlm_plock",
-				      old_plock_minor);
-		if (rv < 0)
-			return rv;
-		log_debug("found /dev/misc/lock_dlm_plock minor %u",
-			  old_plock_minor);
-	}
-
-	return 0;
-}
-
diff --git a/group/dlm_controld/config.c b/group/dlm_controld/config.c
deleted file mode 100644
index 3650b76..0000000
--- a/group/dlm_controld/config.c
+++ /dev/null
@@ -1,307 +0,0 @@
-#include <sys/types.h>
-#include <asm/types.h>
-#include <sys/uio.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <sys/utsname.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <net/if.h>
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <fcntl.h>
-#include <netdb.h>
-#include <limits.h>
-#include <unistd.h>
-#include <dirent.h>
-
-#include "dlm_daemon.h"
-#include "config.h"
-#include "ccs.h"
-
-#define PROTO_TCP  1
-#define PROTO_SCTP 2
-
-int ccs_handle;
-
-/* when not set in cluster.conf, a node's default weight is 1 */
-
-#define MASTER_PATH "/cluster/dlm/lockspace[@name=\"%s\"]/master"
-#define WEIGHT_PATH "/cluster/clusternodes/clusternode[@name=\"%s\"]/@weight"
-#define MASTER_NAME   MASTER_PATH "/@name"
-#define MASTER_WEIGHT MASTER_PATH "[@name=\"%s\"]/@weight"
-
-/* look for node's weight in the dlm/lockspace section */
-
-static int get_weight_lockspace(char *node, char *lockspace)
-{
-	char path[PATH_MAX], *str;
-	int error, weight;
-	int master_count = 0, node_is_master = 0;
-
-	memset(path, 0, PATH_MAX);
-	sprintf(path, MASTER_NAME, lockspace);
-
-	while (1) {
-		error = ccs_get_list(ccs_handle, path, &str);
-		if (error || !str)
-			break;
-		master_count++;
-		if (strcmp(str, node) == 0)
-			node_is_master = 1;
-		free(str);
-	}
-
-	/* if there are no masters, next check for a clusternode weight */
-
-	if (!master_count)
-		return -1;
-
-	/* if there's a master and this node isn't it, it gets weight 0 */
-
-	if (!node_is_master)
-		return 0;
-
-	/* master gets its specified weight or 1 if none is given */
-
-	memset(path, 0, PATH_MAX);
-	sprintf(path, MASTER_WEIGHT, lockspace, node);
-
-	error = ccs_get(ccs_handle, path, &str);
-	if (error || !str)
-		return 1;
-
-	weight = atoi(str);
-	free(str);
-	return weight;
-}
-
-/* look for node's weight on its clusternode line */
-
-static int get_weight_clusternode(char *node, char *lockspace)
-{
-	char path[PATH_MAX], *str;
-	int error, weight;
-
-	memset(path, 0, PATH_MAX);
-	sprintf(path, WEIGHT_PATH, node);
-
-	error = ccs_get(ccs_handle, path, &str);
-	if (error || !str)
-		return -1;
-
-	weight = atoi(str);
-	free(str);
-	return weight;
-}
-
-int get_weight(int nodeid, char *lockspace)
-{
-	char *node;
-	int w;
-
-	node = nodeid2name(nodeid);
-	if (!node) {
-		log_error("no name for nodeid %d", nodeid);
-		w = 1;
-		goto out;
-	}
-
-	w = get_weight_lockspace(node, lockspace);
-	if (w >= 0)
-		goto out;
-
-	w = get_weight_clusternode(node, lockspace);
-	if (w >= 0)
-		goto out;
-
-	/* default weight is 1 */
-	w = 1;
- out:
-	return w;
-}
-
-void read_ccs_name(char *path, char *name)
-{
-	char *str;
-	int error;
-
-	error = ccs_get(ccs_handle, path, &str);
-	if (error || !str)
-		return;
-
-	strcpy(name, str);
-
-	free(str);
-}
-
-void read_ccs_yesno(char *path, int *yes, int *no)
-{
-	char *str;
-	int error;
-
-	*yes = 0;
-	*no = 0;
-
-	error = ccs_get(ccs_handle, path, &str);
-	if (error || !str)
-		return;
-
-	if (!strcmp(str, "yes"))
-		*yes = 1;
-
-	else if (!strcmp(str, "no"))
-		*no = 1;
-
-	free(str);
-}
-
-int read_ccs_int(char *path, int *config_val)
-{
-	char *str;
-	int val;
-	int error;
-
-	error = ccs_get(ccs_handle, path, &str);
-	if (error || !str)
-		return -1;
-
-	val = atoi(str);
-
-	if (val < 0) {
-		log_error("ignore invalid value %d for %s", val, path);
-		return -1;
-	}
-
-	*config_val = val;
-	log_debug("%s is %u", path, val);
-	free(str);
-	return 0;
-}
-
-static void read_ccs_protocol(char *path, int *config_val)
-{
-	char *str;
-	int val;
-	int error;
-
-	error = ccs_get(ccs_handle, path, &str);
-	if (error || !str)
-		return;
-
-	if (!strncasecmp(str, "tcp", 3))
-		val = PROTO_TCP;
-	else if (!strncasecmp(str, "sctp", 4))
-		val = PROTO_SCTP;
-	else {
-		log_error("ignore invalid value %s for %s", str, path);
-		return;
-	}
-
-	*config_val = val;
-	log_debug("%s is %u (%s)", path, val, str);
-	free(str);
-}
-
-#define DEBUG_PATH "/cluster/dlm/@log_debug"
-#define TIMEWARN_PATH "/cluster/dlm/@timewarn"
-#define PROTOCOL_PATH "/cluster/dlm/@protocol"
-#define GROUPD_COMPAT_PATH "/cluster/group/@groupd_compat"
-#define ENABLE_FENCING_PATH "/cluster/dlm/@enable_fencing"
-#define ENABLE_QUORUM_PATH "/cluster/dlm/@enable_quorum"
-#define ENABLE_DEADLK_PATH "/cluster/dlm/@enable_deadlk"
-#define ENABLE_PLOCK_PATH "/cluster/dlm/@enable_plock"
-#define PLOCK_DEBUG_PATH "/cluster/dlm/@plock_debug"
-#define PLOCK_RATE_LIMIT_PATH "/cluster/dlm/@plock_rate_limit"
-#define PLOCK_OWNERSHIP_PATH "/cluster/dlm/@plock_ownership"
-#define DROP_RESOURCES_TIME_PATH "/cluster/dlm/@drop_resources_time"
-#define DROP_RESOURCES_COUNT_PATH "/cluster/dlm/@drop_resources_count"
-#define DROP_RESOURCES_AGE_PATH "/cluster/dlm/@drop_resources_age"
-
-/* for backward-compat */
-#define GFS_PLOCK_RATE_LIMIT_PATH "/cluster/gfs_controld/@plock_rate_limit"
-#define GFS_PLOCK_OWNERSHIP_PATH "/cluster/gfs_controld/@plock_ownership"
-#define GFS_DROP_RESOURCES_TIME_PATH "/cluster/gfs_controld/@drop_resources_time"
-#define GFS_DROP_RESOURCES_COUNT_PATH "/cluster/gfs_controld/@drop_resources_count"
-#define GFS_DROP_RESOURCES_AGE_PATH "/cluster/gfs_controld/@drop_resources_age"
-
-int setup_ccs(void)
-{
-	int cd, rv;
-
-	if (ccs_handle)
-		goto update;
-
-	cd = ccs_connect();
-	if (cd < 0) {
-		log_error("ccs_connect error %d %d", cd, errno);
-		return -1;
-	}
-	ccs_handle = cd;
-
-	/* These config values are set from cluster.conf only if they haven't
-	   already been set on the command line. */
-
-	if (!optk_debug)
-		read_ccs_int(DEBUG_PATH, &cfgk_debug);
-	if (!optk_timewarn)
-		read_ccs_int(TIMEWARN_PATH, &cfgk_timewarn);
-	if (!optk_protocol)
-		read_ccs_protocol(PROTOCOL_PATH, &cfgk_protocol);
-	if (!optd_groupd_compat)
-		read_ccs_int(GROUPD_COMPAT_PATH, &cfgd_groupd_compat);
-	if (!optd_enable_fencing)
-		read_ccs_int(ENABLE_FENCING_PATH, &cfgd_enable_fencing);
-	if (!optd_enable_quorum)
-		read_ccs_int(ENABLE_QUORUM_PATH, &cfgd_enable_quorum);
-	if (!optd_enable_deadlk)
-		read_ccs_int(ENABLE_DEADLK_PATH, &cfgd_enable_deadlk);
-	if (!optd_enable_plock)
-		read_ccs_int(ENABLE_PLOCK_PATH, &cfgd_enable_plock);
-	if (!optd_plock_ownership) {
-		rv = read_ccs_int(PLOCK_OWNERSHIP_PATH, &cfgd_plock_ownership);
-		if (rv < 0)
-			read_ccs_int(GFS_PLOCK_OWNERSHIP_PATH, &cfgd_plock_ownership);
-	}
-
-
-	/* The following can be changed while running */
- update:
-	if (!optd_plock_debug) {
-		read_ccs_int(PLOCK_DEBUG_PATH, &cfgd_plock_debug);
-	}
-	if (!optd_plock_rate_limit) {
-		rv = read_ccs_int(PLOCK_RATE_LIMIT_PATH, &cfgd_plock_rate_limit);
-		if (rv < 0)
-			read_ccs_int(GFS_PLOCK_RATE_LIMIT_PATH, &cfgd_plock_rate_limit);
-	}
-	if (!optd_drop_resources_time) {
-		rv = read_ccs_int(DROP_RESOURCES_TIME_PATH, &cfgd_drop_resources_time);
-		if (rv < 0)
-			read_ccs_int(GFS_DROP_RESOURCES_TIME_PATH, &cfgd_drop_resources_time);
-	}
-	if (!optd_drop_resources_count) {
-		rv = read_ccs_int(DROP_RESOURCES_COUNT_PATH, &cfgd_drop_resources_count);
-		if (rv < 0)
-			read_ccs_int(GFS_DROP_RESOURCES_COUNT_PATH, &cfgd_drop_resources_count);
-	}
-	if (!optd_drop_resources_age) {
-		rv = read_ccs_int(DROP_RESOURCES_AGE_PATH, &cfgd_drop_resources_age);
-		if (rv < 0)
-			read_ccs_int(GFS_DROP_RESOURCES_AGE_PATH, &cfgd_drop_resources_age);
-	}
-
-	return 0;
-}
-
-void close_ccs(void)
-{
-	ccs_disconnect(ccs_handle);
-}
-
diff --git a/group/dlm_controld/config.h b/group/dlm_controld/config.h
deleted file mode 100644
index 9168bba..0000000
--- a/group/dlm_controld/config.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifndef __CONFIG_DOT_H__
-#define __CONFIG_DOT_H__
-
-/* the kernel has default values for debug, timewarn and protocol;
-   we only change them if new values are given on command line or in ccs */
-
-#define DEFAULT_GROUPD_COMPAT 2
-#define DEFAULT_DEBUG_LOGFILE 0
-#define DEFAULT_ENABLE_FENCING 1
-#define DEFAULT_ENABLE_QUORUM 1
-#define DEFAULT_ENABLE_DEADLK 0
-#define DEFAULT_ENABLE_PLOCK 1
-#define DEFAULT_PLOCK_DEBUG 0
-#define DEFAULT_PLOCK_RATE_LIMIT 100
-#define DEFAULT_PLOCK_OWNERSHIP 1
-#define DEFAULT_DROP_RESOURCES_TIME 10000 /* 10 sec */
-#define DEFAULT_DROP_RESOURCES_COUNT 10
-#define DEFAULT_DROP_RESOURCES_AGE 10000 /* 10 sec */
-
-extern int optk_debug;
-extern int optk_timewarn;
-extern int optk_protocol;
-extern int optd_groupd_compat;
-extern int optd_debug_logfile;
-extern int optd_enable_fencing;
-extern int optd_enable_quorum;
-extern int optd_enable_deadlk;
-extern int optd_enable_plock;
-extern int optd_plock_debug;
-extern int optd_plock_rate_limit;
-extern int optd_plock_ownership;
-extern int optd_drop_resources_time;
-extern int optd_drop_resources_count;
-extern int optd_drop_resources_age;
-
-extern int cfgk_debug;
-extern int cfgk_timewarn;
-extern int cfgk_protocol;
-extern int cfgd_groupd_compat;
-extern int cfgd_debug_logfile;
-extern int cfgd_enable_fencing;
-extern int cfgd_enable_quorum;
-extern int cfgd_enable_deadlk;
-extern int cfgd_enable_plock;
-extern int cfgd_plock_debug;
-extern int cfgd_plock_rate_limit;
-extern int cfgd_plock_ownership;
-extern int cfgd_drop_resources_time;
-extern int cfgd_drop_resources_count;
-extern int cfgd_drop_resources_age;
-
-#endif
-
diff --git a/group/dlm_controld/cpg.c b/group/dlm_controld/cpg.c
deleted file mode 100644
index 41a9677..0000000
--- a/group/dlm_controld/cpg.c
+++ /dev/null
@@ -1,2290 +0,0 @@
-#include "dlm_daemon.h"
-#include "config.h"
-
-uint32_t cpgname_to_crc(const char *data, int len);
-
-struct protocol_version {
-	uint16_t major;
-	uint16_t minor;
-	uint16_t patch;
-	uint16_t flags;
-};
-
-struct protocol {
-	union {
-		struct protocol_version dm_ver;
-		uint16_t                daemon_max[4];
-	};
-	union {
-		struct protocol_version km_ver;
-		uint16_t                kernel_max[4];
-	};
-	union {
-		struct protocol_version dr_ver;
-		uint16_t                daemon_run[4];
-	};
-	union {
-		struct protocol_version kr_ver;
-		uint16_t                kernel_run[4];
-	};
-};
-
-struct member {
-	struct list_head list;
-	int nodeid;
-	int start;   /* 1 if we received a start message for this change */
-	int added;   /* 1 if added by this change */
-	int failed;  /* 1 if failed in this change */
-	int disallowed;
-	uint32_t start_flags;
-};
-
-struct node {
-	struct list_head list;
-	int nodeid;
-	int check_fencing;
-	int check_quorum;
-	int check_fs;
-	int fs_notified;
-	uint64_t add_time;
-	uint64_t fence_time;	/* for debug */
-	uint32_t fence_queries;	/* for debug */
-	uint32_t added_seq;	/* for queries */
-	uint32_t removed_seq;	/* for queries */
-	int failed_reason;	/* for queries */
-
-	struct protocol proto;
-};
-
-/* One of these change structs is created for every confchg a cpg gets. */
-
-#define CGST_WAIT_CONDITIONS 1
-#define CGST_WAIT_MESSAGES   2
-
-struct change {
-	struct list_head list;
-	struct list_head members;
-	struct list_head removed; /* nodes removed by this change */
-	int member_count;
-	int joined_count;
-	int remove_count;
-	int failed_count;
-	int state;
-	int we_joined;
-	uint32_t seq; /* used as a reference for debugging, and for queries */
-	uint32_t combined_seq; /* for queries */
-};
-
-struct ls_info {
-	uint32_t ls_info_size;
-	uint32_t id_info_size;
-	uint32_t id_info_count;
-
-	uint32_t started_count;
-
-	int member_count;
-	int joined_count;
-	int remove_count;
-	int failed_count;
-};
-
-struct id_info {
-	int nodeid;
-};
-
-int message_flow_control_on;
-static int daemon_cpg_fd;
-static cpg_handle_t daemon_cpg_handle;
-static struct protocol our_protocol;
-static struct list_head daemon_nodes;
-static struct cpg_address daemon_member[MAX_NODES];
-static int daemon_member_count;
-
-static void ls_info_in(struct ls_info *li)
-{
-	li->ls_info_size  = le32_to_cpu(li->ls_info_size);
-	li->id_info_size  = le32_to_cpu(li->id_info_size);
-	li->id_info_count = le32_to_cpu(li->id_info_count);
-	li->started_count = le32_to_cpu(li->started_count);
-	li->member_count  = le32_to_cpu(li->member_count);
-	li->joined_count  = le32_to_cpu(li->joined_count);
-	li->remove_count  = le32_to_cpu(li->remove_count);
-	li->failed_count  = le32_to_cpu(li->failed_count);
-}
-
-static void id_info_in(struct id_info *id)
-{
-	id->nodeid = le32_to_cpu(id->nodeid);
-}
-
-static void ids_in(struct ls_info *li, struct id_info *ids)
-{
-	struct id_info *id;
-	int i;
-
-	id = ids;
-	for (i = 0; i < li->id_info_count; i++) {
-		id_info_in(id);
-		id = (struct id_info *)((char *)id + li->id_info_size);
-	}
-}
-
-char *msg_name(int type)
-{
-	switch (type) {
-	case DLM_MSG_PROTOCOL:
-		return "protocol";
-	case DLM_MSG_START:
-		return "start";
-	case DLM_MSG_PLOCK:
-		return "plock";
-	case DLM_MSG_PLOCK_OWN:
-		return "plock_own";
-	case DLM_MSG_PLOCK_DROP:
-		return "plock_drop";
-	case DLM_MSG_PLOCK_SYNC_LOCK:
-		return "plock_sync_lock";
-	case DLM_MSG_PLOCK_SYNC_WAITER:
-		return "plock_sync_waiter";
-	case DLM_MSG_PLOCKS_STORED:
-		return "plocks_stored";
-	case DLM_MSG_DEADLK_CYCLE_START:
-		return "deadlk_cycle_start";
-	case DLM_MSG_DEADLK_CYCLE_END:
-		return "deadlk_cycle_end";
-	case DLM_MSG_DEADLK_CHECKPOINT_READY:
-		return "deadlk_checkpoint_ready";
-	case DLM_MSG_DEADLK_CANCEL_LOCK:
-		return "deadlk_cancel_lock";
-	default:
-		return "unknown";
-	}
-}
-
-static int _send_message(cpg_handle_t h, void *buf, int len, int type)
-{
-	struct iovec iov;
-	cpg_error_t error;
-	int retries = 0;
-
-	iov.iov_base = buf;
-	iov.iov_len = len;
-
- retry:
-	error = cpg_mcast_joined(h, CPG_TYPE_AGREED, &iov, 1);
-	if (error == CPG_ERR_TRY_AGAIN) {
-		retries++;
-		usleep(1000);
-		if (!(retries % 100))
-			log_error("cpg_mcast_joined retry %d %s",
-				   retries, msg_name(type));
-		goto retry;
-	}
-	if (error != CPG_OK) {
-		log_error("cpg_mcast_joined error %d handle %llx %s",
-			  error, (unsigned long long)h, msg_name(type));
-		return -1;
-	}
-
-	if (retries)
-		log_debug("cpg_mcast_joined retried %d %s",
-			  retries, msg_name(type));
-
-	return 0;
-}
-
-/* header fields caller needs to set: type, to_nodeid, flags, msgdata */
-
-void dlm_send_message(struct lockspace *ls, char *buf, int len)
-{
-	struct dlm_header *hd = (struct dlm_header *) buf;
-	int type = hd->type;
-
-	hd->version[0]  = cpu_to_le16(our_protocol.daemon_run[0]);
-	hd->version[1]  = cpu_to_le16(our_protocol.daemon_run[1]);
-	hd->version[2]  = cpu_to_le16(our_protocol.daemon_run[2]);
-	hd->type	= cpu_to_le16(hd->type);
-	hd->nodeid      = cpu_to_le32(our_nodeid);
-	hd->to_nodeid   = cpu_to_le32(hd->to_nodeid);
-	hd->global_id   = cpu_to_le32(ls->global_id);
-	hd->flags       = cpu_to_le32(hd->flags);
-	hd->msgdata     = cpu_to_le32(hd->msgdata);
-
-	_send_message(ls->cpg_handle, buf, len, type);
-}
-
-static struct member *find_memb(struct change *cg, int nodeid)
-{
-	struct member *memb;
-
-	list_for_each_entry(memb, &cg->members, list) {
-		if (memb->nodeid == nodeid)
-			return memb;
-	}
-	return NULL;
-}
-
-static struct lockspace *find_ls_handle(cpg_handle_t h)
-{
-	struct lockspace *ls;
-
-	list_for_each_entry(ls, &lockspaces, list) {
-		if (ls->cpg_handle == h)
-			return ls;
-	}
-	return NULL;
-}
-
-static struct lockspace *find_ls_ci(int ci)
-{
-	struct lockspace *ls;
-
-	list_for_each_entry(ls, &lockspaces, list) {
-		if (ls->cpg_client == ci)
-			return ls;
-	}
-	return NULL;
-}
-
-static void free_cg(struct change *cg)
-{
-	struct member *memb, *safe;
-
-	list_for_each_entry_safe(memb, safe, &cg->members, list) {
-		list_del(&memb->list);
-		free(memb);
-	}
-	list_for_each_entry_safe(memb, safe, &cg->removed, list) {
-		list_del(&memb->list);
-		free(memb);
-	}
-	free(cg);
-}
-
-static void free_ls(struct lockspace *ls)
-{
-	struct change *cg, *cg_safe;
-	struct node *node, *node_safe;
-
-	list_for_each_entry_safe(cg, cg_safe, &ls->changes, list) {
-		list_del(&cg->list);
-		free_cg(cg);
-	}
-
-	if (ls->started_change)
-		free_cg(ls->started_change);
-
-	list_for_each_entry_safe(node, node_safe, &ls->node_history, list) {
-		list_del(&node->list);
-		free(node);
-	}
-
-	free(ls);
-}
-
-
-/* Problem scenario:
-   nodes A,B,C are in fence domain
-   node C has gfs foo mounted
-   node C fails
-   nodes A,B begin fencing C (slow, not completed)
-   node B mounts gfs foo
-
-   We may end up having gfs foo mounted and being used on B before
-   C has been fenced.  C could wake up corrupt fs.
-
-   So, we need to prevent any new gfs mounts while there are any
-   outstanding, incomplete fencing operations.
-
-   We also need to check that the specific failed nodes we know about have
-   been fenced (since fenced may not even have been notified that the node
-   has failed yet).
-
-   So, check that:
-   1. has fenced fenced the node after it joined this lockspace?
-   2. fenced has no outstanding fencing ops
-
-   For 1:
-   - record the time of the first good start message we see from node X
-   - node X fails
-   - wait for X to be removed from all dlm cpg's  (probably not necessary)
-   - check that the fencing time is later than the recorded time above
-
-   Tracking fencing state when there are spurious partitions/merges...
-
-   from a spurious leave/join of node X, a lockspace will see:
-   - node X is a lockspace member
-   - node X fails, may be waiting for all cpgs to see failure or for fencing to
-     complete
-   - node X joins the lockspace - we want to process the change as usual, but
-     don't want to disrupt the code waiting for the fencing, and we want to
-     continue running properly once the remerged node is properly reset
-
-   ls->node_history
-   when we see a node not in this list, add entry for it with zero add_time
-   record the time we get a good start message from the node, add_time
-   clear add_time if the node leaves
-   if node fails with non-zero add_time, set check_fencing
-   when a node is fenced, clear add_time and clear check_fencing
-   if a node remerges after this, no good start message, no new add_time set
-   if a node fails with zero add_time, it doesn't need fencing
-   if a node remerges before it's been fenced, no good start message, no new
-   add_time set 
-*/
-
-static struct node *get_node_history(struct lockspace *ls, int nodeid)
-{
-	struct node *node;
-
-	list_for_each_entry(node, &ls->node_history, list) {
-		if (node->nodeid == nodeid)
-			return node;
-	}
-	return NULL;
-}
-
-static void node_history_init(struct lockspace *ls, int nodeid,
-			      struct change *cg)
-{
-	struct node *node;
-
-	node = get_node_history(ls, nodeid);
-	if (node)
-		goto out;
-
-	node = malloc(sizeof(struct node));
-	if (!node)
-		return;
-	memset(node, 0, sizeof(struct node));
-
-	node->nodeid = nodeid;
-	node->add_time = 0;
-	list_add_tail(&node->list, &ls->node_history);
- out:
-	node->added_seq = cg->seq;	/* for queries */
-}
-
-static void node_history_start(struct lockspace *ls, int nodeid)
-{
-	struct node *node;
-	
-	node = get_node_history(ls, nodeid);
-	if (!node) {
-		log_error("node_history_start no nodeid %d", nodeid);
-		return;
-	}
-
-	node->add_time = time(NULL);
-}
-
-static void node_history_left(struct lockspace *ls, int nodeid,
-			      struct change *cg)
-{
-	struct node *node;
-
-	node = get_node_history(ls, nodeid);
-	if (!node) {
-		log_error("node_history_left no nodeid %d", nodeid);
-		return;
-	}
-
-	node->add_time = 0;
-	node->removed_seq = cg->seq;	/* for queries */
-}
-
-static void node_history_fail(struct lockspace *ls, int nodeid,
-			      struct change *cg, int reason)
-{
-	struct node *node;
-
-	node = get_node_history(ls, nodeid);
-	if (!node) {
-		log_error("node_history_fail no nodeid %d", nodeid);
-		return;
-	}
-
-	if (cfgd_enable_fencing && node->add_time) {
-		node->check_fencing = 1;
-		node->fence_time = 0;
-		node->fence_queries = 0;
-	}
-
-	/* fenced will take care of making sure the quorum value
-	   is adjusted for all the failures */
-
-	if (cfgd_enable_quorum && !cfgd_enable_fencing)
-		node->check_quorum = 1;
-
-	if (ls->fs_registered)
-		node->check_fs = 1;
-
-	node->removed_seq = cg->seq;	/* for queries */
-	node->failed_reason = reason;	/* for queries */
-}
-
-static int check_fencing_done(struct lockspace *ls)
-{
-	struct node *node;
-	uint64_t last_fenced_time;
-	int in_progress, wait_count = 0;
-	int rv;
-
-	if (!cfgd_enable_fencing) {
-		log_group(ls, "check_fencing disabled");
-		return 1;
-	}
-
-	list_for_each_entry(node, &ls->node_history, list) {
-		if (!node->check_fencing)
-			continue;
-
-		/* check with fenced to see if the node has been
-		   fenced since node->add_time */
-
-		rv = fence_node_time(node->nodeid, &last_fenced_time);
-		if (rv < 0)
-			log_error("fenced_node_info error %d", rv);
-
-		if (last_fenced_time > node->add_time) {
-			log_group(ls, "check_fencing %d %llu fenced at %llu",
-				  node->nodeid,
-				  (unsigned long long)node->add_time,
-				  (unsigned long long)last_fenced_time);
-			node->check_fencing = 0;
-			node->add_time = 0;
-			node->fence_time = last_fenced_time;
-		} else {
-			if (!node->fence_queries ||
-			    node->fence_time != last_fenced_time) {
-				log_group(ls, "check_fencing %d not fenced "
-					  "add %llu fence %llu", node->nodeid,
-					 (unsigned long long)node->add_time,
-					 (unsigned long long)last_fenced_time);
-				node->fence_queries++;
-				node->fence_time = last_fenced_time;
-			}
-			wait_count++;
-		}
-	}
-
-	if (wait_count)
-		return 0;
-
-	/* now check if there are any outstanding fencing ops (for nodes
-	   we may not have seen in any lockspace), and return 0 if there
-	   are any */
-
-	rv = fence_in_progress(&in_progress);
-	if (rv < 0) {
-		log_error("fenced_domain_info error %d", rv);
-		return 0;
-	}
-
-	if (in_progress)
-		return 0;
-
-	log_group(ls, "check_fencing done");
-	return 1;
-}
-
-static int check_quorum_done(struct lockspace *ls)
-{
-	struct node *node;
-	int wait_count = 0;
-
-	if (!cfgd_enable_quorum) {
-		log_group(ls, "check_quorum disabled");
-		return 1;
-	}
-
-	/* wait for quorum system (cman) to see all the same nodes failed, so
-	   we know that cluster_quorate is adjusted for the same failures we've
-	   seen (see comment in fenced about the assumption here) */
-
-	list_for_each_entry(node, &ls->node_history, list) {
-		if (!node->check_quorum)
-			continue;
-
-		if (!is_cluster_member(node->nodeid)) {
-			node->check_quorum = 0;
-		} else {
-			log_group(ls, "check_quorum nodeid %d is_cluster_member",
-				  node->nodeid);
-			wait_count++;
-		}
-	}
-
-	if (wait_count)
-		return 0;
-
-	if (!cluster_quorate) {
-		log_group(ls, "check_quorum not quorate");
-		return 0;
-	}
-
-	log_group(ls, "check_quorum done");
-	return 1;
-}
-
-/* wait for local fs_controld to ack each failed node */
-
-static int check_fs_done(struct lockspace *ls)
-{
-	struct node *node;
-	int wait_count = 0;
-
-	/* no corresponding fs for this lockspace */
-	if (!ls->fs_registered) {
-		log_group(ls, "check_fs none registered");
-		return 1;
-	}
-
-	list_for_each_entry(node, &ls->node_history, list) {
-		if (!node->check_fs)
-			continue;
-
-		if (node->fs_notified) {
-			node->check_fs = 0;
-		} else {
-			log_group(ls, "check_fs nodeid %d needs fs notify",
-				  node->nodeid);
-			wait_count++;
-		}
-	}
-
-	if (wait_count)
-		return 0;
-
-	log_group(ls, "check_fs done");
-	return 1;
-}
-
-static int member_ids[MAX_NODES];
-static int member_count;
-static int renew_ids[MAX_NODES];
-static int renew_count;
-
-static void format_member_ids(struct lockspace *ls)
-{
-	struct change *cg = list_first_entry(&ls->changes, struct change, list);
-	struct member *memb;
-
-	memset(member_ids, 0, sizeof(member_ids));
-	member_count = 0;
-
-	list_for_each_entry(memb, &cg->members, list)
-		member_ids[member_count++] = memb->nodeid;
-}
-
-/* list of nodeids that have left and rejoined since last start_kernel;
-   is any member of startcg in the left list of any other cg's?
-   (if it is, then it presumably must be flagged added in another) */
-
-static void format_renew_ids(struct lockspace *ls)
-{
-	struct change *cg, *startcg;
-	struct member *memb, *leftmemb;
-
-	startcg = list_first_entry(&ls->changes, struct change, list);
-
-	memset(renew_ids, 0, sizeof(renew_ids));
-	renew_count = 0;
-
-	list_for_each_entry(memb, &startcg->members, list) {
-		list_for_each_entry(cg, &ls->changes, list) {
-			if (cg == startcg)
-				continue;
-			list_for_each_entry(leftmemb, &cg->removed, list) {
-				if (memb->nodeid == leftmemb->nodeid) {
-					renew_ids[renew_count++] = memb->nodeid;
-				}
-			}
-		}
-	}
-
-}
-
-static void start_kernel(struct lockspace *ls)
-{
-	struct change *cg = list_first_entry(&ls->changes, struct change, list);
-
-	if (!ls->kernel_stopped) {
-		log_error("start_kernel cg %u not stopped", cg->seq);
-		return;
-	}
-
-	log_group(ls, "start_kernel cg %u member_count %d",
-		  cg->seq, cg->member_count);
-
-	/* needs to happen before setting control which starts recovery */
-	if (ls->joining)
-		set_sysfs_id(ls->name, ls->global_id);
-
-	format_member_ids(ls);
-	format_renew_ids(ls);
-	set_configfs_members(ls->name, member_count, member_ids,
-			     renew_count, renew_ids);
-	set_sysfs_control(ls->name, 1);
-	ls->kernel_stopped = 0;
-
-	if (ls->joining) {
-		set_sysfs_event_done(ls->name, 0);
-		ls->joining = 0;
-	}
-}
-
-static void stop_kernel(struct lockspace *ls, uint32_t seq)
-{
-	if (!ls->kernel_stopped) {
-		log_group(ls, "stop_kernel cg %u", seq);
-		set_sysfs_control(ls->name, 0);
-		ls->kernel_stopped = 1;
-	}
-}
-
-/* the first condition is that the local lockspace is stopped which we
-   don't need to check for because stop_kernel(), which is synchronous,
-   was done when the change was created */
-
-static int wait_conditions_done(struct lockspace *ls)
-{
-	/* the fencing/quorum/fs conditions need to account for all the changes
-	   that have occured since the last change applied to dlm-kernel, not
-	   just the latest change */
-
-	if (!check_fencing_done(ls)) {
-		poll_fencing = 1;
-		return 0;
-	}
-	poll_fencing = 0;
-
-	/* even though fencing also waits for quorum, checking fencing isn't
-	   sufficient because we don't want to start new lockspaces in an
-	   inquorate cluster */
-
-	if (!check_quorum_done(ls)) {
-		poll_quorum = 1;
-		return 0;
-	}
-	poll_quorum = 0;
-
-	if (!check_fs_done(ls)) {
-		poll_fs = 1;
-		return 0;
-	}
-	poll_fs = 0;
-
-	return 1;
-}
-
-static int wait_messages_done(struct lockspace *ls)
-{
-	struct change *cg = list_first_entry(&ls->changes, struct change, list);
-	struct member *memb;
-	int need = 0, total = 0;
-
-	list_for_each_entry(memb, &cg->members, list) {
-		if (!memb->start)
-			need++;
-		total++;
-	}
-
-	if (need) {
-		log_group(ls, "wait_messages cg %u need %d of %d",
-			  cg->seq, need, total);
-		return 0;
-	}
-
-	log_group(ls, "wait_messages cg %u got all %d", cg->seq, total);
-	return 1;
-}
-
-static void cleanup_changes(struct lockspace *ls)
-{
-	struct change *cg = list_first_entry(&ls->changes, struct change, list);
-	struct change *safe;
-
-	list_del(&cg->list);
-	if (ls->started_change)
-		free_cg(ls->started_change);
-	ls->started_change = cg;
-
-	ls->started_count++;
-	if (!ls->started_count)
-		ls->started_count++;
-
-	cg->combined_seq = cg->seq; /* for queries */
-
-	list_for_each_entry_safe(cg, safe, &ls->changes, list) {
-		ls->started_change->combined_seq = cg->seq; /* for queries */
-		list_del(&cg->list);
-		free_cg(cg);
-	}
-}
-
-/* There's a stream of confchg and messages. At one of these
-   messages, the low node needs to store plocks and new nodes
-   need to begin saving plock messages.  A second message is
-   needed to say that the plocks are ready to be read.
-
-   When the last start message is recvd for a change, the low node
-   stores plocks and the new nodes begin saving messages.  When the
-   store is done, low node sends plocks_stored message.  When
-   new nodes recv this, they read the plocks and their saved messages.
-   plocks_stored message should identify a specific change, like start
-   messages do; if it doesn't match ls->started_change, then it's ignored.
-
-   If a confchg adding a new node arrives after plocks are stored but
-   before plocks_stored msg recvd, then the message is ignored.  The low
-   node will send another plocks_stored message for the latest change
-   (although it may be able to reuse the ckpt if no plock state has changed).
-*/
-
-static void set_plock_ckpt_node(struct lockspace *ls)
-{
-	struct change *cg = list_first_entry(&ls->changes, struct change, list);
-	struct member *memb;
-	int low = 0;
-
-	list_for_each_entry(memb, &cg->members, list) {
-		if (!(memb->start_flags & DLM_MFLG_HAVEPLOCK))
-			continue;
-
-		if (!low || memb->nodeid < low)
-			low = memb->nodeid;
-	}
-
-	log_group(ls, "set_plock_ckpt_node from %d to %d",
-		  ls->plock_ckpt_node, low);
-
-	if (ls->plock_ckpt_node == our_nodeid && low != our_nodeid) {
-		/* Close ckpt so it will go away when the new ckpt_node
-		   unlinks it prior to creating a new one; if we fail
-		   our open ckpts are automatically closed.  At this point
-		   the ckpt has not been unlinked, but won't be held open by
-		   anyone.  We use the max "retentionDuration" to stop the
-		   system from cleaning up ckpts that are open by no one. */
-		close_plock_checkpoint(ls);
-	}
-
-	ls->plock_ckpt_node = low;
-}
-
-static struct id_info *get_id_struct(struct id_info *ids, int count, int size,
-                                     int nodeid)
-{
-	struct id_info *id = ids;
-	int i;
-
-	for (i = 0; i < count; i++) {
-		if (id->nodeid == nodeid)
-			return id;
-		id = (struct id_info *)((char *)id + size);
-	}
-	return NULL;
-}
-
-/* do the change details in the message match the details of the given change */
-
-static int match_change(struct lockspace *ls, struct change *cg,
-			struct dlm_header *hd, struct ls_info *li,
-			struct id_info *ids)
-{
-	struct id_info *id;
-	struct member *memb;
-	uint32_t seq = hd->msgdata;
-	int i, members_mismatch;
-
-	/* We can ignore messages if we're not in the list of members.
-	   The one known time this will happen is after we've joined
-	   the cpg, we can get messages for changes prior to the change
-	   in which we're added. */
-
-	id = get_id_struct(ids, li->id_info_count, li->id_info_size,our_nodeid);
-
-	if (!id) {
-		log_group(ls, "match_change %d:%u skip %u we are not in members",
-			  hd->nodeid, seq, cg->seq);
-                return 0;
-	}
-
-	memb = find_memb(cg, hd->nodeid);
-	if (!memb) {
-		log_group(ls, "match_change %d:%u skip %u sender not member",
-			  hd->nodeid, seq, cg->seq);
-		return 0;
-	}
-
-	/* verify this is the right change by matching the counts
-	   and the nodeids of the current members */
-
-	if (li->member_count != cg->member_count ||
-	    li->joined_count != cg->joined_count ||
-	    li->remove_count != cg->remove_count ||
-	    li->failed_count != cg->failed_count) {
-		log_group(ls, "match_change %d:%u skip %u expect counts "
-			  "%d %d %d %d", hd->nodeid, seq, cg->seq,
-			  cg->member_count, cg->joined_count,
-			  cg->remove_count, cg->failed_count);
-		return 0;
-	}
-
-	members_mismatch = 0;
-	id = ids;
-
-	for (i = 0; i < li->id_info_count; i++) {
-		memb = find_memb(cg, id->nodeid);
-		if (!memb) {
-			log_group(ls, "match_change %d:%u skip %u no memb %d",
-			  	  hd->nodeid, seq, cg->seq, id->nodeid);
-			members_mismatch = 1;
-			break;
-		}
-		id = (struct id_info *)((char *)id + li->id_info_size);
-	}
-	if (members_mismatch)
-		return 0;
-
-	log_group(ls, "match_change %d:%u matches cg %u", hd->nodeid, seq,
-		  cg->seq);
-	return 1;
-}
-
-/* Unfortunately, there's no really simple way to match a message with the
-   specific change that it was sent for.  We hope that by passing all the
-   details of the change in the message, we will be able to uniquely match the
-   it to the correct change. */
-
-/* A start message will usually be for the first (current) change on our list.
-   In some cases it will be for a non-current change, and we can ignore it:
-
-   1. A,B,C get confchg1 adding C
-   2. C sends start for confchg1
-   3. A,B,C get confchg2 adding D
-   4. A,B,C,D recv start from C for confchg1 - ignored
-   5. C,D send start for confchg2
-   6. A,B send start for confchg2
-   7. A,B,C,D recv all start messages for confchg2, and start kernel
- 
-   In step 4, how do the nodes know whether the start message from C is
-   for confchg1 or confchg2?  Hopefully by comparing the counts and members. */
-
-static struct change *find_change(struct lockspace *ls, struct dlm_header *hd,
-				  struct ls_info *li, struct id_info *ids)
-{
-	struct change *cg;
-
-	list_for_each_entry_reverse(cg, &ls->changes, list) {
-		if (!match_change(ls, cg, hd, li, ids))
-			continue;
-		return cg;
-	}
-
-	log_group(ls, "find_change %d:%u no match", hd->nodeid, hd->msgdata);
-	return NULL;
-}
-
-static int is_added(struct lockspace *ls, int nodeid)
-{
-	struct change *cg;
-	struct member *memb;
-
-	list_for_each_entry(cg, &ls->changes, list) {
-		memb = find_memb(cg, nodeid);
-		if (memb && memb->added)
-			return 1;
-	}
-	return 0;
-}
-
-static void receive_start(struct lockspace *ls, struct dlm_header *hd, int len)
-{
-	struct change *cg;
-	struct member *memb;
-	struct ls_info *li;
-	struct id_info *ids;
-	uint32_t seq = hd->msgdata;
-	int added;
-
-	log_group(ls, "receive_start %d:%u len %d", hd->nodeid, seq, len);
-
-	li = (struct ls_info *)((char *)hd + sizeof(struct dlm_header));
-	ids = (struct id_info *)((char *)li + sizeof(struct ls_info));
-
-	ls_info_in(li);
-	ids_in(li, ids);
-
-	cg = find_change(ls, hd, li, ids);
-	if (!cg)
-		return;
-
-	memb = find_memb(cg, hd->nodeid);
-	if (!memb) {
-		/* this should never happen since match_change checks it */
-		log_error("receive_start no member %d", hd->nodeid);
-		return;
-	}
-
-	memb->start_flags = hd->flags;
-
-	added = is_added(ls, hd->nodeid);
-
-	if (added && li->started_count) {
-		log_error("receive_start %d:%u add node with started_count %u",
-			  hd->nodeid, seq, li->started_count);
-
-		/* see comment in fence/fenced/cpg.c */
-		memb->disallowed = 1;
-		return;
-	}
-
-	node_history_start(ls, hd->nodeid);
-	memb->start = 1;
-}
-
-static void receive_plocks_stored(struct lockspace *ls, struct dlm_header *hd,
-				  int len)
-{
-	struct ls_info *li;
-	struct id_info *ids;
-
-	log_group(ls, "receive_plocks_stored %d:%u need_plocks %d",
-		  hd->nodeid, hd->msgdata, ls->need_plocks);
-
-	if (!ls->need_plocks)
-		return;
-
-	/* a confchg arrived between the last start and the plocks_stored msg,
-	   so we ignore this plocks_stored msg and wait to read the ckpt until
-	   the next plocks_stored msg following the current start */
-   
-	if (!list_empty(&ls->changes) || !ls->started_change) {
-		log_group(ls, "receive_plocks_stored %d:%u ignore",
-			  hd->nodeid, hd->msgdata);
-		return;
-	}
-
-	li = (struct ls_info *)((char *)hd + sizeof(struct dlm_header));
-	ids = (struct id_info *)((char *)li + sizeof(struct ls_info));
-	ls_info_in(li);
-	ids_in(li, ids);
-
-	if (!match_change(ls, ls->started_change, hd, li, ids)) {
-		log_group(ls, "receive_plocks_stored %d:%u ignore no match",
-			  hd->nodeid, hd->msgdata);
-		return;
-	}
-
-	retrieve_plocks(ls);
-	process_saved_plocks(ls);
-	ls->need_plocks = 0;
-	ls->save_plocks = 0;
-}
-
-static void send_info(struct lockspace *ls, int type)
-{
-	struct change *cg;
-	struct dlm_header *hd;
-	struct ls_info *li;
-	struct id_info *id;
-	struct member *memb;
-	char *buf;
-	int len, id_count;
-
-	cg = list_first_entry(&ls->changes, struct change, list);
-
-	id_count = cg->member_count;
-
-	len = sizeof(struct dlm_header) + sizeof(struct ls_info) +
-	      id_count * sizeof(struct id_info);
-
-	buf = malloc(len);
-	if (!buf) {
-		log_error("send_info len %d no mem", len);
-		return;
-	}
-	memset(buf, 0, len);
-
-	hd = (struct dlm_header *)buf;
-	li = (struct ls_info *)(buf + sizeof(*hd));
-	id = (struct id_info *)(buf + sizeof(*hd) + sizeof(*li));
-
-	/* fill in header (dlm_send_message handles part of header) */
-
-	hd->type = type;
-	hd->msgdata = cg->seq;
-	if (ls->joining)
-		hd->flags |= DLM_MFLG_JOINING;
-	if (!ls->need_plocks)
-		hd->flags |= DLM_MFLG_HAVEPLOCK;
-
-	/* fill in ls_info */
-
-	li->ls_info_size  = cpu_to_le32(sizeof(struct ls_info));
-	li->id_info_size  = cpu_to_le32(sizeof(struct id_info));
-	li->id_info_count = cpu_to_le32(id_count);
-	li->started_count = cpu_to_le32(ls->started_count);
-	li->member_count  = cpu_to_le32(cg->member_count);
-	li->joined_count  = cpu_to_le32(cg->joined_count);
-	li->remove_count  = cpu_to_le32(cg->remove_count);
-	li->failed_count  = cpu_to_le32(cg->failed_count);
-
-	/* fill in id_info entries */
-
-	list_for_each_entry(memb, &cg->members, list) {
-		id->nodeid = cpu_to_le32(memb->nodeid);
-		id++;
-	}
-
-	log_group(ls, "send_%s cg %u flags %x counts %u %d %d %d %d",
-		  type == DLM_MSG_START ? "start" : "plocks_stored",
-		  cg->seq, hd->flags, ls->started_count, cg->member_count,
-		  cg->joined_count, cg->remove_count, cg->failed_count);
-
-	dlm_send_message(ls, buf, len);
-
-	free(buf);
-}
-
-static void send_start(struct lockspace *ls)
-{
-	send_info(ls, DLM_MSG_START);
-}
-
-static void send_plocks_stored(struct lockspace *ls)
-{
-	send_info(ls, DLM_MSG_PLOCKS_STORED);
-}
-
-static int nodes_added(struct lockspace *ls)
-{
-	struct change *cg;
-
-	list_for_each_entry(cg, &ls->changes, list) {
-		if (cg->joined_count)
-			return 1;
-	}
-	return 0;
-}
-
-static void prepare_plocks(struct lockspace *ls)
-{
-	struct change *cg = list_first_entry(&ls->changes, struct change, list);
-	struct member *memb;
-
-	if (!cfgd_enable_plock)
-		return;
-
-	/* if we're the only node in the lockspace, then we are the ckpt_node
-	   and we don't need plocks */
-
-	if (cg->member_count == 1) {
-		list_for_each_entry(memb, &cg->members, list) {
-			if (memb->nodeid != our_nodeid) {
-				log_error("prepare_plocks other member %d",
-					  memb->nodeid);
-			}
-		}
-		ls->plock_ckpt_node = our_nodeid;
-		ls->need_plocks = 0;
-		return;
-	}
-
-	/* the low node that indicated it had plock state in its last
-	   start message is the ckpt_node */
-
-	set_plock_ckpt_node(ls);
-
-	/* there is no node with plock state, so there's no syncing to do */
-
-	if (!ls->plock_ckpt_node) {
-		ls->need_plocks = 0;
-		ls->save_plocks = 0;
-		return;
-	}
-
-	/* We save all plock messages from the time that the low node saves
-	   existing plock state in the ckpt to the time that we read that state
-	   from the ckpt. */
-
-	if (ls->need_plocks) {
-		ls->save_plocks = 1;
-		return;
-	}
-
-	if (ls->plock_ckpt_node != our_nodeid)
-		return;
-
-	/* At each start, a ckpt is written if there have been nodes added
-	   since the last start/ckpt.  If no nodes have been added, no one
-	   does anything with ckpts.  If the node that wrote the last ckpt
-	   is no longer the ckpt_node, the new ckpt_node will unlink and
-	   write a new one.  If the node that wrote the last ckpt is still
-	   the ckpt_node and no plock state has changed since the last ckpt,
-	   it will just leave the old ckpt and not write a new one.
-	 
-	   A new ckpt_node will send a stored message even if it doesn't
-	   write a ckpt because new nodes in the previous start may be
-	   waiting to read the ckpt from the previous ckpt_node after ignoring
-	   the previous stored message.  They will read the ckpt from the
-	   previous ckpt_node upon receiving the stored message from us. */
-
-	if (nodes_added(ls))
-		store_plocks(ls);
-	send_plocks_stored(ls);
-}
-
-static void apply_changes(struct lockspace *ls)
-{
-	struct change *cg;
-
-	if (list_empty(&ls->changes))
-		return;
-	cg = list_first_entry(&ls->changes, struct change, list);
-
-	switch (cg->state) {
-
-	case CGST_WAIT_CONDITIONS:
-		if (wait_conditions_done(ls)) {
-			send_start(ls);
-			cg->state = CGST_WAIT_MESSAGES;
-		}
-		break;
-
-	case CGST_WAIT_MESSAGES:
-		if (wait_messages_done(ls)) {
-			start_kernel(ls);
-			prepare_plocks(ls);
-			cleanup_changes(ls);
-		}
-		break;
-
-	default:
-		log_error("apply_changes invalid state %d", cg->state);
-	}
-}
-
-void process_lockspace_changes(void)
-{
-	struct lockspace *ls, *safe;
-
-	list_for_each_entry_safe(ls, safe, &lockspaces, list) {
-		if (!list_empty(&ls->changes))
-			apply_changes(ls);
-	}
-}
-
-static int add_change(struct lockspace *ls,
-		      struct cpg_address *member_list, int member_list_entries,
-		      struct cpg_address *left_list, int left_list_entries,
-		      struct cpg_address *joined_list, int joined_list_entries,
-		      struct change **cg_out)
-{
-	struct change *cg;
-	struct member *memb;
-	int i, error;
-
-	cg = malloc(sizeof(struct change));
-	if (!cg)
-		goto fail_nomem;
-	memset(cg, 0, sizeof(struct change));
-	INIT_LIST_HEAD(&cg->members);
-	INIT_LIST_HEAD(&cg->removed);
-	cg->state = CGST_WAIT_CONDITIONS;
-	cg->seq = ++ls->change_seq;
-	if (!cg->seq)
-		cg->seq = ++ls->change_seq;
-
-	cg->member_count = member_list_entries;
-	cg->joined_count = joined_list_entries;
-	cg->remove_count = left_list_entries;
-
-	for (i = 0; i < member_list_entries; i++) {
-		memb = malloc(sizeof(struct member));
-		if (!memb)
-			goto fail_nomem;
-		memset(memb, 0, sizeof(struct member));
-		memb->nodeid = member_list[i].nodeid;
-		list_add_tail(&memb->list, &cg->members);
-	}
-
-	for (i = 0; i < left_list_entries; i++) {
-		memb = malloc(sizeof(struct member));
-		if (!memb)
-			goto fail_nomem;
-		memset(memb, 0, sizeof(struct member));
-		memb->nodeid = left_list[i].nodeid;
-		if (left_list[i].reason == CPG_REASON_NODEDOWN ||
-		    left_list[i].reason == CPG_REASON_PROCDOWN) {
-			memb->failed = 1;
-			cg->failed_count++;
-		}
-		list_add_tail(&memb->list, &cg->removed);
-
-		if (memb->failed)
-			node_history_fail(ls, memb->nodeid, cg,
-					  left_list[i].reason);
-		else
-			node_history_left(ls, memb->nodeid, cg);
-
-		log_group(ls, "add_change cg %u remove nodeid %d reason %d",
-			  cg->seq, memb->nodeid, left_list[i].reason);
-
-		if (left_list[i].reason == CPG_REASON_PROCDOWN)
-			kick_node_from_cluster(memb->nodeid);
-	}
-
-	for (i = 0; i < joined_list_entries; i++) {
-		memb = find_memb(cg, joined_list[i].nodeid);
-		if (!memb) {
-			log_error("no member %d", joined_list[i].nodeid);
-			error = -ENOENT;
-			goto fail;
-		}
-		memb->added = 1;
-
-		if (memb->nodeid == our_nodeid)
-			cg->we_joined = 1;
-		else
-			node_history_init(ls, memb->nodeid, cg);
-
-		log_group(ls, "add_change cg %u joined nodeid %d", cg->seq,
-			  memb->nodeid);
-	}
-
-	if (cg->we_joined) {
-		log_group(ls, "add_change cg %u we joined", cg->seq);
-		list_for_each_entry(memb, &cg->members, list)
-			node_history_init(ls, memb->nodeid, cg);
-	}
-
-	log_group(ls, "add_change cg %u counts member %d joined %d remove %d "
-		  "failed %d", cg->seq, cg->member_count, cg->joined_count,
-		  cg->remove_count, cg->failed_count);
-
-	list_add(&cg->list, &ls->changes);
-	*cg_out = cg;
-	return 0;
-
- fail_nomem:
-	log_error("no memory");
-	error = -ENOMEM;
- fail:
-	free_cg(cg);
-	return error;
-}
-
-static int we_left(struct cpg_address *left_list, int left_list_entries)
-{
-	int i;
-
-	for (i = 0; i < left_list_entries; i++) {
-		if (left_list[i].nodeid == our_nodeid)
-			return 1;
-	}
-	return 0;
-}
-
-static void confchg_cb(cpg_handle_t handle, struct cpg_name *group_name,
-		       struct cpg_address *member_list, int member_list_entries,
-		       struct cpg_address *left_list, int left_list_entries,
-		       struct cpg_address *joined_list, int joined_list_entries)
-{
-	struct lockspace *ls;
-	struct change *cg;
-	struct member *memb;
-	int rv;
-
-	ls = find_ls_handle(handle);
-	if (!ls) {
-		log_error("confchg_cb no lockspace for cpg %s",
-			  group_name->value);
-		return;
-	}
-
-	if (ls->leaving && we_left(left_list, left_list_entries)) {
-		/* we called cpg_leave(), and this should be the final
-		   cpg callback we receive */
-		log_group(ls, "confchg for our leave");
-		stop_kernel(ls, 0);
-		set_configfs_members(ls->name, 0, NULL, 0, NULL);
-		set_sysfs_event_done(ls->name, 0);
-		cpg_finalize(ls->cpg_handle);
-		client_dead(ls->cpg_client);
-		purge_plocks(ls, our_nodeid, 1);
-		list_del(&ls->list);
-		free_ls(ls);
-		return;
-	}
-
-	rv = add_change(ls, member_list, member_list_entries,
-			left_list, left_list_entries,
-			joined_list, joined_list_entries, &cg);
-	if (rv)
-		return;
-
-	stop_kernel(ls, cg->seq);
-
-	list_for_each_entry(memb, &cg->removed, list)
-		purge_plocks(ls, memb->nodeid, 0);
-
-	apply_changes(ls);
-
-	deadlk_confchg(ls, member_list, member_list_entries,
-		       left_list, left_list_entries,
-		       joined_list, joined_list_entries);
-
-}
-
-static void dlm_header_in(struct dlm_header *hd)
-{
-	hd->version[0]  = le16_to_cpu(hd->version[0]);
-	hd->version[1]  = le16_to_cpu(hd->version[1]);
-	hd->version[2]  = le16_to_cpu(hd->version[2]);
-	hd->type        = le16_to_cpu(hd->type);
-	hd->nodeid      = le32_to_cpu(hd->nodeid);
-	hd->to_nodeid   = le32_to_cpu(hd->to_nodeid);
-	hd->global_id   = le32_to_cpu(hd->global_id);
-	hd->flags       = le32_to_cpu(hd->flags);
-	hd->msgdata     = le32_to_cpu(hd->msgdata);
-}
-
-static void deliver_cb(cpg_handle_t handle, struct cpg_name *group_name,
-		       uint32_t nodeid, uint32_t pid, void *data, int len)
-{
-	struct lockspace *ls;
-	struct dlm_header *hd;
-
-	ls = find_ls_handle(handle);
-	if (!ls) {
-		log_error("deliver_cb no ls for cpg %s", group_name->value);
-		return;
-	}
-
-	if (len < sizeof(*hd)) {
-		log_error("deliver_cb short message %d", len);
-		return;
-	}
-
-	hd = (struct dlm_header *)data;
-	dlm_header_in(hd);
-
-	if (hd->version[0] != our_protocol.daemon_run[0] ||
-	    hd->version[1] != our_protocol.daemon_run[1]) {
-		log_error("reject message from %d version %u.%u.%u vs %u.%u.%u",
-			  nodeid, hd->version[0], hd->version[1],
-			  hd->version[2], our_protocol.daemon_run[0],
-			  our_protocol.daemon_run[1],
-			  our_protocol.daemon_run[2]);
-		return;
-	}
-
-	if (hd->nodeid != nodeid) {
-		log_error("bad msg nodeid %d %d", hd->nodeid, nodeid);
-		return;
-	}
-
-	switch (hd->type) {
-	case DLM_MSG_START:
-		receive_start(ls, hd, len);
-		break;
-
-	case DLM_MSG_PLOCK:
-		receive_plock(ls, hd, len);
-		break;
-
-	case DLM_MSG_PLOCK_OWN:
-		receive_own(ls, hd, len);
-		break;
-
-	case DLM_MSG_PLOCK_DROP:
-		receive_drop(ls, hd, len);
-		break;
-
-	case DLM_MSG_PLOCK_SYNC_LOCK:
-	case DLM_MSG_PLOCK_SYNC_WAITER:
-		receive_sync(ls, hd, len);
-		break;
-
-	case DLM_MSG_PLOCKS_STORED:
-		receive_plocks_stored(ls, hd, len);
-		break;
-
-	case DLM_MSG_DEADLK_CYCLE_START:
-		receive_cycle_start(ls, hd, len);
-		break;
-
-	case DLM_MSG_DEADLK_CYCLE_END:
-		receive_cycle_end(ls, hd, len);
-		break;
-
-	case DLM_MSG_DEADLK_CHECKPOINT_READY:
-		receive_checkpoint_ready(ls, hd, len);
-		break;
-
-	case DLM_MSG_DEADLK_CANCEL_LOCK:
-		receive_cancel_lock(ls, hd, len);
-		break;
-
-	default:
-		log_error("unknown msg type %d", hd->type);
-	}
-
-	apply_changes(ls);
-}
-
-static cpg_callbacks_t cpg_callbacks = {
-	.cpg_deliver_fn = deliver_cb,
-	.cpg_confchg_fn = confchg_cb,
-};
-
-void update_flow_control_status(void)
-{
-	cpg_flow_control_state_t flow_control_state;
-	cpg_error_t error;
-
-	error = cpg_flow_control_state_get(daemon_cpg_handle,
-					   &flow_control_state);
-	if (error != CPG_OK) {
-		log_error("cpg_flow_control_state_get %d", error);
-		return;
-	}
-
-	if (flow_control_state == CPG_FLOW_CONTROL_ENABLED) {
-		if (message_flow_control_on == 0) {
-			log_debug("flow control on");
-		}
-		message_flow_control_on = 1;
-	} else {
-		if (message_flow_control_on) {
-			log_debug("flow control off");
-		}
-		message_flow_control_on = 0;
-	}
-}
-
-static void process_lockspace_cpg(int ci)
-{
-	struct lockspace *ls;
-	cpg_error_t error;
-
-	ls = find_ls_ci(ci);
-	if (!ls) {
-		log_error("process_lockspace_cpg no lockspace for ci %d", ci);
-		return;
-	}
-
-	error = cpg_dispatch(ls->cpg_handle, CPG_DISPATCH_ALL);
-	if (error != CPG_OK) {
-		log_error("cpg_dispatch error %d", error);
-		return;
-	}
-
-	update_flow_control_status();
-}
-
-/* received an "online" uevent from dlm-kernel */
-
-int dlm_join_lockspace(struct lockspace *ls)
-{
-	cpg_error_t error;
-	cpg_handle_t h;
-	struct cpg_name name;
-	int i = 0, fd, ci, rv;
-	int unused;
-
-	rv = fence_in_progress(&unused);
-	if (cfgd_enable_fencing && rv < 0) {
-		log_error("dlm_join_lockspace no fence domain");
-		rv = -1;
-		goto fail_free;
-	}
-
-	error = cpg_initialize(&h, &cpg_callbacks);
-	if (error != CPG_OK) {
-		log_error("cpg_initialize error %d", error);
-		rv = -1;
-		goto fail_free;
-	}
-
-	cpg_fd_get(h, &fd);
-
-	ci = client_add(fd, process_lockspace_cpg, NULL);
-
-	list_add(&ls->list, &lockspaces);
-
-	ls->cpg_handle = h;
-	ls->cpg_client = ci;
-	ls->cpg_fd = fd;
-	ls->kernel_stopped = 1;
-	ls->need_plocks = 1;
-	ls->joining = 1;
-
-	memset(&name, 0, sizeof(name));
-	sprintf(name.value, "dlm:ls:%s", ls->name);
-	name.length = strlen(name.value) + 1;
-
-	/* TODO: allow global_id to be set in cluster.conf? */
-	ls->global_id = cpgname_to_crc(name.value, name.length);
-
- retry:
-	error = cpg_join(h, &name);
-	if (error == CPG_ERR_TRY_AGAIN) {
-		sleep(1);
-		if (!(++i % 10))
-			log_error("cpg_join error retrying");
-		goto retry;
-	}
-	if (error != CPG_OK) {
-		log_error("cpg_join error %d", error);
-		cpg_finalize(h);
-		rv = -1;
-		goto fail;
-	}
-
-	return 0;
-
- fail:
-	list_del(&ls->list);
-	client_dead(ci);
-	cpg_finalize(h);
- fail_free:
-	set_sysfs_event_done(ls->name, rv);
-	free_ls(ls);
-	return rv;
-}
-
-/* received an "offline" uevent from dlm-kernel */
-
-int dlm_leave_lockspace(struct lockspace *ls)
-{
-	cpg_error_t error;
-	struct cpg_name name;
-	int i = 0;
-
-	ls->leaving = 1;
-
-	memset(&name, 0, sizeof(name));
-	sprintf(name.value, "dlm:ls:%s", ls->name);
-	name.length = strlen(name.value) + 1;
-
- retry:
-	error = cpg_leave(ls->cpg_handle, &name);
-	if (error == CPG_ERR_TRY_AGAIN) {
-		sleep(1);
-		if (!(++i % 10))
-			log_error("cpg_leave error retrying");
-		goto retry;
-	}
-	if (error != CPG_OK)
-		log_error("cpg_leave error %d", error);
-
-	return 0;
-}
-
-static struct node *get_node_daemon(int nodeid)
-{
-	struct node *node;
-
-	list_for_each_entry(node, &daemon_nodes, list) {
-		if (node->nodeid == nodeid)
-			return node;
-	}
-	return NULL;
-}
-
-static void add_node_daemon(int nodeid)
-{
-	struct node *node;
-
-	if (get_node_daemon(nodeid))
-		return;
-
-	node = malloc(sizeof(struct node));
-	if (!node) {
-		log_error("add_node_daemon no mem");
-		return;
-	}
-	memset(node, 0, sizeof(struct node));
-	node->nodeid = nodeid;
-	list_add_tail(&node->list, &daemon_nodes);
-}
-
-static void pv_in(struct protocol_version *pv)
-{
-	pv->major = le16_to_cpu(pv->major);
-	pv->minor = le16_to_cpu(pv->minor);
-	pv->patch = le16_to_cpu(pv->patch);
-	pv->flags = le16_to_cpu(pv->flags);
-}
-
-static void pv_out(struct protocol_version *pv)
-{
-	pv->major = cpu_to_le16(pv->major);
-	pv->minor = cpu_to_le16(pv->minor);
-	pv->patch = cpu_to_le16(pv->patch);
-	pv->flags = cpu_to_le16(pv->flags);
-}
-
-static void protocol_in(struct protocol *proto)
-{
-	pv_in(&proto->dm_ver);
-	pv_in(&proto->km_ver);
-	pv_in(&proto->dr_ver);
-	pv_in(&proto->kr_ver);
-}
-
-static void protocol_out(struct protocol *proto)
-{
-	pv_out(&proto->dm_ver);
-	pv_out(&proto->km_ver);
-	pv_out(&proto->dr_ver);
-	pv_out(&proto->kr_ver);
-}
-
-/* go through member list saved in last confchg, see if we have received a
-   proto message from each */
-
-static int all_protocol_messages(void)
-{
-	struct node *node;
-	int i;
-
-	if (!daemon_member_count)
-		return 0;
-
-	for (i = 0; i < daemon_member_count; i++) {
-		node = get_node_daemon(daemon_member[i].nodeid);
-		if (!node) {
-			log_error("all_protocol_messages no node %d",
-				  daemon_member[i].nodeid);
-			return 0;
-		}
-
-		if (!node->proto.daemon_max[0])
-			return 0;
-	}
-	return 1;
-}
-
-static int pick_min_protocol(struct protocol *proto)
-{
-	uint16_t mind[4];
-	uint16_t mink[4];
-	struct node *node;
-	int i;
-
-	memset(&mind, 0, sizeof(mind));
-	memset(&mink, 0, sizeof(mink));
-
-	/* first choose the minimum major */
-
-	for (i = 0; i < daemon_member_count; i++) {
-		node = get_node_daemon(daemon_member[i].nodeid);
-		if (!node) {
-			log_error("pick_min_protocol no node %d",
-				  daemon_member[i].nodeid);
-			return -1;
-		}
-
-		if (!mind[0] || node->proto.daemon_max[0] < mind[0])
-			mind[0] = node->proto.daemon_max[0];
-
-		if (!mink[0] || node->proto.kernel_max[0] < mink[0])
-			mink[0] = node->proto.kernel_max[0];
-	}
-
-	if (!mind[0] || !mink[0]) {
-		log_error("pick_min_protocol zero major number");
-		return -1;
-	}
-
-	/* second pick the minimum minor with the chosen major */
-
-	for (i = 0; i < daemon_member_count; i++) {
-		node = get_node_daemon(daemon_member[i].nodeid);
-		if (!node)
-			continue;
-
-		if (mind[0] == node->proto.daemon_max[0]) {
-			if (!mind[1] || node->proto.daemon_max[1] < mind[1])
-				mind[1] = node->proto.daemon_max[1];
-		}
-
-		if (mink[0] == node->proto.kernel_max[0]) {
-			if (!mink[1] || node->proto.kernel_max[1] < mink[1])
-				mink[1] = node->proto.kernel_max[1];
-		}
-	}
-
-	if (!mind[1] || !mink[1]) {
-		log_error("pick_min_protocol zero minor number");
-		return -1;
-	}
-
-	/* third pick the minimum patch with the chosen major.minor */
-
-	for (i = 0; i < daemon_member_count; i++) {
-		node = get_node_daemon(daemon_member[i].nodeid);
-		if (!node)
-			continue;
-
-		if (mind[0] == node->proto.daemon_max[0] &&
-		    mind[1] == node->proto.daemon_max[1]) {
-			if (!mind[2] || node->proto.daemon_max[2] < mind[2])
-				mind[2] = node->proto.daemon_max[2];
-		}
-
-		if (mink[0] == node->proto.kernel_max[0] &&
-		    mink[1] == node->proto.kernel_max[1]) {
-			if (!mink[2] || node->proto.kernel_max[2] < mink[2])
-				mink[2] = node->proto.kernel_max[2];
-		}
-	}
-
-	if (!mind[2] || !mink[2]) {
-		log_error("pick_min_protocol zero patch number");
-		return -1;
-	}
-
-	memcpy(&proto->daemon_run, &mind, sizeof(mind));
-	memcpy(&proto->kernel_run, &mink, sizeof(mink));
-	return 0;
-}
-
-static void receive_protocol(struct dlm_header *hd, int len)
-{
-	struct protocol *p;
-	struct node *node;
-
-	p = (struct protocol *)((char *)hd + sizeof(struct dlm_header));
-	protocol_in(p);
-
-	if (len < sizeof(struct dlm_header) + sizeof(struct protocol)) {
-		log_error("receive_protocol invalid len %d from %d",
-			  len, hd->nodeid);
-		return;
-	}
-
-	/* zero is an invalid version value */
-
-	if (!p->daemon_max[0] || !p->daemon_max[1] || !p->daemon_max[2] ||
-	    !p->kernel_max[0] || !p->kernel_max[1] || !p->kernel_max[2]) {
-		log_error("receive_protocol invalid max value from %d "
-			  "daemon %u.%u.%u kernel %u.%u.%u", hd->nodeid,
-			  p->daemon_max[0], p->daemon_max[1], p->daemon_max[2],
-			  p->kernel_max[0], p->kernel_max[1], p->kernel_max[2]);
-		return;
-	}
-
-	/* the run values will be zero until a version is set, after
-	   which none of the run values can be zero */
-
-	if (p->daemon_run[0] && (!p->daemon_run[1] || !p->daemon_run[2] ||
-	    !p->kernel_run[0] || !p->kernel_run[1] || !p->kernel_run[2])) {
-		log_error("receive_protocol invalid run value from %d "
-			  "daemon %u.%u.%u kernel %u.%u.%u", hd->nodeid,
-			  p->daemon_run[0], p->daemon_run[1], p->daemon_run[2],
-			  p->kernel_run[0], p->kernel_run[1], p->kernel_run[2]);
-		return;
-	}
-
-	/* if we have zero run values, and this msg has non-zero run values,
-	   then adopt them as ours; otherwise save this proto message */
-
-	if (our_protocol.daemon_run[0])
-		return;
-
-	if (p->daemon_run[0]) {
-		memcpy(&our_protocol.daemon_run, &p->daemon_run,
-		       sizeof(struct protocol_version));
-		memcpy(&our_protocol.kernel_run, &p->kernel_run,
-		       sizeof(struct protocol_version));
-		log_debug("run protocol from nodeid %d", hd->nodeid);
-		return;
-	}
-
-	/* save this node's proto so we can tell when we've got all, and
-	   use it to select a minimum protocol from all */
-
-	node = get_node_daemon(hd->nodeid);
-	if (!node) {
-		log_error("receive_protocol no node %d", hd->nodeid);
-		return;
-	}
-	memcpy(&node->proto, p, sizeof(struct protocol));
-}
-
-static void send_protocol(struct protocol *proto)
-{
-	struct dlm_header *hd;
-	struct protocol *pr;
-	char *buf;
-	int len;
-
-	len = sizeof(struct dlm_header) + sizeof(struct protocol);
-	buf = malloc(len);
-	if (!buf) {
-		log_error("send_protocol no mem %d", len);
-		return;
-	}
-	memset(buf, 0, len);
-
-	hd = (struct dlm_header *)buf;
-	pr = (struct protocol *)(buf + sizeof(*hd));
-
-	hd->type = cpu_to_le16(DLM_MSG_PROTOCOL);
-	hd->nodeid = cpu_to_le32(our_nodeid);
-
-	memcpy(pr, proto, sizeof(struct protocol));
-	protocol_out(pr);
-
-	_send_message(daemon_cpg_handle, buf, len, DLM_MSG_PROTOCOL);
-}
-
-int set_protocol(void)
-{
-	struct protocol proto;
-	struct pollfd pollfd;
-	int sent_proposal = 0;
-	int rv;
-
-	memset(&pollfd, 0, sizeof(pollfd));
-	pollfd.fd = daemon_cpg_fd;
-	pollfd.events = POLLIN;
-
-	while (1) {
-		if (our_protocol.daemon_run[0])
-			break;
-
-		if (!sent_proposal && all_protocol_messages()) {
-			/* propose a protocol; look through info from all
-			   nodes and pick the min for both daemon and kernel,
-			   and propose that */
-
-			sent_proposal = 1;
-
-			/* copy our max values */
-			memcpy(&proto, &our_protocol, sizeof(struct protocol));
-
-			rv = pick_min_protocol(&proto);
-			if (rv < 0)
-				return rv;
-
-			log_debug("set_protocol member_count %d propose "
-				  "daemon %u.%u.%u kernel %u.%u.%u",
-				  daemon_member_count,
-				  proto.daemon_run[0], proto.daemon_run[1],
-				  proto.daemon_run[2], proto.kernel_run[0],
-				  proto.kernel_run[1], proto.kernel_run[2]);
-
-			send_protocol(&proto);
-		}
-
-		/* only process messages/events from daemon cpg until protocol
-		   is established */
-
-		rv = poll(&pollfd, 1, -1);
-		if (rv == -1 && errno == EINTR) {
-			if (daemon_quit)
-				return -1;
-			continue;
-		}
-		if (rv < 0) {
-			log_error("set_protocol poll errno %d", errno);
-			return -1;
-		}
-
-		if (pollfd.revents & POLLIN)
-			process_cpg(0);
-		if (pollfd.revents & (POLLERR | POLLHUP | POLLNVAL)) {
-			log_error("set_protocol poll revents %u",
-				  pollfd.revents);
-			return -1;
-		}
-	}
-
-	if (our_protocol.daemon_run[0] != our_protocol.daemon_max[0] ||
-	    our_protocol.daemon_run[1] > our_protocol.daemon_max[1]) {
-		log_error("incompatible daemon protocol run %u.%u.%u max %u.%u.%u",
-			our_protocol.daemon_run[0],
-			our_protocol.daemon_run[1],
-			our_protocol.daemon_run[2],
-			our_protocol.daemon_max[0],
-			our_protocol.daemon_max[1],
-			our_protocol.daemon_max[2]);
-		return -1;
-	}
-
-	if (our_protocol.kernel_run[0] != our_protocol.kernel_max[0] ||
-	    our_protocol.kernel_run[1] > our_protocol.kernel_max[1]) {
-		log_error("incompatible kernel protocol run %u.%u.%u max %u.%u.%u",
-			our_protocol.kernel_run[0],
-			our_protocol.kernel_run[1],
-			our_protocol.kernel_run[2],
-			our_protocol.kernel_max[0],
-			our_protocol.kernel_max[1],
-			our_protocol.kernel_max[2]);
-		return -1;
-	}
-
-	log_debug("daemon run %u.%u.%u max %u.%u.%u "
-		  "kernel run %u.%u.%u max %u.%u.%u",
-		  our_protocol.daemon_run[0],
-		  our_protocol.daemon_run[1],
-		  our_protocol.daemon_run[2],
-		  our_protocol.daemon_max[0],
-		  our_protocol.daemon_max[1],
-		  our_protocol.daemon_max[2],
-		  our_protocol.kernel_run[0],
-		  our_protocol.kernel_run[1],
-		  our_protocol.kernel_run[2],
-		  our_protocol.kernel_max[0],
-		  our_protocol.kernel_max[1],
-		  our_protocol.kernel_max[2]);
-	return 0;
-}
-
-static void deliver_cb_daemon(cpg_handle_t handle, struct cpg_name *group_name,
-		uint32_t nodeid, uint32_t pid, void *data, int len)
-{
-	struct dlm_header *hd;
-
-	if (len < sizeof(*hd)) {
-		log_error("deliver_cb short message %d", len);
-		return;
-	}
-
-	hd = (struct dlm_header *)data;
-	dlm_header_in(hd);
-
-	switch (hd->type) {
-	case DLM_MSG_PROTOCOL:
-		receive_protocol(hd, len);
-		break;
-	default:
-		log_error("deliver_cb_daemon unknown msg type %d", hd->type);
-	}
-}
-
-static void confchg_cb_daemon(cpg_handle_t handle, struct cpg_name *group_name,
-		struct cpg_address *member_list, int member_list_entries,
-		struct cpg_address *left_list, int left_list_entries,
-		struct cpg_address *joined_list, int joined_list_entries)
-{
-	int i;
-
-	if (joined_list_entries)
-		send_protocol(&our_protocol);
-
-	memset(&daemon_member, 0, sizeof(daemon_member));
-	daemon_member_count = member_list_entries;
-
-	for (i = 0; i < member_list_entries; i++) {
-		daemon_member[i] = member_list[i];
-		add_node_daemon(member_list[i].nodeid);
-	}
-}
-
-static cpg_callbacks_t cpg_callbacks_daemon = {
-	.cpg_deliver_fn = deliver_cb_daemon,
-	.cpg_confchg_fn = confchg_cb_daemon,
-};
-
-void process_cpg(int ci)
-{
-	cpg_error_t error;
-
-	error = cpg_dispatch(daemon_cpg_handle, CPG_DISPATCH_ALL);
-	if (error != CPG_OK)
-		log_error("daemon cpg_dispatch error %d", error);
-}
-
-int setup_cpg(void)
-{
-	cpg_error_t error;
-	struct cpg_name name;
-	int i = 0;
-
-	INIT_LIST_HEAD(&daemon_nodes);
-
-	memset(&our_protocol, 0, sizeof(our_protocol));
-	our_protocol.daemon_max[0] = 1;
-	our_protocol.daemon_max[1] = 1;
-	our_protocol.daemon_max[2] = 1;
-	our_protocol.kernel_max[0] = 1;
-	our_protocol.kernel_max[1] = 1;
-	our_protocol.kernel_max[2] = 1;
-
-	error = cpg_initialize(&daemon_cpg_handle, &cpg_callbacks_daemon);
-	if (error != CPG_OK) {
-		log_error("daemon cpg_initialize error %d", error);
-		return -1;
-	}
-
-	cpg_fd_get(daemon_cpg_handle, &daemon_cpg_fd);
-
-	memset(&name, 0, sizeof(name));
-	sprintf(name.value, "dlm:controld");
-	name.length = strlen(name.value) + 1;
-
- retry:
-	error = cpg_join(daemon_cpg_handle, &name);
-	if (error == CPG_ERR_TRY_AGAIN) {
-		sleep(1);
-		if (!(++i % 10))
-			log_error("daemon cpg_join error retrying");
-		goto retry;
-	}
-	if (error != CPG_OK) {
-		log_error("daemon cpg_join error %d", error);
-		goto fail;
-	}
-
-	log_debug("setup_cpg %d", daemon_cpg_fd);
-	return daemon_cpg_fd;
-
- fail:
-	cpg_finalize(daemon_cpg_handle);
-	return -1;
-}
-
-void close_cpg(void)
-{
-	cpg_error_t error;
-	struct cpg_name name;
-	int i = 0;
-
-	if (!daemon_cpg_handle || cluster_down)
-		return;
-
-	memset(&name, 0, sizeof(name));
-	sprintf(name.value, "dlm:controld");
-	name.length = strlen(name.value) + 1;
-
- retry:
-	error = cpg_leave(daemon_cpg_handle, &name);
-	if (error == CPG_ERR_TRY_AGAIN) {
-		sleep(1);
-		if (!(++i % 10))
-			log_error("daemon cpg_leave error retrying");
-		goto retry;
-	}
-	if (error != CPG_OK)
-		log_error("daemon cpg_leave error %d", error);
-}
-
-/* fs_controld has seen nodedown for nodeid; it's now ok for dlm to do
-   recovery for the failed node */
-
-int set_fs_notified(struct lockspace *ls, int nodeid)
-{
-	struct node *node;
-
-	/* this shouldn't happen */
-	node = get_node_history(ls, nodeid);
-	if (!node) {
-		log_error("set_fs_notified no nodeid %d", nodeid);
-		return -ESRCH;
-	}
-
-	/* this can happen, we haven't seen a nodedown for this node yet,
-	   but we should soon */
-	if (!node->check_fs) {
-		log_group(ls, "set_fs_notified %d zero check_fs", nodeid);
-		return -EAGAIN;
-	}
-
-	node->fs_notified = 1;
-	return 0;
-}
-
-int set_lockspace_info(struct lockspace *ls, struct dlmc_lockspace *lockspace)
-{
-	struct change *cg, *last = NULL;
-
-	strncpy(lockspace->name, ls->name, DLM_LOCKSPACE_LEN);
-	lockspace->global_id = ls->global_id;
-
-	if (ls->joining)
-		lockspace->flags |= DLMC_LF_JOINING;
-	if (ls->leaving)
-		lockspace->flags |= DLMC_LF_LEAVING;
-	if (ls->kernel_stopped)
-		lockspace->flags |= DLMC_LF_KERNEL_STOPPED;
-	if (ls->fs_registered)
-		lockspace->flags |= DLMC_LF_FS_REGISTERED;
-	if (ls->need_plocks)
-		lockspace->flags |= DLMC_LF_NEED_PLOCKS;
-	if (ls->save_plocks)
-		lockspace->flags |= DLMC_LF_SAVE_PLOCKS;
-
-	if (!ls->started_change)
-		goto next;
-
-	cg = ls->started_change;
-
-	lockspace->cg_prev.member_count = cg->member_count;
-	lockspace->cg_prev.joined_count = cg->joined_count;
-	lockspace->cg_prev.remove_count = cg->remove_count;
-	lockspace->cg_prev.failed_count = cg->failed_count;
-	lockspace->cg_prev.combined_seq = cg->combined_seq;
-	lockspace->cg_prev.seq = cg->seq;
-
- next:
-	if (list_empty(&ls->changes))
-		goto out;
-
-	list_for_each_entry(cg, &ls->changes, list)
-		last = cg;
-
-	cg = list_first_entry(&ls->changes, struct change, list);
-
-	lockspace->cg_next.member_count = cg->member_count;
-	lockspace->cg_next.joined_count = cg->joined_count;
-	lockspace->cg_next.remove_count = cg->remove_count;
-	lockspace->cg_next.failed_count = cg->failed_count;
-	lockspace->cg_next.combined_seq = last->seq;
-	lockspace->cg_next.seq = cg->seq;
-
-	if (cg->state == CGST_WAIT_CONDITIONS)
-		lockspace->cg_next.wait_condition = 4;
-	if (poll_fencing)
-		lockspace->cg_next.wait_condition = 1;
-	else if (poll_quorum)
-		lockspace->cg_next.wait_condition = 2;
-	else if (poll_fs)
-		lockspace->cg_next.wait_condition = 3;
-
-	if (cg->state == CGST_WAIT_MESSAGES)
-		lockspace->cg_next.wait_messages = 1;
- out:
-	return 0;
-}
-
-static int _set_node_info(struct lockspace *ls, struct change *cg, int nodeid,
-			  struct dlmc_node *node)
-{
-	struct member *m = NULL;
-	struct node *n;
-
-	node->nodeid = nodeid;
-
-	if (cg)
-		m = find_memb(cg, nodeid);
-	if (!m)
-		goto history;
-
-	node->flags |= DLMC_NF_MEMBER;
-
-	if (m->start)
-		node->flags |= DLMC_NF_START;
-	if (m->disallowed)
-		node->flags |= DLMC_NF_DISALLOWED;
-
- history:
-	n = get_node_history(ls, nodeid);
-	if (!n)
-		goto out;
-
-	if (n->check_fencing)
-		node->flags |= DLMC_NF_CHECK_FENCING;
-	if (n->check_quorum)
-		node->flags |= DLMC_NF_CHECK_QUORUM;
-	if (n->check_fs)
-		node->flags |= DLMC_NF_CHECK_FS;
-
-	node->added_seq = n->added_seq;
-	node->removed_seq = n->removed_seq;
-	node->failed_reason = n->failed_reason;
- out:
-	return 0;
-}
-
-int set_node_info(struct lockspace *ls, int nodeid, struct dlmc_node *node)
-{
-	struct change *cg;
-
-	if (!list_empty(&ls->changes)) {
-		cg = list_first_entry(&ls->changes, struct change, list);
-		return _set_node_info(ls, cg, nodeid, node);
-	}
-
-	return _set_node_info(ls, ls->started_change, nodeid, node);
-}
-
-int set_lockspaces(int *count, struct dlmc_lockspace **lss_out)
-{
-	struct lockspace *ls;
-	struct dlmc_lockspace *lss, *lsp;
-	int ls_count = 0;
-
-	list_for_each_entry(ls, &lockspaces, list)
-		ls_count++;
-
-	lss = malloc(ls_count * sizeof(struct dlmc_lockspace));
-	if (!lss)
-		return -ENOMEM;
-	memset(lss, 0, ls_count * sizeof(struct dlmc_lockspace));
-
-	lsp = lss;
-	list_for_each_entry(ls, &lockspaces, list) {
-		set_lockspace_info(ls, lsp++);
-	}
-
-	*count = ls_count;
-	*lss_out = lss;
-	return 0;
-}
-
-int set_lockspace_nodes(struct lockspace *ls, int option, int *node_count,
-                        struct dlmc_node **nodes_out)
-{
-	struct change *cg;
-	struct node *n;
-	struct dlmc_node *nodes = NULL, *nodep;
-	struct member *memb;
-	int count = 0;
-
-	if (option == DLMC_NODES_ALL) {
-		if (!list_empty(&ls->changes))
-			cg = list_first_entry(&ls->changes, struct change,list);
-		else
-			cg = ls->started_change;
-
-		list_for_each_entry(n, &ls->node_history, list)
-			count++;
-
-	} else if (option == DLMC_NODES_MEMBERS) {
-		if (!ls->started_change)
-			goto out;
-		cg = ls->started_change;
-		count = cg->member_count;
-
-	} else if (option == DLMC_NODES_NEXT) {
-		if (list_empty(&ls->changes))
-			goto out;
-		cg = list_first_entry(&ls->changes, struct change, list);
-		count = cg->member_count;
-	} else
-		goto out;
-
-	nodes = malloc(count * sizeof(struct dlmc_node));
-	if (!nodes)
-		return -ENOMEM;
-	memset(nodes, 0, count * sizeof(struct dlmc_node));
-	nodep = nodes;
-
-	if (option == DLMC_NODES_ALL) {
-		list_for_each_entry(n, &ls->node_history, list)
-			_set_node_info(ls, cg, n->nodeid, nodep++);
-	} else {
-		list_for_each_entry(memb, &cg->members, list)
-			_set_node_info(ls, cg, memb->nodeid, nodep++);
-	}
- out:
-	*node_count = count;
-	*nodes_out = nodes;
-	return 0;
-}
-
diff --git a/group/dlm_controld/crc.c b/group/dlm_controld/crc.c
deleted file mode 100644
index ff8c1d3..0000000
--- a/group/dlm_controld/crc.c
+++ /dev/null
@@ -1,72 +0,0 @@
-#include "dlm_daemon.h"
-
-static const uint32_t crc_32_tab[] = {
-  0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
-  0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
-  0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
-  0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
-  0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
-  0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
-  0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
-  0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
-  0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
-  0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
-  0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
-  0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
-  0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
-  0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
-  0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
-  0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
-  0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
-  0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
-  0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
-  0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
-  0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
-  0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
-  0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
-  0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
-  0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
-  0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
-  0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
-  0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
-  0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
-  0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
-  0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
-  0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
-};
-
-/**
- *
- * Copied from:
- *
- * gfs2_disk_hash - hash an array of data
- * @data: the data to be hashed
- * @len: the length of data to be hashed
- *
- * This function must produce the same results as the one in the kernel:
- *   crc32_le(0xFFFFFFFF, data, len) ^ 0xFFFFFFFF
- *
- * Take some data and convert it to a 32-bit hash.
- *
- * The hash function is a 32-bit CRC of the data.  The algorithm uses
- * the crc_32_tab table above.
- *
- * This may not be the fastest hash function, but it does a fair bit better
- * at providing uniform results than the others I've looked at.  That's
- * really important for efficient directories.
- *
- * Returns: the hash
- */
-
-uint32_t cpgname_to_crc(const char *data, int len)
-{
-	uint32_t hash = 0xFFFFFFFF;
-
-	for (; len--; data++)
-		hash = crc_32_tab[(hash ^ *data) & 0xFF] ^ (hash >> 8);
-
-	hash = ~hash;
-
-	return hash;
-}
-
diff --git a/group/dlm_controld/deadlock.c b/group/dlm_controld/deadlock.c
deleted file mode 100644
index 4d93420..0000000
--- a/group/dlm_controld/deadlock.c
+++ /dev/null
@@ -1,1547 +0,0 @@
-#include "dlm_daemon.h"
-#include "config.h"
-#include "libdlm.h"
-
-static SaCkptHandleT global_ckpt_h;
-static SaCkptCallbacksT callbacks = { 0, 0 };
-static SaVersionT version = { 'B', 1, 1 };
-static char section_buf[10 * 1024 * 1024];  /* 10MB of pack_lock's enough? */
-static uint32_t section_len;
-static uint32_t section_max;
-
-struct node {
-	struct list_head	list;
-	int			nodeid;
-	int			checkpoint_ready; /* we've read its ckpt */
-	int			in_cycle;         /* participating in cycle */
-};
-
-enum {
-	LOCAL_COPY = 1,
-	MASTER_COPY = 2,
-};
-
-/* from linux/fs/dlm/dlm_internal.h */
-#define DLM_LKSTS_WAITING       1
-#define DLM_LKSTS_GRANTED       2
-#define DLM_LKSTS_CONVERT       3
-
-struct pack_lock {
-	uint64_t		xid;
-	uint32_t		id;
-	int			nodeid;
-	uint32_t		remid;
-	int			ownpid;
-	uint32_t		exflags;
-	uint32_t		flags;
-	int8_t			status;
-	int8_t			grmode;
-	int8_t			rqmode;
-	int8_t			copy;
-};
-
-struct dlm_rsb {
-	struct list_head	list;
-	struct list_head	locks;
-	char			name[DLM_RESNAME_MAXLEN];
-	int			len;
-};
-
-/* information is saved in the lkb, and lkb->lock, from the perspective of the
-   local or master copy, not the process copy */
-
-struct dlm_lkb {
-	struct list_head        list;       /* r->locks */
-	struct pack_lock	lock;       /* data from debugfs/checkpoint */
-	int			home;       /* node where the lock owner lives*/
-	struct dlm_rsb		*rsb;       /* lock is on resource */
-	struct trans		*trans;     /* lock owned by this transaction */
-	struct list_head	trans_list; /* tr->locks */
-	struct trans		*waitfor_trans; /* the trans that's holding the
-						   lock that's blocking us */
-};
-
-/* waitfor pointers alloc'ed 4 at at time */
-#define TR_NALLOC		4
-
-struct trans {
-	struct list_head	list;
-	struct list_head	locks;
-	uint64_t		xid;
-	int			others_waiting_on_us; /* count of trans's
-							 pointing to us in
-							 waitfor */
-	int			waitfor_alloc;
-	int			waitfor_count;        /* count of in-use
-							 waitfor slots and
-						         num of trans's we're
-						         waiting on */
-	struct trans		**waitfor;	      /* waitfor_alloc trans
-							 pointers */
-};
-
-static const int __dlm_compat_matrix[8][8] = {
-      /* UN NL CR CW PR PW EX PD */
-        {1, 1, 1, 1, 1, 1, 1, 0},       /* UN */
-        {1, 1, 1, 1, 1, 1, 1, 0},       /* NL */
-        {1, 1, 1, 1, 1, 1, 0, 0},       /* CR */
-        {1, 1, 1, 1, 0, 0, 0, 0},       /* CW */
-        {1, 1, 1, 0, 1, 0, 0, 0},       /* PR */
-        {1, 1, 1, 0, 0, 0, 0, 0},       /* PW */
-        {1, 1, 0, 0, 0, 0, 0, 0},       /* EX */
-        {0, 0, 0, 0, 0, 0, 0, 0}        /* PD */
-};
-
-static inline int dlm_modes_compat(int mode1, int mode2)
-{
-	return __dlm_compat_matrix[mode1 + 1][mode2 + 1];
-}
-
-static char *status_str(int lksts)
-{
-	switch (lksts) {
-	case DLM_LKSTS_WAITING:
-		return "W";
-	case DLM_LKSTS_GRANTED:
-		return "G";
-	case DLM_LKSTS_CONVERT:
-		return "C";
-	}
-	return "?";
-}
-
-static void free_resources(struct lockspace *ls)
-{
-	struct dlm_rsb *r, *r_safe;
-	struct dlm_lkb *lkb, *lkb_safe;
-
-	list_for_each_entry_safe(r, r_safe, &ls->resources, list) {
-		list_for_each_entry_safe(lkb, lkb_safe, &r->locks, list) {
-			list_del(&lkb->list);
-			if (!list_empty(&lkb->trans_list))
-				list_del(&lkb->trans_list);
-			free(lkb);
-		}
-		list_del(&r->list);
-		free(r);
-	}
-}
-
-static void free_transactions(struct lockspace *ls)
-{
-	struct trans *tr, *tr_safe;
-
-	list_for_each_entry_safe(tr, tr_safe, &ls->transactions, list) {
-		list_del(&tr->list);
-		if (tr->waitfor)
-			free(tr->waitfor);
-		free(tr);
-	}
-}
-
-static void disable_deadlock(void)
-{
-	log_error("FIXME: deadlock detection disabled");
-}
-
-void setup_deadlock(void)
-{
-	SaAisErrorT rv;
-
-	if (!cfgd_enable_deadlk)
-		return;
-
-	rv = saCkptInitialize(&global_ckpt_h, &callbacks, &version);
-	if (rv != SA_AIS_OK)
-		log_error("ckpt init error %d", rv);
-}
-
-static struct dlm_rsb *get_resource(struct lockspace *ls, char *name, int len)
-{
-	struct dlm_rsb *r;
-
-	list_for_each_entry(r, &ls->resources, list) {
-		if (r->len == len && !strncmp(r->name, name, len))
-			return r;
-	}
-
-	r = malloc(sizeof(struct dlm_rsb));
-	if (!r) {
-		log_error("get_resource: no memory");
-		disable_deadlock();
-		return NULL;
-	}
-	memset(r, 0, sizeof(struct dlm_rsb));
-	memcpy(r->name, name, len);
-	r->len = len;
-	INIT_LIST_HEAD(&r->locks);
-	list_add(&r->list, &ls->resources);
-	return r;
-}
-
-static struct dlm_lkb *create_lkb(void)
-{
-	struct dlm_lkb *lkb;
-
-	lkb = malloc(sizeof(struct dlm_lkb));
-	if (!lkb) {
-		log_error("create_lkb: no memory");
-		disable_deadlock();
-	} else {
-		memset(lkb, 0, sizeof(struct dlm_lkb));
-		INIT_LIST_HEAD(&lkb->list);
-		INIT_LIST_HEAD(&lkb->trans_list);
-	}
-	return lkb;
-}
-
-static void add_lkb(struct dlm_rsb *r, struct dlm_lkb *lkb)
-{
-	list_add(&lkb->list, &r->locks);
-	lkb->rsb = r;
-}
-
-/* from linux/fs/dlm/dlm_internal.h */
-#define IFL_MSTCPY 0x00010000
-
-/* called on a lock that's just been read from debugfs */
-
-static void set_copy(struct pack_lock *lock)
-{
-	uint32_t id, remid;
-
-	if (!lock->nodeid)
-		lock->copy = LOCAL_COPY;
-	else if (lock->flags & IFL_MSTCPY)
-		lock->copy = MASTER_COPY;
-	else {
-		/* process copy lock is converted to a partial master copy
-		   lock that will be combined with the real master copy */
-		lock->copy = MASTER_COPY;
-		id = lock->id;
-		remid = lock->remid;
-		lock->id = remid;
-		lock->remid = id;
-		lock->nodeid = our_nodeid;
-	}
-}
-
-/* xid is always zero in the real master copy, xid should always be non-zero
-   in the partial master copy (what was a process copy) */
-/* TODO: confirm or enforce that the partial will always have non-zero xid */
-
-static int partial_master_copy(struct pack_lock *lock)
-{
-	return (lock->xid != 0);
-}
-
-static struct dlm_lkb *get_lkb(struct dlm_rsb *r, struct pack_lock *lock)
-{
-	struct dlm_lkb *lkb;
-
-	if (lock->copy != MASTER_COPY)
-		goto out;
-
-	list_for_each_entry(lkb, &r->locks, list) {
-		if (lkb->lock.nodeid == lock->nodeid &&
-		    lkb->lock.id == lock->id)
-			return lkb;
-	}
- out:
-	return create_lkb();
-}
-
-static struct dlm_lkb *add_lock(struct lockspace *ls, struct dlm_rsb *r,
-				int from_nodeid, struct pack_lock *lock)
-{
-	struct dlm_lkb *lkb;
-
-	lkb = get_lkb(r, lock);
-	if (!lkb)
-		return NULL;
-
-	switch (lock->copy) {
-	case LOCAL_COPY:
-		lkb->lock.xid     = lock->xid;
-		lkb->lock.nodeid  = lock->nodeid;
-		lkb->lock.id      = lock->id;
-		lkb->lock.remid   = lock->remid;
-		lkb->lock.ownpid  = lock->ownpid;
-		lkb->lock.exflags = lock->exflags;
-		lkb->lock.flags   = lock->flags;
-		lkb->lock.status  = lock->status;
-		lkb->lock.grmode  = lock->grmode;
-		lkb->lock.rqmode  = lock->rqmode;
-		lkb->lock.copy    = LOCAL_COPY;
-		lkb->home = from_nodeid;
-
-		log_group(ls, "add %s local nodeid %d id %x remid %x xid %llx",
-			  r->name, lock->nodeid, lock->id, lock->remid,
-			  (unsigned long long)lock->xid);
-		break;
-
-	case MASTER_COPY:
-		if (partial_master_copy(lock)) {
-			lkb->lock.xid     = lock->xid;
-			lkb->lock.nodeid  = lock->nodeid;
-			lkb->lock.id      = lock->id;
-			lkb->lock.remid   = lock->remid;
-			lkb->lock.copy    = MASTER_COPY;
-		} else {
-			/* only set xid from partial master copy above */
-			lkb->lock.nodeid  = lock->nodeid;
-			lkb->lock.id      = lock->id;
-			lkb->lock.remid   = lock->remid;
-			lkb->lock.copy    = MASTER_COPY;
-			/* set other fields from real master copy */
-			lkb->lock.ownpid  = lock->ownpid;
-			lkb->lock.exflags = lock->exflags;
-			lkb->lock.flags   = lock->flags;
-			lkb->lock.status  = lock->status;
-			lkb->lock.grmode  = lock->grmode;
-			lkb->lock.rqmode  = lock->rqmode;
-		}
-		lkb->home = lock->nodeid;
-
-		log_group(ls, "add %s master nodeid %d id %x remid %x xid %llx",
-			  r->name, lock->nodeid, lock->id, lock->remid,
-			  (unsigned long long)lock->xid);
-		break;
-	}
-
-	if (list_empty(&lkb->list))
-		add_lkb(r, lkb);
-	return lkb;
-}
-
-static void parse_r_name(char *line, char *name)
-{
-	char *p;
-	int i = 0;
-	int begin = 0;
-
-	for (p = line; ; p++) {
-		if (*p == '"') {
-			if (begin)
-				break;
-			begin = 1;
-			continue;
-		}
-		if (begin)
-			name[i++] = *p;
-	}
-}
-
-#define LOCK_LINE_MAX 1024
-
-static int read_debugfs_locks(struct lockspace *ls)
-{
-	FILE *file;
-	char path[PATH_MAX];
-	char line[LOCK_LINE_MAX];
-	struct dlm_rsb *r;
-	struct pack_lock lock;
-	char r_name[65];
-	unsigned long long xid;
-	unsigned int waiting;
-	int r_nodeid;
-	int r_len;
-	int rv;
-
-	snprintf(path, PATH_MAX, "/sys/kernel/debug/dlm/%s_locks", ls->name);
-
-	file = fopen(path, "r");
-	if (!file)
-		return -1;
-
-	/* skip the header on the first line */
-	if (!fgets(line, LOCK_LINE_MAX, file)) {
-		log_error("Unable to read %s: %d", path, errno);
-		goto out;
-	}
-
-	while (fgets(line, LOCK_LINE_MAX, file)) {
-		memset(&lock, 0, sizeof(struct pack_lock));
-
-		rv = sscanf(line, "%x %d %x %u %llu %x %x %hhd %hhd %hhd %u %d %d",
-			    &lock.id,
-			    &lock.nodeid,
-			    &lock.remid,
-			    &lock.ownpid,
-			    &xid,
-			    &lock.exflags,
-			    &lock.flags,
-			    &lock.status,
-			    &lock.grmode,
-			    &lock.rqmode,
-			    &waiting,
-			    &r_nodeid,
-			    &r_len);
-
-		lock.xid = xid; /* hack to avoid warning */
-
-		if (rv != 13) {
-			log_error("invalid debugfs line %d: %s", rv, line);
-			goto out;
-		}
-
-		memset(r_name, 0, sizeof(r_name));
-		parse_r_name(line, r_name);
-
-		r = get_resource(ls, r_name, r_len);
-		if (!r)
-			break;
-
-		set_copy(&lock);
-		add_lock(ls, r, our_nodeid, &lock);
-	}
- out:
-	fclose(file);
-	return 0;
-}
-
-static int read_checkpoint_locks(struct lockspace *ls, int from_nodeid,
-			         char *numbuf, int buflen)
-{
-	struct dlm_rsb *r;
-	struct pack_lock *lock;
-	int count = section_len / sizeof(struct pack_lock);
-	int i;
-
-	r = get_resource(ls, numbuf, buflen - 1);
-	if (!r)
-		return -1;
-
-	lock = (struct pack_lock *) &section_buf;
-
-	for (i = 0; i < count; i++) {
-		lock->xid     = le64_to_cpu(lock->xid);
-		lock->id      = le32_to_cpu(lock->id);
-		lock->nodeid  = le32_to_cpu(lock->nodeid);
-		lock->remid   = le32_to_cpu(lock->remid);
-		lock->ownpid  = le32_to_cpu(lock->ownpid);
-		lock->exflags = le32_to_cpu(lock->exflags);
-		lock->flags   = le32_to_cpu(lock->flags);
-
-		add_lock(ls, r, from_nodeid, lock);
-		lock++;
-	}
-	return 0;
-}
-
-static int pack_lkb_list(struct list_head *q, struct pack_lock **lockp)
-{
-	struct dlm_lkb *lkb;
-	struct pack_lock *lock = *lockp;
-	int count = 0;
-
-	list_for_each_entry(lkb, q, list) {
-		if (count + 1 > section_max) {
-			log_error("too many locks %d for ckpt buf", count);
-			break;
-		}
-
-		lock->xid     = cpu_to_le64(lkb->lock.xid);
-		lock->id      = cpu_to_le32(lkb->lock.id);
-		lock->nodeid  = cpu_to_le32(lkb->lock.nodeid);
-		lock->remid   = cpu_to_le32(lkb->lock.remid);
-		lock->ownpid  = cpu_to_le32(lkb->lock.ownpid);
-		lock->exflags = cpu_to_le32(lkb->lock.exflags);
-		lock->flags   = cpu_to_le32(lkb->lock.flags);
-		lock->status  = lkb->lock.status;
-		lock->grmode  = lkb->lock.grmode;
-		lock->rqmode  = lkb->lock.rqmode;
-		lock->copy    = lkb->lock.copy;
-
-		lock++;
-		count++;
-	}
-	return count;
-}
-
-static void pack_section_buf(struct lockspace *ls, struct dlm_rsb *r)
-{
-	struct pack_lock *lock;
-	int count;
-
-	memset(&section_buf, 0, sizeof(section_buf));
-	section_max = sizeof(section_buf) / sizeof(struct pack_lock);
-
-	lock = (struct pack_lock *) &section_buf;
-
-	count = pack_lkb_list(&r->locks, &lock);
-
-	section_len = count * sizeof(struct pack_lock);
-}
-
-static int _unlink_checkpoint(struct lockspace *ls, SaNameT *name)
-{
-	SaCkptCheckpointHandleT h;
-	SaCkptCheckpointDescriptorT s;
-	SaAisErrorT rv;
-	int ret = 0;
-	int retries;
-
-	h = (SaCkptCheckpointHandleT) ls->deadlk_ckpt_handle;
-	log_group(ls, "unlink ckpt %llx", (unsigned long long)h);
-
-	retries = 0;
- unlink_retry:
-	rv = saCkptCheckpointUnlink(global_ckpt_h, name);
-	if (rv == SA_AIS_ERR_TRY_AGAIN) {
-		log_group(ls, "unlink ckpt retry");
-		sleep(1);
-		if (retries++ < 10)
-			goto unlink_retry;
-	}
-	if (rv == SA_AIS_OK)
-		goto out_close;
-	if (!h)
-		goto out;
-
-	log_error("unlink ckpt error %d %s", rv, ls->name);
-	ret = -1;
-
-	retries = 0;
- status_retry:
-	rv = saCkptCheckpointStatusGet(h, &s);
-	if (rv == SA_AIS_ERR_TRY_AGAIN) {
-		log_group(ls, "unlink ckpt status retry");
-		sleep(1);
-		if (retries++ < 10)
-			goto status_retry;
-	}
-	if (rv != SA_AIS_OK) {
-		log_error("unlink ckpt status error %d %s", rv, ls->name);
-		goto out_close;
-	}
-
-	log_group(ls, "unlink ckpt status: size %llu, max sections %u, "
-		      "max section size %llu, section count %u, mem %u",
-		 (unsigned long long)s.checkpointCreationAttributes.checkpointSize,
-		 s.checkpointCreationAttributes.maxSections,
-		 (unsigned long long)s.checkpointCreationAttributes.maxSectionSize,
-		 s.numberOfSections, s.memoryUsed);
-
- out_close:
-	retries = 0;
- close_retry:
-	rv = saCkptCheckpointClose(h);
-	if (rv == SA_AIS_ERR_TRY_AGAIN) {
-		log_group(ls, "unlink ckpt close retry");
-		sleep(1);
-		if (retries++ < 10)
-			goto close_retry;
-	}
-	if (rv != SA_AIS_OK) {
-		log_error("unlink ckpt %llx close err %d %s",
-			  (unsigned long long)h, rv, ls->name);
-	}
- out:
-	ls->deadlk_ckpt_handle = 0;
-	return ret;
-}
-
-static int unlink_checkpoint(struct lockspace *ls)
-{
-	SaNameT name;
-	int len;
-
-	len = snprintf((char *)name.value, SA_MAX_NAME_LENGTH, "dlmdeadlk.%s.%d",
-		       ls->name, our_nodeid);
-	name.length = len;
-
-	return _unlink_checkpoint(ls, &name);
-}
-
-static void read_checkpoint(struct lockspace *ls, int nodeid)
-{
-	SaCkptCheckpointHandleT h;
-	SaCkptSectionIterationHandleT itr;
-	SaCkptSectionDescriptorT desc;
-	SaCkptIOVectorElementT iov;
-	SaNameT name;
-	SaAisErrorT rv;
-	char buf[DLM_RESNAME_MAXLEN];
-	int len;
-	int retries;
-
-	if (nodeid == our_nodeid)
-		return;
-
-	log_group(ls, "read_checkpoint %d", nodeid);
-
-	len = snprintf((char *)name.value, SA_MAX_NAME_LENGTH, "dlmdeadlk.%s.%d",
-		       ls->name, nodeid);
-	name.length = len;
-
-	retries = 0;
- open_retry:
-	rv = saCkptCheckpointOpen(global_ckpt_h, &name, NULL,
-				  SA_CKPT_CHECKPOINT_READ, 0, &h);
-	if (rv == SA_AIS_ERR_TRY_AGAIN) {
-		log_group(ls, "read_checkpoint: %d ckpt open retry", nodeid);
-		sleep(1);
-		if (retries++ < 10)
-			goto open_retry;
-	}
-	if (rv != SA_AIS_OK) {
-		log_error("read_checkpoint: %d ckpt open error %d", nodeid, rv);
-		return;
-	}
-
-	retries = 0;
- init_retry:
-	rv = saCkptSectionIterationInitialize(h, SA_CKPT_SECTIONS_ANY, 0, &itr);
-	if (rv == SA_AIS_ERR_TRY_AGAIN) {
-		log_group(ls, "read_checkpoint: ckpt iterinit retry");
-		sleep(1);
-		if (retries++ < 10)
-			goto init_retry;
-	}
-	if (rv != SA_AIS_OK) {
-		log_error("read_checkpoint: %d ckpt iterinit error %d", nodeid, rv);
-		goto out;
-	}
-
-	while (1) {
-		retries = 0;
-	 next_retry:
-		rv = saCkptSectionIterationNext(itr, &desc);
-		if (rv == SA_AIS_ERR_NO_SECTIONS)
-			break;
-		if (rv == SA_AIS_ERR_TRY_AGAIN) {
-			log_group(ls, "read_checkpoint: ckpt iternext retry");
-			sleep(1);
-			if (retries++ < 10)
-				goto next_retry;
-		}
-		if (rv != SA_AIS_OK) {
-			log_error("read_checkpoint: %d ckpt iternext error %d",
-				  nodeid, rv);
-			goto out_it;
-		}
-
-		if (!desc.sectionSize)
-			continue;
-
-		iov.sectionId = desc.sectionId;
-		iov.dataBuffer = &section_buf;
-		iov.dataSize = desc.sectionSize;
-		iov.dataOffset = 0;
-
-		memset(&buf, 0, sizeof(buf));
-		snprintf(buf, sizeof(buf), "%s", desc.sectionId.id);
-
-		log_group(ls, "read_checkpoint: section size %llu id %u \"%s\"",
-			  (unsigned long long)iov.dataSize,
-			  iov.sectionId.idLen, buf);
-
-		retries = 0;
-	 read_retry:
-		rv = saCkptCheckpointRead(h, &iov, 1, NULL);
-		if (rv == SA_AIS_ERR_TRY_AGAIN) {
-			log_group(ls, "read_checkpoint: ckpt read retry");
-			sleep(1);
-			if (retries++ < 10)
-				goto read_retry;
-		}
-		if (rv != SA_AIS_OK) {
-			log_error("read_checkpoint: %d ckpt read error %d",
-				  nodeid, rv);
-			goto out_it;
-		}
-
-		section_len = iov.readSize;
-
-		if (!section_len)
-		       continue;
-
-		if (section_len % sizeof(struct pack_lock)) {
-			log_error("read_checkpoint: %d bad section len %d",
-				  nodeid, section_len);
-			continue;
-		}
-
-		read_checkpoint_locks(ls, nodeid, (char *)desc.sectionId.id,
-				      desc.sectionId.idLen);
-	}
-
- out_it:
-	saCkptSectionIterationFinalize(itr);
-	retries = 0;
- out:
-	rv = saCkptCheckpointClose(h);
-	if (rv == SA_AIS_ERR_TRY_AGAIN) {
-		log_group(ls, "read_checkpoint: unlink ckpt close retry");
-		sleep(1);
-		if (retries++ < 10)
-			goto out;
-	}
-	if (rv != SA_AIS_OK)
-		log_error("read_checkpoint: %d close error %d", nodeid, rv);
-}
-
-static void write_checkpoint(struct lockspace *ls)
-{
-	SaCkptCheckpointCreationAttributesT attr;
-	SaCkptCheckpointHandleT h;
-	SaCkptSectionIdT section_id;
-	SaCkptSectionCreationAttributesT section_attr;
-	SaCkptCheckpointOpenFlagsT flags;
-	SaNameT name;
-	SaAisErrorT rv;
-	char buf[DLM_RESNAME_MAXLEN];
-	struct dlm_rsb *r;
-	struct dlm_lkb *lkb;
-	int r_count, lock_count, total_size, section_size, max_section_size;
-	int len;
-
-	len = snprintf((char *)name.value, SA_MAX_NAME_LENGTH, "dlmdeadlk.%s.%d",
-		      ls->name, our_nodeid);
-	name.length = len;
-
-	/* unlink an old checkpoint before we create a new one */
-	if (ls->deadlk_ckpt_handle) {
-		log_error("write_checkpoint: old ckpt");
-		if (_unlink_checkpoint(ls, &name))
-			return;
-	}
-
-	/* loop through all locks to figure out sizes to set in
-	   the attr fields */
-
-	r_count = 0;
-	lock_count = 0;
-	total_size = 0;
-	max_section_size = 0;
-
-	list_for_each_entry(r, &ls->resources, list) {
-		r_count++;
-		section_size = 0;
-		list_for_each_entry(lkb, &r->locks, list) {
-			section_size += sizeof(struct pack_lock);
-			lock_count++;
-		}
-		total_size += section_size;
-		if (section_size > max_section_size)
-			max_section_size = section_size;
-	}
-
-	log_group(ls, "write_checkpoint: r_count %d, lock_count %d",
-		  r_count, lock_count);
-
-	log_group(ls, "write_checkpoint: total %d bytes, max_section %d bytes",
-		  total_size, max_section_size);
-
-	attr.creationFlags = SA_CKPT_WR_ALL_REPLICAS;
-	attr.checkpointSize = total_size;
-	attr.retentionDuration = SA_TIME_MAX;
-	attr.maxSections = r_count + 1;      /* don't know why we need +1 */
-	attr.maxSectionSize = max_section_size;
-	attr.maxSectionIdSize = DLM_RESNAME_MAXLEN;
-
-	flags = SA_CKPT_CHECKPOINT_READ |
-		SA_CKPT_CHECKPOINT_WRITE |
-		SA_CKPT_CHECKPOINT_CREATE;
-
- open_retry:
-	rv = saCkptCheckpointOpen(global_ckpt_h, &name, &attr, flags, 0, &h);
-	if (rv == SA_AIS_ERR_TRY_AGAIN) {
-		log_group(ls, "write_checkpoint: ckpt open retry");
-		sleep(1);
-		goto open_retry;
-	}
-	if (rv == SA_AIS_ERR_EXIST) {
-		log_group(ls, "write_checkpoint: ckpt already exists");
-		return;
-	}
-	if (rv != SA_AIS_OK) {
-		log_group(ls, "write_checkpoint: ckpt open error %d", rv);
-		return;
-	}
-
-	log_group(ls, "write_checkpoint: open ckpt handle %llx",
-		  (unsigned long long)h);
-	ls->deadlk_ckpt_handle = (uint64_t) h;
-
-	list_for_each_entry(r, &ls->resources, list) {
-		memset(buf, 0, sizeof(buf));
-		len = snprintf(buf, sizeof(buf), "%s", r->name);
-
-		section_id.id = (void *)buf;
-		section_id.idLen = len + 1;
-		section_attr.sectionId = &section_id;
-		section_attr.expirationTime = SA_TIME_END;
-
-		pack_section_buf(ls, r);
-
-		log_group(ls, "write_checkpoint: section size %u id %u \"%s\"",
-			  section_len, section_id.idLen, buf);
-
-	 create_retry:
-		rv = saCkptSectionCreate(h, &section_attr, &section_buf,
-					 section_len);
-		if (rv == SA_AIS_ERR_TRY_AGAIN) {
-			log_group(ls, "write_checkpoint: ckpt create retry");
-			sleep(1);
-			goto create_retry;
-		}
-		if (rv == SA_AIS_ERR_EXIST) {
-			/* this shouldn't happen in general */
-			log_error("write_checkpoint: clearing old ckpt");
-			saCkptCheckpointClose(h);
-			_unlink_checkpoint(ls, &name);
-			goto open_retry;
-		}
-		if (rv != SA_AIS_OK) {
-			log_error("write_checkpoint: section create %d", rv);
-			break;
-		}
-	}
-}
-
-static void send_message(struct lockspace *ls, int type,
-			 uint32_t to_nodeid, uint32_t msgdata)
-{
-	struct dlm_header *hd;
-	int len;
-	char *buf;
-
-	len = sizeof(struct dlm_header);
-	buf = malloc(len);
-	if (!buf) {
-		log_error("send_message: no memory");
-		disable_deadlock();
-		return;
-	}
-	memset(buf, 0, len);
-
-	hd = (struct dlm_header *)buf;
-	hd->type = type;
-	hd->to_nodeid = to_nodeid;
-	hd->msgdata = msgdata;
-
-	dlm_send_message(ls, buf, len);
-
-	free(buf);
-}
-
-static void send_checkpoint_ready(struct lockspace *ls)
-{
-	log_group(ls, "send_checkpoint_ready");
-	send_message(ls, DLM_MSG_DEADLK_CHECKPOINT_READY, 0, 0);
-}
-
-void send_cycle_start(struct lockspace *ls)
-{
-	log_group(ls, "send_cycle_start");
-	send_message(ls, DLM_MSG_DEADLK_CYCLE_START, 0, 0);
-}
-
-static void send_cycle_end(struct lockspace *ls)
-{
-	log_group(ls, "send_cycle_end");
-	send_message(ls, DLM_MSG_DEADLK_CYCLE_END, 0, 0);
-}
-
-static void send_cancel_lock(struct lockspace *ls, struct trans *tr,
-			     struct dlm_lkb *lkb)
-{
-	int to_nodeid;
-	uint32_t lkid;
-
-	if (!lkb->lock.nodeid)
-		lkid = lkb->lock.id;
-	else
-		lkid = lkb->lock.remid;
-	to_nodeid = lkb->home;
-
-	log_group(ls, "send_cancel_lock to nodeid %d rsb %s id %x xid %llx",
-		  to_nodeid, lkb->rsb->name, lkid,
-		  (unsigned long long)lkb->lock.xid);
-
-	send_message(ls, DLM_MSG_DEADLK_CANCEL_LOCK, to_nodeid, lkid);
-}
-
-static void dump_resources(struct lockspace *ls)
-{
-	struct dlm_rsb *r;
-	struct dlm_lkb *lkb;
-
-	log_group(ls, "Resource dump:");
-
-	list_for_each_entry(r, &ls->resources, list) {
-		log_group(ls, "\"%s\" len %d", r->name, r->len);
-		list_for_each_entry(lkb, &r->locks, list) {
-			log_group(ls, "  %s: nodeid %d id %08x remid %08x gr %s rq %s pid %u xid %llx",
-			  	  status_str(lkb->lock.status),
-				  lkb->lock.nodeid,
-			  	  lkb->lock.id,
-			  	  lkb->lock.remid,
-			  	  dlm_mode_str(lkb->lock.grmode),
-			          dlm_mode_str(lkb->lock.rqmode),
-			          lkb->lock.ownpid,
-				  (unsigned long long)lkb->lock.xid);
-		}
-	}
-}
-
-static void find_deadlock(struct lockspace *ls);
-
-static void run_deadlock(struct lockspace *ls)
-{
-	struct node *node;
-	int not_ready = 0;
-	int low = -1;
-
-	if (ls->all_checkpoints_ready)
-		log_group(ls, "WARNING: run_deadlock all_checkpoints_ready");
-
-	list_for_each_entry(node, &ls->deadlk_nodes, list) {
-		if (!node->in_cycle)
-			continue;
-		if (!node->checkpoint_ready)
-			not_ready++;
-
-		log_group(ls, "nodeid %d checkpoint_ready = %d",
-			  node->nodeid, node->checkpoint_ready);
-	}
-	if (not_ready)
-		return;
-
-	ls->all_checkpoints_ready = 1;
-
-	list_for_each_entry(node, &ls->deadlk_nodes, list) {
-		if (!node->in_cycle)
-			continue;
-		if (node->nodeid < low || low == -1)
-			low = node->nodeid;
-	}
-	ls->deadlk_low_nodeid = low;
-
-	if (low == our_nodeid)
-		find_deadlock(ls);
-	else
-		log_group(ls, "defer resolution to low nodeid %d", low);
-}
-
-void receive_checkpoint_ready(struct lockspace *ls, struct dlm_header *hd,
-			      int len)
-{
-	struct node *node;
-	int nodeid = hd->nodeid;
-
-	log_group(ls, "receive_checkpoint_ready from %d", nodeid);
-
-	read_checkpoint(ls, nodeid);
-
-	list_for_each_entry(node, &ls->deadlk_nodes, list) {
-		if (node->nodeid == nodeid) {
-			node->checkpoint_ready = 1;
-			break;
-		}
-	}
-
-	run_deadlock(ls);
-}
-
-void receive_cycle_start(struct lockspace *ls, struct dlm_header *hd, int len)
-{
-	struct node *node;
-	int nodeid = hd->nodeid;
-	int rv;
-
-	log_group(ls, "receive_cycle_start from %d", nodeid);
-
-	if (ls->cycle_running) {
-		log_group(ls, "cycle already running");
-		return;
-	}
-	ls->cycle_running = 1;
-	gettimeofday(&ls->cycle_start_time, NULL);
-
-	list_for_each_entry(node, &ls->deadlk_nodes, list)
-		node->in_cycle = 1;
-
-	rv = read_debugfs_locks(ls);
-	if (rv < 0) {
-		log_error("can't read dlm debugfs file: %s", strerror(errno));
-		return;
-	}
-
-	write_checkpoint(ls);
-	send_checkpoint_ready(ls);
-}
-
-static uint64_t dt_usec(struct timeval *start, struct timeval *stop)
-{
-	uint64_t dt;
-
-	dt = stop->tv_sec - start->tv_sec;
-	dt *= 1000000;
-	dt += stop->tv_usec - start->tv_usec;
-	return dt;
-}
-
-/* TODO: nodes added during a cycle - what will they do with messages
-   they recv from other nodes running the cycle? */
-
-void receive_cycle_end(struct lockspace *ls, struct dlm_header *hd, int len)
-{
-	struct node *node;
-	int nodeid = hd->nodeid;
-	uint64_t usec;
-
-	if (!ls->cycle_running) {
-		log_error("receive_cycle_end %s from %d: no cycle running",
-			  ls->name, nodeid);
-		return;
-	}
-
-	gettimeofday(&ls->cycle_end_time, NULL);
-	usec = dt_usec(&ls->cycle_start_time, &ls->cycle_end_time);
-	log_group(ls, "receive_cycle_end: from %d cycle time %.2f s",
-		  nodeid, usec * 1.e-6);
-
-	ls->cycle_running = 0;
-	ls->all_checkpoints_ready = 0;
-
-	list_for_each_entry(node, &ls->deadlk_nodes, list)
-		node->checkpoint_ready = 0;
-
-	free_resources(ls);
-	free_transactions(ls);
-	unlink_checkpoint(ls);
-}
-
-void receive_cancel_lock(struct lockspace *ls, struct dlm_header *hd, int len)
-{
-	dlm_lshandle_t h;
-	int nodeid = hd->nodeid;
-	uint32_t lkid = hd->msgdata;
-	int rv;
-
-	if (nodeid != our_nodeid)
-		return;
-
-	h = dlm_open_lockspace(ls->name);
-	if (!h) {
-		log_error("deadlock cancel %x from %d can't open lockspace %s",
-			  lkid, nodeid, ls->name);
-		return;
-	}
-
-	log_group(ls, "receive_cancel_lock %x from %d", lkid, nodeid);
-
-	rv = dlm_ls_deadlock_cancel(h, lkid, 0);
-	if (rv < 0) {
-		log_error("deadlock cancel %x from %x lib cancel errno %d",
-			  lkid, nodeid, errno);
-	}
-
-	dlm_close_lockspace(h);
-}
-
-static void node_joined(struct lockspace *ls, int nodeid)
-{
-	struct node *node;
-
-	node = malloc(sizeof(struct node));
-	if (!node) {
-		log_error("node_joined: no memory");
-		disable_deadlock();
-		return;
-	}
-	memset(node, 0, sizeof(struct node));
-	node->nodeid = nodeid;
-	list_add_tail(&node->list, &ls->deadlk_nodes);
-	log_group(ls, "node %d joined deadlock cpg", nodeid);
-}
-
-static void node_left(struct lockspace *ls, int nodeid, int reason)
-{
-	struct node *node, *safe;
-
-	list_for_each_entry_safe(node, safe, &ls->deadlk_nodes, list) {
-		if (node->nodeid != nodeid)
-			continue;
-
-		list_del(&node->list);
-		free(node);
-		log_group(ls, "node %d left deadlock cpg", nodeid);
-	}
-}
-
-static void purge_locks(struct lockspace *ls, int nodeid);
-
-void deadlk_confchg(struct lockspace *ls,
-		struct cpg_address *member_list, int member_list_entries,
-		struct cpg_address *left_list, int left_list_entries,
-		struct cpg_address *joined_list, int joined_list_entries)
-{
-	int i;
-
-	if (!cfgd_enable_deadlk)
-		return;
-
-	if (!ls->deadlk_confchg_init) {
-		ls->deadlk_confchg_init = 1;
-		for (i = 0; i < member_list_entries; i++)
-			node_joined(ls, member_list[i].nodeid);
-		return;
-	}
-
-	/* nodes added during a cycle won't have node->in_cycle set so they
-	   won't be included in any of the cycle processing */
-
-	for (i = 0; i < joined_list_entries; i++)
-		node_joined(ls, joined_list[i].nodeid);
-
-	for (i = 0; i < left_list_entries; i++)
-		node_left(ls, left_list[i].nodeid, left_list[i].reason);
-
-	if (!ls->cycle_running)
-		return;
-
-	if (!left_list_entries)
-		return;
-
-	if (!ls->all_checkpoints_ready) {
-		run_deadlock(ls);
-		return;
-	}
-
-	for (i = 0; i < left_list_entries; i++)
-		purge_locks(ls, left_list[i].nodeid);
-
-	for (i = 0; i < left_list_entries; i++) {
-		if (left_list[i].nodeid != ls->deadlk_low_nodeid)
-			continue;
-		/* this will set a new low node which will call find_deadlock */
-		run_deadlock(ls);
-		break;
-	}
-}
-
-/* would we ever call this after we've created the transaction lists?
-   I don't think so; I think it can only be called between reading
-   checkpoints */
-
-static void purge_locks(struct lockspace *ls, int nodeid)
-{
-	struct dlm_rsb *r;
-	struct dlm_lkb *lkb, *safe;
-
-	list_for_each_entry(r, &ls->resources, list) {
-		list_for_each_entry_safe(lkb, safe, &r->locks, list) {
-			if (lkb->home == nodeid) {
-				list_del(&lkb->list);
-				if (list_empty(&lkb->trans_list))
-					free(lkb);
-				else
-					log_group(ls, "purge %d %x on trans",
-						  nodeid, lkb->lock.id);
-			}
-		}
-	}
-}
-
-static void add_lkb_trans(struct trans *tr, struct dlm_lkb *lkb)
-{
-	list_add(&lkb->trans_list, &tr->locks);
-	lkb->trans = tr;
-}
-
-static struct trans *get_trans(struct lockspace *ls, uint64_t xid)
-{
-	struct trans *tr;
-
-	list_for_each_entry(tr, &ls->transactions, list) {
-		if (tr->xid == xid)
-			return tr;
-	}
-
-	tr = malloc(sizeof(struct trans));
-	if (!tr) {
-		log_error("get_trans: no memory");
-		disable_deadlock();
-		return NULL;
-	}
-	memset(tr, 0, sizeof(struct trans));
-	tr->xid = xid;
-	tr->waitfor = NULL;
-	tr->waitfor_alloc = 0;
-	tr->waitfor_count = 0;
-	INIT_LIST_HEAD(&tr->locks);
-	list_add(&tr->list, &ls->transactions);
-	return tr;
-}
-
-/* for each rsb, for each lock, find/create trans, add lkb to the trans list */
-
-static void create_trans_list(struct lockspace *ls)
-{
-	struct dlm_rsb *r;
-	struct dlm_lkb *lkb;
-	struct trans *tr;
-	int r_count = 0, lkb_count = 0;
-
-	list_for_each_entry(r, &ls->resources, list) {
-		r_count++;
-		list_for_each_entry(lkb, &r->locks, list) {
-			lkb_count++;
-			tr = get_trans(ls, lkb->lock.xid);
-			if (!tr)
-				goto out;
-			add_lkb_trans(tr, lkb);
-		}
-	}
- out:
-	log_group(ls, "create_trans_list: r_count %d lkb_count %d",
-		  r_count, lkb_count);
-}
-
-static int locks_compat(struct dlm_lkb *waiting_lkb,
-			struct dlm_lkb *granted_lkb)
-{
-	if (waiting_lkb == granted_lkb) {
-		log_debug("waiting and granted same lock");
-		return 0;
-	}
-
-	if (waiting_lkb->trans->xid == granted_lkb->trans->xid) {
-		log_debug("waiting and granted same trans %llx",
-			  (unsigned long long)waiting_lkb->trans->xid);
-		return 0;
-	}
-
-	return dlm_modes_compat(granted_lkb->lock.grmode,
-				waiting_lkb->lock.rqmode);
-}
-
-static int in_waitfor(struct trans *tr, struct trans *add_tr)
-{
-	int i;
-
-	for (i = 0; i < tr->waitfor_alloc; i++) {
-		if (!tr->waitfor[i])
-			continue;
-		if (tr->waitfor[i] == add_tr)
-			return 1;
-	}
-	return 0;
-}
-
-static void add_waitfor(struct lockspace *ls, struct dlm_lkb *waiting_lkb,
-			struct dlm_lkb *granted_lkb)
-{
-	struct trans *tr = waiting_lkb->trans;
-	int i;
-
-	if (locks_compat(waiting_lkb, granted_lkb))
-		return;
-
-	/* this shouldn't happen AFAIK */
-	if (tr == granted_lkb->trans) {
-		log_group(ls, "trans %llx waiting on self",
-			  (unsigned long long)tr->xid);
-		return;
-	}
-
-	/* don't add the same trans to the waitfor list multiple times */
-	if (tr->waitfor_count && in_waitfor(tr, granted_lkb->trans)) {
-		log_group(ls, "trans %llx already waiting for trans %llx, "
-			  "waiting %x %s, granted %x %s",
-			  (unsigned long long)waiting_lkb->trans->xid,
-			  (unsigned long long)granted_lkb->trans->xid,
-			  waiting_lkb->lock.id, waiting_lkb->rsb->name,
-			  granted_lkb->lock.id, granted_lkb->rsb->name);
-		return;
-	}
-
-	if (tr->waitfor_count == tr->waitfor_alloc) {
-		struct trans **old_waitfor = tr->waitfor;
-		tr->waitfor_alloc += TR_NALLOC;
-		tr->waitfor = malloc(tr->waitfor_alloc * sizeof(tr));
-		if (!tr->waitfor) {
-			log_error("add_waitfor no mem %u", tr->waitfor_alloc);
-			return;
-		}
-		memset(tr->waitfor, 0, tr->waitfor_alloc * sizeof(tr));
-
-		/* copy then free old set of pointers */
-		for (i = 0; i < tr->waitfor_count; i++)
-			tr->waitfor[i] = old_waitfor[i];
-		if (old_waitfor)
-			free(old_waitfor);
-	}
-
-	tr->waitfor[tr->waitfor_count++] = granted_lkb->trans;
-	granted_lkb->trans->others_waiting_on_us++;
-	waiting_lkb->waitfor_trans = granted_lkb->trans;
-}
-
-/* for each trans, for each waiting lock, go to rsb of the lock,
-   find granted locks on that rsb, then find the trans the
-   granted lock belongs to, add that trans to our waitfor list */
-
-static void create_waitfor_graph(struct lockspace *ls)
-{
-	struct dlm_lkb *waiting_lkb, *granted_lkb;
-	struct dlm_rsb *r;
-	struct trans *tr;
-	int depend_count = 0;
-
-	list_for_each_entry(tr, &ls->transactions, list) {
-		list_for_each_entry(waiting_lkb, &tr->locks, trans_list) {
-			if (waiting_lkb->lock.status == DLM_LKSTS_GRANTED)
-				continue;
-			/* waiting_lkb status is CONVERT or WAITING */
-
-			r = waiting_lkb->rsb;
-
-			list_for_each_entry(granted_lkb, &r->locks, list) {
-				if (granted_lkb->lock.status==DLM_LKSTS_WAITING)
-					continue;
-				/* granted_lkb status is GRANTED or CONVERT */
-				add_waitfor(ls, waiting_lkb, granted_lkb);
-				depend_count++;
-			}
-		}
-	}
-
-	log_group(ls, "create_waitfor_graph: depend_count %d", depend_count);
-}
-
-/* Assume a transaction that's not waiting on any locks will complete, release
-   all the locks it currently holds, and exit.  Other transactions that were
-   blocked waiting on the removed transaction's now-released locks may now be
-   unblocked, complete, release all held locks and exit.  Repeat this until
-   no more transactions can be removed.  If there are transactions remaining,
-   then they are deadlocked. */
-
-static void remove_waitfor(struct trans *tr, struct trans *remove_tr)
-{
-	int i;
-
-	for (i = 0; i < tr->waitfor_alloc; i++) {
-		if (!tr->waitfor_count)
-			break;
-
-		if (!tr->waitfor[i])
-			continue;
-
-		if (tr->waitfor[i] == remove_tr) {
-			tr->waitfor[i] = NULL;
-			tr->waitfor_count--;
-			remove_tr->others_waiting_on_us--;
-		}
-	}
-}
-
-/* remove_tr is not waiting for anything, assume it completes and goes away
-   and remove it from any other transaction's waitfor list */
-
-static void remove_trans(struct lockspace *ls, struct trans *remove_tr)
-{
-	struct trans *tr;
-
-	list_for_each_entry(tr, &ls->transactions, list) {
-		if (tr == remove_tr)
-			continue;
-		if (!remove_tr->others_waiting_on_us)
-			break;
-		remove_waitfor(tr, remove_tr);
-	}
-
-	if (remove_tr->others_waiting_on_us)
-		log_group(ls, "trans %llx removed others waiting %d",
-			  (unsigned long long)remove_tr->xid,
-			  remove_tr->others_waiting_on_us);
-}
-
-static int reduce_waitfor_graph(struct lockspace *ls)
-{
-	struct trans *tr, *safe;
-	int blocked = 0;
-	int removed = 0;
-
-	list_for_each_entry_safe(tr, safe, &ls->transactions, list) {
-		if (tr->waitfor_count) {
-			blocked++;
-			continue;
-		}
-		remove_trans(ls, tr);
-		list_del(&tr->list);
-		if (tr->waitfor)
-			free(tr->waitfor);
-		free(tr);
-		removed++;
-	}
-
-	log_group(ls, "reduce_waitfor_graph: %d blocked, %d removed",
-		  blocked, removed);
-	return removed;
-}
-
-static void reduce_waitfor_graph_loop(struct lockspace *ls)
-{
-	int removed;
-
-	while (1) {
-		removed = reduce_waitfor_graph(ls);
-		if (!removed)
-			break;
-	}
-}
-
-static struct trans *find_trans_to_cancel(struct lockspace *ls)
-{
-	struct trans *tr;
-
-	list_for_each_entry(tr, &ls->transactions, list) {
-		if (!tr->others_waiting_on_us)
-			continue;
-		return tr;
-	}
-	return NULL;
-}
-
-static void cancel_trans(struct lockspace *ls)
-{
-	struct trans *tr;
-	struct dlm_lkb *lkb;
-	int removed;
-
-	tr = find_trans_to_cancel(ls);
-	if (!tr) {
-		log_group(ls, "cancel_trans: no trans found");
-		return;
-	}
-
-	list_for_each_entry(lkb, &tr->locks, trans_list) {
-		if (lkb->lock.status == DLM_LKSTS_GRANTED)
-			continue;
-		send_cancel_lock(ls, tr, lkb);
-
-		/* When this canceled trans has multiple locks all blocked by
-		   locks held by one other trans, that other trans is only
-		   added to tr->waitfor once, and only one of these waiting
-		   locks will have waitfor_trans set.  So, the lkb with
-		   non-null waitfor_trans was the first one responsible
-		   for adding waitfor_trans to tr->waitfor.
-
-		   We could potentially forget about keeping track of lkb->
-		   waitfor_trans, forget about calling remove_waitfor()
-		   here and just set tr->waitfor_count = 0 after this loop.
-		   The loss would be that waitfor_trans->others_waiting_on_us
-		   would not get decremented. */
-
-		if (lkb->waitfor_trans)
-			remove_waitfor(tr, lkb->waitfor_trans);
-	}
-
-	/* this shouldn't happen, if it does something's not working right */
-	if (tr->waitfor_count) {
-		log_group(ls, "cancel_trans: %llx non-zero waitfor_count %d",
-			  (unsigned long long)tr->xid, tr->waitfor_count);
-	}
-
-	/* this should now remove the canceled trans since it now has a zero
-	   waitfor_count */
-	removed = reduce_waitfor_graph(ls);
-
-	if (!removed)
-		log_group(ls, "canceled trans not removed from graph");
-
-	/* now call reduce_waitfor_graph() in another loop and it
-	   should completely reduce */
-}
-
-static void dump_trans(struct lockspace *ls, struct trans *tr)
-{
-	struct dlm_lkb *lkb;
-	struct trans *wf;
-	int i;
-
-	log_group(ls, "trans xid %llx waitfor_count %d others_waiting_on_us %d",
-		  (unsigned long long)tr->xid, tr->waitfor_count,
-		  tr->others_waiting_on_us);
-
-	log_group(ls, "locks:");
-	
-	list_for_each_entry(lkb, &tr->locks, trans_list) {
-		log_group(ls, "  %s: id %08x gr %s rq %s pid %u:%u \"%s\"",
-			  status_str(lkb->lock.status),
-			  lkb->lock.id,
-			  dlm_mode_str(lkb->lock.grmode),
-			  dlm_mode_str(lkb->lock.rqmode),
-			  lkb->home,
-			  lkb->lock.ownpid,
-			  lkb->rsb->name);
-	}
-
-	if (!tr->waitfor_count)
-		return;
-
-	log_group(ls, "waitfor:");
-
-	for (i = 0; i < tr->waitfor_alloc; i++) {
-		if (!tr->waitfor[i])
-			continue;
-		wf = tr->waitfor[i];
-		log_group(ls, "  xid %llx", (unsigned long long)wf->xid);
-	}
-}
-
-static void dump_all_trans(struct lockspace *ls)
-{
-	struct trans *tr;
-
-	log_group(ls, "Transaction dump:");
-
-	list_for_each_entry(tr, &ls->transactions, list)
-		dump_trans(ls, tr);
-}
-
-static void find_deadlock(struct lockspace *ls)
-{
-	if (list_empty(&ls->resources)) {
-		log_group(ls, "no deadlock: no resources");
-		goto out;
-	}
-
-	if (!list_empty(&ls->transactions)) {
-		log_group(ls, "transactions list should be empty");
-		goto out;
-	}
-
-	dump_resources(ls);
-	create_trans_list(ls);
-	create_waitfor_graph(ls);
-	dump_all_trans(ls);
-	reduce_waitfor_graph_loop(ls);
-
-	if (list_empty(&ls->transactions)) {
-		log_group(ls, "no deadlock: all transactions reduced");
-		goto out;
-	}
-
-	log_group(ls, "found deadlock");
-	dump_all_trans(ls);
-
-	cancel_trans(ls);
-	reduce_waitfor_graph_loop(ls);
-
-	if (list_empty(&ls->transactions)) {
-		log_group(ls, "resolved deadlock with cancel");
-		goto out;
-	}
-
-	log_error("deadlock resolution failed");
-	dump_all_trans(ls);
- out:
-	send_cycle_end(ls);
-}
-
diff --git a/group/dlm_controld/dlm_controld.h b/group/dlm_controld/dlm_controld.h
deleted file mode 100644
index b02bc42..0000000
--- a/group/dlm_controld/dlm_controld.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef __DLM_CONTROLD_DOT_H__
-#define __DLM_CONTROLD_DOT_H__
-
-/* This defines the interface between dlm_controld and libdlmcontrol, and
-   should only be used by libdlmcontrol. */
-
-#define DLMC_SOCK_PATH			"dlmc_sock"
-#define DLMC_QUERY_SOCK_PATH		"dlmc_query_sock"
-
-#define DLMC_MAGIC			0xD13CD13C
-#define DLMC_VERSION			0x00010001
-
-#define DLMC_CMD_DUMP_DEBUG		1
-#define DLMC_CMD_DUMP_PLOCKS		2
-#define DLMC_CMD_LOCKSPACE_INFO		3
-#define DLMC_CMD_NODE_INFO		4
-#define DLMC_CMD_LOCKSPACES		5
-#define DLMC_CMD_LOCKSPACE_NODES	6
-#define DLMC_CMD_FS_REGISTER		7
-#define DLMC_CMD_FS_UNREGISTER		8
-#define DLMC_CMD_FS_NOTIFIED		9
-#define DLMC_CMD_DEADLOCK_CHECK		10
-
-struct dlmc_header {
-	unsigned int magic;
-	unsigned int version;
-	unsigned int command;
-	unsigned int option;
-	unsigned int len;
-	int data;	/* embedded command-specific data, for convenience */
-	int unused1;
-	int unsued2;
-	char name[DLM_LOCKSPACE_LEN]; /* no terminating null space */
-};
-
-#endif
-
diff --git a/group/dlm_controld/dlm_daemon.h b/group/dlm_controld/dlm_daemon.h
deleted file mode 100644
index 8173192..0000000
--- a/group/dlm_controld/dlm_daemon.h
+++ /dev/null
@@ -1,349 +0,0 @@
-#ifndef __DLM_DAEMON_DOT_H__
-#define __DLM_DAEMON_DOT_H__
-
-#include <sys/types.h>
-#include <asm/types.h>
-#include <sys/uio.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <sys/utsname.h>
-#include <sys/poll.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <net/if.h>
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <fcntl.h>
-#include <netdb.h>
-#include <limits.h>
-#include <unistd.h>
-#include <time.h>
-#include <syslog.h>
-#include <sched.h>
-#include <signal.h>
-#include <sys/time.h>
-#include <dirent.h>
-#include <openais/saAis.h>
-#include <openais/saCkpt.h>
-
-#include <corosync/cpg.h>
-#include <liblogthread.h>
-
-#include <linux/dlmconstants.h>
-#include "libdlmcontrol.h"
-#include "dlm_controld.h"
-#include "list.h"
-#include "linux_endian.h"
-
-/* DLM_LOCKSPACE_LEN: maximum lockspace name length, from linux/dlmconstants.h.
-   Copied in libdlm.h so apps don't need to include the kernel header.
-   The libcpg limit is larger at CPG_MAX_NAME_LENGTH 128.  Our cpg name includes
-   a "dlm:" prefix before the lockspace name. */
-
-/* Maximum members of a ls, should match CPG_MEMBERS_MAX in corosync/cpg.h.
-   There are no max defines in dlm-kernel for lockspace members. */
-
-#define MAX_NODES	128
-
-/* Maximum number of IP addresses per node, when using SCTP and multi-ring in
-   corosync  In dlm-kernel this is DLM_MAX_ADDR_COUNT, currently 3. */
-
-#define MAX_NODE_ADDRESSES 4
-
-/* Max string length printed on a line, for debugging/dump output. */
-
-#define MAXLINE		256
-
-/* group_mode */
-
-#define GROUP_LIBGROUP	2
-#define GROUP_LIBCPG	3
-
-extern int daemon_debug_opt;
-extern int daemon_quit;
-extern int cluster_down;
-extern int poll_fencing;
-extern int poll_quorum;
-extern int poll_fs;
-extern int poll_ignore_plock;
-extern int plock_fd;
-extern int plock_ci;
-extern struct list_head lockspaces;
-extern int cluster_quorate;
-extern int our_nodeid;
-extern char daemon_debug_buf[256];
-extern char dump_buf[DLMC_DUMP_SIZE];
-extern int dump_point;
-extern int dump_wrap;
-extern char plock_dump_buf[DLMC_DUMP_SIZE];
-extern int plock_dump_len;
-extern int group_mode;
-extern uint32_t control_minor;
-extern uint32_t monitor_minor;
-extern uint32_t plock_minor;
-extern uint32_t old_plock_minor;
-
-void daemon_dump_save(void);
-
-#define log_level(lvl, fmt, args...) \
-do { \
-	snprintf(daemon_debug_buf, 255, "%ld " fmt "\n", time(NULL), ##args); \
-	daemon_dump_save(); \
-	logt_print(lvl, fmt "\n", ##args); \
-	if (daemon_debug_opt) \
-		fprintf(stderr, "%s", daemon_debug_buf); \
-} while (0)
-
-#define log_debug(fmt, args...) log_level(LOG_DEBUG, fmt, ##args)
-#define log_error(fmt, args...) log_level(LOG_ERR, fmt, ##args)
-
-#define log_group(ls, fmt, args...) \
-do { \
-	snprintf(daemon_debug_buf, 255, "%ld %s " fmt "\n", time(NULL), \
-		 (ls)->name, ##args); \
-	daemon_dump_save(); \
-	logt_print(LOG_DEBUG, fmt "\n", ##args); \
-	if (daemon_debug_opt) \
-		fprintf(stderr, "%s", daemon_debug_buf); \
-} while (0)
-
-#define log_plock(ls, fmt, args...) \
-do { \
-	snprintf(daemon_debug_buf, 255, "%ld %s " fmt "\n", time(NULL), \
-		 (ls)->name, ##args); \
-	if (daemon_debug_opt && cfgd_plock_debug) \
-		fprintf(stderr, "%s", daemon_debug_buf); \
-} while (0)
-
-/* dlm_header types */
-enum {
-	DLM_MSG_PROTOCOL = 1,
-	DLM_MSG_START,
-	DLM_MSG_PLOCK,
-	DLM_MSG_PLOCK_OWN,
-	DLM_MSG_PLOCK_DROP,
-	DLM_MSG_PLOCK_SYNC_LOCK,
-	DLM_MSG_PLOCK_SYNC_WAITER,
-	DLM_MSG_PLOCKS_STORED,
-	DLM_MSG_DEADLK_CYCLE_START,
-	DLM_MSG_DEADLK_CYCLE_END,
-	DLM_MSG_DEADLK_CHECKPOINT_READY,
-	DLM_MSG_DEADLK_CANCEL_LOCK
-};
-
-/* dlm_header flags */
-#define DLM_MFLG_JOINING   1  /* accompanies start, we are joining */
-#define DLM_MFLG_HAVEPLOCK 2  /* accompanies start, we have plock state */
-
-struct dlm_header {
-	uint16_t version[3];
-	uint16_t type;	  	/* DLM_MSG_ */
-	uint32_t nodeid;	/* sender */
-	uint32_t to_nodeid;     /* recipient, 0 for all */
-	uint32_t global_id;     /* global unique id for this lockspace */
-	uint32_t flags;		/* DLM_MFLG_ */
-	uint32_t msgdata;       /* in-header payload depends on MSG type; lkid
-				   for deadlock, seq for lockspace membership */
-	uint32_t pad1;
-	uint64_t pad2;
-};
-
-struct lockspace {
-	struct list_head	list;
-	char			name[DLM_LOCKSPACE_LEN+1];
-	uint32_t		global_id;
-
-	/* lockspace membership stuff */
-
-	cpg_handle_t		cpg_handle;
-	int			cpg_client;
-	int			cpg_fd;
-	int			joining;
-	int			leaving;
-	int			kernel_stopped;
-	int			fs_registered;
-	uint32_t		change_seq;
-	uint32_t		started_count;
-	struct change		*started_change;
-	struct list_head	changes;
-	struct list_head	node_history;
-
-	/* plock stuff */
-
-	int			plock_ckpt_node;
-	int			need_plocks;
-	int			save_plocks;
-	uint32_t		associated_mg_id;
-	struct list_head	saved_messages;
-	struct list_head	plock_resources;
-	time_t			last_checkpoint_time;
-	time_t			last_plock_time;
-	struct timeval		drop_resources_last;
-	uint64_t		plock_ckpt_handle;
-
-	/* save copy of groupd member callback data for queries */
-
-	int			cb_member_count;
-	int			cb_members[MAX_NODES];
-
-	/* deadlock stuff */
-
-	int			deadlk_low_nodeid;
-	struct list_head	deadlk_nodes;
-	uint64_t		deadlk_ckpt_handle;
-	int			deadlk_confchg_init;
-	struct list_head	transactions;
-	struct list_head	resources;
-	struct timeval		cycle_start_time;
-	struct timeval		cycle_end_time;
-	struct timeval		last_send_cycle_start;
-	int			cycle_running;
-	int			all_checkpoints_ready;
-};
-
-/* action.c */
-void set_associated_id(uint32_t mg_id);
-int set_sysfs_control(char *name, int val);
-int set_sysfs_event_done(char *name, int val);
-int set_sysfs_id(char *name, uint32_t id);
-int set_configfs_members(char *name, int new_count, int *new_members,
-			int renew_count, int *renew_members);
-int add_configfs_node(int nodeid, char *addr, int addrlen, int local);
-void del_configfs_node(int nodeid);
-void clear_configfs(void);
-int setup_configfs(void);
-int check_uncontrolled_lockspaces(void);
-int setup_misc_devices(void);
-
-/* config.c */
-int setup_ccs(void);
-void close_ccs(void);
-void read_ccs_name(char *path, char *name);
-void read_ccs_yesno(char *path, int *yes, int *no);
-int read_ccs_int(char *path, int *config_val);
-int get_weight(int nodeid, char *lockspace);
-
-/* cpg.c */
-int setup_cpg(void);
-void close_cpg(void);
-void process_cpg(int ci);
-int set_protocol(void);
-void process_lockspace_changes(void);
-void dlm_send_message(struct lockspace *ls, char *buf, int len);
-int dlm_join_lockspace(struct lockspace *ls);
-int dlm_leave_lockspace(struct lockspace *ls);
-char *msg_name(int type);
-void update_flow_control_status(void);
-int set_node_info(struct lockspace *ls, int nodeid, struct dlmc_node *node);
-int set_lockspace_info(struct lockspace *ls, struct dlmc_lockspace *lockspace);
-int set_lockspaces(int *count, struct dlmc_lockspace **lss_out);
-int set_lockspace_nodes(struct lockspace *ls, int option, int *node_count,
-			struct dlmc_node **nodes_out);
-int set_fs_notified(struct lockspace *ls, int nodeid);
-
-/* deadlock.c */
-void setup_deadlock(void);
-void send_cycle_start(struct lockspace *ls);
-void receive_checkpoint_ready(struct lockspace *ls, struct dlm_header *hd,
-			int len);
-void receive_cycle_start(struct lockspace *ls, struct dlm_header *hd, int len);
-void receive_cycle_end(struct lockspace *ls, struct dlm_header *hd, int len);
-void receive_cancel_lock(struct lockspace *ls, struct dlm_header *hd, int len);
-void deadlk_confchg(struct lockspace *ls,
-	struct cpg_address *member_list, int member_list_entries,
-	struct cpg_address *left_list, int left_list_entries,
-	struct cpg_address *joined_list, int joined_list_entries);
-
-
-/* main.c */
-int do_read(int fd, void *buf, size_t count);
-int do_write(int fd, void *buf, size_t count);
-void client_dead(int ci);
-int client_add(int fd, void (*workfn)(int ci), void (*deadfn)(int ci));
-int client_fd(int ci);
-void client_ignore(int ci, int fd);
-void client_back(int ci, int fd);
-struct lockspace *find_ls(char *name);
-struct lockspace *find_ls_id(uint32_t id);
-char *dlm_mode_str(int mode);
-void cluster_dead(int ci);
-
-/* member_cman.c */
-int setup_cluster(void);
-void close_cluster(void);
-void process_cluster(int ci);
-void update_cluster(void);
-int is_cluster_member(int nodeid);
-char *nodeid2name(int nodeid);
-void kick_node_from_cluster(int nodeid);
-int fence_node_time(int nodeid, uint64_t *last_fenced_time);
-int fence_in_progress(int *count);
-
-/* netlink.c */
-int setup_netlink(void);
-void process_netlink(int ci);
-
-/* plock.c */
-int setup_plocks(void);
-void process_plocks(int ci);
-int limit_plocks(void);
-void receive_plock(struct lockspace *ls, struct dlm_header *hd, int len);
-void receive_own(struct lockspace *ls, struct dlm_header *hd, int len);
-void receive_sync(struct lockspace *ls, struct dlm_header *hd, int len);
-void receive_drop(struct lockspace *ls, struct dlm_header *hd, int len);
-void process_saved_plocks(struct lockspace *ls);
-void close_plock_checkpoint(struct lockspace *ls);
-void store_plocks(struct lockspace *ls);
-void retrieve_plocks(struct lockspace *ls);
-void purge_plocks(struct lockspace *ls, int nodeid, int unmount);
-int fill_plock_dump_buf(struct lockspace *ls);
-
-/* group.c */
-#define BUILD_GROUPD_COMPAT
-#ifdef BUILD_GROUPD_COMPAT
-int setup_groupd(void);
-void close_groupd(void);
-void process_groupd(int ci);
-int dlm_join_lockspace_group(struct lockspace *ls);
-int dlm_leave_lockspace_group(struct lockspace *ls);
-int set_node_info_group(struct lockspace *ls, int nodeid,
-	struct dlmc_node *node);
-int set_lockspace_info_group(struct lockspace *ls,
-	struct dlmc_lockspace *lockspace);
-int set_lockspaces_group(int *count,
-	struct dlmc_lockspace **lss_out);
-int set_lockspace_nodes_group(struct lockspace *ls, int option,
-	int *node_count, struct dlmc_node **nodes);
-int set_group_mode(void);
-#else
-static inline int setup_groupd(void) { return -1; }
-static inline void close_groupd(void) { }
-static inline void process_groupd(int ci) { }
-static inline int dlm_join_lockspace_group(struct lockspace *ls) { return -1; }
-static inline int dlm_leave_lockspace_group(struct lockspace *ls) { return -1; }
-static inline int set_node_info_group(struct lockspace *ls, int nodeid,
-	struct dlmc_node *node) { return -1; }
-static inline int set_lockspace_info_group(struct lockspace *ls,
-	struct dlmc_lockspace *lockspace) { return -1; }
-static inline int set_lockspaces_group(int *count,
-	struct dlmc_lockspace **lss_out) { return -1; }
-static inline int set_lockspace_nodes_group(struct lockspace *ls, int option,
-	int *node_count, struct dlmc_node **nodes) { return -1; }
-int inline void set_group_mode(void) { return 0; }
-#endif
-
-/* logging.c */
-
-void init_logging(void);
-void setup_logging();
-void close_logging(void);
-
-#endif
-
diff --git a/group/dlm_controld/group.c b/group/dlm_controld/group.c
deleted file mode 100644
index 9b863b7..0000000
--- a/group/dlm_controld/group.c
+++ /dev/null
@@ -1,364 +0,0 @@
-#include "dlm_daemon.h"
-#include "config.h"
-#include "libgroup.h"
-
-#define DO_STOP 1
-#define DO_START 2
-#define DO_FINISH 3
-#define DO_TERMINATE 4
-#define DO_SETID 5
-
-#define GROUPD_TIMEOUT 10 /* seconds */
-
-/* save all the params from callback functions here because we can't
-   do the processing within the callback function itself */
-
-group_handle_t gh;
-static int cb_action;
-static char cb_name[DLM_LOCKSPACE_LEN+1];
-static int cb_event_nr;
-static unsigned int cb_id;
-static int cb_type;
-static int cb_member_count;
-static int cb_members[MAX_NODES];
-
-
-static void stop_cbfn(group_handle_t h, void *private, char *name)
-{
-	cb_action = DO_STOP;
-	strcpy(cb_name, name);
-}
-
-static void start_cbfn(group_handle_t h, void *private, char *name,
-		       int event_nr, int type, int member_count, int *members)
-{
-	int i;
-
-	cb_action = DO_START;
-	strcpy(cb_name, name);
-	cb_event_nr = event_nr;
-	cb_type = type;
-	cb_member_count = member_count;
-
-	for (i = 0; i < member_count; i++)
-		cb_members[i] = members[i];
-}
-
-static void finish_cbfn(group_handle_t h, void *private, char *name,
-			int event_nr)
-{
-	cb_action = DO_FINISH;
-	strcpy(cb_name, name);
-	cb_event_nr = event_nr;
-}
-
-static void terminate_cbfn(group_handle_t h, void *private, char *name)
-{
-	cb_action = DO_TERMINATE;
-	strcpy(cb_name, name);
-}
-
-static void setid_cbfn(group_handle_t h, void *private, char *name,
-		       unsigned int id)
-{
-	cb_action = DO_SETID;
-	strcpy(cb_name, name);
-	cb_id = id;
-}
-
-group_callbacks_t callbacks = {
-	stop_cbfn,
-	start_cbfn,
-	finish_cbfn,
-	terminate_cbfn,
-	setid_cbfn
-};
-
-static char *str_members(void)
-{
-	static char str_members_buf[MAXLINE];
-	int i, ret, pos = 0, len = MAXLINE;
-
-	memset(str_members_buf, 0, MAXLINE);
-
-	for (i = 0; i < cb_member_count; i++) {
-		if (i != 0) {
-			ret = snprintf(str_members_buf + pos, len - pos, " ");
-			if (ret >= len - pos)
-				break;
-			pos += ret;
-		}
-		ret = snprintf(str_members_buf + pos, len - pos, "%d",
-			       cb_members[i]);
-		if (ret >= len - pos)
-			break;
-		pos += ret;
-	}
-	return str_members_buf;
-}
-
-void process_groupd(int ci)
-{
-	struct lockspace *ls;
-	int error = 0, val;
-
-	group_dispatch(gh);
-
-	if (!cb_action)
-		goto out;
-
-	ls = find_ls(cb_name);
-	if (!ls) {
-		log_error("callback %d group %s not found", cb_action, cb_name);
-		error = -1;
-		goto out;
-	}
-
-	switch (cb_action) {
-	case DO_STOP:
-		log_debug("groupd callback: stop %s", cb_name);
-		ls->kernel_stopped = 1; /* for queries */
-		set_sysfs_control(cb_name, 0);
-		group_stop_done(gh, cb_name);
-		break;
-
-	case DO_START:
-		log_debug("groupd callback: start %s count %d members %s",
-			  cb_name, cb_member_count, str_members());
-
-		/* save in ls for queries */
-		ls->cb_member_count = cb_member_count;
-		memcpy(ls->cb_members, cb_members, sizeof(cb_members));
-
-		set_configfs_members(cb_name, cb_member_count, cb_members,
-				     0, NULL);
-
-		/* this causes the dlm to do a "start" using the
-		   members we just set */
-
-		ls->kernel_stopped = 0;
-		set_sysfs_control(cb_name, 1);
-
-		/* the dlm doesn't need/use a "finish" stage following
-		   start, so we can just do start_done immediately */
-
-		group_start_done(gh, cb_name, cb_event_nr);
-
-		if (!ls->joining)
-			break;
-
-		ls->joining = 0;
-		log_debug("join event done %s", cb_name);
-
-		/* this causes the dlm_new_lockspace() call (typically from
-		   mount) to complete */
-		set_sysfs_event_done(cb_name, 0);
-
-		break;
-
-	case DO_SETID:
-		log_debug("groupd callback: set_id %s %x", cb_name, cb_id);
-		set_sysfs_id(cb_name, cb_id);
-		ls->global_id = cb_id;
-		break;
-
-	case DO_TERMINATE:
-		log_debug("groupd callback: terminate %s", cb_name);
-
-		if (ls->joining) {
-			val = -1;
-			ls->joining = 0;
-			log_debug("join event failed %s", cb_name);
-		} else {
-			val = 0;
-			log_debug("leave event done %s", cb_name);
-
-			/* remove everything under configfs */
-			set_configfs_members(ls->name, 0, NULL, 0, NULL);
-		}
-
-		set_sysfs_event_done(cb_name, val);
-		list_del(&ls->list);
-		free(ls);
-		break;
-
-	case DO_FINISH:
-		log_debug("groupd callback: finish %s (unused)", cb_name);
-		break;
-
-	default:
-		error = -EINVAL;
-	}
-
-	cb_action = 0;
- out:
-	return;
-}
-
-int dlm_join_lockspace_group(struct lockspace *ls)
-{
-	int rv;
-
-	ls->joining = 1;
-	list_add(&ls->list, &lockspaces);
-
-	rv = group_join(gh, ls->name);
-	if (rv) {
-		list_del(&ls->list);
-		free(ls);
-	}
-
-	return rv;
-}
-
-int dlm_leave_lockspace_group(struct lockspace *ls)
-{
-	ls->leaving = 1;
-	group_leave(gh, ls->name);
-	return 0;
-}
-
-int setup_groupd(void)
-{
-	int rv;
-
-	gh = group_init(NULL, "dlm", 1, &callbacks, GROUPD_TIMEOUT);
-	if (!gh) {
-		log_error("group_init error %p %d", gh, errno);
-		return -ENOTCONN;
-	}
-
-	rv = group_get_fd(gh);
-	if (rv < 0)
-		log_error("group_get_fd error %d %d", rv, errno);
-
-	return rv;
-}
-
-void close_groupd(void)
-{
-	group_exit(gh);
-}
-
-/* most of the query info doesn't apply in the LIBGROUP mode, but we can
-   emulate some basic parts of it */
-
-int set_lockspace_info_group(struct lockspace *ls,
-			     struct dlmc_lockspace *lockspace)
-{
-	strncpy(lockspace->name, ls->name, DLM_LOCKSPACE_LEN);
-	lockspace->global_id = ls->global_id;
-
-	if (ls->joining)
-		lockspace->flags |= DLMC_LF_JOINING;
-	if (ls->leaving)
-		lockspace->flags |= DLMC_LF_LEAVING;
-	if (ls->kernel_stopped)
-		lockspace->flags |= DLMC_LF_KERNEL_STOPPED;
-
-	lockspace->cg_prev.member_count = ls->cb_member_count;
-
-	/* we could save the previous cb_members and calculate
-	   joined_count and remove_count */
-
-	return 0;
-}
-
-int set_node_info_group(struct lockspace *ls, int nodeid,
-			struct dlmc_node *node)
-{
-	node->nodeid = nodeid;
-	node->flags = DLMC_NF_MEMBER;
-	return 0;
-}
-
-int set_lockspaces_group(int *count, struct dlmc_lockspace **lss_out)
-{
-	struct lockspace *ls;
-	struct dlmc_lockspace *lss, *lsp;
-	int ls_count = 0;
-
-	list_for_each_entry(ls, &lockspaces, list)
-		ls_count++;
-
-	lss = malloc(ls_count * sizeof(struct dlmc_lockspace));
-	if (!lss)
-		return -ENOMEM;
-	memset(lss, 0, ls_count * sizeof(struct dlmc_lockspace));
-
-	lsp = lss;
-	list_for_each_entry(ls, &lockspaces, list) {
-		set_lockspace_info(ls, lsp++);
-	}
-
-	*count = ls_count;
-	*lss_out = lss;
-	return 0;
-}
-
-int set_lockspace_nodes_group(struct lockspace *ls, int option, int *node_count,
-			      struct dlmc_node **nodes_out)
-{
-	struct dlmc_node *nodes = NULL, *nodep;
-	int i, len;
-
-	if (!ls->cb_member_count)
-		goto out;
-
-	len = ls->cb_member_count * sizeof(struct dlmc_node);
-	nodes = malloc(len);
-	if (!nodes)
-		return -ENOMEM;
-	memset(nodes, 0, len);
-
-	nodep = nodes;
-	for (i = 0; i < ls->cb_member_count; i++) {
-		set_node_info_group(ls, ls->cb_members[i], nodep++);
-	}
- out:
-	*node_count = ls->cb_member_count;
-	*nodes_out = nodes;
-	return 0;
-}
-
-int set_group_mode(void)
-{
-	int i = 0, rv, version, limit;
-
-	while (1) {
-		rv = group_get_version(&version);
-
-		if (rv || version < 0) {
-			/* we expect to get version of -EAGAIN while groupd
-			   is detecting the mode of everyone; don't retry
-			   as long if we're not getting anything back from
-			   groupd */
-
-			log_debug("set_group_mode get_version %d ver %d",
-				  rv, version);
-
-			limit = (version == -EAGAIN) ? 30 : 5;
-
-			if (i++ > limit) {
-				log_error("cannot get groupd compatibility "
-					  "mode rv %d ver %d", rv, version);
-				return -1;
-			}
-			sleep(1);
-			continue;
-		}
-
-
-		if (version == GROUP_LIBGROUP) {
-			group_mode = GROUP_LIBGROUP;
-			return 0;
-		} else if (version == GROUP_LIBCPG) {
-			group_mode = GROUP_LIBCPG;
-			return 0;
-		} else {
-			log_error("set_group_mode invalid ver %d", version);
-			return -1;
-		}
-	}
-}
-
diff --git a/group/dlm_controld/logging.c b/group/dlm_controld/logging.c
deleted file mode 100644
index cfcacb0..0000000
--- a/group/dlm_controld/logging.c
+++ /dev/null
@@ -1,61 +0,0 @@
-#include "dlm_daemon.h"
-#include "config.h"
-#include "ccs.h"
-
-extern int ccs_handle;
-
-#define DAEMON_NAME "dlm_controld"
-#define DEFAULT_LOG_MODE LOG_MODE_OUTPUT_FILE|LOG_MODE_OUTPUT_SYSLOG
-#define DEFAULT_SYSLOG_FACILITY		SYSLOGFACILITY
-#define DEFAULT_SYSLOG_PRIORITY		SYSLOGLEVEL
-#define DEFAULT_LOGFILE_PRIORITY	LOG_INFO /* ? */
-#define DEFAULT_LOGFILE			LOGDIR "/" DAEMON_NAME ".log"
-
-static int log_mode;
-static int syslog_facility;
-static int syslog_priority;
-static int logfile_priority;
-static char logfile[PATH_MAX];
-
-void init_logging(void)
-{
-	log_mode = DEFAULT_LOG_MODE;
-	syslog_facility = DEFAULT_SYSLOG_FACILITY;
-	syslog_priority = DEFAULT_SYSLOG_PRIORITY;
-	logfile_priority = DEFAULT_LOGFILE_PRIORITY;
-	strcpy(logfile, DEFAULT_LOGFILE);
-
-	/* logfile_priority is the only one of these options that
-	   can be controlled from command line or environment variable */
-
-	if (cfgd_debug_logfile)
-		logfile_priority = LOG_DEBUG;
-
-	log_debug("logging mode %d syslog f %d p %d logfile p %d %s",
-		  log_mode, syslog_facility, syslog_priority,
-		  logfile_priority, logfile);
-
-	logt_init(DAEMON_NAME, log_mode, syslog_facility, syslog_priority,
-		  logfile_priority, logfile);
-}
-
-void setup_logging(void)
-{
-	ccs_read_logging(ccs_handle, DAEMON_NAME,
-			 &cfgd_debug_logfile, &log_mode,
-			 &syslog_facility, &syslog_priority,
-			 &logfile_priority, logfile);
-
-	log_debug("logging mode %d syslog f %d p %d logfile p %d %s",
-		  log_mode, syslog_facility, syslog_priority,
-		  logfile_priority, logfile);
-
-	logt_conf(DAEMON_NAME, log_mode, syslog_facility, syslog_priority,
-		  logfile_priority, logfile);
-}
-
-void close_logging(void)
-{
-	logt_exit();
-}
-
diff --git a/group/dlm_controld/main.c b/group/dlm_controld/main.c
deleted file mode 100644
index afc8022..0000000
--- a/group/dlm_controld/main.c
+++ /dev/null
@@ -1,1364 +0,0 @@
-#include "dlm_daemon.h"
-#include "config.h"
-#include <pthread.h>
-#include "copyright.cf"
-
-#include <linux/dlmconstants.h>
-#include <linux/netlink.h>
-#include <linux/genetlink.h>
-#include <linux/dlm_netlink.h>
-
-#define LOCKFILE_NAME	"/var/run/dlm_controld.pid"
-#define CLIENT_NALLOC	32
-
-static int client_maxi;
-static int client_size = 0;
-static struct client *client = NULL;
-static struct pollfd *pollfd = NULL;
-static pthread_t query_thread;
-static pthread_mutex_t query_mutex;
-static struct list_head fs_register_list;
-static int kernel_monitor_fd;
-
-struct client {
-	int fd;
-	void *workfn;
-	void *deadfn;
-	struct lockspace *ls;
-};
-
-int do_read(int fd, void *buf, size_t count)
-{
-	int rv, off = 0;
-
-	while (off < count) {
-		rv = read(fd, buf + off, count - off);
-		if (rv == 0)
-			return -1;
-		if (rv == -1 && errno == EINTR)
-			continue;
-		if (rv == -1)
-			return -1;
-		off += rv;
-	}
-	return 0;
-}
-
-int do_write(int fd, void *buf, size_t count)
-{
-	int rv, off = 0;
-
- retry:
-	rv = write(fd, buf + off, count);
-	if (rv == -1 && errno == EINTR)
-		goto retry;
-	if (rv < 0) {
-		log_error("write errno %d", errno);
-		return rv;
-	}
-
-	if (rv != count) {
-		count -= rv;
-		off += rv;
-		goto retry;
-	}
-	return 0;
-}
-
-static void client_alloc(void)
-{
-	int i;
-
-	if (!client) {
-		client = malloc(CLIENT_NALLOC * sizeof(struct client));
-		pollfd = malloc(CLIENT_NALLOC * sizeof(struct pollfd));
-	} else {
-		client = realloc(client, (client_size + CLIENT_NALLOC) *
-					 sizeof(struct client));
-		pollfd = realloc(pollfd, (client_size + CLIENT_NALLOC) *
-					 sizeof(struct pollfd));
-		if (!pollfd)
-			log_error("can't alloc for pollfd");
-	}
-	if (!client || !pollfd)
-		log_error("can't alloc for client array");
-
-	for (i = client_size; i < client_size + CLIENT_NALLOC; i++) {
-		client[i].workfn = NULL;
-		client[i].deadfn = NULL;
-		client[i].fd = -1;
-		pollfd[i].fd = -1;
-		pollfd[i].revents = 0;
-	}
-	client_size += CLIENT_NALLOC;
-}
-
-void client_dead(int ci)
-{
-	close(client[ci].fd);
-	client[ci].workfn = NULL;
-	client[ci].fd = -1;
-	pollfd[ci].fd = -1;
-}
-
-int client_add(int fd, void (*workfn)(int ci), void (*deadfn)(int ci))
-{
-	int i;
-
-	if (!client)
-		client_alloc();
- again:
-	for (i = 0; i < client_size; i++) {
-		if (client[i].fd == -1) {
-			client[i].workfn = workfn;
-			if (deadfn)
-				client[i].deadfn = deadfn;
-			else
-				client[i].deadfn = client_dead;
-			client[i].fd = fd;
-			pollfd[i].fd = fd;
-			pollfd[i].events = POLLIN;
-			if (i > client_maxi)
-				client_maxi = i;
-			return i;
-		}
-	}
-
-	client_alloc();
-	goto again;
-}
-
-int client_fd(int ci)
-{
-	return client[ci].fd;
-}
-
-void client_ignore(int ci, int fd)
-{
-	pollfd[ci].fd = -1;
-	pollfd[ci].events = 0;
-}
-
-void client_back(int ci, int fd)
-{
-	pollfd[ci].fd = fd;
-	pollfd[ci].events = POLLIN;
-}
-
-static void sigterm_handler(int sig)
-{
-	daemon_quit = 1;
-}
-
-static struct lockspace *create_ls(char *name)
-{
-	struct lockspace *ls;
-
-	ls = malloc(sizeof(*ls));
-	if (!ls)
-		goto out;
-	memset(ls, 0, sizeof(struct lockspace));
-	strncpy(ls->name, name, DLM_LOCKSPACE_LEN);
-
-	INIT_LIST_HEAD(&ls->changes);
-	INIT_LIST_HEAD(&ls->node_history);
-	INIT_LIST_HEAD(&ls->saved_messages);
-	INIT_LIST_HEAD(&ls->plock_resources);
-	INIT_LIST_HEAD(&ls->deadlk_nodes);
-	INIT_LIST_HEAD(&ls->transactions);
-	INIT_LIST_HEAD(&ls->resources);
- out:
-	return ls;
-}
-
-struct lockspace *find_ls(char *name)
-{
-	struct lockspace *ls;
-
-	list_for_each_entry(ls, &lockspaces, list) {
-		if ((strlen(ls->name) == strlen(name)) &&
-		    !strncmp(ls->name, name, strlen(name)))
-			return ls;
-	}
-	return NULL;
-}
-
-struct lockspace *find_ls_id(uint32_t id)
-{
-	struct lockspace *ls;
-
-	list_for_each_entry(ls, &lockspaces, list) {
-		if (ls->global_id == id)
-			return ls;
-	}
-	return NULL;
-}
-
-struct fs_reg {
-	struct list_head list;
-	char name[DLM_LOCKSPACE_LEN+1];
-};
-
-static int fs_register_check(char *name)
-{
-	struct fs_reg *fs;
-	list_for_each_entry(fs, &fs_register_list, list) {
-		if (!strcmp(name, fs->name))
-			return 1;
-	}
-	return 0;
-}
-
-static int fs_register_add(char *name)
-{
-	struct fs_reg *fs;
-
-	if (fs_register_check(name))
-		return -EALREADY;
-
-	fs = malloc(sizeof(struct fs_reg));
-	if (!fs)
-		return -ENOMEM;
-	strncpy(fs->name, name, DLM_LOCKSPACE_LEN);
-	list_add(&fs->list, &fs_register_list);
-	return 0;
-}
-
-static void fs_register_del(char *name)
-{
-	struct fs_reg *fs;
-	list_for_each_entry(fs, &fs_register_list, list) {
-		if (!strcmp(name, fs->name)) {
-			list_del(&fs->list);
-			free(fs);
-			return;
-		}
-	}
-}
-
-#define MAXARGS 8
-
-static char *get_args(char *buf, int *argc, char **argv, char sep, int want)
-{
-	char *p = buf, *rp = NULL;
-	int i;
-
-	argv[0] = p;
-
-	for (i = 1; i < MAXARGS; i++) {
-		p = strchr(buf, sep);
-		if (!p)
-			break;
-		*p = '\0';
-
-		if (want == i) {
-			rp = p + 1;
-			break;
-		}
-
-		argv[i] = p + 1;
-		buf = p + 1;
-	}
-	*argc = i;
-
-	/* we ended by hitting \0, return the point following that */
-	if (!rp)
-		rp = strchr(buf, '\0') + 1;
-
-	return rp;
-}
-
-char *dlm_mode_str(int mode)
-{
-	switch (mode) {
-	case DLM_LOCK_IV:
-		return "IV";
-	case DLM_LOCK_NL:
-		return "NL";
-	case DLM_LOCK_CR:
-		return "CR";
-	case DLM_LOCK_CW:
-		return "CW";
-	case DLM_LOCK_PR:
-		return "PR";
-	case DLM_LOCK_PW:
-		return "PW";
-	case DLM_LOCK_EX:
-		return "EX";
-	}
-	return "??";
-}
-
-/* recv "online" (join) and "offline" (leave) 
-   messages from dlm via uevents and pass them on to groupd */
-
-static void process_uevent(int ci)
-{
-	struct lockspace *ls;
-	char buf[MAXLINE];
-	char *argv[MAXARGS], *act, *sys;
-	int rv, argc = 0;
-
-	memset(buf, 0, sizeof(buf));
-	memset(argv, 0, sizeof(char *) * MAXARGS);
-
- retry_recv:
-	rv = recv(client[ci].fd, &buf, sizeof(buf), 0);
-	if (rv < 0) {
-		if (errno == EINTR)
-			goto retry_recv;
-		if (errno != EAGAIN)
-			log_error("uevent recv error %d errno %d", rv, errno);
-		return;
-	}
-
-	if (!strstr(buf, "dlm"))
-		return;
-
-	log_debug("uevent: %s", buf);
-
-	get_args(buf, &argc, argv, '/', 4);
-	if (argc != 4)
-		log_error("uevent message has %d args", argc);
-	act = argv[0];
-	sys = argv[2];
-
-	if ((strlen(sys) != strlen("dlm")) || strcmp(sys, "dlm"))
-		return;
-
-	log_debug("kernel: %s %s", act, argv[3]);
-
-	rv = 0;
-
-	if (!strcmp(act, "online@")) {
-		ls = find_ls(argv[3]);
-		if (ls) {
-			rv = -EEXIST;
-			goto out;
-		}
-
-		ls = create_ls(argv[3]);
-		if (!ls) {
-			rv = -ENOMEM;
-			goto out;
-		}
-
-		if (fs_register_check(ls->name))
-			ls->fs_registered = 1;
-
-		if (group_mode == GROUP_LIBGROUP)
-			rv = dlm_join_lockspace_group(ls);
-		else
-			rv = dlm_join_lockspace(ls);
-		if (rv) {
-			/* ls already freed */
-			goto out;
-		}
-
-	} else if (!strcmp(act, "offline@")) {
-		ls = find_ls(argv[3]);
-		if (!ls) {
-			rv = -ENOENT;
-			goto out;
-		}
-
-		if (group_mode == GROUP_LIBGROUP)
-			dlm_leave_lockspace_group(ls);
-		else
-			dlm_leave_lockspace(ls);
-	}
- out:
-	if (rv < 0)
-		log_error("process_uevent %s error %d errno %d",
-			  act, rv, errno);
-}
-
-static int setup_uevent(void)
-{
-	struct sockaddr_nl snl;
-	int s, rv;
-
-	s = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT);
-	if (s < 0) {
-		log_error("uevent netlink socket");
-		return s;
-	}
-
-	memset(&snl, 0, sizeof(snl));
-	snl.nl_family = AF_NETLINK;
-	snl.nl_pid = getpid();
-	snl.nl_groups = 1;
-
-	rv = bind(s, (struct sockaddr *) &snl, sizeof(snl));
-	if (rv < 0) {
-		log_error("uevent bind error %d errno %d", rv, errno);
-		close(s);
-		return rv;
-	}
-
-	return s;
-}
-
-static void init_header(struct dlmc_header *h, int cmd, char *name, int result,
-			int extra_len)
-{
-	memset(h, 0, sizeof(struct dlmc_header));
-
-	h->magic = DLMC_MAGIC;
-	h->version = DLMC_VERSION;
-	h->len = sizeof(struct dlmc_header) + extra_len;
-	h->command = cmd;
-	h->data = result;
-
-	if (name)
-		strncpy(h->name, name, DLM_LOCKSPACE_LEN);
-}
-
-static void query_dump_debug(int fd)
-{
-	struct dlmc_header h;
-	int extra_len;
-	int len;
-
-	/* in the case of dump_wrap, extra_len will go in two writes,
-	   first the log tail, then the log head */
-	if (dump_wrap)
-		extra_len = DLMC_DUMP_SIZE;
-	else
-		extra_len = dump_point;
-
-	init_header(&h, DLMC_CMD_DUMP_DEBUG, NULL, 0, extra_len);
-	do_write(fd, &h, sizeof(h));
-
-	if (dump_wrap) {
-		len = DLMC_DUMP_SIZE - dump_point;
-		do_write(fd, dump_buf + dump_point, len);
-		len = dump_point;
-	} else
-		len = dump_point;
-
-	/* NUL terminate the debug string */
-	dump_buf[dump_point] = '\0';
-
-	do_write(fd, dump_buf, len);
-}
-
-static void query_dump_plocks(int fd, char *name)
-{
-	struct lockspace *ls;
-	struct dlmc_header h;
-	int rv;
-
-	ls = find_ls(name);
-	if (!ls) {
-		plock_dump_len = 0;
-		rv = -ENOENT;
-	} else {
-		/* writes to plock_dump_buf and sets plock_dump_len */
-		rv = fill_plock_dump_buf(ls);
-	}
-
-	init_header(&h, DLMC_CMD_DUMP_PLOCKS, name, rv, plock_dump_len);
-
-	do_write(fd, &h, sizeof(h));
-
-	if (plock_dump_len)
-		do_write(fd, plock_dump_buf, plock_dump_len);
-}
-
-/* combines a header and the data and sends it back to the client in
-   a single do_write() call */
-
-static void do_reply(int fd, int cmd, char *name, int result, int option,
-		     char *buf, int buflen)
-{
-	struct dlmc_header *h;
-	char *reply;
-	int reply_len;
-
-	reply_len = sizeof(struct dlmc_header) + buflen;
-	reply = malloc(reply_len);
-	if (!reply)
-		return;
-	memset(reply, 0, reply_len);
-	h = (struct dlmc_header *)reply;
-
-	init_header(h, cmd, name, result, buflen);
-	h->option = option;
-
-	if (buf && buflen)
-		memcpy(reply + sizeof(struct dlmc_header), buf, buflen);
-
-	do_write(fd, reply, reply_len);
-
-	free(reply);
-}
-
-static void query_lockspace_info(int fd, char *name)
-{
-	struct lockspace *ls;
-	struct dlmc_lockspace lockspace;
-	int rv;
-
-	ls = find_ls(name);
-	if (!ls) {
-		rv = -ENOENT;
-		goto out;
-	}
-
-	memset(&lockspace, 0, sizeof(lockspace));
-	lockspace.group_mode = group_mode;
-
-	if (group_mode == GROUP_LIBGROUP)
-		rv = set_lockspace_info_group(ls, &lockspace);
-	else
-		rv = set_lockspace_info(ls, &lockspace);
- out:
-	do_reply(fd, DLMC_CMD_LOCKSPACE_INFO, name, rv, 0,
-		 (char *)&lockspace, sizeof(lockspace));
-}
-
-static void query_node_info(int fd, char *name, int nodeid)
-{
-	struct lockspace *ls;
-	struct dlmc_node node;
-	int rv;
-
-	ls = find_ls(name);
-	if (!ls) {
-		rv = -ENOENT;
-		goto out;
-	}
-
-	memset(&node, 0, sizeof(node));
-
-	if (group_mode == GROUP_LIBGROUP)
-		rv = set_node_info_group(ls, nodeid, &node);
-	else
-		rv = set_node_info(ls, nodeid, &node);
- out:
-	do_reply(fd, DLMC_CMD_NODE_INFO, name, rv, 0,
-		 (char *)&node, sizeof(node));
-}
-
-static void query_lockspaces(int fd, int max)
-{
-	int ls_count = 0;
-	struct dlmc_lockspace *lss = NULL;
-	int rv, result;
-
-	if (group_mode == GROUP_LIBGROUP)
-		rv = set_lockspaces_group(&ls_count, &lss);
-	else
-		rv = set_lockspaces(&ls_count, &lss);
-
-	if (rv < 0) {
-		result = rv;
-		ls_count = 0;
-		goto out;
-	}
-
-	if (ls_count > max) {
-		result = -E2BIG;
-		ls_count = max;
-	} else {
-		result = ls_count;
-	}
- out:
-	do_reply(fd, DLMC_CMD_LOCKSPACES, NULL, result, 0,
-		 (char *)lss, ls_count * sizeof(struct dlmc_lockspace));
-
-	if (lss)
-		free(lss);
-}
-
-static void query_lockspace_nodes(int fd, char *name, int option, int max)
-{
-	struct lockspace *ls;
-	int node_count = 0;
-	struct dlmc_node *nodes = NULL;
-	int rv, result;
-
-	ls = find_ls(name);
-	if (!ls) {
-		result = -ENOENT;
-		node_count = 0;
-		goto out;
-	}
-
-	if (group_mode == GROUP_LIBGROUP)
-		rv = set_lockspace_nodes_group(ls, option, &node_count, &nodes);
-	else
-		rv = set_lockspace_nodes(ls, option, &node_count, &nodes);
-
-	if (rv < 0) {
-		result = rv;
-		node_count = 0;
-		goto out;
-	}
-
-	/* node_count is the number of structs copied/returned; the caller's
-	   max may be less than that, in which case we copy as many as they
-	   asked for and return -E2BIG */
-
-	if (node_count > max) {
-		result = -E2BIG;
-		node_count = max;
-	} else {
-		result = node_count;
-	}
- out:
-	do_reply(fd, DLMC_CMD_LOCKSPACE_NODES, name, result, 0,
-		 (char *)nodes, node_count * sizeof(struct dlmc_node));
-
-	if (nodes)
-		free(nodes);
-}
-
-static void process_connection(int ci)
-{
-	struct dlmc_header h;
-	char *extra = NULL;
-	int rv, extra_len;
-	struct lockspace *ls;
-
-	rv = do_read(client[ci].fd, &h, sizeof(h));
-	if (rv < 0) {
-		log_debug("connection %d read error %d", ci, rv);
-		goto out;
-	}
-
-	if (h.magic != DLMC_MAGIC) {
-		log_debug("connection %d magic error %x", ci, h.magic);
-		goto out;
-	}
-
-	if ((h.version & 0xFFFF0000) != (DLMC_VERSION & 0xFFFF0000)) {
-		log_debug("connection %d version error %x", ci, h.version);
-		goto out;
-	}
-
-	if (h.len > sizeof(h)) {
-		extra_len = h.len - sizeof(h);
-		extra = malloc(extra_len);
-		if (!extra) {
-			log_error("process_connection no mem %d", extra_len);
-			goto out;
-		}
-		memset(extra, 0, extra_len);
-
-		rv = do_read(client[ci].fd, extra, extra_len);
-		if (rv < 0) {
-			log_debug("connection %d extra read error %d", ci, rv);
-			goto out;
-		}
-	}
-
-	switch (h.command) {
-	case DLMC_CMD_FS_REGISTER:
-		if (group_mode == GROUP_LIBGROUP) {
-			rv = -EINVAL;
-		} else {
-			rv = fs_register_add(h.name);
-			ls = find_ls(h.name);
-			if (ls)
-				ls->fs_registered = 1;
-		}
-		do_reply(client[ci].fd, DLMC_CMD_FS_REGISTER, h.name, rv, 0,
-			 NULL, 0);
-		break;
-
-	case DLMC_CMD_FS_UNREGISTER:
-		if (group_mode == GROUP_LIBGROUP)
-			break;
-		fs_register_del(h.name);
-		ls = find_ls(h.name);
-		if (ls)
-			ls->fs_registered = 0;
-		break;
-
-	case DLMC_CMD_FS_NOTIFIED:
-		ls = find_ls(h.name);
-		if (ls)
-			rv = set_fs_notified(ls, h.data);
-		else
-			rv = -ENOENT;
-		/* pass back the nodeid provided by caller in option field */
-		do_reply(client[ci].fd, DLMC_CMD_FS_NOTIFIED, h.name, rv,
-			 h.data, NULL, 0);
-		break;
-
-	case DLMC_CMD_DEADLOCK_CHECK:
-		ls = find_ls(h.name);
-		if (ls)
-			send_cycle_start(ls);
-		client_dead(ci);
-		break;
-
-	default:
-		log_error("process_connection %d unknown command %d",
-			  ci, h.command);
-	}
- out:
-	if (extra)
-		free(extra);
-}
-
-static void process_listener(int ci)
-{
-	int fd, i;
-
-	fd = accept(client[ci].fd, NULL, NULL);
-	if (fd < 0) {
-		log_error("process_listener: accept error %d %d", fd, errno);
-		return;
-	}
-	
-	i = client_add(fd, process_connection, NULL);
-
-	log_debug("client connection %d fd %d", i, fd);
-}
-
-static int setup_listener(char *sock_path)
-{
-	struct sockaddr_un addr;
-	socklen_t addrlen;
-	int rv, s;
-
-	/* we listen for new client connections on socket s */
-
-	s = socket(AF_LOCAL, SOCK_STREAM, 0);
-	if (s < 0) {
-		log_error("socket error %d %d", s, errno);
-		return s;
-	}
-
-	memset(&addr, 0, sizeof(addr));
-	addr.sun_family = AF_LOCAL;
-	strcpy(&addr.sun_path[1], sock_path);
-	addrlen = sizeof(sa_family_t) + strlen(addr.sun_path+1) + 1;
-
-	rv = bind(s, (struct sockaddr *) &addr, addrlen);
-	if (rv < 0) {
-		log_error("bind error %d %d", rv, errno);
-		close(s);
-		return rv;
-	}
-
-	rv = listen(s, 5);
-	if (rv < 0) {
-		log_error("listen error %d %d", rv, errno);
-		close(s);
-		return rv;
-	}
-	return s;
-}
-
-void query_lock(void)
-{
-	pthread_mutex_lock(&query_mutex);
-}
-
-void query_unlock(void)
-{
-	pthread_mutex_unlock(&query_mutex);
-}
-
-/* This is a thread, so we have to be careful, don't call log_ functions.
-   We need a thread to process queries because the main thread may block
-   for long periods when writing to sysfs to stop dlm-kernel (any maybe
-   other places). */
-
-static void *process_queries(void *arg)
-{
-	struct dlmc_header h;
-	int s, f, rv;
-
-	rv = setup_listener(DLMC_QUERY_SOCK_PATH);
-	if (rv < 0)
-		exit (-1);
-
-	s = rv;
-
-	for (;;) {
-		f = accept(s, NULL, NULL);
-		if (f < 0)
-			exit (-1);
-
-		rv = do_read(f, &h, sizeof(h));
-		if (rv < 0) {
-			goto out;
-		}
-
-		if (h.magic != DLMC_MAGIC) {
-			goto out;
-		}
-
-		if ((h.version & 0xFFFF0000) != (DLMC_VERSION & 0xFFFF0000)) {
-			goto out;
-		}
-
-		query_lock();
-
-		switch (h.command) {
-		case DLMC_CMD_DUMP_DEBUG:
-			query_dump_debug(f);
-			break;
-		case DLMC_CMD_DUMP_PLOCKS:
-			query_dump_plocks(f, h.name);
-			break;
-		case DLMC_CMD_LOCKSPACE_INFO:
-			query_lockspace_info(f, h.name);
-			break;
-		case DLMC_CMD_NODE_INFO:
-			query_node_info(f, h.name, h.data);
-			break;
-		case DLMC_CMD_LOCKSPACES:
-			query_lockspaces(f, h.data);
-			break;
-		case DLMC_CMD_LOCKSPACE_NODES:
-			query_lockspace_nodes(f, h.name, h.option, h.data);
-			break;
-		default:
-			break;
-		}
-		query_unlock();
-
- out:
-		close(f);
-	}
-}
-
-static int setup_queries(void)
-{
-	int rv;
-
-	pthread_mutex_init(&query_mutex, NULL);
-
-	rv = pthread_create(&query_thread, NULL, process_queries, NULL);
-	if (rv < 0) {
-		log_error("can't create query thread");
-		return rv;
-	}
-	return 0;
-}
-
-/* The dlm in kernels before 2.6.28 do not have the monitor device.  We
-   keep this fd open as long as we're running.  If we exit/terminate while
-   lockspaces exist in the kernel, the kernel will detect a close on this
-   fd and stop the lockspaces. */
-
-static void setup_monitor(void)
-{
-	if (!monitor_minor)
-		return;
-
-	kernel_monitor_fd = open("/dev/misc/dlm-monitor", O_RDONLY);
-	log_debug("/dev/misc/dlm-monitor fd %d", kernel_monitor_fd);
-}
-
-void cluster_dead(int ci)
-{
-	if (!cluster_down)
-		log_error("cluster is down, exiting");
-	daemon_quit = 1;
-	cluster_down = 1;
-}
-
-static void loop(void)
-{
-	int poll_timeout = -1;
-	int rv, i;
-	void (*workfn) (int ci);
-	void (*deadfn) (int ci);
-
-	rv = setup_queries();
-	if (rv < 0)
-		goto out;
-
-	rv = setup_listener(DLMC_SOCK_PATH);
-	if (rv < 0)
-		goto out;
-	client_add(rv, process_listener, NULL);
-
-	rv = setup_cluster();
-	if (rv < 0)
-		goto out;
-	client_add(rv, process_cluster, cluster_dead);
-
-	rv = setup_ccs();
-	if (rv < 0)
-		goto out;
-
-	setup_logging();
-
-	rv = check_uncontrolled_lockspaces();
-	if (rv < 0)
-		goto out;
-
-	rv = setup_misc_devices();
-	if (rv < 0)
-		goto out;
-
-	setup_monitor();
-
-	rv = setup_configfs();
-	if (rv < 0)
-		goto out;
-
-	rv = setup_uevent();
-	if (rv < 0)
-		goto out;
-	client_add(rv, process_uevent, NULL);
-
-	group_mode = GROUP_LIBCPG;
-
-	if (cfgd_groupd_compat) {
-		rv = setup_groupd();
-		if (rv < 0)
-			goto out;
-		client_add(rv, process_groupd, cluster_dead);
-
-		switch (cfgd_groupd_compat) {
-		case 1:
-			group_mode = GROUP_LIBGROUP;
-			rv = 0;
-			break;
-		case 2:
-			rv = set_group_mode();
-			break;
-		default:
-			log_error("inval groupd_compat %d", cfgd_groupd_compat);
-			rv = -1;
-			break;
-		}
-		if (rv < 0) 
-			goto out;
-	}
-	log_debug("group_mode %d compat %d", group_mode, cfgd_groupd_compat);
-
-	if (group_mode == GROUP_LIBCPG) {
-		rv = setup_cpg();
-		if (rv < 0)
-			goto out;
-		client_add(rv, process_cpg, cluster_dead);
-
-		rv = set_protocol();
-		if (rv < 0)
-			goto out;
-
-		if (cfgd_enable_deadlk) {
-			rv = setup_netlink();
-			if (rv < 0)
-				goto out;
-			client_add(rv, process_netlink, NULL);
-
-			setup_deadlock();
-		}
-
-		rv = setup_plocks();
-		if (rv < 0)
-			goto out;
-		plock_fd = rv;
-		plock_ci = client_add(rv, process_plocks, NULL);
-	}
-
-	for (;;) {
-		rv = poll(pollfd, client_maxi + 1, poll_timeout);
-		if (rv == -1 && errno == EINTR) {
-			if (daemon_quit && list_empty(&lockspaces))
-				goto out;
-			daemon_quit = 0;
-			continue;
-		}
-		if (rv < 0) {
-			log_error("poll errno %d", errno);
-			goto out;
-		}
-
-		query_lock();
-
-		for (i = 0; i <= client_maxi; i++) {
-			if (client[i].fd < 0)
-				continue;
-			if (pollfd[i].revents & POLLIN) {
-				workfn = client[i].workfn;
-				workfn(i);
-			}
-			if (pollfd[i].revents & (POLLERR | POLLHUP | POLLNVAL)) {
-				deadfn = client[i].deadfn;
-				deadfn(i);
-			}
-		}
-		query_unlock();
-
-		if (daemon_quit)
-			break;
-
-		query_lock();
-
-		poll_timeout = -1;
-
-		if (poll_fencing || poll_quorum || poll_fs) {
-			process_lockspace_changes();
-			poll_timeout = 1000;
-		}
-
-		if (poll_ignore_plock) {
-			if (!limit_plocks()) {
-				poll_ignore_plock = 0;
-				client_back(plock_ci, plock_fd);
-			}
-			poll_timeout = 1000;
-		}
-		query_unlock();
-	}
- out:
-	if (cfgd_groupd_compat)
-		close_groupd();
-	if (group_mode == GROUP_LIBCPG)
-		close_cpg();
-	clear_configfs();
-	close_logging();
-	close_ccs();
-	close_cluster();
-
-	if (!list_empty(&lockspaces))
-		log_error("lockspaces abandoned");
-}
-
-static void lockfile(void)
-{
-	int fd, error;
-	struct flock lock;
-	char buf[33];
-
-	memset(buf, 0, 33);
-
-	fd = open(LOCKFILE_NAME, O_CREAT|O_WRONLY,
-		  S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
-	if (fd < 0) {
-		fprintf(stderr, "cannot open/create lock file %s\n",
-			LOCKFILE_NAME);
-		exit(EXIT_FAILURE);
-	}
-
-	lock.l_type = F_WRLCK;
-	lock.l_start = 0;
-	lock.l_whence = SEEK_SET;
-	lock.l_len = 0;
-
-	error = fcntl(fd, F_SETLK, &lock);
-	if (error) {
-		fprintf(stderr, "dlm_controld is already running\n");
-		exit(EXIT_FAILURE);
-	}
-
-	error = ftruncate(fd, 0);
-	if (error) {
-		fprintf(stderr, "cannot clear lock file %s\n", LOCKFILE_NAME);
-		exit(EXIT_FAILURE);
-	}
-
-	sprintf(buf, "%d\n", getpid());
-
-	error = write(fd, buf, strlen(buf));
-	if (error <= 0) {
-		fprintf(stderr, "cannot write lock file %s\n", LOCKFILE_NAME);
-		exit(EXIT_FAILURE);
-	}
-}
-
-static void print_usage(void)
-{
-	printf("Usage:\n");
-	printf("\n");
-	printf("dlm_controld [options]\n");
-	printf("\n");
-	printf("Options:\n");
-	printf("\n");
-	printf("  -D		Enable debugging to stderr and don't fork\n");
-	printf("  -L		Enable debugging to log file\n");
-	printf("  -K		Enable kernel dlm debugging messages\n");
-	printf("  -g <num>	groupd compatibility mode, 0 off, 1 on, 2 detect\n");
-	printf("		0: use libcpg, no backward compat, best performance\n");
-	printf("		1: use libgroup for compat with cluster2/rhel5\n");
-	printf("		2: use groupd to detect old, or mode 1, nodes that\n"
-	       "		require compat, use libcpg if none found\n");
-	printf("		Default is %d\n", DEFAULT_GROUPD_COMPAT);
-	printf("  -f <num>	Enable (1) or disable (0) fencing recovery dependency\n");
-	printf("		Default is %d\n", DEFAULT_ENABLE_FENCING);
-	printf("  -q <num>	Enable (1) or disable (0) quorum recovery dependency\n");
-	printf("		Default is %d\n", DEFAULT_ENABLE_QUORUM);
-	printf("  -d <num>	Enable (1) or disable (0) deadlock detection code\n");
-	printf("		Default is %d\n", DEFAULT_ENABLE_DEADLK);
-	printf("  -p <num>	Enable (1) or disable (0) plock code for cluster fs\n");
-	printf("		Default is %d\n", DEFAULT_ENABLE_PLOCK);
-	printf("  -P		Enable plock debugging\n");
-	printf("  -l <limit>	Limit the rate of plock operations\n");
-	printf("		Default is %d, set to 0 for no limit\n", DEFAULT_PLOCK_RATE_LIMIT);
-	printf("  -o <n>	Enable (1) or disable (0) plock ownership\n");
-	printf("		Default is %d\n", DEFAULT_PLOCK_OWNERSHIP);
-	printf("  -t <ms>	plock ownership drop resources time (milliseconds)\n");
-	printf("		Default is %u\n", DEFAULT_DROP_RESOURCES_TIME);
-	printf("  -c <num>	plock ownership drop resources count\n");
-	printf("		Default is %u\n", DEFAULT_DROP_RESOURCES_COUNT);
-	printf("  -a <ms>	plock ownership drop resources age (milliseconds)\n");
-	printf("		Default is %u\n", DEFAULT_DROP_RESOURCES_AGE);
-	printf("  -h		Print this help, then exit\n");
-	printf("  -V		Print program version information, then exit\n");
-}
-
-#define OPTION_STRING "LDKg:f:q:d:p:Pl:o:t:c:a:hV"
-
-static void read_arguments(int argc, char **argv)
-{
-	int cont = 1;
-	int optchar;
-
-	/* we don't allow these to be set on command line, should we? */
-	optk_timewarn = 0;
-	optk_timewarn = 0;
-
-	while (cont) {
-		optchar = getopt(argc, argv, OPTION_STRING);
-
-		switch (optchar) {
-
-		case 'D':
-			daemon_debug_opt = 1;
-			break;
-
-		case 'L':
-			optd_debug_logfile = 1;
-			cfgd_debug_logfile = 1;
-			break;
-
-		case 'g':
-			optd_groupd_compat = 1;
-			cfgd_groupd_compat = atoi(optarg);
-			break;
-
-		case 'K':
-			optk_debug = 1;
-			cfgk_debug = 1;
-			break;
-
-		case 'f':
-			optd_enable_fencing = 1;
-			cfgd_enable_fencing = atoi(optarg);
-			break;
-
-		case 'q':
-			optd_enable_quorum = 1;
-			cfgd_enable_quorum = atoi(optarg);
-			break;
-
-		case 'd':
-			optd_enable_deadlk = 1;
-			cfgd_enable_deadlk = atoi(optarg);
-			break;
-
-		case 'p':
-			optd_enable_plock = 1;
-			cfgd_enable_plock = atoi(optarg);
-			break;
-
-		case 'P':
-			optd_plock_debug = 1;
-			cfgd_plock_debug = 1;
-			break;
-
-		case 'l':
-			optd_plock_rate_limit = 1;
-			cfgd_plock_rate_limit = atoi(optarg);
-			break;
-
-		case 'o':
-			optd_plock_ownership = 1;
-			cfgd_plock_ownership = atoi(optarg);
-			break;
-
-		case 't':
-			optd_drop_resources_time = 1;
-			cfgd_drop_resources_time = atoi(optarg);
-			break;
-
-		case 'c':
-			optd_drop_resources_count = 1;
-			cfgd_drop_resources_count = atoi(optarg);
-			break;
-
-		case 'a':
-			optd_drop_resources_age = 1;
-			cfgd_drop_resources_age = atoi(optarg);
-			break;
-
-		case 'h':
-			print_usage();
-			exit(EXIT_SUCCESS);
-			break;
-
-		case 'V':
-			printf("dlm_controld %s (built %s %s)\n",
-				RELEASE_VERSION, __DATE__, __TIME__);
-			printf("%s\n", REDHAT_COPYRIGHT);
-			exit(EXIT_SUCCESS);
-			break;
-
-		case ':':
-		case '?':
-			fprintf(stderr, "Please use '-h' for usage.\n");
-			exit(EXIT_FAILURE);
-			break;
-
-		case EOF:
-			cont = 0;
-			break;
-
-		default:
-			fprintf(stderr, "unknown option: %c\n", optchar);
-			exit(EXIT_FAILURE);
-			break;
-		};
-	}
-
-	if (getenv("DLM_CONTROLD_DEBUG")) {
-		optd_debug_logfile = 1;
-		cfgd_debug_logfile = 1;
-	}
-}
-
-static void set_oom_adj(int val)
-{
-	FILE *fp;
-
-	fp = fopen("/proc/self/oom_adj", "w");
-	if (!fp)
-		return;
-
-	fprintf(fp, "%i", val);
-	fclose(fp);
-}
-
-static void set_scheduler(void)
-{
-	struct sched_param sched_param;
-	int rv;
-
-	rv = sched_get_priority_max(SCHED_RR);
-	if (rv != -1) {
-		sched_param.sched_priority = rv;
-		rv = sched_setscheduler(0, SCHED_RR, &sched_param);
-		if (rv == -1)
-			log_error("could not set SCHED_RR priority %d err %d",
-				   sched_param.sched_priority, errno);
-	} else {
-		log_error("could not get maximum scheduler priority err %d",
-			  errno);
-	}
-}
-
-int main(int argc, char **argv)
-{
-	INIT_LIST_HEAD(&lockspaces);
-	INIT_LIST_HEAD(&fs_register_list);
-
-	read_arguments(argc, argv);
-	lockfile();
-
-	if (!daemon_debug_opt) {
-		if (daemon(0, 0) < 0) {
-			perror("daemon error");
-			exit(EXIT_FAILURE);
-		}
-	}
-	init_logging();
-	log_level(LOG_INFO, "dlm_controld %s", RELEASE_VERSION);
-	signal(SIGTERM, sigterm_handler);
-	set_scheduler();
-	set_oom_adj(-16);
-
-	loop();
-
-	return 0;
-}
-
-void daemon_dump_save(void)
-{
-	int len, i;
-
-	len = strlen(daemon_debug_buf);
-
-	for (i = 0; i < len; i++) {
-		dump_buf[dump_point++] = daemon_debug_buf[i];
-
-		if (dump_point == DLMC_DUMP_SIZE) {
-			dump_point = 0;
-			dump_wrap = 1;
-		}
-	}
-}
-
-int daemon_debug_opt;
-int daemon_quit;
-int cluster_down;
-int poll_fencing;
-int poll_quorum;
-int poll_fs;
-int poll_ignore_plock;
-int plock_fd;
-int plock_ci;
-struct list_head lockspaces;
-int cluster_quorate;
-int our_nodeid;
-char daemon_debug_buf[256];
-char dump_buf[DLMC_DUMP_SIZE];
-int dump_point;
-int dump_wrap;
-char plock_dump_buf[DLMC_DUMP_SIZE];
-int plock_dump_len;
-int group_mode;
-uint32_t control_minor;
-uint32_t monitor_minor;
-uint32_t plock_minor;
-uint32_t old_plock_minor;
-
-/* was a config value set on command line?, 0 or 1.
-   optk is a kernel option, optd is a daemon option */
-
-int optk_debug;
-int optk_timewarn;
-int optk_protocol;
-int optd_groupd_compat;
-int optd_debug_logfile;
-int optd_enable_fencing;
-int optd_enable_quorum;
-int optd_enable_deadlk;
-int optd_enable_plock;
-int optd_plock_debug;
-int optd_plock_rate_limit;
-int optd_plock_ownership;
-int optd_drop_resources_time;
-int optd_drop_resources_count;
-int optd_drop_resources_age;
-
-/* actual config value from command line, cluster.conf, or default.
-   cfgk is a kernel config value, cfgd is a daemon config value */
-
-int cfgk_debug                  = -1;
-int cfgk_timewarn               = -1;
-int cfgk_protocol               = -1;
-int cfgd_groupd_compat          = DEFAULT_GROUPD_COMPAT;
-int cfgd_debug_logfile		= DEFAULT_DEBUG_LOGFILE;
-int cfgd_enable_fencing         = DEFAULT_ENABLE_FENCING;
-int cfgd_enable_quorum          = DEFAULT_ENABLE_QUORUM;
-int cfgd_enable_deadlk          = DEFAULT_ENABLE_DEADLK;
-int cfgd_enable_plock           = DEFAULT_ENABLE_PLOCK;
-int cfgd_plock_debug            = DEFAULT_PLOCK_DEBUG;
-int cfgd_plock_rate_limit       = DEFAULT_PLOCK_RATE_LIMIT;
-int cfgd_plock_ownership        = DEFAULT_PLOCK_OWNERSHIP;
-int cfgd_drop_resources_time    = DEFAULT_DROP_RESOURCES_TIME;
-int cfgd_drop_resources_count   = DEFAULT_DROP_RESOURCES_COUNT;
-int cfgd_drop_resources_age     = DEFAULT_DROP_RESOURCES_AGE;
-
diff --git a/group/dlm_controld/member_cman.c b/group/dlm_controld/member_cman.c
deleted file mode 100644
index 19403f5..0000000
--- a/group/dlm_controld/member_cman.c
+++ /dev/null
@@ -1,270 +0,0 @@
-#include "dlm_daemon.h"
-#include "config.h"
-#include <libcman.h>
-#include "libfenced.h"
-
-static cman_handle_t	ch;
-static cman_handle_t	ch_admin;
-static cman_node_t      old_nodes[MAX_NODES];
-static int              old_node_count;
-static cman_node_t      cman_nodes[MAX_NODES];
-static int              cman_node_count;
-
-void kick_node_from_cluster(int nodeid)
-{
-	if (!nodeid) {
-		log_error("telling cman to shut down cluster locally");
-		cman_shutdown(ch_admin, CMAN_SHUTDOWN_ANYWAY);
-	} else {
-		log_error("telling cman to remove nodeid %d from cluster",
-			  nodeid);
-		cman_kill_node(ch_admin, nodeid);
-	}
-}
-
-static int is_member(cman_node_t *node_list, int count, int nodeid)
-{
-	int i;
-
-	for (i = 0; i < count; i++) {
-		if (node_list[i].cn_nodeid == nodeid)
-			return node_list[i].cn_member;
-	}
-	return 0;
-}
-
-static int is_old_member(int nodeid)
-{
-	return is_member(old_nodes, old_node_count, nodeid);
-}
-
-int is_cluster_member(int nodeid)
-{
-	return is_member(cman_nodes, cman_node_count, nodeid);
-}
-
-static cman_node_t *find_cman_node(int nodeid)
-{
-	int i;
-
-	for (i = 0; i < cman_node_count; i++) {
-		if (cman_nodes[i].cn_nodeid == nodeid)
-			return &cman_nodes[i];
-	}
-	return NULL;
-}
-
-char *nodeid2name(int nodeid)
-{
-	cman_node_t *cn;
-
-	cn = find_cman_node(nodeid);
-	if (!cn)
-		return NULL;
-	return cn->cn_name;
-}
-
-/* add a configfs dir for cluster members that don't have one,
-   del the configfs dir for cluster members that are now gone */
-
-static void statechange(void)
-{
-	int i, j, rv;
-	struct cman_node_address addrs[MAX_NODE_ADDRESSES];
-	int num_addrs;
-	struct cman_node_address *addrptr = addrs;
-
-	cluster_quorate = cman_is_quorate(ch);
-
-	old_node_count = cman_node_count;
-	memcpy(&old_nodes, &cman_nodes, sizeof(old_nodes));
-
-	cman_node_count = 0;
-	memset(&cman_nodes, 0, sizeof(cman_nodes));
-	rv = cman_get_nodes(ch, MAX_NODES, &cman_node_count, cman_nodes);
-	if (rv < 0) {
-		log_debug("cman_get_nodes error %d %d", rv, errno);
-		return;
-	}
-
-	/* Never allow node ID 0 to be considered a member #315711 */
-	for (i = 0; i < cman_node_count; i++) {
-		if (cman_nodes[i].cn_nodeid == 0) {
-			cman_nodes[i].cn_member = 0;
-			break;
-		}
-	}
-
-	for (i = 0; i < old_node_count; i++) {
-		if (old_nodes[i].cn_member &&
-		    !is_cluster_member(old_nodes[i].cn_nodeid)) {
-
-			log_debug("cman: node %d removed",
-				   old_nodes[i].cn_nodeid);
-
-			del_configfs_node(old_nodes[i].cn_nodeid);
-		}
-	}
-
-	for (i = 0; i < cman_node_count; i++) {
-		if (cman_nodes[i].cn_member &&
-		    !is_old_member(cman_nodes[i].cn_nodeid)) {
-
-			rv = cman_get_node_addrs(ch, cman_nodes[i].cn_nodeid,
-						 MAX_NODE_ADDRESSES,
-						 &num_addrs, addrs);
-			if (rv < 0) {
-				log_debug("cman_get_node_addrs failed, falling back to single-homed. ");
-				num_addrs = 1;
-				addrptr = &cman_nodes[i].cn_address;
-			}
-
-			log_debug("cman: node %d added",
-				  cman_nodes[i].cn_nodeid);
-
-			for (j = 0; j < num_addrs; j++) {
-				add_configfs_node(cman_nodes[i].cn_nodeid,
-						  addrptr[j].cna_address,
-						  addrptr[j].cna_addrlen,
-						  (cman_nodes[i].cn_nodeid ==
-						   our_nodeid));
-			}
-		}
-	}
-}
-
-static void cman_callback(cman_handle_t h, void *private, int reason, int arg)
-{
-	switch (reason) {
-	case CMAN_REASON_TRY_SHUTDOWN:
-		if (list_empty(&lockspaces))
-			cman_replyto_shutdown(ch, 1);
-		else {
-			log_debug("no to cman shutdown");
-			cman_replyto_shutdown(ch, 0);
-		}
-		break;
-	case CMAN_REASON_STATECHANGE:
-		statechange();
-		break;
-	case CMAN_REASON_CONFIG_UPDATE:
-		setup_logging();
-		setup_ccs();
-		break;
-	}
-}
-
-void process_cluster(int ci)
-{
-	int rv;
-
-	rv = cman_dispatch(ch, CMAN_DISPATCH_ALL);
-	if (rv == -1 && errno == EHOSTDOWN)
-		cluster_dead(0);
-}
-
-int setup_cluster(void)
-{
-	cman_node_t node;
-	int rv, fd;
-	int init = 0, active = 0;
-
- retry_init:
-	ch_admin = cman_admin_init(NULL);
-	if (!ch_admin) {
-		if (init++ < 2) {
-			sleep(1);
-			goto retry_init;
-		}
-		log_error("cman_admin_init error %d", errno);
-		return -ENOTCONN;
-	}
-
-	ch = cman_init(NULL);
-	if (!ch) {
-		log_error("cman_init error %d", errno);
-		return -ENOTCONN;
-	}
-
- retry_active:
-	rv = cman_is_active(ch);
-	if (!rv) {
-		if (active++ < 2) {
-			sleep(1);
-			goto retry_active;
-		}
-		log_error("cman_is_active error %d", errno);
-		cman_finish(ch);
-		return -ENOTCONN;
-	}
-
-	rv = cman_start_notification(ch, cman_callback);
-	if (rv < 0) {
-		log_error("cman_start_notification error %d %d", rv, errno);
-		cman_finish(ch);
-		return rv;
-	}
-
-	fd = cman_get_fd(ch);
-
-	/* FIXME: wait here for us to be a member of the cluster */
-	memset(&node, 0, sizeof(node));
-	rv = cman_get_node(ch, CMAN_NODEID_US, &node);
-	if (rv < 0) {
-		log_error("cman_get_node us error %d %d", rv, errno);
-		cman_stop_notification(ch);
-		cman_finish(ch);
-		fd = rv;
-		goto out;
-	}
-	our_nodeid = node.cn_nodeid;
-
-	old_node_count = 0;
-	memset(&old_nodes, 0, sizeof(old_nodes));
-	cman_node_count = 0;
-	memset(&cman_nodes, 0, sizeof(cman_nodes));
- out:
-	return fd;
-}
-
-void close_cluster(void)
-{
-	cman_finish(ch);
-}
-
-/* Force re-read of cman nodes */
-void update_cluster(void)
-{
-	statechange();
-}
-
-int fence_node_time(int nodeid, uint64_t *last_fenced_time)
-{
-	struct fenced_node nodeinfo;
-	int rv;
-
-	memset(&nodeinfo, 0, sizeof(nodeinfo));
-
-	rv = fenced_node_info(nodeid, &nodeinfo);
-	if (rv < 0)
-		return rv;
-
-	*last_fenced_time = nodeinfo.last_fenced_time;
-	return 0;
-}
-
-int fence_in_progress(int *count)
-{
-	struct fenced_domain domain;
-	int rv;
-
-	memset(&domain, 0, sizeof(domain));
-
-	rv = fenced_domain_info(&domain);
-	if (rv < 0)
-		return rv;
-
-	*count = domain.victim_count;
-	return 0;
-}
-
diff --git a/group/dlm_controld/netlink.c b/group/dlm_controld/netlink.c
deleted file mode 100644
index 5a7c261..0000000
--- a/group/dlm_controld/netlink.c
+++ /dev/null
@@ -1,225 +0,0 @@
-#include "dlm_daemon.h"
-#include "config.h"
-#include <linux/dlm.h>
-#include <linux/netlink.h>
-#include <linux/genetlink.h>
-#include <linux/dlm_netlink.h>
-
-#define DEADLOCK_CHECK_SECS		10
-
-/* FIXME: look into using libnl/libnetlink */
-
-#define GENLMSG_DATA(glh)       ((void *)(NLMSG_DATA(glh) + GENL_HDRLEN))
-#define GENLMSG_PAYLOAD(glh)    (NLMSG_PAYLOAD(glh, 0) - GENL_HDRLEN)
-#define NLA_DATA(na)	    	((void *)((char*)(na) + NLA_HDRLEN))
-#define NLA_PAYLOAD(len)	(len - NLA_HDRLEN)
-
-/* Maximum size of response requested or message sent */
-#define MAX_MSG_SIZE    1024
-
-struct msgtemplate {
-	struct nlmsghdr n;
-	struct genlmsghdr g;
-	char buf[MAX_MSG_SIZE];
-};
-
-static int send_genetlink_cmd(int sd, uint16_t nlmsg_type, uint32_t nlmsg_pid,
-			      uint8_t genl_cmd, uint16_t nla_type,
-			      void *nla_data, int nla_len)
-{
-	struct nlattr *na;
-	struct sockaddr_nl nladdr;
-	int r, buflen;
-	char *buf;
-
-	struct msgtemplate msg;
-
-	msg.n.nlmsg_len = NLMSG_LENGTH(GENL_HDRLEN);
-	msg.n.nlmsg_type = nlmsg_type;
-	msg.n.nlmsg_flags = NLM_F_REQUEST;
-	msg.n.nlmsg_seq = 0;
-	msg.n.nlmsg_pid = nlmsg_pid;
-	msg.g.cmd = genl_cmd;
-	msg.g.version = 0x1;
-	na = (struct nlattr *) GENLMSG_DATA(&msg);
-	na->nla_type = nla_type;
-	na->nla_len = nla_len + 1 + NLA_HDRLEN;
-	if (nla_data)
-		memcpy(NLA_DATA(na), nla_data, nla_len);
-	msg.n.nlmsg_len += NLMSG_ALIGN(na->nla_len);
-
-	buf = (char *) &msg;
-	buflen = msg.n.nlmsg_len ;
-	memset(&nladdr, 0, sizeof(nladdr));
-	nladdr.nl_family = AF_NETLINK;
-	while ((r = sendto(sd, buf, buflen, 0, (struct sockaddr *) &nladdr,
-			   sizeof(nladdr))) < buflen) {
-		if (r > 0) {
-			buf += r;
-			buflen -= r;
-		} else if (errno != EAGAIN)
-			return -1;
-	}
-	return 0;
-}
-
-/*
- * Probe the controller in genetlink to find the family id
- * for the DLM family
- */
-static int get_family_id(int sd)
-{
-	char genl_name[100];
-	struct {
-		struct nlmsghdr n;
-		struct genlmsghdr g;
-		char buf[256];
-	} ans;
-
-	int id = 0, rc;
-	struct nlattr *na;
-	int rep_len;
-
-	strcpy(genl_name, DLM_GENL_NAME);
-	rc = send_genetlink_cmd(sd, GENL_ID_CTRL, getpid(), CTRL_CMD_GETFAMILY,
-				CTRL_ATTR_FAMILY_NAME, (void *)genl_name,
-				strlen(DLM_GENL_NAME)+1);
-
-	rep_len = recv(sd, &ans, sizeof(ans), 0);
-	if (ans.n.nlmsg_type == NLMSG_ERROR ||
-	    (rep_len < 0) || !NLMSG_OK((&ans.n), rep_len))
-		return 0;
-
-	na = (struct nlattr *) GENLMSG_DATA(&ans);
-	na = (struct nlattr *) ((char *) na + NLA_ALIGN(na->nla_len));
-	if (na->nla_type == CTRL_ATTR_FAMILY_ID) {
-		id = *(uint16_t *) NLA_DATA(na);
-	}
-	return id;
-}
-
-/* genetlink messages are timewarnings used as part of deadlock detection */
-
-int setup_netlink(void)
-{
-	struct sockaddr_nl snl;
-	int s, rv;
-	uint16_t id;
-
-	s = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC);
-	if (s < 0) {
-		log_error("generic netlink socket");
-		return s;
-	}
-
-	memset(&snl, 0, sizeof(snl));
-	snl.nl_family = AF_NETLINK;
-
-	rv = bind(s, (struct sockaddr *) &snl, sizeof(snl));
-	if (rv < 0) {
-		log_error("gen netlink bind error %d errno %d", rv, errno);
-		close(s);
-		return rv;
-	}
-
-	id = get_family_id(s);
-	if (!id) {
-		log_error("Error getting family id, errno %d", errno);
-		close(s);
-		return -1;
-	}
-
-	rv = send_genetlink_cmd(s, id, getpid(), DLM_CMD_HELLO, 0, NULL, 0);
-	if (rv < 0) {
-		log_error("error sending hello cmd, errno %d", errno);
-		close(s);
-		return -1;
-	}
-
-	return s;
-}
-
-static void process_timewarn(struct dlm_lock_data *data)
-{
-	struct lockspace *ls;
-	struct timeval now;
-	unsigned int sec;
-
-	ls = find_ls_id(data->lockspace_id);
-	if (!ls)
-		return;
-
-	data->resource_name[data->resource_namelen] = '\0';
-
-	log_group(ls, "timewarn: lkid %x pid %d name %s",
-		  data->id, data->ownpid, data->resource_name);
-
-	/* Problem: we don't want to get a timewarn, assume it's resolved
-	   by the current cycle, but in fact it's from a deadlock that
-	   formed after the checkpoints for the current cycle.  Then we'd
-	   have to hope for another warning (that may not come) to trigger
-	   a new cycle to catch the deadlock.  If our last cycle ckpt
-	   was say N (~5?) sec before we receive the timewarn, then we
-	   can be confident that the cycle included the lock in question.
-	   Otherwise, we're not sure if the warning is for a new deadlock
-	   that's formed since our last cycle ckpt (unless it's a long
-	   enough time since the last cycle that we're confident it *is*
-	   a new deadlock).  When there is a deadlock, I suspect it will
-	   be common to receive warnings before, during, and possibly
-	   after the cycle that resolves it.  Wonder if we should record
-	   timewarns and match them with deadlock cycles so we can tell
-	   which timewarns are addressed by a given cycle and which aren't.  */
-
-
-	gettimeofday(&now, NULL);
-
-	/* don't send a new start until at least SECS after the last
-	   we sent, and at least SECS after the last completed cycle */
-
-	sec = now.tv_sec - ls->last_send_cycle_start.tv_sec;
-
-	if (sec < DEADLOCK_CHECK_SECS) {
-		log_group(ls, "skip send: recent send cycle %d sec", sec);
-		return;
-	}
-
-	sec = now.tv_sec - ls->cycle_end_time.tv_sec;
-
-	if (sec < DEADLOCK_CHECK_SECS) {
-		log_group(ls, "skip send: recent cycle end %d sec", sec);
-		return;
-	}
-
-	gettimeofday(&ls->last_send_cycle_start, NULL);
-
-	if (cfgd_enable_deadlk)
-		send_cycle_start(ls);
-}
-
-void process_netlink(int ci)
-{
-	struct msgtemplate msg;
-	struct nlattr *na;
-	int len;
-	int fd;
-
-	fd = client_fd(ci);
-
-	len = recv(fd, &msg, sizeof(msg), 0);
-
-	if (len < 0) {
-		log_error("nonfatal netlink error: errno %d", errno);
-		return;
-	}
-
-	if (msg.n.nlmsg_type == NLMSG_ERROR || !NLMSG_OK((&msg.n), len)) {
-		struct nlmsgerr *err = NLMSG_DATA(&msg);
-		log_error("fatal netlink error: errno %d", err->error);
-		return;
-	}
-
-	na = (struct nlattr *) GENLMSG_DATA(&msg);
-
-	process_timewarn((struct dlm_lock_data *) NLA_DATA(na));
-}
-
diff --git a/group/dlm_controld/pacemaker.c b/group/dlm_controld/pacemaker.c
deleted file mode 100644
index fed9ca7..0000000
--- a/group/dlm_controld/pacemaker.c
+++ /dev/null
@@ -1,409 +0,0 @@
-#include <syslog.h>
-
-#include "config.h"
-#include "dlm_daemon.h"
-
-#include <glib.h>
-#include <bzlib.h>
-#include <heartbeat/ha_msg.h>
-
-#include <pacemaker/crm_config.h>
-
-#include <pacemaker/crm/crm.h>
-#include <pacemaker/crm/ais.h>
-/* heartbeat support is irrelevant here */
-#undef SUPPORT_HEARTBEAT 
-#define SUPPORT_HEARTBEAT 0
-#include <pacemaker/crm/common/cluster.h>
-
-#define COMMS_DIR     "/sys/kernel/config/dlm/cluster/comms"
-
-int setup_ccs(void)
-{
-    /* To avoid creating an additional place for the dlm to be configured,
-     * only allow configuration from the command-line until CoroSync is stable
-     * enough to be used with Pacemaker
-     */
-    cfgd_groupd_compat = 0; /* always use libcpg and disable backward compatability */
-    return 0;
-}
-
-void close_ccs(void) { return; }
-int get_weight(int nodeid, char *lockspace) { return 1; }
-
-/* TODO: Make this configurable
- * Can't use logging.c as-is as whitetank exposes a different logging API
- */
-void init_logging(void) {
-    openlog("cluster-dlm", LOG_PERROR|LOG_PID|LOG_CONS|LOG_NDELAY, LOG_DAEMON);
-    /* cl_log_enable_stderr(TRUE); */
-}
-
-void setup_logging(void) { return; }
-void close_logging(void) {
-    closelog();
-}
-
-extern int ais_fd_async;
-
-int local_node_id = 0;
-char *local_node_uname = NULL;
-void dlm_process_node(gpointer key, gpointer value, gpointer user_data);
-
-int setup_cluster(void)
-{
-    int retries = 0;
-    int rc = SA_AIS_OK;
-    struct utsname name;
-
-    crm_peer_init();
-
-    if(local_node_uname == NULL) {
-	if(uname(&name) < 0) {
-	    cl_perror("uname(2) call failed");
-	    exit(100);
-	}
-	local_node_uname = crm_strdup(name.nodename);
-	log_debug("Local node name: %s", local_node_uname);
-    }
-    
-    /* 16 := CRM_SERVICE */
-  retry:
-    log_debug("Creating connection to our AIS plugin");
-    rc = saServiceConnect (&ais_fd_sync, &ais_fd_async, CRM_SERVICE);
-    if (rc != SA_AIS_OK) {
-	log_error("Connection to our AIS plugin (%d) failed: %s (%d)", CRM_SERVICE, ais_error2text(rc), rc);
-    }
-
-    switch(rc) {
-	case SA_AIS_OK:
-	    break;
-	case SA_AIS_ERR_TRY_AGAIN:
-	    if(retries < 30) {
-		sleep(1);
-		retries++;
-		goto retry;
-	    }
-	    log_error("Retry count exceeded");
-	    return 0;
-	default:
-	    return 0;
-    }
-
-    log_debug("AIS connection established");
-
-    {
-	int pid = getpid();
-	char *pid_s = crm_itoa(pid);
-	send_ais_text(0, pid_s, TRUE, NULL, crm_msg_ais);
-	crm_free(pid_s);
-    }
-
-    /* Sign up for membership updates */
-    send_ais_text(crm_class_notify, "true", TRUE, NULL, crm_msg_ais);
-    
-    /* Requesting the current list of known nodes */
-    send_ais_text(crm_class_members, __FUNCTION__, TRUE, NULL, crm_msg_ais);
-
-    our_nodeid = get_ais_nodeid();
-    log_debug("Local node id: %d", our_nodeid);
-
-    return ais_fd_async;
-}
-
-static void statechange(void)
-{
-    static uint64_t last_membership = 0;
-    cluster_quorate = crm_have_quorum;
-    if(last_membership < crm_peer_seq) {
-	log_debug("Processing membership %llu", crm_peer_seq);
-	g_hash_table_foreach(crm_peer_cache, dlm_process_node, &last_membership);
-	last_membership = crm_peer_seq;
-    }
-}
-
-void update_cluster(void)
-{
-    statechange();
-}
-
-void process_cluster(int ci)
-{
-/* ci ::= client number */    
-    char *data = NULL;
-    char *uncompressed = NULL;
-
-    AIS_Message *msg = NULL;
-    SaAisErrorT rc = SA_AIS_OK;
-    mar_res_header_t *header = NULL;
-    static int header_len = sizeof(mar_res_header_t);
-
-    header = malloc(header_len);
-    memset(header, 0, header_len);
-    
-    errno = 0;
-    rc = saRecvRetry(ais_fd_async, header, header_len);
-    if (rc != SA_AIS_OK) {
-	cl_perror("Receiving message header failed: (%d) %s", rc, ais_error2text(rc));
-	goto bail;
-
-    } else if(header->size == header_len) {
-	log_error("Empty message: id=%d, size=%d, error=%d, header_len=%d",
-		  header->id, header->size, header->error, header_len);
-	goto done;
-	
-    } else if(header->size == 0 || header->size < header_len) {
-	log_error("Mangled header: size=%d, header=%d, error=%d",
-		  header->size, header_len, header->error);
-	goto done;
-	
-    } else if(header->error != 0) {
-	log_error("Header contined error: %d", header->error);
-    }
-    
-    header = realloc(header, header->size);
-    /* Use a char* so we can store the remainder into an offset */
-    data = (char*)header;
-
-    errno = 0;
-    rc = saRecvRetry(ais_fd_async, data+header_len, header->size - header_len);
-    msg = (AIS_Message*)data;
-
-    if (rc != SA_AIS_OK) {
-	cl_perror("Receiving message body failed: (%d) %s", rc, ais_error2text(rc));
-	goto bail;
-    }
-    
-    data = msg->data;
-    if(msg->is_compressed && msg->size > 0) {
-	int rc = BZ_OK;
-	unsigned int new_size = msg->size;
-
-	if(check_message_sanity(msg, NULL) == FALSE) {
-	    goto badmsg;
-	}
-
-	log_debug("Decompressing message data");
-	uncompressed = malloc(new_size);
-	memset(uncompressed, 0, new_size);
-	
-	rc = BZ2_bzBuffToBuffDecompress(
-	    uncompressed, &new_size, data, msg->compressed_size, 1, 0);
-
-	if(rc != BZ_OK) {
-	    log_error("Decompression failed: %d", rc);
-	    goto badmsg;
-	}
-	
-	CRM_ASSERT(rc == BZ_OK);
-	CRM_ASSERT(new_size == msg->size);
-
-	data = uncompressed;
-
-    } else if(check_message_sanity(msg, data) == FALSE) {
-	goto badmsg;
-
-    } else if(safe_str_eq("identify", data)) {
-	int pid = getpid();
-	char *pid_s = crm_itoa(pid);
-	send_ais_text(0, pid_s, TRUE, NULL, crm_msg_ais);
-	crm_free(pid_s);
-	goto done;
-    }
-
-    if(msg->header.id == crm_class_members) {
-	xmlNode *xml = string2xml(data);
-
-	if(xml != NULL) {
-	    const char *value = crm_element_value(xml, "id");
-	    if(value) {
-		crm_peer_seq = crm_int_helper(value, NULL);
-	    }
-
-	    log_debug("Updating membership %llu", crm_peer_seq);
-	    /* crm_log_xml_info(xml, __PRETTY_FUNCTION__); */
-	    xml_child_iter(xml, node, crm_update_ais_node(node, crm_peer_seq));
-	    crm_calculate_quorum();
-	    statechange();
-	    free_xml(xml);
-	    
-	} else {
-	    log_error("Invalid peer update: %s", data);
-	}
-
-    } else {
-	log_error("Unexpected AIS message type: %d", msg->header.id);
-    }
-
-  done:
-    free(uncompressed);
-    free(msg);
-    return;
-
-  badmsg:
-    log_error("Invalid message (id=%d, dest=%s:%s, from=%s:%s.%d):"
-	      " min=%d, total=%d, size=%d, bz2_size=%d",
-	      msg->id, ais_dest(&(msg->host)), msg_type2text(msg->host.type),
-	      ais_dest(&(msg->sender)), msg_type2text(msg->sender.type),
-	      msg->sender.pid, (int)sizeof(AIS_Message),
-	      msg->header.size, msg->size, msg->compressed_size);
-    goto done;
-    
-  bail:
-    log_error("AIS connection failed");
-    return;
-}
-
-void close_cluster(void) {
-    /* TODO: Implement something for this */
-    return;
-}
-
-#include <arpa/inet.h>
-#include <corosync/totem/totemip.h>
-
-void dlm_process_node(gpointer key, gpointer value, gpointer user_data)
-{
-    int rc = 0;
-    struct stat tmp;
-    char path[PATH_MAX];
-    crm_node_t *node = value;
-    uint64_t *last = user_data;
-    const char *action = "Skipped";
-
-    gboolean do_add = FALSE;
-    gboolean do_remove = FALSE;
-    gboolean is_active = FALSE;
-
-    memset(path, 0, PATH_MAX);
-    snprintf(path, PATH_MAX, "%s/%d", COMMS_DIR, node->id);
-
-    rc = stat(path, &tmp);
-    is_active = crm_is_member_active(node);
-    
-    if(rc == 0 && is_active) {
-	/* nothing to do?
-	 * maybe the node left and came back...
-	 */
-    } else if(rc == 0) {
-	do_remove = TRUE;
-
-    } else if(is_active) {
-	do_add = TRUE;
-    }
-
-    if(do_remove) {
-	action = "Removed";
-	del_configfs_node(node->id);
-    }
-
-    if(do_add) {
-	char *addr_copy = strdup(node->addr);
-	char *addr_top = addr_copy;
-	char *addr = NULL;
-	
-	if(do_remove) {
-	    action = "Re-added";
-	} else {
-	    action = "Added";
-	}
-	
-	if(local_node_id == 0) {
-	    crm_node_t *local_node = g_hash_table_lookup(
-		crm_peer_cache, local_node_uname);
-	    local_node_id = local_node->id;
-	}
-	
-	do {
-	    char ipaddr[1024];
-	    int addr_family = AF_INET;
-	    int cna_len = 0, rc = 0;
-	    struct sockaddr_storage cna_addr;
-	    struct totem_ip_address totem_addr;
-	    
-	    addr = strsep(&addr_copy, " ");
-	    if(addr == NULL) {
-		break;
-	    }
-	    
-	    /* do_cmd_get_node_addrs */
-	    if(strstr(addr, "ip(") == NULL) {
-		continue;
-		
-	    } else if(strchr(addr, ':')) {
-		rc = sscanf(addr, "ip(%[0-9A-Fa-f:])", ipaddr);
-		if(rc != 1) {
-		    log_error("Could not extract IPv6 address from '%s'", addr);
-		    continue;			
-		}
-		addr_family = AF_INET6;
-		    
-	    } else {
-		rc = sscanf(addr, "ip(%[0-9.]) ", ipaddr);
-		if(rc != 1) {
-		    log_error("Could not extract IPv4 address from '%s'", addr);
-		    continue;			
-		}
-	    }
-		
-	    rc = inet_pton(addr_family, ipaddr, &totem_addr);
-	    if(rc != 1) {
-		log_error("Could not parse '%s' as in IPv%c address", ipaddr, (addr_family==AF_INET)?'4':'6');
-		continue;
-	    }
-
-	    rc = totemip_parse(&totem_addr, ipaddr, addr_family);
-	    if(rc != 0) {
-		log_error("Could not convert '%s' into a totem address", ipaddr);
-		continue;
-	    }
-
-	    rc = totemip_totemip_to_sockaddr_convert(&totem_addr, 0, &cna_addr, &cna_len);
-	    if(rc != 0) {
-		log_error("Could not convert totem address for '%s' into sockaddr", ipaddr);
-		continue;
-	    }
-
-	    log_debug("Adding address %s to configfs for node %u/%s ", addr, node->id, node->uname);
-	    add_configfs_node(node->id, ((char*)&cna_addr), cna_len, (node->id == local_node_id));
-
-	} while(addr != NULL);
-	free(addr_top);
-    }
-
-    log_debug("%s %sctive node %u '%s': born-on=%llu, last-seen=%llu, this-event=%llu, last-event=%llu",
-	      action, crm_is_member_active(value)?"a":"ina",
-	      node->id, node->uname, node->born, node->last_seen,
-	      crm_peer_seq, (unsigned long long)*last);
-}
-
-int is_cluster_member(int nodeid)
-{
-    crm_node_t *node = crm_get_peer(nodeid, NULL);
-    return crm_is_member_active(node);
-}
-
-char *nodeid2name(int nodeid) {
-    crm_node_t *node = crm_get_peer(nodeid, NULL);
-    if(node->uname == NULL) {
-	return NULL;
-    }
-    return strdup(node->uname);
-}
-
-void kick_node_from_cluster(int nodeid)
-{
-    log_error("%s not yet implemented", __FUNCTION__);
-    return;
-}
-
-int fence_node_time(int nodeid, uint64_t *last_fenced_time)
-{
-	return 0;
-}
-
-int fence_in_progress(int *count)
-{
-	return 0;
-}
-
diff --git a/group/dlm_controld/plock.c b/group/dlm_controld/plock.c
deleted file mode 100644
index 9a8215b..0000000
--- a/group/dlm_controld/plock.c
+++ /dev/null
@@ -1,2193 +0,0 @@
-#include "dlm_daemon.h"
-#include "config.h"
-
-#include <linux/dlm_plock.h>
-
-static uint32_t plock_read_count;
-static uint32_t plock_recv_count;
-static uint32_t plock_rate_delays;
-static struct timeval plock_read_time;
-static struct timeval plock_recv_time;
-static struct timeval plock_rate_last;
-
-static int plock_device_fd = -1;
-static SaCkptHandleT system_ckpt_handle;
-static SaCkptCallbacksT callbacks = { 0, 0 };
-static SaVersionT version = { 'B', 1, 1 };
-static char section_buf[1024 * 1024];
-static uint32_t section_len;
-static int need_fsid_translation = 0;
-
-extern int message_flow_control_on;
-
-struct pack_plock {
-	uint64_t start;
-	uint64_t end;
-	uint64_t owner;
-	uint32_t pid;
-	uint32_t nodeid;
-	uint8_t ex;
-	uint8_t waiter;
-	uint16_t pad1;
-	uint32_t pad;
-};
-
-#define R_GOT_UNOWN 0x00000001 /* have received owner=0 message */
-
-struct resource {
-	struct list_head	list;	   /* list of resources */
-	uint64_t		number;
-	int                     owner;     /* nodeid or 0 for unowned */
-	uint32_t		flags;
-	struct timeval          last_access;
-	struct list_head	locks;	   /* one lock for each range */
-	struct list_head	waiters;
-	struct list_head        pending;   /* discovering r owner */
-};
-
-#define P_SYNCING 0x00000001 /* plock has been sent as part of sync but not
-				yet received */
-
-struct posix_lock {
-	struct list_head	list;	   /* resource locks or waiters list */
-	uint32_t		pid;
-	uint64_t		owner;
-	uint64_t		start;
-	uint64_t		end;
-	int			ex;
-	int			nodeid;
-	uint32_t		flags;
-};
-
-struct lock_waiter {
-	struct list_head	list;
-	uint32_t		flags;
-	struct dlm_plock_info	info;
-};
-
-struct save_msg {
-	struct list_head list;
-	int nodeid;
-	int len;
-	int type;
-	char buf[0];
-};
-
-
-static void send_own(struct lockspace *ls, struct resource *r, int owner);
-static void save_pending_plock(struct lockspace *ls, struct resource *r,
-			       struct dlm_plock_info *in);
-
-
-static int got_unown(struct resource *r)
-{
-	return !!(r->flags & R_GOT_UNOWN);
-}
-
-static void info_bswap_out(struct dlm_plock_info *i)
-{
-	i->version[0]	= cpu_to_le32(i->version[0]);
-	i->version[1]	= cpu_to_le32(i->version[1]);
-	i->version[2]	= cpu_to_le32(i->version[2]);
-	i->pid		= cpu_to_le32(i->pid);
-	i->nodeid	= cpu_to_le32(i->nodeid);
-	i->rv		= cpu_to_le32(i->rv);
-	i->fsid		= cpu_to_le32(i->fsid);
-	i->number	= cpu_to_le64(i->number);
-	i->start	= cpu_to_le64(i->start);
-	i->end		= cpu_to_le64(i->end);
-	i->owner	= cpu_to_le64(i->owner);
-}
-
-static void info_bswap_in(struct dlm_plock_info *i)
-{
-	i->version[0]	= le32_to_cpu(i->version[0]);
-	i->version[1]	= le32_to_cpu(i->version[1]);
-	i->version[2]	= le32_to_cpu(i->version[2]);
-	i->pid		= le32_to_cpu(i->pid);
-	i->nodeid	= le32_to_cpu(i->nodeid);
-	i->rv		= le32_to_cpu(i->rv);
-	i->fsid		= le32_to_cpu(i->fsid);
-	i->number	= le64_to_cpu(i->number);
-	i->start	= le64_to_cpu(i->start);
-	i->end		= le64_to_cpu(i->end);
-	i->owner	= le64_to_cpu(i->owner);
-}
-
-static char *op_str(int optype)
-{
-	switch (optype) {
-	case DLM_PLOCK_OP_LOCK:
-		return "LK";
-	case DLM_PLOCK_OP_UNLOCK:
-		return "UN";
-	case DLM_PLOCK_OP_GET:
-		return "GET";
-	default:
-		return "??";
-	}
-}
-
-static char *ex_str(int optype, int ex)
-{
-	if (optype == DLM_PLOCK_OP_UNLOCK || optype == DLM_PLOCK_OP_GET)
-		return "-";
-	if (ex)
-		return "WR";
-	else
-		return "RD";
-}
-
-/*
- * In kernels before 2.6.26, plocks came from gfs2's lock_dlm module.
- * Reading plocks from there as well should allow us to use cluster3
- * on old (RHEL5) kernels.  In this case, the fsid we read in plock_info
- * structs is the mountgroup id, which we need to translate to the ls id.
- */
-
-int setup_plocks(void)
-{
-	SaAisErrorT err;
-
-	plock_read_count = 0;
-	plock_recv_count = 0;
-	plock_rate_delays = 0;
-	gettimeofday(&plock_read_time, NULL);
-	gettimeofday(&plock_recv_time, NULL);
-	gettimeofday(&plock_rate_last, NULL);
-
-	err = saCkptInitialize(&system_ckpt_handle, &callbacks, &version);
-	if (err != SA_AIS_OK) {
-		log_error("ckpt init error %d", err);
-		cfgd_enable_plock = 0;
-
-		/* still try to open and read the control device so that we can
-		   send ENOSYS back to the kernel if it tries to do a plock */
-	}
-
-	if (plock_minor) {
-		plock_device_fd = open("/dev/misc/dlm_plock", O_RDWR);
-	} else if (old_plock_minor) {
-		log_debug("setup_plocks using old lock_dlm interface");
-		need_fsid_translation = 1;
-		plock_device_fd = open("/dev/misc/lock_dlm_plock", O_RDWR);
-	}
-
-	if (plock_device_fd < 0) {
-		log_error("Failure to open plock device: %s", strerror(errno));
-		return -1;
-	}
-
-	log_debug("plocks %d", plock_device_fd);
-	log_debug("plock cpg message size: %u bytes",
-		  (unsigned int) (sizeof(struct dlm_header) +
-		                  sizeof(struct dlm_plock_info)));
-
-	return plock_device_fd;
-}
-
-static uint32_t mg_to_ls_id(uint32_t fsid)
-{
-	struct lockspace *ls;
-	int do_set = 1;
-
- retry:
-	list_for_each_entry(ls, &lockspaces, list) {
-		if (ls->associated_mg_id == fsid)
-			return ls->global_id;
-	}
-
-	if (do_set) {
-		do_set = 0;
-		set_associated_id(fsid);
-		goto retry;
-	}
-
-	return fsid;
-}
-
-/* FIXME: unify these two */
-
-static unsigned long time_diff_ms(struct timeval *begin, struct timeval *end)
-{
-	struct timeval result;
-	timersub(end, begin, &result);
-	return (result.tv_sec * 1000) + (result.tv_usec / 1000);
-}
-
-static uint64_t dt_usec(struct timeval *start, struct timeval *stop)
-{
-	uint64_t dt;
-
-	dt = stop->tv_sec - start->tv_sec;
-	dt *= 1000000;
-	dt += stop->tv_usec - start->tv_usec;
-	return dt;
-}
-
-static struct resource *search_resource(struct lockspace *ls, uint64_t number)
-{
-	struct resource *r;
-
-	list_for_each_entry(r, &ls->plock_resources, list) {
-		if (r->number == number)
-			return r;
-	}
-	return NULL;
-}
-
-static int find_resource(struct lockspace *ls, uint64_t number, int create,
-			 struct resource **r_out)
-{
-	struct resource *r = NULL;
-	int rv = 0;
-
-	r = search_resource(ls, number);
-	if (r)
-		goto out;
-
-	if (create == 0) {
-		rv = -ENOENT;
-		goto out;
-	}
-
-	r = malloc(sizeof(struct resource));
-	if (!r) {
-		log_error("find_resource no memory %d", errno);
-		rv = -ENOMEM;
-		goto out;
-	}
-
-	memset(r, 0, sizeof(struct resource));
-	r->number = number;
-	INIT_LIST_HEAD(&r->locks);
-	INIT_LIST_HEAD(&r->waiters);
-	INIT_LIST_HEAD(&r->pending);
-
-	if (cfgd_plock_ownership)
-		r->owner = -1;
-	else
-		r->owner = 0;
-
-	list_add_tail(&r->list, &ls->plock_resources);
- out:
-	if (r)
-		gettimeofday(&r->last_access, NULL);
-	*r_out = r;
-	return rv;
-}
-
-static void put_resource(struct resource *r)
-{
-	/* with ownership, resources are only freed via drop messages */
-	if (cfgd_plock_ownership)
-		return;
-
-	if (list_empty(&r->locks) && list_empty(&r->waiters)) {
-		list_del(&r->list);
-		free(r);
-	}
-}
-
-static inline int ranges_overlap(uint64_t start1, uint64_t end1,
-				 uint64_t start2, uint64_t end2)
-{
-	if (end1 < start2 || start1 > end2)
-		return 0;
-	return 1;
-}
-
-/**
- * overlap_type - returns a value based on the type of overlap
- * @s1 - start of new lock range
- * @e1 - end of new lock range
- * @s2 - start of existing lock range
- * @e2 - end of existing lock range
- *
- */
-
-static int overlap_type(uint64_t s1, uint64_t e1, uint64_t s2, uint64_t e2)
-{
-	int ret;
-
-	/*
-	 * ---r1---
-	 * ---r2---
-	 */
-
-	if (s1 == s2 && e1 == e2)
-		ret = 0;
-
-	/*
-	 * --r1--
-	 * ---r2---
-	 */
-
-	else if (s1 == s2 && e1 < e2)
-		ret = 1;
-
-	/*
-	 *   --r1--
-	 * ---r2---
-	 */
-
-	else if (s1 > s2 && e1 == e2)
-		ret = 1;
-
-	/*
-	 *  --r1--
-	 * ---r2---
-	 */
-
-	else if (s1 > s2 && e1 < e2)
-		ret = 2;
-
-	/*
-	 * ---r1---  or  ---r1---  or  ---r1---
-	 * --r2--	  --r2--       --r2--
-	 */
-
-	else if (s1 <= s2 && e1 >= e2)
-		ret = 3;
-
-	/*
-	 *   ---r1---
-	 * ---r2---
-	 */
-
-	else if (s1 > s2 && e1 > e2)
-		ret = 4;
-
-	/*
-	 * ---r1---
-	 *   ---r2---
-	 */
-
-	else if (s1 < s2 && e1 < e2)
-		ret = 4;
-
-	else
-		ret = -1;
-
-	return ret;
-}
-
-/* shrink the range start2:end2 by the partially overlapping start:end */
-
-static int shrink_range2(uint64_t *start2, uint64_t *end2,
-			 uint64_t start, uint64_t end)
-{
-	int error = 0;
-
-	if (*start2 < start)
-		*end2 = start - 1;
-	else if (*end2 > end)
-		*start2 =  end + 1;
-	else
-		error = -1;
-	return error;
-}
-
-static int shrink_range(struct posix_lock *po, uint64_t start, uint64_t end)
-{
-	return shrink_range2(&po->start, &po->end, start, end);
-}
-
-static int is_conflict(struct resource *r, struct dlm_plock_info *in, int get)
-{
-	struct posix_lock *po;
-
-	list_for_each_entry(po, &r->locks, list) {
-		if (po->nodeid == in->nodeid && po->owner == in->owner)
-			continue;
-		if (!ranges_overlap(po->start, po->end, in->start, in->end))
-			continue;
-
-		if (in->ex || po->ex) {
-			if (get) {
-				in->ex = po->ex;
-				in->pid = po->pid;
-				in->start = po->start;
-				in->end = po->end;
-			}
-			return 1;
-		}
-	}
-	return 0;
-}
-
-static int add_lock(struct resource *r, uint32_t nodeid, uint64_t owner,
-		    uint32_t pid, int ex, uint64_t start, uint64_t end)
-{
-	struct posix_lock *po;
-
-	po = malloc(sizeof(struct posix_lock));
-	if (!po)
-		return -ENOMEM;
-	memset(po, 0, sizeof(struct posix_lock));
-
-	po->start = start;
-	po->end = end;
-	po->nodeid = nodeid;
-	po->owner = owner;
-	po->pid = pid;
-	po->ex = ex;
-	list_add_tail(&po->list, &r->locks);
-
-	return 0;
-}
-
-/* RN within RE (and starts or ends on RE boundary)
-   1. add new lock for non-overlap area of RE, orig mode
-   2. convert RE to RN range and mode */
-
-static int lock_case1(struct posix_lock *po, struct resource *r,
-		      struct dlm_plock_info *in)
-{
-	uint64_t start2, end2;
-	int rv;
-
-	/* non-overlapping area start2:end2 */
-	start2 = po->start;
-	end2 = po->end;
-	rv = shrink_range2(&start2, &end2, in->start, in->end);
-	if (rv)
-		goto out;
-
-	po->start = in->start;
-	po->end = in->end;
-	po->ex = in->ex;
-
-	rv = add_lock(r, in->nodeid, in->owner, in->pid, !in->ex, start2, end2);
- out:
-	return rv;
-}
-
-/* RN within RE (RE overlaps RN on both sides)
-   1. add new lock for front fragment, orig mode
-   2. add new lock for back fragment, orig mode
-   3. convert RE to RN range and mode */
-			 
-static int lock_case2(struct posix_lock *po, struct resource *r,
-		      struct dlm_plock_info *in)
-
-{
-	int rv;
-
-	rv = add_lock(r, in->nodeid, in->owner, in->pid,
-		      !in->ex, po->start, in->start - 1);
-	if (rv)
-		goto out;
-
-	rv = add_lock(r, in->nodeid, in->owner, in->pid,
-		      !in->ex, in->end + 1, po->end);
-	if (rv)
-		goto out;
-
-	po->start = in->start;
-	po->end = in->end;
-	po->ex = in->ex;
- out:
-	return rv;
-}
-
-static int lock_internal(struct lockspace *ls, struct resource *r,
-			 struct dlm_plock_info *in)
-{
-	struct posix_lock *po, *safe;
-	int rv = 0;
-
-	list_for_each_entry_safe(po, safe, &r->locks, list) {
-		if (po->nodeid != in->nodeid || po->owner != in->owner)
-			continue;
-		if (!ranges_overlap(po->start, po->end, in->start, in->end))
-			continue;
-
-		/* existing range (RE) overlaps new range (RN) */
-
-		switch(overlap_type(in->start, in->end, po->start, po->end)) {
-
-		case 0:
-			if (po->ex == in->ex)
-				goto out;
-
-			/* ranges the same - just update the existing lock */
-			po->ex = in->ex;
-			goto out;
-
-		case 1:
-			if (po->ex == in->ex)
-				goto out;
-
-			rv = lock_case1(po, r, in);
-			goto out;
-
-		case 2:
-			if (po->ex == in->ex)
-				goto out;
-
-			rv = lock_case2(po, r, in);
-			goto out;
-
-		case 3:
-			list_del(&po->list);
-			free(po);
-			break;
-
-		case 4:
-			if (po->start < in->start)
-				po->end = in->start - 1;
-			else
-				po->start = in->end + 1;
-			break;
-
-		default:
-			rv = -1;
-			goto out;
-		}
-	}
-
-	rv = add_lock(r, in->nodeid, in->owner, in->pid,
-		      in->ex, in->start, in->end);
- out:
-	return rv;
-
-}
-
-static int unlock_internal(struct lockspace *ls, struct resource *r,
-			   struct dlm_plock_info *in)
-{
-	struct posix_lock *po, *safe;
-	int rv = 0;
-
-	list_for_each_entry_safe(po, safe, &r->locks, list) {
-		if (po->nodeid != in->nodeid || po->owner != in->owner)
-			continue;
-		if (!ranges_overlap(po->start, po->end, in->start, in->end))
-			continue;
-
-		/* existing range (RE) overlaps new range (RN) */
-
-		switch (overlap_type(in->start, in->end, po->start, po->end)) {
-
-		case 0:
-			/* ranges the same - just remove the existing lock */
-
-			list_del(&po->list);
-			free(po);
-			goto out;
-
-		case 1:
-			/* RN within RE and starts or ends on RE boundary -
-			 * shrink and update RE */
-
-			rv = shrink_range(po, in->start, in->end);
-			goto out;
-
-		case 2:
-			/* RN within RE - shrink and update RE to be front
-			 * fragment, and add a new lock for back fragment */
-
-			rv = add_lock(r, in->nodeid, in->owner, in->pid,
-				      po->ex, in->end + 1, po->end);
-			po->end = in->start - 1;
-			goto out;
-
-		case 3:
-			/* RE within RN - remove RE, then continue checking
-			 * because RN could cover other locks */
-
-			list_del(&po->list);
-			free(po);
-			continue;
-
-		case 4:
-			/* front of RE in RN, or end of RE in RN - shrink and
-			 * update RE, then continue because RN could cover
-			 * other locks */
-
-			rv = shrink_range(po, in->start, in->end);
-			continue;
-
-		default:
-			rv = -1;
-			goto out;
-		}
-	}
- out:
-	return rv;
-}
-
-static int add_waiter(struct lockspace *ls, struct resource *r,
-		      struct dlm_plock_info *in)
-
-{
-	struct lock_waiter *w;
-
-	w = malloc(sizeof(struct lock_waiter));
-	if (!w)
-		return -ENOMEM;
-	memcpy(&w->info, in, sizeof(struct dlm_plock_info));
-	list_add_tail(&w->list, &r->waiters);
-	return 0;
-}
-
-static void write_result(struct lockspace *ls, struct dlm_plock_info *in,
-			 int rv)
-{
-	if (need_fsid_translation)
-		in->fsid = ls->associated_mg_id;
-
-	in->rv = rv;
-	write(plock_device_fd, in, sizeof(struct dlm_plock_info));
-}
-
-static void do_waiters(struct lockspace *ls, struct resource *r)
-{
-	struct lock_waiter *w, *safe;
-	struct dlm_plock_info *in;
-	int rv;
-
-	list_for_each_entry_safe(w, safe, &r->waiters, list) {
-		in = &w->info;
-
-		if (is_conflict(r, in, 0))
-			continue;
-
-		list_del(&w->list);
-
-		/*
-		log_group(ls, "take waiter %llx %llx-%llx %d/%u/%llx",
-			  in->number, in->start, in->end,
-			  in->nodeid, in->pid, in->owner);
-		*/
-
-		rv = lock_internal(ls, r, in);
-
-		if (in->nodeid == our_nodeid)
-			write_result(ls, in, rv);
-
-		free(w);
-	}
-}
-
-static void do_lock(struct lockspace *ls, struct dlm_plock_info *in,
-		    struct resource *r)
-{
-	int rv;
-
-	if (is_conflict(r, in, 0)) {
-		if (!in->wait)
-			rv = -EAGAIN;
-		else {
-			rv = add_waiter(ls, r, in);
-			if (rv)
-				goto out;
-			rv = -EINPROGRESS;
-		}
-	} else
-		rv = lock_internal(ls, r, in);
-
- out:
-	if (in->nodeid == our_nodeid && rv != -EINPROGRESS)
-		write_result(ls, in, rv);
-
-	do_waiters(ls, r);
-	put_resource(r);
-}
-
-static void do_unlock(struct lockspace *ls, struct dlm_plock_info *in,
-		      struct resource *r)
-{
-	int rv;
-
-	rv = unlock_internal(ls, r, in);
-
-	if (in->nodeid == our_nodeid)
-		write_result(ls, in, rv);
-
-	do_waiters(ls, r);
-	put_resource(r);
-}
-
-/* we don't even get to this function if the getlk isn't from us */
-
-static void do_get(struct lockspace *ls, struct dlm_plock_info *in,
-		   struct resource *r)
-{
-	int rv;
-
-	if (is_conflict(r, in, 1))
-		rv = 1;
-	else
-		rv = 0;
-
-	write_result(ls, in, rv);
-}
-
-static void save_message(struct lockspace *ls, struct dlm_header *hd, int len,
-			 int from, int type)
-{
-	struct save_msg *sm;
-
-	sm = malloc(sizeof(struct save_msg) + len);
-	if (!sm)
-		return;
-	memset(sm, 0, sizeof(struct save_msg) + len);
-
-	memcpy(&sm->buf, hd, len);
-	sm->type = type;
-	sm->len = len;
-	sm->nodeid = from;
-
-	log_group(ls, "save %s from %d len %d", msg_name(type), from, len);
-
-	list_add_tail(&sm->list, &ls->saved_messages);
-}
-
-static void __receive_plock(struct lockspace *ls, struct dlm_plock_info *in,
-			    int from, struct resource *r)
-{
-	switch (in->optype) {
-	case DLM_PLOCK_OP_LOCK:
-		ls->last_plock_time = time(NULL);
-		do_lock(ls, in, r);
-		break;
-	case DLM_PLOCK_OP_UNLOCK:
-		ls->last_plock_time = time(NULL);
-		do_unlock(ls, in, r);
-		break;
-	case DLM_PLOCK_OP_GET:
-		do_get(ls, in, r);
-		break;
-	default:
-		log_error("receive_plock from %d optype %d", from, in->optype);
-		if (from == our_nodeid)
-			write_result(ls, in, -EINVAL);
-	}
-}
-
-/* When ls members receive our options message (for our mount), one of them
-   saves all plock state received to that point in a checkpoint and then sends
-   us our journals message.  We know to retrieve the plock state from the
-   checkpoint when we receive our journals message.  Any plocks messages that
-   arrive between seeing our options message and our journals message needs to
-   be saved and processed after we synchronize our plock state from the
-   checkpoint.  Any plock message received while we're mounting but before we
-   set save_plocks (when we see our options message) can be ignored because it
-   should be reflected in the checkpointed state. */
-
-static void _receive_plock(struct lockspace *ls, struct dlm_header *hd, int len)
-{
-	struct dlm_plock_info info;
-	struct resource *r = NULL;
-	struct timeval now;
-	uint64_t usec;
-	int from = hd->nodeid;
-	int rv, create;
-
-	memcpy(&info, (char *)hd + sizeof(struct dlm_header), sizeof(info));
-	info_bswap_in(&info);
-
-	log_plock(ls, "receive plock %llx %s %s %llx-%llx %d/%u/%llx w %d",
-		  (unsigned long long)info.number,
-		  op_str(info.optype),
-		  ex_str(info.optype, info.ex),
-		  (unsigned long long)info.start, (unsigned long long)info.end,
-		  info.nodeid, info.pid, (unsigned long long)info.owner,
-		  info.wait);
-
-	plock_recv_count++;
-	if (!(plock_recv_count % 1000)) {
-		gettimeofday(&now, NULL);
-		usec = dt_usec(&plock_recv_time, &now);
-		log_group(ls, "plock_recv_count %u time %.3f s",
-			  plock_recv_count, usec * 1.e-6);
-		plock_recv_time = now;
-	}
-
-	if (info.optype == DLM_PLOCK_OP_GET && from != our_nodeid)
-		return;
-
-	if (from != hd->nodeid || from != info.nodeid) {
-		log_error("receive_plock from %d header %d info %d",
-			  from, hd->nodeid, info.nodeid);
-		return;
-	}
-
-	create = !cfgd_plock_ownership;
-
-	rv = find_resource(ls, info.number, create, &r);
-
-	if (rv && cfgd_plock_ownership) {
-		/* There must have been a race with a drop, so we need to
-		   ignore this plock op which will be resent.  If we're the one
-		   who sent the plock, we need to send_own() and put it on the
-		   pending list to resend once the owner is established. */
-
-		log_debug("receive_plock from %d no r %llx", from,
-			  (unsigned long long)info.number);
-
-		if (from != our_nodeid)
-			return;
-
-		rv = find_resource(ls, info.number, 1, &r);
-		if (rv)
-			return;
-		send_own(ls, r, our_nodeid);
-		save_pending_plock(ls, r, &info);
-		return;
-	}
-	if (rv) {
-		/* r not found, rv is -ENOENT, this shouldn't happen because
-		   process_plocks() creates a resource for every op */
-
-		log_error("receive_plock from %d no r %llx %d", from,
-			  (unsigned long long)info.number, rv);
-		return;
-	}
-
-	/* The owner should almost always be 0 here, but other owners may
-	   be possible given odd combinations of races with drop.  Odd races to
-	   worry about (some seem pretty improbable):
-
-	   - A sends drop, B sends plock, receive drop, receive plock.
-	   This is addressed above.
-
-	   - A sends drop, B sends plock, receive drop, B reads plock
-	   and sends own, receive plock, on B we find owner of -1.
-
-	   - A sends drop, B sends two plocks, receive drop, receive plocks.
-	   Receiving the first plock is the previous case, receiving the
-	   second plock will find r with owner of -1.
-
-	   - A sends drop, B sends two plocks, receive drop, C sends own,
-	   receive plock, B sends own, receive own (C), receive plock,
-	   receive own (B).
-
-	   Haven't tried to cook up a scenario that would lead to the
-	   last case below; receiving a plock from ourself and finding
-	   we're the owner of r. */
-
-	if (!r->owner) {
-		__receive_plock(ls, &info, from, r);
-
-	} else if (r->owner == -1) {
-		log_debug("receive_plock from %d r %llx owner %d", from,
-			  (unsigned long long)info.number, r->owner);
-
-		if (from == our_nodeid)
-			save_pending_plock(ls, r, &info);
-
-	} else if (r->owner != our_nodeid) {
-		/* might happen, if frequent change to log_debug */
-		log_error("receive_plock from %d r %llx owner %d", from,
-			  (unsigned long long)info.number, r->owner);
-
-		if (from == our_nodeid)
-			save_pending_plock(ls, r, &info);
-
-	} else if (r->owner == our_nodeid) {
-		/* might happen, if frequent change to log_debug */
-		log_error("receive_plock from %d r %llx owner %d", from,
-			  (unsigned long long)info.number, r->owner);
-
-		if (from == our_nodeid)
-			__receive_plock(ls, &info, from, r);
-	}
-}
-
-void receive_plock(struct lockspace *ls, struct dlm_header *hd, int len)
-{
-	if (ls->save_plocks) {
-		save_message(ls, hd, len, hd->nodeid, DLM_MSG_PLOCK);
-		return;
-	}
-
-	_receive_plock(ls, hd, len);
-}
-
-static int send_struct_info(struct lockspace *ls, struct dlm_plock_info *in,
-			    int msg_type)
-{
-	struct dlm_header *hd;
-	int rv = 0, len;
-	char *buf;
-
-	len = sizeof(struct dlm_header) + sizeof(struct dlm_plock_info);
-	buf = malloc(len);
-	if (!buf) {
-		rv = -ENOMEM;
-		goto out;
-	}
-	memset(buf, 0, len);
-
-	info_bswap_out(in);
-
-	hd = (struct dlm_header *)buf;
-	hd->type = msg_type;
-
-	memcpy(buf + sizeof(struct dlm_header), in, sizeof(*in));
-
-	dlm_send_message(ls, buf, len);
-
-	free(buf);
- out:
-	if (rv)
-		log_error("send_struct_info error %d", rv);
-	return rv;
-}
-
-static void send_plock(struct lockspace *ls, struct resource *r,
-		       struct dlm_plock_info *in)
-{
-	send_struct_info(ls, in, DLM_MSG_PLOCK);
-}
-
-static void send_own(struct lockspace *ls, struct resource *r, int owner)
-{
-	struct dlm_plock_info info;
-
-	/* if we've already sent an own message for this resource,
-	   (pending list is not empty), then we shouldn't send another */
-
-	if (!list_empty(&r->pending)) {
-		log_debug("send_own %llx already pending",
-			  (unsigned long long)r->number);
-		return;
-	}
-
-	memset(&info, 0, sizeof(info));
-	info.number = r->number;
-	info.nodeid = owner;
-
-	send_struct_info(ls, &info, DLM_MSG_PLOCK_OWN);
-}
-
-static void send_syncs(struct lockspace *ls, struct resource *r)
-{
-	struct dlm_plock_info info;
-	struct posix_lock *po;
-	struct lock_waiter *w;
-	int rv;
-
-	list_for_each_entry(po, &r->locks, list) {
-		memset(&info, 0, sizeof(info));
-		info.number    = r->number;
-		info.start     = po->start;
-		info.end       = po->end;
-		info.nodeid    = po->nodeid;
-		info.owner     = po->owner;
-		info.pid       = po->pid;
-		info.ex        = po->ex;
-
-		rv = send_struct_info(ls, &info, DLM_MSG_PLOCK_SYNC_LOCK);
-		if (rv)
-			goto out;
-
-		po->flags |= P_SYNCING;
-	}
-
-	list_for_each_entry(w, &r->waiters, list) {
-		memcpy(&info, &w->info, sizeof(info));
-
-		rv = send_struct_info(ls, &info, DLM_MSG_PLOCK_SYNC_WAITER);
-		if (rv)
-			goto out;
-
-		w->flags |= P_SYNCING;
-	}
- out:
-	return;
-}
-
-static void send_drop(struct lockspace *ls, struct resource *r)
-{
-	struct dlm_plock_info info;
-
-	memset(&info, 0, sizeof(info));
-	info.number = r->number;
-
-	send_struct_info(ls, &info, DLM_MSG_PLOCK_DROP);
-}
-
-/* plock op can't be handled until we know the owner value of the resource,
-   so the op is saved on the pending list until the r owner is established */
-
-static void save_pending_plock(struct lockspace *ls, struct resource *r,
-			       struct dlm_plock_info *in)
-{
-	struct lock_waiter *w;
-
-	w = malloc(sizeof(struct lock_waiter));
-	if (!w) {
-		log_error("save_pending_plock no mem");
-		return;
-	}
-	memcpy(&w->info, in, sizeof(struct dlm_plock_info));
-	list_add_tail(&w->list, &r->pending);
-}
-
-/* plock ops are on pending list waiting for ownership to be established.
-   owner has now become us, so add these plocks to r */
-
-static void add_pending_plocks(struct lockspace *ls, struct resource *r)
-{
-	struct lock_waiter *w, *safe;
-
-	list_for_each_entry_safe(w, safe, &r->pending, list) {
-		__receive_plock(ls, &w->info, our_nodeid, r);
-		list_del(&w->list);
-		free(w);
-	}
-}
-
-/* plock ops are on pending list waiting for ownership to be established.
-   owner has now become 0, so send these plocks to everyone */
-
-static void send_pending_plocks(struct lockspace *ls, struct resource *r)
-{
-	struct lock_waiter *w, *safe;
-
-	list_for_each_entry_safe(w, safe, &r->pending, list) {
-		send_plock(ls, r, &w->info);
-		list_del(&w->list);
-		free(w);
-	}
-}
-
-static void _receive_own(struct lockspace *ls, struct dlm_header *hd, int len)
-{
-	struct dlm_plock_info info;
-	struct resource *r;
-	int should_not_happen = 0;
-	int from = hd->nodeid;
-	int rv;
-
-	memcpy(&info, (char *)hd + sizeof(struct dlm_header), sizeof(info));
-	info_bswap_in(&info);
-
-	log_plock(ls, "receive own %llx from %u owner %u",
-		  (unsigned long long)info.number, hd->nodeid, info.nodeid);
-
-	rv = find_resource(ls, info.number, 1, &r);
-	if (rv)
-		return;
-
-	if (from == our_nodeid) {
-		/*
-		 * received our own own message
-		 */
-
-		if (info.nodeid == 0) {
-			/* we are setting owner to 0 */
-
-			if (r->owner == our_nodeid) {
-				/* we set owner to 0 when we relinquish
-				   ownership */
-				should_not_happen = 1;
-			} else if (r->owner == 0) {
-				/* this happens when we relinquish ownership */
-				r->flags |= R_GOT_UNOWN;
-			} else {
-				should_not_happen = 1;
-			}
-
-		} else if (info.nodeid == our_nodeid) {
-			/* we are setting owner to ourself */
-
-			if (r->owner == -1) {
-				/* we have gained ownership */
-				r->owner = our_nodeid;
-				add_pending_plocks(ls, r);
-			} else if (r->owner == our_nodeid) {
-				should_not_happen = 1;
-			} else if (r->owner == 0) {
-				send_pending_plocks(ls, r);
-			} else {
-				/* resource is owned by other node;
-				   they should set owner to 0 shortly */
-			}
-
-		} else {
-			/* we should only ever set owner to 0 or ourself */
-			should_not_happen = 1;
-		}
-	} else {
-		/*
-		 * received own message from another node
-		 */
-
-		if (info.nodeid == 0) {
-			/* other node is setting owner to 0 */
-
-			if (r->owner == -1) {
-				/* we should have a record of the owner before
-				   it relinquishes */
-				should_not_happen = 1;
-			} else if (r->owner == our_nodeid) {
-				/* only the owner should relinquish */
-				should_not_happen = 1;
-			} else if (r->owner == 0) {
-				should_not_happen = 1;
-			} else {
-				r->owner = 0;
-				r->flags |= R_GOT_UNOWN;
-				send_pending_plocks(ls, r);
-			}
-
-		} else if (info.nodeid == from) {
-			/* other node is setting owner to itself */
-
-			if (r->owner == -1) {
-				/* normal path for a node becoming owner */
-				r->owner = from;
-			} else if (r->owner == our_nodeid) {
-				/* we relinquish our ownership: sync our local
-				   plocks to everyone, then set owner to 0 */
-				send_syncs(ls, r);
-				send_own(ls, r, 0);
-				/* we need to set owner to 0 here because
-				   local ops may arrive before we receive
-				   our send_own message and can't be added
-				   locally */
-				r->owner = 0;
-			} else if (r->owner == 0) {
-				/* can happen because we set owner to 0 before
-				   we receive our send_own sent just above */
-			} else {
-				/* do nothing, current owner should be
-				   relinquishing its ownership */
-			}
-
-		} else if (info.nodeid == our_nodeid) {
-			/* no one else should try to set the owner to us */
-			should_not_happen = 1;
-		} else {
-			/* a node should only ever set owner to 0 or itself */
-			should_not_happen = 1;
-		}
-	}
-
-	if (should_not_happen) {
-		log_error("receive_own from %u %llx info nodeid %d r owner %d",
-			  from, (unsigned long long)r->number, info.nodeid,
-			  r->owner);
-	}
-}
-
-void receive_own(struct lockspace *ls, struct dlm_header *hd, int len)
-{
-	if (ls->save_plocks) {
-		save_message(ls, hd, len, hd->nodeid, DLM_MSG_PLOCK_OWN);
-		return;
-	}
-
-	_receive_own(ls, hd, len);
-}
-
-static void clear_syncing_flag(struct resource *r, struct dlm_plock_info *in)
-{
-	struct posix_lock *po;
-	struct lock_waiter *w;
-
-	list_for_each_entry(po, &r->locks, list) {
-		if ((po->flags & P_SYNCING) &&
-		    in->start  == po->start &&
-		    in->end    == po->end &&
-		    in->nodeid == po->nodeid &&
-		    in->owner  == po->owner &&
-		    in->pid    == po->pid &&
-		    in->ex     == po->ex) {
-			po->flags &= ~P_SYNCING;
-			return;
-		}
-	}
-
-	list_for_each_entry(w, &r->waiters, list) {
-		if ((w->flags & P_SYNCING) &&
-		    in->start  == w->info.start &&
-		    in->end    == w->info.end &&
-		    in->nodeid == w->info.nodeid &&
-		    in->owner  == w->info.owner &&
-		    in->pid    == w->info.pid &&
-		    in->ex     == w->info.ex) {
-			w->flags &= ~P_SYNCING;
-			return;
-		}
-	}
-
-	log_error("clear_syncing %llx no match %s %llx-%llx %d/%u/%llx",
-		  (unsigned long long)r->number, in->ex ? "WR" : "RD", 
-		  (unsigned long long)in->start, (unsigned long long)in->end,
-		  in->nodeid, in->pid, (unsigned long long)in->owner);
-}
-
-static void _receive_sync(struct lockspace *ls, struct dlm_header *hd, int len)
-{
-	struct dlm_plock_info info;
-	struct resource *r;
-	int from = hd->nodeid;
-	int rv;
-
-	memcpy(&info, (char *)hd + sizeof(struct dlm_header), sizeof(info));
-	info_bswap_in(&info);
-
-	log_plock(ls, "receive sync %llx from %u %s %llx-%llx %d/%u/%llx",
-		  (unsigned long long)info.number, from, info.ex ? "WR" : "RD",
-		  (unsigned long long)info.start, (unsigned long long)info.end,
-		  info.nodeid, info.pid, (unsigned long long)info.owner);
-
-	rv = find_resource(ls, info.number, 0, &r);
-	if (rv) {
-		log_error("receive_sync no r %llx from %d", info.number, from);
-		return;
-	}
-
-	if (from == our_nodeid) {
-		/* this plock now in sync on all nodes */
-		clear_syncing_flag(r, &info);
-		return;
-	}
-
-	if (hd->type == DLM_MSG_PLOCK_SYNC_LOCK)
-		add_lock(r, info.nodeid, info.owner, info.pid, info.ex, 
-			 info.start, info.end);
-	else if (hd->type == DLM_MSG_PLOCK_SYNC_WAITER)
-		add_waiter(ls, r, &info);
-}
-
-void receive_sync(struct lockspace *ls, struct dlm_header *hd, int len)
-{
-	if (ls->save_plocks) {
-		save_message(ls, hd, len, hd->nodeid, hd->type);
-		return;
-	}
-
-	_receive_sync(ls, hd, len);
-}
-
-static void _receive_drop(struct lockspace *ls, struct dlm_header *hd, int len)
-{
-	struct dlm_plock_info info;
-	struct resource *r;
-	int from = hd->nodeid;
-	int rv;
-
-	memcpy(&info, (char *)hd + sizeof(struct dlm_header), sizeof(info));
-	info_bswap_in(&info);
-
-	log_plock(ls, "receive drop %llx from %u",
-		  (unsigned long long)info.number, from);
-
-	rv = find_resource(ls, info.number, 0, &r);
-	if (rv) {
-		/* we'll find no r if two nodes sent drop at once */
-		log_debug("receive_drop from %d no r %llx", from,
-			  (unsigned long long)info.number);
-		return;
-	}
-
-	if (r->owner != 0) {
-		/* - A sent drop, B sent drop, receive drop A, C sent own,
-		     receive drop B (this warning on C, owner -1)
-	   	   - A sent drop, B sent drop, receive drop A, A sent own,
-		     receive own A, receive drop B (this warning on all,
-		     owner A) */
-		log_debug("receive_drop from %d r %llx owner %d", from,
-			  (unsigned long long)r->number, r->owner);
-		return;
-	}
-
-	if (!list_empty(&r->pending)) {
-		/* shouldn't happen */
-		log_error("receive_drop from %d r %llx pending op", from,
-			  (unsigned long long)r->number);
-		return;
-	}
-
-	/* the decision to drop or not must be based on things that are
-	   guaranteed to be the same on all nodes */
-
-	if (list_empty(&r->locks) && list_empty(&r->waiters)) {
-		list_del(&r->list);
-		free(r);
-	} else {
-		/* A sent drop, B sent a plock, receive plock, receive drop */
-		log_debug("receive_drop from %d r %llx in use", from,
-			  (unsigned long long)r->number);
-	}
-}
-
-void receive_drop(struct lockspace *ls, struct dlm_header *hd, int len)
-{
-	if (ls->save_plocks) {
-		save_message(ls, hd, len, hd->nodeid, DLM_MSG_PLOCK_DROP);
-		return;
-	}
-
-	_receive_drop(ls, hd, len);
-}
-
-/* We only drop resources from the unowned state to simplify things.
-   If we want to drop a resource we own, we unown/relinquish it first. */
-
-/* FIXME: in the transition from owner = us, to owner = 0, to drop;
-   we want the second period to be shorter than the first */
-
-static int drop_resources(struct lockspace *ls)
-{
-	struct resource *r;
-	struct timeval now;
-	int count = 0;
-
-	gettimeofday(&now, NULL);
-
-	/* try to drop the oldest, unused resources */
-
-	list_for_each_entry_reverse(r, &ls->plock_resources, list) {
-		if (count >= cfgd_drop_resources_count)
-			break;
-		if (r->owner && r->owner != our_nodeid)
-			continue;
-		if (time_diff_ms(&r->last_access, &now) <
-		    cfgd_drop_resources_age)
-			continue;
-
-		if (list_empty(&r->locks) && list_empty(&r->waiters)) {
-			if (r->owner == our_nodeid) {
-				send_own(ls, r, 0);
-				r->owner = 0;
-			} else if (r->owner == 0 && got_unown(r)) {
-				send_drop(ls, r);
-			}
-
-			count++;
-		}
-	}
-
-	return 0;
-}
-
-int limit_plocks(void)
-{
-	struct timeval now;
-
-	/* Don't send more messages while the cpg message queue is backed up */
-
-	if (message_flow_control_on) {
-		update_flow_control_status();
-		if (message_flow_control_on)
-			return 1;
-	}
-
-	if (!cfgd_plock_rate_limit || !plock_read_count)
-		return 0;
-
-	gettimeofday(&now, NULL);
-
-	/* Every time a plock op is read from the kernel, we increment
-	   plock_read_count.  After every cfgd_plock_rate_limit (N) reads,
-	   we check the time it's taken to do those N; if the time is less than
-	   a second, then we delay reading any more until a second is up.
-	   This way we read a max of N ops from the kernel every second. */
-
-	if (!(plock_read_count % cfgd_plock_rate_limit)) {
-		if (time_diff_ms(&plock_rate_last, &now) < 1000) {
-			plock_rate_delays++;
-			return 2;
-		}
-		plock_rate_last = now;
-		plock_read_count++;
-	}
-	return 0;
-}
-
-void process_plocks(int ci)
-{
-	struct lockspace *ls;
-	struct resource *r;
-	struct dlm_plock_info info;
-	struct timeval now;
-	uint64_t usec;
-	int rv;
-
-	if (limit_plocks()) {
-		poll_ignore_plock = 1;
-		client_ignore(plock_ci, plock_fd);
-		return;
-	}
-
-	gettimeofday(&now, NULL);
-
-	memset(&info, 0, sizeof(info));
-
-	rv = do_read(plock_device_fd, &info, sizeof(info));
-	if (rv < 0) {
-		log_debug("process_plocks: read error %d fd %d\n",
-			  errno, plock_device_fd);
-		return;
-	}
-
-	/* kernel doesn't set the nodeid field */
-	info.nodeid = our_nodeid;
-
-	if (!cfgd_enable_plock) {
-		rv = -ENOSYS;
-		goto fail;
-	}
-
-	if (need_fsid_translation)
-		info.fsid = mg_to_ls_id(info.fsid);
-
-	ls = find_ls_id(info.fsid);
-	if (!ls) {
-		log_debug("process_plocks: no ls id %x", info.fsid);
-		rv = -EEXIST;
-		goto fail;
-	}
-
-	log_plock(ls, "read plock %llx %s %s %llx-%llx %d/%u/%llx w %d",
-		  (unsigned long long)info.number,
-		  op_str(info.optype),
-		  ex_str(info.optype, info.ex),
-		  (unsigned long long)info.start, (unsigned long long)info.end,
-		  info.nodeid, info.pid, (unsigned long long)info.owner,
-		  info.wait);
-
-	/* report plock rate and any delays since the last report */
-	plock_read_count++;
-	if (!(plock_read_count % 1000)) {
-		usec = dt_usec(&plock_read_time, &now) ;
-		log_group(ls, "plock_read_count %u time %.3f s delays %u",
-			  plock_read_count, usec * 1.e-6, plock_rate_delays);
-		plock_read_time = now;
-		plock_rate_delays = 0;
-	}
-
-	rv = find_resource(ls, info.number, 1, &r);
-	if (rv)
-		goto fail;
-
-	if (r->owner == 0) {
-		/* plock state replicated on all nodes */
-		send_plock(ls, r, &info);
-
-	} else if (r->owner == our_nodeid) {
-		/* we are the owner of r, so our plocks are local */
-		__receive_plock(ls, &info, our_nodeid, r);
-
-	} else {
-		/* r owner is -1: r is new, try to become the owner;
-		   r owner > 0: tell other owner to give up ownership;
-		   both done with a message trying to set owner to ourself */
-		send_own(ls, r, our_nodeid);
-		save_pending_plock(ls, r, &info);
-	}
-
-	if (cfgd_plock_ownership &&
-	    time_diff_ms(&ls->drop_resources_last, &now) >=
-	    		 cfgd_drop_resources_time) {
-		ls->drop_resources_last = now;
-		drop_resources(ls);
-	}
-
-	return;
-
- fail:
-	info.rv = rv;
-	rv = write(plock_device_fd, &info, sizeof(info));
-}
-
-void process_saved_plocks(struct lockspace *ls)
-{
-	struct save_msg *sm, *sm2;
-	struct dlm_header *hd;
-
-	if (list_empty(&ls->saved_messages))
-		return;
-
-	log_group(ls, "process_saved_plocks");
-
-	list_for_each_entry_safe(sm, sm2, &ls->saved_messages, list) {
-		hd = (struct dlm_header *)sm->buf;
-
-		switch (sm->type) {
-		case DLM_MSG_PLOCK:
-			_receive_plock(ls, hd, sm->len);
-			break;
-		case DLM_MSG_PLOCK_OWN:
-			_receive_own(ls, hd, sm->len);
-			break;
-		case DLM_MSG_PLOCK_DROP:
-			_receive_drop(ls, hd, sm->len);
-			break;
-		case DLM_MSG_PLOCK_SYNC_LOCK:
-		case DLM_MSG_PLOCK_SYNC_WAITER:
-			_receive_sync(ls, hd, sm->len);
-			break;
-		default:
-			continue;
-		}
-
-		list_del(&sm->list);
-		free(sm);
-	}
-}
-
-void plock_exit(void)
-{
-	saCkptFinalize(system_ckpt_handle);
-}
-
-/* locks still marked SYNCING should not go into the ckpt; the new node
-   will get those locks by receiving PLOCK_SYNC messages */
-
-static void pack_section_buf(struct lockspace *ls, struct resource *r)
-{
-	struct pack_plock *pp;
-	struct posix_lock *po;
-	struct lock_waiter *w;
-	int count = 0;
-
-	/* plocks on owned resources are not replicated on other nodes */
-	if (r->owner == our_nodeid)
-		return;
-
-	pp = (struct pack_plock *) &section_buf;
-
-	list_for_each_entry(po, &r->locks, list) {
-		if (po->flags & P_SYNCING)
-			continue;
-		pp->start	= cpu_to_le64(po->start);
-		pp->end		= cpu_to_le64(po->end);
-		pp->owner	= cpu_to_le64(po->owner);
-		pp->pid		= cpu_to_le32(po->pid);
-		pp->nodeid	= cpu_to_le32(po->nodeid);
-		pp->ex		= po->ex;
-		pp->waiter	= 0;
-		pp++;
-		count++;
-	}
-
-	list_for_each_entry(w, &r->waiters, list) {
-		if (w->flags & P_SYNCING)
-			continue;
-		pp->start	= cpu_to_le64(w->info.start);
-		pp->end		= cpu_to_le64(w->info.end);
-		pp->owner	= cpu_to_le64(w->info.owner);
-		pp->pid		= cpu_to_le32(w->info.pid);
-		pp->nodeid	= cpu_to_le32(w->info.nodeid);
-		pp->ex		= w->info.ex;
-		pp->waiter	= 1;
-		pp++;
-		count++;
-	}
-
-	section_len = count * sizeof(struct pack_plock);
-}
-
-static int unpack_section_buf(struct lockspace *ls, char *numbuf, int buflen)
-{
-	struct pack_plock *pp;
-	struct posix_lock *po;
-	struct lock_waiter *w;
-	struct resource *r;
-	int count = section_len / sizeof(struct pack_plock);
-	int i, owner = 0;
-	unsigned long long num;
-	struct timeval now;
-
-	gettimeofday(&now, NULL);
-
-	r = malloc(sizeof(struct resource));
-	if (!r)
-		return -ENOMEM;
-	memset(r, 0, sizeof(struct resource));
-	INIT_LIST_HEAD(&r->locks);
-	INIT_LIST_HEAD(&r->waiters);
-	INIT_LIST_HEAD(&r->pending);
-
-	sscanf(numbuf, "r%llu.%d", &num, &owner);
-
-	r->number = num;
-	r->owner = owner;
-	r->last_access = now;
-
-	pp = (struct pack_plock *) &section_buf;
-
-	for (i = 0; i < count; i++) {
-		if (!pp->waiter) {
-			po = malloc(sizeof(struct posix_lock));
-			// FIXME: handle failed malloc
-			po->start	= le64_to_cpu(pp->start);
-			po->end		= le64_to_cpu(pp->end);
-			po->owner	= le64_to_cpu(pp->owner);
-			po->pid		= le32_to_cpu(pp->pid);
-			po->nodeid	= le32_to_cpu(pp->nodeid);
-			po->ex		= pp->ex;
-			list_add_tail(&po->list, &r->locks);
-		} else {
-			w = malloc(sizeof(struct lock_waiter));
-			// FIXME: handle failed malloc
-			w->info.start	= le64_to_cpu(pp->start);
-			w->info.end	= le64_to_cpu(pp->end);
-			w->info.owner	= le64_to_cpu(pp->owner);
-			w->info.pid	= le32_to_cpu(pp->pid);
-			w->info.nodeid	= le32_to_cpu(pp->nodeid);
-			w->info.ex	= pp->ex;
-			list_add_tail(&w->list, &r->waiters);
-		}
-		pp++;
-	}
-
-	list_add_tail(&r->list, &ls->plock_resources);
-	return 0;
-}
-
-/* If we are the new ckpt_node, we'll be unlinking a ckpt that we don't
-   have open, which was created by the previous ckpt_node.  The previous
-   ckpt_node should have closed the ckpt in set_plock_ckpt_node() so it
-   will go away when we unlink it here. */
-
-static int _unlink_checkpoint(struct lockspace *ls, SaNameT *name)
-{
-	SaCkptCheckpointHandleT h;
-	SaCkptCheckpointDescriptorT s;
-	SaAisErrorT rv;
-	int ret = 0;
-
-	h = (SaCkptCheckpointHandleT) ls->plock_ckpt_handle;
-	log_group(ls, "unlink ckpt %llx", (unsigned long long)h);
-
- unlink_retry:
-	rv = saCkptCheckpointUnlink(system_ckpt_handle, name);
-	if (rv == SA_AIS_ERR_TRY_AGAIN) {
-		log_group(ls, "unlink ckpt retry");
-		sleep(1);
-		goto unlink_retry;
-	}
-	if (rv == SA_AIS_OK)
-		goto out_close;
-
-	log_group(ls, "unlink ckpt error %d %s", rv, ls->name);
-	ret = -1;
-
- status_retry:
-	rv = saCkptCheckpointStatusGet(h, &s);
-	if (rv == SA_AIS_ERR_TRY_AGAIN) {
-		log_group(ls, "unlink ckpt status retry");
-		sleep(1);
-		goto status_retry;
-	}
-	if (rv != SA_AIS_OK) {
-		log_error("unlink ckpt status error %d %s", rv, ls->name);
-		goto out_close;
-	}
-
-	log_group(ls, "unlink ckpt status: size %llu, max sections %u, "
-		      "max section size %llu, section count %u, mem %u",
-		 (unsigned long long)s.checkpointCreationAttributes.checkpointSize,
-		 s.checkpointCreationAttributes.maxSections,
-		 (unsigned long long)s.checkpointCreationAttributes.maxSectionSize,
-		 s.numberOfSections, s.memoryUsed);
-
- out_close:
-	if (!h)
-		goto out;
-
-	rv = saCkptCheckpointClose(h);
-	if (rv == SA_AIS_ERR_TRY_AGAIN) {
-		log_group(ls, "unlink ckpt close retry");
-		sleep(1);
-		goto out_close;
-	}
-	if (rv != SA_AIS_OK) {
-		log_error("unlink ckpt %llx close err %d %s",
-			  (unsigned long long)h, rv, ls->name);
-		/* should we return an error here and possibly cause
-		   store_plocks() to fail on this? */
-		/* ret = -1; */
-	}
- out:
-	ls->plock_ckpt_handle = 0;
-	return ret;
-}
-
-void close_plock_checkpoint(struct lockspace *ls)
-{
-	SaCkptCheckpointHandleT h;
-	SaAisErrorT rv;
-
-	h = (SaCkptCheckpointHandleT) ls->plock_ckpt_handle;
-	if (!h)
-		return;
- retry:
-	rv = saCkptCheckpointClose(h);
-	if (rv == SA_AIS_ERR_TRY_AGAIN) {
-		log_group(ls, "close_plock_checkpoint retry");
-		sleep(1);
-		goto retry;
-	}
-	if (rv != SA_AIS_OK) {
-		log_error("close_plock_checkpoint %llx err %d %s",
-			  (unsigned long long)h, rv, ls->name);
-	}
-
-	ls->plock_ckpt_handle = 0;
-}
-
-/*
- * section id is r<inodenum>.<owner>, the maximum string length is:
- * "r" prefix       =  1    strlen("r")
- * max uint64       = 20    strlen("18446744073709551615")
- * "." before owner =  1    strlen(".")
- * max int          = 11    strlen("-2147483647")
- * \0 at end        =  1
- * ---------------------
- *                    34    SECTION_NAME_LEN
- */
-
-#define SECTION_NAME_LEN 34
-
-/* Copy all plock state into a checkpoint so new node can retrieve it.  The
-   node creating the ckpt for the mounter needs to be the same node that's
-   sending the mounter its journals message (i.e. the low nodeid).  The new
-   mounter knows the ckpt is ready to read only after it gets its journals
-   message.
- 
-   If the mounter is becoming the new low nodeid in the group, the node doing
-   the store closes the ckpt and the new node unlinks the ckpt after reading
-   it.  The ckpt should then disappear and the new node can create a new ckpt
-   for the next mounter. */
-
-void store_plocks(struct lockspace *ls)
-{
-	SaCkptCheckpointCreationAttributesT attr;
-	SaCkptCheckpointHandleT h;
-	SaCkptSectionIdT section_id;
-	SaCkptSectionCreationAttributesT section_attr;
-	SaCkptCheckpointOpenFlagsT flags;
-	SaNameT name;
-	SaAisErrorT rv;
-	char buf[SECTION_NAME_LEN];
-	struct resource *r;
-	struct posix_lock *po;
-	struct lock_waiter *w;
-	int r_count, lock_count, total_size, section_size, max_section_size;
-	int len, owner;
-
-	if (!cfgd_enable_plock)
-		return;
-
-	/* no change to plock state since we created the last checkpoint */
-	if (ls->last_checkpoint_time > ls->last_plock_time) {
-		log_group(ls, "store_plocks: saved ckpt uptodate");
-		goto out;
-	}
-	ls->last_checkpoint_time = time(NULL);
-
-	len = snprintf((char *)name.value, SA_MAX_NAME_LENGTH, "dlmplock.%s",
-		       ls->name);
-	name.length = len;
-
-	_unlink_checkpoint(ls, &name);
-
-	/* loop through all plocks to figure out sizes to set in
-	   the attr fields */
-
-	r_count = 0;
-	lock_count = 0;
-	total_size = 0;
-	max_section_size = 0;
-
-	list_for_each_entry(r, &ls->plock_resources, list) {
-		if (r->owner == -1)
-			continue;
-
-		r_count++;
-		section_size = 0;
-		list_for_each_entry(po, &r->locks, list) {
-			section_size += sizeof(struct pack_plock);
-			lock_count++;
-		}
-		list_for_each_entry(w, &r->waiters, list) {
-			section_size += sizeof(struct pack_plock);
-			lock_count++;
-		}
-		total_size += section_size;
-		if (section_size > max_section_size)
-			max_section_size = section_size;
-	}
-
-	log_group(ls, "store_plocks: r_count %d, lock_count %d, pp %u bytes",
-		  r_count, lock_count, (unsigned int)sizeof(struct pack_plock));
-
-	log_group(ls, "store_plocks: total %d bytes, max_section %d bytes",
-		  total_size, max_section_size);
-
-	attr.creationFlags = SA_CKPT_WR_ALL_REPLICAS;
-	attr.checkpointSize = total_size;
-	attr.retentionDuration = SA_TIME_MAX;
-	attr.maxSections = r_count + 1;      /* don't know why we need +1 */
-	attr.maxSectionSize = max_section_size;
-	attr.maxSectionIdSize = SECTION_NAME_LEN;
-
-	flags = SA_CKPT_CHECKPOINT_READ |
-		SA_CKPT_CHECKPOINT_WRITE |
-		SA_CKPT_CHECKPOINT_CREATE;
-
- open_retry:
-	rv = saCkptCheckpointOpen(system_ckpt_handle, &name,&attr,flags,0,&h);
-	if (rv == SA_AIS_ERR_TRY_AGAIN) {
-		log_group(ls, "store_plocks: ckpt open retry");
-		sleep(1);
-		goto open_retry;
-	}
-	if (rv == SA_AIS_ERR_EXIST) {
-		log_group(ls, "store_plocks: ckpt already exists");
-		return;
-	}
-	if (rv != SA_AIS_OK) {
-		log_error("store_plocks: ckpt open error %d %s", rv, ls->name);
-		return;
-	}
-
-	log_group(ls, "store_plocks: open ckpt handle %llx",
-		  (unsigned long long)h);
-	ls->plock_ckpt_handle = (uint64_t) h;
-
-	/* - If r owner is -1, ckpt nothing.
-	   - If r owner is us, ckpt owner of us and no plocks.
-	   - If r owner is other, ckpt that owner and any plocks we have on r
-	     (they've just been synced but owner=0 msg not recved yet).
-	   - If r owner is 0 and !got_unown, then we've just unowned r;
-	     ckpt owner of us and any plocks that don't have SYNCING set
-	     (plocks with SYNCING will be handled by our sync messages).
-	   - If r owner is 0 and got_unown, then ckpt owner 0 and all plocks;
-	     (there should be no SYNCING plocks) */
-
-	list_for_each_entry(r, &ls->plock_resources, list) {
-		if (r->owner == -1)
-			continue;
-		else if (r->owner == our_nodeid)
-			owner = our_nodeid;
-		else if (r->owner)
-			owner = r->owner;
-		else if (!r->owner && !got_unown(r))
-			owner = our_nodeid;
-		else if (!r->owner)
-			owner = 0;
-		else {
-			log_error("store_plocks owner %d r %llx", r->owner,
-				  (unsigned long long)r->number);
-			continue;
-		}
-
-		memset(&buf, 0, sizeof(buf));
-		len = snprintf(buf, SECTION_NAME_LEN, "r%llu.%d",
-			       (unsigned long long)r->number, owner);
-
-		section_id.id = (void *)buf;
-		section_id.idLen = len + 1;
-		section_attr.sectionId = &section_id;
-		section_attr.expirationTime = SA_TIME_END;
-
-		memset(&section_buf, 0, sizeof(section_buf));
-		section_len = 0;
-
-		pack_section_buf(ls, r);
-
-		log_group(ls, "store_plocks: section size %u id %u \"%s\"",
-			  section_len, section_id.idLen, buf);
-
-	 create_retry:
-		rv = saCkptSectionCreate(h, &section_attr, &section_buf,
-					 section_len);
-		if (rv == SA_AIS_ERR_TRY_AGAIN) {
-			log_group(ls, "store_plocks: ckpt create retry");
-			sleep(1);
-			goto create_retry;
-		}
-		if (rv == SA_AIS_ERR_EXIST) {
-			/* this shouldn't happen in general */
-			log_group(ls, "store_plocks: clearing old ckpt");
-			/* do we need this close or will the close in
-			   the unlink function be ok? */
-			saCkptCheckpointClose(h);
-			_unlink_checkpoint(ls, &name);
-			goto open_retry;
-		}
-		if (rv != SA_AIS_OK) {
-			log_error("store_plocks: ckpt section create err %d %s",
-				  rv, ls->name);
-			break;
-		}
-	}
- out:
-	return;
-}
-
-/* called by a node that's just been added to the group to get existing plock
-   state */
-
-void retrieve_plocks(struct lockspace *ls)
-{
-	SaCkptCheckpointHandleT h;
-	SaCkptSectionIterationHandleT itr;
-	SaCkptSectionDescriptorT desc;
-	SaCkptIOVectorElementT iov;
-	SaNameT name;
-	SaAisErrorT rv;
-	char buf[SECTION_NAME_LEN];
-	int len;
-
-	if (!cfgd_enable_plock)
-		return;
-
-	log_group(ls, "retrieve_plocks");
-
-	len = snprintf((char *)name.value, SA_MAX_NAME_LENGTH, "dlmplock.%s",
-		       ls->name);
-	name.length = len;
-
- open_retry:
-	rv = saCkptCheckpointOpen(system_ckpt_handle, &name, NULL,
-				  SA_CKPT_CHECKPOINT_READ, 0, &h);
-	if (rv == SA_AIS_ERR_TRY_AGAIN) {
-		log_group(ls, "retrieve_plocks: ckpt open retry");
-		sleep(1);
-		goto open_retry;
-	}
-	if (rv != SA_AIS_OK) {
-		log_error("retrieve_plocks: ckpt open error %d %s",
-			  rv, ls->name);
-		return;
-	}
-
- init_retry:
-	rv = saCkptSectionIterationInitialize(h, SA_CKPT_SECTIONS_ANY, 0, &itr);
-	if (rv == SA_AIS_ERR_TRY_AGAIN) {
-		log_group(ls, "retrieve_plocks: ckpt iterinit retry");
-		sleep(1);
-		goto init_retry;
-	}
-	if (rv != SA_AIS_OK) {
-		log_error("retrieve_plocks: ckpt iterinit error %d %s",
-			  rv, ls->name);
-		goto out;
-	}
-
-	while (1) {
-	 next_retry:
-		rv = saCkptSectionIterationNext(itr, &desc);
-		if (rv == SA_AIS_ERR_NO_SECTIONS)
-			break;
-		if (rv == SA_AIS_ERR_TRY_AGAIN) {
-			log_group(ls, "retrieve_plocks: ckpt iternext retry");
-			sleep(1);
-			goto next_retry;
-		}
-		if (rv != SA_AIS_OK) {
-			log_error("retrieve_plocks: ckpt iternext error %d %s",
-				  rv, ls->name);
-			goto out_it;
-		}
-
-		if (!desc.sectionId.idLen)
-			continue;
-
-		iov.sectionId = desc.sectionId;
-		iov.dataBuffer = &section_buf;
-		iov.dataSize = desc.sectionSize;
-		iov.dataOffset = 0;
-
-		/* for debug print */
-		memset(&buf, 0, sizeof(buf));
-		snprintf(buf, SECTION_NAME_LEN, "%s", desc.sectionId.id);
-
-		log_group(ls, "retrieve_plocks: section size %llu id %u \"%s\"",
-			  (unsigned long long)iov.dataSize, iov.sectionId.idLen,
-			  buf);
-
-	 read_retry:
-		rv = saCkptCheckpointRead(h, &iov, 1, NULL);
-		if (rv == SA_AIS_ERR_TRY_AGAIN) {
-			log_group(ls, "retrieve_plocks: ckpt read retry");
-			sleep(1);
-			goto read_retry;
-		}
-		if (rv != SA_AIS_OK) {
-			log_error("retrieve_plocks: ckpt read error %d %s",
-				  rv, ls->name);
-			goto out_it;
-		}
-
-		/* we'll get empty (zero length) sections for resources with
-		   no locks, which exist in ownership mode; the resource
-		   name and owner come from the section id */
-
-		log_group(ls, "retrieve_plocks: ckpt read %llu bytes",
-			  (unsigned long long)iov.readSize);
-		section_len = iov.readSize;
-
-		if (section_len % sizeof(struct pack_plock)) {
-			log_error("retrieve_plocks: bad section len %d %s",
-				  section_len, ls->name);
-			continue;
-		}
-
-		unpack_section_buf(ls, (char *)desc.sectionId.id,
-				   desc.sectionId.idLen);
-	}
-
- out_it:
-	saCkptSectionIterationFinalize(itr);
- out:
-	saCkptCheckpointClose(h);
-}
-
-/* Called when a node has failed, or we're unmounting.  For a node failure, we
-   need to call this when the cpg confchg arrives so that we're guaranteed all
-   nodes do this in the same sequence wrt other messages. */
-
-void purge_plocks(struct lockspace *ls, int nodeid, int unmount)
-{
-	struct posix_lock *po, *po2;
-	struct lock_waiter *w, *w2;
-	struct resource *r, *r2;
-	int purged = 0;
-
-	if (!cfgd_enable_plock)
-		return;
-
-	list_for_each_entry_safe(r, r2, &ls->plock_resources, list) {
-		list_for_each_entry_safe(po, po2, &r->locks, list) {
-			if (po->nodeid == nodeid || unmount) {
-				list_del(&po->list);
-				free(po);
-				purged++;
-			}
-		}
-
-		list_for_each_entry_safe(w, w2, &r->waiters, list) {
-			if (w->info.nodeid == nodeid || unmount) {
-				list_del(&w->list);
-				free(w);
-				purged++;
-			}
-		}
-
-		/* TODO: haven't thought carefully about how this transition
-		   to owner 0 might interact with other owner messages in
-		   progress. */
-
-		if (r->owner == nodeid) {
-			r->owner = 0;
-			send_pending_plocks(ls, r);
-		}
-		
-		if (!list_empty(&r->waiters))
-			do_waiters(ls, r);
-
-		if (!cfgd_plock_ownership &&
-		    list_empty(&r->locks) && list_empty(&r->waiters)) {
-			list_del(&r->list);
-			free(r);
-		}
-	}
-	
-	if (purged)
-		ls->last_plock_time = time(NULL);
-
-	log_group(ls, "purged %d plocks for %d", purged, nodeid);
-}
-
-int fill_plock_dump_buf(struct lockspace *ls)
-{
-	struct posix_lock *po;
-	struct lock_waiter *w;
-	struct resource *r;
-	struct timeval now;
-	int rv = 0;
-	int len = DLMC_DUMP_SIZE, pos = 0, ret;
-
-	memset(plock_dump_buf, 0, sizeof(plock_dump_buf));
-	plock_dump_len = 0;
-
-	gettimeofday(&now, NULL);
-
-	list_for_each_entry(r, &ls->plock_resources, list) {
-
-		if (list_empty(&r->locks) &&
-		    list_empty(&r->waiters) &&
-		    list_empty(&r->pending)) {
-			ret = snprintf(plock_dump_buf + pos, len - pos,
-			      "%llu rown %d unused_ms %llu\n",
-			      (unsigned long long)r->number, r->owner,
-			      (unsigned long long)time_diff_ms(&r->last_access,
-				      			       &now));
-			if (ret >= len - pos) {
-				rv = -ENOSPC;
-				goto out;
-			}
-			pos += ret;
-			continue;
-		}
-
-		list_for_each_entry(po, &r->locks, list) {
-			ret = snprintf(plock_dump_buf + pos, len - pos,
-			      "%llu %s %llu-%llu nodeid %d pid %u owner %llx rown %d\n",
-			      (unsigned long long)r->number,
-			      po->ex ? "WR" : "RD",
-			      (unsigned long long)po->start,
-			      (unsigned long long)po->end,
-			      po->nodeid, po->pid,
-			      (unsigned long long)po->owner, r->owner);
-
-			if (ret >= len - pos) {
-				rv = -ENOSPC;
-				goto out;
-			}
-			pos += ret;
-		}
-
-		list_for_each_entry(w, &r->waiters, list) {
-			ret = snprintf(plock_dump_buf + pos, len - pos,
-			      "%llu %s %llu-%llu nodeid %d pid %u owner %llx rown %d WAITING\n",
-			      (unsigned long long)r->number,
-			      w->info.ex ? "WR" : "RD",
-			      (unsigned long long)w->info.start,
-			      (unsigned long long)w->info.end,
-			      w->info.nodeid, w->info.pid,
-			      (unsigned long long)w->info.owner, r->owner);
-
-			if (ret >= len - pos) {
-				rv = -ENOSPC;
-				goto out;
-			}
-			pos += ret;
-		}
-
-		list_for_each_entry(w, &r->pending, list) {
-			ret = snprintf(plock_dump_buf + pos, len - pos,
-			      "%llu %s %llu-%llu nodeid %d pid %u owner %llx rown %d PENDING\n",
-			      (unsigned long long)r->number,
-			      w->info.ex ? "WR" : "RD",
-			      (unsigned long long)w->info.start,
-			      (unsigned long long)w->info.end,
-			      w->info.nodeid, w->info.pid,
-			      (unsigned long long)w->info.owner, r->owner);
-
-			if (ret >= len - pos) {
-				rv = -ENOSPC;
-				goto out;
-			}
-			pos += ret;
-		}
-	}
- out:
-	plock_dump_len = pos;
-	return rv;
-}
-
diff --git a/group/gfs_control/Makefile b/group/gfs_control/Makefile
deleted file mode 100644
index a69860b..0000000
--- a/group/gfs_control/Makefile
+++ /dev/null
@@ -1,31 +0,0 @@
-TARGET= gfs_control
-
-SBINDIRT=$(TARGET)
-
-all: depends ${TARGET}
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-OBJS=	main.o
-
-CFLAGS += -I$(S)/../libgfscontrol
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L../libgfscontrol -lgfscontrol
-LDFLAGS += -L${libdir}
-
-LDDEPS += ../libgfscontrol/libgfscontrol.a
-
-${TARGET}: ${OBJS} ${LDDEPS}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-clean: generalclean
-
-depends:
-	$(MAKE) -C ../libgfscontrol all
-
--include $(OBJS:.o=.d)
diff --git a/group/gfs_control/main.c b/group/gfs_control/main.c
deleted file mode 100644
index 4bfb392..0000000
--- a/group/gfs_control/main.c
+++ /dev/null
@@ -1,466 +0,0 @@
-#include <sys/types.h>
-#include <sys/un.h>
-#include <inttypes.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <stddef.h>
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-#include <limits.h>
-#include <netinet/in.h>
-
-#include "libgfscontrol.h"
-
-#define OPTION_STRING			"nhV"
-
-#define OP_LIST				1
-#define OP_DUMP				2
-#define OP_PLOCKS			3
-#define OP_JOIN				4
-#define OP_LEAVE			5
-#define OP_JOINLEAVE			6
-
-static char *prog_name;
-static char *fsname;
-static int operation;
-static int opt_ind;
-static int ls_all_nodes;
-
-#define MAX_MG 128
-#define MAX_NODES 128
-
-struct gfsc_mountgroup mgs[MAX_MG];
-struct gfsc_node nodes[MAX_NODES];
-
-
-static void print_usage(void)
-{
-	printf("Usage:\n");
-	printf("\n");
-	printf("%s [options] [ls|dump|plocks]\n", prog_name);
-	printf("\n");
-	printf("Options:\n");
-	printf("  -n               Show all node information in ls\n");
-	printf("  -h               Print this help, then exit\n");
-	printf("  -V               Print program version information, then exit\n");
-	printf("\n");
-}
-
-static void decode_arguments(int argc, char **argv)
-{
-	int cont = 1;
-	int optchar;
-	int need_fsname;
-
-	while (cont) {
-		optchar = getopt(argc, argv, OPTION_STRING);
-
-		switch (optchar) {
-		case 'n':
-			ls_all_nodes = 1;
-			break;
-
-		case 'h':
-			print_usage();
-			exit(EXIT_SUCCESS);
-			break;
-
-		case 'V':
-			printf("%s %s (built %s %s)\n",
-				prog_name, RELEASE_VERSION, __DATE__, __TIME__);
-			/* printf("%s\n", REDHAT_COPYRIGHT); */
-			exit(EXIT_SUCCESS);
-			break;
-
-		case ':':
-		case '?':
-			fprintf(stderr, "Please use '-h' for usage.\n");
-			exit(EXIT_FAILURE);
-			break;
-
-		case EOF:
-			cont = 0;
-			break;
-
-		default:
-			fprintf(stderr, "unknown option: %c\n", optchar);
-			exit(EXIT_FAILURE);
-			break;
-		};
-	}
-
-	need_fsname = 1;
-
-	while (optind < argc) {
-
-		if (!strncmp(argv[optind], "leave", 5) &&
-			   (strlen(argv[optind]) == 5)) {
-			operation = OP_LEAVE;
-			opt_ind = optind + 1;
-			break;
-		} else if (!strncmp(argv[optind], "ls", 2) &&
-			   (strlen(argv[optind]) == 2)) {
-			operation = OP_LIST;
-			opt_ind = optind + 1;
-			need_fsname = 0;
-			break;
-		} else if (!strncmp(argv[optind], "dump", 4) &&
-			   (strlen(argv[optind]) == 4)) {
-			operation = OP_DUMP;
-			opt_ind = optind + 1;
-			need_fsname = 0;
-			break;
-		} else if (!strncmp(argv[optind], "plocks", 6) &&
-			   (strlen(argv[optind]) == 6)) {
-			operation = OP_PLOCKS;
-			opt_ind = optind + 1;
-			break;
-		}
-
-		optind++;
-	}
-
-	if (!operation || !opt_ind) {
-		print_usage();
-		exit(EXIT_FAILURE);
-	}
-
-	if (optind < argc - 1)
-		fsname = argv[opt_ind];
-	else if (need_fsname) {
-		fprintf(stderr, "fs name required\n");
-		exit(EXIT_FAILURE);
-	}
-}
-
-static int do_write(int fd, void *buf, size_t count)
-{
-	int rv, off = 0;
-
- retry:
-	rv = write(fd, buf + off, count);
-	if (rv == -1 && errno == EINTR)
-		goto retry;
-	if (rv < 0)
-		return rv;
-
-	if (rv != count) {
-		count -= rv;
-		off += rv;
-		goto retry;
-	}
-	return 0;
-}
-
-void do_leave(char *table)
-{
-	struct gfsc_mount_args ma;
-	int rv;
-
-	memset(&ma, 0, sizeof(ma));
-
-	strncpy(ma.table, table, sizeof(ma.table));
-
-	rv = gfsc_fs_leave(&ma, 0);
-	if (rv < 0)
-		fprintf(stderr, "gfs_controld leave error %d\n", rv);
-}
-
-char *mg_flags_str(uint32_t flags)
-{
-	static char str[128];
-	int i = 0;
-
-	memset(str, 0, sizeof(str));
-
-	if (flags & GFSC_MF_LOCAL_RECOVERY_BUSY) {
-		i++;
-		strcat(str, "recover");
-	}
-	if (flags & GFSC_MF_FIRST_RECOVERY_NEEDED) {
-		strcat(str, i++ ? "," : "");
-		strcat(str, "need_first");
-	}
-	if (flags & GFSC_MF_KERNEL_MOUNT_ERROR) {
-		strcat(str, i++ ? "," : "");
-		strcat(str, "error");
-	}
-	if (flags & GFSC_MF_KERNEL_MOUNT_DONE) {
-		strcat(str, i++ ? "," : "");
-		strcat(str, "mounted");
-	}
-	if (flags & GFSC_MF_KERNEL_STOPPED) {
-		strcat(str, i++ ? "," : "");
-		strcat(str, "blocked");
-	}
-	if (flags & GFSC_MF_LEAVING) {
-		strcat(str, i++ ? "," : "");
-		strcat(str, "leave");
-	}
-	if (flags & GFSC_MF_JOINING) {
-		strcat(str, i++ ? "," : "");
-		strcat(str, "join");
-	}
-
-	/* leave this one out, it will often be set and we don't need
-	   to see it */
-	/*
-	if (flags & GFSC_MF_FIRST_RECOVERY_MSG)
-		strcat(str, "first_recovery_msg ");
-	*/
-	return str;
-}
-
-char *node_mount_str(uint32_t flags)
-{
-	static char str[128];
-	int i = 0;
-
-	memset(str, 0, sizeof(str));
-
-	if (flags & GFSC_NF_KERNEL_MOUNT_DONE) {
-		i++;
-		strcat(str, "done");
-	}
-	if (flags & GFSC_NF_KERNEL_MOUNT_ERROR) {
-		strcat(str, i++ ? "," : "");
-		strcat(str, "error");
-	}
-	if (flags & GFSC_NF_READONLY) {
-		strcat(str, i++ ? "," : "");
-		strcat(str, "ro");
-	}
-	if (flags & GFSC_NF_SPECTATOR) {
-		strcat(str, i++ ? "," : "");
-		strcat(str, "spect");
-	}
-
-	if (!i)
-		strcat(str, "none");
-
-	/* ignoring CHECK_DLM */
-
-	return str;
-}
-
-int member_int(struct gfsc_node *n)
-{
-	if (n->flags & GFSC_NF_DISALLOWED)
-		return -1;
-	if (n->flags & GFSC_NF_MEMBER)
-		return 1;
-	return 0;
-}
-
-char *condition_str(int cond)
-{
-	switch (cond) {
-	case 0:
-		return "";
-	case 1:
-		return "kernel_mount_done";
-	case 2:
-		return "notify_nodeid";
-	case 3:
-		return "poll_dlm";
-	case 4:
-		return "pending";
-	default:
-		return "unknown";
-	}
-}
-
-static void show_nodeids(int count, struct gfsc_node *nodes)
-{
-	struct gfsc_node *n = nodes;
-	int i;
-
-	for (i = 0; i < count; i++) {
-		printf("%d ", n->nodeid);
-		n++;
-	}
-	printf("\n");
-}
-
-static int node_compare(const void *va, const void *vb)
-{
-	const struct gfsc_node *a = va;
-	const struct gfsc_node *b = vb;
-
-	return a->nodeid - b->nodeid;
-}
-
-static void show_mg(struct gfsc_mountgroup *mg)
-{
-	int rv, node_count;
-
-	printf("name          %s\n", mg->name);
-	printf("id            0x%08x\n", mg->global_id);
-	printf("flags         0x%08x %s\n",
-		mg->flags, mg_flags_str(mg->flags));
-	printf("change        member %d joined %d remove %d failed %d seq %d,%d\n",
-		mg->cg_prev.member_count, mg->cg_prev.joined_count,
-		mg->cg_prev.remove_count, mg->cg_prev.failed_count,
-	        mg->cg_prev.combined_seq, mg->cg_prev.seq);
-
-	node_count = 0;
-	memset(&nodes, 0, sizeof(nodes));
-	rv = gfsc_mountgroup_nodes(mg->name, GFSC_NODES_MEMBERS,
-				   MAX_NODES, &node_count, nodes);
-	if (rv < 0) {
-		printf("members       error\n");
-		goto next;
-	}
-	qsort(nodes, node_count, sizeof(struct gfsc_node), node_compare);
-
-	printf("members       ");
-	show_nodeids(node_count, nodes);
-
- next:
-	if (!mg->cg_next.seq)
-		return;
-
-	printf("new change    member %d joined %d remove %d failed %d seq %d,%d\n",
-		mg->cg_next.member_count, mg->cg_next.joined_count,
-		mg->cg_next.remove_count, mg->cg_next.failed_count,
-		mg->cg_next.combined_seq, mg->cg_next.seq);
-
-	printf("new status    wait_messages %d wait_condition %d %s\n",
-		mg->cg_next.wait_messages, mg->cg_next.wait_condition,
-		condition_str(mg->cg_next.wait_condition));
-
-	node_count = 0;
-	memset(&nodes, 0, sizeof(nodes));
-	rv = gfsc_mountgroup_nodes(mg->name, GFSC_NODES_NEXT,
-				   MAX_NODES, &node_count, nodes);
-	if (rv < 0) {
-		printf("new members   error\n");
-		return;
-	}
-	qsort(nodes, node_count, sizeof(struct gfsc_node), node_compare);
-
-	printf("new members ");
-	show_nodeids(node_count, nodes);
-}
-
-static void show_all_nodes(int count, struct gfsc_node *nodes)
-{
-	struct gfsc_node *n = nodes;
-	int i;
-
-	for (i = 0; i < count; i++) {
-		printf("nodeid %d jid %d member %d failed %d start %d seq_add %u seq_rem %u mount %s\n",
-			n->nodeid,
-			n->jid,
-			member_int(n),
-			n->failed_reason,
-			(n->flags & GFSC_NF_START) ? 1 : 0,
-			n->added_seq,
-			n->removed_seq,
-			node_mount_str(n->flags));
-		n++;
-	}
-}
-
-static void do_list(char *name)
-{
-	struct gfsc_mountgroup *mg;
-	int node_count;
-	int mg_count;
-	int rv;
-	int i;
-
-	memset(mgs, 0, sizeof(mgs));
-
-	if (name) {
-		rv = gfsc_mountgroup_info(name, mgs);
-		if (rv < 0)
-			return;
-		mg_count = 1;
-	} else {
-		rv = gfsc_mountgroups(MAX_MG, &mg_count, mgs);
-		if (rv < 0)
-			return;
-	}
-
-	if (mg_count)
-		printf("gfs mountgroups\n");
-
-	for (i = 0; i < mg_count; i++) {
-		mg = &mgs[i];
-
-		show_mg(mg);
-
-		if (!ls_all_nodes)
-			goto next;
-
-		node_count = 0;
-		memset(&nodes, 0, sizeof(nodes));
-
-		rv = gfsc_mountgroup_nodes(mg->name, GFSC_NODES_ALL,
-					   MAX_NODES, &node_count, nodes);
-		if (rv < 0) {
-			printf("all nodes error %d %d\n", rv, errno);
-			goto next;
-		}
-
-		qsort(nodes, node_count, sizeof(struct gfsc_node),node_compare);
-
-		printf("all nodes\n");
-		show_all_nodes(node_count, nodes);
- next:
-		printf("\n");
-	}
-}
-
-static void do_plocks(char *name)
-{
-	char buf[GFSC_DUMP_SIZE];
-
-	memset(buf, 0, sizeof(buf));
-
-	gfsc_dump_plocks(name, buf);
-
-	do_write(STDOUT_FILENO, buf, strlen(buf));
-}
-
-static void do_dump(void)
-{
-	char buf[GFSC_DUMP_SIZE];
-
-	memset(buf, 0, sizeof(buf));
-
-	gfsc_dump_debug(buf);
-
-	do_write(STDOUT_FILENO, buf, strlen(buf));
-}
-
-int main(int argc, char **argv)
-{
-	prog_name = argv[0];
-	decode_arguments(argc, argv);
-
-	switch (operation) {
-
-	case OP_LEAVE:
-		do_leave(fsname);
-		break;
-
-	case OP_LIST:
-		do_list(fsname);
-		break;
-
-	case OP_DUMP:
-		do_dump();
-		break;
-
-	case OP_PLOCKS:
-		do_plocks(fsname);
-		break;
-	}
-	return 0;
-}
-
diff --git a/group/gfs_controld/Makefile b/group/gfs_controld/Makefile
deleted file mode 100644
index 0b3a9e7..0000000
--- a/group/gfs_controld/Makefile
+++ /dev/null
@@ -1,51 +0,0 @@
-TARGET= gfs_controld
-
-SBINDIRT=$(TARGET)
-
-all: depends ${TARGET}
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-OBJS= 	main.o \
-	member_cman.o \
-	config.o \
-	crc.o \
-	cpg-new.o \
-	cpg-old.o \
-	group.o \
-	util.o \
-	plock.o \
-	logging.o
-
-CFLAGS += -I${ccsincdir} -I${cmanincdir} -I${logtincdir} -I${dlmcontrolincdir}
-CFLAGS += -I${corosyncincdir} -I${openaisincdir}
-CFLAGS += -I${KERNEL_SRC}/include/
-CFLAGS += -I$(S)/../libgfscontrol -I$(S)/../../fence/libfenced/
-CFLAGS += -I$(S)/../lib/ -I$(S)/../include/
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${ccslibdir} -lccs -L${cmanlibdir} -lcman
-LDFLAGS += -L${dlmcontrollibdir} -ldlmcontrol
-LDFLAGS += -L${logtlibdir} -llogthread
-LDFLAGS += -L${corosynclibdir} -lcpg -lpthread
-LDFLAGS += -L${openaislibdir} -lSaCkpt
-LDFLAGS += -L../../fence/libfenced/ -lfenced
-LDFLAGS += -L../lib -lgroup
-LDFLAGS += -L${libdir}
-
-LDDEPS += ../lib/libgroup.a
-LDDEPS += ../../fence/libfenced/libfenced.a
-
-${TARGET}: ${OBJS} ${LDDEPS}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-depends:
-	$(MAKE) -C ../lib all
-
-clean: generalclean
-
--include $(OBJS:.o=.d)
diff --git a/group/gfs_controld/config.c b/group/gfs_controld/config.c
deleted file mode 100644
index b6e2ebe..0000000
--- a/group/gfs_controld/config.c
+++ /dev/null
@@ -1,221 +0,0 @@
-#include <sys/types.h>
-#include <asm/types.h>
-#include <sys/uio.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <sys/utsname.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <net/if.h>
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <fcntl.h>
-#include <netdb.h>
-#include <limits.h>
-#include <unistd.h>
-#include <dirent.h>
-
-#include "gfs_daemon.h"
-#include "config.h"
-#include "ccs.h"
-
-int ccs_handle;
-
-/* was a config value set on command line?, 0 or 1. */
-
-int optd_groupd_compat;
-int optd_debug_logfile;
-int optd_enable_withdraw;
-int optd_enable_plock;
-int optd_plock_debug;
-int optd_plock_rate_limit;
-int optd_plock_ownership;
-int optd_drop_resources_time;
-int optd_drop_resources_count;
-int optd_drop_resources_age;
-
-/* actual config value from command line, cluster.conf, or default. */
-
-int cfgd_groupd_compat		= DEFAULT_GROUPD_COMPAT;
-int cfgd_debug_logfile		= DEFAULT_DEBUG_LOGFILE;
-int cfgd_enable_withdraw	= DEFAULT_ENABLE_WITHDRAW;
-int cfgd_enable_plock		= DEFAULT_ENABLE_PLOCK;
-int cfgd_plock_debug		= DEFAULT_PLOCK_DEBUG;
-int cfgd_plock_rate_limit	= DEFAULT_PLOCK_RATE_LIMIT;
-int cfgd_plock_ownership	= DEFAULT_PLOCK_OWNERSHIP;
-int cfgd_drop_resources_time	= DEFAULT_DROP_RESOURCES_TIME;
-int cfgd_drop_resources_count	= DEFAULT_DROP_RESOURCES_COUNT;
-int cfgd_drop_resources_age	= DEFAULT_DROP_RESOURCES_AGE;
-
-void read_ccs_name(char *path, char *name)
-{
-	char *str;
-	int error;
-
-	error = ccs_get(ccs_handle, path, &str);
-	if (error || !str)
-		return;
-
-	strcpy(name, str);
-
-	free(str);
-}
-
-void read_ccs_yesno(char *path, int *yes, int *no)
-{
-	char *str;
-	int error;
-
-	*yes = 0;
-	*no = 0;
-
-	error = ccs_get(ccs_handle, path, &str);
-	if (error || !str)
-		return;
-
-	if (!strcmp(str, "yes"))
-		*yes = 1;
-
-	else if (!strcmp(str, "no"))
-		*no = 1;
-
-	free(str);
-}
-
-int read_ccs_int(char *path, int *config_val)
-{
-	char *str;
-	int val;
-	int error;
-
-	error = ccs_get(ccs_handle, path, &str);
-	if (error || !str)
-		return -1;
-
-	val = atoi(str);
-
-	if (val < 0) {
-		log_error("ignore invalid value %d for %s", val, path);
-		return -1;
-	}
-
-	*config_val = val;
-	log_debug("%s is %u", path, val);
-	free(str);
-	return 0;
-}
-
-#define LOCKSPACE_NODIR "/cluster/dlm/lockspace[@name=\"%s\"]/@nodir"
-
-void read_ccs_nodir(struct mountgroup *mg, char *buf)
-{
-	char path[PATH_MAX];
-	char *str;
-	int val;
-	int error;
-
-	memset(path, 0, PATH_MAX);
-	sprintf(path, LOCKSPACE_NODIR, mg->name);
-
-	error = ccs_get(ccs_handle, path, &str);
-	if (error || !str)
-		return;
-
-	val = atoi(str);
-
-	if (val < 0) {
-		log_error("ignore invalid value %d for %s", val, path);
-		return;
-	}
-
-	snprintf(buf, 32, ":nodir=%d", val);
-
-	log_debug("%s is %u", path, val);
-	free(str);
-}
-
-#define GROUPD_COMPAT_PATH "/cluster/group/@groupd_compat"
-#define ENABLE_WITHDRAW_PATH "/cluster/gfs_controld/@enable_withdraw"
-#define ENABLE_PLOCK_PATH "/cluster/gfs_controld/@enable_plock"
-#define PLOCK_DEBUG_PATH "/cluster/gfs_controld/@plock_debug"
-#define PLOCK_RATE_LIMIT_PATH "/cluster/gfs_controld/@plock_rate_limit"
-#define PLOCK_OWNERSHIP_PATH "/cluster/gfs_controld/@plock_ownership"
-#define DROP_RESOURCES_TIME_PATH "/cluster/gfs_controld/@drop_resources_time"
-#define DROP_RESOURCES_COUNT_PATH "/cluster/gfs_controld/@drop_resources_count"
-#define DROP_RESOURCES_AGE_PATH "/cluster/gfs_controld/@drop_resources_age"
-
-#define DLM_PLOCK_RATE_LIMIT_PATH "/cluster/dlm/@plock_rate_limit"
-#define DLM_PLOCK_OWNERSHIP_PATH "/cluster/dlm/@plock_ownership"
-#define DLM_DROP_RESOURCES_TIME_PATH "/cluster/dlm/@drop_resources_time"
-#define DLM_DROP_RESOURCES_COUNT_PATH "/cluster/dlm/@drop_resources_count"
-#define DLM_DROP_RESOURCES_AGE_PATH "/cluster/dlm/@drop_resources_age"
-
-int setup_ccs(void)
-{
-	int cd, rv;
-
-	if (ccs_handle)
-		goto update;
-
-	cd = ccs_connect();
-	if (cd < 0) {
-		log_error("ccs_connect error %d %d", cd, errno);
-		return -1;
-	}
-	ccs_handle = cd;
-
-	/* These config values are set from cluster.conf only if they haven't
-	   already been set on the command line. */
-
-	if (!optd_groupd_compat)
-		read_ccs_int(GROUPD_COMPAT_PATH, &cfgd_groupd_compat);
-	if (!optd_enable_withdraw)
-		read_ccs_int(ENABLE_WITHDRAW_PATH, &cfgd_enable_withdraw);
-	if (!optd_enable_plock)
-		read_ccs_int(ENABLE_PLOCK_PATH, &cfgd_enable_plock);
-	if (!optd_plock_ownership) {
-		rv = read_ccs_int(PLOCK_OWNERSHIP_PATH, &cfgd_plock_ownership);
-		if (rv < 0)
-			read_ccs_int(DLM_PLOCK_OWNERSHIP_PATH, &cfgd_plock_ownership);
-	}
-
-	/* The following can be changed while running */
- update:
-	if (!optd_plock_debug) {
-		read_ccs_int(PLOCK_DEBUG_PATH, &cfgd_plock_debug);
-	}
-	if (!optd_plock_rate_limit) {
-		rv = read_ccs_int(PLOCK_RATE_LIMIT_PATH, &cfgd_plock_rate_limit);
-		if (rv < 0)
-			read_ccs_int(DLM_PLOCK_RATE_LIMIT_PATH, &cfgd_plock_rate_limit);
-	}
-	if (!optd_drop_resources_time) {
-		rv = read_ccs_int(DROP_RESOURCES_TIME_PATH, &cfgd_drop_resources_time);
-		if (rv < 0)
-			read_ccs_int(DLM_DROP_RESOURCES_TIME_PATH, &cfgd_drop_resources_time);
-	}
-	if (!optd_drop_resources_count) {
-		rv = read_ccs_int(DROP_RESOURCES_COUNT_PATH, &cfgd_drop_resources_count);
-		if (rv < 0)
-			read_ccs_int(DLM_DROP_RESOURCES_COUNT_PATH, &cfgd_drop_resources_count);
-	}
-	if (!optd_drop_resources_age) {
-		rv = read_ccs_int(DROP_RESOURCES_AGE_PATH, &cfgd_drop_resources_age);
-		if (rv < 0)
-			read_ccs_int(DLM_DROP_RESOURCES_AGE_PATH, &cfgd_drop_resources_age);
-	}
-
-	return 0;
-}
-
-void close_ccs(void)
-{
-	ccs_disconnect(ccs_handle);
-}
-
diff --git a/group/gfs_controld/config.h b/group/gfs_controld/config.h
deleted file mode 100644
index ee0b3b6..0000000
--- a/group/gfs_controld/config.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef __CONFIG_DOT_H__
-#define __CONFIG_DOT_H__
-
-#define DEFAULT_GROUPD_COMPAT 2
-#define DEFAULT_DEBUG_LOGFILE 0
-#define DEFAULT_ENABLE_WITHDRAW 1
-#define DEFAULT_ENABLE_PLOCK 1
-#define DEFAULT_PLOCK_DEBUG 0
-#define DEFAULT_PLOCK_RATE_LIMIT 100
-#define DEFAULT_PLOCK_OWNERSHIP 1
-#define DEFAULT_DROP_RESOURCES_TIME 10000 /* 10 sec */
-#define DEFAULT_DROP_RESOURCES_COUNT 10
-#define DEFAULT_DROP_RESOURCES_AGE 10000 /* 10 sec */
-
-extern int optd_groupd_compat;
-extern int optd_debug_logfile;
-extern int optd_enable_withdraw;
-extern int optd_enable_plock;
-extern int optd_plock_debug;
-extern int optd_plock_rate_limit;
-extern int optd_plock_ownership;
-extern int optd_drop_resources_time;
-extern int optd_drop_resources_count;
-extern int optd_drop_resources_age;
-
-extern int cfgd_groupd_compat;
-extern int cfgd_debug_logfile;
-extern int cfgd_enable_withdraw;
-extern int cfgd_enable_plock;
-extern int cfgd_plock_debug;
-extern int cfgd_plock_rate_limit;
-extern int cfgd_plock_ownership;
-extern int cfgd_drop_resources_time;
-extern int cfgd_drop_resources_count;
-extern int cfgd_drop_resources_age;
-
-#endif
-
diff --git a/group/gfs_controld/cpg-new.c b/group/gfs_controld/cpg-new.c
deleted file mode 100644
index 9d8d5dd..0000000
--- a/group/gfs_controld/cpg-new.c
+++ /dev/null
@@ -1,3476 +0,0 @@
-#include "gfs_daemon.h"
-#include "config.h"
-#include "libdlmcontrol.h"
-
-#define MAX_JOURNALS 256
-
-uint32_t cpgname_to_crc(const char *data, int len);
-
-/* gfs_header types */
-enum {
-	GFS_MSG_PROTOCOL		= 1,
-	GFS_MSG_START			= 2,
-	GFS_MSG_MOUNT_DONE		= 3,
-	GFS_MSG_FIRST_RECOVERY_DONE	= 4,
-	GFS_MSG_RECOVERY_RESULT		= 5,
-	GFS_MSG_REMOUNT			= 6,
-	GFS_MSG_WITHDRAW		= 7,
-	GFS_MSG_WITHDRAW_ACK		= 8,
-};
-
-/* gfs_header flags */
-#define GFS_MFLG_JOINING   1  /* accompanies start, we are joining */
-
-struct gfs_header {
-	uint16_t version[3];	/* daemon_run protocol */
-	uint16_t type;          /* GFS_MSG_ */
-	uint32_t nodeid;        /* sender */
-	uint32_t to_nodeid;     /* recipient, 0 for all */
-	uint32_t global_id;     /* global unique id for this lockspace */
-	uint32_t flags;         /* GFS_MFLG_ */
-	uint32_t msgdata;       /* in-header payload depends on MSG type */
-	uint32_t pad1;
-	uint64_t pad2;
-};
-
-struct protocol_version {
-	uint16_t major;
-	uint16_t minor;
-	uint16_t patch;
-	uint16_t flags;
-};
-
-struct protocol {
-	union {
-		struct protocol_version dm_ver;
-		uint16_t		daemon_max[4];
-	};
-	union {
-		struct protocol_version km_ver;
-		uint16_t		kernel_max[4];
-	};
-	union {
-		struct protocol_version dr_ver;
-		uint16_t		daemon_run[4];
-	};
-	union {
-		struct protocol_version kr_ver;
-		uint16_t		kernel_run[4];
-	};
-};
-
-/* mg_info and id_info: for syncing state in start message */
-
-struct mg_info {
-	uint32_t mg_info_size;
-	uint32_t id_info_size;
-	uint32_t id_info_count;
-
-	uint32_t started_count;
-
-	int member_count;
-	int joined_count;
-	int remove_count;
-	int failed_count;
-
-	int first_recovery_needed;
-	int first_recovery_master;
-};
-
-#define IDI_NODEID_IS_MEMBER	0x00000001
-#define IDI_JID_NEEDS_RECOVERY	0x00000002
-#define IDI_MOUNT_DONE		0x00000008
-#define IDI_MOUNT_ERROR		0x00000010
-#define IDI_MOUNT_RO		0x00000020
-#define IDI_MOUNT_SPECTATOR	0x00000040
-
-struct id_info {
-	int nodeid;
-	int jid;
-	uint32_t flags;
-};
-
-#define JID_NONE -1
-
-struct journal {
-	struct list_head list;
-	int jid;
-	int nodeid;
-	int failed_nodeid;
-	int needs_recovery;
-
-	int local_recovery_busy;
-	int local_recovery_done;
-	int local_recovery_result;
-	int failed_recovery_count;
-};
-
-struct node {
-	struct list_head list;
-	int nodeid;
-	int jid;
-	int ro;
-	int spectator;
-	int kernel_mount_done;
-	int kernel_mount_error;
-
-	int check_dlm;
-	int dlm_notify_callback;
-	int dlm_notify_result;
-
-	int failed_reason;
-	uint32_t added_seq;
-	uint32_t removed_seq;
-	uint64_t add_time;
-
-	int withdraw;
-	int send_withdraw_ack;
-
-	struct protocol proto;
-};
-
-struct member {
-	struct list_head list;
-	int nodeid;
-	int start;   /* 1 if we received a start message for this change */
-	int added;   /* 1 if added by this change */
-	int failed;  /* 1 if failed in this change */
-	int disallowed;
-	char *start_msg; /* full copy of the start message from this node */
-	struct mg_info *mg_info; /* shortcut into started_msg */
-};
-
-/* One of these change structs is created for every confchg a cpg gets. */
-
-#define CGST_WAIT_CONDITIONS 1
-#define CGST_WAIT_MESSAGES   2
-
-struct change {
-	struct list_head list;
-	struct list_head members;
-	struct list_head removed; /* nodes removed by this change */
-	struct list_head saved_messages; /* saved messages */
-	int member_count;
-	int joined_count;
-	int remove_count;
-	int failed_count;
-	int state;
-	int we_joined;
-	uint32_t seq; /* used as a reference for debugging, and for queries */
-	uint32_t combined_seq; /* for queries */
-};
-
-struct save_msg {
-	struct list_head list;
-	int len;
-	char buf[0];
-};
-
-static int dlmcontrol_fd;
-static int daemon_cpg_fd;
-static struct protocol our_protocol;
-static struct list_head daemon_nodes;
-static struct cpg_address daemon_member[MAX_NODES];
-static int daemon_member_count;
-
-/* 
-   cpg confchg's arrive telling us that mountgroup members have
-   joined/left/failed.  A "change" struct is created for each confchg,
-   and added to the mg->changes list.
-
-   apply_changes()
-   ---------------
-
-   <a new node won't know whether first_recovery_needed or not, but it also
-    won't have any conditions to wait for, so a new node will go directly to
-    sending out start message regardless>
-
-   if first_recovery_needed,
-   (or new, where new is not having completed a start barrier yet)
-   all nodes: skip wait conditions
-   all nodes: send start message
-
-   else !first_recovery_needed,
-   all nodes: if failures in changes, wait for conditions:
-              local mount to complete if in progress, stop_kernel, dlm_notified
-   all nodes: send start message
-
-   <new changes that arrive result in going back to beginning; start messages
-    from this aborted start cycle will be ignored>
-
-   all nodes: wait for all start messages
-
-   <once all start messages are received, new changes will be handled in a
-    new batch after all current changes are cleared at end of sync_state>
-
-   if start cycle / start barrier completes (start messages received from
-   all nodes without being interrupted by a change), go on to sync_state
-   which puts all members (as defined by the most recent change) in sync.
-
-   "old nodes" are nodes that have completed a start cycle before (have
-   a non-zero started_count), and "new nodes" are nodes that have not
-   completed a start cycle before (they are being added by one of the
-   changes in this start cycle)
-
-   sync_state()
-   ------------
-
-   if old nodes have first_recovery_needed, or all nodes are new
-   all nodes: mg->first_recovery_needed = 1
-   all nodes: mg->first_recovery_master = prev or new low nodeid
-   new nodes: instantiate existing state to match old nodes
-   old nodes: update state per the changes in the completed start cycle
-   all nodes: assign jids to new members
-   all nodes: clear all change structs
-
-   else !first_recovery_needed,
-   new nodes: instantiate existing state to match old nodes
-   old nodes: update state per the changes in the completed start cycle
-   all nodes: assign jids to new members
-   all nodes: clear all change structs
-
-   <new changes that arrive from here on result in going back to the top>
-
-   apply_recovery()
-   ----------------
-
-   if first_recovery_needed,
-   master:    tells mount to run with first=1 (if not already)
-   all nodes: wait for first_recovery_done message
-   master:    sends first_recovery_done message when mount is done
-   all nodes: mg->first_recovery_needed = 0
-   all nodes: start kernel / tell mount.gfs to mount(2) (master already did)
-   all nodes: send message with result of kernel mount
-
-   else !first_recovery_needed,
-   all nodes: if there are no journals to recover, goto start kernel
-   old nodes: tell kernel to recover jids, send message with each result
-   all nodes: wait for all recoveries to be done
-   all nodes: start kernel
-   new nodes: tell mount.gfs to mount(2)
-   new nodes: send message with result of kernel mount
-
-   [If no one can recover some journal(s), all will be left waiting, unstarted.
-    A new change from a new mount will result in things going back to the top,
-    and hopefully the new node will be successful at doing the journal
-    recoveries when it comes through the apply_recovery() section, which
-    would let everyone start again.]
-*/
-
-static void apply_changes_recovery(struct mountgroup *mg);
-static void send_withdraw_acks(struct mountgroup *mg);
-static void leave_mountgroup(struct mountgroup *mg, int mnterr);
-
-static char *msg_name(int type)
-{
-	switch (type) {
-	case GFS_MSG_PROTOCOL:
-		return "protocol";
-	case GFS_MSG_START:
-		return "start";
-	case GFS_MSG_MOUNT_DONE:
-		return "mount_done";
-	case GFS_MSG_FIRST_RECOVERY_DONE:
-		return "first_recovery_done";
-	case GFS_MSG_RECOVERY_RESULT:
-		return "recovery_result";
-	case GFS_MSG_REMOUNT:
-		return "remount";
-	case GFS_MSG_WITHDRAW:
-		return "withdraw";
-	case GFS_MSG_WITHDRAW_ACK:
-		return "withdraw_ack";
-	default:
-		return "unknown";
-	}
-}
-
-static int _send_message(cpg_handle_t h, void *buf, int len, int type)
-{
-	struct iovec iov;
-	cpg_error_t error;
-	int retries = 0;
-
-	iov.iov_base = buf;
-	iov.iov_len = len;
-
- retry:
-	error = cpg_mcast_joined(h, CPG_TYPE_AGREED, &iov, 1);
-	if (error == CPG_ERR_TRY_AGAIN) {
-		retries++;
-		usleep(1000);
-		if (!(retries % 100))
-			log_error("cpg_mcast_joined retry %d %s",
-				   retries, msg_name(type));
-		goto retry;
-	}
-	if (error != CPG_OK) {
-		log_error("cpg_mcast_joined error %d handle %llx %s",
-			  error, (unsigned long long)h, msg_name(type));
-		return -1;
-	}
-
-	if (retries)
-		log_debug("cpg_mcast_joined retried %d %s",
-			  retries, msg_name(type));
-
-	return 0;
-}
-
-/* header fields caller needs to set: type, to_nodeid, flags, msgdata */
-
-static void gfs_send_message(struct mountgroup *mg, char *buf, int len)
-{
-	struct gfs_header *hd = (struct gfs_header *) buf;
-	int type = hd->type;
-
-	hd->version[0]  = cpu_to_le16(our_protocol.daemon_run[0]);
-	hd->version[1]  = cpu_to_le16(our_protocol.daemon_run[1]);
-	hd->version[2]  = cpu_to_le16(our_protocol.daemon_run[2]);
-	hd->type	= cpu_to_le16(hd->type);
-	hd->nodeid      = cpu_to_le32(our_nodeid);
-	hd->to_nodeid   = cpu_to_le32(hd->to_nodeid);
-	hd->global_id   = cpu_to_le32(mg->id);
-	hd->flags       = cpu_to_le32(hd->flags);
-	hd->msgdata     = cpu_to_le32(hd->msgdata);
-
-	_send_message(mg->cpg_handle, buf, len, type);
-}
-
-static struct member *find_memb(struct change *cg, int nodeid)
-{
-	struct member *memb;
-
-	list_for_each_entry(memb, &cg->members, list) {
-		if (memb->nodeid == nodeid)
-			return memb;
-	}
-	return NULL;
-}
-
-static struct mountgroup *find_mg_handle(cpg_handle_t h)
-{
-	struct mountgroup *mg;
-
-	list_for_each_entry(mg, &mountgroups, list) {
-		if (mg->cpg_handle == h)
-			return mg;
-	}
-	return NULL;
-}
-
-static struct mountgroup *find_mg_ci(int ci)
-{
-	struct mountgroup *mg;
-
-	list_for_each_entry(mg, &mountgroups, list) {
-		if (mg->cpg_client == ci)
-			return mg;
-	}
-	return NULL;
-}
-
-static struct journal *find_journal(struct mountgroup *mg, int jid)
-{
-	struct journal *j;
-
-	list_for_each_entry(j, &mg->journals, list) {
-		if (j->jid == jid)
-			return j;
-	}
-	return NULL;
-}
-
-static struct journal *find_journal_by_nodeid(struct mountgroup *mg, int nodeid)
-{
-	struct journal *j;
-
-	list_for_each_entry(j, &mg->journals, list) {
-		if (j->nodeid == nodeid)
-			return j;
-	}
-	return NULL;
-}
-
-static void free_cg(struct change *cg)
-{
-	struct member *memb, *safe;
-	struct save_msg *sm, *sm2;
-
-	list_for_each_entry_safe(memb, safe, &cg->members, list) {
-		list_del(&memb->list);
-		if (memb->start_msg)
-			free(memb->start_msg);
-		free(memb);
-	}
-	list_for_each_entry_safe(memb, safe, &cg->removed, list) {
-		list_del(&memb->list);
-		if (memb->start_msg)
-			free(memb->start_msg);
-		free(memb);
-	}
-	list_for_each_entry_safe(sm, sm2, &cg->saved_messages, list) {
-		list_del(&sm->list);
-		free(sm);
-	}
-	free(cg);
-}
-
-void free_mg(struct mountgroup *mg)
-{
-	struct change *cg, *cg_safe;
-	struct node *node, *node_safe;
-
-	list_for_each_entry_safe(cg, cg_safe, &mg->changes, list) {
-		list_del(&cg->list);
-		free_cg(cg);
-	}
-
-	if (mg->started_change)
-		free_cg(mg->started_change);
-
-	list_for_each_entry_safe(node, node_safe, &mg->node_history, list) {
-		list_del(&node->list);
-		free(node);
-	}
-
-	free(mg);
-}
-
-static struct node *get_node_history(struct mountgroup *mg, int nodeid)
-{
-	struct node *node;
-
-	list_for_each_entry(node, &mg->node_history, list) {
-		if (node->nodeid == nodeid)
-			return node;
-	}
-	return NULL;
-}
-
-static void node_history_init(struct mountgroup *mg, int nodeid,
-			      struct change *cg)
-{
-	struct node *node;
-
-	node = get_node_history(mg, nodeid);
-	if (node) {
-		list_del(&node->list);
-		goto out;
-	}
-
-	node = malloc(sizeof(struct node));
-	if (!node) {
-		log_error("node_history_init no mem");
-		return;
-	}
- out:
-	memset(node, 0, sizeof(struct node));
-
-	node->nodeid = nodeid;
-	node->add_time = 0;
-	list_add_tail(&node->list, &mg->node_history);
-	node->added_seq = cg->seq;	/* for queries */
-}
-
-static void node_history_start(struct mountgroup *mg, int nodeid)
-{
-	struct node *node;
-	
-	node = get_node_history(mg, nodeid);
-	if (!node) {
-		log_error("node_history_start no nodeid %d", nodeid);
-		return;
-	}
-
-	node->add_time = time(NULL);
-}
-
-static void node_history_left(struct mountgroup *mg, int nodeid,
-			      struct change *cg)
-{
-	struct node *node;
-
-	node = get_node_history(mg, nodeid);
-	if (!node) {
-		log_error("node_history_left no nodeid %d", nodeid);
-		return;
-	}
-
-	node->add_time = 0;
-	node->removed_seq = cg->seq;	/* for queries */
-}
-
-static void node_history_fail(struct mountgroup *mg, int nodeid,
-			      struct change *cg, int reason)
-{
-	struct node *node;
-
-	node = get_node_history(mg, nodeid);
-	if (!node) {
-		log_error("node_history_fail no nodeid %d", nodeid);
-		return;
-	}
-
-	node->check_dlm = 1;
-
-	node->removed_seq = cg->seq;	/* for queries */
-	node->failed_reason = reason;	/* for queries */
-}
-
-static int is_added(struct mountgroup *mg, int nodeid)
-{
-	struct change *cg;
-	struct member *memb;
-
-	list_for_each_entry(cg, &mg->changes, list) {
-		memb = find_memb(cg, nodeid);
-		if (memb && memb->added)
-			return 1;
-	}
-	return 0;
-}
-
-static int is_withdraw(struct mountgroup *mg, int nodeid)
-{
-	struct node *node;
-
-	node = get_node_history(mg, nodeid);
-	if (!node) {
-		log_error("is_withdraw no nodeid %d", nodeid);
-		return 0;
-	}
-	return node->withdraw;
-}
-
-static int journals_need_recovery(struct mountgroup *mg)
-{
-	struct change *cg;
-	struct journal *j;
-	struct member *memb;
-	int count = 0;
-
-	list_for_each_entry(j, &mg->journals, list)
-		if (j->needs_recovery)
-			count++;
-
-	list_for_each_entry(cg, &mg->changes, list) {
-		list_for_each_entry(memb, &cg->removed, list) {
-			if (!memb->failed && !is_withdraw(mg, memb->nodeid))
-				continue;
-			/* check whether this node had a journal assigned? */
-			count++;
-		}
-	}
-
-	return count;
-}
-
-/* find a start message from an old node to use; it doesn't matter which old
-   node we take the start message from, they should all be the same */
-
-static int get_id_list(struct mountgroup *mg, struct id_info **ids,
-		       int *count, int *size)
-{
-	struct change *cg;
-	struct member *memb;
-
-	cg = list_first_entry(&mg->changes, struct change, list);
-
-	list_for_each_entry(memb, &cg->members, list) {
-		if (!memb->mg_info->started_count)
-			continue;
-
-		*count = memb->mg_info->id_info_count;
-		*size = memb->mg_info->id_info_size;
-		*ids = (struct id_info *)(memb->start_msg +
-					  sizeof(struct gfs_header) +
-					  memb->mg_info->mg_info_size);
-		return 0;
-	}
-	return -1;
-}
-
-static struct id_info *get_id_struct(struct id_info *ids, int count, int size,
-				     int nodeid)
-{
-	struct id_info *id = ids;
-	int i;
-
-	for (i = 0; i < count; i++) {
-		if (id->nodeid == nodeid)
-			return id;
-		id = (struct id_info *)((char *)id + size);
-	}
-	return NULL;
-}
-
-static void start_kernel(struct mountgroup *mg)
-{
-	struct change *cg = mg->started_change;
-
-	if (!mg->kernel_stopped) {
-		log_error("start_kernel cg %u not stopped", cg->seq);
-		return;
-	}
-
-	log_group(mg, "start_kernel cg %u member_count %d",
-		  cg->seq, cg->member_count);
-
-	set_sysfs(mg, "block", 0);
-	mg->kernel_stopped = 0;
-
-	if (mg->joining) {
-		client_reply_join_full(mg, 0);
-		mg->joining = 0;
-		mg->mount_client_notified = 1;
-	}
-}
-
-static void stop_kernel(struct mountgroup *mg)
-{
-	if (!mg->kernel_stopped) {
-		log_group(mg, "stop_kernel");
-		set_sysfs(mg, "block", 1);
-		mg->kernel_stopped = 1;
-	}
-}
-
-void process_dlmcontrol(int ci)
-{
-	struct mountgroup *mg;
-	struct node *node;
-	char name[GFS_MOUNTGROUP_LEN+1];
-	int rv, type, nodeid, result;
-
-	memset(name, 0, sizeof(name));
-
-	rv = dlmc_fs_result(dlmcontrol_fd, name, &type, &nodeid, &result);
-	if (rv) {
-		log_error("process_dlmcontrol dlmc_fs_result %d", rv);
-		return;
-	}
-
-	mg = find_mg(name);
-	if (!mg) {
-		log_error("process_dlmcontrol no mg %s", name);
-		return;
-	}
-
-	if (type == DLMC_RESULT_NOTIFIED) {
-		log_group(mg, "process_dlmcontrol notified nodeid %d result %d",
-			  nodeid, result);
-
-		node = get_node_history(mg, nodeid);
-		if (!node) {
-			/* shouldn't happen */
-			log_error("process_dlmcontrol no nodeid %d", nodeid);
-			return;
-		}
-
-		if (mg->dlm_notify_nodeid != nodeid) {
-			/* shouldn't happen */
-			log_error("process_dlmcontrol node %d expected %d",
-				  nodeid, mg->dlm_notify_nodeid);
-			return;
-		}
-
-		mg->dlm_notify_nodeid = 0;
-		node->dlm_notify_callback = 1;
-		node->dlm_notify_result = result;
-
-	} else if (type == DLMC_RESULT_REGISTER) {
-		log_group(mg, "process_dlmcontrol register nodeid %d result %d",
-			  nodeid, result);
-	} else {
-		log_group(mg, "process_dlmcontrol unknown type %d", type);
-	}
-
-	poll_dlm = 0;
-
-	apply_changes_recovery(mg);
-}
-
-static int check_dlm_notify_done(struct mountgroup *mg)
-{
-	struct node *node;
-	int rv;
-
-	/* we're waiting for a notify result from the dlm (could we fire off
-	   all dlmc_fs_notified() calls at once instead of serially?) */
-
-	if (mg->dlm_notify_nodeid)
-		return 0;
-
-	list_for_each_entry(node, &mg->node_history, list) {
-
-		/* check_dlm is set when we see a node fail, and is cleared
-		   below when we find that the dlm has also seen it fail */
-
-		if (!node->check_dlm)
-			continue;
-
-		/* we're in sync with the dlm for this nodeid, i.e. we've
-		   both seen this node fail */
-
-		if (node->dlm_notify_callback && !node->dlm_notify_result) {
-			node->dlm_notify_callback = 0;
-			node->check_dlm = 0;
-			continue;
-		}
-
-		/* we're not in sync with the dlm for this nodeid, i.e.
-		   the dlm hasn't seen this node fail yet; try calling
-		   dlmc_fs_notified() again in a bit */
-
-		if (node->dlm_notify_callback && node->dlm_notify_result) {
-			log_group(mg, "check_dlm_notify result %d will retry nodeid %d",
-				  node->dlm_notify_result, node->nodeid);
-			node->dlm_notify_callback = 0;
-			poll_dlm = 1;
-			return 0;
-		}
-
-		/* check if the dlm has seen this nodeid fail, we get the
-		   answer asynchronously in process_dlmcontrol */
-
-		log_group(mg, "check_dlm_notify nodeid %d begin", node->nodeid);
-
-		rv = dlmc_fs_notified(dlmcontrol_fd, mg->name, node->nodeid);
-		if (rv) {
-			log_error("dlmc_fs_notified error %d", rv);
-			return 0;
-		}
-
-		mg->dlm_notify_nodeid = node->nodeid;
-		return 0;
-	}
-
-	log_group(mg, "check_dlm_notify done");
-	return 1;
-}
-
-static int wait_conditions_done(struct mountgroup *mg)
-{
-	if (mg->first_recovery_needed) {
-		log_group(mg, "wait_conditions skip for first_recovery_needed");
-		return 1;
-	}
-
-	if (!mg->started_count) {
-		log_group(mg, "wait_conditions skip for zero started_count");
-		return 1;
-	}
-
-	if (!journals_need_recovery(mg)) {
-		log_group(mg, "wait_conditions skip for zero "
-			 "journals_need_recovery");
-		return 1;
-	}
-
-	if (!mg->mount_client_notified) {
-		log_group(mg, "wait_conditions skip mount client not notified");
-		return 1;
-	}
-
-	if (mg->kernel_mount_done && mg->kernel_mount_error) {
-		log_group(mg, "wait_conditions skip for kernel_mount_error");
-		return 1;
-	}
-
-	if (!mg->kernel_mount_done) {
-		log_group(mg, "wait_conditions need mount_done");
-		return 0;
-	}
-
-	stop_kernel(mg);
-
-	if (!check_dlm_notify_done(mg))
-		return 0;
-
-	return 1;
-}
-
-static int wait_messages_done(struct mountgroup *mg)
-{
-	struct change *cg = list_first_entry(&mg->changes, struct change, list);
-	struct member *memb;
-	int need = 0, total = 0;
-
-	list_for_each_entry(memb, &cg->members, list) {
-		if (!memb->start)
-			need++;
-		total++;
-	}
-
-	if (need) {
-		log_group(mg, "wait_messages cg %u need %d of %d",
-			  cg->seq, need, total);
-		return 0;
-	}
-
-	log_group(mg, "wait_messages cg %u got all %d", cg->seq, total);
-	return 1;
-}
-
-static void cleanup_changes(struct mountgroup *mg)
-{
-	struct change *cg = list_first_entry(&mg->changes, struct change, list);
-	struct change *safe;
-
-	list_del(&cg->list);
-	if (mg->started_change)
-		free_cg(mg->started_change);
-	mg->started_change = cg;
-
-	/* zero started_count means "never started" */
-
-	mg->started_count++;
-	if (!mg->started_count)
-		mg->started_count++;
-
-	cg->combined_seq = cg->seq; /* for queries */
-
-	list_for_each_entry_safe(cg, safe, &mg->changes, list) {
-		mg->started_change->combined_seq = cg->seq; /* for queries */
-		list_del(&cg->list);
-		free_cg(cg);
-	}
-}
-
-/* do the change details in the message match the details of the given change */
-
-static int match_change(struct mountgroup *mg, struct change *cg,
-			struct gfs_header *hd, struct mg_info *mi,
-			struct id_info *ids)
-{
-	struct id_info *id;
-	struct member *memb;
-	uint32_t seq = hd->msgdata;
-	int i, members_mismatch;
-
-	/* We can ignore messages if we're not in the list of members.
-	   The one known time this will happen is after we've joined
-	   the cpg, we can get messages for changes prior to the change
-	   in which we're added. */
-
-	id = get_id_struct(ids, mi->id_info_count, mi->id_info_size,our_nodeid);
-
-	if (!id || !(id->flags & IDI_NODEID_IS_MEMBER)) {
-		log_group(mg, "match_change %d:%u skip cg %u we are not in members",
-			  hd->nodeid, seq, cg->seq);
-		return 0;
-	}
-
-	memb = find_memb(cg, hd->nodeid);
-	if (!memb) {
-		log_group(mg, "match_change %d:%u skip cg %u sender not member",
-			  hd->nodeid, seq, cg->seq);
-		return 0;
-	}
-
-	/* verify this is the right change by matching the counts
-	   and the nodeids of the current members */
-
-	if (mi->member_count != cg->member_count ||
-	    mi->joined_count != cg->joined_count ||
-	    mi->remove_count != cg->remove_count ||
-	    mi->failed_count != cg->failed_count) {
-		log_group(mg, "match_change %d:%u skip cg %u expect counts "
-			  "%d %d %d %d", hd->nodeid, seq, cg->seq,
-			  cg->member_count, cg->joined_count,
-			  cg->remove_count, cg->failed_count);
-		return 0;
-	}
-
-	members_mismatch = 0;
-	id = ids;
-
-	for (i = 0; i < mi->id_info_count; i++) {
-		if (id->flags & IDI_NODEID_IS_MEMBER) {
-			memb = find_memb(cg, id->nodeid);
-			if (!memb) {
-				log_group(mg, "match_change %d:%u skip cg %u "
-					  "no memb %d", hd->nodeid, seq,
-					  cg->seq, id->nodeid);
-				members_mismatch = 1;
-				break;
-			}
-		}
-		id = (struct id_info *)((char *)id + mi->id_info_size);
-	}
-
-	if (members_mismatch)
-		return 0;
-
-	log_group(mg, "match_change %d:%u matches cg %u", hd->nodeid, seq,
-		  cg->seq);
-	return 1;
-}
-
-/* Unfortunately, there's no really simple way to match a message with the
-   specific change that it was sent for.  We hope that by passing all the
-   details of the change in the message, we will be able to uniquely match
-   it to the correct change. */
-
-/* A start message will usually be for the first (current) change on our list.
-   In some cases it will be for a non-current change, and we can ignore it:
-
-   1. A,B,C get confchg1 adding C
-   2. C sends start for confchg1
-   3. A,B,C get confchg2 adding D
-   4. A,B,C,D recv start from C for confchg1 - ignored
-   5. C,D send start for confchg2
-   6. A,B send start for confchg2
-   7. A,B,C,D recv all start messages for confchg2; start barrier/cycle done
- 
-   In step 4, how do the nodes know whether the start message from C is
-   for confchg1 or confchg2?  Hopefully by comparing the counts and members. */
-
-static struct change *find_change(struct mountgroup *mg, struct gfs_header *hd,
-				  struct mg_info *mi, struct id_info *ids)
-{
-	struct change *cg;
-
-	list_for_each_entry_reverse(cg, &mg->changes, list) {
-		if (!match_change(mg, cg, hd, mi, ids))
-			continue;
-		return cg;
-	}
-
-	log_group(mg, "find_change %d:%u no match", hd->nodeid, hd->msgdata);
-	return NULL;
-}
-
-static void mg_info_in(struct mg_info *mi)
-{
-	mi->mg_info_size  = le32_to_cpu(mi->mg_info_size);
-	mi->id_info_size  = le32_to_cpu(mi->id_info_size);
-	mi->id_info_count = le32_to_cpu(mi->id_info_count);
-	mi->started_count = le32_to_cpu(mi->started_count);
-	mi->member_count  = le32_to_cpu(mi->member_count);
-	mi->joined_count  = le32_to_cpu(mi->joined_count);
-	mi->remove_count  = le32_to_cpu(mi->remove_count);
-	mi->failed_count  = le32_to_cpu(mi->failed_count);
-	mi->first_recovery_needed = le32_to_cpu(mi->first_recovery_needed);
-	mi->first_recovery_master = le32_to_cpu(mi->first_recovery_master);
-}
-
-static void id_info_in(struct id_info *id)
-{
-	id->nodeid = le32_to_cpu(id->nodeid);
-	id->jid    = le32_to_cpu(id->jid);
-	id->flags  = le32_to_cpu(id->flags);
-}
-
-static void ids_in(struct mg_info *mi, struct id_info *ids)
-{
-	struct id_info *id;
-	int i;
-
-	id = ids;
-	for (i = 0; i < mi->id_info_count; i++) {
-		id_info_in(id);
-		id = (struct id_info *)((char *)id + mi->id_info_size);
-	}
-}
-
-static void receive_start(struct mountgroup *mg, struct gfs_header *hd, int len)
-{
-	struct change *cg;
-	struct member *memb;
-	struct mg_info *mi;
-	struct id_info *ids;
-	uint32_t seq = hd->msgdata;
-	int added;
-
-	log_group(mg, "receive_start %d:%u len %d", hd->nodeid, seq, len);
-
-	mi = (struct mg_info *)((char *)hd + sizeof(struct gfs_header));
-	ids = (struct id_info *)((char *)mi + sizeof(struct mg_info));
-
-	mg_info_in(mi);
-	ids_in(mi, ids);
-
-	cg = find_change(mg, hd, mi, ids);
-	if (!cg)
-		return;
-
-	memb = find_memb(cg, hd->nodeid);
-	if (!memb) {
-		/* this should never happen since match_change checks it */
-		log_error("receive_start no member %d", hd->nodeid);
-		return;
-	}
-
-	added = is_added(mg, hd->nodeid);
-
-	if (added && mi->started_count) {
-		log_error("receive_start %d:%u add node with started_count %u",
-			  hd->nodeid, seq, mi->started_count);
-
-		/* see comment in fence/fenced/cpg.c */
-		memb->disallowed = 1;
-		return;
-	}
-
-	node_history_start(mg, hd->nodeid);
-	memb->start = 1;
-
-	if (memb->start_msg) {
-		/* shouldn't happen */
-		log_error("receive_start %d:%u dup start msg", hd->nodeid, seq);
-		return;
-	}
-
-	/* save a copy of each start message */
-	memb->start_msg = malloc(len);
-	if (!memb->start_msg) {
-		log_error("receive_start len %d no mem", len);
-		return;
-	}
-	memcpy(memb->start_msg, hd, len);
-
-	/* a shortcut to the saved mg_info */
-	memb->mg_info = (struct mg_info *)(memb->start_msg +
-					   sizeof(struct gfs_header));
-}
-
-/* start messages are associated with a specific change and use the
-   find_change/match_change routines to make sure all start messages
-   are matched with the same change on all nodes.  The current set of
-   changes are cleared after a completed start cycle.  Other messages
-   happen outside the context of changes.  An "incomplete" start cycle
-   is when a confchg arrives (adding a new change struct) before all
-   start messages have been received for the current change.  In this
-   case, all members send a new start message for the latest change,
-   and any start messages received for the previous change(s) are ignored.
-
-   To sync state with start messages, we need to include:
-   - the state before applying any of the current set of queued changes
-     (new nodes will initialize with this)
-   - the essential info from changes in the set that's being started,
-     so nodes added by one of the queued changes can apply the same changes
-     to the init state that the existing nodes do. */ 
-
-/* recovery_result and mount_done messages may arrive between the time
-   that an old node sends start and the time a new node receives it.
-   two old nodes may also send start before/after a recovery_result or
-   mount_done message, creating inconsistent data in their start messages.
-
-   Soln: a new node saves recovery_result/mount_done messages between
-   last confchg and final start.  the new node knows that a start message
-   from an old node may or may not include the effects from rr/md messages
-   since the last confchg, but *will* include all effects from prior to
-   the last confchg.  The saved rr/md messages can be applied on top of
-   the state from an old node's start message; applying them a second time
-   should not change anything, producing the same result. */
-
-static int count_ids(struct mountgroup *mg)
-{
-	struct change *cg;
-	struct member *memb;
-	struct journal *j;
-	int count = 0;
-
-	cg = list_first_entry(&mg->changes, struct change, list);
-
-	list_for_each_entry(memb, &cg->members, list)
-		count++;
-
-	list_for_each_entry(j, &mg->journals, list)
-		if (j->needs_recovery)
-			count++;
-
-	list_for_each_entry(cg, &mg->changes, list) {
-		list_for_each_entry(memb, &cg->removed, list) {
-			if (!memb->failed && !is_withdraw(mg, memb->nodeid))
-				continue;
-			j = find_journal_by_nodeid(mg, memb->nodeid);
-			if (j)
-				count++;
-		}
-	}
-
-	return count;
-}
-
-/* old member: current member that has completed a start cycle
-   new member: current member that has not yet completed a start cycle */
-
-static void send_start(struct mountgroup *mg)
-{
-	struct change *cg, *c;
-	struct gfs_header *hd;
-	struct mg_info *mi;
-	struct id_info *id;
-	struct member *memb;
-	struct node *node;
-	struct journal *j;
-	char *buf;
-	uint32_t flags;
-	int len, id_count, jid;
-	int old_memb = 0, new_memb = 0, old_journal = 0, new_journal = 0;
-
-	cg = list_first_entry(&mg->changes, struct change, list);
-
-	id_count = count_ids(mg);
-
-	/* sanity check */
-
-	if (!mg->started_count && id_count != cg->member_count) {
-		log_error("send_start bad counts id_count %d member_count %d",
-			  cg->member_count, id_count);
-		return;
-	}
-
-	len = sizeof(struct gfs_header) + sizeof(struct mg_info) +
-	      id_count * sizeof(struct id_info);
-
-	buf = malloc(len);
-	if (!buf) {
-		log_error("send_start len %d no mem", len);
-		return;
-	}
-	memset(buf, 0, len);
-
-	hd = (struct gfs_header *)buf;
-	mi = (struct mg_info *)(buf + sizeof(*hd));
-	id = (struct id_info *)(buf + sizeof(*hd) + sizeof(*mi));
-
-	/* fill in header (gfs_send_message handles part of header) */
-
-	hd->type = GFS_MSG_START;
-	hd->msgdata = cg->seq;
-	hd->flags |= mg->joining ? GFS_MFLG_JOINING : 0;
-
-	/* fill in mg_info */
-
-	mi->mg_info_size  = cpu_to_le32(sizeof(struct mg_info));
-	mi->id_info_size  = cpu_to_le32(sizeof(struct id_info));
-	mi->id_info_count = cpu_to_le32(id_count);
-	mi->started_count = cpu_to_le32(mg->started_count);
-	mi->member_count  = cpu_to_le32(cg->member_count);
-	mi->joined_count  = cpu_to_le32(cg->joined_count);
-	mi->remove_count  = cpu_to_le32(cg->remove_count);
-	mi->failed_count  = cpu_to_le32(cg->failed_count);
-	mi->first_recovery_needed = cpu_to_le32(mg->first_recovery_needed);
-	mi->first_recovery_master = cpu_to_le32(mg->first_recovery_master);
-
-	/* fill in id_info entries */
-
-	/* New members send info about themselves, and empty id_info slots for
-	   all other members.  Old members send full info about all old
-	   members, and empty id_info slots about new members.  The union of
-	   start messages from a single old node and all new nodes give a
-	   complete picture of state for all members.  In sync_state, all nodes
-	   (old and new) make this union, and then assign jid's to new nodes. */
-
-	list_for_each_entry(memb, &cg->members, list) {
-
-		if (!mg->started_count || is_added(mg, memb->nodeid)) {
-			/* send empty slot for new member */
-			jid = JID_NONE;
-			flags = IDI_NODEID_IS_MEMBER;
-
-			/* include our own info which no one knows yet */
-			if (!mg->started_count && memb->nodeid == our_nodeid) {
-				flags |= mg->ro ? IDI_MOUNT_RO : 0;
-				flags |= mg->spectator ? IDI_MOUNT_SPECTATOR : 0;
-			}
-			new_memb++;
-
-		} else {
-			/* send full info for old member */
-			node = get_node_history(mg, memb->nodeid);
-			if (!node) {
-				log_error("send_start no nodeid %d", memb->nodeid);
-				continue;
-			}
-
-			jid = node->jid;
-			flags = IDI_NODEID_IS_MEMBER;
-			flags |= node->ro ? IDI_MOUNT_RO : 0;
-			flags |= node->spectator ? IDI_MOUNT_SPECTATOR : 0;
-			flags |= node->kernel_mount_done ? IDI_MOUNT_DONE : 0;
-			flags |= node->kernel_mount_error ? IDI_MOUNT_ERROR : 0;
-			old_memb++;
-		}
-
-		id->nodeid = cpu_to_le32(memb->nodeid);
-		id->jid    = cpu_to_le32(jid);
-		id->flags  = cpu_to_le32(flags);
-		id++;
-	}
-
-	/* journals needing recovery from previous start cycles */
-
-	list_for_each_entry(j, &mg->journals, list) {
-		if (j->needs_recovery) {
-			flags = IDI_JID_NEEDS_RECOVERY;
-			id->jid = cpu_to_le32(j->jid);
-			id->flags = cpu_to_le32(flags);
-			id++;
-			old_journal++;
-		}
-	}
-
-	/* journals needing recovery from the current start cycle */
-
-	list_for_each_entry(c, &mg->changes, list) {
-		list_for_each_entry(memb, &c->removed, list) {
-			if (!memb->failed && !is_withdraw(mg, memb->nodeid))
-				continue;
-			j = find_journal_by_nodeid(mg, memb->nodeid);
-			if (j) {
-				flags = IDI_JID_NEEDS_RECOVERY;
-				id->jid = cpu_to_le32(j->jid);
-				id->flags = cpu_to_le32(flags);
-				id++;
-				new_journal++;
-			}
-		}
-	}
-
-	/* sanity check */
-
-	if (!mg->started_count && (old_memb || old_journal || new_journal)) {
-		log_error("send_start cg %u bad counts om %d nm %d oj %d nj %d",
-			  cg->seq, old_memb, new_memb, old_journal, new_journal);
-		return;
-	}
-
-	log_group(mg, "send_start cg %u id_count %d om %d nm %d oj %d nj %d",
-		  cg->seq, id_count, old_memb, new_memb, old_journal,
-		  new_journal);
-
-	gfs_send_message(mg, buf, len);
-
-	free(buf);
-}
-
-static void send_mount_done(struct mountgroup *mg, int result)
-{
-	struct gfs_header h;
-
-	memset(&h, 0, sizeof(h));
-
-	h.type = GFS_MSG_MOUNT_DONE;
-	h.msgdata = result;
-
-	gfs_send_message(mg, (char *)&h, sizeof(h));
-}
-
-static void send_first_recovery_done(struct mountgroup *mg)
-{
-	struct gfs_header h;
-
-	memset(&h, 0, sizeof(h));
-
-	h.type = GFS_MSG_FIRST_RECOVERY_DONE;
-
-	gfs_send_message(mg, (char *)&h, sizeof(h));
-}
-
-static void send_recovery_result(struct mountgroup *mg, int jid, int result)
-{
-	struct gfs_header *hd;
-	char *buf;
-	int len, *p;
-
-	len = sizeof(struct gfs_header) + 2 * sizeof(int);
-
-	buf = malloc(len);
-	if (!buf) {
-		log_error("send_recovery_result no mem %d", len);
-		return;
-	}
-	memset(buf, 0, len);
-
-	hd = (struct gfs_header *)buf;
-	hd->type = GFS_MSG_RECOVERY_RESULT;
-
-	p = (int *)(buf + sizeof(struct gfs_header));
-
-	p[0] = cpu_to_le32(jid);
-	p[1] = cpu_to_le32(result);
-
-	gfs_send_message(mg, buf, len);
-
-	free(buf);
-}
-
-void send_remount(struct mountgroup *mg, struct gfsc_mount_args *ma)
-{
-	struct gfs_header h;
-
-	memset(&h, 0, sizeof(h));
-
-	h.type = GFS_MSG_REMOUNT;
-	h.msgdata = strstr(ma->options, "ro") ? 1 : 0;
-
-	gfs_send_message(mg, (char *)&h, sizeof(h));
-}
-
-void send_withdraw(struct mountgroup *mg)
-{
-	struct gfs_header h;
-
-	memset(&h, 0, sizeof(h));
-
-	h.type = GFS_MSG_WITHDRAW;
-
-	gfs_send_message(mg, (char *)&h, sizeof(h));
-}
-
-static void save_message(struct mountgroup *mg, struct gfs_header *hd, int len)
-{
-	struct change *cg;
-	struct save_msg *sm;
-
-	cg = list_first_entry(&mg->changes, struct change, list);
-
-	sm = malloc(sizeof(struct save_msg) + len);
-	if (!sm) {
-		log_error("save_message len %d no mem", len);
-		return;
-	}
-
-	sm->len = len;
-	memcpy(sm->buf, hd, len);
-
-	list_add_tail(&sm->list, &cg->saved_messages);
-}
-
-void gfs_mount_done(struct mountgroup *mg)
-{
-	send_mount_done(mg, mg->kernel_mount_error);
-}
-
-static void receive_mount_done(struct mountgroup *mg, struct gfs_header *hd,
-			       int len)
-{
-	struct node *node;
-
-	log_group(mg, "receive_mount_done from %d result %d",
-		  hd->nodeid, hd->msgdata);
-
-	node = get_node_history(mg, hd->nodeid);
-	if (!node) {
-		log_error("receive_mount_done no nodeid %d", hd->nodeid);
-		return;
-	}
-
-	node->kernel_mount_done = 1;
-	node->kernel_mount_error = hd->msgdata;
-}
-
-static void receive_recovery_result(struct mountgroup *mg,
-				    struct gfs_header *hd, int len)
-{
-	struct journal *j;
-	int jid, result, *p;
-
-	p = (int *)((char *)hd + sizeof(struct gfs_header));
-	jid = le32_to_cpu(p[0]);
-	result = le32_to_cpu(p[1]);
-
-	log_group(mg, "receive_recovery_result from %d jid %d result %d",
-		  hd->nodeid, jid, result);
-
-	j = find_journal(mg, jid);
-	if (!j) {
-		log_error("receive_recovery_result from %d no jid %d",
-			  hd->nodeid, jid);
-		return;
-	}
-
-	if (!j->needs_recovery)
-		return;
-
-	if (result == LM_RD_SUCCESS)
-		j->needs_recovery = 0;
-	else {
-		j->failed_recovery_count++;
-		log_group(mg, "jid %d failed_recovery_count %d", jid,
-			  j->failed_recovery_count);
-	}
-}
-
-static void receive_first_recovery_done(struct mountgroup *mg,
-					struct gfs_header *hd, int len)
-{
-	int master = mg->first_recovery_master;
-
-	log_group(mg, "receive_first_recovery_done from %d master %d "
-		  "mount_client_notified %d",
-		  hd->nodeid, master, mg->mount_client_notified);
-
-	if (list_empty(&mg->changes)) {
-		/* everything is idle, no changes in progress */
-
-		mg->first_recovery_needed = 0;
-		mg->first_recovery_master = 0;
-		mg->first_recovery_msg = 1;
-
-		if (master != our_nodeid)
-			start_kernel(mg);
-	} else {
-		/* Everyone will receive this message in the same sequence
-		   wrt other start messages and confchgs:
-
-		   - If a new confchg arrives after this message (and before
-		     the final start message in the current start cycle),
-		     a new start cycle will begin.  All nodes before the
-		     confchg will have frn=0 due to receiving this message,
-		     and nodes added by the confchg will see frn=0 in all
-		     start messages (in any_nodes_first_recovery() which
-		     returns 0).
-
-		   - If the final start message arrives after this message,
-		     the start cycle will complete, running sync_state(), on
-		     all current nodes with all having seen this message.
-		     Old and new nodes in the current start cycle will see
-		     this msg and use it (first_recovery_msg) instead of the
-		     first_recovery_needed/master data in the start messages
-		     (which may be inconsistent due to members sending their
-		     start messages either before or after receiving this
-		     message). */
-
-		/* exclude new nodes from this sanity check since they've
-		   never set a master value to compare against */
-		if (mg->started_count && (master != hd->nodeid))
-			log_error("receive_first_recovery_done from %d "
-				  "master %d", hd->nodeid, master);
-
-		mg->first_recovery_needed = 0;
-		mg->first_recovery_master = 0;
-		mg->first_recovery_msg = 1;
-	}
-}
-
-static void receive_remount(struct mountgroup *mg, struct gfs_header *hd,
-			    int len)
-{
-	struct node *node;
-
-	log_group(mg, "receive_remount from %d ro %d", hd->nodeid, hd->msgdata);
-
-	node = get_node_history(mg, hd->nodeid);
-	if (!node) {
-		log_error("receive_remount no nodeid %d", hd->nodeid);
-		return;
-	}
-
-	node->ro = hd->msgdata;
-
-	if (hd->nodeid == our_nodeid)
-		mg->ro = node->ro;
-}
-
-/* The node with the withdraw wants to leave the mountgroup, but have
-   the other nodes do recovery for it when it leaves.  They wouldn't usually
-   do recovery for a node that leaves "normally", i.e. without failing at the
-   cluster membership level.  So, we send a withdraw message to tell the
-   others that our succeeding leave-removal should be followed by recovery
-   like a failure-removal would be.
-
-   The withdrawing node can't release dlm locks for the fs before other
-   nodes have stopped the fs.  The same reason as for any gfs journal
-   recovery; the locks on the failed/withdrawn fs "protect" the parts of
-   the fs that need to be recovered, and until the fs on all mounters has
-   been stopped/blocked, our existing dlm locks need to remain to prevent
-   other nodes from touching these parts of the fs.
-
-   So, the node doing withdraw needs to know that other nodes in the mountgroup
-   have blocked the fs before it sets /sys/fs/gfs/foo/withdraw to 1, which
-   tells gfs-kernel to continue and release dlm locks.
-
-   Until the node doing withdraw has released the dlm locks on the withdrawn
-   fs, the other nodes' attempts to recover the given journal will fail (they
-   fail to acquire the journal lock.) So, these nodes need to either wait until
-   the dlm locks have been released before attempting to recover the journal,
-   or retry failed attempts at recovering the journal.
-
-   How it works
-   . nodes A,B,C in mountgroup for fs foo
-   . foo is withrawn on node C
-   . C sends withdraw to all
-   . all set C->withraw = 1
-   . C leaves mountgroup
-   . A,B,C get confchg removing C
-   . A,B stop kernel foo
-   . A,B send out-of-band message to C indicating foo is stopped
-   . C gets OOB message and set /sys/fs/gfs/foo/withdraw to 1
-   . dlm locks for foo are released on C
-   . A,B will now be able to acquire C's journal lock for foo
-   . A,B will complete recovery of foo
-
-   An "in-band" message would be through cpg foo, but since C has left cpg
-   foo, we can't use that cpg, and have to go through an external channel.
-*/
-
-static void receive_withdraw(struct mountgroup *mg, struct gfs_header *hd,
-			     int len)
-{
-	struct node *node;
-
-	log_group(mg, "receive_withdraw from %d", hd->nodeid);
-
-	node = get_node_history(mg, hd->nodeid);
-	if (!node) {
-		log_error("receive_withdraw no nodeid %d", hd->nodeid);
-		return;
-	}
-	node->withdraw = 1;
-
-	if (hd->nodeid == our_nodeid)
-		leave_mountgroup(mg, 0);
-}
-
-/* start message from all nodes shows zero started_count */
-
-static int all_nodes_new(struct mountgroup *mg)
-{
-	struct change *cg;
-	struct member *memb;
-
-	cg = list_first_entry(&mg->changes, struct change, list);
-
-	list_for_each_entry(memb, &cg->members, list) {
-		if (memb->mg_info->started_count)
-			return 0;
-	}
-	return 1;
-}
-
-/* does start message from any node with non-zero started_count have
-   first_recovery_needed set?  (verify that all started nodes agree on
-   first_recovery_needed) */
-
-static int any_nodes_first_recovery(struct mountgroup *mg)
-{
-	struct change *cg;
-	struct member *memb;
-	int yes = 0, no = 0, master = 0;
-
-	cg = list_first_entry(&mg->changes, struct change, list);
-
-	list_for_each_entry(memb, &cg->members, list) {
-		if (!memb->mg_info->started_count)
-			continue;
-		if (memb->mg_info->first_recovery_needed)
-			yes++;
-		else
-			no++;
-	}
-
-	if (no && yes) {
-		/* disagreement on first_recovery_needed, shouldn't happen */
-		log_error("any_nodes_first_recovery no %d yes %d", no, yes);
-		return 1;
-	}
-
-	if (no)
-		return 0;
-
-	/* sanity check: verify agreement on the master */
-
-	list_for_each_entry(memb, &cg->members, list) {
-		if (!memb->mg_info->started_count)
-			continue;
-		if (!master) {
-			master = memb->mg_info->first_recovery_master;
-			continue;
-		}
-		if (master == memb->mg_info->first_recovery_master)
-			continue;
-
-		/* disagreement on master, shouldn't happen */
-		log_error("any_nodes_first_recovery master %d vs %d",
-			  master, memb->mg_info->first_recovery_master);
-	}
-
-	return 1;
-}
-
-/* If all nodes new, there's no previous master, pick low nodeid;
-   if not all nodes new, there will be a previous master, use that one unless
-   it's no longer a member; if master is no longer a member pick low nodeid.
-   The current master will already be set in mg->first_recovery_master for old
-   nodes, but new nodes will need to look in the start messages to find it. */
-
-static int pick_first_recovery_master(struct mountgroup *mg, int all_new)
-{
-	struct change *cg;
-	struct member *memb;
-	int old = 0, low = 0;
-
-	cg = list_first_entry(&mg->changes, struct change, list);
-
-	list_for_each_entry(memb, &cg->members, list) {
-		if (memb->mg_info->started_count)
-			old = memb->mg_info->first_recovery_master;
-
-		if (!low)
-			low = memb->nodeid;
-		else if (memb->nodeid < low)
-			low = memb->nodeid;
-	}
-
-	memb = find_memb(cg, old);
-
-	if (!memb || all_new) {
-		log_group(mg, "pick_first_recovery_master low %d old %d",
-			  low, old);
-		return low;
-	}
-
-	log_group(mg, "pick_first_recovery_master old %d", old);
-	return old;
-}
-
-/* use a start message from an old node to create node info for each old node */
-
-static void create_old_nodes(struct mountgroup *mg)
-{
-	struct change *cg;
-	struct member *memb;
-	struct node *node;
-	struct journal *j;
-	struct id_info *ids, *id;
-	int id_count, id_size, rv;
-
-	/* get ids from a start message of an old node */
-
-	rv = get_id_list(mg, &ids, &id_count, &id_size);
-	if (rv) {
-		/* all new nodes, no old nodes */
-		log_group(mg, "create_old_nodes all new");
-		return;
-	}
-
-	/* use id list to set info for all old nodes */
-
-	cg = list_first_entry(&mg->changes, struct change, list);
-
-	list_for_each_entry(memb, &cg->members, list) {
-		if (!memb->mg_info->started_count)
-			continue;
-
-		node = get_node_history(mg, memb->nodeid);
-		id = get_id_struct(ids, id_count, id_size, memb->nodeid);
-
-		if (!node || !id) {
-			/* shouldn't happen */
-			log_error("create_old_nodes %d node %d id %d",
-				  memb->nodeid, !!node, !!id);
-			return;
-		}
-
-		if (!(id->flags & IDI_NODEID_IS_MEMBER) ||
-		     (id->flags & IDI_JID_NEEDS_RECOVERY)) {
-			/* shouldn't happen */
-			log_error("create_old_nodes %d bad flags %x",
-				  memb->nodeid, id->flags);
-			return;
-		}
-
-		node->jid                = id->jid;
-		node->kernel_mount_done  = !!(id->flags & IDI_MOUNT_DONE);
-		node->kernel_mount_error = !!(id->flags & IDI_MOUNT_ERROR);
-		node->ro                 = !!(id->flags & IDI_MOUNT_RO);
-		node->spectator          = !!(id->flags & IDI_MOUNT_SPECTATOR);
-
-		j = malloc(sizeof(struct journal));
-		if (!j) {
-			log_error("create_old_nodes no mem");
-			return;
-		}
-		memset(j, 0, sizeof(struct journal));
-
-		j->nodeid = node->nodeid;
-		j->jid = node->jid;
-		list_add(&j->list, &mg->journals);
-
-		log_group(mg, "create_old_nodes %d jid %d ro %d spect %d "
-			  "kernel_mount_done %d error %d",
-			  node->nodeid, node->jid, node->ro, node->spectator,
-			  node->kernel_mount_done, node->kernel_mount_error);
-	}
-}
-
-/* use start messages from new nodes to create node info for each new node */
-
-static void create_new_nodes(struct mountgroup *mg)
-{
-	struct change *cg;
-	struct member *memb;
-	struct id_info *ids, *id;
-	struct node *node;
-
-	cg = list_first_entry(&mg->changes, struct change, list);
-
-	list_for_each_entry(memb, &cg->members, list) {
-		if (memb->mg_info->started_count)
-			continue;
-
-		node = get_node_history(mg, memb->nodeid);
-		if (!node) {
-			/* shouldn't happen */
-			log_error("create_new_nodes %d no node", memb->nodeid);
-			return;
-		}
-
-		ids = (struct id_info *)(memb->start_msg +
-					 sizeof(struct gfs_header) +
-					 memb->mg_info->mg_info_size);
-
-		id = get_id_struct(ids, memb->mg_info->id_info_count,
-				   memb->mg_info->id_info_size, memb->nodeid);
-
-		if (!(id->flags & IDI_NODEID_IS_MEMBER) ||
-		     (id->flags & IDI_JID_NEEDS_RECOVERY)) {
-			/* shouldn't happen */
-			log_error("create_new_nodes %d bad flags %x",
-				  memb->nodeid, id->flags);
-			return;
-		}
-
-		node->jid       = JID_NONE;
-		node->ro        = !!(id->flags & IDI_MOUNT_RO);
-		node->spectator = !!(id->flags & IDI_MOUNT_SPECTATOR);
-
-		log_group(mg, "create_new_nodes %d ro %d spect %d",
-			  node->nodeid, node->ro, node->spectator);
-	}
-}
-
-#if 0
-static void print_id_list(struct mountgroup *mg, struct id_info *ids,
-			  int id_count, int id_size)
-{
-	struct id_info *id = ids;
-	int i;
-
-	for (i = 0; i < id_count; i++) {
-		log_group(mg, "id nodeid %d jid %d flags %08x",
-			  id->nodeid, id->jid, id->flags);
-		id = (struct id_info *)((char *)id + id_size);
-	}
-}
-#endif
-
-static void create_failed_journals(struct mountgroup *mg)
-{
-	struct journal *j;
-	struct id_info *ids, *id;
-	int id_count, id_size;
-	int rv, i;
-
-	rv = get_id_list(mg, &ids, &id_count, &id_size);
-	if (rv) {
-		/* all new nodes, no old nodes */
-		log_group(mg, "create_failed_journals all new");
-		return;
-	}
-	/* print_id_list(mg, ids, id_count, id_size); */
-
-	id = ids;
-
-	for (i = 0; i < id_count; i++) {
-		if (!(id->flags & IDI_JID_NEEDS_RECOVERY))
-			goto next;
-
-		j = malloc(sizeof(struct journal));
-		if (!j) {
-			log_error("create_failed_journals no mem");
-			return;
-		}
-		memset(j, 0, sizeof(struct journal));
-
-		j->jid = id->jid;
-		j->needs_recovery = 1;
-		list_add(&j->list, &mg->journals);
-		log_group(mg, "create_failed_journals jid %d", j->jid);
- next:
-		id = (struct id_info *)((char *)id + id_size);
-	}
-}
-
-/* This pattern (for each failed memb in removed list of each change) is
-   repeated and needs to match in four places: here, count_ids(),
-   send_start(), and journals_need_recovery(). */
-
-static void set_failed_journals(struct mountgroup *mg)
-{
-	struct change *cg;
-	struct member *memb;
-	struct journal *j;
-
-	cg = list_first_entry(&mg->changes, struct change, list);
-
-	list_for_each_entry(cg, &mg->changes, list) {
-		list_for_each_entry(memb, &cg->removed, list) {
-			if (!memb->failed && !is_withdraw(mg, memb->nodeid))
-				continue;
-			j = find_journal_by_nodeid(mg, memb->nodeid);
-			if (j) {
-				j->needs_recovery = 1;
-				j->failed_nodeid = j->nodeid;
-				j->nodeid = 0;
-				log_group(mg, "set_failed_journals jid %d "
-					  "nodeid %d", j->jid, memb->nodeid);
-			} else {
-				log_group(mg, "set_failed_journals no journal "
-					  "for nodeid %d ", memb->nodeid);
-			}
-		}
-	}
-}
-
-/* returns nodeid of new member with the next highest nodeid */
-
-static int next_new_nodeid(struct mountgroup *mg, int prev)
-{
-	struct change *cg;
-	struct member *memb;
-	int low = 0;
-
-	cg = list_first_entry(&mg->changes, struct change, list);
-
-	list_for_each_entry(memb, &cg->members, list) {
-		if (memb->mg_info->started_count)
-			continue;
-		if (memb->nodeid <= prev)
-			continue;
-		if (!low)
-			low = memb->nodeid;
-		else if (memb->nodeid < low)
-			low = memb->nodeid;
-	}
-
-	return low;
-}
-
-/* returns lowest unused jid */
-
-static int next_free_jid(struct mountgroup *mg)
-{
-	int i;
-
-	for (i = 0; i < MAX_JOURNALS; i++) {
-		if (!find_journal(mg, i))
-			return i;
-	}
-	return -1;
-}
-
-static void create_new_journals(struct mountgroup *mg)
-{
-	struct journal *j, *safe;
-	struct change *cg;
-	struct node *node;
-	int nodeid = 0;
-
-	cg = list_first_entry(&mg->changes, struct change, list);
-
-	/* first get rid of journal structs that are no longer used
-	   or dirty, i.e. from nodes that have unmounted/left, or
-	   journals that have been recovered */
-
-	list_for_each_entry_safe(j, safe, &mg->journals, list) {
-		if (j->needs_recovery)
-			continue;
-
-		if (find_memb(cg, j->nodeid))
-			continue;
-
-		list_del(&j->list);
-		free(j);
-	}
-
-	while (1) {
-		nodeid = next_new_nodeid(mg, nodeid);
-		if (!nodeid)
-			break;
-
-		node = get_node_history(mg, nodeid);
-		if (!node) {
-			/* shouldn't happen */
-			log_error("create_new_journals no nodeid %d", nodeid);
-			continue;
-		}
-
-		if (node->spectator)
-			node->jid = JID_NONE;
-		else
-			node->jid = next_free_jid(mg);
-
-		if (node->nodeid == our_nodeid)
-			mg->our_jid = node->jid;
-
-		log_group(mg, "create_new_journals %d gets jid %d",
-			  node->nodeid, node->jid);
-
-		if (node->jid == JID_NONE)
-			continue;
-
-		j = malloc(sizeof(struct journal));
-		if (!j) {
-			log_error("create_new_journals no mem");
-			continue;
-		}
-		memset(j, 0, sizeof(struct journal));
-
-		j->nodeid = nodeid;
-		j->jid = node->jid;
-		list_add(&j->list, &mg->journals);
-	}
-}
-
-/* recovery_result and mount_done messages are saved by new members until
-   they've completed the start cycle and have member state to apply them to.
-   The start messages from old nodes may not reflect the rr/md updates. */
-
-static void apply_saved_messages(struct mountgroup *mg)
-{
-	struct change *cg;
-	struct save_msg *sm, *safe;
-	struct gfs_header *hd;
-
-	cg = list_first_entry(&mg->changes, struct change, list);
-
-	list_for_each_entry_safe(sm, safe, &cg->saved_messages, list) {
-		hd = (struct gfs_header *)sm->buf;
-
-		switch (hd->type) {
-		case GFS_MSG_MOUNT_DONE:
-			receive_mount_done(mg, hd, sm->len);
-			break;
-		case GFS_MSG_RECOVERY_RESULT:
-			receive_recovery_result(mg, hd, sm->len);
-			break;
-		}
-
-		list_del(&sm->list);
-		free(sm);
-	}
-}
-
-/* this is run immediately after receiving the final start message in a start
-   cycle, so all nodes will run this in the same sequence wrt other messages
-   and confchgs */
-
-static void sync_state(struct mountgroup *mg)
-{
-	/* This is needed for the case where the first_recovery_done message
-	   arrives while a change/start cycle is in progress.  The
-	   first_recovery data in the start messages (used by new nodes in this
-	   cycle to determine the first_recovery state) may be inconsistent in
-	   different start messages (because nodes sent their start messages at
-	   different times wrt the first_recovery_done message.)  But, in the
-	   case where the new nodes received the first_recovery_done message,
-	   they can just use that and don't need the (possibly inconsistent)
-	   first recovery data in the start messages. */
-
-	if (mg->first_recovery_msg) {
-		if (mg->first_recovery_needed || mg->first_recovery_master) {
-			/* shouldn't happen */
-			log_error("sync_state first_recovery_msg needed %d "
-				  "master %d", mg->first_recovery_needed,
-				  mg->first_recovery_master);
-		}
-
-		log_group(mg, "sync_state first_recovery_msg");
-		goto out;
-	}
-
-	/* This is the path the initial start cycle for the group always
-	   follows.  It's the case where one or more nodes are all starting up
-	   for the first time.  No one has completed a start cycle yet because
-	   everyone is joining, and one node needs to do first recovery. */
-
-	if (all_nodes_new(mg)) {
-		if (mg->first_recovery_needed || mg->first_recovery_master) {
-			/* shouldn't happen */
-			log_error("sync_state all_nodes_new first_recovery "
-				  "needed %d master %d",
-				  mg->first_recovery_needed,
-				  mg->first_recovery_master);
-		}
-		mg->first_recovery_needed = 1;
-		mg->first_recovery_master = pick_first_recovery_master(mg, 1);
-
-		log_group(mg, "sync_state all_nodes_new first_recovery_needed "
-			  "master %d", mg->first_recovery_master);
-		goto out;
-	}
-
-	/* This is for the case where new nodes are added to existing members
-	   that have first_recovery_needed set. */
-
-	if (any_nodes_first_recovery(mg)) {
-		mg->first_recovery_needed = 1;
-		mg->first_recovery_master = pick_first_recovery_master(mg, 0);
-
-		log_group(mg, "sync_state first_recovery_needed master %d",
-			  mg->first_recovery_master);
-		goto out;
-	}
-
-	/* Normal case where nodes join an established group that completed
-	   first recovery sometime in the past.  Existing nodes that weren't
-	   around during first recovery come through here, and new nodes
-           being added in this cycle come through here. */
-
-	if (mg->first_recovery_needed) {
-		/* shouldn't happen */
-		log_error("sync_state frn should not be set");
-		goto out;
-	}
-
-	log_group(mg, "sync_state");
- out:
-	send_withdraw_acks(mg);
-
-	if (!mg->started_count) {
-		create_old_nodes(mg);
-		create_new_nodes(mg);
-		create_failed_journals(mg);
-		apply_saved_messages(mg);
-		create_new_journals(mg);
-	} else {
-		create_new_nodes(mg);
-		set_failed_journals(mg);
-		create_new_journals(mg);
-	}
-}
-
-static void apply_changes(struct mountgroup *mg)
-{
-	struct change *cg;
-
-	cg = list_first_entry(&mg->changes, struct change, list);
-
-	switch (cg->state) {
-
-	case CGST_WAIT_CONDITIONS:
-		if (wait_conditions_done(mg)) {
-			send_start(mg);
-			cg->state = CGST_WAIT_MESSAGES;
-		}
-		break;
-
-	case CGST_WAIT_MESSAGES:
-		if (wait_messages_done(mg)) {
-			sync_state(mg);
-			cleanup_changes(mg);
-		}
-		break;
-
-	default:
-		log_error("apply_changes invalid state %d", cg->state);
-	}
-}
-
-/* We send messages with the info from kernel uevents or mount.gfs ipc,
-   and then process the uevent/ipc upon receiving the message for it, so
-   that it can be processed in the same order by all nodes. */
-
-void process_recovery_uevent(char *name, int jid, int recover_status,
-			     int first_done)
-{
-	struct mountgroup *mg;
-	struct journal *j;
-	int rv;
-
-	mg = find_mg(name);
-	if (!mg) {
-		log_error("recovery_uevent mg not found %s", name);
-		return;
-	}
-
-	if (jid < 0) {
-		/* for back compat, sysfs file deprecated */
-		rv = read_sysfs_int(mg, "recover_done", &jid);
-		if (rv < 0) {
-			log_error("recovery_uevent recover_done read %d", rv);
-			return;
-		}
-	}
-
-	if (recover_status < 0) {
-		/* for back compat, sysfs file deprecated */
-		rv = read_sysfs_int(mg, "recover_status", &recover_status);
-		if (rv < 0) {
-			log_error("recovery_uevent recover_status read %d", rv);
-			return;
-		}
-	}
-
-	if (!mg->first_recovery_needed) {
-		if (!mg->local_recovery_busy) {
-			/* This will happen in two known situations:
-			   - we get a recovery_done uevent for our own journal
-			     when we mount  (jid == mg->our_jid)
-			   - the first mounter can read first_done and clear
-			     first_recovery_needed before seeing the change
-			     uevent from others_may_mount */
-			log_group(mg, "recovery_uevent jid %d ignore", jid);
-			return;
-		}
-
-		mg->local_recovery_busy = 0;
-
-		if (mg->local_recovery_jid != jid) {
-			log_error("recovery_uevent jid %d expected %d", jid,
-				  mg->local_recovery_jid);
-			return;
-		}
-
-		j = find_journal(mg, jid);
-		if (!j) {
-			log_error("recovery_uevent no journal %d", jid);
-			return;
-		}
-
-		log_group(mg, "recovery_uevent jid %d status %d "
-			  "local_recovery_done %d needs_recovery %d",
-			  jid, recover_status, j->local_recovery_done,
-			  j->needs_recovery);
-
-		j->local_recovery_done = 1;
-		j->local_recovery_result = recover_status;
-
-		/* j->needs_recovery will be cleared when we receive this
-		   recovery_result message.  if it's already set, then
-		   someone else has completed the recovery and there's
-		   no need to send our result */
-
-		if (j->needs_recovery)
-			send_recovery_result(mg, jid, recover_status);
-	} else {
-		/*
-		 * Assumption here is that only the first mounter will get
-		 * uevents when first_recovery_needed is set.
-		 */
-
-		/* make a local record of jid and recover_status; we may want
-		   to check below that we've seen uevents for all jids
-		   during first recovery before sending first_recovery_done. */
-
-		log_group(mg, "recovery_uevent jid %d first recovery done %d",
-			  jid, mg->first_done_uevent);
-
-		/* ignore extraneous uevent from others_may_mount */
-		if (mg->first_done_uevent)
-			return;
-
-		if (first_done < 0) {
-			/* for back compat, sysfs file deprecated */
-			rv = read_sysfs_int(mg, "first_done", &first_done);
-			if (rv < 0) {
-				log_error("recovery_uevent first_done read %d", rv);
-				return;
-			}
-		}
-
-		if (first_done) {
-			log_group(mg, "recovery_uevent first_done");
-			mg->first_done_uevent = 1;
-			send_first_recovery_done(mg);
-		}
-	}
-
-	apply_changes_recovery(mg);
-}
-
-static void start_journal_recovery(struct mountgroup *mg, int jid)
-{
-	int rv;
-
-	log_group(mg, "start_journal_recovery jid %d", jid);
-
-	rv = set_sysfs(mg, "recover", jid);
-	if (rv < 0) {
-		log_error("start_journal_recovery %d error %d", jid, rv);
-		return;
-	}
-
-	mg->local_recovery_busy = 1;
-	mg->local_recovery_jid = jid;
-}
-
-static int wait_recoveries_done(struct mountgroup *mg)
-{
-	struct journal *j;
-	int wait_count = 0;
-
-	list_for_each_entry(j, &mg->journals, list) {
-		if (j->needs_recovery) {
-			log_group(mg, "wait_recoveries jid %d nodeid %d "
-				  "unrecovered", j->jid, j->failed_nodeid);
-			wait_count++;
-		}
-	}
-
-	if (wait_count)
-		return 0;
-
-	log_group(mg, "wait_recoveries done");
-	return 1;
-}
-
-/* pick a jid that has not been successfully recovered by someone else
-   (received recovery_result success message) and hasn't been recovered
-   by us (local record); if nothing to recover, return 0 */
-
-static int pick_journal_to_recover(struct mountgroup *mg, int *jid)
-{
-	struct journal *j;
-
-	list_for_each_entry(j, &mg->journals, list) {
-		if (j->needs_recovery && !j->local_recovery_done) {
-			*jid = j->jid;
-			return 1;
-		}
-	}
-
-#if 0
-	/* FIXME: do something so this doesn't happen so regularly; maybe
-	   retry only after all nodes have failed */
-
-	/* Retry recoveries that failed the first time.  This is necessary
-	   at times for withrawn journals when all nodes fail the recovery
-	   (fail to get journal lock) before the withdrawing node has had a
-	   chance to clear its dlm locks for the withdrawn journal.
-	   32 max retries is random, and includes attempts by all nodes. */
-
-	list_for_each_entry(j, &mg->journals, list) {
-		if (j->needs_recovery && j->local_recovery_done &&
-		    (j->local_recovery_result == LM_RD_GAVEUP) &&
-		    (j->failed_recovery_count > 1) &&
-		    (j->failed_recovery_count < 32)) {
-			log_group(mg, "retrying jid %d recovery", j->jid);
-			*jid = j->jid;
-			sleep(1); /* might this cause problems? */
-			return 1;
-		}
-	}
-#endif
-
-	return 0;
-}
-
-/* processing that happens after all changes have been dealt with */
-
-static void apply_recovery(struct mountgroup *mg)
-{
-	int jid;
-
-	if (mg->first_recovery_needed) {
-		if (mg->first_recovery_master == our_nodeid &&
-		    !mg->mount_client_notified) {
-			log_group(mg, "apply_recovery first start_kernel");
-			mg->first_mounter = 1; /* adds first=1 to hostdata */
-			start_kernel(mg);      /* includes reply to mount.gfs */
-		}
-		return;
-	}
-
-	/* The normal non-first-recovery mode.  When a recovery_done message
-	   is received, check whether any more journals need recovery.  If
-	   so, start recovery on the next one, if not, start the kernel. */
-
-	if (!wait_recoveries_done(mg)) {
-		if (!mg->kernel_mount_done || mg->kernel_mount_error)
-			return;
-		if (mg->spectator)
-			return;
-		if (mg->local_recovery_busy)
-			return;
-		if (pick_journal_to_recover(mg, &jid))
-			start_journal_recovery(mg, jid);
-	} else {
-		if (!mg->kernel_stopped)
-			return;
-		log_group(mg, "apply_recovery start_kernel");
-		start_kernel(mg);
-	}
-}
-
-static void apply_changes_recovery(struct mountgroup *mg)
-{
-	if (!list_empty(&mg->changes))
-		apply_changes(mg);
-	
-	if (mg->started_change && list_empty(&mg->changes))
-		apply_recovery(mg);
-}
-
-void process_mountgroups(void)
-{
-	struct mountgroup *mg, *safe;
-
-	list_for_each_entry_safe(mg, safe, &mountgroups, list)
-		apply_changes_recovery(mg);
-}
-
-static int add_change(struct mountgroup *mg,
-		      struct cpg_address *member_list, int member_list_entries,
-		      struct cpg_address *left_list, int left_list_entries,
-		      struct cpg_address *joined_list, int joined_list_entries,
-		      struct change **cg_out)
-{
-	struct change *cg;
-	struct member *memb;
-	int i, error;
-
-	cg = malloc(sizeof(struct change));
-	if (!cg)
-		goto fail_nomem;
-	memset(cg, 0, sizeof(struct change));
-	INIT_LIST_HEAD(&cg->members);
-	INIT_LIST_HEAD(&cg->removed);
-	INIT_LIST_HEAD(&cg->saved_messages);
-	cg->state = CGST_WAIT_CONDITIONS;
-	cg->seq = ++mg->change_seq;
-	if (!cg->seq)
-		cg->seq = ++mg->change_seq;
-
-	cg->member_count = member_list_entries;
-	cg->joined_count = joined_list_entries;
-	cg->remove_count = left_list_entries;
-
-	for (i = 0; i < member_list_entries; i++) {
-		memb = malloc(sizeof(struct member));
-		if (!memb)
-			goto fail_nomem;
-		memset(memb, 0, sizeof(struct member));
-		memb->nodeid = member_list[i].nodeid;
-		list_add_tail(&memb->list, &cg->members);
-	}
-
-	for (i = 0; i < left_list_entries; i++) {
-		memb = malloc(sizeof(struct member));
-		if (!memb)
-			goto fail_nomem;
-		memset(memb, 0, sizeof(struct member));
-		memb->nodeid = left_list[i].nodeid;
-		if (left_list[i].reason == CPG_REASON_NODEDOWN ||
-		    left_list[i].reason == CPG_REASON_PROCDOWN) {
-			memb->failed = 1;
-			cg->failed_count++;
-		}
-		list_add_tail(&memb->list, &cg->removed);
-
-		if (memb->failed)
-			node_history_fail(mg, memb->nodeid, cg,
-					  left_list[i].reason);
-		else
-			node_history_left(mg, memb->nodeid, cg);
-
-		log_group(mg, "add_change cg %u remove nodeid %d reason %d",
-			  cg->seq, memb->nodeid, left_list[i].reason);
-
-		if (left_list[i].reason == CPG_REASON_PROCDOWN)
-			kick_node_from_cluster(memb->nodeid);
-	}
-
-	for (i = 0; i < joined_list_entries; i++) {
-		memb = find_memb(cg, joined_list[i].nodeid);
-		if (!memb) {
-			log_error("no member %d", joined_list[i].nodeid);
-			error = -ENOENT;
-			goto fail;
-		}
-		memb->added = 1;
-
-		if (memb->nodeid == our_nodeid)
-			cg->we_joined = 1;
-		else
-			node_history_init(mg, memb->nodeid, cg);
-
-		log_group(mg, "add_change cg %u joined nodeid %d", cg->seq,
-			  memb->nodeid);
-	}
-
-	if (cg->we_joined) {
-		log_group(mg, "add_change cg %u we joined", cg->seq);
-		list_for_each_entry(memb, &cg->members, list)
-			node_history_init(mg, memb->nodeid, cg);
-	}
-
-	log_group(mg, "add_change cg %u counts member %d joined %d remove %d "
-		  "failed %d", cg->seq, cg->member_count, cg->joined_count,
-		  cg->remove_count, cg->failed_count);
-
-	list_add(&cg->list, &mg->changes);
-	*cg_out = cg;
-	return 0;
-
- fail_nomem:
-	log_error("no memory");
-	error = -ENOMEM;
- fail:
-	free_cg(cg);
-	return error;
-}
-
-static int we_left(struct cpg_address *left_list, int left_list_entries)
-{
-	int i;
-
-	for (i = 0; i < left_list_entries; i++) {
-		if (left_list[i].nodeid == our_nodeid)
-			return 1;
-	}
-	return 0;
-}
-
-static void confchg_cb(cpg_handle_t handle, struct cpg_name *group_name,
-		       struct cpg_address *member_list, int member_list_entries,
-		       struct cpg_address *left_list, int left_list_entries,
-		       struct cpg_address *joined_list, int joined_list_entries)
-{
-	struct mountgroup *mg;
-	struct change *cg;
-	int rv;
-
-	mg = find_mg_handle(handle);
-	if (!mg) {
-		log_error("confchg_cb no mountgroup for cpg %s",
-			  group_name->value);
-		return;
-	}
-
-	if (mg->leaving && we_left(left_list, left_list_entries)) {
-		/* we called cpg_leave(), and this should be the final
-		   cpg callback we receive */
-		log_group(mg, "confchg for our leave");
-		dlmc_fs_unregister(dlmcontrol_fd, mg->name);
-		cpg_finalize(mg->cpg_handle);
-		client_dead(mg->cpg_client);
-		list_del(&mg->list);
-		if (!mg->withdraw_uevent) {
-			free_mg(mg);
-		} else {
-			if (!member_list_entries) {
-				/* no one remaining to send us an ack */
-				set_sysfs(mg, "withdraw", 1);
-				free_mg(mg);
-			} else {
-				/* set the sysfs withdraw file and free the mg
-				   when the ack arrives */
-				list_add(&mg->list, &withdrawn_mounts);
-			}
-		}
-		return;
-	}
-
-	rv = add_change(mg, member_list, member_list_entries,
-			left_list, left_list_entries,
-			joined_list, joined_list_entries, &cg);
-	if (rv)
-		return;
-
-	apply_changes_recovery(mg);
-}
-
-static void gfs_header_in(struct gfs_header *hd)
-{
-	hd->version[0]  = le16_to_cpu(hd->version[0]);
-	hd->version[1]  = le16_to_cpu(hd->version[1]);
-	hd->version[2]  = le16_to_cpu(hd->version[2]);
-	hd->type        = le16_to_cpu(hd->type);
-	hd->nodeid      = le32_to_cpu(hd->nodeid);
-	hd->to_nodeid   = le32_to_cpu(hd->to_nodeid);
-	hd->global_id   = le32_to_cpu(hd->global_id);
-	hd->flags       = le32_to_cpu(hd->flags);
-	hd->msgdata     = le32_to_cpu(hd->msgdata);
-}
-
-static int gfs_header_check(struct gfs_header *hd, int nodeid)
-{
-	if (hd->version[0] != our_protocol.daemon_run[0] ||
-	    hd->version[1] != our_protocol.daemon_run[1]) {
-		log_error("reject message from %d version %u.%u.%u vs %u.%u.%u",
-			  nodeid, hd->version[0], hd->version[1],
-			  hd->version[2], our_protocol.daemon_run[0],
-			  our_protocol.daemon_run[1],
-			  our_protocol.daemon_run[2]);
-		return -1;
-	}
-
-	if (hd->nodeid != nodeid) {
-		log_error("bad message nodeid %d %d", hd->nodeid, nodeid);
-		return -1;
-	}
-
-	return 0;
-}
-
-static void deliver_cb(cpg_handle_t handle, struct cpg_name *group_name,
-		       uint32_t nodeid, uint32_t pid, void *data, int len)
-{
-	struct mountgroup *mg;
-	struct gfs_header *hd;
-
-	mg = find_mg_handle(handle);
-	if (!mg) {
-		log_error("deliver_cb no mg for cpg %s", group_name->value);
-		return;
-	}
-
-	if (len < sizeof(*hd)) {
-		log_error("deliver_cb short message %d", len);
-		return;
-	}
-
-	hd = (struct gfs_header *)data;
-	gfs_header_in(hd);
-
-	if (gfs_header_check(hd, nodeid) < 0)
-		return;
-
-	switch (hd->type) {
-	case GFS_MSG_START:
-		receive_start(mg, hd, len);
-		break;
-	case GFS_MSG_MOUNT_DONE:
-		if (!mg->started_count)
-			save_message(mg, hd, len);
-		else
-			receive_mount_done(mg, hd, len);
-		break;
-	case GFS_MSG_FIRST_RECOVERY_DONE:
-		receive_first_recovery_done(mg, hd, len);
-		break;
-	case GFS_MSG_RECOVERY_RESULT:
-		if (!mg->started_count)
-			save_message(mg, hd, len);
-		else
-			receive_recovery_result(mg, hd, len);
-		break;
-	case GFS_MSG_REMOUNT:
-		receive_remount(mg, hd, len);
-		break;
-	case GFS_MSG_WITHDRAW:
-		receive_withdraw(mg, hd, len);
-		break;
-	default:
-		log_error("unknown msg type %d", hd->type);
-	}
-
-	apply_changes_recovery(mg);
-}
-
-static cpg_callbacks_t cpg_callbacks = {
-	.cpg_deliver_fn = deliver_cb,
-	.cpg_confchg_fn = confchg_cb,
-};
-
-static void process_mountgroup_cpg(int ci)
-{
-	struct mountgroup *mg;
-	cpg_error_t error;
-
-	mg = find_mg_ci(ci);
-	if (!mg) {
-		log_error("process_mountgroup_cpg no mountgroup for ci %d", ci);
-		return;
-	}
-
-	error = cpg_dispatch(mg->cpg_handle, CPG_DISPATCH_ALL);
-	if (error != CPG_OK) {
-		log_error("cpg_dispatch error %d", error);
-		return;
-	}
-
-	update_flow_control_status();
-}
-
-int gfs_join_mountgroup(struct mountgroup *mg)
-{
-	cpg_error_t error;
-	cpg_handle_t h;
-	struct cpg_name name;
-	int i = 0, fd, ci, rv;
-
-	/* I think this registration with dlm_controld could be done
-	   just about anywhere before we do the mount(2). */
-	rv = dlmc_fs_register(dlmcontrol_fd, mg->name);
-	if (rv) {
-		log_error("dlmc_fs_register failed %d", rv);
-		return rv;
-	}
-
-	error = cpg_initialize(&h, &cpg_callbacks);
-	if (error != CPG_OK) {
-		log_error("cpg_initialize error %d", error);
-		goto fail;
-	}
-
-	cpg_fd_get(h, &fd);
-
-	ci = client_add(fd, process_mountgroup_cpg, NULL);
-
-	mg->cpg_handle = h;
-	mg->cpg_client = ci;
-	mg->cpg_fd = fd;
-	mg->kernel_stopped = 1;
-	mg->joining = 1;
-
-	memset(&name, 0, sizeof(name));
-	sprintf(name.value, "gfs:mount:%s", mg->name);
-	name.length = strlen(name.value) + 1;
-
-	/* TODO: allow global_id to be set in cluster.conf? */
-	mg->id = cpgname_to_crc(name.value, name.length);
-
- retry:
-	error = cpg_join(h, &name);
-	if (error == CPG_ERR_TRY_AGAIN) {
-		sleep(1);
-		if (!(++i % 10))
-			log_error("cpg_join error retrying");
-		goto retry;
-	}
-	if (error != CPG_OK) {
-		log_error("cpg_join error %d", error);
-		cpg_finalize(h);
-		goto fail_client;
-	}
-
-	return 0;
-
- fail_client:
-	client_dead(ci);
-	cpg_finalize(h);
- fail:
-	dlmc_fs_unregister(dlmcontrol_fd, mg->name);
-	return -ENOTCONN;
-}
-
-/* If mount(2) fails, we'll often get two leaves, one from seeing the remove
-   uevent, and the other from mount.gfs.  I suspect they could arrive in either
-   order.  We can just ignore the second.  The second would either not find
-   the mg here, or would see mg->leaving of 1 from the first. */
-
-static void leave_mountgroup(struct mountgroup *mg, int mnterr)
-{
-	cpg_error_t error;
-	struct cpg_name name;
-	int i = 0;
-
-	if (mg->leaving) {
-		log_group(mg, "leave: already leaving");
-		return;
-	}
-	mg->leaving = 1;
-
-	memset(&name, 0, sizeof(name));
-	sprintf(name.value, "gfs:mount:%s", mg->name);
-	name.length = strlen(name.value) + 1;
-
- retry:
-	error = cpg_leave(mg->cpg_handle, &name);
-	if (error == CPG_ERR_TRY_AGAIN) {
-		sleep(1);
-		if (!(++i % 10))
-			log_error("cpg_leave error retrying");
-		goto retry;
-	}
-	if (error != CPG_OK)
-		log_error("cpg_leave error %d", error);
-}
-
-void do_leave(char *name, int mnterr)
-{
-	struct mountgroup *mg;
-
-	log_debug("do_leave %s mnterr %d", name, mnterr);
-
-	mg = find_mg(name);
-	if (!mg) {
-		log_error("do_leave: %s not found", name);
-		return;
-	}
-
-	if (mg->withdraw_uevent) {
-		log_group(mg, "do_leave: ignored during withdraw");
-		return;
-	}
-
-	leave_mountgroup(mg, mnterr);
-}
-
-static void receive_withdraw_ack(struct gfs_header *hd, int len)
-{
-	struct mountgroup *mg;
-
-	if (hd->to_nodeid != our_nodeid)
-		return;
-
-	log_debug("receive_withdraw_ack from %d global_id %x",
-		  hd->nodeid, hd->global_id);
-
-	list_for_each_entry(mg, &withdrawn_mounts, list) {
-		if (mg->id != hd->global_id)
-			continue;
-		set_sysfs(mg, "withdraw", 1);
-		list_del(&mg->list);
-		free_mg(mg);
-		break;
-	}
-}
-
-static void send_withdraw_ack(struct mountgroup *mg, int nodeid)
-{
-	struct gfs_header h;
-
-	memset(&h, 0, sizeof(h));
-
-	h.version[0]	= cpu_to_le16(our_protocol.daemon_run[0]);
-	h.version[1]	= cpu_to_le16(our_protocol.daemon_run[1]);
-	h.version[2]	= cpu_to_le16(our_protocol.daemon_run[2]);
-	h.type		= cpu_to_le16(GFS_MSG_WITHDRAW_ACK);
-	h.nodeid	= cpu_to_le32(our_nodeid);
-	h.to_nodeid	= cpu_to_le32(nodeid);
-	h.global_id	= cpu_to_le32(mg->id);
-
-	_send_message(cpg_handle_daemon, (char *)&h, sizeof(h),
-		      GFS_MSG_WITHDRAW_ACK);
-}
-
-/* Everyone remaining in the group will send an ack for the withdrawn fs;
-   all but the first will be ignored. */
-
-static void send_withdraw_acks(struct mountgroup *mg)
-{
-	struct node *node;
-
-	list_for_each_entry(node, &mg->node_history, list) {
-		if (node->withdraw && !node->send_withdraw_ack) {
-			send_withdraw_ack(mg, node->nodeid);
-			node->send_withdraw_ack = 1;
-		}
-	}
-}
-
-static struct node *get_node_daemon(int nodeid)
-{
-	struct node *node;
-
-	list_for_each_entry(node, &daemon_nodes, list) {
-		if (node->nodeid == nodeid)
-			return node;
-	}
-	return NULL;
-}
-
-static void add_node_daemon(int nodeid)
-{
-	struct node *node;
-
-	if (get_node_daemon(nodeid))
-		return;
-
-	node = malloc(sizeof(struct node));
-	if (!node) {
-		log_error("add_node_daemon no mem");
-		return;
-	}
-	memset(node, 0, sizeof(struct node));
-	node->nodeid = nodeid;
-	list_add_tail(&node->list, &daemon_nodes);
-}
-
-static void pv_in(struct protocol_version *pv)
-{
-	pv->major = le16_to_cpu(pv->major);
-	pv->minor = le16_to_cpu(pv->minor);
-	pv->patch = le16_to_cpu(pv->patch);
-	pv->flags = le16_to_cpu(pv->flags);
-}
-
-static void pv_out(struct protocol_version *pv)
-{
-	pv->major = cpu_to_le16(pv->major);
-	pv->minor = cpu_to_le16(pv->minor);
-	pv->patch = cpu_to_le16(pv->patch);
-	pv->flags = cpu_to_le16(pv->flags);
-}
-
-static void protocol_in(struct protocol *proto)
-{
-	pv_in(&proto->dm_ver);
-	pv_in(&proto->km_ver);
-	pv_in(&proto->dr_ver);
-	pv_in(&proto->kr_ver);
-}
-
-static void protocol_out(struct protocol *proto)
-{
-	pv_out(&proto->dm_ver);
-	pv_out(&proto->km_ver);
-	pv_out(&proto->dr_ver);
-	pv_out(&proto->kr_ver);
-}
-
-/* go through member list saved in last confchg, see if we have received a
-   proto message from each */
-
-static int all_protocol_messages(void)
-{
-	struct node *node;
-	int i;
-
-	if (!daemon_member_count)
-		return 0;
-
-	for (i = 0; i < daemon_member_count; i++) {
-		node = get_node_daemon(daemon_member[i].nodeid);
-		if (!node) {
-			log_error("all_protocol_messages no node %d",
-				  daemon_member[i].nodeid);
-			return 0;
-		}
-
-		if (!node->proto.daemon_max[0])
-			return 0;
-	}
-	return 1;
-}
-
-static int pick_min_protocol(struct protocol *proto)
-{
-	uint16_t mind[4];
-	uint16_t mink[4];
-	struct node *node;
-	int i;
-
-	memset(&mind, 0, sizeof(mind));
-	memset(&mink, 0, sizeof(mink));
-
-	/* first choose the minimum major */
-
-	for (i = 0; i < daemon_member_count; i++) {
-		node = get_node_daemon(daemon_member[i].nodeid);
-		if (!node) {
-			log_error("pick_min_protocol no node %d",
-				  daemon_member[i].nodeid);
-			return -1;
-		}
-
-		if (!mind[0] || node->proto.daemon_max[0] < mind[0])
-			mind[0] = node->proto.daemon_max[0];
-
-		if (!mink[0] || node->proto.kernel_max[0] < mink[0])
-			mink[0] = node->proto.kernel_max[0];
-	}
-
-	if (!mind[0] || !mink[0]) {
-		log_error("pick_min_protocol zero major number");
-		return -1;
-	}
-
-	/* second pick the minimum minor with the chosen major */
-
-	for (i = 0; i < daemon_member_count; i++) {
-		node = get_node_daemon(daemon_member[i].nodeid);
-		if (!node)
-			continue;
-
-		if (mind[0] == node->proto.daemon_max[0]) {
-			if (!mind[1] || node->proto.daemon_max[1] < mind[1])
-				mind[1] = node->proto.daemon_max[1];
-		}
-
-		if (mink[0] == node->proto.kernel_max[0]) {
-			if (!mink[1] || node->proto.kernel_max[1] < mink[1])
-				mink[1] = node->proto.kernel_max[1];
-		}
-	}
-
-	if (!mind[1] || !mink[1]) {
-		log_error("pick_min_protocol zero minor number");
-		return -1;
-	}
-
-	/* third pick the minimum patch with the chosen major.minor */
-
-	for (i = 0; i < daemon_member_count; i++) {
-		node = get_node_daemon(daemon_member[i].nodeid);
-		if (!node)
-			continue;
-
-		if (mind[0] == node->proto.daemon_max[0] &&
-		    mind[1] == node->proto.daemon_max[1]) {
-			if (!mind[2] || node->proto.daemon_max[2] < mind[2])
-				mind[2] = node->proto.daemon_max[2];
-		}
-
-		if (mink[0] == node->proto.kernel_max[0] &&
-		    mink[1] == node->proto.kernel_max[1]) {
-			if (!mink[2] || node->proto.kernel_max[2] < mink[2])
-				mink[2] = node->proto.kernel_max[2];
-		}
-	}
-
-	if (!mind[2] || !mink[2]) {
-		log_error("pick_min_protocol zero patch number");
-		return -1;
-	}
-
-	memcpy(&proto->daemon_run, &mind, sizeof(mind));
-	memcpy(&proto->kernel_run, &mink, sizeof(mink));
-	return 0;
-}
-
-static void receive_protocol(struct gfs_header *hd, int len)
-{
-	struct protocol *p;
-	struct node *node;
-
-	p = (struct protocol *)((char *)hd + sizeof(struct gfs_header));
-	protocol_in(p);
-
-	if (len < sizeof(struct gfs_header) + sizeof(struct protocol)) {
-		log_error("receive_protocol invalid len %d from %d",
-			  len, hd->nodeid);
-		return;
-	}
-
-	/* zero is an invalid version value */
-
-	if (!p->daemon_max[0] || !p->daemon_max[1] || !p->daemon_max[2] ||
-	    !p->kernel_max[0] || !p->kernel_max[1] || !p->kernel_max[2]) {
-		log_error("receive_protocol invalid max value from %d "
-			  "daemon %u.%u.%u kernel %u.%u.%u", hd->nodeid,
-			  p->daemon_max[0], p->daemon_max[1], p->daemon_max[2],
-			  p->kernel_max[0], p->kernel_max[1], p->kernel_max[2]);
-		return;
-	}
-
-	/* the run values will be zero until a version is set, after
-	   which none of the run values can be zero */
-
-	if (p->daemon_run[0] && (!p->daemon_run[1] || !p->daemon_run[2] ||
-	    !p->kernel_run[0] || !p->kernel_run[1] || !p->kernel_run[2])) {
-		log_error("receive_protocol invalid run value from %d "
-			  "daemon %u.%u.%u kernel %u.%u.%u", hd->nodeid,
-			  p->daemon_run[0], p->daemon_run[1], p->daemon_run[2],
-			  p->kernel_run[0], p->kernel_run[1], p->kernel_run[2]);
-		return;
-	}
-
-	/* if we have zero run values, and this msg has non-zero run values,
-	   then adopt them as ours; otherwise save this proto message */
-
-	if (our_protocol.daemon_run[0])
-		return;
-
-	if (p->daemon_run[0]) {
-		memcpy(&our_protocol.daemon_run, &p->daemon_run,
-		       sizeof(struct protocol_version));
-		memcpy(&our_protocol.kernel_run, &p->kernel_run,
-		       sizeof(struct protocol_version));
-		log_debug("run protocol from nodeid %d", hd->nodeid);
-		return;
-	}
-
-	/* save this node's proto so we can tell when we've got all, and
-	   use it to select a minimum protocol from all */
-
-	node = get_node_daemon(hd->nodeid);
-	if (!node) {
-		log_error("receive_protocol no node %d", hd->nodeid);
-		return;
-	}
-	memcpy(&node->proto, p, sizeof(struct protocol));
-}
-
-static void send_protocol(struct protocol *proto)
-{
-	struct gfs_header *hd;
-	struct protocol *pr;
-	char *buf;
-	int len;
-
-	len = sizeof(struct gfs_header) + sizeof(struct protocol);
-	buf = malloc(len);
-	if (!buf) {
-		log_error("send_protocol no mem %d", len);
-		return;
-	}
-	memset(buf, 0, len);
-
-	hd = (struct gfs_header *)buf;
-	pr = (struct protocol *)(buf + sizeof(*hd));
-
-	hd->type = cpu_to_le16(GFS_MSG_PROTOCOL);
-	hd->nodeid = cpu_to_le32(our_nodeid);
-
-	memcpy(pr, proto, sizeof(struct protocol));
-	protocol_out(pr);
-
-	_send_message(cpg_handle_daemon, buf, len, GFS_MSG_PROTOCOL);
-}
-
-int set_protocol(void)
-{
-	struct protocol proto;
-	struct pollfd pollfd;
-	int sent_proposal = 0;
-	int rv;
-
-	memset(&pollfd, 0, sizeof(pollfd));
-	pollfd.fd = daemon_cpg_fd;
-	pollfd.events = POLLIN;
-
-	while (1) {
-		if (our_protocol.daemon_run[0])
-			break;
-
-		if (!sent_proposal && all_protocol_messages()) {
-			/* propose a protocol; look through info from all
-			   nodes and pick the min for both daemon and kernel,
-			   and propose that */
-
-			sent_proposal = 1;
-
-			/* copy our max values */
-			memcpy(&proto, &our_protocol, sizeof(struct protocol));
-
-			rv = pick_min_protocol(&proto);
-			if (rv < 0)
-				return rv;
-
-			log_debug("set_protocol member_count %d propose "
-				  "daemon %u.%u.%u kernel %u.%u.%u",
-				  daemon_member_count,
-				  proto.daemon_run[0], proto.daemon_run[1],
-				  proto.daemon_run[2], proto.kernel_run[0],
-				  proto.kernel_run[1], proto.kernel_run[2]);
-
-			send_protocol(&proto);
-		}
-
-		/* only process messages/events from daemon cpg until protocol
-		   is established */
-
-		rv = poll(&pollfd, 1, -1);
-		if (rv == -1 && errno == EINTR) {
-			if (daemon_quit)
-				return -1;
-			continue;
-		}
-		if (rv < 0) {
-			log_error("set_protocol poll errno %d", errno);
-			return -1;
-		}
-
-		if (pollfd.revents & POLLIN)
-			process_cpg(0);
-		if (pollfd.revents & (POLLERR | POLLHUP | POLLNVAL)) {
-			log_error("set_protocol poll revents %u",
-				  pollfd.revents);
-			return -1;
-		}
-	}
-
-	if (our_protocol.daemon_run[0] != our_protocol.daemon_max[0] ||
-	    our_protocol.daemon_run[1] > our_protocol.daemon_max[1]) {
-		log_error("incompatible daemon protocol run %u.%u.%u max %u.%u.%u",
-			our_protocol.daemon_run[0],
-			our_protocol.daemon_run[1],
-			our_protocol.daemon_run[2],
-			our_protocol.daemon_max[0],
-			our_protocol.daemon_max[1],
-			our_protocol.daemon_max[2]);
-		return -1;
-	}
-
-	if (our_protocol.kernel_run[0] != our_protocol.kernel_max[0] ||
-	    our_protocol.kernel_run[1] > our_protocol.kernel_max[1]) {
-		log_error("incompatible kernel protocol run %u.%u.%u max %u.%u.%u",
-			our_protocol.kernel_run[0],
-			our_protocol.kernel_run[1],
-			our_protocol.kernel_run[2],
-			our_protocol.kernel_max[0],
-			our_protocol.kernel_max[1],
-			our_protocol.kernel_max[2]);
-		return -1;
-	}
-
-	log_debug("daemon run %u.%u.%u max %u.%u.%u "
-		  "kernel run %u.%u.%u max %u.%u.%u",
-		  our_protocol.daemon_run[0],
-		  our_protocol.daemon_run[1],
-		  our_protocol.daemon_run[2],
-		  our_protocol.daemon_max[0],
-		  our_protocol.daemon_max[1],
-		  our_protocol.daemon_max[2],
-		  our_protocol.kernel_run[0],
-		  our_protocol.kernel_run[1],
-		  our_protocol.kernel_run[2],
-		  our_protocol.kernel_max[0],
-		  our_protocol.kernel_max[1],
-		  our_protocol.kernel_max[2]);
-	return 0;
-}
-
-static void deliver_cb_daemon(cpg_handle_t handle, struct cpg_name *group_name,
-		uint32_t nodeid, uint32_t pid, void *data, int len)
-{
-	struct gfs_header *hd;
-
-	if (len < sizeof(*hd)) {
-		log_error("deliver_cb short message %d", len);
-		return;
-	}
-
-	hd = (struct gfs_header *)data;
-	gfs_header_in(hd);
-
-	switch (hd->type) {
-	case GFS_MSG_PROTOCOL:
-		receive_protocol(hd, len);
-		break;
-	case GFS_MSG_WITHDRAW_ACK:
-		if (gfs_header_check(hd, nodeid) < 0)
-			return;
-		receive_withdraw_ack(hd, len);
-		break;
-	default:
-		log_error("deliver_cb_daemon unknown msg type %d", hd->type);
-	}
-}
-
-static void confchg_cb_daemon(cpg_handle_t handle, struct cpg_name *group_name,
-		struct cpg_address *member_list, int member_list_entries,
-		struct cpg_address *left_list, int left_list_entries,
-		struct cpg_address *joined_list, int joined_list_entries)
-{
-	int i;
-
-	if (joined_list_entries)
-		send_protocol(&our_protocol);
-
-	memset(&daemon_member, 0, sizeof(daemon_member));
-	daemon_member_count = member_list_entries;
-
-	for (i = 0; i < member_list_entries; i++) {
-		daemon_member[i] = member_list[i];
-		add_node_daemon(member_list[i].nodeid);
-	}
-}
-
-static cpg_callbacks_t cpg_callbacks_daemon = {
-	.cpg_deliver_fn = deliver_cb_daemon,
-	.cpg_confchg_fn = confchg_cb_daemon,
-};
-
-void process_cpg(int ci)
-{
-	cpg_error_t error;
-
-	error = cpg_dispatch(cpg_handle_daemon, CPG_DISPATCH_ALL);
-	if (error != CPG_OK)
-		log_error("daemon cpg_dispatch error %d", error);
-}
-
-int setup_cpg(void)
-{
-	cpg_error_t error;
-	cpg_handle_t h;
-	struct cpg_name name;
-	int i = 0;
-
-	INIT_LIST_HEAD(&daemon_nodes);
-
-	memset(&our_protocol, 0, sizeof(our_protocol));
-	our_protocol.daemon_max[0] = 1;
-	our_protocol.daemon_max[1] = 1;
-	our_protocol.daemon_max[2] = 1;
-	our_protocol.kernel_max[0] = 1;
-	our_protocol.kernel_max[1] = 1;
-	our_protocol.kernel_max[2] = 1;
-
-	error = cpg_initialize(&h, &cpg_callbacks_daemon);
-	if (error != CPG_OK) {
-		log_error("daemon cpg_initialize error %d", error);
-		return -1;
-	}
-
-	cpg_fd_get(h, &daemon_cpg_fd);
-
-	cpg_handle_daemon = h;
-
-	memset(&name, 0, sizeof(name));
-	sprintf(name.value, "gfs:controld");
-	name.length = strlen(name.value) + 1;
-
- retry:
-	error = cpg_join(h, &name);
-	if (error == CPG_ERR_TRY_AGAIN) {
-		sleep(1);
-		if (!(++i % 10))
-			log_error("daemon cpg_join error retrying");
-		goto retry;
-	}
-	if (error != CPG_OK) {
-		log_error("daemon cpg_join error %d", error);
-		goto fail;
-	}
-
-	log_debug("setup_cpg %d", daemon_cpg_fd);
-	return daemon_cpg_fd;
-
- fail:
-	cpg_finalize(h);
-	return -1;
-}
-
-void close_cpg(void)
-{
-	cpg_error_t error;
-	struct cpg_name name;
-	int i = 0;
-
-	if (!cpg_handle_daemon || cluster_down)
-		return;
-
-	memset(&name, 0, sizeof(name));
-	sprintf(name.value, "gfs:controld");
-	name.length = strlen(name.value) + 1;
-
- retry:
-	error = cpg_leave(cpg_handle_daemon, &name);
-	if (error == CPG_ERR_TRY_AGAIN) {
-		sleep(1);
-		if (!(++i % 10))
-			log_error("daemon cpg_leave error retrying");
-		goto retry;
-	}
-	if (error != CPG_OK)
-		log_error("daemon cpg_leave error %d", error);
-}
-
-int setup_dlmcontrol(void)
-{
-	int fd;
-
-	fd = dlmc_fs_connect();
-	if (fd < 0)
-		log_error("cannot connect to dlm_controld %d", fd);
-	else
-		dlmcontrol_fd = fd;
-
-	return fd;
-}
-
-int set_mountgroup_info(struct mountgroup *mg, struct gfsc_mountgroup *out)
-{
-	struct change *cg, *last = NULL;
-
-	strncpy(out->name, mg->name, GFS_MOUNTGROUP_LEN);
-	out->global_id = mg->id;
-
-	if (mg->joining)
-		out->flags |= GFSC_MF_JOINING;
-	if (mg->leaving)
-		out->flags |= GFSC_MF_LEAVING;
-	if (mg->kernel_stopped)
-		out->flags |= GFSC_MF_KERNEL_STOPPED;
-	if (mg->kernel_mount_done)
-		out->flags |= GFSC_MF_KERNEL_MOUNT_DONE;
-	if (mg->kernel_mount_error)
-		out->flags |= GFSC_MF_KERNEL_MOUNT_ERROR;
-	if (mg->first_recovery_needed)
-		out->flags |= GFSC_MF_FIRST_RECOVERY_NEEDED;
-	if (mg->first_recovery_msg)
-		out->flags |= GFSC_MF_FIRST_RECOVERY_MSG;
-	if (mg->local_recovery_busy)
-		out->flags |= GFSC_MF_LOCAL_RECOVERY_BUSY;
-
-	if (!mg->started_change)
-		goto next;
-
-	cg = mg->started_change;
-
-	out->cg_prev.member_count = cg->member_count;
-	out->cg_prev.joined_count = cg->joined_count;
-	out->cg_prev.remove_count = cg->remove_count;
-	out->cg_prev.failed_count = cg->failed_count;
-	out->cg_prev.combined_seq = cg->combined_seq;
-	out->cg_prev.seq = cg->seq;
-
- next:
-	if (list_empty(&mg->changes))
-		goto out;
-
-	list_for_each_entry(cg, &mg->changes, list)
-		last = cg;
-
-	cg = list_first_entry(&mg->changes, struct change, list);
-
-	out->cg_next.member_count = cg->member_count;
-	out->cg_next.joined_count = cg->joined_count;
-	out->cg_next.remove_count = cg->remove_count;
-	out->cg_next.failed_count = cg->failed_count;
-	out->cg_next.combined_seq = last->seq;
-	out->cg_next.seq = cg->seq;
-
-	/* FIXME: use real definitions for these conditions
-	   (also in dlm_controld) */
-
-	if (cg->state == CGST_WAIT_CONDITIONS)
-		out->cg_next.wait_condition = 4;
-	if (!mg->kernel_mount_done)
-		out->cg_next.wait_condition = 1;
-	if (mg->dlm_notify_nodeid)
-		out->cg_next.wait_condition = 2;
-	if (poll_dlm)
-		out->cg_next.wait_condition = 3;
-
-	if (cg->state == CGST_WAIT_MESSAGES)
-		out->cg_next.wait_messages = 1;
- out:
-	return 0;
-}
-
-static int _set_node_info(struct mountgroup *mg, struct change *cg, int nodeid,
-			  struct gfsc_node *node)
-{
-	struct member *m = NULL;
-	struct node *n;
-
-	node->nodeid = nodeid;
-
-	if (cg)
-		m = find_memb(cg, nodeid);
-	if (!m)
-		goto history;
-
-	node->flags |= GFSC_NF_MEMBER;
-
-	if (m->start)
-		node->flags |= GFSC_NF_START;
-	if (m->disallowed)
-		node->flags |= GFSC_NF_DISALLOWED;
-
- history:
-	n = get_node_history(mg, nodeid);
-	if (!n)
-		goto out;
-
-	node->jid = n->jid;
-
-	if (n->kernel_mount_done)
-		node->flags |= GFSC_NF_KERNEL_MOUNT_DONE;
-	if (n->kernel_mount_error)
-		node->flags |= GFSC_NF_KERNEL_MOUNT_ERROR;
-	if (n->check_dlm)
-		node->flags |= GFSC_NF_CHECK_DLM;
-	if (n->ro)
-		node->flags |= GFSC_NF_READONLY;
-	if (n->spectator)
-		node->flags |= GFSC_NF_SPECTATOR;
-
-	node->added_seq = n->added_seq;
-	node->removed_seq = n->removed_seq;
-	node->failed_reason = n->failed_reason;
- out:
-	return 0;
-}
-
-int set_node_info(struct mountgroup *mg, int nodeid, struct gfsc_node *node)
-{
-	struct change *cg;
-
-	if (!list_empty(&mg->changes)) {
-		cg = list_first_entry(&mg->changes, struct change, list);
-		return _set_node_info(mg, cg, nodeid, node);
-	}
-
-	return _set_node_info(mg, mg->started_change, nodeid, node);
-}
-
-int set_mountgroups(int *count, struct gfsc_mountgroup **mgs_out)
-{
-	struct mountgroup *mg;
-	struct gfsc_mountgroup *mgs, *mgp;
-	int mg_count = 0;
-
-	list_for_each_entry(mg, &mountgroups, list)
-		mg_count++;
-
-	mgs = malloc(mg_count * sizeof(struct gfsc_mountgroup));
-	if (!mgs)
-		return -ENOMEM;
-	memset(mgs, 0, mg_count * sizeof(struct gfsc_mountgroup));
-
-	mgp = mgs;
-	list_for_each_entry(mg, &mountgroups, list) {
-		set_mountgroup_info(mg, mgp++);
-	}
-
-	*count = mg_count;
-	*mgs_out = mgs;
-	return 0;
-}
-
-int set_mountgroup_nodes(struct mountgroup *mg, int option, int *node_count,
-                        struct gfsc_node **nodes_out)
-{
-	struct change *cg;
-	struct node *n;
-	struct gfsc_node *nodes = NULL, *nodep;
-	struct member *memb;
-	int count = 0;
-
-	if (option == GFSC_NODES_ALL) {
-		if (!list_empty(&mg->changes))
-			cg = list_first_entry(&mg->changes, struct change,list);
-		else
-			cg = mg->started_change;
-
-		list_for_each_entry(n, &mg->node_history, list)
-			count++;
-
-	} else if (option == GFSC_NODES_MEMBERS) {
-		if (!mg->started_change)
-			goto out;
-		cg = mg->started_change;
-		count = cg->member_count;
-
-	} else if (option == GFSC_NODES_NEXT) {
-		if (list_empty(&mg->changes))
-			goto out;
-		cg = list_first_entry(&mg->changes, struct change, list);
-		count = cg->member_count;
-	} else
-		goto out;
-
-	nodes = malloc(count * sizeof(struct gfsc_node));
-	if (!nodes)
-		return -ENOMEM;
-	memset(nodes, 0, count * sizeof(struct gfsc_node));
-	nodep = nodes;
-
-	if (option == GFSC_NODES_ALL) {
-		list_for_each_entry(n, &mg->node_history, list)
-			_set_node_info(mg, cg, n->nodeid, nodep++);
-	} else {
-		list_for_each_entry(memb, &cg->members, list)
-			_set_node_info(mg, cg, memb->nodeid, nodep++);
-	}
- out:
-	*node_count = count;
-	*nodes_out = nodes;
-	return 0;
-}
-
diff --git a/group/gfs_controld/cpg-old.c b/group/gfs_controld/cpg-old.c
deleted file mode 100644
index b353867..0000000
--- a/group/gfs_controld/cpg-old.c
+++ /dev/null
@@ -1,2442 +0,0 @@
-#include "gfs_daemon.h"
-#include "config.h"
-#include "cpg-old.h"
-#include "libgroup.h"
-
-#define ASSERT(x) \
-do { \
-	if (!(x)) { \
-		log_error("Assertion failed on line %d of file %s\n" \
-			  "Assertion:  \"%s\"\n", __LINE__, __FILE__, #x); \
-	} \
-} while (0)
-
-#define JID_INIT	-9
-
-/* mg_member opts bit field */
-
-enum {
-	MEMB_OPT_RW = 1,
-	MEMB_OPT_RO = 2,
-	MEMB_OPT_SPECT = 4,
-	MEMB_OPT_RECOVER = 8,
-};
-
-/* mg_member state: local_recovery_status, recovery_status */
-
-enum {
-	RS_NEED_RECOVERY = 1,
-	RS_SUCCESS,
-	RS_GAVEUP,
-	RS_NOFS,
-	RS_READONLY,
-};
-
-extern group_handle_t gh;
-
-/* cpg message protocol
-   1.0.0 is initial version
-   2.0.0 is incompatible with 1.0.0 and allows plock ownership */
-static unsigned int protocol_v100[3] = {1, 0, 0};
-static unsigned int protocol_v200[3] = {2, 0, 0};
-static unsigned int protocol_active[3];
-
-
-static void send_journals(struct mountgroup *mg, int nodeid);
-
-
-static char *msg_name(int type)
-{
-	switch (type) {
-	case MSG_JOURNAL:
-		return "MSG_JOURNAL";
-	case MSG_OPTIONS:
-		return "MSG_OPTIONS";
-	case MSG_REMOUNT:
-		return "MSG_REMOUNT";
-	case MSG_PLOCK:
-		return "MSG_PLOCK";
-	case MSG_MOUNT_STATUS:
-		return "MSG_MOUNT_STATUS";
-	case MSG_RECOVERY_STATUS:
-		return "MSG_RECOVERY_STATUS";
-	case MSG_RECOVERY_DONE:
-		return "MSG_RECOVERY_DONE";
-	case MSG_WITHDRAW:
-		return "MSG_WITHDRAW";
-	}
-	return "unknown";
-}
-
-static int _send_message(cpg_handle_t h, void *buf, int len, int type)
-{
-	struct iovec iov;
-	cpg_error_t error;
-	int retries = 0;
-
-	iov.iov_base = buf;
-	iov.iov_len = len;
-
- retry:
-	error = cpg_mcast_joined(h, CPG_TYPE_AGREED, &iov, 1);
-	if (error == CPG_ERR_TRY_AGAIN) {
-		retries++;
-		usleep(1000);
-		if (!(retries % 100))
-			log_error("cpg_mcast_joined retry %d %s",
-				   retries, msg_name(type));
-		goto retry;
-	}
-	if (error != CPG_OK) {
-		log_error("cpg_mcast_joined error %d handle %llx %s",
-			  error, (unsigned long long)h, msg_name(type));
-		return -1;
-	}
-
-	if (retries)
-		log_debug("cpg_mcast_joined retried %d %s",
-			  retries, msg_name(type));
-
-	return 0;
-}
-
-int send_group_message_old(struct mountgroup *mg, int len, char *buf)
-{
-	struct gdlm_header *hd = (struct gdlm_header *) buf;
-	int type = hd->type;
-
-	hd->version[0]	= cpu_to_le16(protocol_active[0]);
-	hd->version[1]	= cpu_to_le16(protocol_active[1]);
-	hd->version[2]	= cpu_to_le16(protocol_active[2]);
-	hd->type	= cpu_to_le16(hd->type);
-	hd->nodeid	= cpu_to_le32(hd->nodeid);
-	hd->to_nodeid	= cpu_to_le32(hd->to_nodeid);
-	memcpy(hd->name, mg->name, strlen(mg->name));
-
-	return _send_message(cpg_handle_daemon, buf, len, type);
-}
-
-static struct mg_member *find_memb_nodeid(struct mountgroup *mg, int nodeid)
-{
-	struct mg_member *memb;
-
-	list_for_each_entry(memb, &mg->members, list) {
-		if (memb->nodeid == nodeid)
-			return memb;
-	}
-	return NULL;
-}
-
-static struct mg_member *find_memb_jid(struct mountgroup *mg, int jid)
-{
-	struct mg_member *memb;
-
-	list_for_each_entry(memb, &mg->members, list) {
-		if (memb->jid == jid)
-			return memb;
-	}
-	return NULL;
-}
-
-static void notify_mount_client(struct mountgroup *mg)
-{
-	struct mg_member *memb;
-
-	if (!mg->mount_client_result && mg->mount_client_delay) {
-		log_group(mg, "notify_mount_client delayed");
-		return;
-	}
-
-	client_reply_join_full(mg, mg->mount_client_result);
-
-	if (mg->mount_client_result) {
-		log_group(mg, "leaving due to mount error: %d",
-			  mg->mount_client_result);
-
-		memb = find_memb_nodeid(mg, our_nodeid);
-		if (memb->finished)
-			group_leave(gh, mg->name);
-		else {
-			log_group(mg, "delay leave until after join");
-			mg->group_leave_on_finish = 1;
-		}
-	} else {
-		mg->mount_client_notified = 1;
-	}
-}
-
-/* we can receive recovery_status messages from other nodes doing start before
-   we actually process the corresponding start callback ourselves */
-
-void save_message_old(struct mountgroup *mg, char *buf, int len, int from,
-		      int type)
-{
-	struct save_msg *sm;
-
-	sm = malloc(sizeof(struct save_msg) + len);
-	if (!sm)
-		return;
-	memset(sm, 0, sizeof(struct save_msg) + len);
-
-	memcpy(&sm->buf, buf, len);
-	sm->type = type;
-	sm->len = len;
-	sm->nodeid = from;
-
-	log_group(mg, "save %s from %d len %d", msg_name(type), from, len);
-
-	list_add_tail(&sm->list, &mg->saved_messages);
-}
-
-static int first_mounter_recovery(struct mountgroup *mg)
-{
-	struct mg_member *memb;
-
-	list_for_each_entry(memb, &mg->members, list) {
-		if (memb->opts & MEMB_OPT_RECOVER)
-			return memb->nodeid;
-	}
-	return 0;
-}
-
-static int local_first_mounter_recovery(struct mountgroup *mg)
-{
-	int nodeid;
-
-	nodeid = first_mounter_recovery(mg);
-	if (nodeid == our_nodeid)
-		return 1;
-	return 0;
-}
-
-int remote_first_mounter_recovery(struct mountgroup *mg)
-{
-	int nodeid;
-
-	nodeid = first_mounter_recovery(mg);
-	if (nodeid && (nodeid != our_nodeid))
-		return 1;
-	return 0;
-}
-
-static void start_done(struct mountgroup *mg)
-{
-	log_group(mg, "start_done %d", mg->start_event_nr);
-	group_start_done(gh, mg->name, mg->start_event_nr);
-}
-
-void send_withdraw_old(struct mountgroup *mg)
-{
-	struct gdlm_header *hd;
-	int len;
-	char *buf;
-
-	len = sizeof(struct gdlm_header);
-
-	buf = malloc(len);
-	if (!buf)
-		return;
-	memset(buf, 0, len);
-
-	hd = (struct gdlm_header *)buf;
-	hd->type = MSG_WITHDRAW;
-	hd->nodeid = our_nodeid;
-	hd->to_nodeid = 0;
-
-	log_group(mg, "send_withdraw");
-
-	send_group_message_old(mg, len, buf);
-
-	free(buf);
-}
-
-static void receive_withdraw(struct mountgroup *mg, char *buf, int len, int from)
-{
-	struct mg_member *memb;
-
-	memb = find_memb_nodeid(mg, from);
-	if (!memb) {
-		log_group(mg, "receive_withdraw no member %d", from);
-		return;
-	}
-	log_group(mg, "receive_withdraw from %d", from);
-	memb->withdrawing = 1;
-
-	if (from == our_nodeid)
-		group_leave(gh, mg->name);
-}
-
-#define SEND_RS_INTS 3
-
-static void send_recovery_status(struct mountgroup *mg)
-{
-	struct gdlm_header *hd;
-	struct mg_member *memb;
-	int len, *p, i, n = 0;
-	char *buf;
-
-	list_for_each_entry(memb, &mg->members_gone, list) {
-		if (memb->local_recovery_status == RS_SUCCESS)
-			n++;
-	}
-
-	len = sizeof(struct gdlm_header) + (n * SEND_RS_INTS * sizeof(int));
-
-	buf = malloc(len);
-	if (!buf)
-		return;
-	memset(buf, 0, len);
-
-	hd = (struct gdlm_header *)buf;
-	hd->type = MSG_RECOVERY_STATUS;
-	hd->nodeid = our_nodeid;
-	hd->to_nodeid = 0;
-	p = (int *) (buf + sizeof(struct gdlm_header));
-
-	i = 0;
-	list_for_each_entry(memb, &mg->members_gone, list) {
-		if (memb->local_recovery_status != RS_SUCCESS)
-			continue;
-		p[i] = cpu_to_le32(memb->nodeid);
-		i++;
-		p[i] = cpu_to_le32(memb->jid);
-		i++;
-		p[i] = cpu_to_le32(memb->local_recovery_status);
-		i++;
-	}
-
-	log_group(mg, "send_recovery_status for %d nodes len %d", n, len);
-
-	send_group_message_old(mg, len, buf);
-
-	free(buf);
-}
-
-/* Note: we can get more than one node reporting success in recovering
-   the journal for a failed node.  The first has really recovered it,
-   the rest have found the fs clean and report success. */
-
-static void _receive_recovery_status(struct mountgroup *mg, char *buf, int len,
-			      int from)
-{
-	struct mg_member *memb;
-	int *p, n, i, nodeid, jid, status, found = 0;
-
-	n = (len - sizeof(struct gdlm_header)) / (SEND_RS_INTS * sizeof(int));
-
-	p = (int *) (buf + sizeof(struct gdlm_header));
-
-	for (i = 0; i < n; i++) {
-		nodeid = le32_to_cpu(p[i * SEND_RS_INTS]);
-		jid    = le32_to_cpu(p[i * SEND_RS_INTS + 1]);
-		status = le32_to_cpu(p[i * SEND_RS_INTS + 2]);
-
-		ASSERT(status == RS_SUCCESS);
-
-		found = 0;
-		list_for_each_entry(memb, &mg->members_gone, list) {
-			if (memb->nodeid != nodeid)
-				continue;
-			ASSERT(memb->jid == jid);
-			ASSERT(memb->recovery_status == RS_NEED_RECOVERY ||
-			       memb->recovery_status == RS_SUCCESS);
-			memb->recovery_status = status;
-			found = 1;
-			break;
-		}
-
-		log_group(mg, "receive_recovery_status from %d len %d "
-			  "nodeid %d jid %d status %d found %d",
-			  from, len, nodeid, jid, status, found);
-	}
-
-	if (from == our_nodeid)
-		start_done(mg);
-}
-
-static void process_saved_recovery_status(struct mountgroup *mg)
-{
-	struct save_msg *sm, *sm2;
-
-	if (list_empty(&mg->saved_messages))
-		return;
-
-	log_group(mg, "process_saved_recovery_status");
-
-	list_for_each_entry_safe(sm, sm2, &mg->saved_messages, list) {
-		if (sm->type != MSG_RECOVERY_STATUS)
-			continue;
-		_receive_recovery_status(mg, sm->buf, sm->len, sm->nodeid);
-		list_del(&sm->list);
-		free(sm);
-	}
-}
-
-static void assign_next_first_mounter(struct mountgroup *mg)
-{
-	struct mg_member *memb, *next = NULL;
-	int low = -1;
-
-	list_for_each_entry(memb, &mg->members, list) {
-		if (memb->jid == -2)
-			continue;
-		if (memb->jid == -9)
-			continue;
-		if (memb->spectator || memb->readonly || memb->withdrawing ||
-		    memb->ms_kernel_mount_done)
-			continue;
-		if (low == -1 || memb->nodeid < low) {
-			next = memb;
-			low = memb->nodeid;
-		}
-	}
-
-	if (next) {
-		log_group(mg, "next first mounter is %d jid %d opts %x",
-			  next->nodeid, next->jid, next->opts);
-		next->opts |= MEMB_OPT_RECOVER;
-		ASSERT(next->jid >= 0);
-	} else
-		log_group(mg, "no next mounter available yet");
-}
-
-#define SEND_MS_INTS 4
-
-void send_mount_status_old(struct mountgroup *mg)
-{
-	struct gdlm_header *hd;
-	int len, *p;
-	char *buf;
-
-	len = sizeof(struct gdlm_header) + (SEND_MS_INTS * sizeof(int));
-
-	buf = malloc(len);
-	if (!buf)
-		return;
-	memset(buf, 0, len);
-
-	hd = (struct gdlm_header *)buf;
-	hd->type = MSG_MOUNT_STATUS;
-	hd->nodeid = our_nodeid;
-	hd->to_nodeid = 0;
-
-	p = (int *) (buf + sizeof(struct gdlm_header));
-
-	p[0] = cpu_to_le32(mg->first_mounter);
-	p[1] = cpu_to_le32(mg->kernel_mount_error);
-	p[2] = 0; /* unused */
-	p[3] = 0; /* unused */
-
-	log_group(mg, "send_mount_status kernel_mount_error %d "
-		      "first_mounter %d",
-		      mg->kernel_mount_error,
-		      mg->first_mounter);
-
-	send_group_message_old(mg, len, buf);
-
-	free(buf);
-}
-
-static void _receive_mount_status(struct mountgroup *mg, char *buf, int len,
-				  int from)
-{
-	struct mg_member *memb, *us;
-	int *p;
-
-	p = (int *) (buf + sizeof(struct gdlm_header));
-
-	memb = find_memb_nodeid(mg, from);
-	if (!memb) {
-		log_group(mg, "_receive_mount_status no node %d", from);
-		return;
-	}
-
-	memb->ms_kernel_mount_done = 1;
-	memb->ms_first_mounter = le32_to_cpu(p[0]);
-	memb->ms_kernel_mount_error = le32_to_cpu(p[1]);
-
-	log_group(mg, "_receive_mount_status from %d kernel_mount_error %d "
-		      "first_mounter %d opts %x", from,
-		      memb->ms_kernel_mount_error, memb->ms_first_mounter,
-		      memb->opts);
-
-	if (memb->opts & MEMB_OPT_RECOVER) {
-		ASSERT(memb->ms_first_mounter);
-	}
-	if (memb->ms_first_mounter) {
-		ASSERT(memb->opts & MEMB_OPT_RECOVER);
-	}
-
-	if (memb->ms_first_mounter) {
-		memb->opts &= ~MEMB_OPT_RECOVER;
-
-		if (!memb->ms_kernel_mount_error) {
-			/* the first mounter has successfully mounted, we can
-			   go ahead and mount now */
-
-			if (mg->mount_client_delay) {
-				mg->mount_client_delay = 0;
-				notify_mount_client(mg);
-			}
-		} else {
-			/* first mounter mount failed, next low node should be
-			   made first mounter */
-
-			memb->jid = -2;
-			if (from == our_nodeid)
-				mg->our_jid = -2;
-
-			assign_next_first_mounter(mg);
-
-			/* if we became the next first mounter, then notify
-			   mount client */
-
-			us = find_memb_nodeid(mg, our_nodeid);
-			if (us->opts & MEMB_OPT_RECOVER) {
-				log_group(mg, "we are next first mounter");
-				mg->first_mounter = 1;
-				mg->first_mounter_done = 0;
-				mg->mount_client_delay = 0;
-				notify_mount_client(mg);
-			}
-		}
-	}
-}
-
-static void receive_mount_status(struct mountgroup *mg, char *buf, int len,
-				 int from)
-{
-	log_group(mg, "receive_mount_status from %d len %d last_cb %d",
-		  from, len, mg->last_callback);
-
-	if (!mg->got_our_options) {
-		log_group(mg, "ignore mount_status from %d", from);
-		return;
-	}
-
-	if (!mg->got_our_journals)
-		save_message_old(mg, buf, len, from, MSG_MOUNT_STATUS);
-	else
-		_receive_mount_status(mg, buf, len, from);
-}
-
-/* We delay processing mount_status msesages until we receive the journals
-   message for our own mount.  Our journals message is a snapshot of the memb
-   list at the time our options message is received on the remote node.  We
-   ignore any messages that would change the memb list prior to seeing our own
-   options message and we save any messages that would change the memb list
-   after seeing our own options message and before we receive the memb list
-   from the journals message. */
-
-static void process_saved_mount_status(struct mountgroup *mg)
-{
-	struct save_msg *sm, *sm2;
-
-	if (list_empty(&mg->saved_messages))
-		return;
-
-	log_group(mg, "process_saved_mount_status");
-
-	list_for_each_entry_safe(sm, sm2, &mg->saved_messages, list) {
-		if (sm->type != MSG_MOUNT_STATUS)
-			continue;
-		_receive_mount_status(mg, sm->buf, sm->len, sm->nodeid);
-		list_del(&sm->list);
-		free(sm);
-	}
-}
-
-static void receive_recovery_status(struct mountgroup *mg, char *buf, int len,
-			     int from)
-{
-	switch (mg->last_callback) {
-	case DO_STOP:
-		save_message_old(mg, buf, len, from, MSG_RECOVERY_STATUS);
-		break;
-	case DO_START:
-		_receive_recovery_status(mg, buf, len, from);
-		break;
-	default:
-		log_group(mg, "receive_recovery_status %d last_callback %d",
-			  from, mg->last_callback);
-	}
-}
-
-/* tell others that all journals are recovered; they should clear
-   memb's from members_gone, clear needs_recovery and unblock locks */
-
-static void send_recovery_done(struct mountgroup *mg)
-{
-	struct gdlm_header *hd;
-	int len;
-	char *buf;
-
-	len = sizeof(struct gdlm_header);
-
-	buf = malloc(len);
-	if (!buf)
-		return;
-	memset(buf, 0, len);
-
-	hd = (struct gdlm_header *)buf;
-	hd->type = MSG_RECOVERY_DONE;
-	hd->nodeid = our_nodeid;
-	hd->to_nodeid = 0;
-
-	send_group_message_old(mg, len, buf);
-
-	free(buf);
-}
-
-static void receive_recovery_done(struct mountgroup *mg, char *buf, int len,
-				  int from)
-{
-	struct mg_member *memb, *safe;
-
-	log_group(mg, "receive_recovery_done from %d needs_recovery %d",
-		  from, mg->needs_recovery);
-
-	list_for_each_entry_safe(memb, safe, &mg->members_gone, list) {
-		log_group(mg, "receive_recovery_done clear jid %d nodeid %d",
-			  memb->jid, memb->nodeid);
-		list_del(&memb->list);
-		free(memb);
-	}
-
-	mg->needs_recovery = 0;
-	mg->kernel_stopped = 0; /* for queries */
-	set_sysfs(mg, "block", 0);
-}
-
-void send_remount_old(struct mountgroup *mg, struct gfsc_mount_args *ma)
-{
-	struct gdlm_header *hd;
-	char *buf;
-	int len;
-	int ro = strstr(ma->options, "ro") ? 1 : 0;
-
-	len = sizeof(struct gdlm_header) + MAX_OPTIONS_LEN;
-
-	buf = malloc(len);
-	if (!buf)
-		return;
-	memset(buf, 0, len);
-
-	hd = (struct gdlm_header *)buf;
-	hd->type = MSG_REMOUNT;
-	hd->nodeid = our_nodeid;
-	hd->to_nodeid = 0;
-
-	strcpy(buf+sizeof(struct gdlm_header), ro ? "ro" : "rw");
-
-	log_group(mg, "send_remount_old len %d \"%s\"", len,
-		  buf+sizeof(struct gdlm_header));
-
-	send_group_message_old(mg, len, buf);
-
-	free(buf);
-}
-
-static void receive_remount(struct mountgroup *mg, char *buf, int len, int from)
-{
-	struct mg_member *memb;
-	char *options;
-	int rw = 0, ro = 0;
-	int result = 0;
-
-	options = (char *) (buf + sizeof(struct gdlm_header));
-
-	memb = find_memb_nodeid(mg, from);
-	if (!memb) {
-		log_error("receive_remount: unknown nodeid %d", from);
-		return;
-	}
-
-	if (strstr(options, "rw"))
-		rw = 1;
-	else if (strstr(options, "ro"))
-		ro = 1;
-	else {
-		result = -EINVAL;
-		goto out;
-	}
-
-	/* FIXME: check if we've even fully completed our normal mount yet
-	   (received our own mount-status?)  if not, then disallow remount */
-
-	/* FIXME: going ro->rw may mean we can now do journal or first-mounter
-	   recovery that we couldn't do before. */
-
-	memb->readonly = ro;
-	memb->rw = !ro;
-
-	if (ro) {
-		memb->opts &= ~MEMB_OPT_RW;
-		memb->opts |= MEMB_OPT_RO;
-	} else {
-		memb->opts &= ~MEMB_OPT_RO;
-		memb->opts |= MEMB_OPT_RW;
-	}
- out:
-	if (from == our_nodeid) {
-		if (!result) {
-			mg->rw = memb->rw;
-			mg->ro = memb->readonly;
-		}
-		client_reply_remount(mg, mg->remount_client, result);
-	}
-
-	log_group(mg, "receive_remount from %d rw=%d ro=%d opts=%x",
-		  from, memb->rw, memb->readonly, memb->opts);
-}
-
-static void set_our_memb_options(struct mountgroup *mg)
-{
-	struct mg_member *memb;
-	memb = find_memb_nodeid(mg, our_nodeid);
-	ASSERT(memb);
-
-	if (mg->ro) {
-		memb->readonly = 1;
-		memb->opts |= MEMB_OPT_RO;
-	} else if (mg->spectator) {
-		memb->spectator = 1;
-		memb->opts |= MEMB_OPT_SPECT;
-	} else if (mg->rw) {
-		memb->rw = 1;
-		memb->opts |= MEMB_OPT_RW;
-	}
-}
-
-static void send_options(struct mountgroup *mg)
-{
-	struct gdlm_header *hd;
-	int len;
-	char *buf;
-
-	len = sizeof(struct gdlm_header) + MAX_OPTIONS_LEN;
-
-	buf = malloc(len);
-	if (!buf)
-		return;
-	memset(buf, 0, len);
-
-	hd = (struct gdlm_header *)buf;
-	hd->type = MSG_OPTIONS;
-	hd->nodeid = our_nodeid;
-	hd->to_nodeid = 0;
-
-	strncpy(buf+sizeof(struct gdlm_header), mg->mount_args.options,
-		MAX_OPTIONS_LEN-1);
-
-	log_group(mg, "send_options len %d \"%s\"", len,
-		  buf+sizeof(struct gdlm_header));
-
-	send_group_message_old(mg, len, buf);
-
-	free(buf);
-}
-
-/* We set the new member's jid to the lowest unused jid.  If we're the lowest
-   existing member (by nodeid), then send jid info to the new node. */
-
-/* Look at rw/ro/spectator status of all existing mounters and whether
-   we need to do recovery.  Based on that, decide if the current mount
-   mode (ro/spectator) is permitted; if not, set jid = -2.  If spectator
-   mount and it's ok, set jid = -1.  If ro or rw mount and it's ok, set
-   real jid. */
-
-static int assign_journal(struct mountgroup *mg, struct mg_member *new)
-{
-	struct mg_member *memb, *memb_recover = NULL, *memb_mounted = NULL;
-	int i, total, rw_count, ro_count, spect_count, invalid_count;
-
-	total = rw_count = ro_count = spect_count = invalid_count = 0;
-
-	list_for_each_entry(memb, &mg->members, list) {
-		if (memb->nodeid == new->nodeid)
-			continue;
-		total++;
-		if (memb->jid == -2)
-			invalid_count++;
-		else if (memb->spectator)
-			spect_count++;
-		else if (memb->rw)
-			rw_count++;
-		else if (memb->readonly)
-			ro_count++;
-
-		if (memb->opts & MEMB_OPT_RECOVER) {
-			memb_recover = memb;
-			log_group(mg, "assign_journal: memb %d has OPT_RECOVER",
-				  memb->nodeid);
-		}
-
-		if (memb->ms_kernel_mount_done && !memb->ms_kernel_mount_error)
-			memb_mounted = memb;
-	}
-
-	log_group(mg, "assign_journal: total %d iv %d rw %d ro %d spect %d "
-		  "needs_recovery %d", total, invalid_count, rw_count,
-		  ro_count, spect_count, mg->needs_recovery);
-
-	if (new->spectator) {
-		log_group(mg, "assign_journal: new spectator allowed");
-		new->jid = -1;
-		goto out;
-	}
-
-	for (i = 0; i < 1024; i++) {
-		memb = find_memb_jid(mg, i);
-		if (!memb) {
-			new->jid = i;
-			break;
-		}
-	}
-
-	/* Repeat first-mounter recovery: the fs has been mounted and in-use,
-	   but nodes have failed and none of the current mounters has been able
-	   to do recovery (all remaining nodes may be ro/spect for example).
-	   This puts us into the special "needs_recovery" state where new
-	   mounters are asked to do first-mounter recovery of the fs while
-	   the current mounters sit in a blocked state. */
-
-	if (mg->needs_recovery) {
-		if (!memb_recover) {
-			log_group(mg, "assign_journal: needs_recovery: "
-				  "new memb %d gets OPT_RECOVER",
-				  new->nodeid);
-			new->opts |= MEMB_OPT_RECOVER;
-		} else {
-			log_group(mg, "assign_journal: needs_recovery: "
-				  "new memb %d memb %d has OPT_RECOVER",
-				  new->nodeid, memb_recover->nodeid);
-		}
-		goto out;
-	}
-
-	/* Initial first-mounter recovery: the fs is coming online, the first
-	   mg member assumes first-mounter role and other nodes join the mg
-	   while the first-mounter is working.  These non-first mounters wait
-	   for the first-mounter to finish before notifying mount.gfs.  If the
-	   first-mounter fails, one of them will become the first-mounter. */
-
-	/* it shouldn't be possible to have someone doing first mounter
-	   recovery and also have someone with the fs fully mounted */
-
-	if (memb_mounted && memb_recover) {
-		log_group(mg, "memb_mounted %d memb_recover %d",
-			  memb_mounted->nodeid, memb_recover->nodeid);
-		ASSERT(0);
-	}
-
-	/* someone has successfully mounted the fs which means the fs doesn't
-	   need first mounter recovery */
-
-	if (memb_mounted) {
-		log_group(mg, "assign_journal: no first recovery needed %d",
-			  memb_mounted->nodeid);
-		goto out;
-	}
-
-	/* someone is currently doing first mounter recovery, they'll send
-	   mount_status when they're done letting everyone know the result */
-
-	if (memb_recover) {
-		log_group(mg, "assign_journal: %d doing first recovery",
-			  memb_recover->nodeid);
-		goto out;
-	}
-
-	/* when we received our journals, no one was flagged with OPT_RECOVER
-	   which means no first mounter recovery is needed or is current */
-
-	if (mg->global_first_recover_done) {
-		log_group(mg, "assign_journal: global_first_recover_done");
-		goto out;
-	}
-
-	/* no one has done kernel mount successfully and no one is doing first
-	   mounter recovery, the new node gets to try first mounter recovery */
-
-	log_group(mg, "kernel_mount_done %d kernel_mount_error %d "
-		      "first_mounter %d first_mounter_done %d",
-		      mg->kernel_mount_done, mg->kernel_mount_error,
-		      mg->first_mounter, mg->first_mounter_done);
-
-	log_group(mg, "assign_journal: new memb %d gets OPT_RECOVER for: "
-		  "fs not mounted", new->nodeid);
-	new->opts |= MEMB_OPT_RECOVER;
-
- out:
-	log_group(mg, "assign_journal: new member %d got jid %d opts %x",
-		  new->nodeid, new->jid, new->opts);
-
-	if (mg->master_nodeid == our_nodeid) {
-		store_plocks(mg, new->nodeid);
-		send_journals(mg, new->nodeid);
-	}
-	return 0;
-}
-
-static void _receive_options(struct mountgroup *mg, char *buf, int len,
-			     int from)
-{
-	struct mg_member *memb;
-	struct gdlm_header *hd;
-	char *options;
-
-	hd = (struct gdlm_header *)buf;
-	options = (char *) (buf + sizeof(struct gdlm_header));
-
-	memb = find_memb_nodeid(mg, from);
-	if (!memb) {
-		log_error("unknown nodeid %d for options message", from);
-		return;
-	}
-
-	if (strstr(options, "spectator")) {
-		memb->spectator = 1;
-		memb->opts |= MEMB_OPT_SPECT;
-	} else if (strstr(options, "rw")) {
-		memb->rw = 1;
-		memb->opts |= MEMB_OPT_RW;
-	} else if (strstr(options, "ro")) {
-		memb->readonly = 1;
-		memb->opts |= MEMB_OPT_RO;
-	}
-
-	log_group(mg, "_receive_options from %d rw=%d ro=%d spect=%d opts=%x",
-		  from, memb->rw, memb->readonly, memb->spectator, memb->opts);
-
-	assign_journal(mg, memb);
-}
-
-static void receive_options(struct mountgroup *mg, char *buf, int len, int from)
-{
-	struct gdlm_header *hd = (struct gdlm_header *)buf;
-	struct mg_member *memb;
-
-	log_group(mg, "receive_options from %d len %d last_cb %d",
-		  from, len, mg->last_callback);
-
-	if (hd->nodeid == our_nodeid) {
-		mg->got_our_options = 1;
-		mg->save_plocks = 1;
-		return;
-	}
-
-	if (!mg->got_our_options) {
-		log_group(mg, "ignore options from %d", from);
-		return;
-	}
-
-	/* we can receive an options message before getting the start
-	   that adds the mounting node that sent the options, or
-	   we can receive options messages before we get the journals
-	   message for out own mount */
-
-	memb = find_memb_nodeid(mg, from);
-
-	if (!memb || !mg->got_our_journals)
-		save_message_old(mg, buf, len, from, MSG_OPTIONS);
-	else
-		_receive_options(mg, buf, len, from);
-}
-
-static void process_saved_options(struct mountgroup *mg)
-{
-	struct save_msg *sm, *sm2;
-
-	if (list_empty(&mg->saved_messages))
-		return;
-
-	log_group(mg, "process_saved_options");
-
-	list_for_each_entry_safe(sm, sm2, &mg->saved_messages, list) {
-		if (sm->type != MSG_OPTIONS)
-			continue;
-		_receive_options(mg, sm->buf, sm->len, sm->nodeid);
-		list_del(&sm->list);
-		free(sm);
-	}
-}
-
-#define NUM 3
-
-/* send nodeid/jid/opts of every member to nodeid */
-
-static void send_journals(struct mountgroup *mg, int nodeid)
-{
-	struct mg_member *memb;
-	struct gdlm_header *hd;
-	int i, len;
-	char *buf;
-	int *ids;
-
-	len = sizeof(struct gdlm_header) + (mg->memb_count * NUM * sizeof(int));
-
-	buf = malloc(len);
-	if (!buf)
-		return;
-	memset(buf, 0, len);
-
-	hd = (struct gdlm_header *)buf;
-	hd->type = MSG_JOURNAL;
-	hd->nodeid = our_nodeid;
-	hd->to_nodeid = nodeid;
-	ids = (int *) (buf + sizeof(struct gdlm_header));
-
-	i = 0;
-	list_for_each_entry(memb, &mg->members, list) {
-		ids[i] = cpu_to_le32(memb->nodeid);
-		i++;
-		ids[i] = cpu_to_le32(memb->jid);
-		i++;
-		ids[i] = cpu_to_le32(memb->opts);
-		i++;
-	}
-
-	log_group(mg, "send_journals to %d len %d count %d", nodeid, len, i);
-
-	send_group_message_old(mg, len, buf);
-
-	free(buf);
-}
-
-static void received_our_jid(struct mountgroup *mg)
-{
-	log_group(mg, "received_our_jid %d", mg->our_jid);
-
-	/* we've been given jid of -2 which means we're not permitted
-	   to mount the fs; probably because we're trying to mount readonly
-	   but the next mounter is required to be rw */
-
-	if (mg->our_jid == -2) {
-		mg->mount_client_result = -EUCLEAN;
-		goto out;
-	}
-
-	/* fs needs recovery and existing mounters can't recover it,
-	   i.e. they're spectator/readonly or the first mounter's
-	   mount(2) failed, so we're told to do first-mounter recovery
-	   on the fs. */
-
-	if (local_first_mounter_recovery(mg)) {
-		log_group(mg, "we're told to do first mounter recovery");
-		mg->first_mounter = 1;
-		mg->first_mounter_done = 0;
-		mg->mount_client_delay = 0;
-		mg->save_plocks = 0;
-		goto out;
-	} else if (remote_first_mounter_recovery(mg)) {
-		/* delay notifying mount client until we get a successful
-		   mount status from the first mounter */
-		log_group(mg, "other node doing first mounter recovery, "
-			  "set mount_client_delay");
-		mg->mount_client_delay = 1;
-		mg->save_plocks = 0;
-		return;
-	}
-
-	retrieve_plocks(mg);
-	mg->save_plocks = 0;
-	process_saved_plocks(mg);
- out:
-	notify_mount_client(mg);
-}
-
-static void _receive_journals(struct mountgroup *mg, char *buf, int len,
-			      int from)
-{
-	struct mg_member *memb, *memb2;
-	struct gdlm_header *hd;
-	int *ids, count, i, nodeid, jid, opts;
-	int current_first_recover = 0;
-
-	hd = (struct gdlm_header *)buf;
-
-	count = (len - sizeof(struct gdlm_header)) / (NUM * sizeof(int));
-	ids = (int *) (buf + sizeof(struct gdlm_header));
-
-	for (i = 0; i < count; i++) {
-		nodeid = le32_to_cpu(ids[i * NUM]);
-		jid    = le32_to_cpu(ids[i * NUM + 1]);
-		opts   = le32_to_cpu(ids[i * NUM + 2]);
-
-		log_debug("receive nodeid %d jid %d opts %x",
-			  nodeid, jid, opts);
-
-		memb = find_memb_nodeid(mg, nodeid);
-		memb2 = find_memb_jid(mg, jid);
-
-		if (!memb || memb2) {
-			log_error("invalid journals message "
-				  "nodeid %d jid %d opts %x",
-				  nodeid, jid, opts);
-		}
-		if (!memb)
-			continue;
-
-		memb->jid = jid;
-
-		if (nodeid == our_nodeid) {
-			mg->our_jid = jid;
-			/* set_our_memb_options() sets rest */
-			if (opts & MEMB_OPT_RECOVER)
-				memb->opts |= MEMB_OPT_RECOVER;
-		} else {
-			memb->opts = opts;
-			if (opts & MEMB_OPT_RO)
-				memb->readonly = 1;
-			else if (opts & MEMB_OPT_RW)
-				memb->rw = 1;
-			else if (opts & MEMB_OPT_SPECT)
-				memb->spectator = 1;
-		}
-
-		if (opts & MEMB_OPT_RECOVER)
-			current_first_recover = 1;
-	}
-
-	/* FIXME: use global_first_recover_done more widely instead of
-	   as a single special case */
-	if (!current_first_recover)
-		mg->global_first_recover_done = 1;
-
-	process_saved_mount_status(mg);
-
-	/* we delay processing any options messages from new mounters
-	   until after we receive the journals message for our own mount */
-
-	process_saved_options(mg);
-
-	received_our_jid(mg);
-}
-
-static void receive_journals(struct mountgroup *mg, char *buf, int len,
-			     int from)
-{
-	struct gdlm_header *hd = (struct gdlm_header *)buf;
-	struct mg_member *memb;
-	int count;
-
-	count = (len - sizeof(struct gdlm_header)) / (NUM * sizeof(int));
-
-	log_group(mg, "receive_journals from %d to %d len %d count %d cb %d",
-		  from, hd->to_nodeid, len, count, mg->last_callback);
-
-	/* just like we can receive an options msg from a newly added node
-	   before we get the start adding it, we can receive the journals
-	   message sent to it before we get the start adding it */
-
-	memb = find_memb_nodeid(mg, hd->to_nodeid);
-	if (!memb) {
-		log_group(mg, "receive_journals from %d to unknown %d",
-			  from, hd->to_nodeid);
-		return;
-	}
-	memb->needs_journals = 0;
-
-	if (hd->to_nodeid && hd->to_nodeid != our_nodeid)
-		return;
-
-	if (mg->got_our_journals) {
-		log_group(mg, "receive_journals from %d duplicate", from);
-		return;
-	}
-	mg->got_our_journals = 1;
-
-	_receive_journals(mg, buf, len, from);
-}
-
-static void add_ordered_member(struct mountgroup *mg, struct mg_member *new)
-{
-	struct mg_member *memb = NULL;
-	struct list_head *tmp;
-	struct list_head *newlist = &new->list;
-	struct list_head *head = &mg->members;
-
-	list_for_each(tmp, head) {
-		memb = list_entry(tmp, struct mg_member, list);
-		if (new->nodeid < memb->nodeid)
-			break;
-	}
-
-	if (!memb)
-		list_add_tail(newlist, head);
-	else {
-		/* FIXME: can use list macro here */
-		newlist->prev = tmp->prev;
-		newlist->next = tmp;
-		tmp->prev->next = newlist;
-		tmp->prev = newlist;
-	}
-}
-
-static int add_member(struct mountgroup *mg, int nodeid)
-{
-	struct mg_member *memb;
-
-	memb = malloc(sizeof(struct mg_member));
-	if (!memb)
-		return -ENOMEM;
-
-	memset(memb, 0, sizeof(struct mg_member));
-
-	memb->nodeid = nodeid;
-	memb->jid = JID_INIT;
-	add_ordered_member(mg, memb);
-	mg->memb_count++;
-
-	if (!mg->init)
-		memb->needs_journals = 1;
-
-	return 0;
-}
-
-static int is_member(struct mountgroup *mg, int nodeid)
-{
-	struct mg_member *memb;
-
-	list_for_each_entry(memb, &mg->members, list) {
-		if (memb->nodeid == nodeid)
-			return 1;
-	}
-	return 0;
-}
-
-static int is_removed(struct mountgroup *mg, int nodeid)
-{
-	struct mg_member *memb;
-
-	list_for_each_entry(memb, &mg->members_gone, list) {
-		if (memb->nodeid == nodeid)
-			return 1;
-	}
-	return 0;
-}
-
-/* New mounters may be waiting for a journals message that a failed node (as
-   master) would have sent.  If the master failed and we're the new master,
-   then send a journals message to any nodes for whom we've not seen a journals
-   message.  We also need to checkpoint the plock state for the new nodes to
-   read after they get their journals message. */
-
-static void resend_journals(struct mountgroup *mg)
-{
-	struct mg_member *memb;
-	int stored_plocks = 0;
-
-	list_for_each_entry(memb, &mg->members, list) {
-		if (!memb->needs_journals)
-			continue;
-
-		if (!stored_plocks) {
-			store_plocks(mg, memb->nodeid);
-			stored_plocks = 1;
-		}
-
-		log_group(mg, "resend_journals to %d", memb->nodeid);
-		send_journals(mg, memb->nodeid);
-	}
-}
-
-/* The master node is the member of the group with the lowest nodeid who
-   was also a member of the last "finished" group, i.e. a member of the
-   group the last time it got a finish callback.  The job of the master
-   is to send state info to new nodes joining the group, and doing that
-   requires that the master has all the state to send -- a new joining
-   node that has the lowest nodeid doesn't have any state, which is why
-   we add the "finished" requirement. */
-
-static void update_master_nodeid(struct mountgroup *mg)
-{
-	struct mg_member *memb;
-	int new = -1, low = -1;
-
-	list_for_each_entry(memb, &mg->members, list) {
-		if (low == -1 || memb->nodeid < low)
-			low = memb->nodeid;
-		if (!memb->finished)
-			continue;
-		if (new == -1 || memb->nodeid < new)
-			new = memb->nodeid;
-	}
-	mg->master_nodeid = new;
-	mg->low_nodeid = low;
-}
-
-/* This can happen before we receive a journals message for our mount. */
-
-static void recover_members(struct mountgroup *mg, int num_nodes,
-			    int *nodeids, int *pos_out, int *neg_out)
-{
-	struct mg_member *memb, *safe, *memb_gone_recover = NULL;
-	int i, found, id, pos = 0, neg = 0, prev_master_nodeid;
-	int master_failed = 0;
-
-	/* move departed nodes from members list to members_gone */
-
-	list_for_each_entry_safe(memb, safe, &mg->members, list) {
-		found = 0;
-		for (i = 0; i < num_nodes; i++) {
-			if (memb->nodeid == nodeids[i]) {
-				found = 1;
-				break;
-			}
-		}
-
-		if (!found) {
-			neg++;
-
-			list_move(&memb->list, &mg->members_gone);
-			memb->gone_event = mg->start_event_nr;
-			memb->gone_type = mg->start_type;
-			mg->memb_count--;
-
-			memb->tell_gfs_to_recover = 0;
-			memb->recovery_status = 0;
-			memb->local_recovery_status = 0;
-
-			/* - journal cb for failed or withdrawing nodes
-			   - failed node was assigned a journal
-			   - no journal cb if failed node was spectator
-			   - no journal cb if we've already done a journl cb */
-
-			if ((memb->gone_type == GROUP_NODE_FAILED ||
-			    memb->withdrawing) &&
-			    memb->jid != JID_INIT &&
-			    memb->jid != -2 &&
-			    !memb->spectator &&
-			    !memb->wait_gfs_recover_done) {
-				memb->tell_gfs_to_recover = 1;
-				memb->recovery_status = RS_NEED_RECOVERY;
-				memb->local_recovery_status = RS_NEED_RECOVERY;
-			}
-
-			log_group(mg, "remove member %d tell_gfs_to_recover %d "
-				  "(%d,%d,%d,%d,%d,%d)",
-				  memb->nodeid, memb->tell_gfs_to_recover,
-				  mg->spectator,
-				  mg->start_type,
-				  memb->withdrawing,
-				  memb->jid,
-				  memb->spectator,
-				  memb->wait_gfs_recover_done);
-
-			if (mg->master_nodeid == memb->nodeid &&
-			    memb->gone_type == GROUP_NODE_FAILED)
-				master_failed = 1;
-
-			if (memb->opts & MEMB_OPT_RECOVER)
-				memb_gone_recover = memb;
-		}
-	}
-
-	/* add new nodes to members list */
-
-	for (i = 0; i < num_nodes; i++) {
-		id = nodeids[i];
-		if (is_member(mg, id))
-			continue;
-		add_member(mg, id);
-		pos++;
-		log_group(mg, "add member %d", id);
-	}
-
-	prev_master_nodeid = mg->master_nodeid;
-	update_master_nodeid(mg);
-
-	*pos_out = pos;
-	*neg_out = neg;
-
-	log_group(mg, "total members %d master_nodeid %d prev %d",
-		  mg->memb_count, mg->master_nodeid, prev_master_nodeid);
-
-
-	/* The master failed and we're the new master, we need to:
-
-	   - unlink the ckpt that the failed master had open so new ckpts
-	     can be created down the road
-	   - resend journals msg to any nodes that needed one from the
-	     failed master
-	   - store plocks in ckpt for the new mounters to read when they
-	     get the journals msg from us */
-
-	if (neg && master_failed &&
-	    (prev_master_nodeid != -1) &&
-	    (prev_master_nodeid != mg->master_nodeid) &&
-	    (our_nodeid == mg->master_nodeid)) {
-		log_group(mg, "unlink ckpt for failed master %d",
-			  prev_master_nodeid);
-		unlink_checkpoint(mg);
-		resend_journals(mg);
-	}
-
-	/* Do we need a new first mounter?
-
-	   If we've not gotten a journals message yet (implies we're mounting)
-	   and there's only one node left in the group (us, after removing the
-	   failed node), then it's possible that the failed node was doing
-	   first mounter recovery, so we need to become first mounter.
-
-	   If we've received a journals message, we can check if the failed
-	   node was doing first mounter recovery (MEMB_OPT_RECOVER set) and
-	   if so select the next first mounter. */
-
-	if (!neg)
-		return;
-
-	if (!mg->got_our_journals && mg->memb_count == 1) {
-		log_group(mg, "we are left alone, act as first mounter");
-		unlink_checkpoint(mg);
-		memb = find_memb_nodeid(mg, our_nodeid);
-		memb->jid = 0;
-		memb->opts |= MEMB_OPT_RECOVER;
-		mg->our_jid = 0;
-		mg->first_mounter = 1;
-		mg->first_mounter_done = 0;
-		mg->got_our_options = 1;
-		mg->got_our_journals = 1;
-		mg->mount_client_delay = 0;
-		notify_mount_client(mg);
-		return;
-	}
-
-	if (memb_gone_recover) {
-		log_group(mg, "failed node %d had MEMB_OPT_RECOVER",
-			  memb_gone_recover->nodeid);
-		memb_gone_recover->tell_gfs_to_recover = 0;
-	}
-
-	if (memb_gone_recover && mg->got_our_journals) {
-		assign_next_first_mounter(mg);
-		memb = find_memb_nodeid(mg, our_nodeid);
-		if (memb->opts & MEMB_OPT_RECOVER) {
-			log_group(mg, "first mounter failed, we get "
-				  "MEMB_OPT_RECOVER");
-			unlink_checkpoint(mg);
-			memb->opts |= MEMB_OPT_RECOVER;
-			mg->first_mounter = 1;
-			mg->first_mounter_done = 0;
-			mg->mount_client_delay = 0;
-			notify_mount_client(mg);
-		}
-	}
-}
-
-int gfs_join_mountgroup_old(struct mountgroup *mg, struct gfsc_mount_args *ma)
-{
-	int rv;
-
-	if (strlen(ma->options) > MAX_OPTIONS_LEN-1) {
-		log_error("join: options too long %zu", strlen(ma->options));
-		return -EMLINK;
-	}
-
-	rv = group_join(gh, mg->name);
-	if (rv)
-		return -ENOTCONN;
-	return 0;
-}
-
-/* recover_members() discovers which nodes need journal recovery
-   and moves the memb structs for those nodes into members_gone
-   and sets memb->tell_gfs_to_recover on them */
-
-/* we don't want to tell gfs-kernel to do journal recovery for a failed
-   node in a number of cases:
-   - we're a spectator or readonly mount
-   - gfs-kernel is currently withdrawing
-   - we're mounting and haven't received a journals message yet
-   - we're mounting and got a kernel mount error back from mount.gfs
-   - we're mounting and haven't notified mount.gfs yet (to do mount(2))
-   - we're mounting and got_kernel_mount is 0, i.e. we've not seen a uevent
-     related to the kernel mount yet
-   (some of the mounting checks should be obviated by others)
-
-   the problem we're trying to avoid here is telling gfs-kernel to do
-   recovery when it can't for some reason and then waiting forever for
-   a recovery_done signal that will never arrive. */
-
-static void recover_journals(struct mountgroup *mg)
-{
-	struct mg_member *memb;
-	int rv;
-
-	if (mg->spectator ||
-	    mg->ro ||
-	    mg->withdraw_suspend ||
-	    mg->our_jid == JID_INIT ||
-	    mg->kernel_mount_error ||
-	    !mg->mount_client_notified ||
-	    !mg->got_kernel_mount ||
-	    !mg->kernel_mount_done) {
-		log_group(mg, "recover_journals: unable %d,%d,%d,%d,%d,%d,%d,%d",
-			  mg->spectator,
-			  mg->ro,
-			  mg->withdraw_suspend,
-			  mg->our_jid,
-			  mg->kernel_mount_error,
-			  mg->mount_client_notified,
-			  mg->got_kernel_mount,
-			  mg->kernel_mount_done);
-
-		list_for_each_entry(memb, &mg->members_gone, list) {
-			log_group(mg, "member gone %d jid %d "
-				  "tell_gfs_to_recover %d",
-				  memb->nodeid, memb->jid,
-				  memb->tell_gfs_to_recover);
-
-			if (memb->tell_gfs_to_recover) {
-				memb->tell_gfs_to_recover = 0;
-				memb->local_recovery_status = RS_READONLY;
-			}
-		}
-		start_done(mg);
-		return;
-	}
-
-	/* we feed one jid into the kernel for recovery instead of all
-	   at once because we need to get the result of each independently
-	   through the single recovery_done sysfs file */
-
-	list_for_each_entry(memb, &mg->members_gone, list) {
-		if (memb->wait_gfs_recover_done) {
-			log_group(mg, "delay new gfs recovery, "
-				  "wait_gfs_recover_done for nodeid %d jid %d",
-				  memb->nodeid, memb->jid);
-			return;
-		}
-	}
-
-	list_for_each_entry(memb, &mg->members_gone, list) {
-		if (!memb->tell_gfs_to_recover)
-			continue;
-
-		log_group(mg, "recover journal %d nodeid %d",
-			  memb->jid, memb->nodeid);
-
-		rv = set_sysfs(mg, "recover", memb->jid);
-		if (rv < 0) {
-			memb->local_recovery_status = RS_NOFS;
-			continue;
-		}
-		memb->tell_gfs_to_recover = 0;
-		memb->wait_gfs_recover_done = 1;
-		return;
-	}
-
-	/* no more journals to attempt to recover, if we've been successful
-	   recovering any then send out status, if not then start_done...
-	   receiving no status message from us before start_done means we
-	   didn't successfully recover any journals.  If we send out status,
-	   then delay start_done until we get our own message (so all nodes
-	   will get the status before finish) */
-
-	list_for_each_entry(memb, &mg->members_gone, list) {
-		if (memb->local_recovery_status == RS_SUCCESS) {
-			send_recovery_status(mg);
-			log_group(mg, "delay start_done until status recvd");
-			return;
-		}
-	}
-
-	start_done(mg);
-}
-
-/* In some cases, we may be joining a mountgroup with needs_recovery
-   set (there are journals that need recovery and current members can't
-   recover them because they're ro).  In this case, we're told to act
-   like the first mounter to cause gfs to try to recovery all journals
-   when it mounts.  When gfs does this, we'll get recovery_done's for
-   the individual journals it recovers (ignored) and finally, if all
-   journals are ok, an others_may_mount/first_done. */
-
-/* When gfs does first-mount recovery, the mount(2) fails if it can't
-   recover one of the journals.  If we get o_m_m, then we know it was
-   able to successfully recover all the journals. */
-
-/* When we're the first mounter, gfs does recovery on all the journals
-   and does "recovery_done" callbacks when it finishes each.  We ignore
-   these and wait for gfs to be finished with all at which point it calls
-   others_may_mount() and first_done is set. */
-
-static int kernel_recovery_done_first(struct mountgroup *mg, int first_done)
-{
-	int rv;
-
-	if (first_done < 0) {
-		/* for back compat, sysfs file deprecated */
-		rv = read_sysfs_int(mg, "first_done", &first_done);
-		if (rv < 0)
-			return rv;
-	}
-
-	log_group(mg, "kernel_recovery_done_first first_done %d", first_done);
-
-	if (mg->kernel_mount_done)
-		log_group(mg, "FIXME: assuming kernel_mount_done comes after "
-			  "first_done");
-
-	if (first_done) {
-		mg->first_mounter_done = 1;
-		send_recovery_done(mg);
-	}
-
-	return 0;
-}
-
-static int need_kernel_recovery_done(struct mountgroup *mg)
-{
-	struct mg_member *memb;
-
-	list_for_each_entry(memb, &mg->members_gone, list) {
-		if (memb->wait_gfs_recover_done)
-			return 1;
-	}
-	return 0;
-}
-
-/* Note: when a readonly node fails we do consider its journal (and the
-   fs) to need recovery... not sure this is really necessary, but
-   the readonly node did "own" a journal so it seems proper to recover
-   it even if the node wasn't writing to it.  So, if there are 3 ro
-   nodes mounting the fs and one fails, gfs on the remaining 2 will
-   remain blocked until an rw node mounts, and the next mounter must
-   be rw. */
-
-int process_recovery_uevent_old(char *name, int jid_done, int status, int first)
-{
-	struct mountgroup *mg;
-	struct mg_member *memb;
-	char *ss;
-	int rv, found = 0;
-
-	mg = find_mg(name);
-	if (!mg) {
-		log_error("recovery_done: unknown mount group %s", name);
-		return -1;
-	}
-
-	if (mg->first_mounter && !mg->first_mounter_done)
-		return kernel_recovery_done_first(mg, first);
-
-	if (jid_done < 0) {
-		/* for back compat, sysfs file deprecated */
-		rv = read_sysfs_int(mg, "recover_done", &jid_done);
-		if (rv < 0)
-			return rv;
-	}
-
-	list_for_each_entry(memb, &mg->members_gone, list) {
-		if (memb->jid == jid_done) {
-			if (memb->wait_gfs_recover_done) {
-				memb->wait_gfs_recover_done = 0;
-				found = 1;
-			}
-			break;
-		}
-	}
-
-	/* We need to ignore recovery_done callbacks in the case where there
-	   are a bunch of recovery_done callbacks for the first mounter, but
-	   we detect "first_done" before we've processed all the
-	   recovery_done's. */
-
-	if (!found) {
-		log_group(mg, "recovery_done jid %d ignored, first %d,%d",
-			  jid_done, mg->first_mounter, mg->first_mounter_done);
-		return 0;
-	}
-
-	if (status < 0) {
-		/* for back compat, sysfs file deprecated */
-		rv = read_sysfs_int(mg, "recover_status", &status);
-		if (rv < 0) {
-			log_group(mg, "recovery_done jid %d nodeid %d sysfs error %d",
-				  memb->jid, memb->nodeid, rv);
-			memb->local_recovery_status = RS_NOFS;
-			goto out;
-		}
-	}
-
-	switch (status) {
-	case LM_RD_GAVEUP:
-		/*
-		 * This is unfortunate; it's needed for bz 442451 where
-		 * gfs-kernel fails to acquire the journal lock on all nodes
-		 * because a withdrawing node has not yet called
-		 * dlm_release_lockspace() to free it's journal lock.  With
-		 * this, all nodes should repeatedly try to to recover the
-		 * journal of the withdrawn node until the withdrawing node
-		 * clears its dlm locks, and gfs on each of the remaining nodes
-		 * succeeds in doing the recovery.
-		 */
-
-		if (memb->withdrawing) {
-			log_group(mg, "recovery_done jid %d nodeid %d retry "
-				  "for withdraw", memb->jid, memb->nodeid);
-			memb->tell_gfs_to_recover = 1;
-			memb->wait_gfs_recover_done = 0;
-			usleep(500000);
-		}
-
-		memb->local_recovery_status = RS_GAVEUP;
-		ss = "gaveup";
-		break;
-	case LM_RD_SUCCESS:
-		memb->local_recovery_status = RS_SUCCESS;
-		ss = "success";
-		break;
-	default:
-		log_error("recovery_done: jid %d nodeid %d unknown status %d",
-			  memb->jid, memb->nodeid, status);
-		ss = "unknown";
-	}
-
-	log_group(mg, "recovery_done jid %d nodeid %d %s",
-		  memb->jid, memb->nodeid, ss);
-
-	/* sanity check */
-	if (need_kernel_recovery_done(mg))
-		log_error("recovery_done: should be no pending gfs recoveries");
-
- out:
-	recover_journals(mg);
-	return 0;
-}
-
-static void leave_mountgroup(struct mountgroup *mg, int mnterr)
-{
-	/* sanity check: we should already have gotten the error from
-	   the mount.gfs mount_done; so this shouldn't happen */
-
-	if (mnterr && !mg->kernel_mount_error) {
-		log_error("leave: mount_error is new %d %d",
-			  mg->kernel_mount_error, mnterr);
-	}
-
-	mg->leaving = 1;
-
-	/* Check to see if we're waiting for a kernel recovery_done to do a
-	   start_done().  If so, call the start_done() here because we won't be
-	   getting anything else from gfs-kernel which is now gone. */
-
-	if (need_kernel_recovery_done(mg)) {
-		log_group(mg, "leave: fill in start_done");
-		start_done(mg);
-	}
-
-	group_leave(gh, mg->name);
-}
-
-void do_leave_old(char *name, int mnterr)
-{
-	struct mountgroup *mg;
-
-	log_debug("do_leave_old %s mnterr %d", name, mnterr);
-
-	list_for_each_entry(mg, &withdrawn_mounts, list) {
-		if (strcmp(mg->name, name))
-			continue;
-		log_group(mg, "leave for withdrawn fs");
-		list_del(&mg->list);
-		free_mg(mg);
-		return;
-	}
-
-	mg = find_mg(name);
-	if (!mg) {
-		log_error("do_leave_old: %s not found", name);
-		return;
-	}
-
-	leave_mountgroup(mg, mnterr);
-}
-
-/* When mounting a fs, we first join the mountgroup, then tell mount.gfs
-   to procede with the kernel mount.  Once we're in the mountgroup, we
-   can get a stop callback at any time, which requires us to block the
-   fs by setting a sysfs file.  If the kernel mount is slow, we can get
-   a stop callback and try to set the sysfs file before the kernel mount
-   has actually created the sysfs files for the fs.  This function delays
-   any further processing until the sysfs files exist. */
-
-/* This function returns 0 when the kernel mount is successfully detected
-   and we know that do_stop() will be able to block the fs.
-   This function returns a negative error if it detects the kernel mount
-   has failed which means there's nothing to stop and do_stop() can assume
-   an implicit stop. */
-
-/* wait for
-   - kernel mount to get to the point of creating sysfs files we
-     can read (and that do_stop can then use), or
-   - kernel mount to fail causing mount.gfs to send us a MOUNT_DONE
-     which we read in process_connection() */
-
-static int wait_for_kernel_mount(struct mountgroup *mg)
-{
-	int rv, val;
-
-	while (1) {
-		/* This is the standard way we leave this loop, where the
-		   kernel mount gets to the point of creating the sysfs files
-		   which we see by successfully reading "id".  With the
-		   sysfs files in place, do_stop() will be able to block
-		   the kernel. */
-
-		rv = read_sysfs_int(mg, "block", &val);
-		if (!rv)
-			break;
-		usleep(100000);
-
-		/* kernel_mount_done is set by mount_done_old() which is called
-		   by process_connection() if mount.gfs sends MOUNT_DONE. */
-
-		if (mg->kernel_mount_done && !mg->kernel_mount_error) {
-			/* mount(2) was successful and we should be able
-			   to read "id" very shortly... */
-			continue;
-		}
-
-		if (mg->kernel_mount_done && mg->kernel_mount_error) {
-			/* mount(2) failed, stop becomes implicit */
-			break;
-		}
-
-		/* this should either do nothing and return immediatley, or
-		   read a MOUNT_DONE from mount.gfs and call mount_done_old()
-		   which will set kernel_mount_done and set kernel_mount_error */
-
-		process_connection(mg->mount_client);
-	}
-
-	return rv;
-}
-
-/* The processing of new mounters (send/recv options, send/recv journals,
-   notify mount.gfs) is not very integrated with the stop/start/finish
-   callbacks from libgroup.  A start callback just notifies us of a new
-   mounter and the options/journals messages drive things from there.
-   Recovery for failed nodes _is_ controlled more directly by the
-   stop/start/finish callbacks.  So, processing new mounters happens
-   independently of recovery and of the libgroup callbacks.  One place
-   where they need to intersect, though, is in stopping/suspending
-   gfs-kernel:
-   - When we get a stop callback, we need to be certain that gfs-kernel
-     is blocked.
-   - When a mounter notifies mount.gfs to go ahead, gfs-kernel will
-     shortly begin running in an unblocked fashion as it goes through
-     the kernel mounting process.
-   Given this, we need to be sure that if gfs-kernel is supposed to be
-   blocked, we don't notify mount.gfs to go ahead and do the kernel mount
-   since that starts gfs-kernel in an unblocked state. */
-
-/* - if we're unmounting, the kernel is gone, so no problem.
-   - if we've just mounted and notified mount.gfs, then wait for kernel
-     mount and then block.
-   - if we're mounting and have not yet notified mount.gfs, then set
-     a flag that delays the notification until block is set to 0. */
-
-int do_stop(struct mountgroup *mg)
-{
-	int rv;
-
-	if (mg->first_mounter && !mg->kernel_mount_done) {
-		log_group(mg, "do_stop skip during first mount recovery");
-		goto out;
-	}
-
-	for (;;) {
-		rv = set_sysfs(mg, "block", 1);
-		if (!rv) {
-			mg->kernel_stopped = 1; /* for queries */
-			break;
-		}
-
-		/* We get an error trying to block gfs, this could be due
-		   to a number of things:
-		   1. if the kernel instance of gfs existed before but now
-		      we can't see it, that must mean it's been unmounted,
-		      so it's implicitly stopped
-		   2. we're in the process of mounting and gfs hasn't created
-		      the sysfs files for this fs yet
-		   3. we're mounting and mount(2) returned an error
-		   4. we're mounting but haven't told mount.gfs to go ahead
-		      with mount(2) yet
-		   We also need to handle the situation where we get here in
-		   case 2 but it turns into case 3 while we're in
-		   wait_for_kernel_mount() */
-
-		if (mg->got_kernel_mount) {
-			log_group(mg, "do_stop skipped fs unmounted");
-			break;
-		}
-
-		if (mg->mount_client_notified) {
-			if (!mg->kernel_mount_error) {
-				log_group(mg, "do_stop wait for kernel mount");
-				rv = wait_for_kernel_mount(mg);
-				if (rv < 0)
-					break;
-			} else {
-				log_group(mg, "do_stop ignore, failed mount");
-				break;
-			}
-		} else {
-			log_group(mg, "do_stop causes mount_client_delay");
-			mg->mount_client_delay = 1;
-			break;
-		}
-	}
- out:
-	group_stop_done(gh, mg->name);
-	return 0;
-}
-
-/*  After a start that initiated a recovery, everyone will go and see if they
-    can do recovery and try if they can.  If a node can't, it does start_done,
-    if it tries and fails, it does start_done, if it tries and succeeds it
-    sends a message and then does start_done once it receives's it back.  So,
-    when we get a finish we know that we have all the results from the recovery
-    cycle and can judge if everything is recovered properly or not.  If so, we
-    can unblock locks (in the finish), if not, we leave them blocked (in the
-    finish).
-
-    If we leave locks blocked in the finish, then they can only be unblocked
-    after someone is able to do the recovery that's needed.  So, leaving locks
-    blocked in a finish because recovery hasn't worked puts us into a special
-    state: the fs needs recovery, none of the current mounters has been able to
-    recover it, all current mounters have locks blocked in gfs, new mounters
-    are allowed, nodes can unmount, new mounters are asked to do first-mounter
-    recovery, if one of them succeeds then we can all clear this special state
-    and unblock locks (the unblock would happen upon recving the success
-    message from the new pseudo-first mounter, not as part of a finish), future
-    finishes would then go back to being able to unblock locks.
-
-    While in this special state, a new node has been added and asked to do
-    first-mounter recovery, other nodes can also be added while the new
-    first-mounter is active.  These other nodes don't notify mount.gfs.
-    They'll receive the result of the first mounter and if it succeeded they'll
-    notify mount.gfs, otherwise one of them will become the next first-mounter
-    and notify mount.gfs. */
-
-int do_finish(struct mountgroup *mg)
-{
-	struct mg_member *memb, *safe;
-
-	log_group(mg, "finish %d needs_recovery %d", mg->last_finish,
-		  mg->needs_recovery);
-
-	/* members_gone list are the members that were removed from the
-	   members list when processing a start.  members are removed
-	   from members_gone if their journals have been recovered */
-
-	list_for_each_entry_safe(memb, safe, &mg->members_gone, list) {
-		if (!memb->recovery_status) {
-			list_del(&memb->list);
-			free(memb);
-		} else if (memb->recovery_status == RS_SUCCESS) {
-			ASSERT(memb->gone_event <= mg->last_finish);
-			log_group(mg, "finish: recovered jid %d nodeid %d",
-				  memb->jid, memb->nodeid);
-			list_del(&memb->list);
-			free(memb);
-		} else {
-			log_error("%s finish: needs recovery jid %d nodeid %d "
-				  "status %d", mg->name, memb->jid,
-				  memb->nodeid, memb->recovery_status);
-			mg->needs_recovery = 1;
-		}
-	}
-
-	list_for_each_entry(memb, &mg->members, list)
-		memb->finished = 1;
-
-	if (mg->group_leave_on_finish) {
-		log_group(mg, "leaving group after delay for join to finish");
-		group_leave(gh, mg->name);
-		mg->group_leave_on_finish = 0;
-		return 0;
-	}
-
-	if (!mg->needs_recovery) {
-		mg->kernel_stopped = 0; /* for queries */
-		set_sysfs(mg, "block", 0);
-
-		/* we may have been holding back our local mount due to
-		   being stopped/blocked */
-		if (mg->mount_client_delay && !first_mounter_recovery(mg)) {
-			mg->mount_client_delay = 0;
-			notify_mount_client(mg);
-		}
-	} else
-		log_group(mg, "finish: leave locks blocked for needs_recovery");
-
-	return 0;
-}
-
-/*
- * - require the first mounter to be rw, not ro or spectator.
- *
- * - if rw mounter fails, leaving only spectator mounters,
- * require the next mounter to be rw, more ro/spectator mounts should
- * fail until the fs is mounted rw.
- *
- * - if last rw mounter fails and ro mounters are left (possibly with
- * some spectators), disallow any ro->rw remounts, leave gfs blocked,
- * require next mounter to be rw, have next mounter do first mount
- * gfs/journal recovery.
- */
-
-/* called for the initial start on the node that's first to mount the fs.
-   (it should be ok to let the first mounter be a spectator, gfs should do
-   first recovery and bail out if there are any dirty journals) */
-
-/* FIXME: if journal recovery fails on any of the journals, we should
-   fail the mount */
-
-static void start_first_mounter(struct mountgroup *mg)
-{
-	struct mg_member *memb;
-
-	log_group(mg, "start_first_mounter");
-	set_our_memb_options(mg);
-	memb = find_memb_nodeid(mg, our_nodeid);
-	ASSERT(memb);
-
-	if (mg->ro || mg->spectator) {
-		memb->jid = -2;
-		mg->our_jid = -2;
-		log_group(mg, "start_first_mounter not rw ro=%d spect=%d",
-			  mg->ro , mg->spectator);
-		mg->mount_client_result = -EUCLEAN;
-	} else {
-		memb->opts |= MEMB_OPT_RECOVER;
-		memb->jid = 0;
-		mg->our_jid = 0;
-		mg->first_mounter = 1;
-		mg->first_mounter_done = 0;
-		mg->got_our_options = 1;
-		mg->got_our_journals = 1;
-	}
-	start_done(mg);
-	notify_mount_client(mg);
-}
-
-/* called for the initial start on a rw/ro mounter;
-   the existing mounters are running start_participant() */
-
-static void start_participant_init(struct mountgroup *mg)
-{
-	log_group(mg, "start_participant_init");
-	set_our_memb_options(mg);
-	send_options(mg);
-	start_done(mg);
-}
-
-/* called for a non-initial start on a normal mounter.
-   NB we can get here without having received a journals message for
-   our (recent) mount yet in which case we don't know the jid or ro/rw
-   status of any members, and don't know our own jid. */
-
-static void start_participant(struct mountgroup *mg, int pos, int neg)
-{
-	log_group(mg, "start_participant pos=%d neg=%d", pos, neg);
-
-	if (pos) {
-		start_done(mg);
-		/* we save options messages from nodes for whom we've not
-		   received a start yet */
-		process_saved_options(mg);
-	} else if (neg) {
-		recover_journals(mg);
-		process_saved_recovery_status(mg);
-	}
-}
-
-/* called for the initial start on a spectator mounter,
-   after _receive_journals() */
-
-static void start_spectator_init_2(struct mountgroup *mg)
-{
-	log_group(mg, "start_spectator_init_2 our_jid=%d", mg->our_jid);
-
-	/* we've been given jid of -2 which means we're not permitted
-	   to mount the fs; probably because the next mounter must be rw */
-
-	if (mg->our_jid == -2) {
-		mg->mount_client_result = -EUCLEAN;
-	} else
-		ASSERT(mg->our_jid == -1);
-
-	notify_mount_client(mg);
-}
-
-/* called for the initial start on a spectator mounter */
-
-static void start_spectator_init(struct mountgroup *mg)
-{
-	log_group(mg, "start_spectator_init");
-	set_our_memb_options(mg);
-	send_options(mg);
-	start_done(mg);
-	mg->start2_fn = start_spectator_init_2;
-}
-
-/* called for a non-initial start on a spectator mounter */
-
-static void start_spectator(struct mountgroup *mg, int pos, int neg)
-{
-	log_group(mg, "start_spectator pos=%d neg=%d", pos, neg);
-
-	if (pos) {
-		start_done(mg);
-		process_saved_options(mg);
-	} else if (neg) {
-		recover_journals(mg);
-		process_saved_recovery_status(mg);
-	}
-}
-
-/* If nodeA fails, nodeB is recovering journalA and nodeB fails before
-   finishing, then nodeC needs to tell gfs to recover both journalA and
-   journalB.  We do this by setting tell_gfs_to_recover back to 1 for
-   any nodes that are still on the members_gone list. */
-
-static void reset_unfinished_recoveries(struct mountgroup *mg)
-{
-	struct mg_member *memb;
-
-	list_for_each_entry(memb, &mg->members_gone, list) {
-		if (memb->recovery_status &&
-		    memb->recovery_status != RS_NEED_RECOVERY) {
-			log_group(mg, "retry unfinished recovery "
-				  "jid %d nodeid %d",
-				  memb->jid, memb->nodeid);
-			memb->tell_gfs_to_recover = 1;
-			memb->recovery_status = RS_NEED_RECOVERY;
-			memb->local_recovery_status = RS_NEED_RECOVERY;
-		}
-	}
-}
-
-/*
-   old method:
-   A is rw mount, B mounts rw
-
-   do_start		do_start
-   start_participant	start_participant_init
-   			send_options
-   receive_options
-   start_participant_2
-   discover_journals
-   assign B a jid
-   send_journals
-   group_start_done
-   			receive_journals
-			start_participant_init_2
-			group_start_done
-   do_finish		do_finish
-
-   new method: decouples stop/start/finish from mount processing
-   A is rw mount, B mounts rw
-
-   do_start		do_start
-   start_participant	start_participant_init
-   start_done		send_options
-   			start_done
-   do_finish		do_finish
-
-   receive_options
-   assign_journal
-   send_journals
-   			receive_journals
-			start_participant_init_2
-			notify_mount_client
-*/
-
-void do_start(struct mountgroup *mg, int type, int member_count, int *nodeids)
-{
-	int pos = 0, neg = 0;
-
-	mg->start_event_nr = mg->last_start;
-	mg->start_type = type;
-
-	log_group(mg, "start %d init %d type %d member_count %d",
-		  mg->last_start, mg->init, type, member_count);
-
-	recover_members(mg, member_count, nodeids, &pos, &neg);
-	reset_unfinished_recoveries(mg);
-
-	if (mg->init) {
-		if (member_count == 1)
-			start_first_mounter(mg);
-		else if (mg->spectator)
-			start_spectator_init(mg);
-		else
-			start_participant_init(mg);
-		mg->init = 0;
-	} else {
-		if (mg->spectator)
-			start_spectator(mg, pos, neg);
-		else
-			start_participant(mg, pos, neg);
-	}
-}
-
-/*
-  What repurcussions are there from umount shutting down gfs in the
-  kernel before we leave the mountgroup?  We can no longer participate
-  in recovery even though we're in the group -- what are the end cases
-  that we need to deal with where this causes a problem?  i.e. there
-  is a period of time where the mountgroup=A,B,C but the kernel fs
-  is only active on A,B, not C.  The mountgroup on A,B can't depend
-  on the mg on C to necessarily be able to do some things (recovery).
-
-  At least in part, it means that after we do an umount and have
-  removed the instance of this fs in the kernel, we'll still get
-  stop/start/finish callbacks from groupd for which we'll attempt
-  and fail to: block/unblock gfs kernel activity, initiate gfs
-  journal recovery, get recovery-done signals fromt eh kernel.
- 
-  We don't want to hang groupd event processing by failing to send
-  an ack (stop_done/start_done) back to groupd when it needs one
-  to procede.  In the case where we get a start for a failed node
-  that needs journal recovery, we have a problem because we wait to
-  call group_start_done() until gfs in the kernel to signal that
-  the journal recovery is done.  If we've unmounted gfs isn't there
-  any more to give us this signal and we'll never call start_done.
- 
-  update: we should be dealing with all these issues correctly now. */
-
-int do_terminate(struct mountgroup *mg)
-{
-	purge_plocks(mg, 0, 1);
-
-	if (mg->withdraw_suspend) {
-		log_group(mg, "termination of our withdraw leave");
-		set_sysfs(mg, "withdraw", 1);
-		list_move(&mg->list, &withdrawn_mounts);
-	} else {
-		log_group(mg, "termination of our unmount leave");
-		list_del(&mg->list);
-		free(mg);
-	}
-
-	return 0;
-}
-
-static void do_deliver(int nodeid, char *data, int len)
-{
-	struct mountgroup *mg;
-	struct gdlm_header *hd;
-
-	hd = (struct gdlm_header *) data;
-
-	mg = find_mg(hd->name);
-	if (!mg) {
-		/*
-		log_error("cpg message from %d len %d no group %s",
-			  nodeid, len, hd->name);
-		*/
-		return;
-	}
-
-	hd->version[0]	= le16_to_cpu(hd->version[0]);
-	hd->version[1]	= le16_to_cpu(hd->version[1]);
-	hd->version[2]	= le16_to_cpu(hd->version[2]);
-	hd->type	= le16_to_cpu(hd->type);
-	hd->nodeid	= le32_to_cpu(hd->nodeid);
-	hd->to_nodeid	= le32_to_cpu(hd->to_nodeid);
-
-	/* FIXME: we need to look at how to gracefully fail when we end up
-	   with mixed incompat versions */
-
-	if (hd->version[0] != protocol_active[0]) {
-		log_error("reject message from %d version %u.%u.%u vs %u.%u.%u",
-			  nodeid, hd->version[0], hd->version[1],
-			  hd->version[2], protocol_active[0],
-			  protocol_active[1], protocol_active[2]);
-		return;
-	}
-
-	/* If there are some group messages between a new node being added to
-	   the cpg group and being added to the app group, the new node should
-	   discard them since they're only relevant to the app group. */
-
-	if (!mg->last_callback) {
-		log_group(mg, "discard %s len %d from %d",
-			  msg_name(hd->type), len, nodeid);
-		return;
-	}
-
-	switch (hd->type) {
-	case MSG_JOURNAL:
-		receive_journals(mg, data, len, nodeid);
-		break;
-
-	case MSG_OPTIONS:
-		receive_options(mg, data, len, nodeid);
-		break;
-
-	case MSG_REMOUNT:
-		receive_remount(mg, data, len, nodeid);
-		break;
-
-	case MSG_PLOCK:
-		receive_plock(mg, data, len, nodeid);
-		break;
-
-	case MSG_MOUNT_STATUS:
-		receive_mount_status(mg, data, len, nodeid);
-		break;
-
-	case MSG_RECOVERY_STATUS:
-		receive_recovery_status(mg, data, len, nodeid);
-		break;
-
-	case MSG_RECOVERY_DONE:
-		receive_recovery_done(mg, data, len, nodeid);
-		break;
-
-	case MSG_WITHDRAW:
-		receive_withdraw(mg, data, len, nodeid);
-		break;
-
-	case MSG_PLOCK_OWN:
-		receive_own(mg, data, len, nodeid);
-		break;
-
-	case MSG_PLOCK_DROP:
-		receive_drop(mg, data, len, nodeid);
-		break;
-
-	case MSG_PLOCK_SYNC_LOCK:
-	case MSG_PLOCK_SYNC_WAITER:
-		receive_sync(mg, data, len, nodeid);
-		break;
-
-	default:
-		log_error("unknown message type %d from %d",
-			  hd->type, hd->nodeid);
-	}
-}
-
-static void deliver_cb(cpg_handle_t handle, struct cpg_name *group_name,
-		uint32_t nodeid, uint32_t pid, void *data, int data_len)
-{
-	do_deliver(nodeid, data, data_len);
-}
-
-/* Not sure if purging plocks (driven by confchg) needs to be synchronized with
-   the other recovery steps (driven by libgroup) for a node, don't think so.
-   Is it possible for a node to have been cleared from the members_gone list
-   before this confchg is processed? */
-
-static void confchg_cb(cpg_handle_t handle, struct cpg_name *group_name,
-		struct cpg_address *member_list, int member_list_entries,
-		struct cpg_address *left_list, int left_list_entries,
-		struct cpg_address *joined_list, int joined_list_entries)
-{
-	struct mountgroup *mg;
-	int i, nodeid;
-
-	for (i = 0; i < left_list_entries; i++) {
-		nodeid = left_list[i].nodeid;
-		list_for_each_entry(mg, &mountgroups, list) {
-			if (is_member(mg, nodeid) || is_removed(mg, nodeid))
-				purge_plocks(mg, left_list[i].nodeid, 0);
-		}
-	}
-}
-
-static cpg_callbacks_t callbacks = {
-	.cpg_deliver_fn = deliver_cb,
-	.cpg_confchg_fn = confchg_cb,
-};
-
-void process_cpg_old(int ci)
-{
-	cpg_error_t error;
-
-	error = cpg_dispatch(cpg_handle_daemon, CPG_DISPATCH_ALL);
-	if (error != CPG_OK) {
-		log_error("cpg_dispatch error %d", error);
-		return;
-	}
-
-	update_flow_control_status();
-}
-
-int setup_cpg_old(void)
-{
-	static struct cpg_name name;
-	cpg_error_t error;
-	int fd = 0;
-
-	if (cfgd_plock_ownership)
-		memcpy(protocol_active, protocol_v200, sizeof(protocol_v200));
-	else
-		memcpy(protocol_active, protocol_v100, sizeof(protocol_v100));
-
-	error = cpg_initialize(&cpg_handle_daemon, &callbacks);
-	if (error != CPG_OK) {
-		log_error("daemon cpg_initialize error %d", error);
-		return -1;
-	}
-
-	cpg_fd_get(cpg_handle_daemon, &fd);
-	if (fd < 0) {
-		log_error("daemon cpg_fd_get error %d", error);
-		return -1;
-	}
-
-	memset(&name, 0, sizeof(name));
-	strcpy(name.value, "gfs_controld");
-	name.length = 12;
-
- retry:
-	error = cpg_join(cpg_handle_daemon, &name);
-	if (error == CPG_ERR_TRY_AGAIN) {
-		log_debug("daemon cpg_join retry");
-		sleep(1);
-		goto retry;
-	}
-	if (error != CPG_OK) {
-		log_error("daemon cpg_join error %d", error);
-		cpg_finalize(cpg_handle_daemon);
-		return -1;
-	}
-
-	log_debug("setup_cpg_old %d", fd);
-	return fd;
-}
-
-void close_cpg_old(void)
-{
-	static struct cpg_name name;
-	cpg_error_t error;
-	int i = 0;
-
-	if (!cpg_handle_daemon || cluster_down)
-		return;
-
-	memset(&name, 0, sizeof(name));
-	strcpy(name.value, "gfs_controld");
-	name.length = 12;
-
- retry:
-	error = cpg_leave(cpg_handle_daemon, &name);
-	if (error == CPG_ERR_TRY_AGAIN) {
-		sleep(1);
-		if (!(++i % 10))
-			log_error("daemon cpg_leave error retrying");
-		goto retry;
-	}
-	if (error != CPG_OK)
-		log_error("daemon cpg_leave error %d", error);
-}
-
diff --git a/group/gfs_controld/cpg-old.h b/group/gfs_controld/cpg-old.h
deleted file mode 100644
index 0458338..0000000
--- a/group/gfs_controld/cpg-old.h
+++ /dev/null
@@ -1,73 +0,0 @@
-#ifndef __CPG_OLD_DOT_H__
-#define __CPG_OLD_DOT_H__
-
-#define DO_STOP 1
-#define DO_START 2
-#define DO_FINISH 3
-#define DO_TERMINATE 4
-#define DO_SETID 5
-
-enum {
-
-	MSG_JOURNAL = 1,
-	MSG_OPTIONS,
-	MSG_REMOUNT,
-	MSG_PLOCK,
-	MSG_WITHDRAW,
-	MSG_MOUNT_STATUS,
-	MSG_RECOVERY_STATUS,
-	MSG_RECOVERY_DONE,
-	MSG_PLOCK_OWN,
-	MSG_PLOCK_DROP,
-	MSG_PLOCK_SYNC_LOCK,
-	MSG_PLOCK_SYNC_WAITER,
-};
-
-/* These lengths are part of the "old" wire protocol. */
-
-#define MAX_OPTIONS_LEN		1024
-#define MSG_NAMELEN		255
-
-struct gdlm_header {
-	uint16_t		version[3];
-	uint16_t		type;		   /* MSG_ */
-	uint32_t		nodeid;		 /* sender */
-	uint32_t		to_nodeid;	      /* 0 if to all */
-	char			name[MSG_NAMELEN];
-};
-
-struct save_msg {
-	struct list_head list;
-	int nodeid;
-	int len;
-	int type;
-	char buf[0];
-};
-
-struct mg_member {
-	struct list_head	list;
-	int			nodeid;
-	int			jid;
-
-	int			spectator;
-	int			readonly;
-	int			rw;
-	uint32_t		opts;
-
-	int			tell_gfs_to_recover;
-	int			wait_gfs_recover_done;
-	int			gone_event;
-	int			gone_type;
-	int			finished;
-	int			local_recovery_status;
-	int			recovery_status;
-	int			withdrawing;
-	int			needs_journals;
-
-	int			ms_kernel_mount_done;
-	int			ms_first_mounter;
-	int	ms_kernel_mount_error;
-};
-
-#endif
-
diff --git a/group/gfs_controld/crc.c b/group/gfs_controld/crc.c
deleted file mode 100644
index 29bc096..0000000
--- a/group/gfs_controld/crc.c
+++ /dev/null
@@ -1,72 +0,0 @@
-#include "gfs_daemon.h"
-
-static const uint32_t crc_32_tab[] = {
-  0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,
-  0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
-  0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
-  0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
-  0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
-  0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
-  0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,
-  0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,
-  0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
-  0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
-  0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,
-  0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
-  0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,
-  0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,
-  0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
-  0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,
-  0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,
-  0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
-  0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,
-  0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
-  0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
-  0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,
-  0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,
-  0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
-  0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
-  0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,
-  0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
-  0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,
-  0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,
-  0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
-  0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,
-  0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
-};
-
-/**
- *
- * Copied from:
- *
- * gfs2_disk_hash - hash an array of data
- * @data: the data to be hashed
- * @len: the length of data to be hashed
- *
- * This function must produce the same results as the one in the kernel:
- *   crc32_le(0xFFFFFFFF, data, len) ^ 0xFFFFFFFF
- *
- * Take some data and convert it to a 32-bit hash.
- *
- * The hash function is a 32-bit CRC of the data.  The algorithm uses
- * the crc_32_tab table above.
- *
- * This may not be the fastest hash function, but it does a fair bit better
- * at providing uniform results than the others I've looked at.  That's
- * really important for efficient directories.
- *
- * Returns: the hash
- */
-
-uint32_t cpgname_to_crc(const char *data, int len)
-{
-	uint32_t hash = 0xFFFFFFFF;
-
-	for (; len--; data++)
-		hash = crc_32_tab[(hash ^ *data) & 0xFF] ^ (hash >> 8);
-
-	hash = ~hash;
-
-	return hash;
-}
-
diff --git a/group/gfs_controld/gfs_controld.h b/group/gfs_controld/gfs_controld.h
deleted file mode 100644
index 571dffb..0000000
--- a/group/gfs_controld/gfs_controld.h
+++ /dev/null
@@ -1,37 +0,0 @@
-#ifndef __GFS_CONTROLD_DOT_H__
-#define __GFS_CONTROLD_DOT_H__
-
-/* This defines the interface between gfs_controld and libgfscontrol, and
-   should only be used by libgfscontrol. */
-
-#define GFSC_SOCK_PATH                  "gfsc_sock"
-#define GFSC_QUERY_SOCK_PATH            "gfsc_query_sock"
-
-#define GFSC_MAGIC                      0x6F5C6F5C
-#define GFSC_VERSION                    0x00010001
-
-#define GFSC_CMD_DUMP_DEBUG             1
-#define GFSC_CMD_DUMP_PLOCKS            2
-#define GFSC_CMD_MOUNTGROUP_INFO        3
-#define GFSC_CMD_NODE_INFO              4
-#define GFSC_CMD_MOUNTGROUPS            5
-#define GFSC_CMD_MOUNTGROUP_NODES       6
-#define GFSC_CMD_FS_JOIN		7
-#define GFSC_CMD_FS_REMOUNT		8
-#define GFSC_CMD_FS_MOUNT_DONE		9
-#define GFSC_CMD_FS_LEAVE		10
-
-struct gfsc_header {
-	unsigned int magic;
-	unsigned int version;
-	unsigned int command;
-	unsigned int option;
-	unsigned int len;
-	int data;       /* embedded command-specific data, for convenience */
-	int unused1;
-	int unsued2;
-	char name[GFS_MOUNTGROUP_LEN]; /* no terminating null space */
-};
-
-#endif
-
diff --git a/group/gfs_controld/gfs_daemon.h b/group/gfs_controld/gfs_daemon.h
deleted file mode 100644
index 157865a..0000000
--- a/group/gfs_controld/gfs_daemon.h
+++ /dev/null
@@ -1,331 +0,0 @@
-#ifndef __GFS_DAEMON_DOT_H__
-#define __GFS_DAEMON_DOT_H__
-
-#include <sys/types.h>
-#include <asm/types.h>
-#include <sys/uio.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <sys/utsname.h>
-#include <sys/poll.h>
-#include <sys/wait.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <net/if.h>
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <fcntl.h>
-#include <netdb.h>
-#include <limits.h>
-#include <unistd.h>
-#include <time.h>
-#include <syslog.h>
-#include <sched.h>
-#include <signal.h>
-#include <sys/time.h>
-#include <dirent.h>
-#include <openais/saAis.h>
-#include <openais/saCkpt.h>
-#include <corosync/cpg.h>
-#include <liblogthread.h>
-
-#include <linux/dlmconstants.h>
-#include "libgfscontrol.h"
-#include "gfs_controld.h"
-#include "list.h"
-#include "linux_endian.h"
-
-/* TODO: warn if
-   DLM_LOCKSPACE_LEN (from dlmconstants.h) !=
-   GFS_MOUNTGROUP_LEN (from libgfscontrol.h)
-*/
-
-/* Maximum members of a mountgroup, should match CPG_MEMBERS_MAX in
-   corosync/cpg.h.  There are no max defines in gfs-kernel for
-   mountgroup members. (FIXME verify gfs-kernel/lock_dlm) */
-
-#define MAX_NODES       128
-
-/* Max string length printed on a line, for debugging/dump output. */
-
-#define MAXLINE         256
-
-/* group_mode */
-
-#define GROUP_LIBGROUP	2
-#define GROUP_LIBCPG	3
-
-extern int daemon_debug_opt;
-extern int daemon_quit;
-extern int cluster_down;
-extern int poll_dlm;
-extern int poll_ignore_plock;
-extern int plock_fd;
-extern int plock_ci;
-extern struct list_head mountgroups;
-extern int cman_quorate;
-extern int our_nodeid;
-extern char *clustername;
-extern char daemon_debug_buf[256];
-extern char dump_buf[GFSC_DUMP_SIZE];
-extern int dump_point;
-extern int dump_wrap;
-extern char plock_dump_buf[GFSC_DUMP_SIZE];
-extern int plock_dump_len;
-extern int dmsetup_wait;
-extern cpg_handle_t cpg_handle_daemon;
-extern int libcpg_flow_control_on;
-extern int group_mode;
-extern uint32_t plock_minor;
-extern uint32_t old_plock_minor;
-extern struct list_head withdrawn_mounts;
-
-void daemon_dump_save(void);
-
-#define log_level(lvl, fmt, args...) \
-do { \
-	snprintf(daemon_debug_buf, 255, "%ld " fmt "\n", time(NULL), ##args); \
-	daemon_dump_save(); \
-	logt_print(lvl, fmt "\n", ##args); \
-	if (daemon_debug_opt) \
-		fprintf(stderr, "%s", daemon_debug_buf); \
-} while (0)
-
-#define log_debug(fmt, args...) log_level(LOG_DEBUG, fmt, ##args)
-#define log_error(fmt, args...) log_level(LOG_ERR, fmt, ##args)
-
-#define log_group(g, fmt, args...) \
-do { \
-	snprintf(daemon_debug_buf, 255, "%ld %s " fmt "\n", time(NULL), \
-		 (g)->name, ##args); \
-	daemon_dump_save(); \
-	logt_print(LOG_DEBUG, fmt "\n", ##args); \
-	if (daemon_debug_opt) \
-		fprintf(stderr, "%s", daemon_debug_buf); \
-} while (0)
-
-#define log_plock(g, fmt, args...) \
-do { \
-	snprintf(daemon_debug_buf, 255, "%ld %s " fmt "\n", time(NULL), \
-		 (g)->name, ##args); \
-	if (daemon_debug_opt && cfgd_plock_debug) \
-		fprintf(stderr, "%s", daemon_debug_buf); \
-} while (0)
-
-struct mountgroup {
-	struct list_head	list;
-	uint32_t		id;
-	struct gfsc_mount_args	mount_args;
-	char			name[GFS_MOUNTGROUP_LEN+1];
-	int			old_group_mode;
-
-	int			mount_client;
-	int			mount_client_result;
-	int			mount_client_notified;
-	int			mount_client_delay;
-	int			remount_client;
-
-	int			withdraw_uevent;
-	int			withdraw_suspend;
-	int			dmsetup_wait;
-	pid_t			dmsetup_pid;
-	int			our_jid;
-	int			spectator;
-	int			ro;
-	int			rw;
-	int                     joining;
-	int                     leaving;
-	int			kernel_mount_error;
-	int			kernel_mount_done;
-	int			first_mounter;
-
-	/* cpg-new stuff */
-
-	cpg_handle_t            cpg_handle;
-	int                     cpg_client;
-	int                     cpg_fd;
-	int                     kernel_stopped;
-	uint32_t                change_seq;
-	uint32_t                started_count;
-	struct change           *started_change;
-	struct list_head        changes;
-	struct list_head        node_history;
-	struct list_head	journals;
-	int			dlm_notify_nodeid;
-	int			first_done_uevent;
-	int			first_recovery_needed;
-	int			first_recovery_master;
-	int			first_recovery_msg;
-	int			local_recovery_jid;
-	int			local_recovery_busy;
-
-	/* cpg-old stuff for rhel5/stable2 compat */
-
-	struct list_head	members;
-	struct list_head	members_gone;
-	int			memb_count;
-	int			last_stop;
-	int			last_start;
-	int			last_finish;
-	int			last_callback;
-	int			start_event_nr;
-	int			start_type;
-	int                     group_leave_on_finish;
-	int			init;
-	int			got_our_options;
-	int			got_our_journals;
-	int			delay_send_journals;
-	int			first_mount_pending_stop;
-	int			first_mounter_done;
-	int			global_first_recover_done;
-	int			emulate_first_mounter;
-	int			wait_first_done;
-	int			needs_recovery;
-	int			low_nodeid;
-	int			master_nodeid;
-	int			got_kernel_mount;
-	struct list_head	saved_messages;
-	void			*start2_fn;
-
-	/* cpg-old plock stuff */
-
-	int			save_plocks;
-	struct list_head	plock_resources;
-	uint32_t		associated_ls_id;
-	uint64_t		cp_handle;
-	time_t			last_checkpoint_time;
-	time_t			last_plock_time;
-	struct timeval		drop_resources_last;
-};
-
-/* these need to match the kernel defines of the same name in lm_interface.h */
-
-#define LM_RD_GAVEUP 308
-#define LM_RD_SUCCESS 309
-
-/* config.c */
-int setup_ccs(void);
-void close_ccs(void);
-void read_ccs_name(char *path, char *name);
-void read_ccs_yesno(char *path, int *yes, int *no);
-int read_ccs_int(char *path, int *config_val);
-void read_ccs_nodir(struct mountgroup *mg, char *buf);
-
-/* cpg-new.c */
-int setup_cpg(void);
-void close_cpg(void);
-void process_cpg(int ci);
-int setup_dlmcontrol(void);
-void process_dlmcontrol(int ci);
-int set_protocol(void);
-void process_recovery_uevent(char *name, int jid, int status, int first);
-void process_mountgroups(void);
-int gfs_join_mountgroup(struct mountgroup *mg);
-void do_leave(char *name, int mnterr);
-void gfs_mount_done(struct mountgroup *mg);
-void send_remount(struct mountgroup *mg, struct gfsc_mount_args *ma);
-void send_withdraw(struct mountgroup *mg);
-int set_mountgroup_info(struct mountgroup *mg, struct gfsc_mountgroup *out);
-int set_node_info(struct mountgroup *mg, int nodeid, struct gfsc_node *node);
-int set_mountgroups(int *count, struct gfsc_mountgroup **mgs_out);
-int set_mountgroup_nodes(struct mountgroup *mg, int option, int *node_count,
-	struct gfsc_node **nodes_out);
-void free_mg(struct mountgroup *mg);
-
-/* cpg-old.c */
-int setup_cpg_old(void);
-void close_cpg_old(void);
-void process_cpg_old(int ci);
-
-int gfs_join_mountgroup_old(struct mountgroup *mg, struct gfsc_mount_args *ma);
-void do_leave_old(char *name, int mnterr);
-int send_group_message_old(struct mountgroup *mg, int len, char *buf);
-void save_message_old(struct mountgroup *mg, char *buf, int len, int from,
-	int type);
-void send_withdraw_old(struct mountgroup *mg);
-int process_recovery_uevent_old(char *name, int jid, int status, int first);
-void send_remount_old(struct mountgroup *mg, struct gfsc_mount_args *ma);
-void send_mount_status_old(struct mountgroup *mg);
-int do_stop(struct mountgroup *mg);
-int do_finish(struct mountgroup *mg);
-void do_start(struct mountgroup *mg, int type, int member_count, int *nodeids);
-int do_terminate(struct mountgroup *mg);
-int do_withdraw_old(char *table);
-
-/* group.c */
-int setup_groupd(void);
-void close_groupd(void);
-void process_groupd(int ci);
-int set_mountgroup_info_group(struct mountgroup *mg,
-	struct gfsc_mountgroup *out);
-int set_node_info_group(struct mountgroup *mg, int nodeid,
-	struct gfsc_node *node);
-int set_mountgroups_group(int *count, struct gfsc_mountgroup **mgs_out);
-int set_mountgroup_nodes_group(struct mountgroup *mg, int option,
-	int *node_count, struct gfsc_node **nodes_out);
-int set_group_mode(void);
-
-/* main.c */
-int do_read(int fd, void *buf, size_t count);
-int do_write(int fd, void *buf, size_t count);
-void client_dead(int ci);
-int client_add(int fd, void (*workfn)(int ci), void (*deadfn)(int ci));
-int client_fd(int ci);
-void client_ignore(int ci, int fd);
-void client_back(int ci, int fd);
-struct mountgroup *create_mg(char *name);
-struct mountgroup *find_mg(char *name);
-struct mountgroup *find_mg_id(uint32_t id);
-void client_reply_remount(struct mountgroup *mg, int ci, int result);
-void client_reply_join(int ci, struct gfsc_mount_args *ma, int result);
-void client_reply_join_full(struct mountgroup *mg, int result);
-void query_lock(void);
-void query_unlock(void);
-void process_connection(int ci);
-void cluster_dead(int ci);
-
-/* member_cman.c */
-int setup_cman(void);
-void close_cman(void);
-void process_cman(int ci);
-void kick_node_from_cluster(int nodeid);
-
-/* plock.c */
-int setup_plocks(void);
-void process_plocks(int ci);
-int limit_plocks(void);
-void receive_plock(struct mountgroup *mg, char *buf, int len, int from);
-void receive_own(struct mountgroup *mg, char *buf, int len, int from);
-void receive_sync(struct mountgroup *mg, char *buf, int len, int from);
-void receive_drop(struct mountgroup *mg, char *buf, int len, int from);
-void process_saved_plocks(struct mountgroup *mg);
-int unlink_checkpoint(struct mountgroup *mg);
-void store_plocks(struct mountgroup *mg, int nodeid);
-void retrieve_plocks(struct mountgroup *mg);
-void purge_plocks(struct mountgroup *mg, int nodeid, int unmount);
-int fill_plock_dump_buf(struct mountgroup *mg);
-int setup_misc_devices(void);
-
-/* util.c */
-int we_are_in_fence_domain(void);
-int set_sysfs(struct mountgroup *mg, char *field, int val);
-int read_sysfs_int(struct mountgroup *mg, char *field, int *val_out);
-int run_dmsetup_suspend(struct mountgroup *mg, char *dev);
-void update_dmsetup_wait(void);
-void update_flow_control_status(void);
-int check_uncontrolled_filesystems(void);
-
-/* logging.c */
-
-void init_logging(void);
-void setup_logging();
-void close_logging(void);
-
-#endif
diff --git a/group/gfs_controld/group.c b/group/gfs_controld/group.c
deleted file mode 100644
index e5046b2..0000000
--- a/group/gfs_controld/group.c
+++ /dev/null
@@ -1,360 +0,0 @@
-#include "gfs_daemon.h"
-#include "config.h"
-#include "cpg-old.h"
-#include "libgroup.h"
-
-#define LOCK_DLM_GROUP_LEVEL    2
-#define LOCK_DLM_GROUP_NAME     "gfs"
-
-/* save all the params from callback functions here because we can't
-   do the processing within the callback function itself */
-
-group_handle_t gh;
-static int cb_action;
-static char cb_name[GFS_MOUNTGROUP_LEN+1];
-static int cb_event_nr;
-static unsigned int cb_id;
-static int cb_type;
-static int cb_member_count;
-static int cb_members[MAX_NODES];
-
-
-static void stop_cbfn(group_handle_t h, void *private, char *name)
-{
-	cb_action = DO_STOP;
-	strcpy(cb_name, name);
-}
-
-static void start_cbfn(group_handle_t h, void *private, char *name,
-		       int event_nr, int type, int member_count, int *members)
-{
-	int i;
-
-	cb_action = DO_START;
-	strncpy(cb_name, name, GFS_MOUNTGROUP_LEN);
-	cb_event_nr = event_nr;
-	cb_type = type;
-	cb_member_count = member_count;
-
-	for (i = 0; i < member_count; i++)
-		cb_members[i] = members[i];
-}
-
-static void finish_cbfn(group_handle_t h, void *private, char *name,
-			int event_nr)
-{
-	cb_action = DO_FINISH;
-	strncpy(cb_name, name, GFS_MOUNTGROUP_LEN);
-	cb_event_nr = event_nr;
-}
-
-static void terminate_cbfn(group_handle_t h, void *private, char *name)
-{
-	cb_action = DO_TERMINATE;
-	strncpy(cb_name, name, GFS_MOUNTGROUP_LEN);
-}
-
-static void setid_cbfn(group_handle_t h, void *private, char *name,
-		       unsigned int id)
-{
-	cb_action = DO_SETID;
-	strncpy(cb_name, name, GFS_MOUNTGROUP_LEN);
-	cb_id = id;
-}
-
-static group_callbacks_t callbacks = {
-	stop_cbfn,
-	start_cbfn,
-	finish_cbfn,
-	terminate_cbfn,
-	setid_cbfn,
-};
-
-static char *str_members(void)
-{
-	static char str_members_buf[MAXLINE];
-	int i, ret, pos = 0, len = MAXLINE;
-
-	memset(str_members_buf, 0, MAXLINE);
-
-	for (i = 0; i < cb_member_count; i++) {
-		if (i != 0) {
-			ret = snprintf(str_members_buf + pos, len - pos, " ");
-			if (ret >= len - pos)
-				break;
-			pos += ret;
-		}
-		ret = snprintf(str_members_buf + pos, len - pos, "%d",
-			       cb_members[i]);
-		if (ret >= len - pos)
-			break;
-		pos += ret;
-	}
-	return str_members_buf;
-}
-
-void process_groupd(int ci)
-{
-	struct mountgroup *mg;
-	int error = 0;
-
-	error = group_dispatch(gh);
-	if (error) {
-		log_error("groupd_dispatch error %d errno %d", error, errno);
-		goto out;
-	}
-
-	if (!cb_action)
-		goto out;
-
-	mg = find_mg(cb_name);
-	if (!mg) {
-		log_error("callback %d group %s not found", cb_action, cb_name);
-		error = -1;
-		goto out;
-	}
-
-	switch (cb_action) {
-	case DO_STOP:
-		log_debug("groupd cb: stop %s", cb_name);
-		mg->last_callback = DO_STOP;
-		mg->last_stop = mg->last_start;
-		do_stop(mg);
-		break;
-
-	case DO_START:
-		log_debug("groupd cb: start %s type %d count %d members %s",
-			  cb_name, cb_type, cb_member_count, str_members());
-		mg->last_callback = DO_START;
-		mg->last_start = cb_event_nr;
-		do_start(mg, cb_type, cb_member_count, cb_members);
-		break;
-
-	case DO_FINISH:
-		log_debug("groupd cb: finish %s", cb_name);
-		mg->last_callback = DO_FINISH;
-		mg->last_finish = cb_event_nr;
-		do_finish(mg);
-		break;
-
-	case DO_TERMINATE:
-		log_debug("groupd cb: terminate %s", cb_name);
-		mg->last_callback = DO_TERMINATE;
-		do_terminate(mg);
-		break;
-
-	case DO_SETID:
-		log_debug("groupd cb: set_id %s %x", cb_name, cb_id);
-		mg->id = cb_id;
-		break;
-
-	default:
-		error = -EINVAL;
-	}
-
- out:
-	cb_action = 0;
-}
-
-int setup_groupd(void)
-{
-	int rv;
-
-	gh = group_init(NULL, LOCK_DLM_GROUP_NAME, LOCK_DLM_GROUP_LEVEL,
-			&callbacks, 10);
-	if (!gh) {
-		log_error("group_init error %p %d", gh, errno);
-		return -ENOTCONN;
-	}
-
-	rv = group_get_fd(gh);
-	if (rv < 0)
-		log_error("group_get_fd error %d %d", rv, errno);
-
-	log_debug("groupd %d", rv);
-
-	return rv;
-}
-
-void close_groupd(void)
-{
-	group_exit(gh);
-}
-
-/* most of the query info doesn't apply in the LIBGROUP mode, but we can
-   emulate some basic parts of it */
-
-int set_mountgroup_info_group(struct mountgroup *mg,
-			      struct gfsc_mountgroup *out)
-{
-	strncpy(out->name, mg->name, GFS_MOUNTGROUP_LEN);
-	out->global_id = mg->id;
-
-	if (mg->joining)
-		out->flags |= GFSC_MF_JOINING;
-	if (mg->leaving)
-		out->flags |= GFSC_MF_LEAVING;
-	if (mg->kernel_stopped)
-		out->flags |= GFSC_MF_KERNEL_STOPPED;
-
-	out->cg_prev.member_count = mg->memb_count;
-
-	return 0;
-}
-
-static int _set_node_info(struct mountgroup *mg, int nodeid,
-			  struct gfsc_node *node)
-{
-	struct mg_member *memb;
-	int is_member = 0, is_gone = 0;
-
-	list_for_each_entry(memb, &mg->members, list) {
-		if (memb->nodeid != nodeid)
-			continue;
-		is_member = 1;
-		goto found;
-	}
-	list_for_each_entry(memb, &mg->members_gone, list) {
-		if (memb->nodeid != nodeid)
-			continue;
-		is_gone = 1;
-		break;
-	}
-	if (!is_member && !is_gone)
-		goto out;
- found:
-	node->nodeid = nodeid;
-
-	if (is_member)
-		node->flags |= GFSC_NF_MEMBER;
-	if (memb->spectator)
-		node->flags |= GFSC_NF_SPECTATOR;
-	if (memb->readonly)
-		node->flags |= GFSC_NF_READONLY;
-	if (memb->ms_kernel_mount_done)
-		node->flags |= GFSC_NF_KERNEL_MOUNT_DONE;
-	if (memb->ms_kernel_mount_error)
-		node->flags |= GFSC_NF_KERNEL_MOUNT_ERROR;
-
-	node->jid = memb->jid;
-
-	if (is_gone && memb->gone_type == GROUP_NODE_FAILED)
-		node->failed_reason = 1;
- out:
-	return 0;
-}
-
-int set_node_info_group(struct mountgroup *mg, int nodeid,
-			struct gfsc_node *node)
-{
-	return _set_node_info(mg, nodeid, node);
-}
-
-int set_mountgroups_group(int *count, struct gfsc_mountgroup **mgs_out)
-{
-	struct mountgroup *mg;
-	struct gfsc_mountgroup *mgs, *mgp;
-	int mg_count = 0;
-
-	list_for_each_entry(mg, &mountgroups, list)
-		mg_count++;
-
-	mgs = malloc(mg_count * sizeof(struct gfsc_mountgroup));
-	if (!mgs)
-		return -ENOMEM;
-	memset(mgs, 0, mg_count * sizeof(struct gfsc_mountgroup));
-
-	mgp = mgs;
-	list_for_each_entry(mg, &mountgroups, list) {
-		set_mountgroup_info(mg, mgp++);
-	}
-
-	*count = mg_count;
-	*mgs_out = mgs;
-	return 0;
-}
-
-int list_count(struct list_head *head)
-{
-	struct list_head *tmp;
-	int count = 0;
-
-	list_for_each(tmp, head)
-		count++;
-	return count;
-}
-
-int set_mountgroup_nodes_group(struct mountgroup *mg, int option,
-			       int *node_count, struct gfsc_node **nodes_out)
-{
-	struct gfsc_node *nodes = NULL, *nodep;
-	struct mg_member *memb;
-	int count = 0;
-
-	if (option == GFSC_NODES_ALL) {
-		count = mg->memb_count + list_count(&mg->members_gone);
-	} else if (option == GFSC_NODES_MEMBERS) {
-		count = mg->memb_count;
-	} else
-		goto out;
-
-	nodes = malloc(count * sizeof(struct gfsc_node));
-	if (!nodes)
-		return -ENOMEM;
-	memset(nodes, 0, count * sizeof(struct gfsc_node));
-	nodep = nodes;
-
-	list_for_each_entry(memb, &mg->members, list)
-		_set_node_info(mg, memb->nodeid, nodep++);
-
-	if (option == GFSC_NODES_ALL) {
-		list_for_each_entry(memb, &mg->members_gone, list)
-			_set_node_info(mg, memb->nodeid, nodep++);
-	}
- out:
-	*node_count = count;
-	*nodes_out = nodes;
-	return 0;
-}
-
-int set_group_mode(void)
-{
-	int i = 0, rv, version, limit;
-
-	while (1) {
-		rv = group_get_version(&version);
-
-		if (rv || version < 0) {
-			/* we expect to get version of -EAGAIN while groupd
-			   is detecting the mode of everyone; don't retry
-			   as long if we're not getting anything back from
-			   groupd */
-
-			log_debug("set_group_mode get_version %d ver %d",
-				  rv, version);
-
-			limit = (version == -EAGAIN) ? 30 : 5;
-
-			if (i++ > limit) {
-				log_error("cannot get groupd compatibility "
-					  "mode rv %d ver %d", rv, version);
-				return -1;
-			}
-			sleep(1);
-			continue;
-		}
-
-
-		if (version == GROUP_LIBGROUP) {
-			group_mode = GROUP_LIBGROUP;
-			return 0;
-		} else if (version == GROUP_LIBCPG) {
-			group_mode = GROUP_LIBCPG;
-			return 0;
-		} else {
-			log_error("set_group_mode invalid ver %d", version);
-			return -1;
-		}
-	}
-}
-
diff --git a/group/gfs_controld/logging.c b/group/gfs_controld/logging.c
deleted file mode 100644
index 2c44b5c..0000000
--- a/group/gfs_controld/logging.c
+++ /dev/null
@@ -1,61 +0,0 @@
-#include "gfs_daemon.h"
-#include "config.h"
-#include "ccs.h"
-
-extern int ccs_handle;
-
-#define DAEMON_NAME "gfs_controld"
-#define DEFAULT_LOG_MODE LOG_MODE_OUTPUT_FILE|LOG_MODE_OUTPUT_SYSLOG
-#define DEFAULT_SYSLOG_FACILITY		SYSLOGFACILITY
-#define DEFAULT_SYSLOG_PRIORITY		SYSLOGLEVEL
-#define DEFAULT_LOGFILE_PRIORITY	LOG_INFO /* ? */
-#define DEFAULT_LOGFILE			LOGDIR "/" DAEMON_NAME ".log"
-
-static int log_mode;
-static int syslog_facility;
-static int syslog_priority;
-static int logfile_priority;
-static char logfile[PATH_MAX];
-
-void init_logging(void)
-{
-	log_mode = DEFAULT_LOG_MODE;
-	syslog_facility = DEFAULT_SYSLOG_FACILITY;
-	syslog_priority = DEFAULT_SYSLOG_PRIORITY;
-	logfile_priority = DEFAULT_LOGFILE_PRIORITY;
-	strcpy(logfile, DEFAULT_LOGFILE);
-
-	/* logfile_priority is the only one of these options that
-	   can be controlled from command line or environment variable */
-
-	if (cfgd_debug_logfile)
-		logfile_priority = LOG_DEBUG;
-
-	log_debug("logging mode %d syslog f %d p %d logfile p %d %s",
-		  log_mode, syslog_facility, syslog_priority,
-		  logfile_priority, logfile);
-
-	logt_init(DAEMON_NAME, log_mode, syslog_facility, syslog_priority,
-		  logfile_priority, logfile);
-}
-
-void setup_logging(void)
-{
-	ccs_read_logging(ccs_handle, DAEMON_NAME,
-			 &cfgd_debug_logfile, &log_mode,
-			 &syslog_facility, &syslog_priority,
-			 &logfile_priority, logfile);
-
-	log_debug("logging mode %d syslog f %d p %d logfile p %d %s",
-		  log_mode, syslog_facility, syslog_priority,
-		  logfile_priority, logfile);
-
-	logt_conf(DAEMON_NAME, log_mode, syslog_facility, syslog_priority,
-		  logfile_priority, logfile);
-}
-
-void close_logging(void)
-{
-	logt_exit();
-}
-
diff --git a/group/gfs_controld/main.c b/group/gfs_controld/main.c
deleted file mode 100644
index 457a5d6..0000000
--- a/group/gfs_controld/main.c
+++ /dev/null
@@ -1,1583 +0,0 @@
-#include "gfs_daemon.h"
-#include "config.h"
-#include <pthread.h>
-#include "copyright.cf"
-
-#include <linux/netlink.h>
-
-#define LOCKFILE_NAME	"/var/run/gfs_controld.pid"
-#define CLIENT_NALLOC   32
-#define UEVENT_BUF_SIZE 4096
-
-static int client_maxi;
-static int client_size;
-static struct client *client;
-static struct pollfd *pollfd;
-static pthread_t query_thread;
-static pthread_mutex_t query_mutex;
-
-struct client {
-	int fd;
-	void *workfn;
-	void *deadfn;
-	struct mountgroup *mg;
-};
-
-static void do_withdraw(char *name);
-
-int do_read(int fd, void *buf, size_t count)
-{
-	int rv, off = 0;
-
-	while (off < count) {
-		rv = read(fd, buf + off, count - off);
-		if (rv == 0)
-			return -1;
-		if (rv == -1 && errno == EINTR)
-			continue;
-		if (rv == -1)
-			return -1;
-		off += rv;
-	}
-	return 0;
-}
-
-int do_write(int fd, void *buf, size_t count)
-{
-	int rv, off = 0;
-
- retry:
-	rv = write(fd, buf + off, count);
-	if (rv == -1 && errno == EINTR)
-		goto retry;
-	if (rv < 0) {
-		log_error("write errno %d", errno);
-		return rv;
-	}
-
-	if (rv != count) {
-		count -= rv;
-		off += rv;
-		goto retry;
-	}
-	return 0;
-}
-
-static void client_alloc(void)
-{
-	int i;
-
-	if (!client) {
-		client = malloc(CLIENT_NALLOC * sizeof(struct client));
-		pollfd = malloc(CLIENT_NALLOC * sizeof(struct pollfd));
-	} else {
-		client = realloc(client, (client_size + CLIENT_NALLOC) *
-					 sizeof(struct client));
-		pollfd = realloc(pollfd, (client_size + CLIENT_NALLOC) *
-					 sizeof(struct pollfd));
-		if (!pollfd)
-			log_error("can't alloc for pollfd");
-	}
-	if (!client || !pollfd)
-		log_error("can't alloc for client array");
-
-	for (i = client_size; i < client_size + CLIENT_NALLOC; i++) {
-		client[i].workfn = NULL;
-		client[i].deadfn = NULL;
-		client[i].fd = -1;
-		pollfd[i].fd = -1;
-		pollfd[i].revents = 0;
-	}
-	client_size += CLIENT_NALLOC;
-}
-
-void client_dead(int ci)
-{
-	close(client[ci].fd);
-	client[ci].workfn = NULL;
-	client[ci].fd = -1;
-	pollfd[ci].fd = -1;
-}
-
-int client_add(int fd, void (*workfn)(int ci), void (*deadfn)(int ci))
-{
-	int i;
-
-	if (!client)
-		client_alloc();
- again:
-	for (i = 0; i < client_size; i++) {
-		if (client[i].fd == -1) {
-			client[i].workfn = workfn;
-			if (deadfn)
-				client[i].deadfn = deadfn;
-			else
-				client[i].deadfn = client_dead;
-			client[i].fd = fd;
-			pollfd[i].fd = fd;
-			pollfd[i].events = POLLIN;
-			if (i > client_maxi)
-				client_maxi = i;
-			return i;
-		}
-	}
-
-	client_alloc();
-	goto again;
-}
-
-int client_fd(int ci)
-{
-	return client[ci].fd;
-}
-
-void client_ignore(int ci, int fd)
-{
-	pollfd[ci].fd = -1;
-	pollfd[ci].events = 0;
-}
-
-void client_back(int ci, int fd)
-{
-	pollfd[ci].fd = fd;
-	pollfd[ci].events = POLLIN;
-}
-
-static void sigterm_handler(int sig)
-{
-	daemon_quit = 1;
-}
-
-struct mountgroup *create_mg(char *name)
-{
-	struct mountgroup *mg;
-
-	mg = malloc(sizeof(struct mountgroup));
-	if (!mg)
-		return NULL;
-	memset(mg, 0, sizeof(struct mountgroup));
-
-	if (group_mode == GROUP_LIBGROUP)
-		mg->old_group_mode = 1;
-
-	INIT_LIST_HEAD(&mg->members);
-	INIT_LIST_HEAD(&mg->members_gone);
-	INIT_LIST_HEAD(&mg->plock_resources);
-	INIT_LIST_HEAD(&mg->saved_messages);
-	INIT_LIST_HEAD(&mg->changes);
-	INIT_LIST_HEAD(&mg->journals);
-	INIT_LIST_HEAD(&mg->node_history);
-	mg->init = 1;
-	mg->master_nodeid = -1;
-	mg->low_nodeid = -1;
-
-	strncpy(mg->name, name, GFS_MOUNTGROUP_LEN);
-
-	return mg;
-}
-
-struct mountgroup *find_mg(char *name)
-{
-	struct mountgroup *mg;
-
-	list_for_each_entry(mg, &mountgroups, list) {
-		if ((strlen(mg->name) == strlen(name)) &&
-		    !strncmp(mg->name, name, strlen(name)))
-			return mg;
-	}
-	return NULL;
-}
-
-struct mountgroup *find_mg_id(uint32_t id)
-{
-	struct mountgroup *mg;
-
-	list_for_each_entry(mg, &mountgroups, list) {
-		if (mg->id == id)
-			return mg;
-	}
-	return NULL;
-}
-
-static void ping_kernel_mount(char *name)
-{
-	struct mountgroup *mg;
-	int rv, val;
-
-	mg = find_mg(name);
-	if (!mg)
-		return;
-
-	rv = read_sysfs_int(mg, "block", &val);
-
-	log_group(mg, "ping_kernel_mount %d", rv);
-}
-
-enum {
-	Env_ACTION = 0,
-	Env_SUBSYSTEM,
-	Env_LOCKPROTO,
-	Env_LOCKTABLE,
-	Env_DEVPATH,
-	Env_RECOVERY,
-	Env_FIRSTMOUNT,
-	Env_JID,
-	Env_Last, /* Flag for end of vars */
-};
-
-static const char *uevent_vars[] = {
-	[Env_ACTION]		= "ACTION=",
-	[Env_SUBSYSTEM]		= "SUBSYSTEM=",
-	[Env_LOCKPROTO]		= "LOCKPROTO=",
-	[Env_LOCKTABLE]		= "LOCKTABLE=",
-	[Env_DEVPATH]		= "DEVPATH=",
-	[Env_RECOVERY]		= "RECOVERY=",
-	[Env_FIRSTMOUNT]	= "FIRSTMOUNT=",
-	[Env_JID]		= "JID=",
-};
-
-/*
- * Parses a uevent message for the interesting bits. It requires a list
- * of variables to look for, and an equally long list of pointers into
- * which to write the results.
- */
-static void decode_uevent(const char *buf, unsigned len, const char *vars[],
-			  unsigned nvars, const char *vals[])
-{
-	const char *ptr;
-	unsigned int i;
-	int slen, vlen;
-
-	memset(vals, 0, sizeof(const char *) * nvars);
-
-	while (len > 0) {
-		ptr = buf;
-		slen = strlen(ptr);
-		buf += slen;
-		len -= slen;
-		buf++;
-		len--;
-
-		for (i = 0; i < nvars; i++) {
-			vlen = strlen(vars[i]);
-			if (vlen > slen)
-				continue;
-			if (memcmp(vars[i], ptr, vlen) != 0)
-				continue;
-			vals[i] = ptr + vlen;
-			break;
-		}
-	}
-}
-
-static char *uevent_fsname(const char *vars[])
-{
-	char *name = NULL;
-
-	if (vars[Env_LOCKTABLE])
-		name = strchr(vars[Env_LOCKTABLE], ':');
-
-	/* When all kernels are converted, we can dispose with the following
-	 * grotty bit. This is for backward compatibility only.
-	 */
-	if (!name && vars[Env_DEVPATH]) {
-		name = strchr(vars[Env_DEVPATH], ':');
-		if (name) {
-			char *end = strstr(name, "/lock_module");
-			if (end)
-				*end = 0;
-		}
-	}
-	return (name && name[0]) ? name + 1 : NULL;
-}
-
-static void process_uevent(int ci)
-{
-	char buf[UEVENT_BUF_SIZE];
-	const char *uevent_vals[Env_Last];
-	char *fsname;
-	int rv;
-
- retry_recv:
-	rv = recv(client[ci].fd, &buf, sizeof(buf), 0);
-	if (rv < 0) {
-		if (errno == EINTR)
-			goto retry_recv;
-		if (errno != EAGAIN)
-			log_error("uevent recv error %d errno %d", rv, errno);
-		return;
-	}
-	buf[rv] = 0;
-
-	decode_uevent(buf, rv, uevent_vars, Env_Last, uevent_vals);
-
-	if (!uevent_vals[Env_DEVPATH] ||
-	    !uevent_vals[Env_ACTION] ||
-	    !uevent_vals[Env_SUBSYSTEM])
-		return;
-
-	if (!strstr(uevent_vals[Env_DEVPATH], "/fs/gfs"))
-		return;
-
-	log_debug("uevent %s %s %s",
-		  uevent_vals[Env_ACTION],
-		  uevent_vals[Env_SUBSYSTEM],
-		  uevent_vals[Env_DEVPATH]);
-
-	fsname = uevent_fsname(uevent_vals);
-	if (!fsname) {
-		log_error("no fsname uevent %s %s %s",
-		  	  uevent_vals[Env_ACTION],
-		  	  uevent_vals[Env_SUBSYSTEM],
-		  	  uevent_vals[Env_DEVPATH]);
-		return;
-	}
-
-	if (!strcmp(uevent_vals[Env_ACTION], "remove")) {
-		/* We want to trigger the leave at the very end of the kernel's
-		   unmount process, i.e. at the end of put_super(), so we do the
-		   leave when the second uevent (from the gfs kobj) arrives. */
-
-		if (strcmp(uevent_vals[Env_SUBSYSTEM], "lock_dlm") == 0)
-			return;
-		if (group_mode == GROUP_LIBGROUP)
-			do_leave_old(fsname, 0);
-		else
-			do_leave(fsname, 0);
-
-	} else if (!strcmp(uevent_vals[Env_ACTION], "change")) {
-		int jid, status = -1, first = -1;
-
-		if (!uevent_vals[Env_JID] ||
-		    (sscanf(uevent_vals[Env_JID], "%d", &jid) != 1))
-			jid = -1;
-
-		if (uevent_vals[Env_RECOVERY]) {
-			if (strcmp(uevent_vals[Env_RECOVERY], "Done") == 0)
-				status = LM_RD_SUCCESS;
-			if (strcmp(uevent_vals[Env_RECOVERY], "Failed") == 0)
-				status = LM_RD_GAVEUP;
-		}
-
-		if (uevent_vals[Env_FIRSTMOUNT] &&
-		    (strcmp(uevent_vals[Env_FIRSTMOUNT], "Done") == 0))
-			first = 1;
-
-		if (group_mode == GROUP_LIBGROUP)
-			process_recovery_uevent_old(fsname, jid, status, first);
-		else
-			process_recovery_uevent(fsname, jid, status, first);
-
-	} else if (!strcmp(uevent_vals[Env_ACTION], "offline")) {
-		do_withdraw(fsname);
-	} else {
-		ping_kernel_mount(fsname);
-	}
-}
-
-static int setup_uevent(void)
-{
-	struct sockaddr_nl snl;
-	int s, rv;
-
-	s = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT);
-	if (s < 0) {
-		log_error("uevent netlink socket");
-		return s;
-	}
-
-	memset(&snl, 0, sizeof(snl));
-	snl.nl_family = AF_NETLINK;
-	snl.nl_pid = getpid();
-	snl.nl_groups = 1;
-
-	rv = bind(s, (struct sockaddr *) &snl, sizeof(snl));
-	if (rv < 0) {
-		log_error("uevent bind error %d errno %d", rv, errno);
-		close(s);
-		return rv;
-	}
-
-	return s;
-}
-
-static void init_header(struct gfsc_header *h, int cmd, char *name, int result,
-			int extra_len)
-{
-	memset(h, 0, sizeof(struct gfsc_header));
-
-	h->magic = GFSC_MAGIC;
-	h->version = GFSC_VERSION;
-	h->len = sizeof(struct gfsc_header) + extra_len;
-	h->command = cmd;
-	h->data = result;
-
-	if (name)
-		strncpy(h->name, name, GFS_MOUNTGROUP_LEN);
-}
-
-static void query_dump_debug(int fd)
-{
-	struct gfsc_header h;
-	int extra_len;
-	int len;
-
-	/* in the case of dump_wrap, extra_len will go in two writes,
-	   first the log tail, then the log head */
-	if (dump_wrap)
-		extra_len = GFSC_DUMP_SIZE;
-	else
-		extra_len = dump_point;
-
-	init_header(&h, GFSC_CMD_DUMP_DEBUG, NULL, 0, extra_len);
-	do_write(fd, &h, sizeof(h));
-
-	if (dump_wrap) {
-		len = GFSC_DUMP_SIZE - dump_point;
-		do_write(fd, dump_buf + dump_point, len);
-		len = dump_point;
-	} else
-		len = dump_point;
-
-	/* NUL terminate the debug string */
-	dump_buf[dump_point] = '\0';
-
-	do_write(fd, dump_buf, len);
-}
-
-static void query_dump_plocks(int fd, char *name)
-{
-	struct mountgroup *mg;
-	struct gfsc_header h;
-	int rv;
-
-	mg = find_mg(name);
-	if (!mg) {
-		plock_dump_len = 0;
-		rv = -ENOENT;
-	} else {
-		/* writes to plock_dump_buf and sets plock_dump_len */
-		rv = fill_plock_dump_buf(mg);
-	}
-
-	init_header(&h, GFSC_CMD_DUMP_PLOCKS, name, rv, plock_dump_len);
-
-	do_write(fd, &h, sizeof(h));
-
-	if (plock_dump_len)
-		do_write(fd, plock_dump_buf, plock_dump_len);
-}
-
-/* combines a header and the data and sends it back to the client in
-   a single do_write() call */
-
-static void do_reply(int fd, int cmd, char *name, int result, void *buf,
-		     int buflen)
-{
-	char *reply;
-	int reply_len;
-
-	reply_len = sizeof(struct gfsc_header) + buflen;
-	reply = malloc(reply_len);
-	if (!reply)
-		return;
-	memset(reply, 0, reply_len);
-
-	init_header((struct gfsc_header *)reply, cmd, name, result, buflen);
-
-	if (buf && buflen)
-		memcpy(reply + sizeof(struct gfsc_header), buf, buflen);
-
-	do_write(fd, reply, reply_len);
-
-	free(reply);
-}
-
-static void query_mountgroup_info(int fd, char *name)
-{
-	struct mountgroup *mg;
-	struct gfsc_mountgroup mountgroup;
-	int rv;
-
-	mg = find_mg(name);
-	if (!mg) {
-		rv = -ENOENT;
-		goto out;
-	}
-
-	memset(&mountgroup, 0, sizeof(mountgroup));
-	mountgroup.group_mode = group_mode;
-
-	if (group_mode == GROUP_LIBGROUP)
-		rv = set_mountgroup_info_group(mg, &mountgroup);
-	else
-		rv = set_mountgroup_info(mg, &mountgroup);
- out:
-	do_reply(fd, GFSC_CMD_MOUNTGROUP_INFO, name, rv,
-		 (char *)&mountgroup, sizeof(mountgroup));
-}
-
-static void query_node_info(int fd, char *name, int nodeid)
-{
-	struct mountgroup *mg;
-	struct gfsc_node node;
-	int rv;
-
-	mg = find_mg(name);
-	if (!mg) {
-		rv = -ENOENT;
-		goto out;
-	}
-
-	if (group_mode == GROUP_LIBGROUP)
-		rv = set_node_info_group(mg, nodeid, &node);
-	else
-		rv = set_node_info(mg, nodeid, &node);
- out:
-	do_reply(fd, GFSC_CMD_NODE_INFO, name, rv,
-		 (char *)&node, sizeof(node));
-}
-
-static void query_mountgroups(int fd, int max)
-{
-	int mg_count = 0;
-	struct gfsc_mountgroup *mgs = NULL;
-	int rv, result;
-
-	if (group_mode == GROUP_LIBGROUP)
-		rv = set_mountgroups_group(&mg_count, &mgs);
-	else
-		rv = set_mountgroups(&mg_count, &mgs);
-
-	if (rv < 0) {
-		result = rv;
-		mg_count = 0;
-		goto out;
-	}
-
-	if (mg_count > max) {
-		result = -E2BIG;
-		mg_count = max;
-	} else {
-		result = mg_count;
-	}
- out:
-	do_reply(fd, GFSC_CMD_MOUNTGROUPS, NULL, result,
-		 (char *)mgs, mg_count * sizeof(struct gfsc_mountgroup));
-
-	if (mgs)
-		free(mgs);
-}
-
-static void query_mountgroup_nodes(int fd, char *name, int option, int max)
-{
-	struct mountgroup *mg;
-	int node_count = 0;
-	struct gfsc_node *nodes = NULL;
-	int rv, result;
-
-	mg = find_mg(name);
-	if (!mg) {
-		result = -ENOENT;
-		node_count = 0;
-		goto out;
-	}
-
-	if (group_mode == GROUP_LIBGROUP)
-		rv = set_mountgroup_nodes_group(mg, option, &node_count, &nodes);
-	else
-		rv = set_mountgroup_nodes(mg, option, &node_count, &nodes);
-
-	if (rv < 0) {
-		result = rv;
-		node_count = 0;
-		goto out;
-	}
-
-	/* node_count is the number of structs copied/returned; the caller's
-	   max may be less than that, in which case we copy as many as they
-	   asked for and return -E2BIG */
-
-	if (node_count > max) {
-		result = -E2BIG;
-		node_count = max;
-	} else {
-		result = node_count;
-	}
- out:
-	do_reply(fd, GFSC_CMD_MOUNTGROUP_NODES, name, result,
-		 (char *)nodes, node_count * sizeof(struct gfsc_node));
-
-	if (nodes)
-		free(nodes);
-}
-
-void client_reply_join(int ci, struct gfsc_mount_args *ma, int result)
-{
-	char *name = strstr(ma->table, ":") + 1;
-
-	log_debug("client_reply_join %s ci %d result %d", name, ci, result);
-
-	do_reply(client[ci].fd, GFSC_CMD_FS_JOIN,
-		 name, result, ma, sizeof(struct gfsc_mount_args));
-}
-
-void client_reply_join_full(struct mountgroup *mg, int result)
-{
-	char nodir_str[32];
-
-	if (result)
-		goto out;
-
-	if (mg->our_jid < 0) {
-		snprintf(mg->mount_args.hostdata, PATH_MAX,
-			 "hostdata=id=%u:first=%d",
-			 mg->id, mg->first_mounter);
-	} else {
-		snprintf(mg->mount_args.hostdata, PATH_MAX,
-			 "hostdata=jid=%d:id=%u:first=%d",
-			 mg->our_jid, mg->id, mg->first_mounter);
-	}
-
-	memset(nodir_str, 0, sizeof(nodir_str));
-
-	read_ccs_nodir(mg, nodir_str);
-	if (nodir_str[0])
-		strcat(mg->mount_args.hostdata, nodir_str);
- out:
-	log_group(mg, "client_reply_join_full ci %d result %d %s",
-		  mg->mount_client, result, mg->mount_args.hostdata);
-
-	client_reply_join(mg->mount_client, &mg->mount_args, result);
-}
-
-static void do_join(int ci, struct gfsc_mount_args *ma)
-{
-	struct mountgroup *mg = NULL;
-	char table2[PATH_MAX];
-	char *cluster = NULL, *name = NULL;
-	int rv;
-
-	log_debug("join: %s %s %s %s %s %s", ma->dir, ma->type, ma->proto,
-		  ma->table, ma->options, ma->dev);
-
-	if (strcmp(ma->proto, "lock_dlm")) {
-		log_error("join: lockproto %s not supported", ma->proto);
-		rv = -EPROTONOSUPPORT;
-		goto fail;
-	}
-
-	if (strstr(ma->options, "jid=") ||
-	    strstr(ma->options, "first=") ||
-	    strstr(ma->options, "id=")) {
-		log_error("join: jid, first and id are reserved options");
-		rv = -EOPNOTSUPP;
-		goto fail;
-	}
-
-	/* table is <cluster>:<name> */
-
-	memset(table2, 0, sizeof(table2));
-	strncpy(table2, ma->table, sizeof(table2));
-
-	name = strstr(table2, ":");
-	if (!name) {
-		rv = -EBADFD;
-		goto fail;
-	}
-
-	*name = '\0';
-	name++;
-	cluster = table2;
-
-	if (strlen(name) > GFS_MOUNTGROUP_LEN) {
-		rv = -ENAMETOOLONG;
-		goto fail;
-	}
-
-	mg = find_mg(name);
-	if (mg) {
-		if (strcmp(mg->mount_args.dev, ma->dev)) {
-			log_error("different fs dev %s with same name",
-				  mg->mount_args.dev);
-			rv = -EADDRINUSE;
-		} else if (mg->leaving) {
-			/* we're leaving the group */
-			log_error("join: reject mount due to unmount");
-			rv = -ESTALE;
-		} else if (mg->mount_client || !mg->kernel_mount_done) {
-			log_error("join: other mount in progress %d %d",
-				  mg->mount_client, mg->kernel_mount_done);
-			rv = -EBUSY;
-		} else {
-			log_group(mg, "join: already mounted");
-			rv = -EALREADY;
-		}
-		goto fail;
-	}
-
-	mg = create_mg(name);
-	if (!mg) {
-		rv = -ENOMEM;
-		goto fail;
-	}
-	mg->mount_client = ci;
-	memcpy(&mg->mount_args, ma, sizeof(struct gfsc_mount_args));
-
-	if (strlen(cluster) != strlen(clustername) ||
-	    strlen(cluster) == 0 || strcmp(cluster, clustername)) {
-		log_error("join: fs requires cluster=\"%s\" current=\"%s\"",
-			  cluster, clustername);
-		rv = -EBADR;
-		goto fail_free;
-	}
-	log_group(mg, "join: cluster name matches: %s", clustername);
-
-	if (strstr(ma->options, "spectator")) {
-		log_group(mg, "join: spectator mount");
-		mg->spectator = 1;
-	} else {
-		if (!we_are_in_fence_domain()) {
-			log_error("join: not in default fence domain");
-			rv = -ENOANO;
-			goto fail_free;
-		}
-	}
-
-	if (!mg->spectator && strstr(ma->options, "rw"))
-		mg->rw = 1;
-	else if (strstr(ma->options, "ro")) {
-		if (mg->spectator) {
-			log_error("join: readonly invalid with spectator");
-			rv = -EROFS;
-			goto fail_free;
-		}
-		mg->ro = 1;
-	}
-
-	list_add(&mg->list, &mountgroups);
-
-	if (group_mode == GROUP_LIBGROUP)
-		rv = gfs_join_mountgroup_old(mg, ma);
-	else
-		rv = gfs_join_mountgroup(mg);
-
-	if (rv) {
-		log_error("join: group join error %d", rv);
-		list_del(&mg->list);
-		goto fail_free;
-	}
-	return;
-
- fail_free:
-	free(mg);
- fail:
-	client_reply_join(ci, ma, rv);
-}
-
-/* The basic rule of withdraw is that we don't want to tell the kernel to drop
-   all locks until we know gfs has been stopped/blocked on all nodes.
-   A withdrawing node is very much like a readonly node, differences are
-   that others recover its journal when they remove it from the group,
-   and when it's been removed from the group, it tells the locally withdrawing
-   gfs to clear out locks. */
-
-static void do_withdraw(char *name)
-{
-	struct mountgroup *mg;
-	int rv;
-
-	log_debug("withdraw: %s", name);
-
-	if (!cfgd_enable_withdraw) {
-		log_error("withdraw feature not enabled");
-		return;
-	}
-
-	mg = find_mg(name);
-	if (!mg) {
-		log_error("do_withdraw no mountgroup %s", name);
-		return;
-	}
-
-	mg->withdraw_uevent = 1;
-
-	rv = run_dmsetup_suspend(mg, mg->mount_args.dev);
-	if (rv) {
-		log_error("do_withdraw %s: dmsetup %s error %d", mg->name,
-			  mg->mount_args.dev, rv);
-		return;
-	}
-
-	dmsetup_wait = 1;
-}
-
-static void do_mount_done(char *table, int result)
-{
-	struct mountgroup *mg;
-	char *name = strstr(table, ":") + 1;
-
-	log_debug("mount_done: %s result %d", name, result);
-
-	mg = find_mg(name);
-	if (!mg) {
-		log_error("mount_done: %s not found", name);
-		return;
-	}
-
-	mg->mount_client = 0;
-	mg->kernel_mount_done = 1;
-	mg->kernel_mount_error = result;
-
-	if (group_mode == GROUP_LIBGROUP)
-		send_mount_status_old(mg);
-	else
-		gfs_mount_done(mg);
-}
-
-void client_reply_remount(struct mountgroup *mg, int ci, int result)
-{
-	do_reply(client[ci].fd, GFSC_CMD_FS_REMOUNT, mg->name, result,
-		 &mg->mount_args, sizeof(struct gfsc_mount_args));
-}
-
-/* mount.gfs creates a special ma->options string with only "ro" or "rw" */
-
-static void do_remount(int ci, struct gfsc_mount_args *ma)
-{
-	struct mountgroup *mg;
-	char *name = strstr(ma->table, ":") + 1;
-	int ro = 0, result = 0;
-
-	log_debug("remount: %s ci %d options %s", name, ci, ma->options);
-
-	mg = find_mg(name);
-	if (!mg) {
-		log_error("remount: %s not found", name);
-		result = -1;
-		goto out;
-	}
-
-	if (mg->spectator) {
-		log_error("remount of spectator not allowed");
-		result = -1;
-		goto out;
-	}
-
-	if (!strcmp(ma->options, "ro"))
-		ro = 1;
-
-	if ((mg->ro && ro) || (!mg->ro && !ro))
-		goto out;
-
-	if (group_mode == GROUP_LIBGROUP) {
-		/* the receive calls client_reply_remount */
-		mg->remount_client = ci;
-		send_remount_old(mg, ma);
-		return;
-	}
-
-	send_remount(mg, ma);
- out:
-	client_reply_remount(mg, ci, result);
-}
-
-void process_connection(int ci)
-{
-	struct gfsc_header h;
-	struct gfsc_mount_args empty;
-	struct gfsc_mount_args *ma;
-	char *extra = NULL;
-	int rv, extra_len;
-
-	rv = do_read(client[ci].fd, &h, sizeof(h));
-	if (rv < 0) {
-		log_debug("connection %d read error %d", ci, rv);
-		goto out;
-	}
-
-	if (h.magic != GFSC_MAGIC) {
-		log_debug("connection %d magic error %x", ci, h.magic);
-		goto out;
-	}
-
-	if ((h.version & 0xFFFF0000) != (GFSC_VERSION & 0xFFFF0000)) {
-		log_debug("connection %d version error %x", ci, h.version);
-		goto out;
-	}
-
-	if (h.len > sizeof(h)) {
-		extra_len = h.len - sizeof(h);
-		extra = malloc(extra_len);
-		if (!extra) {
-			log_error("process_connection no mem %d", extra_len);
-			goto out;
-		}
-		memset(extra, 0, extra_len);
-
-		rv = do_read(client[ci].fd, extra, extra_len);
-		if (rv < 0) {
-			log_debug("connection %d extra read error %d", ci, rv);
-			goto out;
-		}
-	}
-
-	ma = (struct gfsc_mount_args *)extra;
-
-	if (!ma) {
-		memset(&empty, 0, sizeof(empty));
-
-		if (h.command == GFSC_CMD_FS_JOIN ||
-		    h.command == GFSC_CMD_FS_REMOUNT) {
-			do_reply(client[ci].fd, h.command, h.name, -EINVAL,
-				 &empty, sizeof(empty));
-		}
-		log_debug("connection %d cmd %d no data", ci, h.command);
-		goto out;
-	}
-
-	switch (h.command) {
-
-	case GFSC_CMD_FS_JOIN:
-		do_join(ci, ma);
-		break;
-
-	case GFSC_CMD_FS_LEAVE:
-		if (group_mode == GROUP_LIBGROUP)
-			do_leave_old(ma->table, h.data);
-		else
-			do_leave(ma->table, h.data);
-		break;
-
-	case GFSC_CMD_FS_MOUNT_DONE:
-		do_mount_done(ma->table, h.data);
-		break;
-
-	case GFSC_CMD_FS_REMOUNT:
-		do_remount(ci, ma);
-		break;
-
-	default:
-		log_error("process_connection %d unknown command %d",
-			  ci, h.command);
-	}
- out:
-	if (extra)
-		free(extra);
-
-	/* no client_dead(ci) here, since the connection for
-	   join/remount is reused */
-}
-
-static void process_listener(int ci)
-{
-	int fd, i;
-
-	fd = accept(client[ci].fd, NULL, NULL);
-	if (fd < 0) {
-		log_error("process_listener: accept error %d %d", fd, errno);
-		return;
-	}
-
-	i = client_add(fd, process_connection, NULL);
-
-	log_debug("client connection %d fd %d", i, fd);
-}
-
-static int setup_listener(char *sock_path)
-{
-	struct sockaddr_un addr;
-	socklen_t addrlen;
-	int rv, s;
-
-	/* we listen for new client connections on socket s */
-
-	s = socket(AF_LOCAL, SOCK_STREAM, 0);
-	if (s < 0) {
-		log_error("socket error %d %d", s, errno);
-		return s;
-	}
-
-	memset(&addr, 0, sizeof(addr));
-	addr.sun_family = AF_LOCAL;
-	strcpy(&addr.sun_path[1], sock_path);
-	addrlen = sizeof(sa_family_t) + strlen(addr.sun_path+1) + 1;
-
-	rv = bind(s, (struct sockaddr *) &addr, addrlen);
-	if (rv < 0) {
-		log_error("bind error %d %d", rv, errno);
-		close(s);
-		return rv;
-	}
-
-	rv = listen(s, 5);
-	if (rv < 0) {
-		log_error("listen error %d %d", rv, errno);
-		close(s);
-		return rv;
-	}
-	return s;
-}
-
-void query_lock(void)
-{
-	pthread_mutex_lock(&query_mutex);
-}
-
-void query_unlock(void)
-{
-	pthread_mutex_unlock(&query_mutex);
-}
-
-/* This is a thread, so we have to be careful, don't call log_ functions.
-   We need a thread to process queries because the main thread may block
-   for long periods. */
-
-static void *process_queries(void *arg)
-{
-	struct gfsc_header h;
-	int f, rv, s;
-
-	rv = setup_listener(GFSC_QUERY_SOCK_PATH);
-	if (rv < 0)
-		exit (-1);
-
-	s = rv;
-
-	for (;;) {
-		f = accept(s, NULL, NULL);
-		if (f < 0)
-			exit (-1);
-
-		rv = do_read(f, &h, sizeof(h));
-		if (rv < 0) {
-			goto out;
-		}
-
-		if (h.magic != GFSC_MAGIC) {
-			goto out;
-		}
-
-		if ((h.version & 0xFFFF0000) != (GFSC_VERSION & 0xFFFF0000)) {
-			goto out;
-		}
-
-		query_lock();
-
-		switch (h.command) {
-		case GFSC_CMD_DUMP_DEBUG:
-			query_dump_debug(f);
-			break;
-		case GFSC_CMD_DUMP_PLOCKS:
-			query_dump_plocks(f, h.name);
-			break;
-		case GFSC_CMD_MOUNTGROUP_INFO:
-			query_mountgroup_info(f, h.name);
-			break;
-		case GFSC_CMD_NODE_INFO:
-			query_node_info(f, h.name, h.data);
-			break;
-		case GFSC_CMD_MOUNTGROUPS:
-			query_mountgroups(f, h.data);
-			break;
-		case GFSC_CMD_MOUNTGROUP_NODES:
-			query_mountgroup_nodes(f, h.name, h.option, h.data);
-			break;
-		default:
-			break;
-		}
-		query_unlock();
-
- out:
-		close(f);
-	}
-}
-
-static int setup_queries(void)
-{
-	int rv;
-
-	pthread_mutex_init(&query_mutex, NULL);
-
-	rv = pthread_create(&query_thread, NULL, process_queries, NULL);
-	if (rv < 0) {
-		log_error("can't create query thread");
-		return rv;
-	}
-	return 0;
-}
-
-void cluster_dead(int ci)
-{
-	if (!cluster_down)
-		log_error("cluster is down, exiting");
-	daemon_quit = 1;
-	cluster_down = 1;
-}
-
-static void dlmcontrol_dead(int ci)
-{
-	if (!list_empty(&mountgroups))
-		log_error("dlm_controld is gone");
-	client_dead(ci);
-}
-
-static void loop(void)
-{
-	int poll_timeout = -1;
-	int rv, i;
-	void (*workfn) (int ci);
-	void (*deadfn) (int ci);
-
-	rv = setup_queries();
-	if (rv < 0)
-		goto out;
-
-	rv = setup_listener(GFSC_SOCK_PATH);
-	if (rv < 0)
-		goto out;
-	client_add(rv, process_listener, NULL);
-
-	rv = setup_cman();
-	if (rv < 0)
-		goto out;
-	client_add(rv, process_cman, cluster_dead);
-
-	rv = setup_ccs();
-	if (rv < 0)
-		goto out;
-
-	setup_logging();
-
-	rv = check_uncontrolled_filesystems();
-	if (rv < 0)
-		goto out;
-
-	rv = setup_uevent();
-	if (rv < 0)
-		goto out;
-	client_add(rv, process_uevent, NULL);
-
-	group_mode = GROUP_LIBCPG;
-
-	if (cfgd_groupd_compat) {
-		rv = setup_groupd();
-		if (rv < 0)
-			goto out;
-		client_add(rv, process_groupd, cluster_dead);
-
-		switch (cfgd_groupd_compat) {
-		case 1:
-			group_mode = GROUP_LIBGROUP;
-			rv = 0;
-			break;
-		case 2:
-			rv = set_group_mode();
-			break;
-		default:
-			log_error("inval groupd_compat %d", cfgd_groupd_compat);
-			rv = -1;
-			break;
-		}
-		if (rv < 0)
-			goto out;
-	}
-	log_debug("group_mode %d compat %d", group_mode, cfgd_groupd_compat);
-
-	if (group_mode == GROUP_LIBCPG) {
-
-		/*
-		 * The new, good, way of doing things using libcpg directly.
-		 * code in: cpg-new.c
-		 */
-
-		rv = setup_cpg();
-		if (rv < 0)
-			goto out;
-		client_add(rv, process_cpg, cluster_dead);
-
-		rv = set_protocol();
-		if (rv < 0)
-			goto out;
-
-		rv = setup_dlmcontrol();
-		if (rv < 0)
-			goto out;
-		client_add(rv, process_dlmcontrol, dlmcontrol_dead);
-
-	} else if (group_mode == GROUP_LIBGROUP) {
-
-		/*
-		 * The old, bad, way of doing things using libgroup.
-		 * code in: cpg-old.c group.c plock.c
-		 */
-
-		rv = setup_cpg_old();
-		if (rv < 0)
-			goto out;
-		client_add(rv, process_cpg_old, cluster_dead);
-
-		rv = setup_misc_devices();
-		if (rv < 0)
-			goto out;
-
-		rv = setup_plocks();
-		if (rv < 0)
-			goto out;
-		plock_fd = rv;
-		plock_ci = client_add(rv, process_plocks, NULL);
-	}
-
-	for (;;) {
-		rv = poll(pollfd, client_maxi + 1, poll_timeout);
-		if (rv == -1 && errno == EINTR) {
-			if (daemon_quit && list_empty(&mountgroups))
-				goto out;
-			daemon_quit = 0;
-			continue;
-		}
-		if (rv < 0) {
-			log_error("poll errno %d", errno);
-			goto out;
-		}
-
-		query_lock();
-
-		for (i = 0; i <= client_maxi; i++) {
-			if (client[i].fd < 0)
-				continue;
-			if (pollfd[i].revents & POLLIN) {
-				workfn = client[i].workfn;
-				workfn(i);
-			}
-			if (pollfd[i].revents & (POLLERR | POLLHUP | POLLNVAL)) {
-				deadfn = client[i].deadfn;
-				deadfn(i);
-			}
-		}
-		query_unlock();
-
-		if (daemon_quit)
-			break;
-
-		query_lock();
-
-		poll_timeout = -1;
-
-		if (poll_dlm) {
-			/* only happens for GROUP_LIBCPG */
-			process_mountgroups();
-			poll_timeout = 500;
-		}
-
-		if (poll_ignore_plock) {
-			/* only happens for GROUP_LIBGROUP */
-			if (!limit_plocks()) {
-				poll_ignore_plock = 0;
-				client_back(plock_ci, plock_fd);
-			}
-			poll_timeout = 1000;
-		}
-
-		if (dmsetup_wait) {
-			update_dmsetup_wait();
-			if (dmsetup_wait) {
-				if (poll_timeout == -1)
-					poll_timeout = 1000;
-			} else {
-				if (poll_timeout == 1000)
-					poll_timeout = -1;
-			}
-		}
-		query_unlock();
-	}
- out:
-	if (group_mode == GROUP_LIBCPG)
-		close_cpg();
-	else if (group_mode == GROUP_LIBGROUP)
-		close_cpg_old();
-	if (cfgd_groupd_compat)
-		close_groupd();
-	close_logging();
-	close_ccs();
-	close_cman();
-
-	if (!list_empty(&mountgroups))
-		log_error("mountgroups abandoned");
-}
-
-static void lockfile(void)
-{
-	int fd, error;
-	struct flock lock;
-	char buf[33];
-
-	memset(buf, 0, 33);
-
-	fd = open(LOCKFILE_NAME, O_CREAT|O_WRONLY,
-		  S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
-	if (fd < 0) {
-		fprintf(stderr, "cannot open/create lock file %s\n",
-			LOCKFILE_NAME);
-		exit(EXIT_FAILURE);
-	}
-
-	lock.l_type = F_WRLCK;
-	lock.l_start = 0;
-	lock.l_whence = SEEK_SET;
-	lock.l_len = 0;
-
-	error = fcntl(fd, F_SETLK, &lock);
-	if (error) {
-		fprintf(stderr, "gfs_controld is already running\n");
-		exit(EXIT_FAILURE);
-	}
-
-	error = ftruncate(fd, 0);
-	if (error) {
-		fprintf(stderr, "cannot clear lock file %s\n", LOCKFILE_NAME);
-		exit(EXIT_FAILURE);
-	}
-
-	sprintf(buf, "%d\n", getpid());
-
-	error = write(fd, buf, strlen(buf));
-	if (error <= 0) {
-		fprintf(stderr, "cannot write lock file %s\n", LOCKFILE_NAME);
-		exit(EXIT_FAILURE);
-	}
-}
-
-static void print_usage(void)
-{
-	printf("Usage:\n");
-	printf("\n");
-	printf("gfs_controld [options]\n");
-	printf("\n");
-	printf("Options:\n");
-	printf("\n");
-	printf("  -D           Enable debugging to stderr and don't fork\n");
-	printf("  -L           Enable debugging to log file\n");
-	printf("  -g <num>     groupd compatibility mode, 0 off, 1 on, 2 detect\n");
-	printf("               0: use libcpg, no backward compat, best performance\n");
-	printf("               1: use libgroup for compat with cluster2/rhel5\n");
-	printf("               2: use groupd to detect old, or mode 1, nodes that\n"
-	       "               require compat, use libcpg if none found\n");
-	printf("               Default is %d\n", DEFAULT_GROUPD_COMPAT);
-	printf("  -w <num>     Enable (1) or disable (0) withdraw\n");
-	printf("               Default is %d\n", DEFAULT_ENABLE_WITHDRAW);
-	printf("  -p <num>     Enable (1) or disable (0) plock code\n");
-	printf("               Default is %d\n", DEFAULT_ENABLE_PLOCK);
-	printf("  -P           Enable plock debugging\n");
-
-	printf("  -l <limit>   Limit the rate of plock operations\n");
-	printf("               Default is %d, set to 0 for no limit\n", DEFAULT_PLOCK_RATE_LIMIT);
-	printf("  -o <n>       Enable (1) or disable (0) plock ownership\n");
-	printf("               Default is %d\n", DEFAULT_PLOCK_OWNERSHIP);
-	printf("  -t <ms>      plock ownership drop resources time (milliseconds)\n");
-	printf("               Default is %u\n", DEFAULT_DROP_RESOURCES_TIME);
-	printf("  -c <num>     plock ownership drop resources count\n");
-	printf("               Default is %u\n", DEFAULT_DROP_RESOURCES_COUNT);
-	printf("  -a <ms>      plock ownership drop resources age (milliseconds)\n");
-	printf("               Default is %u\n", DEFAULT_DROP_RESOURCES_AGE);
-	printf("  -h           Print this help, then exit\n");
-	printf("  -V           Print program version information, then exit\n");
-}
-
-#define OPTION_STRING "LDKg:w:f:q:d:p:Pl:o:t:c:a:hV"
-
-static void read_arguments(int argc, char **argv)
-{
-	int cont = 1;
-	int optchar;
-
-	while (cont) {
-		optchar = getopt(argc, argv, OPTION_STRING);
-
-		switch (optchar) {
-
-		case 'D':
-			daemon_debug_opt = 1;
-			break;
-
-		case 'L':
-			optd_debug_logfile = 1;
-			cfgd_debug_logfile = 1;
-			break;
-
-		case 'g':
-			optd_groupd_compat = 1;
-			cfgd_groupd_compat = atoi(optarg);
-			break;
-
-		case 'w':
-			optd_enable_withdraw = 1;
-			cfgd_enable_withdraw = atoi(optarg);
-			break;
-
-		case 'p':
-			optd_enable_plock = 1;
-			cfgd_enable_plock = atoi(optarg);
-			break;
-
-		case 'P':
-			optd_plock_debug = 1;
-			cfgd_plock_debug = 1;
-			break;
-
-		case 'l':
-			optd_plock_rate_limit = 1;
-			cfgd_plock_rate_limit = atoi(optarg);
-			break;
-
-		case 'o':
-			optd_plock_ownership = 1;
-			cfgd_plock_ownership = atoi(optarg);
-			break;
-
-		case 't':
-			optd_drop_resources_time = 1;
-			cfgd_drop_resources_time = atoi(optarg);
-			break;
-
-		case 'c':
-			optd_drop_resources_count = 1;
-			cfgd_drop_resources_count = atoi(optarg);
-			break;
-
-		case 'a':
-			optd_drop_resources_age = 1;
-			cfgd_drop_resources_age = atoi(optarg);
-			break;
-
-		case 'h':
-			print_usage();
-			exit(EXIT_SUCCESS);
-			break;
-
-		case 'V':
-			printf("gfs_controld %s (built %s %s)\n",
-				RELEASE_VERSION, __DATE__, __TIME__);
-			printf("%s\n", REDHAT_COPYRIGHT);
-			exit(EXIT_SUCCESS);
-			break;
-
-		case ':':
-		case '?':
-			fprintf(stderr, "Please use '-h' for usage.\n");
-			exit(EXIT_FAILURE);
-			break;
-
-		case EOF:
-			cont = 0;
-			break;
-
-		default:
-			fprintf(stderr, "unknown option: %c\n", optchar);
-			exit(EXIT_FAILURE);
-			break;
-		};
-	}
-
-	if (getenv("GFS_CONTROLD_DEBUG")) {
-		optd_debug_logfile = 1;
-		cfgd_debug_logfile = 1;
-	}
-}
-
-static void set_oom_adj(int val)
-{
-	FILE *fp;
-
-	fp = fopen("/proc/self/oom_adj", "w");
-	if (!fp)
-		return;
-
-	fprintf(fp, "%i", val);
-	fclose(fp);
-}
-
-static void set_scheduler(void)
-{
-	struct sched_param sched_param;
-	int rv;
-
-	rv = sched_get_priority_max(SCHED_RR);
-	if (rv != -1) {
-		sched_param.sched_priority = rv;
-		rv = sched_setscheduler(0, SCHED_RR, &sched_param);
-		if (rv == -1)
-			log_error("could not set SCHED_RR priority %d err %d",
-				   sched_param.sched_priority, errno);
-	} else {
-		log_error("could not get maximum scheduler priority err %d",
-			  errno);
-	}
-}
-
-int main(int argc, char **argv)
-{
-	INIT_LIST_HEAD(&mountgroups);
-	INIT_LIST_HEAD(&withdrawn_mounts);
-
-	read_arguments(argc, argv);
-	lockfile();
-
-	if (!daemon_debug_opt) {
-		if (daemon(0, 0) < 0) {
-			perror("daemon error");
-			exit(EXIT_FAILURE);
-		}
-	}
-	init_logging();
-	log_level(LOG_INFO, "gfs_controld %s", RELEASE_VERSION);
-	signal(SIGTERM, sigterm_handler);
-	set_scheduler();
-	set_oom_adj(-16);
-
-	loop();
-
-	return 0;
-}
-
-void daemon_dump_save(void)
-{
-	int len, i;
-
-	len = strlen(daemon_debug_buf);
-
-	for (i = 0; i < len; i++) {
-		dump_buf[dump_point++] = daemon_debug_buf[i];
-
-		if (dump_point == GFSC_DUMP_SIZE) {
-			dump_point = 0;
-			dump_wrap = 1;
-		}
-	}
-}
-
-int daemon_debug_opt;
-int daemon_quit;
-int cluster_down;
-int poll_ignore_plock;
-int poll_dlm;
-int plock_fd;
-int plock_ci;
-struct list_head mountgroups;
-int cman_quorate;
-int our_nodeid;
-char *clustername;
-char daemon_debug_buf[256];
-char dump_buf[GFSC_DUMP_SIZE];
-int dump_point;
-int dump_wrap;
-char plock_dump_buf[GFSC_DUMP_SIZE];
-int plock_dump_len;
-int dmsetup_wait;
-cpg_handle_t cpg_handle_daemon;
-int libcpg_flow_control_on;
-int group_mode;
-uint32_t plock_minor;
-uint32_t old_plock_minor;
-struct list_head withdrawn_mounts;
-
diff --git a/group/gfs_controld/member_cman.c b/group/gfs_controld/member_cman.c
deleted file mode 100644
index 2bd72d0..0000000
--- a/group/gfs_controld/member_cman.c
+++ /dev/null
@@ -1,121 +0,0 @@
-#include "gfs_daemon.h"
-#include "config.h"
-#include <libcman.h>
-
-static cman_handle_t ch;
-static cman_handle_t ch_admin;
-static cman_cluster_t cluster;
-
-void kick_node_from_cluster(int nodeid)
-{
-	if (!nodeid) {
-		log_error("telling cman to shut down cluster locally");
-		cman_shutdown(ch_admin, CMAN_SHUTDOWN_ANYWAY);
-	} else {
-		log_error("telling cman to remove nodeid %d from cluster",
-			  nodeid);
-		cman_kill_node(ch_admin, nodeid);
-	}
-}
-
-static void cman_callback(cman_handle_t h, void *private, int reason, int arg)
-{
-	switch (reason) {
-	case CMAN_REASON_TRY_SHUTDOWN:
-		if (list_empty(&mountgroups))
-			cman_replyto_shutdown(ch, 1);
-		else {
-			log_debug("no to cman shutdown");
-			cman_replyto_shutdown(ch, 0);
-		}
-		break;
-	case CMAN_REASON_CONFIG_UPDATE:
-		setup_logging();
-		setup_ccs();
-		break;
-	}
-}
-
-void process_cman(int ci)
-{
-	int rv;
-
-	rv = cman_dispatch(ch, CMAN_DISPATCH_ALL);
-	if (rv == -1 && errno == EHOSTDOWN)
-		cluster_dead(0);
-}
-
-int setup_cman(void)
-{
-	cman_node_t node;
-	int rv, fd;
-	int init = 0, active = 0;
-
- retry_init:
-	ch_admin = cman_admin_init(NULL);
-	if (!ch_admin) {
-		if (init++ < 2) {
-			sleep(1);
-			goto retry_init;
-		}
-		log_error("cman_admin_init error %d", errno);
-		return -ENOTCONN;
-	}
-
-	ch = cman_init(NULL);
-	if (!ch) {
-		log_error("cman_init error %d", errno);
-		return -ENOTCONN;
-	}
-
- retry_active:
-	rv = cman_is_active(ch);
-	if (!rv) {
-		if (active++ < 2) {
-			sleep(1);
-			goto retry_active;
-		}
-		log_error("cman_is_active error %d", errno);
-		cman_finish(ch);
-		return -ENOTCONN;
-	}
-
-	rv = cman_start_notification(ch, cman_callback);
-	if (rv < 0) {
-		log_error("cman_start_notification error %d %d", rv, errno);
-		cman_finish(ch);
-		return rv;
-	}
-
-	fd = cman_get_fd(ch);
-
-	/* FIXME: wait here for us to be a member of the cluster */
-	memset(&cluster, 0, sizeof(cluster));
-	rv = cman_get_cluster(ch, &cluster);
-	if (rv < 0) {
-		log_error("cman_get_cluster error %d %d", rv, errno);
-		cman_stop_notification(ch);
-		cman_finish(ch);
-		return rv;
-	}
-	clustername = cluster.ci_name;
-
-	memset(&node, 0, sizeof(node));
-	rv = cman_get_node(ch, CMAN_NODEID_US, &node);
-	if (rv < 0) {
-		log_error("cman_get_node error %d %d", rv, errno);
-		cman_stop_notification(ch);
-		cman_finish(ch);
-		fd = rv;
-		goto out;
-	}
-	our_nodeid = node.cn_nodeid;
- out:
-	return fd;
-}
-
-void close_cman(void)
-{
-	cman_finish(ch);
-}
-
diff --git a/group/gfs_controld/plock.c b/group/gfs_controld/plock.c
deleted file mode 100644
index ce17afe..0000000
--- a/group/gfs_controld/plock.c
+++ /dev/null
@@ -1,2361 +0,0 @@
-/* gfs_controld only handles plocks in rhel5/stable2 compat mode */
-
-#include "gfs_daemon.h"
-#include "cpg-old.h"
-#include "config.h"
-
-#include <linux/dlm_plock.h>
-
-static uint32_t plock_read_count;
-static uint32_t plock_recv_count;
-static uint32_t plock_rate_delays;
-static struct timeval plock_read_time;
-static struct timeval plock_recv_time;
-static struct timeval plock_rate_last;
-
-static int plock_device_fd = -1;
-static SaCkptHandleT ckpt_handle;
-static SaCkptCallbacksT callbacks = { 0, 0 };
-static SaVersionT version = { 'B', 1, 1 };
-static char section_buf[1024 * 1024];
-static uint32_t section_len;
-static int need_fsid_translation = 0;
-
-struct pack_plock {
-	uint64_t start;
-	uint64_t end;
-	uint64_t owner;
-	uint32_t pid;
-	uint32_t nodeid;
-	uint8_t ex;
-	uint8_t waiter;
-	uint16_t pad1;
-	uint32_t pad;
-};
-
-#define R_GOT_UNOWN 0x00000001 /* have received owner=0 message */
-
-struct resource {
-	struct list_head	list;	   /* list of resources */
-	uint64_t		number;
-	int                     owner;     /* nodeid or 0 for unowned */
-	uint32_t		flags;
-	struct timeval          last_access;
-	struct list_head	locks;	   /* one lock for each range */
-	struct list_head	waiters;
-	struct list_head        pending;   /* discovering r owner */
-};
-
-#define P_SYNCING 0x00000001 /* plock has been sent as part of sync but not
-				yet received */
-
-struct posix_lock {
-	struct list_head	list;	   /* resource locks or waiters list */
-	uint32_t		pid;
-	uint64_t		owner;
-	uint64_t		start;
-	uint64_t		end;
-	int			ex;
-	int			nodeid;
-	uint32_t		flags;
-};
-
-struct lock_waiter {
-	struct list_head	list;
-	uint32_t		flags;
-	struct dlm_plock_info	info;
-};
-
-
-static void send_own(struct mountgroup *mg, struct resource *r, int owner);
-static void save_pending_plock(struct mountgroup *mg, struct resource *r,
-			       struct dlm_plock_info *in);
-
-
-static int got_unown(struct resource *r)
-{
-	return !!(r->flags & R_GOT_UNOWN);
-}
-
-static void info_bswap_out(struct dlm_plock_info *i)
-{
-	i->version[0]	= cpu_to_le32(i->version[0]);
-	i->version[1]	= cpu_to_le32(i->version[1]);
-	i->version[2]	= cpu_to_le32(i->version[2]);
-	i->pid		= cpu_to_le32(i->pid);
-	i->nodeid	= cpu_to_le32(i->nodeid);
-	i->rv		= cpu_to_le32(i->rv);
-	i->fsid		= cpu_to_le32(i->fsid);
-	i->number	= cpu_to_le64(i->number);
-	i->start	= cpu_to_le64(i->start);
-	i->end		= cpu_to_le64(i->end);
-	i->owner	= cpu_to_le64(i->owner);
-}
-
-static void info_bswap_in(struct dlm_plock_info *i)
-{
-	i->version[0]	= le32_to_cpu(i->version[0]);
-	i->version[1]	= le32_to_cpu(i->version[1]);
-	i->version[2]	= le32_to_cpu(i->version[2]);
-	i->pid		= le32_to_cpu(i->pid);
-	i->nodeid	= le32_to_cpu(i->nodeid);
-	i->rv		= le32_to_cpu(i->rv);
-	i->fsid		= le32_to_cpu(i->fsid);
-	i->number	= le64_to_cpu(i->number);
-	i->start	= le64_to_cpu(i->start);
-	i->end		= le64_to_cpu(i->end);
-	i->owner	= le64_to_cpu(i->owner);
-}
-
-static char *op_str(int optype)
-{
-	switch (optype) {
-	case DLM_PLOCK_OP_LOCK:
-		return "LK";
-	case DLM_PLOCK_OP_UNLOCK:
-		return "UN";
-	case DLM_PLOCK_OP_GET:
-		return "GET";
-	default:
-		return "??";
-	}
-}
-
-static char *ex_str(int optype, int ex)
-{
-	if (optype == DLM_PLOCK_OP_UNLOCK || optype == DLM_PLOCK_OP_GET)
-		return "-";
-	if (ex)
-		return "WR";
-	else
-		return "RD";
-}
-
-/*
- * In kernels before 2.6.26, plocks came from gfs2's lock_dlm module.
- * Reading plocks from there as well should allow us to use cluster3
- * on old (RHEL5) kernels.  In this case, the fsid we read in plock_info
- * structs is the mountgroup id, which we need to translate to the ls id.
- */
-
-int setup_plocks(void)
-{
-	SaAisErrorT err;
-
-	plock_read_count = 0;
-	plock_recv_count = 0;
-	plock_rate_delays = 0;
-	gettimeofday(&plock_read_time, NULL);
-	gettimeofday(&plock_recv_time, NULL);
-	gettimeofday(&plock_rate_last, NULL);
-
-	err = saCkptInitialize(&ckpt_handle, &callbacks, &version);
-	if (err != SA_AIS_OK) {
-		log_error("ckpt init error %d", err);
-		cfgd_enable_plock = 0;
-
-		/* still try to open and read the control device so that we can
-		   send ENOSYS back to the kernel if it tries to do a plock */
-	}
-
-	if (plock_minor) {
-		need_fsid_translation = 1;
-		plock_device_fd = open("/dev/misc/dlm_plock", O_RDWR);
-	} else if (old_plock_minor) {
-		log_debug("setup_plocks using old lock_dlm interface");
-		need_fsid_translation = 0;
-		plock_device_fd = open("/dev/misc/lock_dlm_plock", O_RDWR);
-	}
-
-	if (plock_device_fd < 0) {
-		log_error("Failure to open plock device: %s", strerror(errno));
-		return -1;
-	}
-
-	log_debug("plocks %d", plock_device_fd);
-	log_debug("plock cpg message size: %u bytes",
-		  (unsigned int) (sizeof(struct gdlm_header) +
-				  sizeof(struct dlm_plock_info)));
-
-	return plock_device_fd;
-}
-
-/* FIXME: unify these two */
-
-static unsigned long time_diff_ms(struct timeval *begin, struct timeval *end)
-{
-	struct timeval result;
-	timersub(end, begin, &result);
-	return (result.tv_sec * 1000) + (result.tv_usec / 1000);
-}
-
-static uint64_t dt_usec(struct timeval *start, struct timeval *stop)
-{
-	uint64_t dt;
-
-	dt = stop->tv_sec - start->tv_sec;
-	dt *= 1000000;
-	dt += stop->tv_usec - start->tv_usec;
-	return dt;
-}
-
-static struct resource *search_resource(struct mountgroup *mg, uint64_t number)
-{
-	struct resource *r;
-
-	list_for_each_entry(r, &mg->plock_resources, list) {
-		if (r->number == number)
-			return r;
-	}
-	return NULL;
-}
-
-static int find_resource(struct mountgroup *mg, uint64_t number, int create,
-			 struct resource **r_out)
-{
-	struct resource *r = NULL;
-	int rv = 0;
-
-	r = search_resource(mg, number);
-	if (r)
-		goto out;
-
-	if (create == 0) {
-		rv = -ENOENT;
-		goto out;
-	}
-
-	r = malloc(sizeof(struct resource));
-	if (!r) {
-		log_error("find_resource no memory %d", errno);
-		rv = -ENOMEM;
-		goto out;
-	}
-
-	memset(r, 0, sizeof(struct resource));
-	r->number = number;
-	INIT_LIST_HEAD(&r->locks);
-	INIT_LIST_HEAD(&r->waiters);
-	INIT_LIST_HEAD(&r->pending);
-
-	if (cfgd_plock_ownership)
-		r->owner = -1;
-	else
-		r->owner = 0;
-
-	list_add_tail(&r->list, &mg->plock_resources);
- out:
-	if (r)
-		gettimeofday(&r->last_access, NULL);
-	*r_out = r;
-	return rv;
-}
-
-static void put_resource(struct resource *r)
-{
-	/* with ownership, resources are only freed via drop messages */
-	if (cfgd_plock_ownership)
-		return;
-
-	if (list_empty(&r->locks) && list_empty(&r->waiters)) {
-		list_del(&r->list);
-		free(r);
-	}
-}
-
-static inline int ranges_overlap(uint64_t start1, uint64_t end1,
-				 uint64_t start2, uint64_t end2)
-{
-	if (end1 < start2 || start1 > end2)
-		return 0;
-	return 1;
-}
-
-/**
- * overlap_type - returns a value based on the type of overlap
- * @s1 - start of new lock range
- * @e1 - end of new lock range
- * @s2 - start of existing lock range
- * @e2 - end of existing lock range
- *
- */
-
-static int overlap_type(uint64_t s1, uint64_t e1, uint64_t s2, uint64_t e2)
-{
-	int ret;
-
-	/*
-	 * ---r1---
-	 * ---r2---
-	 */
-
-	if (s1 == s2 && e1 == e2)
-		ret = 0;
-
-	/*
-	 * --r1--
-	 * ---r2---
-	 */
-
-	else if (s1 == s2 && e1 < e2)
-		ret = 1;
-
-	/*
-	 *   --r1--
-	 * ---r2---
-	 */
-
-	else if (s1 > s2 && e1 == e2)
-		ret = 1;
-
-	/*
-	 *  --r1--
-	 * ---r2---
-	 */
-
-	else if (s1 > s2 && e1 < e2)
-		ret = 2;
-
-	/*
-	 * ---r1---  or  ---r1---  or  ---r1---
-	 * --r2--	  --r2--       --r2--
-	 */
-
-	else if (s1 <= s2 && e1 >= e2)
-		ret = 3;
-
-	/*
-	 *   ---r1---
-	 * ---r2---
-	 */
-
-	else if (s1 > s2 && e1 > e2)
-		ret = 4;
-
-	/*
-	 * ---r1---
-	 *   ---r2---
-	 */
-
-	else if (s1 < s2 && e1 < e2)
-		ret = 4;
-
-	else
-		ret = -1;
-
-	return ret;
-}
-
-/* shrink the range start2:end2 by the partially overlapping start:end */
-
-static int shrink_range2(uint64_t *start2, uint64_t *end2,
-			 uint64_t start, uint64_t end)
-{
-	int error = 0;
-
-	if (*start2 < start)
-		*end2 = start - 1;
-	else if (*end2 > end)
-		*start2 =  end + 1;
-	else
-		error = -1;
-	return error;
-}
-
-static int shrink_range(struct posix_lock *po, uint64_t start, uint64_t end)
-{
-	return shrink_range2(&po->start, &po->end, start, end);
-}
-
-static int is_conflict(struct resource *r, struct dlm_plock_info *in, int get)
-{
-	struct posix_lock *po;
-
-	list_for_each_entry(po, &r->locks, list) {
-		if (po->nodeid == in->nodeid && po->owner == in->owner)
-			continue;
-		if (!ranges_overlap(po->start, po->end, in->start, in->end))
-			continue;
-
-		if (in->ex || po->ex) {
-			if (get) {
-				in->ex = po->ex;
-				in->pid = po->pid;
-				in->start = po->start;
-				in->end = po->end;
-			}
-			return 1;
-		}
-	}
-	return 0;
-}
-
-static int add_lock(struct resource *r, uint32_t nodeid, uint64_t owner,
-		    uint32_t pid, int ex, uint64_t start, uint64_t end)
-{
-	struct posix_lock *po;
-
-	po = malloc(sizeof(struct posix_lock));
-	if (!po)
-		return -ENOMEM;
-	memset(po, 0, sizeof(struct posix_lock));
-
-	po->start = start;
-	po->end = end;
-	po->nodeid = nodeid;
-	po->owner = owner;
-	po->pid = pid;
-	po->ex = ex;
-	list_add_tail(&po->list, &r->locks);
-
-	return 0;
-}
-
-/* RN within RE (and starts or ends on RE boundary)
-   1. add new lock for non-overlap area of RE, orig mode
-   2. convert RE to RN range and mode */
-
-static int lock_case1(struct posix_lock *po, struct resource *r,
-		      struct dlm_plock_info *in)
-{
-	uint64_t start2, end2;
-	int rv;
-
-	/* non-overlapping area start2:end2 */
-	start2 = po->start;
-	end2 = po->end;
-	rv = shrink_range2(&start2, &end2, in->start, in->end);
-	if (rv)
-		goto out;
-
-	po->start = in->start;
-	po->end = in->end;
-	po->ex = in->ex;
-
-	rv = add_lock(r, in->nodeid, in->owner, in->pid, !in->ex, start2, end2);
- out:
-	return rv;
-}
-
-/* RN within RE (RE overlaps RN on both sides)
-   1. add new lock for front fragment, orig mode
-   2. add new lock for back fragment, orig mode
-   3. convert RE to RN range and mode */
-
-static int lock_case2(struct posix_lock *po, struct resource *r,
-		      struct dlm_plock_info *in)
-
-{
-	int rv;
-
-	rv = add_lock(r, in->nodeid, in->owner, in->pid,
-		      !in->ex, po->start, in->start - 1);
-	if (rv)
-		goto out;
-
-	rv = add_lock(r, in->nodeid, in->owner, in->pid,
-		      !in->ex, in->end + 1, po->end);
-	if (rv)
-		goto out;
-
-	po->start = in->start;
-	po->end = in->end;
-	po->ex = in->ex;
- out:
-	return rv;
-}
-
-static int lock_internal(struct mountgroup *mg, struct resource *r,
-			 struct dlm_plock_info *in)
-{
-	struct posix_lock *po, *safe;
-	int rv = 0;
-
-	list_for_each_entry_safe(po, safe, &r->locks, list) {
-		if (po->nodeid != in->nodeid || po->owner != in->owner)
-			continue;
-		if (!ranges_overlap(po->start, po->end, in->start, in->end))
-			continue;
-
-		/* existing range (RE) overlaps new range (RN) */
-
-		switch(overlap_type(in->start, in->end, po->start, po->end)) {
-
-		case 0:
-			if (po->ex == in->ex)
-				goto out;
-
-			/* ranges the same - just update the existing lock */
-			po->ex = in->ex;
-			goto out;
-
-		case 1:
-			if (po->ex == in->ex)
-				goto out;
-
-			rv = lock_case1(po, r, in);
-			goto out;
-
-		case 2:
-			if (po->ex == in->ex)
-				goto out;
-
-			rv = lock_case2(po, r, in);
-			goto out;
-
-		case 3:
-			list_del(&po->list);
-			free(po);
-			break;
-
-		case 4:
-			if (po->start < in->start)
-				po->end = in->start - 1;
-			else
-				po->start = in->end + 1;
-			break;
-
-		default:
-			rv = -1;
-			goto out;
-		}
-	}
-
-	rv = add_lock(r, in->nodeid, in->owner, in->pid,
-		      in->ex, in->start, in->end);
- out:
-	return rv;
-
-}
-
-static int unlock_internal(struct mountgroup *mg, struct resource *r,
-			   struct dlm_plock_info *in)
-{
-	struct posix_lock *po, *safe;
-	int rv = 0;
-
-	list_for_each_entry_safe(po, safe, &r->locks, list) {
-		if (po->nodeid != in->nodeid || po->owner != in->owner)
-			continue;
-		if (!ranges_overlap(po->start, po->end, in->start, in->end))
-			continue;
-
-		/* existing range (RE) overlaps new range (RN) */
-
-		switch (overlap_type(in->start, in->end, po->start, po->end)) {
-
-		case 0:
-			/* ranges the same - just remove the existing lock */
-
-			list_del(&po->list);
-			free(po);
-			goto out;
-
-		case 1:
-			/* RN within RE and starts or ends on RE boundary -
-			 * shrink and update RE */
-
-			rv = shrink_range(po, in->start, in->end);
-			goto out;
-
-		case 2:
-			/* RN within RE - shrink and update RE to be front
-			 * fragment, and add a new lock for back fragment */
-
-			rv = add_lock(r, in->nodeid, in->owner, in->pid,
-				      po->ex, in->end + 1, po->end);
-			po->end = in->start - 1;
-			goto out;
-
-		case 3:
-			/* RE within RN - remove RE, then continue checking
-			 * because RN could cover other locks */
-
-			list_del(&po->list);
-			free(po);
-			continue;
-
-		case 4:
-			/* front of RE in RN, or end of RE in RN - shrink and
-			 * update RE, then continue because RN could cover
-			 * other locks */
-
-			rv = shrink_range(po, in->start, in->end);
-			continue;
-
-		default:
-			rv = -1;
-			goto out;
-		}
-	}
- out:
-	return rv;
-}
-
-static int add_waiter(struct mountgroup *mg, struct resource *r,
-		      struct dlm_plock_info *in)
-
-{
-	struct lock_waiter *w;
-
-	w = malloc(sizeof(struct lock_waiter));
-	if (!w)
-		return -ENOMEM;
-	memcpy(&w->info, in, sizeof(struct dlm_plock_info));
-	list_add_tail(&w->list, &r->waiters);
-	return 0;
-}
-
-static void write_result(struct mountgroup *mg, struct dlm_plock_info *in,
-			 int rv)
-{
-	if (need_fsid_translation)
-		in->fsid = mg->associated_ls_id;
-
-	in->rv = rv;
-	write(plock_device_fd, in, sizeof(struct dlm_plock_info));
-}
-
-static void do_waiters(struct mountgroup *mg, struct resource *r)
-{
-	struct lock_waiter *w, *safe;
-	struct dlm_plock_info *in;
-	int rv;
-
-	list_for_each_entry_safe(w, safe, &r->waiters, list) {
-		in = &w->info;
-
-		if (is_conflict(r, in, 0))
-			continue;
-
-		list_del(&w->list);
-
-		/*
-		log_group(mg, "take waiter %llx %llx-%llx %d/%u/%llx",
-			  in->number, in->start, in->end,
-			  in->nodeid, in->pid, in->owner);
-		*/
-
-		rv = lock_internal(mg, r, in);
-
-		if (in->nodeid == our_nodeid)
-			write_result(mg, in, rv);
-
-		free(w);
-	}
-}
-
-static void do_lock(struct mountgroup *mg, struct dlm_plock_info *in,
-		    struct resource *r)
-{
-	int rv;
-
-	if (is_conflict(r, in, 0)) {
-		if (!in->wait)
-			rv = -EAGAIN;
-		else {
-			rv = add_waiter(mg, r, in);
-			if (rv)
-				goto out;
-			rv = -EINPROGRESS;
-		}
-	} else
-		rv = lock_internal(mg, r, in);
-
- out:
-	if (in->nodeid == our_nodeid && rv != -EINPROGRESS)
-		write_result(mg, in, rv);
-
-	do_waiters(mg, r);
-	put_resource(r);
-}
-
-static void do_unlock(struct mountgroup *mg, struct dlm_plock_info *in,
-		      struct resource *r)
-{
-	int rv;
-
-	rv = unlock_internal(mg, r, in);
-
-	if (in->nodeid == our_nodeid)
-		write_result(mg, in, rv);
-
-	do_waiters(mg, r);
-	put_resource(r);
-}
-
-/* we don't even get to this function if the getlk isn't from us */
-
-static void do_get(struct mountgroup *mg, struct dlm_plock_info *in,
-		   struct resource *r)
-{
-	int rv;
-
-	if (is_conflict(r, in, 1))
-		rv = 1;
-	else
-		rv = 0;
-
-	write_result(mg, in, rv);
-}
-
-static void __receive_plock(struct mountgroup *mg, struct dlm_plock_info *in,
-			    int from, struct resource *r)
-{
-	switch (in->optype) {
-	case DLM_PLOCK_OP_LOCK:
-		mg->last_plock_time = time(NULL);
-		do_lock(mg, in, r);
-		break;
-	case DLM_PLOCK_OP_UNLOCK:
-		mg->last_plock_time = time(NULL);
-		do_unlock(mg, in, r);
-		break;
-	case DLM_PLOCK_OP_GET:
-		do_get(mg, in, r);
-		break;
-	default:
-		log_error("receive_plock from %d optype %d", from, in->optype);
-		if (from == our_nodeid)
-			write_result(mg, in, -EINVAL);
-	}
-}
-
-/* When mg members receive our options message (for our mount), one of them
-   saves all plock state received to that point in a checkpoint and then sends
-   us our journals message.  We know to retrieve the plock state from the
-   checkpoint when we receive our journals message.  Any plocks messages that
-   arrive between seeing our options message and our journals message needs to
-   be saved and processed after we synchronize our plock state from the
-   checkpoint.  Any plock message received while we're mounting but before we
-   set save_plocks (when we see our options message) can be ignored because it
-   should be reflected in the checkpointed state. */
-
-static void _receive_plock(struct mountgroup *mg, char *buf, int len, int from)
-{
-	struct dlm_plock_info info;
-	struct gdlm_header *hd = (struct gdlm_header *) buf;
-	struct resource *r = NULL;
-	struct timeval now;
-	uint64_t usec;
-	int rv, create;
-
-	memcpy(&info, buf + sizeof(struct gdlm_header), sizeof(info));
-	info_bswap_in(&info);
-
-	log_plock(mg, "receive plock %llx %s %s %llx-%llx %d/%u/%llx w %d",
-		  (unsigned long long)info.number,
-		  op_str(info.optype),
-		  ex_str(info.optype, info.ex),
-		  (unsigned long long)info.start, (unsigned long long)info.end,
-		  info.nodeid, info.pid, (unsigned long long)info.owner,
-		  info.wait);
-
-	plock_recv_count++;
-	if (!(plock_recv_count % 1000)) {
-		gettimeofday(&now, NULL);
-		usec = dt_usec(&plock_recv_time, &now);
-		log_group(mg, "plock_recv_count %u time %.3f s",
-			  plock_recv_count, usec * 1.e-6);
-		plock_recv_time = now;
-	}
-
-	if (info.optype == DLM_PLOCK_OP_GET && from != our_nodeid)
-		return;
-
-	if (from != hd->nodeid || from != info.nodeid) {
-		log_error("receive_plock from %d header %d info %d",
-			  from, hd->nodeid, info.nodeid);
-		return;
-	}
-
-	create = !cfgd_plock_ownership;
-
-	rv = find_resource(mg, info.number, create, &r);
-
-	if (rv && cfgd_plock_ownership) {
-		/* There must have been a race with a drop, so we need to
-		   ignore this plock op which will be resent.  If we're the one
-		   who sent the plock, we need to send_own() and put it on the
-		   pending list to resend once the owner is established. */
-
-		log_debug("receive_plock from %d no r %llx", from,
-			  (unsigned long long)info.number);
-
-		if (from != our_nodeid)
-			return;
-
-		rv = find_resource(mg, info.number, 1, &r);
-		if (rv)
-			return;
-		send_own(mg, r, our_nodeid);
-		save_pending_plock(mg, r, &info);
-		return;
-	}
-	if (rv) {
-		/* r not found, rv is -ENOENT, this shouldn't happen because
-		   process_plocks() creates a resource for every op */
-
-		log_error("receive_plock from %d no r %llx %d", from,
-			  (unsigned long long)info.number, rv);
-		return;
-	}
-
-	/* The owner should almost always be 0 here, but other owners may
-	   be possible given odd combinations of races with drop.  Odd races to
-	   worry about (some seem pretty improbable):
-
-	   - A sends drop, B sends plock, receive drop, receive plock.
-	   This is addressed above.
-
-	   - A sends drop, B sends plock, receive drop, B reads plock
-	   and sends own, receive plock, on B we find owner of -1.
-
-	   - A sends drop, B sends two plocks, receive drop, receive plocks.
-	   Receiving the first plock is the previous case, receiving the
-	   second plock will find r with owner of -1.
-
-	   - A sends drop, B sends two plocks, receive drop, C sends own,
-	   receive plock, B sends own, receive own (C), receive plock,
-	   receive own (B).
-
-	   Haven't tried to cook up a scenario that would lead to the
-	   last case below; receiving a plock from ourself and finding
-	   we're the owner of r. */
-
-	if (!r->owner) {
-		__receive_plock(mg, &info, from, r);
-
-	} else if (r->owner == -1) {
-		log_debug("receive_plock from %d r %llx owner %d", from,
-			  (unsigned long long)info.number, r->owner);
-
-		if (from == our_nodeid)
-			save_pending_plock(mg, r, &info);
-
-	} else if (r->owner != our_nodeid) {
-		/* might happen, if frequent change to log_debug */
-		log_error("receive_plock from %d r %llx owner %d", from,
-			  (unsigned long long)info.number, r->owner);
-
-		if (from == our_nodeid)
-			save_pending_plock(mg, r, &info);
-
-	} else if (r->owner == our_nodeid) {
-		/* might happen, if frequent change to log_debug */
-		log_error("receive_plock from %d r %llx owner %d", from,
-			  (unsigned long long)info.number, r->owner);
-
-		if (from == our_nodeid)
-			__receive_plock(mg, &info, from, r);
-	}
-}
-
-void receive_plock(struct mountgroup *mg, char *buf, int len, int from)
-{
-	if (mg->save_plocks) {
-		save_message_old(mg, buf, len, from, MSG_PLOCK);
-		return;
-	}
-
-	if (!mg->got_our_journals) {
-		log_group(mg, "not saving plock messages yet");
-		return;
-	}
-
-	_receive_plock(mg, buf, len, from);
-}
-
-static int send_struct_info(struct mountgroup *mg, struct dlm_plock_info *in,
-			    int msg_type)
-{
-	char *buf;
-	int rv, len;
-	struct gdlm_header *hd;
-
-	len = sizeof(struct gdlm_header) + sizeof(struct dlm_plock_info);
-	buf = malloc(len);
-	if (!buf) {
-		rv = -ENOMEM;
-		goto out;
-	}
-	memset(buf, 0, len);
-
-	info_bswap_out(in);
-
-	hd = (struct gdlm_header *)buf;
-	hd->type = msg_type;
-	hd->nodeid = our_nodeid;
-	hd->to_nodeid = 0;
-
-	memcpy(buf + sizeof(struct gdlm_header), in, sizeof(*in));
-
-	rv = send_group_message_old(mg, len, buf);
-
-	free(buf);
- out:
-	if (rv)
-		log_error("send plock message error %d", rv);
-	return rv;
-}
-
-static void send_plock(struct mountgroup *mg, struct resource *r,
-		       struct dlm_plock_info *in)
-{
-	send_struct_info(mg, in, MSG_PLOCK);
-}
-
-static void send_own(struct mountgroup *mg, struct resource *r, int owner)
-{
-	struct dlm_plock_info info;
-
-	/* if we've already sent an own message for this resource,
-	   (pending list is not empty), then we shouldn't send another */
-
-	if (!list_empty(&r->pending)) {
-		log_debug("send_own %llx already pending",
-			  (unsigned long long)r->number);
-		return;
-	}
-
-	memset(&info, 0, sizeof(info));
-	info.number = r->number;
-	info.nodeid = owner;
-
-	send_struct_info(mg, &info, MSG_PLOCK_OWN);
-}
-
-static void send_syncs(struct mountgroup *mg, struct resource *r)
-{
-	struct dlm_plock_info info;
-	struct posix_lock *po;
-	struct lock_waiter *w;
-	int rv;
-
-	list_for_each_entry(po, &r->locks, list) {
-		memset(&info, 0, sizeof(info));
-		info.number    = r->number;
-		info.start     = po->start;
-		info.end       = po->end;
-		info.nodeid    = po->nodeid;
-		info.owner     = po->owner;
-		info.pid       = po->pid;
-		info.ex        = po->ex;
-
-		rv = send_struct_info(mg, &info, MSG_PLOCK_SYNC_LOCK);
-		if (rv)
-			goto out;
-
-		po->flags |= P_SYNCING;
-	}
-
-	list_for_each_entry(w, &r->waiters, list) {
-		memcpy(&info, &w->info, sizeof(info));
-
-		rv = send_struct_info(mg, &info, MSG_PLOCK_SYNC_WAITER);
-		if (rv)
-			goto out;
-
-		w->flags |= P_SYNCING;
-	}
- out:
-	return;
-}
-
-static void send_drop(struct mountgroup *mg, struct resource *r)
-{
-	struct dlm_plock_info info;
-
-	memset(&info, 0, sizeof(info));
-	info.number = r->number;
-
-	send_struct_info(mg, &info, MSG_PLOCK_DROP);
-}
-
-/* plock op can't be handled until we know the owner value of the resource,
-   so the op is saved on the pending list until the r owner is established */
-
-static void save_pending_plock(struct mountgroup *mg, struct resource *r,
-			       struct dlm_plock_info *in)
-{
-	struct lock_waiter *w;
-
-	w = malloc(sizeof(struct lock_waiter));
-	if (!w) {
-		log_error("save_pending_plock no mem");
-		return;
-	}
-	memcpy(&w->info, in, sizeof(struct dlm_plock_info));
-	list_add_tail(&w->list, &r->pending);
-}
-
-/* plock ops are on pending list waiting for ownership to be established.
-   owner has now become us, so add these plocks to r */
-
-static void add_pending_plocks(struct mountgroup *mg, struct resource *r)
-{
-	struct lock_waiter *w, *safe;
-
-	list_for_each_entry_safe(w, safe, &r->pending, list) {
-		__receive_plock(mg, &w->info, our_nodeid, r);
-		list_del(&w->list);
-		free(w);
-	}
-}
-
-/* plock ops are on pending list waiting for ownership to be established.
-   owner has now become 0, so send these plocks to everyone */
-
-static void send_pending_plocks(struct mountgroup *mg, struct resource *r)
-{
-	struct lock_waiter *w, *safe;
-
-	list_for_each_entry_safe(w, safe, &r->pending, list) {
-		send_plock(mg, r, &w->info);
-		list_del(&w->list);
-		free(w);
-	}
-}
-
-static void _receive_own(struct mountgroup *mg, char *buf, int len, int from)
-{
-	struct gdlm_header *hd = (struct gdlm_header *) buf;
-	struct dlm_plock_info info;
-	struct resource *r;
-	int should_not_happen = 0;
-	int rv;
-
-	memcpy(&info, buf + sizeof(struct gdlm_header), sizeof(info));
-	info_bswap_in(&info);
-
-	log_plock(mg, "receive own %llx from %u owner %u",
-		  (unsigned long long)info.number, hd->nodeid, info.nodeid);
-
-	rv = find_resource(mg, info.number, 1, &r);
-	if (rv)
-		return;
-
-	if (from == our_nodeid) {
-		/*
-		 * received our own own message
-		 */
-
-		if (info.nodeid == 0) {
-			/* we are setting owner to 0 */
-
-			if (r->owner == our_nodeid) {
-				/* we set owner to 0 when we relinquish
-				   ownership */
-				should_not_happen = 1;
-			} else if (r->owner == 0) {
-				/* this happens when we relinquish ownership */
-				r->flags |= R_GOT_UNOWN;
-			} else {
-				should_not_happen = 1;
-			}
-
-		} else if (info.nodeid == our_nodeid) {
-			/* we are setting owner to ourself */
-
-			if (r->owner == -1) {
-				/* we have gained ownership */
-				r->owner = our_nodeid;
-				add_pending_plocks(mg, r);
-			} else if (r->owner == our_nodeid) {
-				should_not_happen = 1;
-			} else if (r->owner == 0) {
-				send_pending_plocks(mg, r);
-			} else {
-				/* resource is owned by other node;
-				   they should set owner to 0 shortly */
-			}
-
-		} else {
-			/* we should only ever set owner to 0 or ourself */
-			should_not_happen = 1;
-		}
-	} else {
-		/*
-		 * received own message from another node
-		 */
-
-		if (info.nodeid == 0) {
-			/* other node is setting owner to 0 */
-
-			if (r->owner == -1) {
-				/* we should have a record of the owner before
-				   it relinquishes */
-				should_not_happen = 1;
-			} else if (r->owner == our_nodeid) {
-				/* only the owner should relinquish */
-				should_not_happen = 1;
-			} else if (r->owner == 0) {
-				should_not_happen = 1;
-			} else {
-				r->owner = 0;
-				r->flags |= R_GOT_UNOWN;
-				send_pending_plocks(mg, r);
-			}
-
-		} else if (info.nodeid == from) {
-			/* other node is setting owner to itself */
-
-			if (r->owner == -1) {
-				/* normal path for a node becoming owner */
-				r->owner = from;
-			} else if (r->owner == our_nodeid) {
-				/* we relinquish our ownership: sync our local
-				   plocks to everyone, then set owner to 0 */
-				send_syncs(mg, r);
-				send_own(mg, r, 0);
-				/* we need to set owner to 0 here because
-				   local ops may arrive before we receive
-				   our send_own message and can't be added
-				   locally */
-				r->owner = 0;
-			} else if (r->owner == 0) {
-				/* can happen because we set owner to 0 before
-				   we receive our send_own sent just above */
-			} else {
-				/* do nothing, current owner should be
-				   relinquishing its ownership */
-			}
-
-		} else if (info.nodeid == our_nodeid) {
-			/* no one else should try to set the owner to us */
-			should_not_happen = 1;
-		} else {
-			/* a node should only ever set owner to 0 or itself */
-			should_not_happen = 1;
-		}
-	}
-
-	if (should_not_happen) {
-		log_error("receive_own from %u %llx info nodeid %d r owner %d",
-			  from, (unsigned long long)r->number, info.nodeid,
-			  r->owner);
-	}
-}
-
-void receive_own(struct mountgroup *mg, char *buf, int len, int from)
-{
-	if (mg->save_plocks) {
-		save_message_old(mg, buf, len, from, MSG_PLOCK_OWN);
-		return;
-	}
-
-	_receive_own(mg, buf, len, from);
-}
-
-static void clear_syncing_flag(struct resource *r, struct dlm_plock_info *in)
-{
-	struct posix_lock *po;
-	struct lock_waiter *w;
-
-	list_for_each_entry(po, &r->locks, list) {
-		if ((po->flags & P_SYNCING) &&
-		    in->start  == po->start &&
-		    in->end    == po->end &&
-		    in->nodeid == po->nodeid &&
-		    in->owner  == po->owner &&
-		    in->pid    == po->pid &&
-		    in->ex     == po->ex) {
-			po->flags &= ~P_SYNCING;
-			return;
-		}
-	}
-
-	list_for_each_entry(w, &r->waiters, list) {
-		if ((w->flags & P_SYNCING) &&
-		    in->start  == w->info.start &&
-		    in->end    == w->info.end &&
-		    in->nodeid == w->info.nodeid &&
-		    in->owner  == w->info.owner &&
-		    in->pid    == w->info.pid &&
-		    in->ex     == w->info.ex) {
-			w->flags &= ~P_SYNCING;
-			return;
-		}
-	}
-
-	log_error("clear_syncing %llx no match %s %llx-%llx %d/%u/%llx",
-		  (unsigned long long)r->number, in->ex ? "WR" : "RD",
-		  (unsigned long long)in->start, (unsigned long long)in->end,
-		  in->nodeid, in->pid, (unsigned long long)in->owner);
-}
-
-static void _receive_sync(struct mountgroup *mg, char *buf, int len, int from)
-{
-	struct dlm_plock_info info;
-	struct gdlm_header *hd = (struct gdlm_header *) buf;
-	struct resource *r;
-	int rv;
-
-	memcpy(&info, buf + sizeof(struct gdlm_header), sizeof(info));
-	info_bswap_in(&info);
-
-	log_plock(mg, "receive sync %llx from %u %s %llx-%llx %d/%u/%llx",
-		  (unsigned long long)info.number, from, info.ex ? "WR" : "RD",
-		  (unsigned long long)info.start, (unsigned long long)info.end,
-		  info.nodeid, info.pid, (unsigned long long)info.owner);
-
-	rv = find_resource(mg, info.number, 0, &r);
-	if (rv) {
-		log_error("receive_sync no r %llx from %d", info.number, from);
-		return;
-	}
-
-	if (from == our_nodeid) {
-		/* this plock now in sync on all nodes */
-		clear_syncing_flag(r, &info);
-		return;
-	}
-
-	if (hd->type == MSG_PLOCK_SYNC_LOCK)
-		add_lock(r, info.nodeid, info.owner, info.pid, info.ex,
-			 info.start, info.end);
-	else if (hd->type == MSG_PLOCK_SYNC_WAITER)
-		add_waiter(mg, r, &info);
-}
-
-void receive_sync(struct mountgroup *mg, char *buf, int len, int from)
-{
-	struct gdlm_header *hd = (struct gdlm_header *) buf;
-
-	if (mg->save_plocks) {
-		save_message_old(mg, buf, len, from, hd->type);
-		return;
-	}
-
-	_receive_sync(mg, buf, len, from);
-}
-
-static void _receive_drop(struct mountgroup *mg, char *buf, int len, int from)
-{
-	struct dlm_plock_info info;
-	struct resource *r;
-	int rv;
-
-	memcpy(&info, buf + sizeof(struct gdlm_header), sizeof(info));
-	info_bswap_in(&info);
-
-	log_plock(mg, "receive drop %llx from %u",
-		  (unsigned long long)info.number, from);
-
-	rv = find_resource(mg, info.number, 0, &r);
-	if (rv) {
-		/* we'll find no r if two nodes sent drop at once */
-		log_debug("receive_drop from %d no r %llx", from,
-			  (unsigned long long)info.number);
-		return;
-	}
-
-	if (r->owner != 0) {
-		/* - A sent drop, B sent drop, receive drop A, C sent own,
-		     receive drop B (this warning on C, owner -1)
-	   	   - A sent drop, B sent drop, receive drop A, A sent own,
-		     receive own A, receive drop B (this warning on all,
-		     owner A) */
-		log_debug("receive_drop from %d r %llx owner %d", from,
-			  (unsigned long long)r->number, r->owner);
-		return;
-	}
-
-	if (!list_empty(&r->pending)) {
-		/* shouldn't happen */
-		log_error("receive_drop from %d r %llx pending op", from,
-			  (unsigned long long)r->number);
-		return;
-	}
-
-	/* the decision to drop or not must be based on things that are
-	   guaranteed to be the same on all nodes */
-
-	if (list_empty(&r->locks) && list_empty(&r->waiters)) {
-		list_del(&r->list);
-		free(r);
-	} else {
-		/* A sent drop, B sent a plock, receive plock, receive drop */
-		log_debug("receive_drop from %d r %llx in use", from,
-			  (unsigned long long)r->number);
-	}
-}
-
-void receive_drop(struct mountgroup *mg, char *buf, int len, int from)
-{
-	if (mg->save_plocks) {
-		save_message_old(mg, buf, len, from, MSG_PLOCK_DROP);
-		return;
-	}
-
-	_receive_drop(mg, buf, len, from);
-}
-
-/* We only drop resources from the unowned state to simplify things.
-   If we want to drop a resource we own, we unown/relinquish it first. */
-
-/* FIXME: in the transition from owner = us, to owner = 0, to drop;
-   we want the second period to be shorter than the first */
-
-static int drop_resources(struct mountgroup *mg)
-{
-	struct resource *r;
-	struct timeval now;
-	int count = 0;
-
-	gettimeofday(&now, NULL);
-
-	/* try to drop the oldest, unused resources */
-
-	list_for_each_entry_reverse(r, &mg->plock_resources, list) {
-		if (count >= cfgd_drop_resources_count)
-			break;
-		if (r->owner && r->owner != our_nodeid)
-			continue;
-		if (time_diff_ms(&r->last_access, &now) <
-		    cfgd_drop_resources_age)
-			continue;
-
-		if (list_empty(&r->locks) && list_empty(&r->waiters)) {
-			if (r->owner == our_nodeid) {
-				send_own(mg, r, 0);
-				r->owner = 0;
-			} else if (r->owner == 0 && got_unown(r)) {
-				send_drop(mg, r);
-			}
-
-			count++;
-		}
-	}
-
-	return 0;
-}
-
-/* iterate through directory names looking for matching id:
-   /sys/kernel/dlm/<name>/id */
-
-#define DLM_SYSFS_DIR "/sys/kernel/dlm"
-
-static char ls_name[256];
-
-static int get_lockspace_name(uint32_t ls_id)
-{
-	char path[PATH_MAX];
-	DIR *d;
-	FILE *file;
-	struct dirent *de;
-	uint32_t id;
-	int rv, error;
-
-        d = opendir(DLM_SYSFS_DIR);
-        if (!d) {
-                log_debug("%s: opendir failed: %d", path, errno);
-		return -1;
-        }
-
-	rv = -1;
-
-	while ((de = readdir(d))) {
-		if (de->d_name[0] == '.')
-			continue;
-
-		id = 0;
-		memset(path, 0, PATH_MAX);
-		snprintf(path, PATH_MAX, "%s/%s/id", DLM_SYSFS_DIR, de->d_name);
-
-		file = fopen(path, "r");
-		if (!file) {
-			log_error("can't open %s %d", path, errno);
-			continue;
-		}
-
-		error = fscanf(file, "%u", &id);
-		fclose(file);
-
-		if (error != 1) {
-			log_error("bad read %s %d", path, errno);
-			continue;
-		}
-		if (id != ls_id) {
-			log_debug("get_lockspace_name skip %x %s",
-				  id, de->d_name);
-			continue;
-		}
-
-		log_debug("get_lockspace_name found %x %s", id, de->d_name);
-		strncpy(ls_name, de->d_name, 256);
-		rv = 0;
-		break;
-	}
-
-	closedir(d);
-	return rv;
-}
-
-/* find the locskapce with "ls_id" in sysfs, get it's name, then look for
-   the mg with with the same name in mounts list, return it's id */
-
-static void set_associated_id(uint32_t ls_id)
-{
-	struct mountgroup *mg;
-	int rv;
-
-	log_debug("set_associated_id ls_id %x %d", ls_id, ls_id);
-
-	memset(&ls_name, 0, sizeof(ls_name));
-
-	rv = get_lockspace_name(ls_id);
-	if (rv) {
-		log_error("no lockspace found with id %x", ls_id);
-		return;
-	}
-
-	mg = find_mg(ls_name);
-	if (!mg) {
-		log_error("no mountgroup found with name %s for ls_id %x",
-			  ls_name, ls_id);
-		return;
-	}
-
-	log_debug("set_associated_id ls %x is mg %x", ls_id, mg->id);
-
-	mg->associated_ls_id = ls_id;
-}
-
-static uint32_t ls_to_mg_id(uint32_t fsid)
-{
-	struct mountgroup *mg;
-	int do_set = 1;
-
- retry:
-	list_for_each_entry(mg, &mountgroups, list) {
-		if (mg->associated_ls_id == fsid)
-			return mg->id;
-	}
-
-	if (do_set) {
-		do_set = 0;
-		set_associated_id(fsid);
-		goto retry;
-	}
-
-	return fsid;
-}
-
-int limit_plocks(void)
-{
-	struct timeval now;
-
-	/* Don't send more messages while the cpg message queue is backed up */
-
-	if (libcpg_flow_control_on) {
-		update_flow_control_status();
-		if (libcpg_flow_control_on)
-			return 1;
-	}
-
-	if (!cfgd_plock_rate_limit || !plock_read_count)
-		return 0;
-
-	gettimeofday(&now, NULL);
-
-	/* Every time a plock op is read from the kernel, we increment
-	   plock_read_count.  After every cfgd_plock_rate_limit (N) reads,
-	   we check the time it's taken to do those N; if the time is less than
-	   a second, then we delay reading any more until a second is up.
-	   This way we read a max of N ops from the kernel every second. */
-
-	if (!(plock_read_count % cfgd_plock_rate_limit)) {
-		if (time_diff_ms(&plock_rate_last, &now) < 1000) {
-			plock_rate_delays++;
-			return 2;
-		}
-		plock_rate_last = now;
-		plock_read_count++;
-	}
-	return 0;
-}
-
-void process_plocks(int ci)
-{
-	struct mountgroup *mg;
-	struct resource *r;
-	struct dlm_plock_info info;
-	struct timeval now;
-	uint64_t usec;
-	int rv;
-
-	if (limit_plocks()) {
-		poll_ignore_plock = 1;
-		client_ignore(plock_ci, plock_fd);
-		return;
-	}
-
-	gettimeofday(&now, NULL);
-
-	memset(&info, 0, sizeof(info));
-
-	rv = do_read(plock_device_fd, &info, sizeof(info));
-	if (rv < 0) {
-		log_debug("process_plocks: read error %d fd %d\n",
-			  errno, plock_device_fd);
-		return;
-	}
-
-	/* kernel doesn't set the nodeid field */
-	info.nodeid = our_nodeid;
-
-	if (!cfgd_enable_plock) {
-		rv = -ENOSYS;
-		goto fail;
-	}
-
-	if (need_fsid_translation)
-		info.fsid = ls_to_mg_id(info.fsid);
-
-	mg = find_mg_id(info.fsid);
-	if (!mg) {
-		log_debug("process_plocks: no mg id %x", info.fsid);
-		rv = -EEXIST;
-		goto fail;
-	}
-
-	log_plock(mg, "read plock %llx %s %s %llx-%llx %d/%u/%llx w %d",
-		  (unsigned long long)info.number,
-		  op_str(info.optype),
-		  ex_str(info.optype, info.ex),
-		  (unsigned long long)info.start, (unsigned long long)info.end,
-		  info.nodeid, info.pid, (unsigned long long)info.owner,
-		  info.wait);
-
-	/* report plock rate and any delays since the last report */
-	plock_read_count++;
-	if (!(plock_read_count % 1000)) {
-		usec = dt_usec(&plock_read_time, &now) ;
-		log_group(mg, "plock_read_count %u time %.3f s delays %u",
-			  plock_read_count, usec * 1.e-6, plock_rate_delays);
-		plock_read_time = now;
-		plock_rate_delays = 0;
-	}
-
-	rv = find_resource(mg, info.number, 1, &r);
-	if (rv)
-		goto fail;
-
-	if (r->owner == 0) {
-		/* plock state replicated on all nodes */
-		send_plock(mg, r, &info);
-
-	} else if (r->owner == our_nodeid) {
-		/* we are the owner of r, so our plocks are local */
-		__receive_plock(mg, &info, our_nodeid, r);
-
-	} else {
-		/* r owner is -1: r is new, try to become the owner;
-		   r owner > 0: tell other owner to give up ownership;
-		   both done with a message trying to set owner to ourself */
-		send_own(mg, r, our_nodeid);
-		save_pending_plock(mg, r, &info);
-	}
-
-	if (cfgd_plock_ownership &&
-	    time_diff_ms(&mg->drop_resources_last, &now) >=
-	    		 cfgd_drop_resources_time) {
-		mg->drop_resources_last = now;
-		drop_resources(mg);
-	}
-
-	return;
-
- fail:
-	info.rv = rv;
-	rv = write(plock_device_fd, &info, sizeof(info));
-
-	return;
-}
-
-void process_saved_plocks(struct mountgroup *mg)
-{
-	struct save_msg *sm, *sm2;
-
-	if (list_empty(&mg->saved_messages))
-		return;
-
-	log_group(mg, "process_saved_plocks");
-
-	list_for_each_entry_safe(sm, sm2, &mg->saved_messages, list) {
-		switch (sm->type) {
-		case MSG_PLOCK:
-			_receive_plock(mg, sm->buf, sm->len, sm->nodeid);
-			break;
-		case MSG_PLOCK_OWN:
-			_receive_own(mg, sm->buf, sm->len, sm->nodeid);
-			break;
-		case MSG_PLOCK_DROP:
-			_receive_drop(mg, sm->buf, sm->len, sm->nodeid);
-			break;
-		case MSG_PLOCK_SYNC_LOCK:
-		case MSG_PLOCK_SYNC_WAITER:
-			_receive_sync(mg, sm->buf, sm->len, sm->nodeid);
-			break;
-		default:
-			continue;
-		}
-
-		list_del(&sm->list);
-		free(sm);
-	}
-}
-
-void plock_exit(void)
-{
-	if (cfgd_enable_plock)
-		saCkptFinalize(ckpt_handle);
-}
-
-/* locks still marked SYNCING should not go into the ckpt; the new node
-   will get those locks by receiving PLOCK_SYNC messages */
-
-static void pack_section_buf(struct mountgroup *mg, struct resource *r)
-{
-	struct pack_plock *pp;
-	struct posix_lock *po;
-	struct lock_waiter *w;
-	int count = 0;
-
-	/* plocks on owned resources are not replicated on other nodes */
-	if (r->owner == our_nodeid)
-		return;
-
-	pp = (struct pack_plock *) &section_buf;
-
-	list_for_each_entry(po, &r->locks, list) {
-		if (po->flags & P_SYNCING)
-			continue;
-		pp->start	= cpu_to_le64(po->start);
-		pp->end		= cpu_to_le64(po->end);
-		pp->owner	= cpu_to_le64(po->owner);
-		pp->pid		= cpu_to_le32(po->pid);
-		pp->nodeid	= cpu_to_le32(po->nodeid);
-		pp->ex		= po->ex;
-		pp->waiter	= 0;
-		pp++;
-		count++;
-	}
-
-	list_for_each_entry(w, &r->waiters, list) {
-		if (w->flags & P_SYNCING)
-			continue;
-		pp->start	= cpu_to_le64(w->info.start);
-		pp->end		= cpu_to_le64(w->info.end);
-		pp->owner	= cpu_to_le64(w->info.owner);
-		pp->pid		= cpu_to_le32(w->info.pid);
-		pp->nodeid	= cpu_to_le32(w->info.nodeid);
-		pp->ex		= w->info.ex;
-		pp->waiter	= 1;
-		pp++;
-		count++;
-	}
-
-	section_len = count * sizeof(struct pack_plock);
-}
-
-static int unpack_section_buf(struct mountgroup *mg, char *numbuf, int buflen)
-{
-	struct pack_plock *pp;
-	struct posix_lock *po;
-	struct lock_waiter *w;
-	struct resource *r;
-	int count = section_len / sizeof(struct pack_plock);
-	int i, owner = 0;
-	unsigned long long num;
-	struct timeval now;
-
-	gettimeofday(&now, NULL);
-
-	r = malloc(sizeof(struct resource));
-	if (!r)
-		return -ENOMEM;
-	memset(r, 0, sizeof(struct resource));
-	INIT_LIST_HEAD(&r->locks);
-	INIT_LIST_HEAD(&r->waiters);
-	INIT_LIST_HEAD(&r->pending);
-
-	if (cfgd_plock_ownership)
-		sscanf(numbuf, "r%llu.%d", &num, &owner);
-	else
-		sscanf(numbuf, "r%llu", &num);
-
-	r->number = num;
-	r->owner = owner;
-	r->last_access = now;
-
-	pp = (struct pack_plock *) &section_buf;
-
-	for (i = 0; i < count; i++) {
-		if (!pp->waiter) {
-			po = malloc(sizeof(struct posix_lock));
-			// FIXME: handle failed malloc
-			po->start	= le64_to_cpu(pp->start);
-			po->end		= le64_to_cpu(pp->end);
-			po->owner	= le64_to_cpu(pp->owner);
-			po->pid		= le32_to_cpu(pp->pid);
-			po->nodeid	= le32_to_cpu(pp->nodeid);
-			po->ex		= pp->ex;
-			list_add_tail(&po->list, &r->locks);
-		} else {
-			w = malloc(sizeof(struct lock_waiter));
-			// FIXME: handle failed malloc
-			w->info.start	= le64_to_cpu(pp->start);
-			w->info.end	= le64_to_cpu(pp->end);
-			w->info.owner	= le64_to_cpu(pp->owner);
-			w->info.pid	= le32_to_cpu(pp->pid);
-			w->info.nodeid	= le32_to_cpu(pp->nodeid);
-			w->info.ex	= pp->ex;
-			list_add_tail(&w->list, &r->waiters);
-		}
-		pp++;
-	}
-
-	list_add_tail(&r->list, &mg->plock_resources);
-	return 0;
-}
-
-static int _unlink_checkpoint(struct mountgroup *mg, SaNameT *name)
-{
-	SaCkptCheckpointHandleT h;
-	SaCkptCheckpointDescriptorT s;
-	SaAisErrorT rv;
-	int ret = 0;
-
-	h = (SaCkptCheckpointHandleT) mg->cp_handle;
-	log_group(mg, "unlink ckpt %llx", (unsigned long long)h);
-
- unlink_retry:
-	rv = saCkptCheckpointUnlink(ckpt_handle, name);
-	if (rv == SA_AIS_ERR_TRY_AGAIN) {
-		log_group(mg, "unlink ckpt retry");
-		sleep(1);
-		goto unlink_retry;
-	}
-	if (rv == SA_AIS_OK)
-		goto out_close;
-
-	log_error("unlink ckpt error %d %s", rv, mg->name);
-	ret = -1;
-
- status_retry:
-	rv = saCkptCheckpointStatusGet(h, &s);
-	if (rv == SA_AIS_ERR_TRY_AGAIN) {
-		log_group(mg, "unlink ckpt status retry");
-		sleep(1);
-		goto status_retry;
-	}
-	if (rv != SA_AIS_OK) {
-		log_error("unlink ckpt status error %d %s", rv, mg->name);
-		goto out_close;
-	}
-
-	log_group(mg, "unlink ckpt status: size %llu, max sections %u, "
-		      "max section size %llu, section count %u, mem %u",
-		 (unsigned long long)s.checkpointCreationAttributes.checkpointSize,
-		 s.checkpointCreationAttributes.maxSections,
-		 (unsigned long long)s.checkpointCreationAttributes.maxSectionSize,
-		 s.numberOfSections, s.memoryUsed);
-
- out_close:
-	if (!h)
-		goto out;
-
-	rv = saCkptCheckpointClose(h);
-	if (rv == SA_AIS_ERR_TRY_AGAIN) {
-		log_group(mg, "unlink ckpt close retry");
-		sleep(1);
-		goto out_close;
-	}
-	if (rv != SA_AIS_OK) {
-		log_error("unlink ckpt %llx close err %d %s",
-			  (unsigned long long)h, rv, mg->name);
-		/* should we return an error here and possibly cause
-		   store_plocks() to fail on this? */
-		/* ret = -1; */
-	}
- out:
-	mg->cp_handle = 0;
-	return ret;
-}
-
-int unlink_checkpoint(struct mountgroup *mg)
-{
-	SaNameT name;
-	int len;
-
-	len = snprintf((char *)name.value, SA_MAX_NAME_LENGTH, "gfsplock.%s",
-		       mg->name);
-	name.length = len;
-	return _unlink_checkpoint(mg, &name);
-}
-
-/*
- * section id is r<inodenum>.<owner>, the maximum string length is:
- * "r" prefix       =  1    strlen("r")
- * max uint64       = 20    strlen("18446744073709551615")
- * "." before owner =  1    strlen(".")
- * max int          = 11    strlen("-2147483647")
- * \0 at end        =  1
- * ---------------------
- *                    34    SECTION_NAME_LEN
- */
-
-#define SECTION_NAME_LEN 34
-
-/* Copy all plock state into a checkpoint so new node can retrieve it.  The
-   node creating the ckpt for the mounter needs to be the same node that's
-   sending the mounter its journals message (i.e. the low nodeid).  The new
-   mounter knows the ckpt is ready to read only after it gets its journals
-   message.
- 
-   If the mounter is becoming the new low nodeid in the group, the node doing
-   the store closes the ckpt and the new node unlinks the ckpt after reading
-   it.  The ckpt should then disappear and the new node can create a new ckpt
-   for the next mounter. */
-
-void store_plocks(struct mountgroup *mg, int nodeid)
-{
-	SaCkptCheckpointCreationAttributesT attr;
-	SaCkptCheckpointHandleT h;
-	SaCkptSectionIdT section_id;
-	SaCkptSectionCreationAttributesT section_attr;
-	SaCkptCheckpointOpenFlagsT flags;
-	SaNameT name;
-	SaAisErrorT rv;
-	char buf[SECTION_NAME_LEN];
-	struct resource *r;
-	struct posix_lock *po;
-	struct lock_waiter *w;
-	int r_count, lock_count, total_size, section_size, max_section_size;
-	int len, owner;
-
-	if (!cfgd_enable_plock)
-		return;
-
-	/* no change to plock state since we created the last checkpoint */
-	if (mg->last_checkpoint_time > mg->last_plock_time) {
-		log_group(mg, "store_plocks: saved ckpt uptodate");
-		goto out;
-	}
-	mg->last_checkpoint_time = time(NULL);
-
-	len = snprintf((char *)name.value, SA_MAX_NAME_LENGTH, "gfsplock.%s",
-		       mg->name);
-	name.length = len;
-
-	/* unlink an old checkpoint before we create a new one */
-	if (mg->cp_handle) {
-		if (_unlink_checkpoint(mg, &name))
-			return;
-	}
-
-	/* loop through all plocks to figure out sizes to set in
-	   the attr fields */
-
-	r_count = 0;
-	lock_count = 0;
-	total_size = 0;
-	max_section_size = 0;
-
-	list_for_each_entry(r, &mg->plock_resources, list) {
-		if (r->owner == -1)
-			continue;
-
-		r_count++;
-		section_size = 0;
-		list_for_each_entry(po, &r->locks, list) {
-			section_size += sizeof(struct pack_plock);
-			lock_count++;
-		}
-		list_for_each_entry(w, &r->waiters, list) {
-			section_size += sizeof(struct pack_plock);
-			lock_count++;
-		}
-		total_size += section_size;
-		if (section_size > max_section_size)
-			max_section_size = section_size;
-	}
-
-	log_group(mg, "store_plocks: r_count %d, lock_count %d, pp %u bytes",
-		  r_count, lock_count, (unsigned int)sizeof(struct pack_plock));
-
-	log_group(mg, "store_plocks: total %d bytes, max_section %d bytes",
-		  total_size, max_section_size);
-
-	attr.creationFlags = SA_CKPT_WR_ALL_REPLICAS;
-	attr.checkpointSize = total_size;
-	attr.retentionDuration = SA_TIME_MAX;
-	attr.maxSections = r_count + 1;      /* don't know why we need +1 */
-	attr.maxSectionSize = max_section_size;
-	attr.maxSectionIdSize = SECTION_NAME_LEN;
-
-	flags = SA_CKPT_CHECKPOINT_READ |
-		SA_CKPT_CHECKPOINT_WRITE |
-		SA_CKPT_CHECKPOINT_CREATE;
-
- open_retry:
-	rv = saCkptCheckpointOpen(ckpt_handle, &name, &attr, flags, 0, &h);
-	if (rv == SA_AIS_ERR_TRY_AGAIN) {
-		log_group(mg, "store_plocks: ckpt open retry");
-		sleep(1);
-		goto open_retry;
-	}
-	if (rv == SA_AIS_ERR_EXIST) {
-		log_group(mg, "store_plocks: ckpt already exists");
-		return;
-	}
-	if (rv != SA_AIS_OK) {
-		log_error("store_plocks: ckpt open error %d %s", rv, mg->name);
-		return;
-	}
-
-	log_group(mg, "store_plocks: open ckpt handle %llx",
-		  (unsigned long long)h);
-	mg->cp_handle = (uint64_t) h;
-
-	/* - If r owner is -1, ckpt nothing.
-	   - If r owner is us, ckpt owner of us and no plocks.
-	   - If r owner is other, ckpt that owner and any plocks we have on r
-	     (they've just been synced but owner=0 msg not recved yet).
-	   - If r owner is 0 and !got_unown, then we've just unowned r;
-	     ckpt owner of us and any plocks that don't have SYNCING set
-	     (plocks with SYNCING will be handled by our sync messages).
-	   - If r owner is 0 and got_unown, then ckpt owner 0 and all plocks;
-	     (there should be no SYNCING plocks) */
-
-	list_for_each_entry(r, &mg->plock_resources, list) {
-		if (r->owner == -1)
-			continue;
-		else if (r->owner == our_nodeid)
-			owner = our_nodeid;
-		else if (r->owner)
-			owner = r->owner;
-		else if (!r->owner && !got_unown(r))
-			owner = our_nodeid;
-		else if (!r->owner)
-			owner = 0;
-		else {
-			log_error("store_plocks owner %d r %llx", r->owner,
-				  (unsigned long long)r->number);
-			continue;
-		}
-
-		memset(&buf, 0, sizeof(buf));
-		if (cfgd_plock_ownership)
-			len = snprintf(buf, SECTION_NAME_LEN, "r%llu.%d",
-			       	       (unsigned long long)r->number, owner);
-		else
-			len = snprintf(buf, SECTION_NAME_LEN, "r%llu",
-			       	       (unsigned long long)r->number);
-
-		section_id.id = (void *)buf;
-		section_id.idLen = len + 1;
-		section_attr.sectionId = &section_id;
-		section_attr.expirationTime = SA_TIME_END;
-
-		memset(&section_buf, 0, sizeof(section_buf));
-		section_len = 0;
-
-		pack_section_buf(mg, r);
-
-		log_group(mg, "store_plocks: section size %u id %u \"%s\"",
-			  section_len, section_id.idLen, buf);
-
-	 create_retry:
-		rv = saCkptSectionCreate(h, &section_attr, &section_buf,
-					 section_len);
-		if (rv == SA_AIS_ERR_TRY_AGAIN) {
-			log_group(mg, "store_plocks: ckpt create retry");
-			sleep(1);
-			goto create_retry;
-		}
-		if (rv == SA_AIS_ERR_EXIST) {
-			/* this shouldn't happen in general */
-			log_group(mg, "store_plocks: clearing old ckpt");
-			saCkptCheckpointClose(h);
-			_unlink_checkpoint(mg, &name);
-			goto open_retry;
-		}
-		if (rv != SA_AIS_OK) {
-			log_error("store_plocks: ckpt section create err %d %s",
-				  rv, mg->name);
-			break;
-		}
-	}
-
- out:
-	/* If the new nodeid is becoming the low nodeid it will now be in
-	   charge of creating ckpt's for mounters instead of us. */
-
-	if (nodeid < our_nodeid) {
-		log_group(mg, "store_plocks: closing ckpt for new low node %d",
-			  nodeid);
-		saCkptCheckpointClose(h);
-		mg->cp_handle = 0;
-	}
-}
-
-/* called by a node that's just been added to the group to get existing plock
-   state */
-
-void retrieve_plocks(struct mountgroup *mg)
-{
-	SaCkptCheckpointHandleT h;
-	SaCkptSectionIterationHandleT itr;
-	SaCkptSectionDescriptorT desc;
-	SaCkptIOVectorElementT iov;
-	SaNameT name;
-	SaAisErrorT rv;
-	char buf[SECTION_NAME_LEN];
-	int len;
-
-	if (!cfgd_enable_plock)
-		return;
-
-	log_group(mg, "retrieve_plocks");
-
-	len = snprintf((char *)name.value, SA_MAX_NAME_LENGTH, "gfsplock.%s",
-		       mg->name);
-	name.length = len;
-
- open_retry:
-	rv = saCkptCheckpointOpen(ckpt_handle, &name, NULL,
-				  SA_CKPT_CHECKPOINT_READ, 0, &h);
-	if (rv == SA_AIS_ERR_TRY_AGAIN) {
-		log_group(mg, "retrieve_plocks: ckpt open retry");
-		sleep(1);
-		goto open_retry;
-	}
-	if (rv != SA_AIS_OK) {
-		log_error("retrieve_plocks: ckpt open error %d %s",
-			  rv, mg->name);
-		return;
-	}
-
- init_retry:
-	rv = saCkptSectionIterationInitialize(h, SA_CKPT_SECTIONS_ANY, 0, &itr);
-	if (rv == SA_AIS_ERR_TRY_AGAIN) {
-		log_group(mg, "retrieve_plocks: ckpt iterinit retry");
-		sleep(1);
-		goto init_retry;
-	}
-	if (rv != SA_AIS_OK) {
-		log_error("retrieve_plocks: ckpt iterinit error %d %s",
-			  rv, mg->name);
-		goto out;
-	}
-
-	while (1) {
-	 next_retry:
-		rv = saCkptSectionIterationNext(itr, &desc);
-		if (rv == SA_AIS_ERR_NO_SECTIONS)
-			break;
-		if (rv == SA_AIS_ERR_TRY_AGAIN) {
-			log_group(mg, "retrieve_plocks: ckpt iternext retry");
-			sleep(1);
-			goto next_retry;
-		}
-		if (rv != SA_AIS_OK) {
-			log_error("retrieve_plocks: ckpt iternext error %d %s",
-				  rv, mg->name);
-			goto out_it;
-		}
-
-		if (!desc.sectionId.idLen)
-			continue;
-
-		iov.sectionId = desc.sectionId;
-		iov.dataBuffer = &section_buf;
-		iov.dataSize = desc.sectionSize;
-		iov.dataOffset = 0;
-
-		/* for debug print */
-		memset(&buf, 0, sizeof(buf));
-		snprintf(buf, SECTION_NAME_LEN, "%s", desc.sectionId.id);
-
-		log_group(mg, "retrieve_plocks: section size %llu id %u \"%s\"",
-			  (unsigned long long)iov.dataSize, iov.sectionId.idLen,
-			  buf);
-
-	 read_retry:
-		rv = saCkptCheckpointRead(h, &iov, 1, NULL);
-		if (rv == SA_AIS_ERR_TRY_AGAIN) {
-			log_group(mg, "retrieve_plocks: ckpt read retry");
-			sleep(1);
-			goto read_retry;
-		}
-		if (rv != SA_AIS_OK) {
-			log_error("retrieve_plocks: ckpt read error %d %s",
-				  rv, mg->name);
-			goto out_it;
-		}
-
-		/* we'll get empty (zero length) sections for resources with
-		   no locks, which exist in ownership mode; the resource
-		   name and owner come from the section id */
-
-		log_group(mg, "retrieve_plocks: ckpt read %llu bytes",
-			  (unsigned long long)iov.readSize);
-		section_len = iov.readSize;
-
-		if (section_len % sizeof(struct pack_plock)) {
-			log_error("retrieve_plocks: bad section len %d %s",
-				  section_len, mg->name);
-			continue;
-		}
-
-		unpack_section_buf(mg, (char *)desc.sectionId.id,
-				   desc.sectionId.idLen);
-	}
-
- out_it:
-	saCkptSectionIterationFinalize(itr);
- out:
-	if (mg->low_nodeid == our_nodeid) {
-		/* we're the new low nodeid, will be master */
-		log_group(mg, "retrieve_plocks: unlink ckpt from old master");
-		mg->cp_handle = (uint64_t) h;
-		_unlink_checkpoint(mg, &name);
-	} else
-		saCkptCheckpointClose(h);
-}
-
-/* Called when a node has failed, or we're unmounting.  For a node failure, we
-   need to call this when the cpg confchg arrives so that we're guaranteed all
-   nodes do this in the same sequence wrt other messages. */
-
-void purge_plocks(struct mountgroup *mg, int nodeid, int unmount)
-{
-	struct posix_lock *po, *po2;
-	struct lock_waiter *w, *w2;
-	struct resource *r, *r2;
-	int purged = 0;
-
-	if (!cfgd_enable_plock)
-		return;
-
-	list_for_each_entry_safe(r, r2, &mg->plock_resources, list) {
-		list_for_each_entry_safe(po, po2, &r->locks, list) {
-			if (po->nodeid == nodeid || unmount) {
-				list_del(&po->list);
-				free(po);
-				purged++;
-			}
-		}
-
-		list_for_each_entry_safe(w, w2, &r->waiters, list) {
-			if (w->info.nodeid == nodeid || unmount) {
-				list_del(&w->list);
-				free(w);
-				purged++;
-			}
-		}
-
-		/* TODO: haven't thought carefully about how this transition
-		   to owner 0 might interact with other owner messages in
-		   progress. */
-
-		if (r->owner == nodeid) {
-			r->owner = 0;
-			send_pending_plocks(mg, r);
-		}
-
-		if (!list_empty(&r->waiters))
-			do_waiters(mg, r);
-
-		if (!cfgd_plock_ownership &&
-		    list_empty(&r->locks) && list_empty(&r->waiters)) {
-			list_del(&r->list);
-			free(r);
-		}
-	}
-
-	if (purged)
-		mg->last_plock_time = time(NULL);
-
-	log_group(mg, "purged %d plocks for %d", purged, nodeid);
-
-	/* we may have a saved ckpt that we created for the last mounter,
-	   we need to unlink it so another node can create a new ckpt for
-	   the next mounter after we leave */
-
-	if (unmount && mg->cp_handle)
-		unlink_checkpoint(mg);
-}
-
-int fill_plock_dump_buf(struct mountgroup *mg)
-{
-	struct posix_lock *po;
-	struct lock_waiter *w;
-	struct resource *r;
-	struct timeval now;
-	int rv = 0;
-	int len = GFSC_DUMP_SIZE, pos = 0, ret;
-
-	memset(plock_dump_buf, 0, sizeof(plock_dump_buf));
-	plock_dump_len = 0;
-
-	gettimeofday(&now, NULL);
-
-	list_for_each_entry(r, &mg->plock_resources, list) {
-
-		if (list_empty(&r->locks) &&
-		    list_empty(&r->waiters) &&
-		    list_empty(&r->pending)) {
-			ret = snprintf(plock_dump_buf + pos, len - pos,
-			      "%llu rown %d unused_ms %llu\n",
-			      (unsigned long long)r->number, r->owner,
-			      (unsigned long long)time_diff_ms(&r->last_access,
-							       &now));
-			if (ret >= len - pos) {
-				rv = -ENOSPC;
-				goto out;
-			}
-			pos += ret;
-			continue;
-		}
-
-		list_for_each_entry(po, &r->locks, list) {
-			ret = snprintf(plock_dump_buf + pos, len - pos,
-			      "%llu %s %llu-%llu nodeid %d pid %u owner %llx rown %d\n",
-			      (unsigned long long)r->number,
-			      po->ex ? "WR" : "RD",
-			      (unsigned long long)po->start,
-			      (unsigned long long)po->end,
-			      po->nodeid, po->pid,
-			      (unsigned long long)po->owner, r->owner);
-
-			if (ret >= len - pos) {
-				rv = -ENOSPC;
-				goto out;
-			}
-			pos += ret;
-		}
-
-		list_for_each_entry(w, &r->waiters, list) {
-			ret = snprintf(plock_dump_buf + pos, len - pos,
-			      "%llu %s %llu-%llu nodeid %d pid %u owner %llx rown %d WAITING\n",
-			      (unsigned long long)r->number,
-			      w->info.ex ? "WR" : "RD",
-			      (unsigned long long)w->info.start,
-			      (unsigned long long)w->info.end,
-			      w->info.nodeid, w->info.pid,
-			      (unsigned long long)w->info.owner, r->owner);
-
-			if (ret >= len - pos) {
-				rv = -ENOSPC;
-				goto out;
-			}
-			pos += ret;
-		}
-
-		list_for_each_entry(w, &r->pending, list) {
-			ret = snprintf(plock_dump_buf + pos, len - pos,
-			      "%llu %s %llu-%llu nodeid %d pid %u owner %llx rown %d PENDING\n",
-			      (unsigned long long)r->number,
-			      w->info.ex ? "WR" : "RD",
-			      (unsigned long long)w->info.start,
-			      (unsigned long long)w->info.end,
-			      w->info.nodeid, w->info.pid,
-			      (unsigned long long)w->info.owner, r->owner);
-
-			if (ret >= len - pos) {
-				rv = -ENOSPC;
-				goto out;
-			}
-			pos += ret;
-		}
-	}
- out:
-	plock_dump_len = pos;
-	return rv;
-}
-
-static void find_minors(void)
-{
-	FILE *fl;
-	char name[256];
-	uint32_t number;
-	int found = 0;
-	int c;
-
-	plock_minor = 0;
-	old_plock_minor = 0;
-
-	if (!(fl = fopen("/proc/misc", "r"))) {
-		log_error("/proc/misc fopen failed: %s", strerror(errno));
-		return;
-	}
-
-	while (!feof(fl)) {
-		if (fscanf(fl, "%d %255s\n", &number, &name[0]) == 2) {
-
-			if (!strcmp(name, "dlm_plock")) {
-				plock_minor = number;
-				found++;
-			} else if (!strcmp(name, "lock_dlm_plock")) {
-				old_plock_minor = number;
-				found++;
-			}
-
-		} else do {
-			c = fgetc(fl);
-		} while (c != EOF && c != '\n');
-
-		if (found == 3)
-			break;
-	}
-	fclose(fl);
-
-	if (!found)
-		log_error("Is lock_dlm or dlm missing from kernel? No misc devices found.");
-}
-
-static int find_udev_device(char *path, uint32_t minor)
-{
-	struct stat st;
-	int i;
-
-	for (i = 0; i < 10; i++) {
-		if (stat(path, &st) == 0 && minor(st.st_rdev) == minor)
-			return 0;
-		sleep(1);
-	}
-
-	log_error("cannot find device %s with minor %d", path, minor);
-	return -1;
-}
-
-int setup_misc_devices(void)
-{
-	int rv;
-
-	find_minors();
-
-	if (plock_minor) {
-		rv = find_udev_device("/dev/misc/dlm_plock", plock_minor);
-		if (rv < 0)
-			return rv;
-		log_debug("found /dev/misc/dlm_plock minor %u",
-			  plock_minor);
-	}
-
-	if (!plock_minor && old_plock_minor) {
-		rv = find_udev_device("/dev/misc/lock_dlm_plock",
-				      old_plock_minor);
-		if (rv < 0)
-			return rv;
-		log_debug("found /dev/misc/lock_dlm_plock minor %u",
-			  old_plock_minor);
-	}
-
-	return 0;
-}
-
diff --git a/group/gfs_controld/util.c b/group/gfs_controld/util.c
deleted file mode 100644
index a0650fe..0000000
--- a/group/gfs_controld/util.c
+++ /dev/null
@@ -1,288 +0,0 @@
-#include "gfs_daemon.h"
-#include "config.h"
-#include "libfenced.h"
-
-void update_flow_control_status(void)
-{
-	cpg_flow_control_state_t flow_control_state;
-	cpg_error_t error;
-
-	error = cpg_flow_control_state_get(cpg_handle_daemon, &flow_control_state);
-	if (error != CPG_OK) {
-		log_error("cpg_flow_control_state_get %d", error);
-		return;
-	}
-
-	if (flow_control_state == CPG_FLOW_CONTROL_ENABLED) {
-		if (libcpg_flow_control_on == 0) {
-			log_debug("flow control on");
-		}
-		libcpg_flow_control_on = 1;
-	} else {
-		if (libcpg_flow_control_on) {
-			log_debug("flow control off");
-		}
-		libcpg_flow_control_on = 0;
-	}
-}
-
-int we_are_in_fence_domain(void)
-{
-	struct fenced_node nodeinfo;
-	int rv;
-
-	memset(&nodeinfo, 0, sizeof(nodeinfo));
-
-	rv = fenced_node_info(our_nodeid, &nodeinfo);
-	if (rv < 0) {
-		log_debug("fenced_node_info error %d", rv);
-		return 0;
-	}
-
-	if (nodeinfo.member)
-		return 1;
-	return 0;
-}
-
-#define SYSFS_DIR       "/sys/fs"
-#define SYSFS_BUFLEN    64
-
-int set_sysfs(struct mountgroup *mg, char *field, int val)
-{
-	char fname[PATH_MAX];
-	char out[SYSFS_BUFLEN];
-	int rv, fd;
-
-	snprintf(fname, PATH_MAX, "%s/%s/%s/lock_module/%s",
-		 SYSFS_DIR, mg->mount_args.type, mg->mount_args.table, field);
-
-	log_group(mg, "set %s to %d", fname, val);
-
-	fd = open(fname, O_RDWR);
-	if (fd < 0) {
-		log_group(mg, "set open %s error %d %d", fname, fd, errno);
-		return -1;
-	}
-
-	mg->got_kernel_mount = 1;
-
-	memset(out, 0, sizeof(out));
-	sprintf(out, "%d", val);
-
-	rv = write(fd, out, strlen(out));
-
-	close(fd);
-
-	if (rv)
-		rv = 0;
-	return rv;
-}
-
-static int get_sysfs(struct mountgroup *mg, char *field, char *buf, int len)
-{
-	char fname[PATH_MAX], *p;
-	int fd, rv;
-
-	snprintf(fname, PATH_MAX, "%s/%s/%s/lock_module/%s",
-		 SYSFS_DIR, mg->mount_args.type, mg->mount_args.table, field);
-
-	fd = open(fname, O_RDONLY);
-	if (fd < 0) {
-		log_group(mg, "get open %s error %d %d", fname, fd, errno);
-		return -1;
-	}
-
-	mg->got_kernel_mount = 1;
-
-	rv = read(fd, buf, len);
-	if (rv < 0)
-		log_error("read %s error %d %d", fname, rv, errno);
-	else {
-		rv = 0;
-		p = strchr(buf, '\n');
-		if (p)
-			*p = '\0';
-	}
-
-	close(fd);
-	return rv;
-}
-
-int read_sysfs_int(struct mountgroup *mg, char *field, int *val_out)
-{
-	char buf[SYSFS_BUFLEN];
-	int rv;
-
-	memset(buf, 0, sizeof(buf));
-
-	rv = get_sysfs(mg, field, buf, sizeof(buf));
-	if (rv < 0)
-		return rv;
-
-	*val_out = atoi(buf);
-	return 0;
-}
-
-int run_dmsetup_suspend(struct mountgroup *mg, char *dev)
-{
-	struct sched_param sched_param;
-	char buf[PATH_MAX];
-	pid_t pid;
-	int i, rv;
-
-	memset(buf, 0, sizeof(buf));
-	rv = readlink(dev, buf, PATH_MAX);
-	if (rv < 0)
-		strncpy(buf, dev, sizeof(buf));
-
-	log_group(mg, "run_dmsetup_suspend %s (orig %s)", buf, dev);
-
-	pid = fork();
-	if (pid < 0)
-		return -1;
-
-	if (pid) {
-		mg->dmsetup_wait = 1;
-		mg->dmsetup_pid = pid;
-		return 0;
-	} else {
-		sched_param.sched_priority = 0;
-		sched_setscheduler(0, SCHED_OTHER, &sched_param);
-
-		for (i = 0; i < 50; i++)
-			close(i);
-
-		execlp("dmsetup", "dmsetup", "suspend", buf, NULL);
-		exit(EXIT_FAILURE);
-	}
-	return -1;
-}
-
-static void dmsetup_suspend_done(struct mountgroup *mg, int rv)
-{
-	log_group(mg, "dmsetup_suspend_done result %d", rv);
-	mg->dmsetup_wait = 0;
-	mg->dmsetup_pid = 0;
-
-	if (!rv) {
-		mg->withdraw_suspend = 1;
-		if (mg->old_group_mode)
-			send_withdraw_old(mg);
-		else
-			send_withdraw(mg);
-	}
-}
-
-void update_dmsetup_wait(void)
-{
-	struct mountgroup *mg;
-	int status;
-	int waiting = 0;
-	pid_t pid;
-
-	list_for_each_entry(mg, &mountgroups, list) {
-		if (mg->dmsetup_wait) {
-			pid = waitpid(mg->dmsetup_pid, &status, WNOHANG);
-
-			/* process not exited yet */
-			if (!pid) {
-				waiting++;
-				continue;
-			}
-
-			if (pid < 0) {
-				log_error("update_dmsetup_wait %s: waitpid %d "
-					  "error %d", mg->name,
-					  mg->dmsetup_pid, errno);
-				dmsetup_suspend_done(mg, -2);
-				continue;
-			}
-
-			/* process exited */
-
-			if (!WIFEXITED(status) || WEXITSTATUS(status))
-				dmsetup_suspend_done(mg, -1);
-			else
-				dmsetup_suspend_done(mg, 0);
-		}
-	}
-
-	if (!waiting) {
-		dmsetup_wait = 0;
-		log_debug("dmsetup_wait off");
-	}
-}
-
-static int ignore_nolock(char *sysfs_dir, char *table)
-{
-	char path[PATH_MAX];
-	int fd;
-
-	memset(path, 0, PATH_MAX);
-
-	snprintf(path, PATH_MAX, "%s/%s/lock_module/proto_name",
-		 sysfs_dir, table);
-
-	/* lock_nolock doesn't create the "lock_module" dir at all,
-	   so we'll fail to open this */
-
-	fd = open(path, O_RDONLY);
-	if (fd < 0)
-		return 1;
-
-	close(fd);
-	return 0;
-}
-
-/* This is for the case where gfs_controld exits/fails, abandoning gfs
-   filesystems in the kernel, and then gfs_controld is restarted.  When
-   gfs_controld exits and abandons lockspaces, that node needs to be
-   rebooted to clear the uncontrolled filesystems from the kernel. */
-
-int check_uncontrolled_filesystems(void)
-{
-	DIR *d;
-	struct dirent *de;
-	int count = 0;
-
-	d = opendir("/sys/fs/gfs/");
-	if (!d)
-		goto gfs2;
-
-	while ((de = readdir(d))) {
-		if (de->d_name[0] == '.')
-			continue;
-
-		if (ignore_nolock("/sys/fs/gfs/", de->d_name))
-			continue;
-
-		log_error("found uncontrolled gfs fs %s", de->d_name);
-		count++;
-	}
-	closedir(d);
-
- gfs2:
-	d = opendir("/sys/fs/gfs2/");
-	if (!d)
-		goto out;
-
-	while ((de = readdir(d))) {
-		if (de->d_name[0] == '.')
-			continue;
-
-		if (ignore_nolock("/sys/fs/gfs2/", de->d_name))
-			continue;
-
-		log_error("found uncontrolled gfs2 fs %s", de->d_name);
-		count++;
-	}
-	closedir(d);
-
- out:
-	if (count) {
-		kick_node_from_cluster(our_nodeid);
-		return -1;
-	}
-	return 0;
-}
-
diff --git a/group/include/linux_endian.h b/group/include/linux_endian.h
deleted file mode 100644
index 43089d2..0000000
--- a/group/include/linux_endian.h
+++ /dev/null
@@ -1,68 +0,0 @@
-#ifndef __LINUX_ENDIAN_DOT_H__
-#define __LINUX_ENDIAN_DOT_H__
-
-
-#include <endian.h>
-#include <byteswap.h>
-
-
-/*  I'm not sure which versions of alpha glibc/gcc are broken,
-    so fix all of them.  */
-#ifdef __alpha__
-#undef bswap_64
-static __inline__ unsigned long bswap_64(unsigned long x)
-{
-  unsigned int h = x >> 32;
-  unsigned int l = x;
-
-  h = bswap_32(h);
-  l = bswap_32(l);
-
-  return ((unsigned long)l << 32) | h;
-}
-#endif  /*  __alpha__  */
-
-
-#if __BYTE_ORDER == __BIG_ENDIAN
-
-#define be16_to_cpu(x) (x)
-#define be32_to_cpu(x) (x)
-#define be64_to_cpu(x) (x)
-
-#define cpu_to_be16(x) (x)
-#define cpu_to_be32(x) (x)
-#define cpu_to_be64(x) (x)
-
-#define le16_to_cpu(x) (bswap_16((x)))
-#define le32_to_cpu(x) (bswap_32((x)))
-#define le64_to_cpu(x) (bswap_64((x)))
-
-#define cpu_to_le16(x) (bswap_16((x)))
-#define cpu_to_le32(x) (bswap_32((x)))
-#define cpu_to_le64(x) (bswap_64((x)))
-
-#endif  /*  __BYTE_ORDER == __BIG_ENDIAN  */
-
-
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-
-#define be16_to_cpu(x) (bswap_16((x)))
-#define be32_to_cpu(x) (bswap_32((x)))
-#define be64_to_cpu(x) (bswap_64((x)))
-
-#define cpu_to_be16(x) (bswap_16((x)))
-#define cpu_to_be32(x) (bswap_32((x)))
-#define cpu_to_be64(x) (bswap_64((x))) 
-
-#define le16_to_cpu(x) (x)
-#define le32_to_cpu(x) (x)
-#define le64_to_cpu(x) (x)
-
-#define cpu_to_le16(x) (x)
-#define cpu_to_le32(x) (x)
-#define cpu_to_le64(x) (x)
-
-#endif  /*  __BYTE_ORDER == __LITTLE_ENDIAN  */
-
-
-#endif  /*  __LINUX_ENDIAN_DOT_H__  */
diff --git a/group/include/list.h b/group/include/list.h
deleted file mode 100644
index 8100cbc..0000000
--- a/group/include/list.h
+++ /dev/null
@@ -1,336 +0,0 @@
-/* Copied from include/linux/list.h */
-
-#ifndef _LINUX_LIST_H
-#define _LINUX_LIST_H
-
-/**
- * container_of - cast a member of a structure out to the containing structure
- *
- * @ptr:        the pointer to the member.
- * @type:       the type of the container struct this is embedded in.
- * @member:     the name of the member within the struct.
- *
- */
-#define container_of(ptr, type, member) ({                      \
-	const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
-	(type *)( (char *)__mptr - offsetof(type,member) );})
-
-
-/*
- * These are non-NULL pointers that will result in page faults
- * under normal circumstances, used to verify that nobody uses
- * non-initialized list entries.
- */
-#define LIST_POISON1  ((void *) 0x00100100)
-#define LIST_POISON2  ((void *) 0x00200200)
-
-/*
- * Simple doubly linked list implementation.
- *
- * Some of the internal functions ("__xxx") are useful when
- * manipulating whole lists rather than single entries, as
- * sometimes we already know the next/prev entries and we can
- * generate better code by using them directly rather than
- * using the generic single-entry routines.
- */
-
-struct list_head {
-	struct list_head *next, *prev;
-};
-
-#define LIST_HEAD_INIT(name) { &(name), &(name) }
-
-#define LIST_HEAD(name) \
-	struct list_head name = LIST_HEAD_INIT(name)
-
-#define INIT_LIST_HEAD(ptr) do { \
-	(ptr)->next = (ptr); (ptr)->prev = (ptr); \
-} while (0)
-
-/*
- * Insert a new entry between two known consecutive entries. 
- *
- * This is only for internal list manipulation where we know
- * the prev/next entries already!
- */
-static inline void __list_add(struct list_head *new,
-			      struct list_head *prev,
-			      struct list_head *next)
-{
-	next->prev = new;
-	new->next = next;
-	new->prev = prev;
-	prev->next = new;
-}
-
-/**
- * list_add - add a new entry
- * @new: new entry to be added
- * @head: list head to add it after
- *
- * Insert a new entry after the specified head.
- * This is good for implementing stacks.
- */
-static inline void list_add(struct list_head *new, struct list_head *head)
-{
-	__list_add(new, head, head->next);
-}
-
-/**
- * list_add_tail - add a new entry
- * @new: new entry to be added
- * @head: list head to add it before
- *
- * Insert a new entry before the specified head.
- * This is useful for implementing queues.
- */
-static inline void list_add_tail(struct list_head *new, struct list_head *head)
-{
-	__list_add(new, head->prev, head);
-}
-
-/*
- * Delete a list entry by making the prev/next entries
- * point to each other.
- *
- * This is only for internal list manipulation where we know
- * the prev/next entries already!
- */
-static inline void __list_del(struct list_head * prev, struct list_head * next)
-{
-	next->prev = prev;
-	prev->next = next;
-}
-
-/**
- * list_del - deletes entry from list.
- * @entry: the element to delete from the list.
- * Note: list_empty on entry does not return true after this, the entry is
- * in an undefined state.
- */
-static inline void list_del(struct list_head *entry)
-{
-	__list_del(entry->prev, entry->next);
-	entry->next = LIST_POISON1;
-	entry->prev = LIST_POISON2;
-}
-
-/**
- * list_del_init - deletes entry from list and reinitialize it.
- * @entry: the element to delete from the list.
- */
-static inline void list_del_init(struct list_head *entry)
-{
-	__list_del(entry->prev, entry->next);
-	INIT_LIST_HEAD(entry); 
-}
-
-/**
- * list_move - delete from one list and add as another's head
- * @list: the entry to move
- * @head: the head that will precede our entry
- */
-static inline void list_move(struct list_head *list, struct list_head *head)
-{
-        __list_del(list->prev, list->next);
-        list_add(list, head);
-}
-
-/**
- * list_move_tail - delete from one list and add as another's tail
- * @list: the entry to move
- * @head: the head that will follow our entry
- */
-static inline void list_move_tail(struct list_head *list,
-				  struct list_head *head)
-{
-        __list_del(list->prev, list->next);
-        list_add_tail(list, head);
-}
-
-/**
- * list_empty - tests whether a list is empty
- * @head: the list to test.
- */
-static inline int list_empty(const struct list_head *head)
-{
-	return head->next == head;
-}
-
-/**
- * list_empty_careful - tests whether a list is
- * empty _and_ checks that no other CPU might be
- * in the process of still modifying either member
- *
- * NOTE: using list_empty_careful() without synchronization
- * can only be safe if the only activity that can happen
- * to the list entry is list_del_init(). Eg. it cannot be used
- * if another CPU could re-list_add() it.
- *
- * @head: the list to test.
- */
-static inline int list_empty_careful(const struct list_head *head)
-{
-	struct list_head *next = head->next;
-	return (next == head) && (next == head->prev);
-}
-
-static inline void __list_splice(struct list_head *list,
-				 struct list_head *head)
-{
-	struct list_head *first = list->next;
-	struct list_head *last = list->prev;
-	struct list_head *at = head->next;
-
-	first->prev = head;
-	head->next = first;
-
-	last->next = at;
-	at->prev = last;
-}
-
-/**
- * list_splice - join two lists
- * @list: the new list to add.
- * @head: the place to add it in the first list.
- */
-static inline void list_splice(struct list_head *list, struct list_head *head)
-{
-	if (!list_empty(list))
-		__list_splice(list, head);
-}
-
-/**
- * list_splice_init - join two lists and reinitialise the emptied list.
- * @list: the new list to add.
- * @head: the place to add it in the first list.
- *
- * The list at @list is reinitialised
- */
-static inline void list_splice_init(struct list_head *list,
-				    struct list_head *head)
-{
-	if (!list_empty(list)) {
-		__list_splice(list, head);
-		INIT_LIST_HEAD(list);
-	}
-}
-
-/**
- * list_entry - get the struct for this entry
- * @ptr:	the &struct list_head pointer.
- * @type:	the type of the struct this is embedded in.
- * @member:	the name of the list_struct within the struct.
- */
-#define list_entry(ptr, type, member) \
-	container_of(ptr, type, member)
-
-/**
- * list_first_entry - get the first element from a list
- * @ptr:        the list head to take the element from.
- * @type:       the type of the struct this is embedded in.
- * @member:     the name of the list_struct within the struct.
- *
- * Note, that list is expected to be not empty.
- */
-#define list_first_entry(ptr, type, member) \
-	list_entry((ptr)->next, type, member)
-
-/**
- * list_for_each	-	iterate over a list
- * @pos:	the &struct list_head to use as a loop counter.
- * @head:	the head for your list.
- */
-#define list_for_each(pos, head) \
-	for (pos = (head)->next; pos != (head); pos = pos->next)
-
-/**
- * __list_for_each	-	iterate over a list
- * @pos:	the &struct list_head to use as a loop counter.
- * @head:	the head for your list.
- *
- * This variant differs from list_for_each() in that it's the
- * simplest possible list iteration code, no prefetching is done.
- * Use this for code that knows the list to be very short (empty
- * or 1 entry) most of the time.
- */
-#define __list_for_each(pos, head) \
-	for (pos = (head)->next; pos != (head); pos = pos->next)
-
-/**
- * list_for_each_prev	-	iterate over a list backwards
- * @pos:	the &struct list_head to use as a loop counter.
- * @head:	the head for your list.
- */
-#define list_for_each_prev(pos, head) \
-	for (pos = (head)->prev; pos != (head); pos = pos->prev)
-        	
-/**
- * list_for_each_safe	-	iterate over a list safe against removal of list entry
- * @pos:	the &struct list_head to use as a loop counter.
- * @n:		another &struct list_head to use as temporary storage
- * @head:	the head for your list.
- */
-#define list_for_each_safe(pos, n, head) \
-	for (pos = (head)->next, n = pos->next; pos != (head); \
-		pos = n, n = pos->next)
-
-/**
- * list_for_each_entry	-	iterate over list of given type
- * @pos:	the type * to use as a loop counter.
- * @head:	the head for your list.
- * @member:	the name of the list_struct within the struct.
- */
-#define list_for_each_entry(pos, head, member)				\
-	for (pos = list_entry((head)->next, typeof(*pos), member);	\
-	     &pos->member != (head); 					\
-	     pos = list_entry(pos->member.next, typeof(*pos), member))
-
-/**
- * list_for_each_entry_reverse - iterate backwards over list of given type.
- * @pos:	the type * to use as a loop counter.
- * @head:	the head for your list.
- * @member:	the name of the list_struct within the struct.
- */
-#define list_for_each_entry_reverse(pos, head, member)			\
-	for (pos = list_entry((head)->prev, typeof(*pos), member);	\
-	     &pos->member != (head); 					\
-	     pos = list_entry(pos->member.prev, typeof(*pos), member))
-
-/**
- * list_prepare_entry - prepare a pos entry for use as a start point in
- *			list_for_each_entry_continue
- * @pos:	the type * to use as a start point
- * @head:	the head of the list
- * @member:	the name of the list_struct within the struct.
- */
-#define list_prepare_entry(pos, head, member) \
-	((pos) ? : list_entry(head, typeof(*pos), member))
-
-/**
- * list_for_each_entry_continue -	iterate over list of given type
- *			continuing after existing point
- * @pos:	the type * to use as a loop counter.
- * @head:	the head for your list.
- * @member:	the name of the list_struct within the struct.
- */
-#define list_for_each_entry_continue(pos, head, member) 		\
-	for (pos = list_entry(pos->member.next, typeof(*pos), member);  \
-	     &pos->member != (head);					\
-	     pos = list_entry(pos->member.next, typeof(*pos), member))
-
-/**
- * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
- * @pos:	the type * to use as a loop counter.
- * @n:		another type * to use as temporary storage
- * @head:	the head for your list.
- * @member:	the name of the list_struct within the struct.
- */
-#define list_for_each_entry_safe(pos, n, head, member)			\
-	for (pos = list_entry((head)->next, typeof(*pos), member),	\
-		n = list_entry(pos->member.next, typeof(*pos), member);	\
-	     &pos->member != (head); 					\
-	     pos = n, n = list_entry(n->member.next, typeof(*n), member))
-
-
-#endif
diff --git a/group/lib/Makefile b/group/lib/Makefile
deleted file mode 100644
index ca1e2c6..0000000
--- a/group/lib/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-TARGET=libgroup
-
-MAKESTATICLIB = 1
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/libs.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-CFLAGS += -fPIC
-CFLAGS += -I$(S) -I$(S)/../daemon
-CFLAGS += -I${incdir}
diff --git a/group/lib/libgroup.c b/group/lib/libgroup.c
deleted file mode 100644
index c86ac25..0000000
--- a/group/lib/libgroup.c
+++ /dev/null
@@ -1,524 +0,0 @@
-#include <sys/types.h>
-#include <sys/un.h>
-#include <inttypes.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <netinet/in.h>
-#include <string.h>
-#include <errno.h>
-#include <ctype.h>
-
-#include "groupd.h"
-#include "libgroup.h"
-
-#define LIBGROUP_MAGIC	0x67727570
-#define MAXARGS		100  /* FIXME */
-
-#define VALIDATE_HANDLE(h) \
-do { \
-	if (!(h) || (h)->magic != LIBGROUP_MAGIC) { \
-		errno = EINVAL; \
-		return -1; \
-	} \
-} while (0)
-
-enum {
-	DO_STOP = 1,
-	DO_START = 2,
-	DO_FINISH = 3,
-	DO_TERMINATE = 4,
-	DO_SET_ID = 5,
-	DO_DELIVER = 6,
-};
-
-
-/* if there's more data beyond the number of args we want, the return value
-   points to it */
-
-static char *get_args(char *buf, int *argc, char **argv, char sep, int want)
-{
-	char *p = buf, *rp = NULL;
-	int i;
-
-	argv[0] = p;
-
-	for (i = 1; i < MAXARGS; i++) {
-		p = strchr(buf, sep);
-		if (!p)
-			break;
-		*p = '\0';
-
-		if (want == i) {
-			rp = p + 1;
-			break;
-		}
-
-		argv[i] = p + 1;
-		buf = p + 1;
-	}
-	*argc = i;
-
-	/* we ended by hitting \0, return the point following that */
-	if (!rp)
-		rp = strchr(buf, '\0') + 1;
-
-	return rp;
-}
-
-static void get_nodeids(char *buf, int memb_count, int *nodeids)
-{
-	char *p;
-	int i, count = 0;
-
-	for (i = 0; ; i++) {
-		if (isdigit(buf[i]))
-			break;
-	}
-
-	buf = &buf[i];
-
-	for (i = 0; i < memb_count; i++) {
-
-		nodeids[count++] = atoi(buf);
-
-		p = strchr(buf, ' ');
-		if (!p)
-			break;
-
-		buf = p + 1;
-	}
-}
-
-static int get_action(char *buf)
-{
-	char act[16];
-	int i;
-
-	memset(act, 0, 16);
-
-	for (i = 0; i < 16; i++) {
-		if (isalnum(buf[i]))
-			act[i] = buf[i];
-		else
-			break;
-	}
-
-	if (!strncmp(act, "stop", 16))
-		return DO_STOP;
-
-	if (!strncmp(act, "start", 16))
-		return DO_START;
-
-	if (!strncmp(act, "finish", 16))
-		return DO_FINISH;
-
-	if (!strncmp(act, "terminate", 16))
-		return DO_TERMINATE;
-
-	if (!strncmp(act, "setid", 16))
-		return DO_SET_ID;
-
-	if (!strncmp(act, "deliver", 16))
-		return DO_DELIVER;
-
-	return -1;
-}
-
-static int do_write(int fd, void *buf, size_t count)
-{
-	int rv, off = 0;
-
- retry:
-	rv = write(fd, buf + off, count);
-	if (rv == -1 && errno == EINTR)
-		goto retry;
-	if (rv < 0)
-		return rv;
-
-	if (rv != count) {
-		count -= rv;
-		off += rv;
-		goto retry;
-	}
-	return 0;
-}
-
-static int do_read(int fd, void *buf, size_t count)
-{
-	int rv, off = 0;
-
-	while (off < count) {
-		rv = read(fd, buf + off, count - off);
-		if (rv == 0)
-			return -1;
-		if (rv == -1 && errno == EINTR)
-			continue;
-		if (rv == -1)
-			return -1;
-		off += rv;
-	}
-	return 0;
-}
-
-struct group_handle
-{
-	int magic;
-	int fd;
-	int level;
-	void *private;
-	group_callbacks_t cbs;
-	char prog_name[32];
-};
-
-static int _joinleave(group_handle_t handle, char *name, char *cmd)
-{
-	char buf[GROUPD_MSGLEN];
-	struct group_handle *h = (struct group_handle *) handle;
-	VALIDATE_HANDLE(h);
-
-	memset(buf, 0, sizeof(buf));
-	snprintf(buf, sizeof(buf), "%s %s", cmd, name);
-
-	return do_write(h->fd, buf, GROUPD_MSGLEN);
-}
-
-int group_join(group_handle_t handle, char *name)
-{
-	return _joinleave(handle, name, "join");
-}
-
-int group_leave(group_handle_t handle, char *name)
-{
-	return _joinleave(handle, name, "leave");
-}
-
-int group_stop_done(group_handle_t handle, char *name)
-{
-	char buf[GROUPD_MSGLEN];
-	struct group_handle *h = (struct group_handle *) handle;
-	VALIDATE_HANDLE(h);
-
-	memset(buf, 0, sizeof(buf));
-	snprintf(buf, sizeof(buf), "stop_done %s", name);
-
-	return do_write(h->fd, buf, GROUPD_MSGLEN);
-}
-
-int group_start_done(group_handle_t handle, char *name, int event_nr)
-{
-	char buf[GROUPD_MSGLEN];
-	struct group_handle *h = (struct group_handle *) handle;
-	VALIDATE_HANDLE(h);
-
-	memset(buf, 0, sizeof(buf));
-	snprintf(buf, sizeof(buf), "start_done %s %d", name, event_nr);
-
-	return do_write(h->fd, buf, GROUPD_MSGLEN);
-}
-
-int group_send(group_handle_t handle, char *name, int len, char *data)
-{
-	char buf[GROUPD_MSGLEN];
-	int rv;
-	struct group_handle *h = (struct group_handle *) handle;
-	VALIDATE_HANDLE(h);
-
-	if (len > 2048 || len <= 0)
-		return -EINVAL;
-
-	memset(buf, 0, sizeof(buf));
-	rv = snprintf(buf, sizeof(buf), "send %s %d", name, len);
-	memcpy(buf + rv + 1, data, len);
-
-	return do_write(h->fd, buf, GROUPD_MSGLEN);
-}
-
-static int connect_groupd(void)
-{
-	struct sockaddr_un sun;
-	socklen_t addrlen;
-	int rv, fd;
-
-	fd = socket(PF_UNIX, SOCK_STREAM, 0);
-	if (fd < 0)
-		goto out;
-
-	memset(&sun, 0, sizeof(sun));
-	sun.sun_family = AF_UNIX;
-	strcpy(&sun.sun_path[1], GROUPD_SOCK_PATH);
-	addrlen = sizeof(sa_family_t) + strlen(sun.sun_path+1) + 1;
-
-	rv = connect(fd, (struct sockaddr *) &sun, addrlen);
-	if (rv < 0) {
-		close(fd);
-		fd = rv;
-	}
- out:
-	return fd;
-}
-
-group_handle_t group_init(void *private, char *prog_name, int level,
-			  group_callbacks_t *cbs, int timeout)
-{
-	struct group_handle *h;
-	char buf[GROUPD_MSGLEN];
-	int rv, saved_errno, i;
-
-	h = malloc(sizeof(struct group_handle));
-	if (!h)
-		return NULL;
-
-	h->magic = LIBGROUP_MAGIC;
-	h->private = private;
-	h->cbs = *cbs;
-	h->level = level;
-	strncpy(h->prog_name, prog_name, 32);
-
-	for (i = 0; !timeout || i < timeout * 2; i++) {
-		h->fd = connect_groupd();
-		if (h->fd > 0 || !timeout)
-			break;
-		usleep(500000);
-	}
-
-	if (h->fd <= 0)
-		goto fail;
-
-	memset(buf, 0, sizeof(buf));
-	snprintf(buf, sizeof(buf), "setup %s %d", prog_name, level);
-
-	rv = do_write(h->fd, &buf, GROUPD_MSGLEN);
-	if (rv < 0)
-		goto fail;
-
-	return (group_handle_t) h;
-
- fail:
-	saved_errno = errno;
-	close(h->fd);
-	free(h);
-	h = NULL;
-	errno = saved_errno;
-	return NULL;
-}
-
-int group_exit(group_handle_t handle)
-{
-	struct group_handle *h = (struct group_handle *) handle;
-	VALIDATE_HANDLE(h);
-	h->magic = 0;
-	close(h->fd);
-	free(h);
-	return 0;
-}
-
-int group_get_fd(group_handle_t handle)
-{
-	struct group_handle *h = (struct group_handle *) handle;
-	VALIDATE_HANDLE(h);
-	return h->fd;
-}
-
-/* Format of string messages we receive from groupd:
-
-   "stop <name>"
-   
-      name = the name of the group (same for rest)
-
-   "start <name> <event_nr> <type> <memb_count> <memb0> <memb1>..."
-
-      event_nr = used to later match finish/terminate
-      type = 1/GROUP_NODE_FAILED, 2/GROUP_NODE_JOIN, 3/GROUP_NODE_LEAVE
-      memb_count = the number of group members
-      memb0... = the nodeids of the group members
-
-   "finish <name> <event_nr>"
-   
-      event_nr = matches the start event that's finishing
-
-   "terminate <name> <event_nr>"
-
-      event_nr = matches the start event that's being canceled
-
-   "setid <name> <id>"
-
-      id = the global id of the group
-
-   "deliver <name> <nodeid> <len>"<data>
-
-      nodeid = who sent the message
-      len = length of the message
-      data = the message
-*/
-
-int group_dispatch(group_handle_t handle)
-{
-	char buf[GROUPD_MSGLEN], *argv[MAXARGS];
-	char *p;
-	int act, argc, rv, count, *nodeids;
-	struct group_handle *h = (struct group_handle *) handle;
-	VALIDATE_HANDLE(h);
-
-	memset(buf, 0, sizeof(buf));
-
-	rv = do_read(h->fd, &buf, GROUPD_MSGLEN);
-	if (rv < 0)
-		goto out;
-
-	act = get_action(buf);
-
-	switch (act) {
-
-	case DO_STOP:
-		get_args(buf, &argc, argv, ' ', 2);
-
-		h->cbs.stop(h, h->private, argv[1]);
-		break;
-
-	case DO_START:
-		p = get_args(buf, &argc, argv, ' ', 5);
-
-		count = atoi(argv[4]);
-		nodeids = malloc(count * sizeof(int));
-		if (!nodeids) {
-			rv = -ENOMEM;
-			goto out;
-		}
-		get_nodeids(p, count, nodeids);
-
-		h->cbs.start(h, h->private, argv[1], atoi(argv[2]),
-			     atoi(argv[3]), count, nodeids);
-
-		free(nodeids);
-		break;
-
-	case DO_FINISH:
-		get_args(buf, &argc, argv, ' ', 3);
-
-		h->cbs.finish(h, h->private, argv[1], atoi(argv[2]));
-		break;
-
-	case DO_TERMINATE:
-		get_args(buf, &argc, argv, ' ', 3);
-
-		/* FIXME: why aren't we passing event_nr, argv[2], through? */
-
-		h->cbs.terminate(h, h->private, argv[1]);
-		break;
-
-	case DO_SET_ID:
-		get_args(buf, &argc, argv, ' ', 3);
-
-		h->cbs.set_id(h, h->private, argv[1],
-			      (unsigned int) strtoul(argv[2], NULL, 10));
-		break;
-
-	case DO_DELIVER:
-		p = get_args(buf, &argc, argv, ' ', 4);
-
-		h->cbs.deliver(h, h->private, argv[1], atoi(argv[2]),
-			       atoi(argv[3]), p);
-		break;
-	}
-
-	rv = 0;
- out:
-	return rv;
-}
-
-int group_get_groups(int max, int *count, group_data_t *data)
-{
-	char buf[GROUPD_MSGLEN];
-	group_data_t dbuf, empty;
-	int fd, rv;
-
-	*count = 0;
-
-	fd = connect_groupd();
-	if (fd < 0)
-		return fd;
-
-	memset(buf, 0, sizeof(buf));
-	snprintf(buf, sizeof(buf), "get_groups %d", max);
-
-	rv = do_write(fd, &buf, GROUPD_MSGLEN);
-	if (rv < 0)
-		goto out;
-
-	memset(&empty, 0, sizeof(empty));
-
-	while (1) {
-		memset(&dbuf, 0, sizeof(dbuf));
-
-		rv = do_read(fd, &dbuf, sizeof(group_data_t));
-		if (rv < 0)
-			break;
-
-		if (!memcmp(&dbuf, &empty, sizeof(group_data_t))) {
-			rv = 0;
-			break;
-		} else {
-			memcpy(&data[*count], &dbuf, sizeof(group_data_t));
-			(*count)++;
-		}
-	}
- out:
-	close(fd);
-	return rv;
-}
-
-int group_get_group(int level, const char *name, group_data_t *data)
-{
-	char buf[GROUPD_MSGLEN];
-	char data_buf[sizeof(group_data_t)];
-	int fd, rv;
-
-	fd = connect_groupd();
-	if (fd < 0)
-		 return fd;
-
-	memset(buf, 0, sizeof(buf));
-	snprintf(buf, sizeof(buf), "get_group %d %s", level, name);
-
-	rv = do_write(fd, &buf, GROUPD_MSGLEN);
-	if (rv < 0)
-		 goto out;
-
-	rv = do_read(fd, &data_buf, sizeof(data_buf));
-	if (rv < 0)
-		 goto out;
-
-	memcpy(data, data_buf, sizeof(group_data_t));
-	rv = 0;
- out:
-	close(fd);
-	return rv;
-}
-
-int group_get_version(int *version)
-{
-	char buf[GROUPD_MSGLEN];
-	int fd, rv;
-
-	fd = connect_groupd();
-	if (fd < 0)
-		 return fd;
-
-	memset(buf, 0, sizeof(buf));
-	snprintf(buf, sizeof(buf), "get_version");
-
-	rv = do_write(fd, &buf, GROUPD_MSGLEN);
-	if (rv < 0)
-		 goto out;
-
-	rv = do_read(fd, version, sizeof(int));
-	if (rv < 0)
-		 goto out;
-	rv = 0;
- out:
-	close(fd);
-	return rv;
-}
-
diff --git a/group/lib/libgroup.h b/group/lib/libgroup.h
deleted file mode 100644
index 82ef7e1..0000000
--- a/group/lib/libgroup.h
+++ /dev/null
@@ -1,81 +0,0 @@
-#ifndef _LIBGROUP_H_
-#define _LIBGROUP_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define MAX_GROUP_MEMBERS	256
-#define MAX_GROUP_NAME_LEN	32
-
-/* these need to match what's in groupd.h */
-#define GROUP_NODE_FAILED	1
-#define GROUP_NODE_JOIN		2
-#define GROUP_NODE_LEAVE	3
-
-typedef void *group_handle_t;
-
-typedef void (*group_stop_t)(group_handle_t h, void *priv, char *name);
-typedef void (*group_start_t)(group_handle_t h, void *priv, char *name,
-			      int event_nr, int type, int member_count,
-			      int *members);
-typedef void (*group_finish_t)(group_handle_t h, void *priv, char *name,
-			       int event_nr);
-typedef void (*group_terminate_t)(group_handle_t h, void *priv, char *name);
-typedef void (*group_set_id_t)(group_handle_t h, void *priv, char *name,
-			       unsigned int id);
-typedef void (*group_deliver_t)(group_handle_t h, void *priv, char *name,
-			        int nodeid, int len, char *buf);
-
-typedef struct {
-	group_stop_t stop;
-	group_start_t start;
-	group_finish_t finish;
-	group_terminate_t terminate;
-	group_set_id_t set_id;
-	group_deliver_t deliver;
-} group_callbacks_t;
-
-group_handle_t group_init(void *priv, char *prog_name, int level, group_callbacks_t *cbs, int timeout);
-int group_exit(group_handle_t handle);
-
-int group_join(group_handle_t handle, char *name);
-int group_leave(group_handle_t handle, char *name);
-int group_stop_done(group_handle_t handle, char *name);
-int group_start_done(group_handle_t handle, char *name, int event_nr);
-int group_get_fd(group_handle_t handle);
-int group_dispatch(group_handle_t handle);
-int group_send(group_handle_t handle, char *name, int len, char *buf);
-
-
-/*
- * Querying for group information
- */
-
-typedef struct group_data {
-	char client_name[32+1];
-	char name[MAX_GROUP_NAME_LEN+1];
-	int level;
-	unsigned int id;
-	int member;
-	int member_count;
-	int members[MAX_GROUP_MEMBERS];
-	int event_state;
-	int event_nodeid;
-	int event_local_status;
-	uint64_t event_id;
-} group_data_t;
-
-/* These routines create their own temporary connection to groupd so they
-   don't interfere with dispatchable callback messages. */
-
-int group_get_groups(int max, int *count, group_data_t *data);
-int group_get_group(int level, const char *name, group_data_t *data);
-
-int group_get_version(int *version);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/group/libgfscontrol/Makefile b/group/libgfscontrol/Makefile
deleted file mode 100644
index fab27a2..0000000
--- a/group/libgfscontrol/Makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-TARGET= libgfscontrol
-
-MAKESTATICLIB = 1
-
-OBJS= main.o
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/libs.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-CFLAGS += -fPIC
-CFLAGS += -I$(S)/../../group/gfs_controld
-CFLAGS += -I${incdir}
diff --git a/group/libgfscontrol/libgfscontrol.h b/group/libgfscontrol/libgfscontrol.h
deleted file mode 100644
index e5bb969..0000000
--- a/group/libgfscontrol/libgfscontrol.h
+++ /dev/null
@@ -1,122 +0,0 @@
-#ifndef _LIBGFSCONTROL_H_
-#define _LIBGFSCONTROL_H_
-
-/* Maximum mountgroup name length, should match DLM_LOCKSPACE_LEN from
-   linux/dlmconstants.h.  The libcpg limit is larger at
-   CPG_MAX_NAME_LENGTH 128.  Our cpg name includes a "gfs:" prefix before
-   the mountgroup name. */
-
-#define GFS_MOUNTGROUP_LEN	64
-
-#define GFSC_DUMP_SIZE		(1024 * 1024)
-
-#define GFSC_NF_MEMBER			0x00000001 /* node is member in cg */
-#define GFSC_NF_START			0x00000002 /* start message recvd */
-#define GFSC_NF_DISALLOWED		0x00000004 /* node disallowed in cg */
-#define GFSC_NF_KERNEL_MOUNT_DONE	0x00000008
-#define GFSC_NF_KERNEL_MOUNT_ERROR	0x00000010
-#define GFSC_NF_READONLY		0x00000020
-#define GFSC_NF_SPECTATOR		0x00000040
-#define GFSC_NF_CHECK_DLM		0x00000080
-
-struct gfsc_node {
-	int nodeid;
-	int jid;
-	uint32_t flags;
-	uint32_t added_seq;
-	uint32_t removed_seq;
-	int failed_reason;
-};
-
-struct gfsc_change {
-	int member_count;
-	int joined_count;
-	int remove_count;
-	int failed_count;
-	int wait_condition;	/* 0 no, 1 fencing, 2 quorum, 3 fs */
-	int wait_messages;	/* 0 no, 1 yes */
-	uint32_t seq;
-	uint32_t combined_seq;
-};
-
-#define GFSC_MF_JOINING			0x00000001
-#define GFSC_MF_LEAVING			0x00000002
-#define GFSC_MF_KERNEL_STOPPED		0x00000004
-#define GFSC_MF_KERNEL_MOUNT_DONE	0x00000008
-#define GFSC_MF_KERNEL_MOUNT_ERROR	0x00000010
-#define GFSC_MF_FIRST_RECOVERY_NEEDED	0x00000020
-#define GFSC_MF_FIRST_RECOVERY_MSG	0x00000040
-#define GFSC_MF_LOCAL_RECOVERY_BUSY	0x00000080
-
-struct gfsc_mountgroup {
-	int group_mode;
-	struct gfsc_change cg_prev;	/* completed change (started_change) */
-	struct gfsc_change cg_next;	/* in-progress change (changes list) */
-	int journals_need_recovery;	/* count of jounals need_recovery */
-	uint32_t flags;
-	uint32_t global_id;
-	char name[GFS_MOUNTGROUP_LEN+1];
-};
-
-/* gfsc_mountgroup_nodes() types
-
-   MEMBERS: members in completed (prev) change,
-            zero if there's no completed (prev) change
-   NEXT:    members in in-progress (next) change,
-            zero if there's no in-progress (next) change
-   ALL:     NEXT + nonmembers if there's an in-progress (next) change,
-            MEMBERS + nonmembers if there's no in-progress (next) change, but
-            there is a completed (prev) change
-            nonmembers if there's no in-progress (next) or completed (prev)
-            change (possible?)
-
-   gfsc_node_info() returns info for in-progress (next) change, if one exists,
-   otherwise it returns info for completed (prev) change.
-*/
-
-#define GFSC_NODES_ALL		1
-#define GFSC_NODES_MEMBERS	2
-#define GFSC_NODES_NEXT		3
-
-int gfsc_dump_debug(char *buf);
-int gfsc_dump_plocks(char *name, char *buf);
-int gfsc_mountgroup_info(char *mgname, struct gfsc_mountgroup *mg);
-int gfsc_node_info(char *mgname, int nodeid, struct gfsc_node *node);
-int gfsc_mountgroups(int max, int *count, struct gfsc_mountgroup *mgs);
-int gfsc_mountgroup_nodes(char *mgname, int type, int max, int *count,
-			 struct gfsc_node *nodes);
-
-struct gfsc_mount_args {
-	char dir[PATH_MAX];
-	char type[PATH_MAX];
-	char proto[PATH_MAX];
-	char table[PATH_MAX];
-	char options[PATH_MAX];
-	char dev[PATH_MAX];
-	char hostdata[PATH_MAX];
-};
-
-/*
- * mount.gfs connects to gfs_controld,
- * mount.gfs tells gfs_controld to do a join or remount,
- * mount.gfs reads the result of the join or remount from gfs_controld,
- * mount.gfs tells gfs_controld the result of the mount(2),
- * mount.gfs disconnects from gfs_controld
- */
-
-int gfsc_fs_connect(void);
-int gfsc_fs_join(int fd, struct gfsc_mount_args *ma);
-int gfsc_fs_remount(int fd, struct gfsc_mount_args *ma);
-int gfsc_fs_result(int fd, int *result, struct gfsc_mount_args *ma);
-int gfsc_fs_mount_done(int fd, struct gfsc_mount_args *ma, int result);
-void gfsc_fs_disconnect(int fd);
-
-/*
- * mount.gfs tells gfs_controld to do a leave (due to a mount failure)
- * for unmount, gfs_controld leaves due to a message from the kernel
- */
-
-int gfsc_fs_leave(struct gfsc_mount_args *ma, int reason);
-
-#endif
-
diff --git a/group/libgfscontrol/main.c b/group/libgfscontrol/main.c
deleted file mode 100644
index f45af9d..0000000
--- a/group/libgfscontrol/main.c
+++ /dev/null
@@ -1,426 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdint.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <limits.h>
-
-#include "libgfscontrol.h"
-#include "gfs_controld.h"
-
-static int do_read(int fd, void *buf, size_t count)
-{
-	int rv, off = 0;
-
-	while (off < count) {
-		rv = read(fd, buf + off, count - off);
-		if (rv == 0)
-			return -1;
-		if (rv == -1 && errno == EINTR)
-			continue;
-		if (rv == -1)
-			return -1;
-		off += rv;
-	}
-	return 0;
-}
-
-static int do_write(int fd, void *buf, size_t count)
-{
-	int rv, off = 0;
-
- retry:
-	rv = write(fd, buf + off, count);
-	if (rv == -1 && errno == EINTR)
-		goto retry;
-	if (rv < 0) {
-		return rv;
-	}
-
-	if (rv != count) {
-		count -= rv;
-		off += rv;
-		goto retry;
-	}
-	return 0;
-}
-
-static int do_connect(char *sock_path)
-{
-	struct sockaddr_un sun;
-	socklen_t addrlen;
-	int rv, fd;
-
-	fd = socket(PF_UNIX, SOCK_STREAM, 0);
-	if (fd < 0)
-		goto out;
-
-	memset(&sun, 0, sizeof(sun));
-	sun.sun_family = AF_UNIX;
-	strcpy(&sun.sun_path[1], sock_path);
-	addrlen = sizeof(sa_family_t) + strlen(sun.sun_path+1) + 1;
-
-	rv = connect(fd, (struct sockaddr *) &sun, addrlen);
-	if (rv < 0) {
-		close(fd);
-		fd = rv;
-	}
- out:
-	return fd;
-}
-
-static void init_header(struct gfsc_header *h, int cmd, char *name,
-			int extra_len)
-{
-	memset(h, 0, sizeof(struct gfsc_header));
-
-	h->magic = GFSC_MAGIC;
-	h->version = GFSC_VERSION;
-	h->len = sizeof(struct gfsc_header) + extra_len;
-	h->command = cmd;
-
-	if (name)
-		strncpy(h->name, name, GFS_MOUNTGROUP_LEN);
-}
-
-int do_dump(int cmd, char *name, char *buf)
-{
-	struct gfsc_header h, *rh;
-	char *reply;
-	int reply_len;
-	int fd, rv;
-
-	init_header(&h, cmd, name, 0);
-
-	reply_len = sizeof(struct gfsc_header) + GFSC_DUMP_SIZE;
-	reply = malloc(reply_len);
-	if (!reply) {
-		rv = -1;
-		goto out;
-	}
-	memset(reply, 0, reply_len);
-
-	fd = do_connect(GFSC_QUERY_SOCK_PATH);
-	if (fd < 0) {
-		rv = fd;
-		goto out;
-	}
-
-	rv = do_write(fd, &h, sizeof(h));
-	if (rv < 0)
-		goto out_close;
-
-	/* won't always get back the full reply_len */
-	do_read(fd, reply, reply_len);
-
-	rh = (struct gfsc_header *)reply;
-	rv = rh->data;
-	if (rv < 0)
-		goto out_close;
-
-	memcpy(buf, (char *)reply + sizeof(struct gfsc_header),
-	       GFSC_DUMP_SIZE);
- out_close:
-	close(fd);
- out:
-	return rv;
-}
-
-int gfsc_dump_debug(char *buf)
-{
-	return do_dump(GFSC_CMD_DUMP_DEBUG, NULL, buf);
-}
-
-int gfsc_dump_plocks(char *name, char *buf)
-{
-	return do_dump(GFSC_CMD_DUMP_PLOCKS, name, buf);
-}
-
-int gfsc_node_info(char *name, int nodeid, struct gfsc_node *node)
-{
-	struct gfsc_header h, *rh;
-	char reply[sizeof(struct gfsc_header) + sizeof(struct gfsc_node)];
-	int fd, rv;
-
-	init_header(&h, GFSC_CMD_NODE_INFO, name, 0);
-	h.data = nodeid;
-
-	memset(reply, 0, sizeof(reply));
-
-	fd = do_connect(GFSC_QUERY_SOCK_PATH);
-	if (fd < 0) {
-		rv = fd;
-		goto out;
-	}
-
-	rv = do_write(fd, &h, sizeof(h));
-	if (rv < 0)
-		goto out_close;
-
-	rv = do_read(fd, reply, sizeof(reply));
-	if (rv < 0)
-		goto out_close;
-
-	rh = (struct gfsc_header *)reply;
-	rv = rh->data;
-	if (rv < 0)
-		goto out_close;
-
-	memcpy(node, (char *)reply + sizeof(struct gfsc_header),
-	       sizeof(struct gfsc_node));
- out_close:
-	close(fd);
- out:
-	return rv;
-}
-
-int gfsc_mountgroup_info(char *name, struct gfsc_mountgroup *mountgroup)
-{
-	struct gfsc_header h, *rh;
-	char reply[sizeof(struct gfsc_header) + sizeof(struct gfsc_mountgroup)];
-	int fd, rv;
-
-	init_header(&h, GFSC_CMD_MOUNTGROUP_INFO, name, 0);
-
-	memset(reply, 0, sizeof(reply));
-
-	fd = do_connect(GFSC_QUERY_SOCK_PATH);
-	if (fd < 0) {
-		rv = fd;
-		goto out;
-	}
-
-	rv = do_write(fd, &h, sizeof(h));
-	if (rv < 0)
-		goto out_close;
-
-	rv = do_read(fd, reply, sizeof(reply));
-	if (rv < 0)
-		goto out_close;
-
-	rh = (struct gfsc_header *)reply;
-	rv = rh->data;
-	if (rv < 0)
-		goto out_close;
-
-	memcpy(mountgroup, (char *)reply + sizeof(struct gfsc_header),
-	       sizeof(struct gfsc_mountgroup));
- out_close:
-	close(fd);
- out:
-	return rv;
-}
-
-int gfsc_mountgroups(int max, int *count, struct gfsc_mountgroup *mgs)
-{
-	struct gfsc_header h, *rh;
-	char *reply;
-	int reply_len;
-	int fd, rv, result, mg_count;
-
-	init_header(&h, GFSC_CMD_MOUNTGROUPS, NULL, 0);
-	h.data = max;
-
-	reply_len = sizeof(struct gfsc_header) +
-		    (max * sizeof(struct gfsc_mountgroup));
-	reply = malloc(reply_len);
-	if (!reply) {
-		rv = -1;
-		goto out;
-	}
-	memset(reply, 0, reply_len);
-
-	fd = do_connect(GFSC_QUERY_SOCK_PATH);
-	if (fd < 0) {
-		rv = fd;
-		goto out;
-	}
-
-	rv = do_write(fd, &h, sizeof(h));
-	if (rv < 0)
-		goto out_close;
-
-	/* won't usually get back the full reply_len */
-	do_read(fd, reply, reply_len);
-
-	rh = (struct gfsc_header *)reply;
-	result = rh->data;
-	if (result < 0 && result != -E2BIG) {
-		rv = result;
-		goto out_close;
-	}
-
-	if (result == -E2BIG) {
-		*count = -E2BIG;
-		mg_count = max;
-	} else {
-		*count = result;
-		mg_count = result;
-	}
-	rv = 0;
-
-	memcpy(mgs, (char *)reply + sizeof(struct gfsc_header),
-	       mg_count * sizeof(struct gfsc_mountgroup));
- out_close:
-	close(fd);
- out:
-	return rv;
-}
-
-int gfsc_mountgroup_nodes(char *name, int type, int max, int *count,
-			 struct gfsc_node *nodes)
-{
-	struct gfsc_header h, *rh;
-	char *reply;
-	int reply_len;
-	int fd, rv, result, node_count;
-
-	init_header(&h, GFSC_CMD_MOUNTGROUP_NODES, name, 0);
-	h.option = type;
-	h.data = max;
-
-	reply_len = sizeof(struct gfsc_header) +
-		    (max * sizeof(struct gfsc_node));
-	reply = malloc(reply_len);
-	if (!reply) {
-		rv = -1;
-		goto out;
-	}
-	memset(reply, 0, reply_len);
-
-	fd = do_connect(GFSC_QUERY_SOCK_PATH);
-	if (fd < 0) {
-		rv = fd;
-		goto out;
-	}
-
-	rv = do_write(fd, &h, sizeof(h));
-	if (rv < 0)
-		goto out_close;
-
-	/* won't usually get back the full reply_len */
-	do_read(fd, reply, reply_len);
-
-	rh = (struct gfsc_header *)reply;
-	result = rh->data;
-	if (result < 0 && result != -E2BIG) {
-		rv = result;
-		goto out_close;
-	}
-
-	if (result == -E2BIG) {
-		*count = -E2BIG;
-		node_count = max;
-	} else {
-		*count = result;
-		node_count = result;
-	}
-	rv = 0;
-
-	memcpy(nodes, (char *)reply + sizeof(struct gfsc_header),
-	       node_count * sizeof(struct gfsc_node));
- out_close:
-	close(fd);
- out:
-	return rv;
-}
-
-int gfsc_fs_connect(void)
-{
-	return do_connect(GFSC_SOCK_PATH);
-}
-
-void gfsc_fs_disconnect(int fd)
-{
-	close(fd);
-}
-
-int gfsc_fs_join(int fd, struct gfsc_mount_args *ma)
-{
-	char msg[sizeof(struct gfsc_header) + sizeof(struct gfsc_mount_args)];
-	struct gfsc_header *h = (struct gfsc_header *)msg;
-	char *name = strstr(ma->table, ":") + 1;
-
-	init_header(h, GFSC_CMD_FS_JOIN, name, sizeof(struct gfsc_mount_args));
-
-	memcpy(msg + sizeof(struct gfsc_header), ma,
-	       sizeof(struct gfsc_mount_args));
-
-	return do_write(fd, msg, sizeof(msg));
-}
-
-int gfsc_fs_remount(int fd, struct gfsc_mount_args *ma)
-{
-	char msg[sizeof(struct gfsc_header) + sizeof(struct gfsc_mount_args)];
-	struct gfsc_header *h = (struct gfsc_header *)msg;
-	char *name = strstr(ma->table, ":") + 1;
-
-	init_header(h, GFSC_CMD_FS_REMOUNT, name,
-		    sizeof(struct gfsc_mount_args));
-
-	memcpy(msg + sizeof(struct gfsc_header), ma,
-	       sizeof(struct gfsc_mount_args));
-
-	return do_write(fd, msg, sizeof(msg));
-}
-
-int gfsc_fs_result(int fd, int *result, struct gfsc_mount_args *ma)
-{
-	char reply[sizeof(struct gfsc_header) + sizeof(struct gfsc_mount_args)];
-	struct gfsc_header *h = (struct gfsc_header *)reply;
-	int rv;
-
-	rv = do_read(fd, reply, sizeof(reply));
-	if (rv < 0)
-		goto out;
-
-	*result = h->data;
-
-	memcpy(ma, reply + sizeof(struct gfsc_header),
-	       sizeof(struct gfsc_mount_args));
- out:
-	return rv;
-}
-
-int gfsc_fs_mount_done(int fd, struct gfsc_mount_args *ma, int result)
-{
-	char msg[sizeof(struct gfsc_header) + sizeof(struct gfsc_mount_args)];
-	struct gfsc_header *h = (struct gfsc_header *)msg;
-	char *name = strstr(ma->table, ":") + 1;
-
-	init_header(h, GFSC_CMD_FS_MOUNT_DONE, name,
-		    sizeof(struct gfsc_mount_args));
-
-	h->data = result;
-
-	memcpy(msg + sizeof(struct gfsc_header), ma,
-	       sizeof(struct gfsc_mount_args));
-
-	return do_write(fd, msg, sizeof(msg));
-}
-
-int gfsc_fs_leave(struct gfsc_mount_args *ma, int reason)
-{
-	char msg[sizeof(struct gfsc_header) + sizeof(struct gfsc_mount_args)];
-	struct gfsc_header *h = (struct gfsc_header *)msg;
-	char *name = strstr(ma->table, ":") + 1;
-	int fd;
-
-	init_header(h, GFSC_CMD_FS_LEAVE, name,
-		    sizeof(struct gfsc_mount_args));
-
-	h->data = reason;
-
-	memcpy(msg + sizeof(struct gfsc_header), ma,
-	       sizeof(struct gfsc_mount_args));
-
-	fd = do_connect(GFSC_SOCK_PATH);
-	if (fd < 0)
-		return fd;
-
-	return do_write(fd, msg, sizeof(msg));
-}
-
diff --git a/group/man/Makefile b/group/man/Makefile
deleted file mode 100644
index 36f8b87..0000000
--- a/group/man/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-TARGET= dlm_controld.8 \
-	gfs_controld.8 \
-	group_tool.8 \
-	groupd.8
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/man.mk
diff --git a/group/man/dlm_controld.8 b/group/man/dlm_controld.8
deleted file mode 100644
index e8dc1c6..0000000
--- a/group/man/dlm_controld.8
+++ /dev/null
@@ -1,123 +0,0 @@
-.TH dlm_controld 8
-
-.SH NAME
-dlm_controld - daemon that configures dlm according to cluster events
-
-.SH SYNOPSIS
-.B
-dlm_controld
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-The dlm lives in the kernel, and the cluster infrastructure (cluster
-membership and group management) lives in user space.  The dlm in the
-kernel needs to adjust/recover for certain cluster events.  It's the job
-of dlm_controld to receive these events and reconfigure the kernel dlm as
-needed.  dlm_controld controls and configures the dlm through sysfs and
-configfs files that are considered dlm-internal interfaces; not a general
-API/ABI.
-
-The dlm also exports lock state through debugfs so that dlm_controld can
-implement deadlock detection in user space.
-
-.SH CONFIGURATION FILE
-
-Optional cluster.conf settings are placed in the <dlm> section.
-
-.SS Global settings
-The network
-.I protocol
-can be set to "tcp" or "sctp".  The default is tcp.
-
-  <dlm protocol="tcp"/>
-
-After waiting
-.I timewarn
-centiseconds, the dlm will emit a warning via netlink.  This only applies
-to lockspaces created with the DLM_LSFL_TIMEWARN flag, and is used for
-deadlock detection.  The default is 500 (5 seconds).
-
-  <dlm timewarn="500"/>
-
-DLM kernel debug messages can be enabled by setting
-.I log_debug
-to 1.  The default is 0.
-
-  <dlm log_debug="0"/>
-
-.SS Disabling resource directory
-
-Lockspaces usually use a resource directory to keep track of which node is
-the master of each resource.  The dlm can operate without the resource
-directory, though, by statically assigning the master of a resource using
-a hash of the resource name.
-
-  <dlm>
-    <lockspace name="foo" nodir="1">
-  </dlm>
-
-.SS Lock-server configuration
-
-The nodir setting can be combined with node weights to create a
-configuration where select node(s) are the master of all resources/locks.
-These "master" nodes can be viewed as "lock servers" for the other nodes.
-
-  <dlm>
-    <lockspace name="foo" nodir="1">
-      <master name="node01"/>
-    </lockspace>
-  </dlm>
-
-or,
-
-  <dlm>
-    <lockspace name="foo" nodir="1">
-      <master name="node01"/>
-      <master name="node02"/>
-    </lockspace>
-  </dlm>
-
-Lock management will be partitioned among the available masters.  There
-can be any number of masters defined.  The designated master nodes will
-master all resources/locks (according to the resource name hash).  When no
-masters are members of the lockspace, then the nodes revert to the common
-fully-distributed configuration.  Recovery is faster, with little
-disruption, when a non-master node joins/leaves.
-
-There is no special mode in the dlm for this lock server configuration,
-it's just a natural consequence of combining the "nodir" option with node
-weights.  When a lockspace has master nodes defined, the master has a
-default weight of 1 and all non-master nodes have weight of 0.  Explicit
-non-zero weights can also be assigned to master nodes, e.g.
-
-  <dlm>
-    <lockspace name="foo" nodir="1">
-      <master name="node01" weight="2"/>
-      <master name="node02" weight="1"/>
-    </lockspace>
-  </dlm>
-
-In which case node01 will master 2/3 of the total resources and node2 will
-master the other 1/3.
-
-
-.SH OPTIONS
-.TP
-\fB-d\fP <num>
-Enable (1) or disable (0) the deadlock detection code.
-.TP
-\fB-D\fP
-Run the daemon in the foreground and print debug statements to stdout.
-.TP
-\fB-K\fP
-Enable kernel dlm debugging messages.
-.TP
-\fB-V\fP
-Print the version information and exit.
-.TP
-\fB-h\fP 
-Print out a help message describing available options, then exit.
-
-.SH SEE ALSO
-groupd(8)
-
diff --git a/group/man/gfs_controld.8 b/group/man/gfs_controld.8
deleted file mode 100644
index 3d053ee..0000000
--- a/group/man/gfs_controld.8
+++ /dev/null
@@ -1,122 +0,0 @@
-.TH gfs_controld 8
-
-.SH NAME
-gfs_controld - daemon that manages mounting, unmounting, recovery and
-posix locks
-
-.SH SYNOPSIS
-.B
-gfs_controld
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-GFS lives in the kernel, and the cluster infrastructure (cluster
-membership and group management) lives in user space.  GFS in the kernel
-needs to adjust/recover for certain cluster events.  It's the job of
-gfs_controld to receive these events and reconfigure gfs as needed.
-gfs_controld controls and configures gfs through sysfs files that are
-considered gfs-internal interfaces; not a general API/ABI.
-
-Mounting, unmounting and node failure are the main cluster events that
-gfs_controld controls.  It also manages the assignment of journals to
-different nodes.  The mount.gfs and umount.gfs programs communicate with
-gfs_controld to join/leave the mount group and receive the necessary
-options for the kernel mount.
-
-GFS also sends all posix lock operations to gfs_controld for processing.
-gfs_controld manages cluster-wide posix locks for gfs and passes results
-back to gfs in the kernel.
-
-.SH CONFIGURATION FILE
-
-Optional cluster.conf settings are placed in the <gfs_controld> section.
-
-.SS Posix locks
-
-Heavy use of plocks can result in high network load.  The rate at which
-plocks are processed are limited by the
-.I plock_rate_limit
-setting, which limits the maximum plock performance, and limits potentially
-excessive network load.  This value is the maximum number of plock operations
-a single node will process every second.  To achieve maximum posix locking
-performance, the rate limiting should be disabled by setting it to 0.  The
-default value is 100.
-
-  <gfs_controld plock_rate_limit="100"/>
-
-To optimize performance for repeated locking of the same locks by
-processes on a single node,
-.I plock_ownership
-can be set to 1.  The default is 0.  If this is enabled, gfs_controld
-cannot interoperate with older versions that did not support this option.
-
-  <gfs_controld plock_ownership="1"/>
-
-Three options can be used to tune the behavior of the plock_ownership
-optimization.  All three relate to the caching of lock ownership state.
-Specifically, they define how aggressively cached ownership state is dropped.
-More caching of ownership state can result in better performance, at the
-expense of more memory usage.
-
-.I drop_resources_time
-is the frequency of drop attempts in milliseconds.  Default 10000 (10 sec).
-
-.I drop_resources_count
-is the maximum number of items to drop from the cache each time.  Default 10.
-
-.I drop_resources_age
-is the time in milliseconds a cached item should be unused before being
-considered for dropping.  Default 10000 (10 sec).
-
-  <gfs_controld drop_resources_time="10000" drop_resources_count="10"
-   drop_resources_age="10000"/>
-
-
-.SH OPTIONS
-.TP
-\fB-D\fP
-Run the daemon in the foreground and print debug statements to stdout.
-.TP
-\fB-P\fP
-Enable posix lock debugging messages.
-.TP
-\fB-w\fP
-Disable the "withdraw" feature.
-.TP
-\fB-p\fP
-Disable posix lock handling.
-.TP
-\fB-l\fP <num>
-Limit the rate at which posix lock messages are sent to <num> messages per
-second.  0 disables the limit and results in the maximum performance of
-posix locks. Default 100.
-.TP
-\fB-o\fP <num>
-Enable (1) or disable (0) plock ownership optimization. Default 0.  All
-nodes must run with the same value.
-.TP
-\fB-t\fP <ms>
-Ownership cache tuning, drop resources time (milliseconds). Default 10000.
-.TP
-\fB-c\fP <ms>
-Ownership cache tuning, drop resources count. Default 10.
-.TP
-\fB-a\fP <ms>
-Ownership cache tuning, drop resources age (milliseconds). Default 10000.
-.TP
-\fB-h\fP 
-Print out a help message describing available options, then exit.
-.TP
-\fB-V\fP
-Print the version information and exit.
-
-.SH DEBUGGING 
-The gfs_controld daemon keeps a circular buffer of debug messages that can
-be dumped with the 'group_tool dump gfs' command.
-
-The state of all gfs posix locks can also be dumped from gfs_controld with
-the 'group_tool dump plocks <fsname>' command.
-
-.SH SEE ALSO
-groupd(8), group_tool(8)
-
diff --git a/group/man/group_tool.8 b/group/man/group_tool.8
deleted file mode 100644
index 6cf5e7f..0000000
--- a/group/man/group_tool.8
+++ /dev/null
@@ -1,61 +0,0 @@
-.TH group_tool 8
-
-.SH NAME
-group_tool - display/dump information about fence, dlm and gfs groups
-
-.SH SYNOPSIS
-.B
-group_tool
-[\fISUBCOMMAND\fR] [\fIOPTION\fR]...
-
-.SH DESCRIPTION
-
-The group_tool program displays the status of fence, dlm and gfs groups.
-The information is read from the groupd daemon which controls the fenced,
-dlm_controld and gfs_controld daemons.  group_tool will also dump debug
-logs from various daemons.
-
-.SH SUBCOMMANDS
-
-.TP
-\fBls\fP
-displays the list of groups and their membership.  It is the default
-subcommand if none is specified.
-
-.TP
-\fBdump\fP
-dumps the debug log from groupd.
-
-.TP
-\fBdump fence\fP
-dumps the debug log from fenced.
-
-.TP
-\fBdump gfs\fP
-dumps the debug log from gfs_controld.
-
-.TP
-\fBdump plocks\fP <fsname>
-prints the posix locks on the named gfs fs from gfs_controld.
-
-.SH OPTIONS
-.TP
-\fB-v\fP
-Verbose output, used with the 'ls' subcommand.
-.TP
-\fB-D\fP
-Run the daemon in the foreground and print debug statements to stdout.
-.TP
-\fB-V\fP
-Print the version information and exit.
-.TP
-\fB-h\fP 
-Print out a help message describing available options, then exit.
-
-.SH DEBUGGING
-The groupd daemon keeps a circular buffer of debug messages that can be
-dumped with the 'group_tool dump' command.
-
-.SH SEE ALSO
-groupd(8)
-
diff --git a/group/man/groupd.8 b/group/man/groupd.8
deleted file mode 100644
index 634d0a0..0000000
--- a/group/man/groupd.8
+++ /dev/null
@@ -1,43 +0,0 @@
-.TH groupd 8
-
-.SH NAME
-groupd - the group manager for fenced, dlm_controld and gfs_controld
-
-.SH SYNOPSIS
-.B
-groupd
-[\fIOPTION\fR]...
-
-.SH DESCRIPTION
-
-The group daemon, groupd, provides a compatibility layer between the
-openais closed process group (CPG) service and the fenced, dlm_controld
-and gfs_controld daemons.  groupd and its associated libgroup interface
-will go away in the future as the fencing, dlm and gfs daemons are ported
-to use the libcpg interfaces directly.  groupd translates and buffers cpg
-events between openais's cpg service and the fence/dlm/gfs systems that
-use it.  CPG's are used to represent the membership of the fence domain,
-dlm lockspaces and gfs mount groups.
-
-groupd is also a convenient place to query the status of the fence, dlm
-and gfs groups.  This is done by the group_tool program.
-
-
-.SH OPTIONS
-.TP
-\fB-D\fP
-Run the daemon in the foreground and print debug statements to stdout.
-.TP
-\fB-V\fP
-Print the version information and exit.
-.TP
-\fB-h\fP 
-Print out a help message describing available options, then exit.
-
-.SH DEBUGGING
-The groupd daemon keeps a circular buffer of debug messages that can be
-dumped with the 'group_tool dump' command.
-
-.SH SEE ALSO
-group_tool(8)
-
diff --git a/group/test/Makefile b/group/test/Makefile
deleted file mode 100644
index 3a91013..0000000
--- a/group/test/Makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-TARGETS= client clientd
-
-all: $(TARGETS)
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${libdir}
-
-%: %.o
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-clean: generalclean
diff --git a/group/test/client.c b/group/test/client.c
deleted file mode 100644
index a9a3930..0000000
--- a/group/test/client.c
+++ /dev/null
@@ -1,45 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <sys/types.h>
-#include <sys/errno.h>
-
-
-#define COMMAND_SOCK_PATH "command_socket"
-
-
-int main(int argc, char *argv[])
-{
-	int s, i, rv;
-	struct sockaddr_un addr;
-	socklen_t addrlen;
-	char buf[256];
-
-	s = socket(AF_LOCAL, SOCK_DGRAM, 0);
-	if (s < 0) {
-		printf("socket error %d errno %d\n", s, errno);
-		exit(-1);
-	}
-
-	memset(&addr, 0, sizeof(addr));
-	addr.sun_family = AF_LOCAL;
-	strcpy(&addr.sun_path[1], COMMAND_SOCK_PATH);
-	addrlen = sizeof(sa_family_t) + strlen(addr.sun_path+1) + 1;
-
-	memset(buf, 0, 256);
-
-	for (i = 1; i < argc; i++) {
-		if (i != 1)
-			strcat(buf, " ");
-		strcat(buf, argv[i]);
-	}
-
-
-	rv = sendto(s, buf, strlen(buf), 0, (struct sockaddr *)&addr, addrlen);
-
-	printf("send %d \"%s\"\n", rv, buf);
-	return 0;
-}
-
diff --git a/group/test/clientd.c b/group/test/clientd.c
deleted file mode 100644
index 9f344f4..0000000
--- a/group/test/clientd.c
+++ /dev/null
@@ -1,179 +0,0 @@
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <asm/types.h>
-#include <sys/socket.h>
-#include <sys/poll.h>
-#include <sys/un.h>
-#include <linux/netlink.h> 
-
-#define GROUPD_SOCK_PATH "groupd_socket"
-#define COMMAND_SOCK_PATH "command_socket"
-
-#define MAXLINE 256
-#define MAXCON  4
-
-#define log_error(fmt, args...) fprintf(stderr, fmt "\n", ##args)
-
-int groupd_fd;
-int command_fd;
-struct sockaddr_un sun;
-struct sockaddr_un addr;
-socklen_t addrlen;
-
-
-void process_groupd(void)
-{
-	char buf[MAXLINE];
-	int rv;
-
-	memset(buf, 0, sizeof(buf));
-
-	rv = read(groupd_fd, &buf, sizeof(buf));
-	if (rv < 0) {
-		log_error("read error %d errno %d", rv, errno);
-		return;
-	}
-
-	printf("I: groupd read:   %s\n", buf);
-}
-
-void process_command(void)
-{
-	char buf[MAXLINE];
-	int rv;
-
-	memset(buf, 0, sizeof(buf));
-
-	rv = recvfrom(command_fd, buf, MAXLINE, 0, (struct sockaddr *) &addr,
-		      &addrlen);
-
-	printf("I: command recv:  %s\n", buf);
-
-	rv = write(groupd_fd, buf, strlen(buf));
-	if (rv < 0)
-		log_error("groupd write error");
-
-	printf("O: command write: %s\n", buf);
-}
-
-void process_input(int fd)
-{
-	if (fd == groupd_fd)
-		process_groupd();
-	else if (fd == command_fd)
-		process_command();
-}
-
-void process_hup(int fd)
-{
-	if (fd == groupd_fd)
-		close(groupd_fd);
-	else if (fd == command_fd)
-		close(command_fd);
-}
-
-int setup_groupd(void)
-{
-	char buf[] = "setup test 1";
-	int rv;
-
-	rv = write(groupd_fd, &buf, strlen(buf));
-	if (rv < 0) {
-		log_error("write error %d errno %d %s", rv, errno, buf);
-		return -1;
-	}
-	return 0;
-}
-
-int loop(void)
-{
-	struct pollfd *pollfd;
-	int s, rv, i, maxi;
-
-
-	pollfd = malloc(MAXCON * sizeof(struct pollfd));
-	if (!pollfd)
-		return -1;
-
-
-	/* connect to the groupd server */
-
-	s = socket(AF_LOCAL, SOCK_STREAM, 0);
-	if (s < 0) {
-		log_error("socket");
-		exit(1);
-	}
-
-	memset(&sun, 0, sizeof(sun));
-	sun.sun_family = AF_LOCAL;
-	strcpy(&sun.sun_path[1], GROUPD_SOCK_PATH);
-	addrlen = sizeof(sa_family_t) + strlen(sun.sun_path+1) + 1;
-
-	rv = connect(s, (struct sockaddr *) &sun, addrlen);
-	if (rv < 0) {
-		log_error("groupd connect error %d errno %d", rv, errno);
-		exit(1);
-	}
-
-	groupd_fd = s;
-	pollfd[0].fd = s;
-	pollfd[0].events = POLLIN;
-
-
-	/* get commands via another local socket */
-
-	s = socket(AF_LOCAL, SOCK_DGRAM, 0);
-	if (s < 0) {
-		log_error("socket");
-		exit(1);
-	}
-
-	memset(&addr, 0, sizeof(addr));
-	addr.sun_family = AF_LOCAL;
-	strcpy(&addr.sun_path[1], COMMAND_SOCK_PATH);
-	addrlen = sizeof(sa_family_t) + strlen(addr.sun_path+1) + 1;
-
-	rv = bind(s, (struct sockaddr *) &addr, addrlen);
-	if (rv < 0) {
-		log_error("bind error");
-		exit(1);
-	}
-
-	command_fd = s;
-	pollfd[1].fd = s;
-	pollfd[1].events = POLLIN;
-
-	maxi = 1;
-
-	rv = setup_groupd();
-	if (rv < 0) {
-		log_error("setup_groupd");
-		exit(1);
-	}
-
-	for (;;) {
-		rv = poll(pollfd, maxi + 1, -1);
-		if (rv < 0)
-			log_error("poll");
-
-		for (i = 0; i <= maxi; i++) {
-			if (pollfd[i].revents & (POLLHUP | POLLERR | POLLNVAL)) {
-				process_hup(pollfd[i].fd);
-			} else if (pollfd[i].revents & POLLIN) {
-				process_input(pollfd[i].fd);
-			}
-		}
-	}
-
-	free(pollfd);
-	return 0;
-}
-
-int main(int argc, char **argv)
-{
-	return loop();
-}
-
diff --git a/group/tool/Makefile b/group/tool/Makefile
deleted file mode 100644
index ba5d960..0000000
--- a/group/tool/Makefile
+++ /dev/null
@@ -1,38 +0,0 @@
-TARGET= group_tool
-
-SBINDIRT=$(TARGET)
-
-all: depends ${TARGET}
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-OBJS=	main.o
-
-CFLAGS += -I$(S) -I$(S)/../daemon/ -I$(S)/../lib/
-CFLAGS += -I${dlmcontrolincdir}
-CFLAGS += -I$(S)/../../fence/libfenced
-CFLAGS += -I$(S)/../libgfscontrol
-CFLAGS += -I${incdir}
-CFLAGS += -I${KERNEL_SRC}/include/
-
-LDFLAGS += -L${dlmcontrollibdir} -ldlmcontrol
-LDFLAGS += -L../lib -lgroup
-LDFLAGS += -L../../fence/libfenced -lfenced
-LDFLAGS += -L../libgfscontrol -lgfscontrol
-LDFLAGS += -L${libdir}
-
-LDDEPS += ../lib/libgroup.a
-LDDEPS += ../libgfscontrol/libgfscontrol.a
-LDDEPS += ../../fence/libfenced/libfenced.a
-
-${TARGET}: ${OBJS} ${LDDEPS}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-depends:
-	$(MAKE) -C ../lib all
-
-clean: generalclean
diff --git a/group/tool/main.c b/group/tool/main.c
deleted file mode 100644
index e1d911c..0000000
--- a/group/tool/main.c
+++ /dev/null
@@ -1,746 +0,0 @@
-#include <sys/types.h>
-#include <sys/un.h>
-#include <inttypes.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <stddef.h>
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-#include <limits.h>
-#include <netinet/in.h>
-#include <linux/dlmconstants.h>
-
-#include "libgroup.h"
-#include "groupd.h"
-#include "libfenced.h"
-#include "libdlmcontrol.h"
-#include "libgfscontrol.h"
-#include "copyright.cf"
-
-#define GROUP_LIBGROUP			2
-#define GROUP_LIBCPG			3
-
-#define MAX_NODES			128
-#define MAX_LS				128
-#define MAX_MG				128
-#define MAX_GROUPS			128
-
-#define OP_LIST				1
-#define OP_DUMP				2
-#define OP_LOG				3
-
-static char *prog_name;
-static int operation;
-static int opt_ind;
-static int verbose;
-static int all_daemons;
-static int ls_all_nodes;
-static int print_header_done;
-
-
-static int do_write(int fd, void *buf, size_t count)
-{
-	int rv, off = 0;
-
- retry:
-	rv = write(fd, buf + off, count);
-	if (rv == -1 && errno == EINTR)
-		goto retry;
-	if (rv < 0)
-		return rv;
-
-	if (rv != count) {
-		count -= rv;
-		off += rv;
-		goto retry;
-	}
-	return 0;
-}
-
-static int do_read(int fd, void *buf, size_t count)
-{
-	int rv, off = 0;
-
-	while (off < count) {
-		rv = read(fd, buf + off, count - off);
-		if (rv == 0)
-			return -1;
-		if (rv == -1 && errno == EINTR)
-			continue;
-		if (rv == -1)
-			return -1;
-		off += rv;
-	}
-	return 0;
-}
-
-static void print_usage(void)
-{
-	printf("Usage:\n");
-	printf("\n");
-	printf("%s [options] [ls|dump]\n", prog_name);
-	printf("\n");
-	printf("Options:\n");
-	printf("  -v               Verbose output, extra event information\n");
-	printf("  -a               fence_tool ls; dlm_tool ls; gfs_control ls\n");
-	printf("  -n               Show all node information with -a\n");
-	printf("  -h               Print this help, then exit\n");
-	printf("  -V               Print program version information, then exit\n");
-	printf("\n");
-	printf("Display group information from groupd\n");
-	printf("ls                 Show information for all groups\n");
-	printf("ls <level> <name>  Show information one group.  If\n");
-	printf("                   we are not a member of the group,\n");
-	printf("                   return 1.\n");
-	printf("\n");
-	printf("Display debugging information\n");
-	printf("dump               Show debug log from groupd\n");
-	printf("dump fence         Show debug log from fenced\n");
-	printf("dump gfs           Show debug log from gfs_controld\n");
-	printf("dump plocks <name> Show posix locks for gfs with given name\n");
-	printf("\n");
-	printf("log <comments>     Add information to the groupd log.\n");
-	printf("\n");
-}
-
-#define OPTION_STRING "ahVvn"
-
-static void decode_arguments(int argc, char **argv)
-{
-	int cont = 1;
-	int optchar;
-
-	while (cont) {
-		optchar = getopt(argc, argv, OPTION_STRING);
-
-		switch (optchar) {
-		case 'a':
-			all_daemons = 1;
-			break;
-
-		case 'n':
-			ls_all_nodes = 1;
-			break;
-
-		case 'v':
-			verbose = 1;
-			break;
-
-		case 'h':
-			print_usage();
-			exit(EXIT_SUCCESS);
-			break;
-
-		case 'V':
-			printf("%s %s (built %s %s)\n",
-				prog_name, RELEASE_VERSION, __DATE__, __TIME__);
-			printf("%s\n", REDHAT_COPYRIGHT);
-			exit(EXIT_SUCCESS);
-			break;
-
-		case ':':
-		case '?':
-			fprintf(stderr, "Please use '-h' for usage.\n");
-			exit(EXIT_FAILURE);
-			break;
-
-		case EOF:
-			cont = 0;
-			break;
-
-		default:
-			fprintf(stderr, "unknown option: %c\n", optchar);
-			exit(EXIT_FAILURE);
-			break;
-		};
-	}
-
-	while (optind < argc) {
-		if (strcmp(argv[optind], "dump") == 0) {
-			operation = OP_DUMP;
-			opt_ind = optind + 1;
-			break;
-		} else if (strcmp(argv[optind], "ls") == 0 ||
-		           strcmp(argv[optind], "list") == 0) {
-			operation = OP_LIST;
-			opt_ind = optind + 1;
-			break;
-		} else if (strcmp(argv[optind], "log") == 0) {
-			operation = OP_LOG;
-			opt_ind = optind + 1;
-			break;
-		}
-		optind++;
-	}
-
-	if (!operation)
-		operation = OP_LIST;
-}
-
-/* copied from grouip/daemon/gd_internal.h, must keep in sync */
-
-#define EST_JOIN_BEGIN         1
-#define EST_JOIN_STOP_WAIT     2
-#define EST_JOIN_ALL_STOPPED   3
-#define EST_JOIN_START_WAIT    4
-#define EST_JOIN_ALL_STARTED   5
-#define EST_LEAVE_BEGIN        6
-#define EST_LEAVE_STOP_WAIT    7
-#define EST_LEAVE_ALL_STOPPED  8
-#define EST_LEAVE_START_WAIT   9
-#define EST_LEAVE_ALL_STARTED 10
-#define EST_FAIL_BEGIN        11
-#define EST_FAIL_STOP_WAIT    12
-#define EST_FAIL_ALL_STOPPED  13
-#define EST_FAIL_START_WAIT   14
-#define EST_FAIL_ALL_STARTED  15
-
-char *ev_state_str(state)
-{
-	switch (state) {
-	case EST_JOIN_BEGIN:
-		return "JOIN_BEGIN";
-	case EST_JOIN_STOP_WAIT:
-		return "JOIN_STOP_WAIT";
-	case EST_JOIN_ALL_STOPPED:
-		return "JOIN_ALL_STOPPED";
-	case EST_JOIN_START_WAIT:
-		return "JOIN_START_WAIT";
-	case EST_JOIN_ALL_STARTED:
-		return "JOIN_ALL_STARTED";
-	case EST_LEAVE_BEGIN:
-		return "LEAVE_BEGIN";
-	case EST_LEAVE_STOP_WAIT:
-		return "LEAVE_STOP_WAIT";
-	case EST_LEAVE_ALL_STOPPED:
-		return "LEAVE_ALL_STOPPED";
-	case EST_LEAVE_START_WAIT:
-		return "LEAVE_START_WAIT";
-	case EST_LEAVE_ALL_STARTED:
-		return "LEAVE_ALL_STARTED";
-	case EST_FAIL_BEGIN:
-		return "FAIL_BEGIN";
-	case EST_FAIL_STOP_WAIT:
-		return "FAIL_STOP_WAIT";
-	case EST_FAIL_ALL_STOPPED:
-		return "FAIL_ALL_STOPPED";
-	case EST_FAIL_START_WAIT:
-		return "FAIL_START_WAIT";
-	case EST_FAIL_ALL_STARTED:
-		return "FAIL_ALL_STARTED";
-	default:
-		return "unknown";
-	}
-}
-
-char *state_str(group_data_t *data)
-{
-	static char buf[128];
-	
-	memset(buf, 0, sizeof(buf));
-
-	if (!data->event_state && !data->event_nodeid)
-		sprintf(buf, "none");
-	else if (verbose)
-		snprintf(buf, 127, "%s %d %llx %d",
-			 ev_state_str(data->event_state),
-			 data->event_nodeid,
-			 (unsigned long long)data->event_id,
-			 data->event_local_status);
-	else
-		snprintf(buf, 127, "%s", ev_state_str(data->event_state));
-
-	return buf;
-}
-
-static int data_compare(const void *va, const void *vb)
-{
-	const group_data_t *a = va;
-	const group_data_t *b = vb;
-	return a->level - b->level;
-}
-
-static int member_compare(const void *va, const void *vb)
-{
-	const int *a = va;
-	const int *b = vb;
-	return *a - *b;
-}
-
-static int groupd_list(int argc, char **argv)
-{
-	group_data_t data[MAX_GROUPS];
-	int i, j, rv, count = 0, level, ret = 0;
-	char *name, *state_header;
-	int type_width = 16;
-	int level_width = 5;
-	int name_width = 32;
-	int id_width = 8;
-	int state_width = 12;
-	int len, max_name = 4;
-
-	memset(&data, 0, sizeof(data));
-
-	if (opt_ind && opt_ind < argc) {
-		level = atoi(argv[opt_ind++]);
-		name = argv[opt_ind];
-
-		rv = group_get_group(level, name, data);
-		count = 1;
-
-		/* don't output if there's no group at all */
-		if (data[0].id == 0) {
-			fprintf(stderr, "groupd has no information about "
-			        "the specified group\n");
-			return 1;
-		}
-		/* If we wanted a specific group but we are not
-		   joined, print it out - but return failure to
-		   the caller */
-		if (data[0].member != 1)
-			ret = 1;
-	} else
-		rv = group_get_groups(MAX_GROUPS, &count, data);
-
-	if (rv < 0)
-		return rv;
-
-	if (!count)
-		return 0;
-
-	for (i = 0; i < count; i++) {
-		len = strlen(data[i].name);
-		if (len > max_name)
-			max_name = len;
-	}
-	name_width = max_name + 1;
-
-	if (verbose)
-		state_header = "state node id local_done";
-	else
-		state_header = "state";
-			
-	qsort(&data, count, sizeof(group_data_t), data_compare);
-
-	for (i = 0; i < count; i++) {
-		if (!i)
-			printf("%-*s %-*s %-*s %-*s %-*s\n",
-			       type_width, "type",
-			       level_width, "level",
-			       name_width, "name",
-			       id_width, "id",
-			       state_width, state_header);
-
-		printf("%-*s %-*d %-*s %0*x %-*s\n",
-			type_width, data[i].client_name,
-			level_width, data[i].level,
-			name_width, data[i].name,
-			id_width, data[i].id,
-			state_width, state_str(&data[i]));
-
-		qsort(&data[i].members, data[i].member_count,
-		      sizeof(int), member_compare);
-
-		printf("[");
-		for (j = 0; j < data[i].member_count; j++) {
-			if (j != 0)
-				printf(" ");
-			printf("%d", data[i].members[j]);
-		}
-		printf("]\n");
-	}
-	return ret;
-}
-
-static int fenced_node_compare(const void *va, const void *vb)
-{
-	const struct fenced_node *a = va;
-	const struct fenced_node *b = vb;
-
-	return a->nodeid - b->nodeid;
-}
-
-static void print_header(void)
-{
-	if (print_header_done)
-		return;
-	print_header_done = 1;
-
-	printf("type         level name             id       state\n");
-}
-
-static void fenced_list(void)
-{
-	struct fenced_domain d;
-	struct fenced_node nodes[MAX_NODES];
-	struct fenced_node *np;
-	int node_count;
-	int rv, j;
-
-	rv = fenced_domain_info(&d);
-	if (rv < 0)
-		return;
-
-	print_header();
-
-	printf("fence        0     %-*s %08x %d\n",
-	       16, "default", 0, d.state);
-
-	node_count = 0;
-	memset(&nodes, 0, sizeof(nodes));
-
-	rv = fenced_domain_nodes(FENCED_NODES_MEMBERS, MAX_NODES,
-				 &node_count, nodes);
-	if (rv < 0 || !node_count)
-		goto do_nodeids;
-
-	qsort(&nodes, node_count, sizeof(struct fenced_node),
-	      fenced_node_compare);
-
- do_nodeids:
-	printf("[");
-	np = nodes;
-	for (j = 0; j < node_count; j++) {
-		if (j)
-			printf(" ");
-		printf("%d", np->nodeid);
-		np++;
-	}
-	printf("]\n");
-}
-
-static int dlmc_node_compare(const void *va, const void *vb)
-{
-	const struct dlmc_node *a = va;
-	const struct dlmc_node *b = vb;
-
-	return a->nodeid - b->nodeid;
-}
-
-static void dlm_controld_list(void)
-{
-	struct dlmc_lockspace lss[MAX_LS];
-	struct dlmc_node nodes[MAX_NODES];
-	struct dlmc_node *np;
-	struct dlmc_lockspace *ls;
-	char *name = NULL;
-	int node_count;
-	int ls_count;
-	int rv;
-	int i, j;
-
-	memset(lss, 0, sizeof(lss));
-
-	if (name) {
-		rv = dlmc_lockspace_info(name, lss);
-		if (rv < 0)
-			return;
-		ls_count = 1;
-	} else {
-		rv = dlmc_lockspaces(MAX_LS, &ls_count, lss);
-		if (rv < 0)
-			return;
-	}
-
-	for (i = 0; i < ls_count; i++) {
-		ls = &lss[i];
-
-		if (!i)
-			print_header();
-
-		printf("dlm          1     %-*s %08x %x\n",
-			16, ls->name, ls->global_id, ls->flags);
-
-		node_count = 0;
-		memset(&nodes, 0, sizeof(nodes));
-
-		rv = dlmc_lockspace_nodes(ls->name, DLMC_NODES_MEMBERS,
-					  MAX_NODES, &node_count, nodes);
-		if (rv < 0 || !node_count)
-			goto do_nodeids;
-
-		qsort(nodes, node_count, sizeof(struct dlmc_node),
-		      dlmc_node_compare);
-
- do_nodeids:
-		printf("[");
-		np = nodes;
-		for (j = 0; j < node_count; j++) {
-			if (j)
-				printf(" ");
-			printf("%d", np->nodeid);
-			np++;
-		}
-		printf("]\n");
-	}
-}
-
-static int gfsc_node_compare(const void *va, const void *vb)
-{
-	const struct gfsc_node *a = va;
-	const struct gfsc_node *b = vb;
-
-	return a->nodeid - b->nodeid;
-}
-
-static void gfs_controld_list(void)
-{
-	struct gfsc_mountgroup mgs[MAX_MG];
-	struct gfsc_node nodes[MAX_NODES];
-	struct gfsc_node *np;
-	struct gfsc_mountgroup *mg;
-	char *name = NULL;
-	int node_count;
-	int mg_count;
-	int rv;
-	int i, j;
-
-	memset(mgs, 0, sizeof(mgs));
-
-	if (name) {
-		rv = gfsc_mountgroup_info(name, mgs);
-		if (rv < 0)
-			return;
-		mg_count = 1;
-	} else {
-		rv = gfsc_mountgroups(MAX_MG, &mg_count, mgs);
-		if (rv < 0)
-			return;
-	}
-
-	for (i = 0; i < mg_count; i++) {
-		mg = &mgs[i];
-
-		if (!i)
-			print_header();
-
-		printf("gfs          2     %-*s %08x %x\n",
-			16, mg->name, mg->global_id, mg->flags);
-
-		node_count = 0;
-		memset(&nodes, 0, sizeof(nodes));
-
-		rv = gfsc_mountgroup_nodes(mg->name, GFSC_NODES_MEMBERS,
-					   MAX_NODES, &node_count, nodes);
-		if (rv < 0 || !node_count)
-			goto do_nodeids;
-
-		qsort(nodes, node_count, sizeof(struct gfsc_node),
-		      gfsc_node_compare);
-
- do_nodeids:
-		printf("[");
-		np = nodes;
-		for (j = 0; j < node_count; j++) {
-			if (j)
-				printf(" ");
-			printf("%d", np->nodeid);
-			np++;
-		}
-		printf("]\n");
-	}
-}
-
-static int connect_daemon(char *path)
-{
-	struct sockaddr_un sun;
-	socklen_t addrlen;
-	int rv, fd;
-
-	fd = socket(PF_UNIX, SOCK_STREAM, 0);
-	if (fd < 0)
-		goto out;
-
-	memset(&sun, 0, sizeof(sun));
-	sun.sun_family = AF_UNIX;
-	strcpy(&sun.sun_path[1], path);
-	addrlen = sizeof(sa_family_t) + strlen(sun.sun_path+1) + 1;
-
-	rv = connect(fd, (struct sockaddr *) &sun, addrlen);
-	if (rv < 0) {
-		close(fd);
-		fd = rv;
-	}
- out:
-	return fd;
-}
-
-static void groupd_dump_debug(int argc, char **argv, char *inbuf)
-{
-	char outbuf[GROUPD_MSGLEN];
-	int rv, fd;
-
-	fd = connect_daemon(GROUPD_SOCK_PATH);
-	if (fd < 0)
-		return;
-
-	memset(outbuf, 0, sizeof(outbuf));
-	sprintf(outbuf, "dump");
-
-	rv = do_write(fd, outbuf, sizeof(outbuf));
-	if (rv < 0) {
-		printf("dump write error %d errno %d\n", rv, errno);
-		return;
-	}
-
-	do_read(fd, inbuf, GROUPD_DUMP_SIZE);
-
-	close(fd);
-}
-
-static int do_log(char *comment)
-{
-	char buf[GROUPD_MSGLEN];
-	int fd, rv;
-
-	fd = connect_daemon(GROUPD_SOCK_PATH);
-	if (fd < 0)
-		return fd;
-	memset(buf, 0, sizeof(buf));
-	snprintf(buf, sizeof(buf), "log %s", comment);
-	rv = write(fd, &buf, GROUPD_MSGLEN);
-	close(fd);
-	return rv;
-}
-
-int main(int argc, char **argv)
-{
-	int rv, version = 0; 
-
-	prog_name = argv[0];
-	decode_arguments(argc, argv);
-
-	switch (operation) {
-	case OP_LIST:
-
-		rv = group_get_version(&version);
-		if (rv < 0)
-			version = -1;
-
-		switch (version) {
-		case -1:
-			printf("groupd not running\n");
-			break;
-		case -EAGAIN:
-			printf("groupd compatibility mode 2 (pending)\n");
-			break;
-		case GROUP_LIBGROUP:
-			printf("groupd compatibility mode 1\n");
-			break;
-		case GROUP_LIBCPG:
-			printf("groupd compatibility mode 0\n");
-			break;
-		default:
-			printf("groupd compatibility mode %d\n", version);
-			break;
-		}
-
-		if (all_daemons) {
-			/* show the new cluster3 data (from daemons) in
-			   the new daemon-specific format */
-
-			if (verbose || ls_all_nodes) {
-				system("fence_tool ls -n");
-				system("dlm_tool ls -n");
-				system("gfs_control ls -n");
-			} else {
-				system("fence_tool ls");
-				system("dlm_tool ls");
-				system("gfs_control ls");
-			}
-
-			if (version == GROUP_LIBGROUP)
-				printf("Run 'group_tool ls' for groupd information.\n");
-
-		} else {
-			if (version == GROUP_LIBGROUP) {
-				/* show the same old cluster2 data (from groupd)
-				   in the same old format as cluster2 */
-
-				groupd_list(argc, argv);
-
-			} else if (version == GROUP_LIBCPG || version == -1) {
-				/* show the new cluster3 data (from daemons)
-				   in the (nearly) same old format as cluster2 */
-
-				fenced_list();
-				dlm_controld_list();
-				gfs_controld_list();
-
-				printf("Run 'group_tool ls -a' for daemon information.\n");
-			}
-		}
-		break;
-
-	case OP_DUMP:
-		if (opt_ind && opt_ind < argc) {
-			if (!strncmp(argv[opt_ind], "gfs", 3)) {
-				char gbuf[GFSC_DUMP_SIZE];
-
-				memset(gbuf, 0, sizeof(gbuf));
-
-				printf("dump gfs\n");
-				gfsc_dump_debug(gbuf);
-
-				do_write(STDOUT_FILENO, gbuf, strlen(gbuf));
-			}
-
-			if (!strncmp(argv[opt_ind], "dlm", 3)) {
-				char dbuf[DLMC_DUMP_SIZE];
-
-				memset(dbuf, 0, sizeof(dbuf));
-
-				printf("dump dlm\n");
-				dlmc_dump_debug(dbuf);
-
-				do_write(STDOUT_FILENO, dbuf, strlen(dbuf));
-			}
-
-			if (!strncmp(argv[opt_ind], "fence", 5)) {
-				char fbuf[FENCED_DUMP_SIZE];
-
-				memset(fbuf, 0, sizeof(fbuf));
-
-				fenced_dump_debug(fbuf);
-
-				do_write(STDOUT_FILENO, fbuf, strlen(fbuf));
-			}
-
-			if (!strncmp(argv[opt_ind], "plocks", 6)) {
-				char pbuf[DLMC_DUMP_SIZE];
-
-				if (opt_ind + 1 >= argc) {
-					printf("plock dump requires name\n");
-					return -1;
-				}
-
-				memset(pbuf, 0, sizeof(pbuf));
-
-				dlmc_dump_plocks(argv[opt_ind + 1], pbuf);
-
-				do_write(STDOUT_FILENO, pbuf, strlen(pbuf));
-			}
-		} else {
-			char rbuf[GROUPD_DUMP_SIZE];
-
-			memset(rbuf, 0, sizeof(rbuf));
-
-			groupd_dump_debug(argc, argv, rbuf);
-
-			do_write(STDOUT_FILENO, rbuf, strlen(rbuf));
-		}
-
-		break;
-
-	case OP_LOG:
-		if (opt_ind && opt_ind < argc) {
-			return do_log(argv[opt_ind]);
-		}
-	}
-
-	return 0;
-}
-
diff --git a/make/cobj.mk b/make/cobj.mk
index 03f1826..1d8a03f 100644
--- a/make/cobj.mk
+++ b/make/cobj.mk
@@ -1,14 +1,2 @@
 %.o: $(S)/%.c
 	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(REENT_CFLAGS) -c -o $@ $<
-
-# used by dlm/libdlm
-%_lt.o: $(S)/%.c
-	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
-
-# used by rgmanager/src/daemons
-%-noccs.o: $(S)/%.c
-	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(NOCCS_CFLAGS) -c -o $@ $<
-
-# used by fence/agents/xvm
-%-standalone.o: $(S)/%.c
-	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(STANDALONE_CFLAGS) -c -o $@ $<
diff --git a/make/defines.mk.input b/make/defines.mk.input
index 5cbffd1..0775137 100644
--- a/make/defines.mk.input
+++ b/make/defines.mk.input
@@ -2,17 +2,10 @@
 sbindir ?= ${DESTDIR}@SBINDIR@
 initddir ?= ${DESTDIR}@INITDDIR@
 libdir ?= ${DESTDIR}@LIBDIR@
-libexecdir ?= ${DESTDIR}@LIBEXECDIR@
-sharedir ?= ${DESTDIR}@SHAREDIR@
 docdir ?= ${DESTDIR}@DOCDIR@
-logdir ?= ${DESTDIR}@LOGDIR@
-logrotatedir ?= ${DESTDIR}@LOGROTATEDIR@
 mandir ?= ${DESTDIR}@MANDIR@
 module_dir ?= ${DESTDIR}@MODULE_DIR@
 incdir ?= ${DESTDIR}@INCDIR@
-mibdir ?= ${DESTDIR}@MIBDIR@
-snmpbin ?= @SNMPBIN@
-notifyddir ?= ${DESTDIR}@CONFDIR@/cman-notify.d
 
 # Build information
 
@@ -22,9 +15,6 @@ AR = ar
 RANLIB = ranlib
 
 CFLAGS += @CFLAGS@ -I@SRCDIR@/make
-CFLAGS += -DDEFAULT_CONFIG_DIR=\"@CONFDIR@\" -DDEFAULT_CONFIG_FILE=\"@CONFFILE@\"
-CFLAGS += -DENABLE_PACEMAKER=@ENABLE_PACEMAKER@
-CFLAGS += -DLOGDIR=\"@LOGDIR@\" -DSYSLOGFACILITY=@SYSLOGFACILITY@ -DSYSLOGLEVEL=@SYSLOGLEVEL@
 LDFLAGS += @LDFLAGS@
 
 SRCDIR = @SRCDIR@
@@ -33,68 +23,17 @@ OBJDIR = @OBJDIR@
 KERNEL_BUILD = @KERNEL_BUILD@
 KERNEL_SRC = @KERNEL_SRC@
 gfskincdir ?= @GFSKINCDIR@
-ccsincdir ?= @CCSINCDIR@
-ccslibdir ?= @CCSLIBDIR@
-cmanincdir ?= @CMANINCDIR@
-cmanlibdir ?= @CMANLIBDIR@
-dlmincdir ?= @DLMINCDIR@
-dlmlibdir ?= @DLMLIBDIR@
-dlmcontrolincdir ?= @DLMCONTROLINCDIR@
-dlmcontrollibdir ?= @DLMCONTROLLIBDIR@
-fenceincdir ?= @FENCEINCDIR@
-fencelibdir ?= @FENCELIBDIR@
-logtincdir ?= @LOGTINCDIR@
-logtlibdir ?= @LOGTLIBDIR@
 volidincdir ?= @VOLIDINCDIR@
 volidlibdir ?= @VOLIDLIBDIR@
-readlineincdir ?= @READLINEINCDIR@
-readlinelibdir ?= @READLINELIBDIR@
-ncursesincdir ?= @NCURSESINCDIR@
-ncurseslibdir ?= @NCURSESLIBDIR@
-slangincdir ?= @SLANGINCDIR@
-slanglibdir ?= @SLANGLIBDIR@
-nssincdir ?= @NSSINCDIR@
-nsslibdir ?= @NSSLIBDIR@
-nsprincdir ?= @NSPRINCDIR@
-nsprlibdir ?= @NSPRLIBDIR@
-corosyncincdir ?= @COROSYNCINCDIR@
-corosynclibdir ?= @COROSYNCLIBDIR@
-openaisincdir ?= @OPENAISINCDIR@
-openaislibdir ?= @OPENAISLIBDIR@
-corosyncbin ?= @COROSYNCBIN@
-xenincdir ?= @XENINCDIR@
-xenlibdir ?= @XENLIBDIR@
-ldapincdir ?= @LDAPINCDIR@
-ldaplibdir ?= @LDAPLIBDIR@
-virtincdir ?= @VIRTINCDIR@
-virtlibdir ?= @VIRTLIBDIR@
-zlibincdir ?= @ZLIBINCDIR@
-zliblibdir ?= @ZLIBLIBDIR@
-fence_agents ?= @FENCE_AGENTS@
-fenceagentslibdir ?= @FENCEAGENTSLIBDIR@
 experimental_build ?= @ENABLE_CRACK_OF_THE_DAY@
 legacy_code ?= @ENABLE_LEGACY_CODE@
 contrib_code ?= @ENABLE_CONTRIB@
-enable_virt ?= @ENABLE_VIRT@
-enable_pacemaker ?= @ENABLE_PACEMAKER@
 without_gfs-kernel/src/gfs ?= @DISABLE_GFSKERNEL@
-without_common ?= @DISABLE_COMMON@
-without_config ?= @DISABLE_CONFIG@
-without_cman/lib ?= @DISABLE_CMAN@
-without_cman ?= @DISABLE_CMAN@
-without_dlm ?= @DISABLE_DLM@
-without_group ?= @DISABLE_GROUP@
-without_fence ?= @DISABLE_FENCE@
 without_gfs ?= @DISABLE_GFS@
-without_gfs2 ?= @DISABLE_GFS2@
-without_rgmanager ?= @DISABLE_RGMANAGER@
 without_bindings ?= @DISABLE_BINDINGS@
 
 THISDIR = $(shell echo $(CURDIR) | sed -e 's|$(OBJDIR)/||g')
 S=$(SRCDIR)/$(THISDIR)
 
-CONFDIR=@CONFDIR@
-CONFFILE=@CONFFILE@
-
 UNINSTALL = perl @SRCDIR@/scripts/uninstall.pl
 FENCEPARSE = bash @SRCDIR@/scripts/fenceparse
diff --git a/make/fencebuild.mk b/make/fencebuild.mk
deleted file mode 100644
index 03fb62a..0000000
--- a/make/fencebuild.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-ifndef FENCEAGENTSLIB
-	ifndef SBINDIRT
-		SBINDIRT=$(TARGET)
-	endif
-endif
-
-all: $(TARGET)
-
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-$(TARGET):
-	${FENCEPARSE} \
-		${SRCDIR}/make/copyright.cf REDHAT_COPYRIGHT \
-		${RELEASE_VERSION} \
-		$(S) $@ | \
-	sed \
-		-e 's#@FENCEAGENTSLIBDIR@#${fenceagentslibdir}#g' \
-		-e 's#@MIBDIR@#${mibdir}#g' \
-		-e 's#@SNMPBIN@#${snmpbin}#g' \
-		-e 's#@LOGDIR@#${logdir}#g' \
-	> $@
-
-clean: generalclean
diff --git a/make/install.mk b/make/install.mk
index cbe9816..b99b861 100644
--- a/make/install.mk
+++ b/make/install.mk
@@ -19,10 +19,6 @@ endif
 ifdef SBINSYMT
 	cp -a ${SBINSYMT} ${sbindir}
 endif
-ifdef LCRSOT
-	install -d ${libexecdir}/lcrso
-	install -m644 ${LCRSOT} ${libexecdir}/lcrso
-endif
 ifdef INITDT
 	install -d ${initddir}
 	for i in ${INITDT}; do \
@@ -33,12 +29,6 @@ ifdef INITDT
 		fi; \
 	done
 endif
-ifdef UDEVT
-	install -d ${DESTDIR}/etc/udev/rules.d
-	for i in ${UDEVT}; do \
-		install -m644 $(S)/$$i ${DESTDIR}/etc/udev/rules.d; \
-	done
-endif
 ifdef KMODT
 	install -d ${module_dir}/${KDIRT}
 	install -m644 ${KMODT} ${module_dir}/${KDIRT}
@@ -47,25 +37,9 @@ ifdef KHEADT
 	install -d ${incdir}/linux
 	install -m644 ${KHEADT} ${incdir}/linux
 endif
-ifdef MIBRESOURCE
-	install -d ${mibdir}
-	install -m644 $(S)/${MIBRESOURCE} ${mibdir}
-endif
-ifdef FENCEAGENTSLIB
-	install -d ${DESTDIR}/${fenceagentslibdir}
-	install -m644 ${FENCEAGENTSLIB} ${DESTDIR}/${fenceagentslibdir}
-endif
 ifdef DOCS
 	install -d ${docdir}
 	for i in ${DOCS}; do \
 		install -m644 $(S)/$$i ${docdir}; \
 	done
 endif
-ifdef LOGRORATED
-	install -d ${logrotatedir}
-	install -m644 ${LOGRORATED} ${logrotatedir}
-endif
-ifdef NOTIFYD
-	install -d ${notifyddir}
-	install -m755 ${NOTIFYD} ${notifyddir}
-endif
diff --git a/make/uninstall.mk b/make/uninstall.mk
index dfa14dc..5a69a03 100644
--- a/make/uninstall.mk
+++ b/make/uninstall.mk
@@ -14,33 +14,15 @@ endif
 ifdef SBINSYMT
 	${UNINSTALL} ${SBINSYMT} ${sbindir}
 endif
-ifdef LCRSOT
-	${UNINSTALL} ${LCRSOT} ${libexecdir}/lcrso
-endif
 ifdef INITDT
 	${UNINSTALL} ${INITDT} ${initddir}
 endif
-ifdef UDEVT
-	${UNINSTALL} ${UDEVT} ${DESTDIR}/etc/udev/rules.d
-endif
 ifdef KMODT
 	${UNINSTALL} ${KMODT} ${module_dir}/${KDIRT}
 endif
 ifdef KHEADT
 	${UNINSTALL} ${KHEADT} ${incdir}/linux
 endif
-ifdef MIBRESOURCE
-	${UNINSTALL} ${MIBRESOURCE} ${mibdir}
-endif
-ifdef FENCEAGENTSLIB
-	${UNINSTALL} ${FENCEAGENTSLIB}* ${DESTDIR}/${fenceagentslibdir}
-endif
 ifdef DOCS
 	${UNINSTALL} ${DOCS} ${docdir}
 endif
-ifdef LOGRORATED
-	${UNINSTALL} ${LOGRORATED} ${logrotatedir}
-endif
-ifdef NOTIFYD
-	${UNINSTALL} ${NOTIFYD} ${notifyddir}
-endif
diff --git a/rgmanager/ChangeLog b/rgmanager/ChangeLog
deleted file mode 100644
index 2387815..0000000
--- a/rgmanager/ChangeLog
+++ /dev/null
@@ -1,629 +0,0 @@
-2008-04-16 Fabio M. Di Nitto <fabbione at fabbione.net>
-	* src/utils/clustat.c: Fix variable init
-
-2008-03-04 Lon Hohberger <lhh at redhat.com>
-	* src/resources/ASEHAagent.sh, Makefile: Add Sybase failover agent
-	* src/resources/oracledb.sh, Makefile: Add Oracle 10g failover agent
-
-2008-02-26 Lon Hohberger <lhh at redhat.com>
-	* src/resources/ip.sh: Fix netmask handling in ip.sh
-	* src/utils/clustat.c: Don't show estranged nodes if they're down
-
-2008-01-25 Lon Hohberger <lhh at redhat.com>
-	* src/daemons/rg_thread.c: Fix case that broke 'clusvcadm -e <service>
-	-n <node>' case #430220
-	* src/daemons/rg_state.c: Don't enable migrate-to-self (#430272)
-
-2008-01-02 Fabio M. Di Nitto <fabbione at ubuntu.com>
-	* src/resources/ocf-shellfuncs: Add interpreter.
-
-2007-12-30 Fabio M. Di Nitto <fabbione at ubuntu.com>
-	* src/daemons/rg_state.c, include/resgroup.h, src/clulib/alloc.c:
-	  Fix building when -DDEBUG is defined.
-
-2007-12-24 Fabio M. Di Nitto <fabbione at ubuntu.com>
-	* src/clulib/vft.c: Change ifdef to fix build on parisc.
-
-2007-12-19 Lon Hohberger <lhh at redhat.com>
-	* include/res-ocf.h: Fix typo
-	* src/daemons/restree.c: Export reference counts to resource agents.
-	* src/resources/clusterfs.sh: Use reference counts to ensure we
-	don't unmount a GFS file system if it's in use by multiple services
-	on the same node.  #254111
-	* src/resources/service.sh, default_event_script.sl: Add support for
-	"soft" dependencies if central_processing is enabled
-
-2007-12-14 Lon Hohberger <lhh at redhat.com>
-	(Misc central_events fixes)
-	* Add return code for inability to run because of exclusive 
-	tag
-	* Only initialize state once
-	* Fix master-node failover.
-	* Correctly return node after enable if request was forwarded
-
-2007-12-12 Lon Hohberger <lhh at redhat.com>
-	* Misc changes; add missing ds.h
-	* src/resources/default*.sl: Make clusvcadm -r go to a different
-	node.  Don't notice() that we're starting a service if it's
-	disabled.
-	* src/daemons/groups.c: Make clustat not interfere with startup
-	when central processing is enabled
-	* src/daemons/slang_event.c: Make clusvcadm correctly report
-	service owner after relocate/restart/enable requests.
-
-2007-11-30 Lon Hohberger <lhh at redhat.com>
-	* Commit RIND / S-Lang script engine [untested]
-
-[RHEL5 merged ChangeLog Entries]
-2007-11-30 Lon Hohberger <lhh at redhat.com>
-	* src/resources/clusterfs.sh: Retry mount up to 3 times to avoid
-	race condition during another process mounting a GFS volume
-	* src/resources/vm.sh, service.sh: Add defaults for values.
-	Make vm.sh work with more service attrs (max restarts)
-	* src/utils/clustat.c: Make output of clustat terminal-width 
-	dependent
-
-2007-11-26 Lon Hohberger <lhh at redhat.com>
-	* include/reslist.h: Add restart counters to resource node structure
-	(intended for top-level resources, i.e. services, vms...)
-	* include/restart_counter.h: Add header file for restart counter
-	* src/daemons/Makefile: Fix build to include restart counters
-	* src/daemons/restart_counter.c: Implement restart counters #247139
-	* src/daemons/fo_domain.c, groups.c, restart_counter.c, resrules.c,
-	restree.c, test.c: Glue for restart counters.
-	* src/daemons/reslist.c: Glue for restart counters.  Make expand_time
-	parser more robust to allow things like '1h30m' as a time value.
-	* src/daemons/main.c: Mark quorum disk offline in the correct
-	place to avoid extraneous log messages
-	* src/daemons/rg_state.c: Allow marking service as stopped if
-	stuck in recover state.  Make service which failed to start
-	go to stopped state.  Glue for restart counters.
-	* src/resources/service.sh, vm.sh: Add parameters for restart
-	counters #247139
-
-2007-11-14 Lon Hohberger <lhh at redhat.com>
-	* src/utils/clulog.c: Make clulog honor rgmanager log levels
-	(#289501)
-	* src/clulib/vft.c: Fix #303981 - crash on rgmanager restart in some
-	cases
-	* man/clusvcadm.8: Remove references to clushutdown from man page;
-	resolves #324151
-	* src/resources/netfs.sh: Apply patch from Marco Ceci to fix #358161
-	* src/resources/vm.sh: Make default migration policy live instead
-	of pause for Xen virtual machines.  Also make it configurable instead
-	of static.  Resolves #345871
-
-2007-11-13 Lon Hohberger <lhh at redhat.com>
-	* src/resources/clusterfs.sh: Add support for self_fence operation
-	to clusterfs resource agent
-	* src/resources/service.sh: Add default values to service.sh
-
-2007-10-26 Lon Hohberger <lhh at redhat.com>
-	* src/daemons/main.c, src/utils/clustat.c, clusvcadm.c:
-	Fix #354391
-
-2007-09-25 Lon Hohberger <lhh at redhat.com>
-	* src/daemons/restree.c: Apply patch to fix side case re: 229650
-	Patch from Simone Gotti. Resolves: #229650
-[End RHEL5 merged changes]
-
-2007-08-30 Lon Hohberger <lhh at redhat.com>
-	* src/daemons/restree.c, rg_state.c: Fix tree-restart bug
-	This is another part of #229650
-
-2007-08-22 Fabio M. Di Nitto <fabbione at ubuntu.com>
-	* include/list.h: Fix build with gcc-4.2.
-
-2007-08-15 Lon Hohberger <lhh at redhat.com>
-	* src/utils/clustat.c: Remove uninitialized var & fix logic /
-	spotted by Ryan McCabe
-
-2007-08-09  Fabio M. Di Nitto <fabbione at ubuntu.com>
-	* rgmanager/src/clulib/alloc.c: Undefine DEBUG when building on
-	PARISC. __builtin_address needs the same love as IA64.
-
-2007-08-02 Lon Hohberger <lhh at redhat.com>
-	* general: More fixes around #248727
-	* include/reslist.h, src/daemons/restree.c: Make last-value be
-	returned or resources which have been checked recently
-	* src/daemons/groups.c: Make VMs use migrate semantics instead of
-	relocate semantics when employing failover domain rules
-	* src/daemons/nodeevent.c: Fix VMs ending up on wrong nodes when
-	simultaneous boot occurs
-	* src/daemons/rg_forward.c: Fix erroneous timeout
-	* src/daemons/rg_state.c: Handle RG_STATE_MIGRATE in svc_advise_*
-	Handle certain migration failures.
-	* src/resources/vm.sh: Handle certain migration failures
-
-2007-07-31 Lon Hohberger <lhh at redhat.com>
-	* general: Make VMs not change state when added/removed from the
-	cluster config or bounce services/VMs when minor config changes
-	are made. (#248727)
-	* include/res-ocf.h: Add reconfigure operation
-	* include/reslist.h: Add flags allowing reconfigurable options in
-	resource agent metadata, and per-agent flags which allow resources
-	to be added w/o initialization / removed w/o kill.
-	* src/clulib/rg_strings.c: Add string definition for reconfigure op
-	* src/daemons/groups.c: Allow no-init-on-add and no-kill-on-delete
-	flags to work
-	* src/daemons/reslist.c: Allow resource comparison to take into 
-	account reconfig flags and return a new value if the resource is
-	reconfigurable
-	* src/daemons/resrules.c: Code to support new flags
-	* src/daemons/restree.c: Code to support reconfiguration operation
-	* src/daemons/test.c: Code to support testing new reconfig ops and
-	behaviors
-	* src/resources/*: Add new flags to service and VM resource agents.
-
-2007-07-23 Lon Hohberger <lhh at redhat.com>
-	* general: make threads exit with pthread_exit() so we can wrap/track them.
-	Add internal statedump (SIGUSR1) support.
-	* src/clulib/msg_cluster.c: Fix rare deadlock condition.  Add dump support.
-	* src/clulib/tmgr.c: Add thread wrappers so we can report threads in
-	internal state dumps.
-	* src/clulib/vft.c: Fix rare crash if vf_resolve_views gets called with
-	NULL.  Add dump support.
-	* src/daemons/main.c: Fix minor memory leak in membership_update().  Fix
-	crash-on-exit race.  Don't exit if someone requests foreground mode.
-	* src/daemons/rg_forward.c: Clean up forwarding logic and handle missed
-	case (forward-to-self -> ERROR!)
-	* src/daemons/rg_state.c: Move closing / free of contexts out of
-	send_ret/send_response to the caller (where they belong).  Don't let
-	people relocate disabled services.
-	* src/daemons/rg_thread.c: Don't loop forever if the thread exits before
-	we notice that it's started.
-	* src/daemons/clusvcadm.c: Fix error codes if you try to relocate when
-	rgmanager isn't running
-
-2007-07-12 Marek Grac <mgrac at redhat.com>
-	* src/resources/Makefile: Fix #245178 - install RA for named
-
-2007-07-10 Lon Hohberger <lhh at redhat.com>
-	* src/daemons/rg_thread.c, groups.c: Make status queue max 1 instead
-	of unbounded (resolves: 247488)
-
-2007-06-29 Lon Hohberger <lhh at redhat.com>
-	* src/daemons/groups.c, rg_state.c: Make all test cases for #237144
-	work correctly
-
-2007-06-27 Lon Hohberger <lhh at redhat.com>
-	* Merge from RHEL5 branch.
-	* src/daemons/vm.sh: Un-break migrate (#231692).  Make status
-	checks happen every 30 seconds instead of 30 minutes.
-	* include/resgroup.h: Move inline recovery flags to a header file,
-	add RG_STATUS_INQUIRY for locating virtual machines which may have
-	migrated.
-	* include/reslist.h: Change res_exec() back to using agent_op_str()
-	inline so we can squelch errors while performing RG_STATUS_INQUIRY
-	* src/clulib/rg_strings.c: Add new strings for new error code / 
-	request types
-	* src/daemons/groups.c: Change group_migrate() to use the correct
-	calling semantics
-	* src/daemons/main.c, nodeevent.c: Clean up cases which could cause
-	#244143
-	* src/daemons/resrules.c: Clear up noise
-	* src/daemons/restree.c: Squelch errors during RG_STATUS_INQUIRY
-	Patch up inline service recovery (#229650)
-	* src/daemons/rg_state.c: Don't let migrations or relocations to a
-	node running exclusive services occur in the first place and return
-	a useful error. (goes with #237144).  Locate virtual machines (or
-	generally, services with the 'migrate' ability) elsewhere in the
-	cluster prior to trying to start one.  Detect if someone migrates
-	such a service without using the cluster tools (#232300)
-	* src/daemons/test.c: Make rg_test do the right thing for migrate
-	operations
-
-2007-06-21 Fabio M. Di Nitto <fabbione at ubuntu.com>
-	* rgmanager/src/clulib/alloc.c: Undefine DEBUG when building on IA64.
-	The __builtin_address functionality should be taken from libunwind
-	but porting requires some work. For now use this workaround and
-	also make sure to wrap STACKSIZE withing DEBUG.
-
-2007-06-14 Lon Hohberger <lhh at redhat.com>
-	* include/resgroup.h: Fix size incompatibility on 32/64 bit mixed
-	clusters.  Put in stubs for intelligent handling of state sizes
-       	during a cluster upgrade.
-
-2007-06-14 Marek Grac <mgrac at redhat.com>
-        * src/daemons/main.c, rg_state.c, rg_thread.c,
-          src/utils/clusvcadm.c
-        * #211469 - RFE: Flag (-F) for clusvcadm to respect failover domain
-        * 'clusvcadm -e service00' works same as in RHEL4 (differs from RHEL5.0)
-	* -F for freeze was changed to -Z 
-
-2007-06-13 Lon Hohberger <lhh at redhat.com>
-	* src/daemons/restree.c: Fix #229650 uninitialized bug
-
-2007-05-31 Lon Hohberger <lhh at redhat.com>
-	* src/daemons/resrules.c: Fix #234249 - ignore obvious backup files
-	in /usr/share/cluster when processing resource rules
-	* src/daemons/restree.c, src/daemons/groups.c, include/reslist.h: 
-	Implement independent subtrees, per bug #229650
-
-2007-05-22 Lon Hohberger <lhh at redhat.com>
-	* src/resources/SAPInstance, SAPDatabase: Add primary attrs
-
-2007-05-09 Lon Hohberger <lhh at redhat.com>
-	* src/resources/Makefile: Install SAP agents
-
-2007-05-08 Lon Hohberger <lhh at redhat.com>
-	* src/resources/SAPInstance, SAPDatabase: Add SAP resource agents
-	from Alexander Krauth
-
-2007-04-27 Lon Hohberger <lhh at redhat.com>
-	* include/resgroup.h, src/clulib/rg_strings.c src/daemons/groups.c,
-	rg_state.c, rg_thread.c, src/utils/clustat.c, clusvcadm.c: Apply
-	patch to implement service freeze/unfreeze from Simone Gotti
-	* src/daemons/sbuf.c: Add simple buffer handlers for future use
-	by svc_status_inquiry
-
-2007-04-27 Fabio M. Di Nitto <fabbione at ubuntu.com>
-	* src/clulib/vft.c: Change ifdef to fix build on parisc.
-
-2007-04-26 Lon Hohberger <lhh at redhat.com>
-	* src/daemons/reslist.c: Try all direct ancestors while 
-	performing run-time inheritance resolution #231521
-
-2007-04-26 Fabio M. Di Nitto <fabbione at ubuntu.com>
-	* src/daemons/Makefile: use resrules-noccs in dtest build
-	target.
-
-2007-04-19 Lon Hohberger <lhh at redhat.com>
-	* src/daemons/groups.c, rg_state.c: Apply patch from Andrey
-	Mirkin to fix bug #237144; prevents exclusive services from
-	being accidentally (or intentionally) being started on the
-	same node
-	* src/resources/clusterfs.sh: Apply patch from Simone
-	Gotti to fix logging errors in clusterfs.sh
-	* src/daemons/main.c: Fix qdiskd being treated as an online
-	cluster node
-
-2007-04-12 Lon Hohberger <lhh at redhat.com>
-	* src/daemons/main.c: Fix watchdog race condition causing
-	reboot; patch from Andrey Mirkin; bugzilla #236204
-	
-2007-03-27 Lon Hohberger <lhh at redhat.com>
-	* Merge patch from Crosswalk development team:
-		* Scott Cannata
-		* Henry Harris
-		* Leonard Maiorani
-
-=====
-	
-2006-10-25 Lon Hohberger <lhh at redhat.com>
-	* src/resources/clusterfs.sh: Fix unmounting problem (#212074)
-
-2006-10-23 Lon Hohberger <lhh at redhat.com>
-	* src/resources/xenvm.sh: Gone; replaced with vm.sh.
-	* The C code parts: Fix deadlocks incurred while testing
-	rgmanager on larger node counts. #211701
-
-2006-10-06 Lon Hohberger <lhh at redhat.com>
-	* src/daemons/main.c: Fix #202492: provide rgmanager's view of
-	who is running rgmanager to clustat.
-	* src/daemons/groups.c: Fix tiny memory leak during configuration
-	changes
-	* include/resgroup.h: #202492: Flip unused RG_STATUS_INQUIRY to
-	RG_STATUS_NODE.
-	* src/utils/clustat.c: #202492: Send RG_STATUS_NODE to clurgmgrd
-	in order to obtain rgmanager "group" status information
-
-2006-09-27 Lon Hohberger <lhh at redhat.com>
-	* src/daemons/rg_state.c: Fix #208011 - failed->disabled state 
-	transition.  Fix node ID type.
-	* include/members.h: Add a third state to note that a node does
-	not need to be fenced as a result of rgmanager crashing.  Add protos
-	for memb_set_state and member_online functions.
-	* include/reslist.h: Fix type error; node IDs are 32-bit ints, not 
-	64-bit ints.
-	* src/clulib/members.c: Add member_set_state/online functions for
-	quick checks and sets of the protected member list.  Zero out
-	the node structure prior to calling cman_get_nodeid so that we 
-	don't get ENOENT (fixed clustat bug where clustat didn't report
-	the "local" flag).  Fix node ID type.
-	* src/daemons/fo_domain.c: Fix node ID type, fix shadow declaration
-	of member_online
-	* src/daemons/groups.c: Unfix logic error that wasn't broken in the
-	first place.
-	* src/daemons/main.c: Fix node ID types.  Add fourth ("clean")
-	param to node_event* to decide whether a node death is clean or not.
-	Nodes get marked clean if we get an RG_EXITING message, otherwise,
-	they are unclean, and we wait for fencing.  
-	* src/daemons/nodeevent.c: Add fourth param to node_event* to help
-	decide if we need to wait for a node to be fenced or not.  Fix
-	node ID type.
-	* src/utils/clustat.c: Fix logic error preventing nodes from properly
-	being flagged.  Apply patch from Fabio M. Di Nitto to fix bug where
-	clustat -s foo wasn't getting expanded to service:foo
-	* src/daemons/rg_forward.c, rg_thread.c: Make forwarding of enable
-	to specified target node work (#202498)
-
-2006-09-01 Lon Hohberger <lhh at redhat.com>
-	* include/resgroup.h: Add proto for rg_strerror
-	* include/vf.h: Add proto for vf_invalidate (flushes vf cache)
-	* src/clulib/rg_strings.c: Add rg_strerror function, define
-	human-readable strings for rgmanager error values
-	* src/clulib/vft.c: Add vf_invalidate (separate from vf_shutdown)
-	* src/daemons/groups.c: Fix obvious logic error
-	* src/daemons/main.c: Fix rg_doall() message during loss of quorum.
-	Invalidate local VF cache and kill resource configurations on
-	loss of quorum (#202497).  Send RG_EQUORUM back to clustat/clusvcadm
-	so that they report why they can't get information.  Don't queue
-	status checks if we've lost quorum.  Add command line parameter to
-	disable internal crash watchdog
-	* src/utils/clustat.c, clusvcadm.c: Handle SIGPIPE, and produce
-	useful errors if possible.
-
-2006-08-31 Marek Grác <mgrac at redhat.com>
-	* src/daemons/restree.c: Fix #203720. Do not run backup copies (ends
-	with ~) of resource agents.
-	* src/resources/apache.*, mysql.*: Add Apache & MySQL resource agents
-	* src/resources/utils/*: Add utility scripts for resource agents
-
-2006-08-21 Lon Hohberger <lhh at redhat.com>
-	* src/daemons/main.c: Fix #202500 - simultaneous starts confuse
-	rgmanager.  This happened due to the fact that rgmanager was not
-	correctly determining port listening status of other nodes on the
-	first pass, and subsequent attempts to determine status of other 
-	nodes were not tried.
-
-2006-08-18 Lon Hohberger <lhh at redhat.com>
-	* include/resgroup.h: Change ordering and add magic field to
-	rgmanager state field (warning: breaks compatibility from 08/08 CVS!)
-	* src/clulib/ckpt_state.c, src/daemons/rg_state.c: Fix bug
-	preventing correct operation of ckpt operation after initial boot.
-	Get rid of debug info.
-	* src/daemons/groups,c, main.c: Fix #202499 - shutdown while handling
-	transitions sometimes allows services to restart (due to not locking
-	RGs locally)
-	* src/resources/clusterfs.sh, fs.sh, nfsclient.sh: Add proper
-	warning messages if status check fails
-	* src/resources/ra-api-1-modified.dtd: Allow 'migrate' option
-	* include/clulog.h, src/daemons/clulog.c: Fix default log levels so
-	that they're LOG_NOTICE, and only one default is used (#200776)
-
-2006-08-08 Lon Hohberger <lhh at redhat.com>
-	* src/clulib/members.c: Fix gained/lost list creation so that the
-	count is actually nonzero (#201713)
-	* src/daemons/main.c: Fix typo in debug information.  Kill CMAN handle
-	before doing a member list update.  Don't call memb_online; just
-	check the cn_member field (optimization).  Don't process node event
-	until the node actually closes port (#201713).
-	* src/utils/clusvcadm.c: Fix relocation issues (#201711).
-
-2006-08-07 Lon Hohberger <lhh at redhat.com>
-	* src/clulib/ckpt_state.c: Preliminary implementation of replacement
-	for VF using AIS CKPT B.02.01 (w/ built-in test program)
-	* include/cman-private.h: Clean up APIs (cman APIs return
-	cman_handle_t, which is void*, should be using void ** all over)
-	* include/message.h: Bump context count to 128, add destination
-	node ID in header of packets.
-	* src/clulib/alloc.c: If we alloc the same size, return the same
-	block
-	* src/clulib/cman.c: API cleanups
-	* src/clulib/message.c: Add error checking to msg_print
-	* src/clulib/msg_cluster.c: Check destination in header before 
-        processing message remove dup #define for MAX_CONTEXTS, add
-	proto_error() macro for displaying protocol errors.  Use 'max' 
-	instead of 'fd' for select().  Use correct var when assigning
-	contexts.  Fix CMAN handles.  Return correct size from msg_send()
-	requests.
-	* src/clulib/msgtest.c: Fix CMAN handles
-	* src/clulib/vft.c: Don't handle VF_CURRENT inside comms thread
-	* src/daemons/main.c: Check to see if nodes are listening on our
-	port before we consider them running.  Handle VF_CURRENT requests
-	from other nodes.  Fail if we can't determine local node ID
-	* src/daemons/rg_forward.c: Give 10 minutes for responses to
-	forwarded requests.
-	* src/daemons/rg_state.c: Shorten RG state names.  Fix 'Uncertain'
-	output line.
-	* src/utils/clustat.c: Fix ccs_member_list() function.
-
-2006-05-23 Lon Hohberger <lhh at redhat.com>
-	* src/daemons/members.c: Zap pad fields on copy-out
-	* src/daemons/main.c: Give notice if skipping an event because of
-	locked services.  Call the self-watchdog init function
-	* src/daemons/watchdog.c: Add Stanko Kupcevic's self-watchdog from
-	CVS head (fixes #193247)
-	* src/daemons/groups.c: Add debug messages.  Actually count
-	resgroups during node transition handling
-	* src/daemons/rg_state.c: allow failover of stopping services if
-	the owner died (#193255)
-	* src/utils/clustat.c: fix typo, misc. usability problems (#192999)
-
-2006-05-16 Lon Hohberger <lhh at redhat.com>
-	* src/resources/nfsclient.sh: Fix 189218 - nfsclient not matching
-	wildcards correctly when checking status.  Allow disabling of
-	recovery for services where the nfs clients are ordered (this will
-	cause a full service restart, but works)
-	* src/resources/clusterfs.sh, fs.sh, svclib_nfslock, service.sh:
-	Implement rudimentary atomic bomb-style NFS lock reclaim handling
-	Needs compatible and correctly configured version of nfs-utils 
-	installed and running on the system.  For clusterfs.sh, ensure
-	that we flush buffers during service tear-down - regardless of
-	whether or not we unmount the file system.
-	* src/utils/clunfslock.sh: HA-callout program (/usr/sbin/clunfslock)
-	for use with the rpc.statd -H parameter.  Copies the client to all
-	cluster-managed mounted file systems so that it will get lock
-	reclaim notification on failover.
-
-2006-05-09 Lon Hohberger <lhh at redhat.com>
-	* include/list.h: Prevent dereferencing curr if it's null for some
-	reason
-	* include/resgroup.h: Clean up alignment, add rgmanager lock/unlock
-	message types
-	* src/daemons/Makefile: Add nodeevent.o to the build for rgmanager
-	* src/clulib/msgsimple.c: Misc code path cleanups
-	* src/clulib/vft.c: Add local reads for fast clustat operation.
-	* src/daemons/groups.c: Count all resource groups for all nodes 
-	in one pass, rather than one node per pass.  Split queueing of
-	status checks off so we never block the main thread.  Mark services
-	which have autostart=0 in the config as "disabled" to help remove
-	confusion between "disabled", "stopped", and the no-longer-needed
-	"stopped but behave like disabled" states. bz #182454 /
-	#190234 / #190408	
-	* src/daemons/fo_domain.c: Add patch from Josef Whiter to 
-	implement no-failback option for a given FO domain - bz #189841
-	* src/daemons/main.c: Queue node events for another thread to
-	handle, so we never block the main thread.  Also, implement 
-	cluster-wide service lock/unlock feature from clumanager 1.2.x
-	- bz #175010
-	* src/daemons/nodeevent.c: Split out node event queueing / handling
-	in to a separate thread so the main thread does not block
-	* src/daemons/rg_state.c: Return error codes if resource groups
-	are locked.
-	* src/daemons/rg_thread.c: Fix assertion failure causing segfault
-	in extremely rare cases.  Quash the rg queue during shutdown.
-	- bz #181539
-	* src/daemons/rg_state.c: Add fast local service state query to
-	reduce unnecessary lock contention
-	* src/daemons/groups.c: Handle request for expedited information
-	from clustat.
-	* src/daemons/main.c: Pass arg1 to send_rg_states() to enable fast
-	clustat operation.
-	* src/resources/fs.sh: Implement user/group quota support if 
-	enabled in the file system options
-	* src/utils/clustat.c: Misc. error handling.  Add single service / 
-	member output and add -Q to the help information.  #185952.
-	Added -f flag.
-	* src/utils/clusvcadm.c: Implement client-side of #175010
-	* src/utils/clustat.c: show transition time in clustat -x
-	- bz #191398
-	* src/resources/fs.sh: enable user/group quotas if enabled in the
-	options attribute - bz #191182
-	* init.d/rgmanager: fix typo - bz #191205
-
-
--------------
-
-2005-03-21 Lon Hohberger <lhh at redhat.com>
-	* init.d/rgmanager, Makefile: Fix up init script and add Makefile
-	so that the init script is properly installed #142754
-	* src/daemons/*: Fixes for #150344, #151187: Relocate to same node
-	returns failure, hang during shutdown if user relocate is in-flight.
-	Fix service state getting stuck in "recoverable" on fail-to-start
-	scenarios where other nodes failed (or no other node was available)
-	Rename "resourcegroup" to "service" to be consistent with UI
-	* src/resources/fs.sh, clusterfs.sh: Fix #151077: Force unmount broken
-	* src/resources/netfs.sh: Fix #151091: netfs status broken
-	* src/resources/resourcegroup.sh, service.sh: Remove resourcegroup,
-	rename to service.sh
-
-2005-03-14 Lon Hohberger <lhh at redhat.com>
-	* src/resources/clusterfs.sh, fs.sh: Make clusterfs actually work.
-	Clean up fs.sh + clusterfs.sh "status" when mount reports none/
-	devpets/usbdev/etc.
-	* src/daemons/test.c: Add a 'rules' test function for printing
-	resource rules to stdout.
-	* src/daemons/reslist.c: Fix 151095
-
-2005-03-07 Lon Hohberger <lhh at redhat.com>
-	* include/resgroup.h: Add STOP_USER so we can handle user 
-	STOP (instead of just DISABLE) requests.  #150333
-	* src/resources/fs.sh: umount should umount mount points, not
-	devices.  Handle symlinks to file system block devices.  #150481
-	* src/clulib/rg_strings.c: Add user stop string.
-	* src/clulib/gettid.c: errno fix from trunk
-	* src/clulib/vft.c: Connect timeout extension for VF
-	* src/daemons/main.c: Separate connect + login.  GuLM doesn't know
-	about SGs.
-	* src/daemons/rg_state.c: Change stop handling.  Add generic recover
-	function.
-	* src/daemons/rg_thread.c: Add support for RESTART, USER_STOP.
-	#150330, #150333
-	* src/utils/clusvcadm.c: Use USER_STOP to signal a user-called stop.
-	#150333
-
-2005-03-02 Lon Hohberger <lhh at redhat.com>
-	* include/clulog.h: Change default log level to INFO
-	* include/resgroup.h: Add proto for "best_target_node"
-	* src/clulib/clulog.c: Change log facility to LOG_DAEMON to match
-	other cluster daemons (e.g. lock_gulmd)
-	* src/daemons/groups.c: Add best_target_node, count_resource_groups.
-	Implement missing autostart-disable feature and requested exclusive
-	resource group feature.  Store configuration view number so we can
-	tell when the configuration changes.
-	* src/daemons/main.c: Print node state transition messages before
-	calling node_event().  Use do_status_checks() so we don't try to
-	check services we're not running.  Bump periodic status event
-	queueing to 10 seconds instead of 5.  Poll ccsd for config updates
-	since we have no other way to find them.  Fix bug preventing
-	status checks when clustat -i 1 is running.
-	* src/daemons/rg_state.c: Fix handle_relocate_req so that it uses
-	best_target_node() correctly.  Leave services which failed on all
-	current nodes as 'stopped', so the next node transition will cause
-	us to try to restart it automagically.  Consider recovery policy
-	when taking recovery action.
-	* src/daemons/rg_thread.c: Use recovery routine instead of start.
-	* src/daemons/restree.c: Fix tree delta updates.
-	* src/resources/resourcegroup.sh: Add 'exclusive' parameter.  Change
-	'autostart' to a boolean instead of string.  Add recovery policy
-	parameter.
-	* src/utils/clusvcadm.c: Make "relocate to node X" work.
-
-2005-02-28 Lon Hohberger <lhh at redhat.com>
-	*  errors.txt: Remove random whitespace at the bottom.
-	* include/resgroup.h: Add do_status_checks proto
-	* include/rg_queue.h: Remove __ definitions so as not to conflict
-	with glibc internals.
-	* include/vf.h: Increase VF_COORD_TIMEOUT to something reasonable.
-	* src/daemons/groups.c: Add do_status_checks().  We were previously
-	queueing status checks for RGs that we didn't own.  Not useful.
-	* src/daemons/main.c: Fix for #149410.
-	* src/daemons/rg_state.c: Fix various failover service problems.
-	* src/resources/script.sh: Remove "recover" from generic script
-	wrapper.
-
-=======================================================================
-
-2004-09-23 Lon Hohberger <lhh at redhat.com>
-	* include/reslist.h: Add needstart/needstop/common flags for
-	reconfiguration.  Added RS_CONDSTART/CONDSTOP to perform "stop
-	if needed/start if needed" operations after a resource [group]
-	reconfiguration.  Cleaned up structures.  Added NO_CCS define for
-	testing.
-	* src/daemons/fo_domain.c: Added NO_CCS defines for testing.
-	* src/daemons/main.c: Added reconfigure() stub function.  Added
-	testing support.
-	* src/daemons/reslist.c: Added comparsion + primary-attr functions
-	for resources.  Add printout of needstart/stop in resource dump.
-	* src/daemons/restree.c: Added resource list comparsion + 
-	resource tree comparison functions.  Added condstart/stop to ops
-	list.  Added CONDSTART/CONDSTOP handling in res_op.
-	* src/daemons/rg_locks.c: Added NO_CCS support for testing.
-
-2004-09-13 Lon Hohberger <lhh at redhat.com>
-	* include/resgroup.h: Add a default check interval.
-	* include/reslist.h: Add a recover operation, and put operations
-	and checks together in each instantiated resource structure.
-	* src/daemons/groups.c: Don't use the old rg_status() func --
-	its internals have changed.
-	* src/daemons/reslist.c: Duplicate the action structure of a 
-	parent resource type into an instantiated resource.
-	* src/daemons/resrules.c: Find the actions with the correct
-	path.
-	* src/daemons/restree.c: Add depth parameter to res_exec.  Add
-	do_status - find the highest check/status level to perform given
-	the elapsed time since another status operation was performed.
-	Add a reference count each time a resource is started on a node.
-	* src/daemons/rg_thread.c: Implement periodic status checks. 
- 	Currently (in contrast to clumanager 1.2), these status checks
-	are automatic and not configurable.
-	* src/resources/*: Misc updates re: check intervals, new 
-	parameters, etc.
-
-2004-09-07 Lon Hohberger <lhh at redhat.com>
-	* src/resources/group.sh: Add 'autostart' parameter to group 
-	entity
-	* src/daemons/*: Add support for OCF 'action' specifications.
-
-2004-08-30 Lon Hohberger <lhh at redhat.com>
-	* src/resources/*: Add status/monitor actions to metadata
-	* include/list.h: Update to fix compiler warnings.  This is not
-	complete; it's better to add a 'field' to structures requiring 
-	list specs.
-	* src/clulib/vft.c: Remove unnecessary pthread locks.
-	* src/daemons/*: Misc. code cleanups.
-
-2004-08-12 Lon Hohberger <lhh at redhat.com>
-	* global: prepare for RPM build
diff --git a/rgmanager/Makefile b/rgmanager/Makefile
deleted file mode 100644
index 8f730e3..0000000
--- a/rgmanager/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../make/defines.mk
-include $(OBJDIR)/make/passthrough.mk
-
-SUBDIRS=src man init.d
diff --git a/rgmanager/README b/rgmanager/README
deleted file mode 100644
index c8d73fe..0000000
--- a/rgmanager/README
+++ /dev/null
@@ -1,359 +0,0 @@
-This is a clustered resource group manager layered on top of Magma, a
-single API which can talk to multiple cluster infrastructures via their
-native APIs.  This resource manager requires both magma and one or more
-plugins to be available (the dumb plugin will work just fine, but will
-only get you one node...).
-
-
-Note: I tend to use "service" and "resource group" to mean the same
-thing.  While they are slightly different, "services" were simply
-collections of different things (IPs, file systems, etc.), as are
-resource groups.
-
-Introduction
-
-The resource manager is a daemon which provides failover of user-defined
-resource collected into groups.  It is a direct descendent of the
-Service Manager from Red Hat Cluster Manager 1.2, which is a descendent
-of Cluster Manager 1.0, which is a descendent of Kimberlite 1.1.0.
-The primary reason for a rename was to avoid confusion with the Service
-Manager present in David Tiegland's Symmetric Cluster Architecture paper
-and software, with which this application must collaborate.
-
-The simplicity, ease of maintenance, and stability in the field has led
-us to attempt to preserve as much of the method of operations of Cluster
-Manager's Service Manager, but certain aspects needed to be removed in
-order to provide a more flexible framework for users.
-
-At this point, the resource manager is designed primarily for cold
-failover (= application has to restart entirely).  This allows a lot of
-flexibility in the sense that most off-the-shelf applications can
-benefit from increased availability with minimal effort.  However, it
-may be extended to support warm and even hot failover if necessary,
-though these models require often require application modification -
-which is outside the scope of this readme.
-
-
-Goals and Requirements
-
-(1) Supercede Red Hat Cluster Manager's capabilities with respect to
-service modification.  Red Hat Cluster Manager's resource model was
-based on an old model from Kimberlite 1.1.0.  In this model, services
-were entirely monolithic, and had to be disabled in order to be changed.
-This meant that if one had an NFS service with a list of clients and a
-new client was added, all other clients had to lose access in order to
-add the new client.  In short, provide for on-line service modification
-and have intelligence about what to restart/reload after a new
-configuration is received.  Note that this intelligence is not yet
-completed, but the framework exists for it to be completed.
-
-(2) Be able to use CMAN/DLM/SM and GuLM cluster infrastructures.  This
-is done via magma.
-
-(3) Use CCS for all configuration data.
-
-(4) Be able to queue requests for services.  This is forward-looking
-towards things such as event scheduling (e.g. disable this resource
-group at this time in the future).
-
-(5) Provide an extensible set of rules which define resource structure.
-This is accomplished by providing rule sets which essentially define how
-resources may be defined in CCS.  These rule sets attempt to be OCF
-RA API compliant.  This has the side effect of partially solving (1)
-for us.
-
-(6) Use a distributed model for resource group/service state.  This is
-currently done with a port of the View-Formation code from Cluster
-Manager 1.2.  Ideally, it would be nice to use LVBs in the DLM or GuLM
-to distribute this state; but it probably requires >64 bytes (DLM's
-limit).  Another model is client-server like NFS, where clients tell
-the new master what resource groups they have.  However, this has
-implications if the server fails and was running a RG.
-
-(7) Combination of 3 and 6 gives us: no dependency on shared storage.
-
-(8) Be practical.  Try to follow the model from clumanager 1.x as much
-as possible without sacrificing flexibility.  It should be easy to
-convert an existing clumanager 1.2 user to use this RM.  While it will
-be impossible to perform a rolling upgrade from clumanager 1.2 to this
-RM, it should be easy to convert an existing installation's
-configuration information.
-
-(9) Try to be OCF compliant across how the resource scripts are written.
-While this is a goal, it is not a guarantee at this point.
-
-(10) Work with the same fencing model as clumanager and GFS (i.e.
-"top-down" - the infrastructure handles it).  Resource-based fencing,
-for example, is specifically not a goal at this point.
-
-(11) Be scalable without being overly complex ;)  Note that we're not
-very scalable at the moment (VF is too slow for this kind of thing)
-
-(12) Introduce other failover/balancing policies (instead of just
-failover domains).
-
-
-Directory Structure
-
-include/
-
-Include files
-
-src/daemons/
-
-The RM daemon and clurmtabd (from RHEL3), which keeps /var/lib/nfs/rmtab
-in sync with clustered exports, or tries to.
-
-src/utils/
-
-Home of various utilities including clustat and clusvcadm.
-
-src/clulib/
-
-Library functions which aren't necessarily tied to a specific daemon.
-This was more important in clumanager 1.2; and is mostly cruft at this 
-point.
-
-src/resources/
-
-Shell scripts and resource XML rules for various resources.  Includes
-a DTD to validate a given resource XML rule.
-
-
-Implementation - Handling of Client Requests
-
-The resource manager currently uses a threaded model which has a
-producer thread and a set of consumer threads with their own work
-queues.
-
- Client <--(result)---------+
-   |                        |
- (req)                      |
-   |                 [Handle request]
-   |                        ^
-   v                        |
-Listener --(req)--> Resource group thread
-
-In a typical example, the client sends a request to the listener thread.
-The listener accepts hands it off to a resource group queue and
-immediately resumes listening for requests.  Queueing the request on a
-resource thread queue has a side effect of spawning a new resource group
-thread if one is needed.  The resource group thread pulls the request
-off of its work queue and handles the request.  After the request
-completes, the resource thread sends the result of the operation back to
-the client.  If no other requests are pending and the last operation
-resulted in the resource group being in a non-running state (stopped,
-disabled, etc.), then the resource group thread cleans itself up and
-exits.
-
-The resource manager handles failed resource groups in a simplistic
-manner which is the same as how Red Hat Cluster Manager handled
-failover.  If a resource group fails a status check, the resource
-manager stops the affected RG.  If the 'STOP' operation succeeds, then
-the RM tries to restart the RG.  If this succeeds, the RM is done.
-
-However, if it fails to restart/recover the resource group, it again
-stops the RG and attempts to determine the best-available online node
-based on the failover domain or (not implemented yet) least-loaded
-cluster member.  If none are available, or all members fail to start the
-RG, the RG is disabled.
-
-
-Cluster Events
-
-Cluster events are provided by a cluster-abstraction library called
-Magma.  Magma currently runs with CMAN/DLM, gulm, or no cluster
-infrastructure at all (e.g. one node, always-quorate-pseudo-cluster).
-
-Magma provides group membership lists, state of the cluster quorum (if
-one exists), cluster locking, and (in some cases), barriers - so the RM
-needs to implement none of the above.
-
-Cluster events are handed to the listener thread via a file descriptor,
-and can affect resource group states.  For instance, when a member is no
-longer quorate, all resource groups are stopped immediately (and, quite
-normally, the member is fenced prior to this actually completing!).
-
-Whenever a node transition occurs (or in the SM case, a node joins the
-requisite service group), all RG states are evaluated to see if they
-should be moved about or started (or failed-over), depending on the
-failover domain (or other policies which are not yet implemented).
-
-
-The Resource Tree
-
-In clumanager 1.x (and Kimberlite, for that matter), the attributes of
-various resources attributes were read one by one, as required, inside
-of a large shell script.  This had several benefits (hard dependency
-enforcment, maintenance, support, etc.), but had several drawbacks as
-well; the most important being flexibility.
-
-In contrast to clumanager 1.x, the resource groups are now modeled in
-the daemon's RAM as tree structures with all their requisite
-attributes loaded from CCS based on external XML rules.
-
-After a resource is started, it follows down the tree and starts all
-dependent children.  Before a resource is stopped, all of its dependent
-children are first stopped.  Because of this structure, it is possible
-to add or restart, for instance, an "NFS client" resource without
-affecting its parent "export" resource.  By determining the delta
-between resource lists and/or resource trees, it's possible to use this
-information to automatically restart a node in the tree and all its
-dependent children in the event of a configuration change.
-
-The tree can be summarized as follows:
-
-	group
-		ip address...
-		file system...
-			NFS export...
-				NFS client...
-		samba share(s)...
-		script...
-
-
-Resource Agents
-
-Resource agents are scripts or executables which handle operations for a
-given resource (such as start, stop, restart, etc.).  See the OCF RA API
-v1.0 for more details on how the resource agents work:
-
-	http://www.opencf.org/cgi-bin/viewcvs.cgi/specs/ra/
-
-The resource agents and handling should be OCF compliant (at least in
-how they are called), primarily because it is fairly nonsensical to
-require third party application developers to write multiple differing
-application scripts in order to have their application work in different
-cluster environments on an otherwise similar system [1].
-
-
-The XML Resource Rules
-
-The XML Resource Rules are encapsulated in the resource agent scripts,
-which attempt to follow the OCF RA API 1.0.  The RA API, however, does
-not work with the goals of this project as it exists today, so there are
-a few extensions to the ra-api-1.dtd.
-
-  * Addition of a 'required' tag parameter elements.  This allows the UI
-    and/or the resource group manager to determine if a resource is
-    configured properly without having to ask the resource agent itself.
-  * Addition of a 'primary' tag parameter elements.  This allows the
-    resource tree to reference resource instances using the 'ref='
-    tag in the code.
-  * Addition of an 'inherit' tag to allow resources to inherit a parent
-    resources' parameters.
-
-Additionally, there is some data which is used in the 'special' element
-of the RA API DTD.
-
-Description of rgmanager-specific block.
-
-<!ELEMENT attributes>
-<!ATTLIST 
-	root		(0|1)		#IMPLIED
-	maxinstances	CDATA		#IMPLIED>
-
-  * root: This is the root resource type.  This should only exist in the
-    'group' resource, generally.
-  * maxinstances: This is the maximum number of instances in the resource
-    tree this resource may exist.
-
-Description of a resource type or attribute.
-
-<!ELEMENT child EMPTY>
-<!ATTLIST child
-	type		CDATA		#REQUIRED
-	start		CDATA		#IMPLIED
-	stop		CDATA		#IMPLIED>
-
-Describes a valid child rule type.
-
-  * type: Resource type which is to be declared as a valid child for
-    this resource type.
-  * start: Start level of this child type.  All resource children at
-    level '1' are started before all resource children at level '2'.
-    Valid values are 1-99.
-  * stop: Stop level of this child type.  All resource children at level
-    '1' are stopped before all resource children at level '2'.
-    Valid values are 1-99.
-
-
-Failover Domains
-
-A failover domain is an ordered subset of cluster members to which a
-resource group may be bound. The following is a list of semantics
-governing the options as to how the different configuration options
-affect the behavior of a resource group which is bound to a particular
-failover domain:
-
-  * restricted domain: Resource groups bound to the domain may only run
-    on cluster members which are also members of the failover domain. If
-    no members of the failover domain are available, the resource group
-    is placed in the stopped state.
-
-  * unrestricted domain: Resource groups bound to this domain may run on
-    all cluster members members, but will run on a member of the domain
-    whenever one is available. This means that if a resource group is
-    running outside of the domain and a member of the domain transitions
-    online, the resource group will migrate to that cluster member.
-
-  * ordered domain: Nodes in an ordered domain are assigned a priority
-    level from 1-100, priority 1 being the highest and 100 being the 
-    lowest.  A member of the highest priority group will run a resourece
-    group bound to a given domain whenever one is online.  This means
-    that if member A has a higher priority than member B, the resource
-    group will migrate to A if it was running on B if A transitions from
-    offline to online.
-
-  * unordered domain: Members of the domain have no order of preference;
-    any member may run the resource group. Resource groups will always
-    migrate to members of their failover domain whenever possible,
-    however, in an unordered domain.
-
-Ordering and restriction are flags and may be combined in any way (ie,
-ordered+restricted, unordered+unrestricted, etc.). These combinations
-affect both where resource groups start after initial quorum formation
-and which cluster members will take over resource groups in the event
-that the resource group or the member running it has failed (without
-being recoverable on that member).
-
-
-Failover Domains (Examples)
-
-Given a cluster comprised of this set of members: {A, B, C, D, E, F, G}
-
-Ordered, restricted failover domain {A(1), B(2), C(3)}. A resource group
-'S' will always run on member 'A' whenever member 'A' is online and
-there is a quorum.  If all members of {A, B, C} are offline, the
-resource group will be stopped. If the resource group is running on 'C'
-and 'A' transitions online, the resource group will migrate to 'A'.
-
-Unordered, restricted failover domain {A, B, C}. A service 'S' will only
-run if there is a quorum and at least one member of {A, B, C} is online.
-If another member of the domain transitions online, the service does not
-relocate.
-
-Ordered, unrestricted failover domain {A(1), B(2), C(3)}. A resource
-group 'S' will run whenever there is a quorum. If a member of the
-failover domain is online, the resource group will run on the highest
-ranking member. That is, if 'A' is online, the resource group will run
-on 'A'.
-
-Unordered, unrestricted failover domain {A, B, C}. This is also called a
-"Set of Preferred Members". When one or more members of the failover
-domain are online, the service will run on a nonspecific online member
-of the failover domain. If another member of the failover domain
-transitions online, the service does not relocate.
-
-
-
-Notes:
-
-[1] Lars Marowsky-Bree pointed this out; which makes perfect sense.  The
-OCF RA API attempts to follow LSB with respect to how init-scripts
-handle starting/stopping/status of daemons and such, so it was directly
-in line with where we were going with this RM.
-
-[2] This is derived from the OCF RA metadata DTD:
-
-	http://www.opencf.org/cgi-bin/viewcvs.cgi/specs/ra/ra-api-1.dtd
diff --git a/rgmanager/errors.txt b/rgmanager/errors.txt
deleted file mode 100644
index 0cda423..0000000
--- a/rgmanager/errors.txt
+++ /dev/null
@@ -1,552 +0,0 @@
-Service (Resource Group) Manager Errors
-
-Herein lie explanations as to the various errors and warnings that you may
-see while running the resource group manager.  This is meant to be
-all-inclusive; if any error messages or warning messages are experienced
-which are not explained below, please file a bugzilla:
-
-http://bugzilla.redhat.com/bugzilla
-
-#1: Quorum Dissolved
-
-The cluster infrastructure has reported to the resource group manager that
-the local node and/or entire cluster is inquorate.  At this point, all
-services and resources managed by the resource group manager are stopped
-and the resource group manager restarts, waiting for a quorum to form.
-
-If this node was disconnected, it should be evicted and fenced by the rest
-of the cluster.  Nodes which become inquorate may reboot themselves.
-
-#2: Service <name> returned failure code.  Last owner: <name>
-
-The resource group named <name> has failed to stop.  This generally means
-that it may not be automatically recovered and that the system administrator
-must intervene in order to cleanly restart the service.  Services which
-fail must first be disabled then re-enabled.  However, be sure that all
-resources have been properly cleaned up first.  Generally, a hard reset
-of the node on which the service failed will restore it to working order
-and is the safest measure to take prior to restarting the failed service.
-
-This, however, is not required.
-
-#3: Service <name> returned failure code.  Last owner:
-<integer>
-
-Same as #2, but the node name was not determinable given the node ID.
-
-#4: Administrator intervention required.
-
-Only occurs after #2 or #3.  Complaint stating that the administrator
-must take action after a service failed.  See #2.
-
-#5: Couldn't connect to ccsd!
-
-The resource group manager was unable to connect to ccsd.  This generally
-means that ccsd was not running at the time the resource group manager
-tried to connect.  Starting ccsd generally solves this.  If this does
-not solve it, try checking firewall rules to ensure that the connection
-to ccsd's port is not blocked.  Additionally, it could be that there is
-a conflict between ccsd and the version of the system library (libccs) that
-rgmanager was built against.
-
-#6: Error loading services
-
-The resource group manager was unable to load configuration information
-from ccsd.  This could mean a communication problem or an invalid
-configuration. 
-
-This error is fatal; the resource group manager aborts.
-
-#7: Error building resource tree
-
-The resource group manager was unable to load configuration information
-from ccsd.  This could mean a communication problem or an invalid
-configuration.
-
-This error is fatal; the resource group manager aborts.
-
-#8: Couldn't initialize services
-
-The resource group manager was unable to load configuration information
-from ccsd.  This could mean a communication problem or an invalid
-configuration.
-
-#9: Couldn't connect to cluster
-
-The resource group manager was unable to find a plugin which was able to
-talk to the cluster infrastructure.  Generally, this occurs when no cluster
-infrastruture is running.  Try starting the preferred cluster infrastructure
-for your configuration (e.g. CMAN+DLM, GuLM) and restarting rgmanager.
-
-#10: Couldn't set up listen socket
-
-The resource group manager was unable to bind to its listening socket.
-This generally happens when there is already a resource group manager running,
-but it is possible for other applications to use the port that rgmanager
-wants to use for this purpose.
-
-#11: Couldn't set up VF listen socket
-
-The resource group manager was unable to bind to its listening socket which
-is used fo internal state distribution.  This generally happens when there
-is already a resource group manager running, but it is possible for other
-applications to use the port that rgmanager wants to use for this purpose.
-
-#12: RG <name> failed to stop; intervention required
-
-The resource group manager has failed to cleanly stop a service.
-See #2 for actions to take.
-
-#13: Service <name> failed to stop cleanly
-
-The resource group manager has failed to cleanly stop a service after
-failing to start the same resource group during an enable or start operation.
-See #2 for actions to take.
-
-#14: Failed to send <integer> bytes to <integer>
-
-During a broadcast operation to all nodes, the view-formation library has
-failed to send a message to one of the nodes.  This is generally recovered
-automatically.
-
-#15: rmtab_modified: stat: <error>
-
-The stat(2) function received an error while scanning for changes to
-/var/lib/nfs/rmtab.  Though generally handled automatically, repeats of
-this kind of error could indicate a problem with /var/lib/nfs/rmtab.
-
-If repeated errors occur:
- * Ensure /var/lib/nfs exists and is a directory.
- * Ensure /var/lib/nfs/rmtab exists and is a regular file (not a directory)
-
-#16: Failed to reread rmtab: <error>
-
-Clurmtabd had trouble reading or parsing /var/lib/nfs/rmtab.  This could
-mean that there is garbage in /var/lib/nfs/rmtab or that the internal
-format has changed or some problem with the filesystem.  If the latter is
-suspected, please file a Bugzilla.  Ensure you include your
-/var/lib/nfs/rmtab and version of rgmanager.
-
-#17: Failed to prune rmtab: <error>
-
-Clurmtabd failed to prune a new copy of /var/lib/nfs/rmtab against its 
-specified mount point.
-
-#18: Failed to diff rbtab: <error>
-
-Clurmtabd failed to determine the differences, if any, between a previous
-copy of /var/lib/nfs/rmtab and the current data stored there.
-
-#19: (Obsolete)
-
-#20: Failed to set log level
-
-Clurmtabd failed to change its log level to the specified level.  This
-is non-fatal.  The side effect is that more or less verbose logging will
-be seen depending on whether the log level was increased or decreased.
-
-#21: Couldn't read/create <filename>
-
-Clurmtabd stores service-specific rmtab information in
-<mount_point>/.clumanager/rmtab so that when the service fails over,
-the new instance of clurmtabd on the other node can pick up and know which
-hosts already have mounted any NFS exports.  This error could indicate that
-clients will receive ESTALE (Stale NFS file handle) after failover.
-
-#22: Failed to read <filename>: <error>
-
-Clurmtabd failed to read or parse <filename>.  This could indicate garbage
-in that file, or another error.  This could have side effects of ESTALEs
-being received by clients.  The error should be indicative of the cause.
-
-#23: Failed to read /var/lib/nfs/rmtab: <error>
-
-Clurmtabd failed to read or parse <filename>.  This could indicate garbage
-in that file, or another error.  This could have side effects of ESTALEs
-being received by clients.  The error should be indicative of the cause.
-
-#24: Failed to prune rmtab: <error>
-
-Clurmtabd failed to prune unrelated entries in /var/lib/nfs/rmtab.  The
-error should be indicative of the cause.
-
-#25: Failed to write /var/lib/nfs/rmtab: <error>
-
-Clurmtabd failed to atomically write a new copy of /var/lib/nfs/rmtab after
-merging changes between private cluster data (<mount_point>/.clumanager/rmtab)
-and the system-wide copy (/var/lib/nfs/rmtab).  The error should be indicative
-of the cause.
-
-#26: Failed to write <filename>: <error>
-
-Clurmtabd failed to atomically write a new copy of its private cluster data
-file after changes between it and the system-wide copy in
-(/var/lib/nfs/rmtab).  The error should be indicative of the cause.
-
-#27: Couldn't initialize - exiting
-
-Clurmtabd failed to initialize for one reason or another.  A previous
-error should indicate the reason why.
-
-#28: daemonize: <error>
-
-Clurmtabd failed to become a daemon.  The possible reasons this could happen
-are documented in fork(2) and setsid(2).
-
-#29: rmtab_write_atomic: <error>
-
-Clurmtabd failed to atomically write a new copy of /var/lib/nfs/rmtab after
-merging changes between private cluster data (<mount_point>/.clumanager/rmtab)
-and the system-wide copy (/var/lib/nfs/rmtab).  The error should be indicative
-of the cause.
-
-#30: Node <name> defined multiple times in domain <domain>
-
-This indicates a configuration error where a node <name> was defined more
-than once in a given failover domain <domain>.  If this occurs, only the first
-entry for the node <name> will be used. Remove the duplicate copy and restart
-rgmanager on all nodes.
-
-#31: Domain <domain> defined multiple times
-
-This indicates a configuration error where a domain <domain> was defined
-more than once.  Failover domains may not have duplicate names.  If this
-occurs, the first one found will be used.
-
-#32: Code path error: Invalid return from node_in_domain()
-
-If this occurs, please file a Bugzilla.
-
-#33: Unable to obtain cluster lock: <error>
-
-This occurs while evaluating services after a node transition.  If
-this occurs, the current service under evaluation will not be able
-to be checked for possible starting.
-
-Possible reasons obtaining a cluster lock would fail:
- * Loss of node/cluster quorum
- * Broken connection to GuLM/DLM
- * Error in magma-plugins package.
-
-#34: Cannot get status for service <name>
-
-This occurs while evaluating services after a node transition.  The
-service <name> has an indeterminable state.  This could indicate a
-bug with the data distribution subsystem, or an invalid service.
-
-#35: Unable to inform partner to start failback
-
-This occurs after a node transition where a node asks other nodes for
-services (resource groups) which it should own.  This generally indicates
-a communication problem between the cluster nodes.  If this occurs,
-services may not migrate to the node which just came online.
-
-#36: Cannot initialize services
-
-The resource group manager could not initialize services after a node
-transition.  This is fatal, and rgmanager exits uncleanly afterward.
-
-#37: Error receiving message header
-
-This occurs after an incoming request causes the resource group manager to
-accept a new connection.  After a new connection is received, there is a
-short amount of time during which to receive the message header.  If this
-does not occur, the connection is dropped and the message (if any) is
-rejected.
-
-#38: Invalid magic: Wanted 0x<hex>, got 0x<hex>
-
-This occurs after an incoming request causes the resource group manager to
-accept a new connection.  This could indicate a mismatched version between
-resource group managers or an unauthorized program attempting to communicate
-with the resource group manager.  The connection is dropped and the message
-is rejected.
-
-#39: Error receiving entire request
-
-This occurs after an incoming request causes the service manager to
-accept a new connection.  The amount of data received did not match the amount
-of data specified in the message header.  This could indicate a mismatched
-version between service managers or an unauthorized program attempting
-to communicate with the service manager.  The connection is dropped
-and the message is rejected.
-
-#40: Error replying to action request.
-
-A resource action request was received (enable/disable/etc.) while the 
-resource groups were locked and we failed to reply properly to the waiting
-client connection.
-
-#41: Couldn't obtain lock for RG <name>: <error>
-
-While trying to report a failed service (resource group) to the other
-cluster members, we failed to obtain a cluster lock.  This could indicate
-that the cluster quorum has dissolved, communication errors with the lock
-server, or other problems.  The effect of this is, however, minimal; simply
-put, the #2 and #3 messages won't appear in the logs, so the last owner
-of the service will be unknown.
-
-See #33 for reasons as to why obtaining a lock might fail.
-
-#42: Cannot stop service <name>: Invalid State <integer>
-
-The service <name> could not be stopped.  It was in an invalid state.
-This could indicate a bug in rgmanager.
-
-#43: Service <name> has failed on all applicable members; can not
-start.
-
-I don't know how to make this more verbose.  The service must be disabled and
-enabled prior to being allowed to start.  See #2 and #3 for more information.
-
-#44: Cannot start service <name>: Invalid State <integer>
-
-The service <name> could not be stopped.  It was in an invalid state.
-This could indicate a bug in rgmanager.
-
-#45: Unable to obtain cluster lock: <error>
-
-This occurs while trying to determine the state of a resource group prior
-to starting it.  If this occurs, the start operation will fail.  The error
-should be indicative of the reason.
-
-See #33 for reasons as to why obtaining a lock might fail.
-
-#46: Failed getting status for RG <name>
-
-This occurs while trying to determine the state of a resource group prior
-to starting it.  If this occurs, the start operation will fail.
-
-Generally, this indicates attempt to retrieve the current view of that 
-resource group's state after quorum has dissolved.
-
-#47: Failed changing service status
-
-This occurs while trying to write out a new ownership state of a resource 
-group prior to starting it.  If this occurs, the start operation will fail.
-
-Generally, this indicates attempt to write a new view of that resource
-group's state after quorum has dissolved.
-
-#48: Unable to obtain cluster lock: <error>
-
-This occurs while trying to determine the state of a resource group prior
-to performing a status operation on it.  If this occurs, the status
-operation will fail.
-
-See #33 for reasons as to why obtaining a lock might fail.
-
-#49: Failed getting status for RG <name>
-
-This occurs while trying to determine the state of a resource group prior
-to performing a status operation on it.  If this occurs, the status
-operation will fail.
-
-Generally, this indicates attempt to retrieve the current view of that 
-resource group's state after quorum has dissolved.
-
-#50: Unable to obtain cluster lock: <error>
-
-This occurs while trying to determine the state of a resource group prior
-to performing a stop or disable operation on it.  If this occurs, the stop
-operation will fail.
-
-If a stop operation fails on a service, the service is marked as 'failed',
-if possible.
-
-See #33 for reasons as to why obtaining a lock might fail.
-See #2 for steps to take after a resource group has failed.
-
-#51: Failed getting status for service <name>
-
-This occurs while trying to determine the state of a resource group prior
-to performing a stop or disable operation on it.  If this occurs, the stop
-operation will fail.
-
-Generally, this indicates attempt to retrieve the current view of that 
-resource group's state after quorum has dissolved.
-
-If a stop operation fails on a service, the service is marked as 'failed',
-if possible (if the cluster is not quorate, then this is not possible).
-
-See #2 for steps to take after a resource group has failed.
-
-#52: Failed changing RG status
-
-This occurs while trying to write out a new ownership state of a resource 
-group prior to stopping it.  If this occurs, the stop operation will fail.
-
-Generally, this indicates attempt to write a new view of that resource
-group's state after quorum has dissolved.
-
-See #2 for steps to take after a resource group has failed.
-
-#53: Unable to obtain cluster lock: <error>
-
-This occurs while trying to determine the state of a resource group after
-performing a stop or disable operation on it.  If this occurs, the stop
-operation will fail.
-
-If a stop operation fails on a service, the service is marked as 'failed',
-if possible.
-
-See #33 for reasons as to why obtaining a lock might fail.
-See #2 for steps to take after a resource group has failed.
-
-#54: Failed getting status for RG <name>
-
-This occurs while trying to determine the state of a resource group after
-to performing a stop or disable operation on it.  If this occurs, the stop
-operation will fail.
-
-Generally, this indicates attempt to retrieve the current view of that 
-resource group's state after quorum has dissolved.
-
-If a stop operation fails on a service, the service is marked as 'failed',
-if possible (if the cluster is not quorate, then this is not possible).
-
-#55: Failed changing RG status
-
-This occurs while trying to write out a new ownership state of a resource 
-group after stopping it.  If this occurs, the stop operation will fail.
-
-Generally, this indicates attempt to write a new view of that resource
-group's state after quorum has dissolved.
-
-See #2 for steps to take after a resource group has failed.
-
-#55: Unable to obtain cluster lock: <error>
-
-This occurs while trying to determine the state of a resource group after
-a stop operation has failed, while the cluster is trying to disable
-the service.  If this occurs, the operation will fail.
-
-See #33 for reasons as to why obtaining a lock might fail.
-See #2 for steps to take after a resource group has failed.
-
-#56: Failed getting status for RG <name>
-
-This occurs while trying to determine the state of a resource group after
-failing to perform a stop or disable operation on it.  If this occurs,
-the operation to lock the service will fail.
-
-Generally, this indicates attempt to retrieve the current view of that 
-resource group's state after quorum has dissolved.
-
-#57: Failed changing RG status
-
-This occurs while trying to write out a new ownership state of a resource 
-group after marking it as failed.  If this occurs, the stop operation
-will fail.
-
-Generally, this indicates attempt to write a new view of that resource
-group's state after quorum has dissolved.
-
-See #2 for steps to take after a resource group has failed.
-
-#58: Failed opening connection to member #<integer>
-
-We attempted to relocate a resource group (service) to another node, but
-failed to actually connect to that node's resource group manager.  This
-could indicate that rgmanager is not running on that node.  In any case,
-the next node in the cluster member list is tried.
-
-#59: Error sending relocate request to member #<integer>
-
-We attempted to relocate a resource group (service) to another node, but
-failed to send the relocation message.  This could indicate a problem with
-network connectivity, extremely high local/remote load, or other problems.
-The next node in the cluster member list is tried.
-
-#60: Mangled reply from member #<integer> during RG relocate
-
-We sent a resource group to another node, but it failed to send us a 
-useful reply.  At this point, the state of the resource group is unknown, but
-we give it the benefit of the doubt and assume it started okay.
-
-#61: Invalid reply from member <integer> during relocate operation!
-
-Similar to #60, but this occurs only after the inital preferred node failed
-to start the service and/or failed to communicate a proper reply.
-
-#62: /var/lib/nfs/rmtab does not exist - creating
-
-/var/lib/nfs/rmtab did not exist.  Clurmtabd creates it.
-
-#63: Couldn't write PID!
-
-Clurmtabd failed to write its pid to <mount_point>/.clumanager/pid.  This
-will cause fs.sh to kill it with -9 during a stop operation, preventing
-it from synchronizing with /var/lib/nfs/rmtab prior to exiting.  This
-increases the risk of ESTALE (Stale NFS file handle) on clients after
-a relocation.
-
-#64: Could not validate <mount_point>
-#65: NFS failover of <mount_point> will malfunction
-
-Clurmtabd failed to initialize the mount point's private cluster rmtab
-file.  This will prevent updating of that mount point's rmtab file, which
-means that clients will receive ESTALE after a relocation or failover.
-
-#66: Domain '<domain>' specified for resource group <name> nonexistent!
-
-The failover domain <domain> does not exist in the current view of the
-cluster configuration.  This is a configuration error.
-
-#67: Shutting down uncleanly
-
-The node has left the cluster cleanly, but rgmanager was still running.
-All services are halted as quickly as possible to prevent data corruption.
-
-(It may be a good idea to have rgmanager reboot if this is received)
-
-#68: Failed to start <name>; return value: <integer>
-
-The resource group <name> failed to start and returned the value <integer>.
-This could indicate missing resources on the node or an improperly configured
-resource group.  Check your resource group's configuration against your 
-hardware and software configuration and ensure that it is correct.
-
-#69: Unclean [stop|disable] of <name>
-
-The resource group is being stopped because of a local node exiting or
-loss of quorum.  The distributed state is left unchanged.
-
-#70: Attempting to restart resource group <name> locally.
-
-The resource group failed to start on all other applicable nodes during
-processing of a relocate operation.  (A relocate operation occurs either
-by an administrator manually relocating a service or the service being
-relocated after a fail-to-restart event.)
-
-#71: Relocating failed service <name>
-
-The resource group <name> failed a status check and subsequently failed to
-restart.  At this point, we try to send it to another applicable node in
-the cluster.
-
-#72: clunfsops: NFS syscall <name> failed: <error>.
-#73: clunfsops: Kernel may not have NFS failover enhancements.
-
-Required NFS failover enhancements were not present on the host kernel.
-It is impossible to restart or relocate NFS services without these, but
-they should properly work in the case of true failover situations (i.e.
-the node on whicch the NFS service was running has failed and been
-fenced by the cluster).
-
-#74: Unable to obtain cluster lock: <error>
-
-This occurs while trying to determine the state of a resource group after
-an attempt to start it has completed (at the script level).  If this occurs,
-the start operation will fail.
-
-See #33 for reasons as to why obtaining a lock might fail.
-
-#75: Failed getting status for RG <name>
-
-This occurs while trying to determine the state of a resource group after
-an attempt to start it has completed.  If this occurs, the start operation
-will report a failure.
-
-Generally, this indicates attempt to retrieve the current view of that 
-resource group's state after quorum has dissolved.
diff --git a/rgmanager/event-script.txt b/rgmanager/event-script.txt
deleted file mode 100644
index 3cc1f31..0000000
--- a/rgmanager/event-script.txt
+++ /dev/null
@@ -1,305 +0,0 @@
-TODO:
-* Return correct error codes to clusvcadm (currently it always returns
-  "Unknown")
-* Write glue for 'migrate' operations and migrate-enabled services
-
-Basic configuration specification:
-
-  <rm>
-    <events>
-      <event class="node"/>        <!-- all node events -->
-      <event class="node"
-             node="bar"/>     <!-- events concerning 'bar' -->
-      <event class="node"
-             node="foo"
-             node_state="up"/>     <!-- 'up' events for 'foo' -->
-      <event class="node"
-             node_id="3"
-             node_state="down"/>   <!-- 'down' events for node ID 3 -->
-
-          (note, all service ops and such deal with node ID, not
-           with node names)
-
-      <event class="service"/>     <!-- all service events-->
-      <event class="service"
-             service_name="A"/>    <!-- events concerning 'A' -->
-      <event class="service"
-             service_name="B"
-	     service_state="started"/> <!-- when 'B' is started... -->
-      <event class="service"
-             service_name="B"
-	     service_state="started"/>
-	     service_owner="3"/> <!-- when 'B' is started on node 3... -->
-
-      <event class="service"
-             priority="1"
-	     service_state="started"/>
-	     service_owner="3"/> <!-- when 'B' is started on node 3, do this
-				      before the other event handlers ... -->
-
-
-    </events>
-    ...
-  </rm>
-
-General globals available from all scripts:
-
-   node_self - local node ID
-   event_type - event class, either:
-       EVENT_NONE - unspecified / unknown
-       EVENT_NODE - node transition
-       EVENT_SERVICE - service transition
-       EVENT_USER - a user-generated request
-       EVENT_CONFIG - [NOT CONFIGURABLE]
-
-Node event globals (i.e. when event_type == EVENT_NODE):
-  
-   node_id - node ID which is transitioning
-   node_name - name of node which is transitioning
-   node_state - new node state (NODE_ONLINE or NODE_OFFLINE, or if you prefer,
-                1 or 0, respectively)
-   node_clean - 0 if the node has not been fenced, 1 if the node has been
-                fenced
-
-Service event globals (i.e. when event_type == EVENT_SERVICE):
-
-   service_name - Name of service which transitioned
-   service_state - new state of service
-   service_owner - new owner of service (or <0 if service is no longer
-		   running)
-   service_last_owner - Last owner of service if known.  Used for when
-                   service_state = "recovering" generally, in order to
-                   apply restart/relocate/disable policy.
-
-User event globals (i.e. when event_type == EVENT_USER):
-
-   service_name - service to perform request upon
-   user_request - request to perform (USER_ENABLE, USER_DISABLE,
-                   USER_STOP, USER_RELOCATE, [TODO] USER_MIGRATE)
-   user_target - target node ID if applicable
-
-
-Scripting functions - Informational:
-
-  node_list = nodes_online();
-
-	Returns a list of all online nodes.
-
-  service_list = service_list();
-
-	Returns a list of all configured services.
-
-  (restarts, last_owner, owner, state) = service_status(service_name);
-
-	Returns the state, owner, last_owner, and restarts.  Note that
-	all return values are optional, but are right-justified per S-Lang
-	specification.  This means if you only want the 'state', you can use:
-	
-	(state) = service_status(service_name);
-
-	However, if you need the restart count, you must provide all four 
-	return values as above.
-
-  (nofailback, restricted, ordered, node_list) =
-		service_domain_info(service_name);
-
-	Returns the failover domain specification, if it exists, for the
-	specified service name.  The node list returned is an ordered list
-	according to priority levels.  In the case of unordered domains, 
-	the ordering of the returned list is pseudo-random.
-
-Scripting functions - Operational:
-
-  err = service_start(service_name, node_list, [avoid_list]);
-
-	Start a non-running, (but runnable, i.e. not failed)
-	service on the first node in node_list.  Failing that, start it on
-	the second node in node_list and so forth.  One may also specify
-	an avoid list, but it's better to just use the subtract() function
-	below.
-
-  err = service_stop(service_name, [0 = stop, 1 = disable]);
-
-	Stop a running service.  The second parameter is optional, and if
-	non-zero is specified, the service will enter the disabled state.
-
-  ... stuff that's not done but needs to be:
-
-  err = service_relocate(service_name, node_list);
-
-	Move a running service to the specified node_list in order of
-	preference.  In the case of VMs, this is actually a migrate-or-
-	relocate operation.
-
-Utility functions - Node list manipulation
-
-  node_list = union(left_node_list, right_node_list);
-
-	Calculates the union between the two node list, removing duplicates
-	and preserving ordering according to left_node_list.  Any added
-	values from right_node_list will appear in their order, but
-	after left_node_list in the returned list.
-
-  node_list = intersection(left_node_list, right_node_list);
-
-	Calculates the intersection (items in both lists) between the two
-	node lists, removing duplicates and preserving ordering according
-	to left_node_list.  Any added values from right_node_list will
-	appear in their order, but after left_node_list in the returned list.
-
-  node_list = delta(left_node_list, right_node_list);
-
-	Calculates the delta (items not in both lists) between the two
-	node lists, removing duplicates and preserving ordering according
-	to left_node_list.  Any added values from right_node_list will
-	appear in their order, but after left_node_list in the returned list.
-
-  node_list = subtract(left_node_list, right_node_list);
-
-	Removes any duplicates as well as items specified in right_node_list
-	from left_node_list.  Example:
-
-	all_nodes = nodes_online();
-	allowed_nodes = subtract(nodes_online, node_to_avoid);
-
-Utility functions - Logging:
-
-  debug(item1, item2, ...);	LOG_DEBUG level
-  info(...);			LOG_INFO level
-  notice(...);			LOG_NOTICE level
-  warning(...);			LOG_WARNING level
-  err(...);			LOG_ERR level
-  crit(...);			LOG_CRIT level
-  alert(...);			LOG_ALERT level
-  emerg(...);			LOG_EMERG level
-
-	items - These can be strings, integer lists, or integers.  Logging
-		string lists is not supported.
-
-	level - the level is consistent with syslog(8)
-
-  stop_processing();
-
-	Calling this function will prevent further event scripts from being
-	executed on a particular event.  Call this script if, for example,
-	you do not wish for the default event handler to process the event.
-
-	Note: This does NOT terminate the caller script; that is, the
-	script being executed will run to completion.
-
-Event scripts are written in a language called S-Lang; documentation specifics
-about the language are available at http://www.s-lang.org
-
-Example script (creating a follows-but-avoid-after-start behavior):
-%
-% If the main queue server and replication queue server are on the same
-% node, relocate the replication server somewhere else if possible.
-%
-define my_sap_event_trigger()
-{
-	variable state, owner_rep, owner_main;
-	variable nodes, allowed;
-
-	%
-	% If this was a service event, don't execute the default event
-	% script trigger after this script completes.
-	%
-	if (event_type == EVENT_SERVICE) {
-		stop_processing();
-	}
-
-	(owner_main, state) = service_status("service:main_queue");
-	(owner_rep, state) = service_status("service:replication_server");
-
-	if ((event_type == EVENT_NODE) and (owner_main == node_id) and
-	    (node_state == NODE_OFFLINE) and (owner_rep >= 0)) {
-		%
-		% uh oh, the owner of the main server died.  Restart it
-		% on the node running the replication server
-		%
-		notice("Starting Main Queue Server on node ", owner_rep);
-		()=service_start("service:main_queue", owner_rep);
-		return;
-	}
-
-	%
-	% S-Lang doesn't short-circuit prior to 2.1.0
-	%
-	if ((owner_main >= 0) and
-	    ((owner_main == owner_rep) or (owner_rep < 0))) {
-
-		%
-		% Get all online nodes
-		%
-		nodes = nodes_online();
-
-		%
-		% Drop out the owner of the main server
-		%
-		allowed = subtract(nodes, owner_main);
-		if ((owner_rep >= 0) and (length(allowed) == 0)) {
-			%
-			% Only one node is online and the rep server is
-			% already running.  Don't do anything else.
-			%
-			return;
-		}
-
-		if ((length(allowed) == 0) and (owner_rep < 0)) {
-			%
-			% Only node online is the owner ... go ahead
-			% and start it, even though it doesn't increase
-			% availability to do so.
-			%
-			allowed = owner_main;
-		}
-
-		%
-		% Move the replication server off the node that is
-		% running the main server if a node's available.
-		%
-		if (owner_rep >= 0) {
-			()=service_stop("service:replication_server");
-		}
-		()=service_start("service:replication_server", allowed);
-	}
-
-	return;
-}
-
-my_sap_event_trigger();
-
-
-Relevant <rm> section from cluster.conf:
-
-        <rm central_processing="1">
-                <events>
-                        <event name="main-start" class="service"
-				service="service:main_queue"
-				service_state="started"
-				file="/tmp/sap.sl"/>
-                        <event name="rep-start" class="service"
-				service="service:replication_server"
-				service_state="started"
-				file="/tmp/sap.sl"/>
-                        <event name="node-up" node_state="up"
-				class="node"
-				file="/tmp/sap.sl"/>
-
-                </events>
-                <failoverdomains>
-                        <failoverdomain name="all" ordered="1" restricted="1">
-                                <failoverdomainnode name="molly"
-priority="2"/>
-                                <failoverdomainnode name="frederick"
-priority="1"/>
-                        </failoverdomain>
-                </failoverdomains>
-                <resources/>
-                <service name="main_queue"/>
-                <service name="replication_server" autostart="0"/>
-		<!-- replication server is started when main-server start
-		     event completes -->
-        </rm>
-
-
diff --git a/rgmanager/examples/cluster.conf b/rgmanager/examples/cluster.conf
deleted file mode 100644
index a53e479..0000000
--- a/rgmanager/examples/cluster.conf
+++ /dev/null
@@ -1,106 +0,0 @@
-<?xml version="1.0"?>
-<cluster name="pretty" config_version="6">
-
-<cman>
-</cman>
-
-<dlm>
-</dlm>
-
-<clusternodes>
-  <clusternode name="red" votes="4">
-    <fence>
-      <method name="power">
-        <device name="wti" port="1"/>
-      </method>
-    </fence>
-  </clusternode>
-  <clusternode name="green" votes="3">
-    <fence>
-      <method name="power">
-        <device name="wti" port="2"/>
-      </method>
-    </fence>
-  </clusternode>
-</clusternodes>
-
-
-<fencedevices>
-  <fencedevice name="wti" agent="fence_wti" ipaddress="nps1" password="wti"/>
-</fencedevices>
-
-
-<!-- The RM block holds resources, failover domains, and any number of
-     'group' (= resource group) blocks -->
-<rm>
-  <!-- Similar to failover domains in RHEL3 -->
-  <failoverdomains>
-    <failoverdomain name="thisdomain" ordered="1">
-      <failoverdomainnode name="red" priority="1"/>
-      <failoverdomainnode name="green" priority="1"/>
-      <failoverdomainnode name="blue" priority="2"/>
-    </failoverdomain>
-    <failoverdomain name="bluedomain" restricted="1">
-      <failoverdomainnode name="blue" priority="2"/>
-    </failoverdomain>
-  </failoverdomains>
-
-  <!-- Define resources here -->
-  <resources>
-
-    <group name="oracle" domain="thisdomain"/>
-    <script name="Oracle Script" file="/etc/init.d/oracle"/>
-    <script name="Oracle Script 2" file="/etc/init.d/oracle2"/>
-    <ip address="192.168.0.28" monitor_link="yes"/>
-    <ip address="192.168.0.29" monitor_link="yes"/>
-    <nfsclient name="User group" target="@users" options="ro"/>
-    <nfsclient name="Admin group" target="@admin" options="rw"/>
-    <nfsexport name="nfs exports"/>
-  </resources>
-
-  <!-- Define resource groups here -->
-  <service ref="oracle">
-
-    <!-- Reference the above resources by their primary attribute -->
-    <script ref="Oracle Script"/>
-    <script ref="Oracle Script 2"/>
-    <ip ref="192.168.0.28"/>
-    <ip ref="192.168.0.29"/>
-
-    <!-- Or define them inline.  Fine with me! -->
-    <fs fstype="ext3" name="NFS Mount" mountpoint="/mnt/cluster" device="/dev/sdb8">
-
-       <!-- nfs export path inherited from parent file system's mount point-->
-       <nfsexport ref="nfs exports">
-          <!-- Export path inherited from export. So, for this instance
-               of "admin group", the export path is /mnt/cluster. -->
-          <nfsclient ref="Admin group"/>
-	  <nfsclient ref="User group"/>
-       </nfsexport>
-    </fs>
-
-    <fs fstype="ext3" name="NFS2" mountpoint="/mnt/sdb7" device="/dev/sdb7">
-       <!-- nfs export path inherited from parent file system's mount point-->
-       <nfsexport name="NFS Export" type="nfs">
-          <!-- Export path inherited from export. So, for this instance
-               of "admin group", the export path is /mnt/sdb7. -->
-          <nfsclient ref="Admin group"/>
-	  <nfsclient ref="User group"/>
-       </nfsexport>
-    </fs>
-  </service>
-
-  <!-- Define a bunch of test resource groups. -->
-  <service name="test1"/>
-  <service name="test2"/>
-  <service name="test3"/>
-  <service name="test4"/>
-  <service name="test5"/>
-  <service name="test6"/>
-  <service name="test7"/>
-  <service name="test8"/>
-  <service name="test9"/>
-  <service name="blueonly" domain="bluedomain"/>
-</rm>
-
-</cluster>
diff --git a/rgmanager/include/cman-private.h b/rgmanager/include/cman-private.h
deleted file mode 100644
index 2cddb39..0000000
--- a/rgmanager/include/cman-private.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _CMAN_PRIVATE_H
-#define _CMAN_PRIVATE_H
-
-#include <libcman.h>
-
-int cman_init_subsys(cman_handle_t ch);
-cman_handle_t cman_lock(int block, int sig);
-cman_handle_t cman_lock_preemptible(int block, int *fd);
-int cman_cleanup_subsys(void);
-int cman_unlock(cman_handle_t ch);
-int cman_send_data_unlocked(void *buf, int len, int flags,
-			    uint8_t port, int nodeid);
-
-#endif
diff --git a/rgmanager/include/depends.h b/rgmanager/include/depends.h
deleted file mode 100644
index 72f2958..0000000
--- a/rgmanager/include/depends.h
+++ /dev/null
@@ -1,134 +0,0 @@
-#ifndef _DEPENDS_H
-#define _DEPENDS_H
-
-#include <resgroup.h>
-#include <list.h>
-
-typedef enum {
-	DEP_COLO_UNSPEC		= 0,
-	DEP_COLO_ALWAYS		= 1,
-	DEP_COLO_NEVER		= 2
-} dep_colo_t;
-
-typedef enum {
-	DEP_REQ_UNSPEC		= 0,
-	DEP_REQ_START		= 1,
-	DEP_REQ_ALWAYS		= 2
-} dep_req_t;
-
-typedef enum {
-	DEP_FLAG_CYCLIC		= 0x1,
-	DEP_FLAG_TERMINAL	= 0x2,
-	DEP_FLAG_IMPOSSIBLE	= 0x4,
-	DEP_FLAG_IMPLIED	= 0x8,
-	DEP_FLAG_NEVER		= 0x10,
-	DEP_FLAG_ALWAYS		= 0x20
-} dep_flag_t;
-
-typedef enum {
-	RS_ILLEGAL_NODE	= 0x1,
-	RS_DEAD_NODE	= 0x2,
-	RS_BEEN_STARTED	= 0x4,
-	RS_BEEN_STOPPED = 0x8,
-	RS_IMMUTABLE    = 0x10,
-	RS_ORDERED	= 0x20,
-	RS_FAILBACK	= 0x40,
-	RS_BROKEN	= 0x80
-} rs_flag_t;
-
-typedef enum {
-	DN_BROKEN_COLO	= 0x1,
-	DN_BROKEN_NONCOLO	= 0x2,
-	DN_BROKEN_REQ	= 0x4
-} dep_node_flag_t;
-
-typedef struct _dn_node {
-	list_head();
-	char		*dn_name;
-	struct _dep	*dn_ptr;
-	dep_colo_t	dn_colo;
-	dep_req_t	dn_req;
-	int		dn_traversed;
-	dep_node_flag_t	dn_flags;
-} dep_node_t;
-
-typedef struct _dep {
-	list_head();
-	char *d_name;
-	dep_node_t *d_nodes;
-	dep_flag_t d_flags;
-	int d_hits;
-	int d_deps;
-} dep_t;
-
-
-typedef struct _res_state {
-	rg_state_t	rs_status;
-	int 		*rs_allowed;
-	int		rs_allowed_len;
-	rs_flag_t	rs_flags;
-} dep_rs_t;
-
-
-/* List of operations to take current state -> ideal state */
-typedef struct _dep_op {
-	list_head();
-	struct _dep_op	*do_child;
-	char		do_res[64];	
-	int		do_op;
-	int		do_nodeid;
-	int		do_iter;
-} dep_op_t;
-	
-
-
-int construct_depends(int ccsfd, dep_t **deps);
-void deconstruct_depends(dep_t **deps);
-void print_depends(FILE *fp, dep_t **deps);
-void print_depends_dot(FILE *fp, dep_t **deps);
-
-/* Check cluster state given:
- * all resource (service) states,
- * all available nodes to each resource,
- * all online nodes.
- * 
- * Returns # of errors (negative), # of stopped services (positive), or
- * 0 if the cluster state is ideal.
- * 
- * Note: Call dep_reset() when you're done to clear error flags in the
- * graph.
- */
-int dep_check(dep_t **deps, dep_rs_t *states, int slen,
-		    int *nodes, int nlen);
-
-/* Clear error flags in the graph + states */
-void dep_reset(dep_t **deps, dep_rs_t *rs, int slen);
-
-/* Print out our errors */
-void dep_print_errors(dep_t **deps, dep_rs_t *rs, int slen);
-
-dep_rs_t * dep_rstate_alloc(resource_node_t **restree, fod_t **domains,
-			     int *nodes, int nlen, int *rs_cnt);
-void dep_rstate_free(dep_rs_t *states, int cnt);
-
-/* Dump graphviz-compatible output to fp (includes errors in graph */
-int dep_cluster_state_dot(FILE *fp, dep_t **deps, dep_rs_t *states, int slen,
-			  int *nodes, int nlen);
-int dep_cluster_state(FILE *fp, dep_t **deps, dep_rs_t *states, int slen,
-		      int *nodes, int nlen);
-
-/* Calculate transition list */
-int dep_calc_trans(dep_t **deps, dep_rs_t *states, int slen,
-		   int *nodes, int nlen, dep_op_t **op_list, int *iter);
-
-int dep_copy_tree(dep_t **dest, dep_t **src);
-
-int dep_apply_trans(dep_t **deps, dep_rs_t *states,
-		    int slen, dep_op_t **op_list);
-
-int dep_check_operation(char *res, int operation, int target, 
-		    dep_t **deps, dep_rs_t *_states,
-		    int slen, int *nodes, int nlen, dep_op_t **oplist);
-int dep_tree_dup(dep_t **dest, dep_t **src);
-
-#endif
diff --git a/rgmanager/include/ds.h b/rgmanager/include/ds.h
deleted file mode 100644
index f7c9913..0000000
--- a/rgmanager/include/ds.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef _DS_H
-#define _DS_H
-
-int ds_init(void);
-int ds_key_init(char *keyid, int maxsize, int timeout);
-int ds_key_finish(char *keyid);
-int ds_write(char *keyid, void *buf, size_t maxlen);
-int ds_read(char *keyid, void *buf, size_t maxlen);
-int ds_finish(void);
-
-#define DS_MIN_SIZE 512
-
-#endif
diff --git a/rgmanager/include/event.h b/rgmanager/include/event.h
deleted file mode 100644
index bf89247..0000000
--- a/rgmanager/include/event.h
+++ /dev/null
@@ -1,128 +0,0 @@
-#ifndef _EVENT_H
-#define _EVENT_H
-
-/* 128 is a bit big, but it should be okay */
-typedef struct __rge_q {
-	char rg_name[128];
-	uint32_t rg_state;
-	uint32_t pad1;
-	int rg_owner;
-	int rg_last_owner;
-} group_event_t;
-
-typedef struct __ne_q {
-	int ne_local;
-	int ne_nodeid;
-	int ne_state;
-	int ne_clean;
-} node_event_t;
-
-typedef struct __cfg_q {
-	int cfg_version;	/* Not used or handled for now */
-	int cfg_oldversion;
-} config_event_t;
-
-typedef struct __user_q {
-	char u_name[128];
-	msgctx_t *u_ctx;
-	int u_request;
-	int u_arg1;
-	int u_arg2;
-	int u_target;		/* Node ID */
-} user_event_t;
-
-typedef enum {
-	EVENT_NONE=0,
-	EVENT_CONFIG,
-	EVENT_NODE,
-	EVENT_RG,
-	EVENT_USER
-} event_type_t;
-
-/* Data that's distributed which indicates which
-   node is the event master */
-typedef struct __rgm {
-	uint32_t m_magic;
-	uint32_t m_nodeid;
-	uint64_t m_master_time;
-	uint8_t  m_reserved[112];
-} event_master_t;
-
-#define swab_event_master_t(ptr) \
-{\
-	swab32((ptr)->m_nodeid);\
-	swab32((ptr)->m_magic);\
-	swab64((ptr)->m_master_time);\
-}
-
-/* Just a magic # to help us ensure we've got good
-   date from VF */
-#define EVENT_MASTER_MAGIC 0xfabab0de
-
-/* Event structure - internal to the event subsystem; use
-   the queueing functions below which allocate this struct
-   and pass it to the event handler */
-typedef struct _event {
-	/* Not used dynamically - part of config info */
-	list_head();
-	char *ev_name;
-	char *ev_script;
-	char *ev_script_file;
-	int ev_prio; 
-	int ev_pad;
-	/* --- end config part */
-	int ev_type;		/* config & generated by rgmanager*/
-	int ev_transaction;
-	union {
-		group_event_t group;
-		node_event_t node;
-		config_event_t config;
-		user_event_t user;
-	} ev;
-} event_t;
-
-#define EVENT_PRIO_COUNT 100
-
-typedef struct _event_table {
-	int max_prio;
-	int pad;
-	event_t *entries[0];
-} event_table_t;
-
-
-int construct_events(int ccsfd, event_table_t **);
-void deconstruct_events(event_table_t **);
-void print_events(event_table_t *);
-
-/* Does the event match a configured event? */
-int event_match(event_t *pattern, event_t *actual);
-
-/* Event queueing functions. */
-void node_event_q(int local, int nodeID, int state, int clean);
-void rg_event_q(char *name, uint32_t state, int owner, int last);
-void user_event_q(char *svc, int request, int arg1, int arg2,
-		  int target, msgctx_t *ctx);
-void config_event_q(void);
-
-/* Call this to see if there's a master. */
-int event_master_info_cached(event_master_t *);
-
-/* Call this to get the node ID of the current 
-   master *or* become the master if none exists */
-int event_master(void);
-
-/* Setup */
-int central_events_enabled(void);
-void set_central_events(int flag);
-int slang_process_event(event_table_t *event_table, event_t *ev);
-
-/* For distributed events. */
-void set_transition_throttling(int nsecs);
-
-/* Simplified service start. */
-int service_op_start(char *svcName, int *target_list, int target_list_len,
-		     int *new_owner);
-int service_op_stop(char *svcName, int do_disable, int event_type);
-
-
-#endif
diff --git a/rgmanager/include/fdops.h b/rgmanager/include/fdops.h
deleted file mode 100644
index f3194de..0000000
--- a/rgmanager/include/fdops.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _FDOPS_H
-#define _FDOPS_H
-#include <unistd.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <errno.h>
-
-int _select_retry(int fdmax, fd_set * rfds, fd_set * wfds, fd_set * xfds,
-   		  struct timeval *timeout);
-ssize_t _write_retry(int fd, void *buf, int count, struct timeval * timeout);
-ssize_t _read_retry(int sockfd, void *buf, int count,
-		    struct timeval * timeout);
-
-#endif
diff --git a/rgmanager/include/findproc.h b/rgmanager/include/findproc.h
deleted file mode 100644
index 3b6db59..0000000
--- a/rgmanager/include/findproc.h
+++ /dev/null
@@ -1,11 +0,0 @@
-/** @file
- * Header for findproc.c
- */
-#ifndef __PROC_H
-#define __PROC_H
-
-int findkillproc(char *, pid_t *, size_t, int);
-int findproc(char *, pid_t *, size_t);
-int killall(char *, int);
-
-#endif
diff --git a/rgmanager/include/gettid.h b/rgmanager/include/gettid.h
deleted file mode 100644
index 636560c..0000000
--- a/rgmanager/include/gettid.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef __GETTID_H
-#define __GETTID_H
-
-pid_t gettid(void);
-
-#endif
-
diff --git a/rgmanager/include/list.h b/rgmanager/include/list.h
deleted file mode 100644
index 0dac6e8..0000000
--- a/rgmanager/include/list.h
+++ /dev/null
@@ -1,94 +0,0 @@
-#ifndef _LIST_H
-#define _LIST_H
-
-/**
-  Simple list handlig macros.
-  Needs rewrite or inclusion of /usr/include/linux/list.h as a replacement.
- */
-
-/* Must be first if structure is going to use it. */
-struct list_entry {
-	struct list_entry *le_next, *le_prev;
-};
-
-#define list_head() struct list_entry _list_head
-
-#define le(p) (&((*p)._list_head))
-
-#define list_insert(list, newnode) \
-do { \
-	if (!(*list)) { \
-		le(newnode)->le_next = \
-		le(newnode)->le_prev = le(newnode); \
-		*list = (void *)le(newnode); \
-	} else { \
-		le(*list)->le_prev->le_next = le(newnode); \
-		le(newnode)->le_next = le(*list); \
-		le(newnode)->le_prev = le(*list)->le_prev; \
-		le(*list)->le_prev = le(newnode); \
-	} \
-} while (0)
-
-	
-#define list_prepend(list, newnode) \
-do { \
-	list_insert(list, newnode); \
-	*list = newnode; \
-} while (0)
-
-
-#define list_remove(list, oldnode) \
-do { \
-	if (le(oldnode) == le(*list)) { \
-		*list = (void *)le(*list)->le_next; \
-	} \
-	if (le(oldnode) == le(*list)) { \
-		le(oldnode)->le_next = NULL; \
-		le(oldnode)->le_prev = NULL; \
-		*list = NULL; \
-	} else { \
-		le(oldnode)->le_next->le_prev = le(oldnode)->le_prev; \
-		le(oldnode)->le_prev->le_next = le(oldnode)->le_next; \
-		le(oldnode)->le_prev = NULL; \
-	       	le(oldnode)->le_next = NULL; \
-	} \
-} while (0)
-
-/*
-   list_do(list, node) {
-   	stuff;
-   } while (!list_done(list, node));
- */
-#define list_do(list, curr) \
-	if (*list && (curr = *list)) do
-
-#define list_done(list, curr) \
-	(curr && (((curr = (void *)le(curr)->le_next)) && (curr == *list)))
-
-/*
- * list_for(list, tmp, counter) {
- *     stuff;
- * }
- * 
- * counter = # of items in list when done.
- * * sets cnt to 0 before even checking list;
- * * checks for valid list
- * * traverses list, incrementing counter.  If we get to the for loop,
- *   there must be at least one item in the list
- */
-#define list_for(list, curr, cnt) \
-	if (!(cnt=0) && *list) \
-		for (curr = *list; \
-		     (cnt == 0) || (curr != *list); \
-		     curr = (void*)le(curr)->le_next, \
-		     cnt++)
-			
-#define list_for_rev(list, curr, cnt) \
-	if (!(cnt=0) && *list) \
-		for (curr = (void *)(le(*list)->le_prev); \
-		     (cnt == 0) || ((void *)curr != le(*list)->le_prev); \
-		     curr = (void*)(le(curr)->le_prev), \
-		     cnt++)
-				   
-
-#endif
diff --git a/rgmanager/include/lock.h b/rgmanager/include/lock.h
deleted file mode 100644
index 4fab545..0000000
--- a/rgmanager/include/lock.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef _LOCK_H
-#define _LOCK_H
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include <libdlm.h>
-
-int clu_ls_lock(dlm_lshandle_t ls, int mode, struct dlm_lksb *lksb,
-	     	int options, char *resource);
-dlm_lshandle_t clu_open_lockspace(const char *lsname);
-int clu_ls_unlock(dlm_lshandle_t ls, struct dlm_lksb *lksb);
-int clu_close_lockspace(dlm_lshandle_t ls, const char *lsname);
-
-/* Default lockspace wrappers */
-int clu_lock_init(const char *default_lsname);
-int clu_lock(int mode, struct dlm_lksb *lksb,
-	     int options, char *resource);
-int clu_unlock(struct dlm_lksb *lksb);
-void clu_lock_finished(const char *default_lsname);
-
-#endif
diff --git a/rgmanager/include/logging.h b/rgmanager/include/logging.h
deleted file mode 100644
index 0852118..0000000
--- a/rgmanager/include/logging.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef _LOGGING_H
-#define _LOGGING_H
-
-/* #include <corosync/engine/logsys.h>*/
-#include <liblogthread.h>
-
-void init_logging(char *name, int foreground, int debugging);
-void setup_logging(int ccs_handle);
-void close_logging(void);
-
-#endif
diff --git a/rgmanager/include/members.h b/rgmanager/include/members.h
deleted file mode 100644
index 768f040..0000000
--- a/rgmanager/include/members.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef _MEMBERS_H
-#define _MEMBERS_H
-
-#include <rg_types.h>
-
-typedef enum {
-	NODE_STATE_DOWN = 0,
-	NODE_STATE_UP = 1,
-	NODE_STATE_CLEAN = 2
-} node_state_t;
-
-
-int get_my_nodeid(cman_handle_t h);
-int my_id(void);
-cluster_member_list_t * get_member_list(cman_handle_t h);
-void free_member_list(cluster_member_list_t *ml);
-void member_set_state(int nodeid, int state);
-int memb_count(cluster_member_list_t *ml);
-int member_online(int nodeid);
-int member_online_set(int **nodes, int *nodecount);
-int memb_online(cluster_member_list_t *ml, int nodeid);
-int memb_online_name(cluster_member_list_t *ml, char *name);
-int memb_name_to_id(cluster_member_list_t *ml, char *name);
-int memb_mark_down(cluster_member_list_t *ml, int nodeid);
-char * memb_id_to_name(cluster_member_list_t *ml, int nodeid);
-cman_node_t * memb_id_to_p(cluster_member_list_t *ml, int nodeid);
-cman_node_t * memb_name_to_p(cluster_member_list_t *ml, char *name);
-void free_member_list(cluster_member_list_t *ml);
-cluster_member_list_t *memb_gained(cluster_member_list_t *old,
-		 		   cluster_member_list_t *new);
-cluster_member_list_t *memb_lost(cluster_member_list_t *old,
-	 			 cluster_member_list_t *new);
-
-cluster_member_list_t *member_list_dup(cluster_member_list_t *old);
-cluster_member_list_t *member_list(void);
-void member_list_update(cluster_member_list_t *new_ml);
-
-#endif
diff --git a/rgmanager/include/message.h b/rgmanager/include/message.h
deleted file mode 100644
index 890a6c4..0000000
--- a/rgmanager/include/message.h
+++ /dev/null
@@ -1,160 +0,0 @@
-#ifndef _MESSAGE_H
-#define _MESSAGE_H
-#include <arpa/inet.h>
-#include <stdint.h>
-#include <pthread.h>
-#include <platform.h>
-#include <libcman.h>
-#include <list.h>
-#include <rg_types.h>
-#include <sys/types.h>
-#include <sys/select.h>
-
-typedef enum {
-	M_NONE = 0,
-	M_OPEN = 1,
-	M_OPEN_ACK = 2,
-	M_CLOSE = 3,
-	M_DATA = 4,
-	M_STATECHANGE = 5,		/* Node transition */
-	M_PORTOPENED = 6,		/* Port opened */
-	M_PORTCLOSED = 7,		/* Port closed */
-	M_TRY_SHUTDOWN = 8,		/* Local node shutdown */
-	M_CONFIG_UPDATE = 9		/* (new) Config Update */
-} msg_control_t;
-
-typedef enum {
-	MSG_NONE = -1,
-	MSG_SOCKET  = 1,
-	MSG_CLUSTER = 2
-} msgctx_type_t;
-
-/* Header is never presented to applications */
-typedef struct ALIGNED {
-	uint32_t	src_ctx;
-	uint32_t	src_nodeid;
-	/* 8 */
-	uint32_t	dest_ctx;
-	uint32_t	dest_nodeid;
-	/* 16 */
-	uint8_t		msg_control;
-	uint8_t		msg_port;
-	uint8_t		pad[2];
-	/* 20 */
-	uint8_t		msg_reserved[12];
-} cluster_msg_hdr_t;
-
-/* Header is never presented to applications */
-typedef struct ALIGNED {
-	uint32_t	msg_len;	/* Size of tailing message */
-	uint8_t		msg_control;
-	uint8_t		pad[3];
-} local_msg_hdr_t;
-/* No need for swabbing this one */
-
-
-/* Cluster private queue */
-typedef struct ALIGNED {
-	list_head();
-	cluster_msg_hdr_t *message;
-	int len;
-} msg_q_t;
-
-
-#define swab_cluster_msg_hdr_t(ptr) \
-{\
-	swab32((ptr)->dest_ctx);\
-	swab32((ptr)->src_ctx);\
-	swab32((ptr)->src_nodeid);\
-	swab32((ptr)->dest_nodeid);\
-}
-
-
-typedef struct ALIGNED _msgctx {
-	struct _msg_ops *ops;
-	msgctx_type_t type;
-	int flags;
-	/* XXX todo make this opaque */
-	void *sp;
-	union {
-		struct {
-			msg_q_t *queue;
-			pthread_mutex_t mutex;
-			pthread_cond_t cond;
-			cman_handle_t cman_handle;
-			int nodeid;
-			int port;
-			uint32_t local_ctx;
-			uint32_t remote_ctx;
-			int select_pipe[2];
-		} cluster_info;
-		struct {
-			int sockfd;
-			int pad;
-		} local_info;
-	} u;
-} msgctx_t;
-
-
-typedef int (*msg_open_t)(int type, int nodeid, int port, msgctx_t *ctx,
-			  int timeout);
-typedef int (*msg_close_t)(msgctx_t *);
-typedef int (*msg_listen_t)(int me, void *, msgctx_t **);
-typedef int (*msg_accept_t)(msgctx_t *, msgctx_t *);
-typedef int (*msg_shutdown_t)(void);
-typedef int (*msg_send_t)(msgctx_t *, void *, size_t);
-typedef int (*msg_receive_t)(msgctx_t *, void *, size_t, int);
-typedef int (*msg_wait_t)(msgctx_t *, int);
-typedef int (*msg_fd_set_t)(msgctx_t *, fd_set *, int *);
-typedef int (*msg_fd_isset_t)(msgctx_t *, fd_set *);
-typedef int (*msg_fd_clr_t)(msgctx_t *, fd_set *);
-typedef void (*msg_print_t)(msgctx_t *);
-typedef int (*msg_init_t)(msgctx_t *);
-
-typedef struct _msg_ops {
-	msg_open_t	mo_open;
-	msg_close_t	mo_close;
-	msg_listen_t	mo_listen;
-	msg_accept_t	mo_accept;
-	msg_shutdown_t	mo_shutdown;
-	msg_wait_t	mo_wait;
-	msg_send_t	mo_send;
-	msg_receive_t	mo_receive;
-	msg_fd_set_t	mo_fd_set;
-	msg_fd_isset_t	mo_fd_isset;
-	msg_fd_clr_t	mo_fd_clr;
-	msg_print_t	mo_print;
-	msg_init_t	mo_init;
-} msg_ops_t;
-
-
-/* Ripped from ccsd's setup_local_socket */
-#define MAX_CONTEXTS 128  /* Testing; production should be 1024-ish */
-
-#define SKF_LISTEN (1<<0)
-#define SKF_READ   (1<<1)
-#define SKF_WRITE  (1<<2)
-#define SKF_MCAST  (1<<3)
-
-
-/* Call once for MSG_CLUSTER, once for MSG_SOCKET */
-/* Private is should be a null-terminated char string for MSG_SOCKET,
-   and a pointer to int type for MSG_CLUSTER */
-int msg_listen(int type, void *port, int me, msgctx_t **new_ctx);
-int msg_open(int type, int nodeid, int port, msgctx_t *ctx, int timeout);
-int msg_init(msgctx_t *ctx);
-int msg_accept(msgctx_t *listenctx, msgctx_t *acceptctx);
-int msg_get_nodeid(msgctx_t *ctx);
-int msg_close(msgctx_t *ctx);
-int msg_receive(msgctx_t *ctx, void *msg, size_t maxlen, int timeout);
-int msg_wait(msgctx_t *ctx, int timeout); /* Select-ish */
-int msg_send(msgctx_t *ctx, void *msg, size_t len);
-msgctx_t *msg_new_ctx(void);
-void msg_free_ctx(msgctx_t *old);
-int msg_fd_set(msgctx_t *ctx, fd_set *fds, int *max);
-int msg_fd_isset(msgctx_t *ctx, fd_set *fds);
-int msg_fd_clr(msgctx_t *ctx, fd_set *fds);
-void msg_print(msgctx_t *ctx);
-int msg_shutdown(void);
-
-#endif
diff --git a/rgmanager/include/msgsimple.h b/rgmanager/include/msgsimple.h
deleted file mode 100644
index 66ba927..0000000
--- a/rgmanager/include/msgsimple.h
+++ /dev/null
@@ -1,64 +0,0 @@
-#ifndef __MSG_SIMPLE_H
-#define __MSG_SIMPLE_H
-
-#include <errno.h>
-#include <stdint.h>
-#include <resgroup.h>
-
-typedef struct PACKED {
-    uint32_t gh_magic; 
-    uint32_t gh_length;
-    uint32_t gh_command;
-    uint32_t gh_arg1;
-    uint32_t gh_arg2;
-    uint32_t gh_arg3;
-} generic_msg_hdr;
-
-#define swab_generic_msg_hdr(ptr)\
-{\
-	swab32((ptr)->gh_magic);\
-	swab32((ptr)->gh_length);\
-	swab32((ptr)->gh_command);\
-	swab32((ptr)->gh_arg1);\
-	swab32((ptr)->gh_arg2);\
-}
-
-typedef struct PACKED {
-    generic_msg_hdr	sm_hdr;
-    struct {
-	char 		d_svcName[64];
-        uint32_t	d_action;
-        uint32_t	d_svcState;
-        uint32_t	d_svcOwner;
-        int32_t		d_ret;
-    } sm_data;
-} SmMessageSt;
-
-#define swab_SmMessageSt(ptr) \
-{\
-	swab_generic_msg_hdr(&((ptr)->sm_hdr));\
-	swab32((ptr)->sm_data.d_action);\
-	swab32((ptr)->sm_data.d_svcState);\
-	swab32((ptr)->sm_data.d_svcOwner);\
-	swab32((ptr)->sm_data.d_ret);\
-}
-
-typedef struct ALIGNED {
-    generic_msg_hdr	rsm_hdr;
-    rg_state_t		rsm_state;
-} rg_state_msg_t;
-
-#define swab_rg_state_msg_t(ptr) \
-{\
-	swab_generic_msg_hdr(&((ptr)->rsm_hdr));\
-	swab_rg_state_t(&((ptr)->rsm_state));\
-}
-
-
-#define GENERIC_HDR_MAGIC   0x123abc00
-#define GENERIC_HDR_MAGICV2 0x123abc02
-
-int msg_send_simple(msgctx_t *ctx, int cmd, int arg1, int arg2);
-int msg_receive_simple(msgctx_t *ctx, generic_msg_hdr ** buf, int timeout);
-
-#endif
diff --git a/rgmanager/include/platform.h b/rgmanager/include/platform.h
deleted file mode 100644
index 7681b50..0000000
--- a/rgmanager/include/platform.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/** @file
- * Defines for byte-swapping
- */
-#ifndef _PLATFORM_H
-#define _PLATFORM_H
-
-#include <endian.h>
-#include <sys/param.h>
-#include <byteswap.h>
-#include <bits/wordsize.h>
-
-/*
-
-Configure is gone...
- #ifndef HAVE_CONFIG_H
-#error "Please run configure first"
-#endif
-
-*/
-
-/* #include <config.h> */
-
-/* No swapping on little-endian machines */
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define le_swap16(x) (x)
-#define le_swap32(x) (x)
-#define le_swap64(x) (x)
-#else
-#define le_swap16(x) bswap_16(x)
-#define le_swap32(x) bswap_32(x)
-#define le_swap64(x) bswap_64(x)
-#endif
-
-/* No swapping on big-endian machines */
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define be_swap16(x) bswap_16(x)
-#define be_swap32(x) bswap_32(x)
-#define be_swap64(x) bswap_64(x)
-#else
-#define be_swap16(x) (x)
-#define be_swap32(x) (x)
-#define be_swap64(x) (x)
-#endif
-
-
-#define swab16(x) x=be_swap16(x)
-#define swab32(x) x=be_swap32(x)
-#define swab64(x) x=be_swap64(x)
-
-
-#if defined(__sparc__)
-#define ALIGNED __attribute__((aligned))
-#define PACKED  __attribute__((aligned,packed))
-#else
-#define ALIGNED
-#define PACKED __attribute__((packed))
-#endif
-
-#endif /* _PLATFORM_H */
diff --git a/rgmanager/include/pthread_dbg.h b/rgmanager/include/pthread_dbg.h
deleted file mode 100644
index 7b6d5e0..0000000
--- a/rgmanager/include/pthread_dbg.h
+++ /dev/null
@@ -1,41 +0,0 @@
-#ifndef _PTHREAD_DBG_H
-#define _PTHREAD_DBG_H
-#include <pthread.h>
-
-#define pthread_mutex_lock(x) \
-{\
-	printf("pthread_mutex_lock(%s) @ %s:%d in %s\n",\
-	       #x, __FILE__, __LINE__, __FUNCTION__); \
-	pthread_mutex_lock(x);\
-}
-
-#define pthread_mutex_unlock(x) \
-{\
-	printf("pthread_mutex_unlock(%s) @ %s:%d in %s\n",\
-	       #x, __FILE__, __LINE__, __FUNCTION__); \
-	pthread_mutex_unlock(x);\
-}
-
-
-#define pthread_rwlock_rdlock(x) \
-{\
-	printf("pthread_rwlock_rdlock(%s) @ %s:%d in %s\n",\
-	       #x, __FILE__, __LINE__, __FUNCTION__); \
-	pthread_rwlock_rdlock(x);\
-}
-
-#define pthread_rwlock_unlock(x) \
-{\
-	printf("pthread_rwlock_unlock(%s) @ %s:%d in %s\n",\
-	       #x, __FILE__, __LINE__, __FUNCTION__); \
-	pthread_rwlock_unlock(x);\
-}
-
-#define pthread_rwlock_wrlock(x) \
-{\
-	printf("pthread_rwlock_wrlock(%s) @ %s:%d in %s\n",\
-	       #x, __FILE__, __LINE__, __FUNCTION__); \
-	pthread_rwlock_wrlock(x);\
-}
-
-#endif
diff --git a/rgmanager/include/res-ocf.h b/rgmanager/include/res-ocf.h
deleted file mode 100644
index 74549e3..0000000
--- a/rgmanager/include/res-ocf.h
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef _RES_OCF_H
-#define _RES_OCF_H 1
-
-#define OCF_ROOT RESOURCE_ROOTDIR
-
-#define OCF_API_VERSION "1.0"
-
-#define OCF_RES_PREFIX "OCF_RESKEY_"
-
-#define OCF_ROOT_STR "OCF_ROOT"
-#define OCF_RA_VERSION_MAJOR_STR "OCF_RA_VERSION_MAJOR"
-#define OCF_RA_VERSION_MINOR_STR "OCF_RA_VERSION_MINOR"
-#define OCF_RESOURCE_INSTANCE_STR "OCF_RESOURCE_INSTANCE"
-#define OCF_CHECK_LEVEL_STR "OCF_CHECK_LEVEL"
-#define OCF_RESOURCE_TYPE_STR "OCF_RESOURCE_TYPE"
-#define OCF_REFCNT_STR "OCF_RESKEY_RGMANAGER_meta_refcnt"
-
-/*
-   LSB return codes 
- */
-#define OCF_RA_SUCCESS		0
-#define OCF_RA_ERROR		1
-#define OCF_RA_INVALID_ARG	2
-#define OCF_RA_UNIMPLEMENTED	3
-#define OCF_RA_PERMISSION	4
-#define OCF_RA_NOT_INSTALLED	5
-#define OCF_RA_NOT_CONFIGURED	6
-#define OCF_RA_NOT_RUNNING	7
-#define OCF_RA_MAX		7
-
-/*
-   Resource operations - not ocf-specified
- */
-#define RS_START	(0)
-#define RS_STOP		(1)
-#define RS_STATUS	(2)
-#define RS_RESINFO	(3)
-#define RS_RESTART	(4)
-#define RS_RELOAD	(5)
-#define RS_CONDRESTART  (6)
-#define	RS_RECOVER	(7)
-#define RS_CONDSTART	(8)	/** Start if flagged with RF_NEEDSTART */
-#define RS_CONDSTOP	(9)	/** STOP if flagged with RF_NEEDSTOP */
-#define RS_MONITOR	(10)
-#define RS_META_DATA	(11)
-#define RS_VALIDATE	(12)
-#define RS_MIGRATE	(13)
-#define RS_RECONFIG	(14)
-
-#endif
diff --git a/rgmanager/include/resgroup.h b/rgmanager/include/resgroup.h
deleted file mode 100644
index 67acb6d..0000000
--- a/rgmanager/include/resgroup.h
+++ /dev/null
@@ -1,282 +0,0 @@
-#ifndef __RESGROUP_H
-#define __RESGROUP_H
-
-#include <pthread.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <errno.h>
-#include <sys/wait.h>
-#include <sys/types.h>
-#include <sys/select.h>
-#include <gettid.h>
-#include <rg_locks.h>
-#include <message.h>
-#include <rg_queue.h>
-#include <signals.h>
-
-/**
- * Service state as represented on disk.
- *
- * This structure represents a service description.  This data structure
- * represents the in-memory service description.  (There is a separate
- * description of the on-disk format.)
- */
-typedef struct {
-	char		rs_name[64];	/**< Service name */
-	/* 64 */
-	uint32_t	rs_id;		/**< Service ID */
-	uint32_t	rs_magic;	/**< Magic ID */
-	uint32_t	rs_owner;	/**< Member ID running service. */
-	uint32_t	rs_last_owner;	/**< Last member to run the service. */
-	/* 80 */
-	uint32_t	rs_state;	/**< State of service. */
-	uint32_t	rs_restarts;	/**< Number of cluster-induced 
-					     restarts */
-	uint64_t	rs_transition;	/**< Last service transition time */
-	/* 96 */
-	uint32_t	rs_flags;	/**< User setted flags */
-	/* 100 */
-	uint8_t		rs_version;	/**< State version */
-	uint8_t		_pad_[3];
-	/* 104 */
-} rg_state_t;
-
-#define swab_rg_state_t(ptr) \
-{\
-	swab32((ptr)->rs_id);\
-	swab32((ptr)->rs_magic);\
-	swab32((ptr)->rs_owner);\
-	swab32((ptr)->rs_last_owner);\
-	swab32((ptr)->rs_state);\
-	swab32((ptr)->rs_restarts);\
-	swab64((ptr)->rs_transition);\
-	swab32((ptr)->rs_flags);\
-}
-
-#if 0
-/* Future upgrade compatibility */
-#define RG_STATE_MINSIZE		96
-#define RG_STATE_CURRENT_VERSION	1
-
-extern size_t rg_state_t_version_sizes[];
-#endif
-
-
-#define RG_PORT    177
-
-/* Constants moved to src/clulib/constants.c */
-/* DO NOT EDIT */
-#define RG_MAGIC   0x11398fed
-
-#define RG_ACTION_REQUEST	/* Message header */ 0x138582
-/* Argument to RG_ACTION_REQUEST */
-#define RG_ACTION_MASTER	0xfe0db143
-#define RG_ACTION_USER		0x3f173bfd
-/* */
-#define RG_EVENT		0x138583
-
-/* Requests */
-#define RG_SUCCESS	  0
-#define RG_FAIL		  1
-#define RG_START	  2
-#define RG_STOP		  3
-#define RG_STATUS	  4
-#define RG_DISABLE	  5
-#define RG_STOP_RECOVER	  6
-#define RG_START_RECOVER  7
-#define RG_RESTART	  8
-#define RG_EXITING	  9 
-#define RG_INIT		  10
-#define RG_ENABLE	  11
-#define RG_STATUS_NODE	  12
-#define RG_RELOCATE	  13
-#define RG_CONDSTOP	  14
-#define RG_CONDSTART	  15
-#define RG_START_REMOTE   16	/* Part of a relocate */
-#define RG_STOP_USER	  17	/* User-stop request */
-#define RG_STOP_EXITING	  18	/* Exiting. */
-#define RG_LOCK		  19
-#define RG_UNLOCK	  20
-#define RG_QUERY_LOCK	  21
-#define RG_MIGRATE	  22
-#define RG_FREEZE	  23
-#define RG_UNFREEZE	  24
-#define RG_STATUS_INQUIRY 25
-#define RG_NONE		  999
-
-const char *rg_req_str(int req);
-
-int handle_relocate_req(char *svcName, int request, int preferred_target,
-			int *new_owner);
-int handle_start_req(char *svcName, int req, int *new_owner);
-int handle_fd_start_req(char *svcName, int req, int *new_owner);
-int handle_recover_req(char *svcName, int *new_owner);
-int handle_start_remote_req(char *svcName, int req);
-
-/* Resource group states (for now) */
-#define RG_STATE_BASE			110
-#define RG_STATE_STOPPED		110	/** Resource group is stopped */
-#define RG_STATE_STARTING		111	/** Resource is starting */
-#define RG_STATE_STARTED		112	/** Resource is started */
-#define RG_STATE_STOPPING		113	/** Resource is stopping */
-#define RG_STATE_FAILED			114	/** Resource has failed */
-#define RG_STATE_UNINITIALIZED		115	/** Thread not running yet */
-#define RG_STATE_CHECK			116	/** Checking status */
-#define RG_STATE_ERROR			117	/** Recoverable error */
-#define RG_STATE_RECOVER		118	/** Pending recovery */
-#define RG_STATE_DISABLED		119	/** Resource not allowd to run */
-#define RG_STATE_MIGRATE		120	/** Resource migrating */
-
-#define DEFAULT_CHECK_INTERVAL		10
-
-/* Resource group flags (for now) */
-#define RG_FLAG_FROZEN			(1<<0)	/** Resource frozen */
-
-const char *rg_state_str(int val);
-const char *rg_flag_str(int val);
-const char *rg_flags_str(char *flags_string, size_t size, int val, char *separator);
-int rg_state_str_to_id(const char *val);
-const char *rg_flags_str(char *flags_string, size_t size, int val, char *separator);
-const char *agent_op_str(int val);
-
-int eval_groups(int local, uint32_t nodeid, int nodeStatus);
-int group_migrate(char *groupname, int target);
-
-int rg_status(const char *resgroupname);
-int group_op(char *rgname, int op);
-void rg_init(void);
-int init_resource_groups(int, int);
-
-/* Basic service operations */
-int svc_start(char *svcName, int req);
-int svc_stop(char *svcName, int error);
-int svc_status(char *svcName);
-int svc_status_inquiry(char *svcName);
-int svc_disable(char *svcName);
-int svc_fail(char *svcName);
-int svc_freeze(char *svcName);
-int svc_unfreeze(char *svcName);
-int svc_migrate(char *svcName, int target);
-int check_restart(char *svcName);
-
-int rt_enqueue_request(const char *resgroupname, int request,
-		       msgctx_t *resp_ctx,
-       		       int max, uint32_t target, int arg0, int arg1);
-
-void send_response(int ret, int node, request_t *req);
-void send_ret(msgctx_t *ctx, char *name, int ret, int orig_request,
-	      int new_owner);
-
-/* do this op on all resource groups.  The handler for the request 
-   will sort out whether or not it's a valid request given the state */
-void rg_doall(int request, int block, char *debugfmt);
-void do_status_checks(void); /* Queue status checks for locally running
-				services */
-
-/* from rg_state.c */
-int set_rg_state(char *name, rg_state_t *svcblk);
-int get_rg_state(char *servicename, rg_state_t *svcblk);
-int get_rg_state_local(char *servicename, rg_state_t *svcblk);
-uint32_t best_target_node(cluster_member_list_t *allowed, uint32_t owner,
-			  char *rg_name, int lock);
-
-#ifdef DEBUG
-int _rg_lock_dbg(char *, struct dlm_lksb *, char *, int);
-#define rg_lock(name, p) _rg_lock_dbg(name, p, __FILE__, __LINE__)
-
-int _rg_unlock_dbg(struct dlm_lksb *, char *, int);
-#define rg_unlock(p) _rg_unlock_dbg(p, __FILE__, __LINE__)
-
-#else
-int rg_lock(char *name, struct dlm_lksb *p);
-int rg_unlock(struct dlm_lksb *p);
-#endif
-
-
-/* Return codes */
-#define RG_EEXCL	-16		/* Service not runnable due to
-					   inability to start exclusively */
-#define RG_EDOMAIN	-15		/* Service not runnable given the
-					   set of nodes and its failover
-					   domain */
-#define RG_ESCRIPT	-14		/* S/Lang script failed */
-#define RG_EFENCE	-13		/* Fencing operation pending */
-#define RG_ENODE	-12		/* Node is dead/nonexistent */
-#define RG_EFROZEN	-11		/* Service is frozen */
-#define RG_ERUN		-10		/* Service is already running */
-#define RG_EQUORUM	-9		/* Operation requires quorum */
-#define RG_EINVAL	-8		/* Invalid operation for resource */
-#define RG_EDEPEND 	-7		/* Operation violates dependency */
-#define RG_EAGAIN	-6		/* Try again */
-#define RG_EDEADLCK	-5		/* Aborted - would deadlock */
-#define RG_ENOSERVICE	-4		/* Service does not exist */
-#define RG_EFORWARD	-3		/* Service not mastered locally */
-#define RG_EABORT	-2		/* Abort; service unrecoverable */
-#define RG_EFAIL	-1		/* Generic failure */
-#define RG_ESUCCESS	0
-#define RG_YES		1
-#define RG_NO		2
-
-
-const char *rg_strerror(int val);
-
-
-/*
- * Fail-over domain states
- */
-#define FOD_ILLEGAL		0
-#define FOD_GOOD		1
-#define FOD_BETTER		2
-#define FOD_BEST		3
-
-/* 
-   Fail-over domain flags
- */
-#define FOD_ORDERED		(1<<0)
-#define FOD_RESTRICTED		(1<<1)
-#define FOD_NOFAILBACK		(1<<2)
-
-/*
-   Status tree flags
- */
-#define SFL_FAILURE		(1<<0)
-#define SFL_RECOVERABLE		(1<<1)
-
-//#define DEBUG
-#ifdef DEBUG
-
-#define dbg_printf(fmt, args...) \
-{\
-	printf("{%d} ", gettid());\
-	printf(fmt, ##args);\
-	fflush(stdout);\
-}
-
-#if 0
-#define pthread_mutex_lock(mutex) \
-{\
-	printf("lock(%s) @ %s:%d\n", #mutex, __FUNCTION__, __LINE__);\
-	fflush(stdout);\
-	pthread_mutex_lock(mutex);\
-}
-
-
-#define pthread_mutex_unlock(mutex) \
-{\
-	printf("unlock(%s) @ %s:%d\n", #mutex, __FUNCTION__, __LINE__);\
-	fflush(stdout);\
-	pthread_mutex_unlock(mutex);\
-}
-#endif
-
-#else /* DEBUG */
-
-#define dbg_printf(fmt, args...)
-
-#endif
-
-#endif
diff --git a/rgmanager/include/reslist.h b/rgmanager/include/reslist.h
deleted file mode 100644
index 206567d..0000000
--- a/rgmanager/include/reslist.h
+++ /dev/null
@@ -1,222 +0,0 @@
-#ifndef _RESLIST_H
-#define _RESLIST_H
-
-#include <stdint.h>
-#include <libxml/parser.h>
-#include <libxml/xmlmemory.h>
-#include <libxml/xpath.h>
-
-
-#define RA_PRIMARY	(1<<0)	/** Primary key */
-#define RA_UNIQUE	(1<<1)	/** Unique for given type */
-#define RA_REQUIRED	(1<<2)	/** Required (or an error if not present */
-#define RA_INHERIT	(1<<3)	/** Inherit a parent resource's attr */
-#define RA_RECONFIG	(1<<4)	/** Allow inline reconfiguration */
-
-#define RF_INLINE	(1<<0)
-#define RF_DEFINED	(1<<1)
-#define RF_NEEDSTART	(1<<2)	/** Used when adding/changing resources */
-#define RF_NEEDSTOP	(1<<3)  /** Used when deleting/changing resources */
-#define RF_COMMON	(1<<4)	/** " */
-#define RF_INDEPENDENT	(1<<5)  /** Define this for a resource if it is
-				  otherwise an independent subtree */
-#define RF_RECONFIG	(1<<6)
-
-#define RF_INIT		(1<<7)	/** Resource rule: Initialize this resource
-				  class on startup */
-#define RF_DESTROY	(1<<8)	/** Resource rule flag: Destroy this
-				  resource class if you delete it from
-				  the configuration */
-#define RF_ENFORCE_TIMEOUTS (1<<9) /** Enforce timeouts for this node */
-
-
-
-#define RES_STOPPED	(0)
-#define RES_STARTED	(1)
-#define RES_FAILED	(2)
-
-#ifndef SHAREDIR
-#define SHAREDIR		"/usr/share/rgmanager"
-#endif
-
-#define RESOURCE_ROOTDIR	SHAREDIR
-#define RESOURCE_TREE_ROOT	"/cluster/rm"
-#define RESOURCE_BASE		RESOURCE_TREE_ROOT "/resources"
-#define RESOURCE_ROOT_FMT 	RESOURCE_TREE_ROOT "/%s[%d]"
-
-#define RESOURCE_MAX_LEVELS	100
-
-/* Include OCF definitions */
-#include <res-ocf.h>
-
-
-typedef struct _resource_attribute {
-	char	*ra_name;
-	char	*ra_value;
-	int	ra_flags;
-	int	_pad_;
-} resource_attr_t;
-
-
-typedef struct _resource_child {
-	char	*rc_name;
-	int	rc_startlevel;
-	int	rc_stoplevel;
-	int	rc_forbid;
-	int	rc_flags;
-} resource_child_t;
-
-
-typedef struct _resource_act {
-	char	*ra_name;
-	time_t	ra_timeout;
-	time_t	ra_last;
-	time_t	ra_interval;
-	int	ra_depth;
-	int	ra_flags;
-} resource_act_t;
-
-
-typedef struct _resource_rule {
-	list_head();
-	char *	rr_type;
-	char *	rr_agent;
-	char *	rr_version;	/** agent XML spec version; OCF-ism */
-	int	rr_flags;
-	int	rr_maxrefs;
-	resource_attr_t *	rr_attrs;
-	resource_child_t *	rr_childtypes;
-	resource_act_t *	rr_actions;
-} resource_rule_t;
-
-
-typedef struct _resource {
-	list_head();
-	resource_rule_t *	r_rule;
-	char *	r_name;
-	resource_attr_t *	r_attrs;
-	resource_act_t *	r_actions;
-	time_t	r_started;	/** Time this resource was last started */
-	int	r_flags;
-	int	r_refs;
-	int	r_incarnations;	/** Number of instances running locally */
-	int	_pad_; /* align */
-} resource_t;
-
-
-typedef struct _rg_node {
-	list_head();
-	struct _rg_node	*rn_child, *rn_parent;
-	resource_t	*rn_resource;
-	resource_act_t	*rn_actions;
-	restart_counter_t rn_restart_counter;
-	int	rn_state; /* State of this instance of rn_resource */
-	int	rn_flags;
-	int	rn_last_status;
-	int 	rn_last_depth;
-	int	rn_checked;
-	int	rn_pad;
-} resource_node_t;
-
-typedef struct _fod_node {
-	list_head();
-	char	*fdn_name;
-	int	fdn_prio;
-	int	fdn_nodeid;
-} fod_node_t;
-
-typedef struct _fod {
-	list_head();
-	char	*fd_name;
-	fod_node_t	*fd_nodes;
-	int	fd_flags;
-	int	_pad_; /* align */
-} fod_t;
-
-
-/*
-   Exported Functions
- */
-int res_start(resource_node_t **tree, resource_t *res, void *ret);
-int res_stop(resource_node_t **tree, resource_t *res, void *ret);
-int res_status(resource_node_t **tree, resource_t *res, void *ret);
-int res_condstart(resource_node_t **tree, resource_t *res, void *ret);
-int res_condstop(resource_node_t **tree, resource_t *res, void *ret);
-int res_exec(resource_node_t *node, int op, const char *arg, int depth);
-/*int res_resinfo(resource_node_t **tree, resource_t *res, void *ret);*/
-int expand_time(char *val);
-int store_action(resource_act_t **actsp, char *name, int depth, int timeout, int interval);
-
-
-/*
-   Calculate differences
- */
-int resource_delta(resource_t **leftres, resource_t **rightres);
-int resource_tree_delta(resource_node_t **, resource_node_t **);
-
-
-/*
-   Load/kill resource rule sets
- */
-int load_resource_rules(const char *rpath, resource_rule_t **rules);
-void print_resource_rule(resource_rule_t *rr);
-void destroy_resource_rules(resource_rule_t **rules);
-
-/*
-   Load/kill resource sets
- */
-int load_resources(int ccsfd, resource_t **reslist, resource_rule_t **rulelist);
-void print_resource(resource_t *res);
-void destroy_resources(resource_t **list);
-
-/*
-   Construct/deconstruct resource trees
- */
-int build_resource_tree(int ccsfd, resource_node_t **tree,
-			resource_rule_t **rulelist, resource_t **reslist);
-void print_resource_tree(resource_node_t **tree);
-void destroy_resource_tree(resource_node_t **tree);
-
-/*
-   Construct/deconstruct failover domains
- */
-int construct_domains(int ccsfd, fod_t **domains);
-void deconstruct_domains(fod_t **domains);
-void print_domains(fod_t **domains);
-int node_should_start(int nodeid, cluster_member_list_t *membership,
-		      char *rg_name, fod_t **domains);
-int node_domain_set(fod_t **domains, char *name, int **ret, int *retlen, int *flags);
-int node_domain_set_safe(char *domainname, int **ret, int *retlen, int *flags);
-
-
-/*
-   Handy functions
- */
-resource_t *find_resource_by_ref(resource_t **reslist, char *type, char *ref);
-resource_t *find_root_by_ref(resource_t **reslist, char *ref);
-resource_rule_t *find_rule_by_type(resource_rule_t **rulelist, char *type);
-void res_build_name(char *, size_t, resource_t *);
-
-/*
-   Internal functions; shouldn't be needed.
- */
-char *xpath_get_one(xmlDocPtr doc, xmlXPathContextPtr ctx, char *query);
-int store_attribute(resource_attr_t **attrsp, char *name, char *value,
-		    int flags);
-
-resource_t *load_resource(int ccsfd, resource_rule_t *rule, char *base);
-int store_resource(resource_t **reslist, resource_t *newres);
-void destroy_resource(resource_t *res);
-
-char *attr_value(resource_node_t *node, char *attrname);
-char *rg_attr_value(resource_node_t *node, char *attrname);
-char *res_attr_value(resource_t *res, char *attrname);
-char *primary_attr_value(resource_t *);
-int rescmp(resource_t *l, resource_t *r);
-
-#ifdef NO_CCS
-int conf_get(char *query, char **ret);
-int conf_setconfig(char *path);
-#endif
-
-#endif /* _RESLIST_H */
diff --git a/rgmanager/include/restart_counter.h b/rgmanager/include/restart_counter.h
deleted file mode 100644
index 399680c..0000000
--- a/rgmanager/include/restart_counter.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* Time-based restart counters for rgmanager */
-
-#ifndef _RESTART_COUNTER_H
-#define _RESTART_COUNTER_H
-
-typedef void *restart_counter_t;
-
-int restart_add(restart_counter_t arg);
-int restart_clear(restart_counter_t arg);
-int restart_count(restart_counter_t arg);
-restart_counter_t restart_init(time_t expire_timeout, int max_restarts);
-int restart_cleanup(restart_counter_t arg);
-
-#endif
diff --git a/rgmanager/include/rg_locks.h b/rgmanager/include/rg_locks.h
deleted file mode 100644
index 50b181e..0000000
--- a/rgmanager/include/rg_locks.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef __RG_LOCKS_H
-#define __RG_LOCKS_H
-
-int rg_running(void);
-
-int rg_locked(void);
-int rg_lockall(int flag);
-int rg_unlockall(int flag);
-
-int rg_quorate(void);
-int rg_set_quorate(void);
-int rg_set_inquorate(void);
-
-int rg_inc_threads(void);
-int rg_dec_threads(void);
-int rg_wait_threads(void);
-
-int rg_initialized(void);
-int rg_set_initialized(int);
-int rg_clear_initialized(int);
-int rg_wait_initialized(int);
-
-#define FL_INIT 0x1
-#define FL_CONFIG 0x2
-
-int rg_inc_status(void);
-int rg_dec_status(void);
-int rg_set_statusmax(int max);
-
-int ccs_lock(void);
-int ccs_unlock(int fd);
-
-#endif
-
diff --git a/rgmanager/include/rg_queue.h b/rgmanager/include/rg_queue.h
deleted file mode 100644
index 6f26e40..0000000
--- a/rgmanager/include/rg_queue.h
+++ /dev/null
@@ -1,48 +0,0 @@
-#ifndef _RG_QUEUE_H
-#define _RG_QUEUE_H
-#include <list.h>
-#include <stdint.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <message.h>
-
-
-/** 
- * Resource Group thread request queue entry.
- */
-typedef struct _request {
-	list_head();				/** Next/prev pointers */
-	char		rr_group[64];		/** Resource Group */
-	uint32_t	rr_request;		/** Request */
-	uint32_t	rr_errorcode;		/** Error condition */
-	uint32_t	rr_orig_request;	/** Original request */
-	uint32_t	rr_target;		/** Target node */
-	uint32_t	rr_arg0;		/** Integer argument */
-	uint32_t	rr_arg1;		/** Integer argument */
-	uint32_t	rr_arg2;		/** Integer argument */
-	uint32_t	rr_line;		/** Line no */
-	msgctx_t *	rr_resp_ctx;		/** FD to send response */
-	char 		*rr_file;		/** Who made req */
-	time_t		rr_when;		/** time to execute */
-} request_t;
-
-
-int _rq_queue_request(request_t **queue, char *name, uint32_t request,
-    		     uint32_t err, uint32_t oldreq, msgctx_t *ctx, time_t when,
-    		     uint32_t target, uint32_t arg0, uint32_t arg1, char *file,
-		     int line);
-
-#define rq_queue_request(queue, name, request, err, oldreq,\
-			 fd, when, target, arg0, arg1) \
-	_rq_queue_request(queue, name, request, err, oldreq, fd, when, \
-			 target, arg0, arg1, __FILE__, __LINE__)
-
-request_t *rq_next_request(request_t **q);
-int rq_queue_empty(request_t **q);
-void rq_free(request_t *foo);
-
-void forward_request(request_t *req);
-void forward_message(msgctx_t *ctx, void *msg, int nodeid);
-
-
-#endif
diff --git a/rgmanager/include/rg_types.h b/rgmanager/include/rg_types.h
deleted file mode 100644
index a6a2b5f..0000000
--- a/rgmanager/include/rg_types.h
+++ /dev/null
@@ -1,18 +0,0 @@
-#ifndef _RG_TYPES_H
-#define _RG_TYPES_H
-
-#include <stdint.h>
-#include <arpa/inet.h>
-#include <libcman.h>
-#include <libdlm.h>
-
-typedef struct cluster_members {
-	int cml_count;
-	int pad;
-	cman_node_t *cml_members;
-} cluster_member_list_t;
-
-#define RG_PORT 177
-#define RGMGR_SOCK "/var/run/cluster/rgmanager.sk"
-
-#endif
diff --git a/rgmanager/include/rmtab.h b/rgmanager/include/rmtab.h
deleted file mode 100644
index f0bd9b1..0000000
--- a/rgmanager/include/rmtab.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/** @file
- * Header for rmtab.c.
- */
-/*
- * Author: Lon H. Hohberger <lhh at redhat.com>
- */
-#ifndef _RMTAB_H
-#define _RMTAB_H
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdint.h>
-
-/* Shamelessly ripped from nfs-utils */
-#ifndef MAXHOSTNAMELEN
-#define MAXHOSTNAMELEN 64
-#endif
-
-#ifndef _PATH_RMTAB
-#define _PATH_RMTAB "/var/lib/nfs/rmtab"
-#endif
-
-/* private types */
-#ifndef MSG_RMTAB_UPDATE
-#define MSG_RMTAB_UPDATE 978
-#endif
-
-#ifndef MSG_RMTAB_BOOT
-#define MSG_RMTAB_BOOT 603
-#endif
-
-/* Just a mem-size trim for now */
-#define __MAXPATHLEN 1024
-
-/**
- * rmtab node list entry.
- *
- * This contains all the information necessary to reconstruct a line in
- * /var/lib/nfs/rmtab.
- */
-typedef struct _rmtab_node {
-	struct _rmtab_node *rn_next;	/**< Next pointer */
-	char *rn_hostname;		/**< Mount entry hostname */
-	char *rn_path;			/**< Export mounted */
-	uint32_t rn_count;		/**< Number of times export is
-					     mounted. */
-} rmtab_node;
-
-
-/*
- * list addition (insert)
- */
-int __rmtab_insert(rmtab_node **head, rmtab_node *rnew);
-rmtab_node *rmtab_insert(rmtab_node **head, rmtab_node *pre, char *host,
-			 char *path, int count);
-
-/*
- * list deletion/removal/etc.
- */
-rmtab_node *__rmtab_remove(rmtab_node **head, rmtab_node *entry);
-rmtab_node *rmtab_remove(rmtab_node **head, char *host, char *path);
-void rmtab_kill(rmtab_node **head);
-
-/*
- * diff/merge functions
- */
-int rmtab_diff(rmtab_node *old, rmtab_node *new, rmtab_node **diff);
-int rmtab_merge(rmtab_node **head, rmtab_node *patch);
-
-/*
- * Read/write/import/export...
- */
-int rmtab_import(rmtab_node **head, FILE *fp);
-int rmtab_export(rmtab_node *head, FILE *fp);
-
-int rmtab_read(rmtab_node **head, char *filename);
-int rmtab_write_atomic(rmtab_node *head, char *filename);
-
-/*
- * Translation to/from network block [array] style
- */
-int rmtab_pack(char *dest, rmtab_node *head);
-int rmtab_unpack(rmtab_node **dest, char *src, size_t srclen);
-
-/*
- * utility functions
- */
-int rmtab_cmp_min(rmtab_node *left, rmtab_node *right);
-int rmtab_cmp(rmtab_node *left, rmtab_node *right);
-size_t rmtab_pack_size(rmtab_node *head);
-int rmtab_move(rmtab_node **dest, rmtab_node **src);
-
-/*
- * DEBUG junk
- */
-#ifdef DEBUG
-int rmtab_dump(rmtab_node *head);
-#endif
-
-#endif
diff --git a/rgmanager/include/sets.h b/rgmanager/include/sets.h
deleted file mode 100644
index eb499e6..0000000
--- a/rgmanager/include/sets.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- @file sets.h - Header file for sets.c
- @author Lon Hohberger <lhh at redhat.com>
- */
-#ifndef _SETS_H
-#define _SETS_H
-
-/* #include <stdint.h> */
-typedef int set_type_t;
-
-int s_add(set_type_t *, int *, set_type_t);
-int s_union(set_type_t *, int, set_type_t *,
-	    int, set_type_t **, int *);
-
-int s_intersection(set_type_t *, int, set_type_t *,
-		   int, set_type_t **, int *);
-int s_delta(set_type_t *, int, set_type_t *,
-	    int, set_type_t **, int *);
-int s_subtract(set_type_t *, int, set_type_t *, int, set_type_t **, int *);
-int s_shuffle(set_type_t *, int);
-
-#endif
diff --git a/rgmanager/include/signals.h b/rgmanager/include/signals.h
deleted file mode 100644
index c5f7d6c..0000000
--- a/rgmanager/include/signals.h
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef __SIGNALS_H
-#define __SIGNALS_H
-
-void *setup_signal(int, void (*)(int));
-int block_signal(int sig);
-int unblock_signal(int sig);
-int block_all_signals(void);
-
-#endif
diff --git a/rgmanager/include/vf.h b/rgmanager/include/vf.h
deleted file mode 100644
index e149a47..0000000
--- a/rgmanager/include/vf.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/** @file
- * Header for vf.c.
- */
-#ifndef __VF_H
-#define __VF_H
-
-#include <stdint.h>
-#include <sys/types.h>
-#include <msgsimple.h>
-
-/*
- * We use this to initiate the VF protocol.  This doesn't really belong here.
- */
-typedef struct __attribute__ ((packed)) _vf_msg_info {
-	uint32_t	vf_command;
-	uint32_t	vf_transaction;
-	char 		vf_keyid[64];
-	uint32_t	vf_coordinator; /* Node ID of who coordinates */
-	uint32_t	vf_datalen;
-	uint64_t	vf_view;
-	char		vf_data[0];
-} vf_msg_info_t;
-
-#define swab_vf_msg_info_t(ptr) \
-{\
-	swab32((ptr)->vf_command);\
-	swab32((ptr)->vf_transaction);\
-	swab32((ptr)->vf_coordinator);\
-	swab64((ptr)->vf_view);\
-	swab32((ptr)->vf_datalen);\
-}
-
-
-typedef struct __attribute__ ((packed)) _vf_msg {
-	generic_msg_hdr	vm_hdr;
-	vf_msg_info_t	vm_msg;
-} vf_msg_t;
-
-#define swab_vf_msg_t(ptr) \
-{\
-	swab_generic_msg_hdr(&((ptr)->vm_hdr));\
-	swab_vf_msg_info_t(&((ptr)->vm_msg));\
-}
-
- 
-/*
- * Exp: Callback function proto definitions.
- */
-typedef int32_t (*vf_vote_cb_t)(char *, uint64_t, void *, uint32_t);
-typedef int32_t (*vf_commit_cb_t)(char *, uint64_t, void *, uint32_t);
-
-/*
- * INTERNAL VF STRUCTURES
- */
- 
- /**
- * A view node.  This holds the data from a VF_JOIN_VIEW message until it
- * is committed.
- */
-typedef struct _view_node {
-	struct _view_node *
-			vn_next;	/**< Next pointer. */
-	uint32_t 	vn_transaction;	/**< Transaction ID */
-	uint32_t	vn_nodeid;	/**< Node ID of coordinator. */
-	struct timeval  vn_timeout;	/**< Expiration time. */
-	uint64_t	vn_viewno;	/**< View Number. */
-	uint32_t	vn_datalen;	/**< Length of included data. */
-	uint32_t	vn_pad;		/**< pad */
-	char		vn_data[0];	/**< Included data. */
-} view_node_t;
-
-
-/**
- * A commit node.  This holds a commit message until it is possible to
- * resolve it with its corresponding view_node_t.
- */
-typedef struct _commit_node {
-	struct _commit_node *
-			vc_next;	/**< Next pointer. */
-	uint32_t 	vc_transaction;	/**< Transaction ID */
-} commit_node_t;
-
-
-/**
- * A key node.  For each type of data used, a key node is created
- * and managed by the programmer.
- */
-typedef struct _key_node {
-	struct _key_node *kn_next;	/**< Next pointer. */
-	char	 *kn_keyid;		/**< Key ID this key node refers to. */
-	uint32_t kn_pid;		/**< PID. Child process running
-					  View-Formation on this key. */
-	uint32_t kn_datalen;		/**< Current length of data. */
-	view_node_t *kn_jvlist;		/**< Buffered join-view list. */
-	commit_node_t *kn_clist;	/**< Buffered commit list. */
-	uint64_t kn_viewno;		/**< Current view number of data. */
-	char *kn_data;			/**< Current data. */
-	int kn_tsec;			/**< Default timeout (in seconds */
-	int kn_pad;			/**< pad */
-	vf_vote_cb_t kn_vote_cb;	/**< Voting callback function */
-	vf_commit_cb_t kn_commit_cb;	/**< Commit callback function */
-} key_node_t;
-
-
-
-
-/*
- * VF message types.
- */
-/* Main programs handle this */
-#define VF_MESSAGE		0x3000
-
-/* Subtypes */
-#define VF_JOIN_VIEW		0x3001
-#define VF_VOTE			0x3002
-#define VF_ABORT		0x3004
-#define VF_VIEW_FORMED		0x3005
-#define VF_CURRENT		0x3006
-#define VF_ACK			0x3007
-#define VF_NACK			0x3008
-
-#define vf_command(x)  (x&0x0000ffff)
-#define vf_flags(x)    (x&0xffff0000)
-
-#define VFMF_AFFIRM	0x00010000
-
-
-#define VF_COORD_TIMEOUT	60	/* 60 seconds MAX timeout */
-#define VF_COMMIT_TIMEOUT_MIN	(2 * VF_COORD_TIMEOUT)
-
-/* Return codes for vf_handle_msg... */
-#define VFR_ERROR	100
-#define VFR_TIMEOUT	101
-#define VFR_OK		0
-#define VFR_YES		VFR_OK
-#define VFR_NO		1
-#define VFR_COMMIT	2
-#define VFR_ABORT	3
-#define VFR_NODATA	4
-
-/*
- * Operational flags for vf_start
- */
-#define VFF_RETRY		0x1
-#define VFF_IGN_CONN_ERRORS	0x2
-#define VFF_IGN_WRITE_ERRORS	0x4
-#define VFF_IGN_READ_ERRORS	0x8
-#define VFF_IGN_ALL_ERRORS	(VFF_IGN_CONN_ERRORS|VFF_IGN_WRITE_ERRORS|\
-				 VFF_IGN_READ_ERRORS)
-
-
-/* 
- * VF Stuff.  VF only talks to peers.
- */
-int vf_init(int, uint16_t, vf_vote_cb_t, vf_commit_cb_t);
-int vf_invalidate(void);
-int vf_shutdown(void);
-
-/*
- * Returns a file descriptor on which the caller can select().
- *
- * This is a pipe which is used to notify the parent process that
- * the child has exited
- */
-int vf_write(cluster_member_list_t *membership, uint32_t flags,
-	     char *keyid, void *data, uint32_t datalen);
-int vf_read(cluster_member_list_t *membership, char *keyid,
-	    uint64_t *view, void **data, uint32_t *datalen);
-int vf_key_init(char *keyid, int timeout, vf_vote_cb_t vote_cb,
-		vf_commit_cb_t commit_cb);
-int getuptime(struct timeval *tv);
-int vf_process_msg(msgctx_t *ctx, int nodeid, generic_msg_hdr *msgp, int nbytes);
-
-#define MSGP_VFS 0x18dcf1
-#define MSGP_VFC 0x0103fab
-
-#endif
diff --git a/rgmanager/init.d/Makefile b/rgmanager/init.d/Makefile
deleted file mode 100644
index 1a50d62..0000000
--- a/rgmanager/init.d/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-TARGET= rgmanager
-
-INITDT=$(TARGET)
-
-all: $(TARGET)
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-$(TARGET): $(S)/$(TARGET).in
-	cat $(S)/$(TARGET).in | sed \
-		-e 's#@INITDDIR@#${initddir}#g' \
-	> $(TARGET)
-
-clean: generalclean
-
-check:
diff --git a/rgmanager/init.d/rgmanager.in b/rgmanager/init.d/rgmanager.in
deleted file mode 100644
index 2a3a30c..0000000
--- a/rgmanager/init.d/rgmanager.in
+++ /dev/null
@@ -1,192 +0,0 @@
-#!/bin/bash
-#
-# chkconfig: - 99 01
-# description: Starts and stops Red Hat Service (resource group) Manager
-
-### BEGIN INIT INFO
-# Provides:		rgmanager
-# Required-Start:	cman
-# Required-Stop:	cman
-# Default-Start:
-# Default-Stop:
-# Short-Description:	Starts and stops Red Hat Service (resource group) Manager
-# Description:		Starts and stops Red Hat Service (resource group) Manager
-### END INIT INFO
-
-# rpm based distros
-if [ -d /etc/sysconfig ]; then
-	[ -f @INITDDIR@/functions ] && . @INITDDIR@/functions
-	[ -f /etc/sysconfig/cluster ] && . /etc/sysconfig/cluster
-	[ -f /etc/sysconfig/rgmanager ] && . /etc/sysconfig/rgmanager
-	[ -z "$LOCK_FILE" ] && LOCK_FILE="/var/lock/subsys/rgmanager"
-	success=success
-	failure=failure
-	status=status
-fi
-
-# deb based distros
-if [ -d /etc/default ]; then
-	[ -f /etc/default/cluster ] && . /etc/default/cluster
-	[ -f /etc/default/rgmanager ] && . /etc/default/rgmanager
-	[ -z "$LOCK_FILE" ] && LOCK_FILE="/var/lock/rgmanager"
-	success=local_success
-	failure=local_failure
-	status=local_status
-fi
-
-PATH=/sbin:/bin:/usr/sbin:/usr/bin
-
-export PATH
-
-ID="Cluster Service Manager"
-RGMGRD="rgmanager"
-
-LOG_ERR=3
-LOG_WARNING=4
-LOG_NOTICE=5
-LOG_INFO=6
-
-local_success()
-{
-    echo -ne "[  OK  ]\r"
-}
-
-local_failure()
-{
-    echo -ne "[FAILED]\r"
-}
-
-local_status()
-{
-    pid=$(pidof $1 2>/dev/null)
-    rtrn=$?
-    if [ $rtrn -ne 0 ]; then
-        echo "$1 is stopped"
-    else
-        echo "$1 (pid $pid) is running..."
-    fi
-    return $rtrn
-}
-
-#
-# log_and_print <level> <message>
-#
-log_and_print()
-{
-	if [ -z "$1" -o -z "$2" ]; then
-		return 1;
-	fi
-
-	clulog -s $1 "$2"
-	echo -n $2
-
-	return 0;
-}
-
-
-#
-# Bring down the cluster on a node.
-#
-stop_cluster()
-{
-	kill -TERM $(pidof $RGMGRD)
-
-	while [ 0 ]; do
-
-		if [ -n "$(pidof $RGMGRD)" ]; then
-			echo -n "Waiting for services to stop: " 
-			while [ -n "`pidof $RGMGRD`" ]; do
-				sleep 1
-			done
-			$success
-			echo
-		else
-			echo "Services are stopped."
-		fi
-
-		# Ensure all NFS rmtab daemons are dead.
-		killall $RMTABD > /dev/null 2>&1
-
-		rm -f /var/run/$RGMGRD.pid
-
-		return 0
-	done
-}
-
-
-case $1 in
-	start)
-		echo -n "Starting $ID: "
-
-		# most recent distributions use tmpfs for /var/run
-		# to avoid to clean it up on every boot.
-		# they also assume that init scripts will create
-		# required subdirectories for proper operations
-		mkdir -p /var/run/cluster
-
-		$RGMGRD $RGMGR_OPTS
-		rtrn=$?
-		if [ $rtrn = 0 ]; then
-			touch $LOCK_FILE
-			$success
-		else
-			$failure
-		fi
-		echo
-
-		exit $rtrn
-		;;
-
-	restart)
-		$0 status > /dev/null 2>&1
-		if [ $? -ne 1 ]; then
-			$0 stop
-		fi
-		$0 start
-		;;
-		
-	condrestart)
-		$0 status > /dev/null 2>&1
-		if [ $? -eq 0 ]; then
-			$0 stop
-			$0 start
-		fi
-		;;
-
-	reload)
-		log_and_print $LOG_NOTICE "Reloading Resource Configuration."
-		kill -HUP $(pidof $RGMGRD) 2>&1
-		rtrn=$?
-		if [ $rtrn = 0 ]; then
-			$success
-		else
-			$failure
-		fi
-		echo
-
-		exit $rtrn
-		;;
-
-	status)
-		$status $RGMGRD
-		exit $?
-		;;
-
-	stop)
-		if [ -n "$(pidof $RGMGRD)" ]; then
-			log_and_print $LOG_NOTICE "Shutting down $ID..."
-			echo
-			stop_cluster
-		fi
-
-		rm -f $LOCK_FILE
-		log_and_print $LOG_NOTICE "$ID is stopped."
-		echo
-		;;
-	*)
-		echo "usage: $0 {start|restart|condrestart|reload|status|stop}"
-		exit 1
-		;;
-esac
-
-exit 0
diff --git a/rgmanager/man/Makefile b/rgmanager/man/Makefile
deleted file mode 100644
index d965432..0000000
--- a/rgmanager/man/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-TARGET= clubufflush.8 \
-	clufindhostname.8 \
-	clulog.8 \
-	clurgmgrd.8 \
-	clurmtabd.8 \
-	clustat.8 \
-	clusvcadm.8
-
-include ../../make/defines.mk
-include $(OBJDIR)/make/man.mk
-
-check:
diff --git a/rgmanager/man/cluarp.8 b/rgmanager/man/cluarp.8
deleted file mode 100644
index 5bc912e..0000000
--- a/rgmanager/man/cluarp.8
+++ /dev/null
@@ -1,15 +0,0 @@
-.TH "cluarp" "8" "Jan 2005" "" "Red Hat Cluster Suite Internal Commands"
-.SH "NAME"
-cluarp \- Send a gratuitous ARP
-.SH "WARNING"
-Use of this command can cause the cluster to malfunction.  Do not run this
-without instructions from Red Hat Support.
-.SH "DESCRIPTION"
-.PP 
-The
-.B cluarp
-command is an internal command used to broadcast new ARP information when
-a service IP address is configured by the Service Manager.
-
-.SH "SEE ALSO"
-arp(8)
diff --git a/rgmanager/man/clubufflush.8 b/rgmanager/man/clubufflush.8
deleted file mode 100644
index 848d01e..0000000
--- a/rgmanager/man/clubufflush.8
+++ /dev/null
@@ -1,13 +0,0 @@
-.TH "clubufflush" "8" "Jan 2005" "" "Red Hat Cluster Suite Internal Commands"
-.SH "NAME"
-clubufflush \- Flush buffers on a service's file system.
-
-.SH "DESCRIPTION"
-.PP 
-The
-.B clubufflush
-command is an internal command used to synchronize buffers to disk
-prior to stopping a clustered service.
-
-.SH "SEE ALSO"
-sync(1), sync(2), fsync(2), fdatasync(2)
diff --git a/rgmanager/man/clufindhostname.8 b/rgmanager/man/clufindhostname.8
deleted file mode 100644
index 7035cd5..0000000
--- a/rgmanager/man/clufindhostname.8
+++ /dev/null
@@ -1,22 +0,0 @@
-.TH "clufindhostname" "8" "Jan 2005" "" "Red Hat Cluster Suite Internal Commands"
-.SH "NAME"
-clufindhostname \- Find a hostname or IP address given the other.
-.SH "SYNOPSIS"
-.B clufindhostname
-.B [\-i <ip_address>]
-.B [\-n <hostname>]
-
-.SH "DESCRIPTION"
-.PP 
-The
-.B clufindhostname
-command is a wrapper around gethostbyname(3) and gethostbyaddr(3).
-
-.SH "OPTIONS"
-.IP "\-i <ip_address>"
-Call gethostbyaddr(3) on specified IP address.
-.IP "\-n <hostname>"
-Call gethostbyname(3) on specified hostname.
-
-.SH "SEE ALSO"
-host(1), gethostbyname(3), gethostbyaddr(3)
diff --git a/rgmanager/man/clulog.8 b/rgmanager/man/clulog.8
deleted file mode 100644
index 571c341..0000000
--- a/rgmanager/man/clulog.8
+++ /dev/null
@@ -1,35 +0,0 @@
-.TH "clulog" "8" "Jan 2005" "" "Red Hat Cluster Suite Internal Commands"
-.SH "NAME"
-clulog \- Log a message to the cluster and/or system logs
-.SH "SYNOPSIS"
-.B clulog 
-.B \-s
-.I severity
-.B [\-l
-.I priority_filter
-.B ] 
-.B [\-n
-.I program_name
-.B ] 
-.B [\-p
-.I pid
-.B ] 
-.B message
-.SH "DESCRIPTION"
-.PP 
-The
-.B clulog
-command sends a message to syslogd(8).
-.SH "OPTIONS"
-.IP "\-s <severity>"
-Log at the specified severity (0-7; 0=ALERT, 7=DEBUG).
-.IP "\-l <priority_filter>"
-Apply the specified filter (0-7) for the message.  By default,
-.B clulog
-uses the service manager's assigned log level.
-.IP "\-n <program_name>"
-Log as the specified program name.
-.IP "\-p <pid>"
-Log as the specified PID.
-.SH "SEE ALSO"
-syslog(2), syslogd(8)
diff --git a/rgmanager/man/clunfsops.8 b/rgmanager/man/clunfsops.8
deleted file mode 100644
index ba768e4..0000000
--- a/rgmanager/man/clunfsops.8
+++ /dev/null
@@ -1,14 +0,0 @@
-.TH "clunfsops" "8" "Jan 2005" "" "Red Hat Cluster Suite Internal Commands"
-.SH "NAME"
-clunfsops \- Manipulate NFS
-.SH "WARNING"
-Use of this command can cause the cluster to malfunction.  Do not run this
-without instructions from Red Hat Support.
-.SH "DESCRIPTION"
-.PP 
-The
-.B clunfsops
-command is an internal command used to manipulate clustered NFS services.
-
-.SH "SEE ALSO"
-nfs(5), rpc.nfsd(8)
diff --git a/rgmanager/man/clurgmgrd.8 b/rgmanager/man/clurgmgrd.8
deleted file mode 100644
index 7b43925..0000000
--- a/rgmanager/man/clurgmgrd.8
+++ /dev/null
@@ -1,41 +0,0 @@
-.TH "clusvcmgrd" "8" "Jan 2005" "" "Red Hat Cluster Suite"
-.SH "NAME"
-Clurgmgrd \- Resource Group (Cluster Service) Manager Daemon
-.SH "DESCRIPTION"
-.PP 
-.B Clurgmgrd
-handles management of user-defined cluster services (also known as resource
-groups).  This includes handling of user requests including service start,
-service disable, service relocate, and service restart.  The service
-manager daemon also handles restarting and relocating services in the
-event of failures.
-.SH "HOW IT WORKS"
-.PP
-The service manager is spawned by an init script after the cluster
-infrastructure has been started and ccsd has been spawned, and only
-functions when the cluster is quorate.
-.LP 
-During initialization, the service manager runs scripts which ensure that all
-services are clear to be started.  After that, it determines which services
-need to be started and starts them.
-.LP
-When an event is received, members which are no longer online have their
-services taken away from them.  The event should only occur in the case that
-the member has been fenced whenever fencing is available.
-.LP
-When a cluster member determines that it is no longer in the cluster quorum,
-the service manager stops all services and waits for a new quorum to form.
-
-.SH "COMMAND LINE OPTIONS"
-.IP \-f
-Run in the foreground (do not fork).
-.IP \-d
-Enable debug-level logging.
-.IP \-N
-Do not perform stop-before-start.  Combined with the
-.I -Z
-flag to clusvcadm, this can be used to allow rgmanager to be upgraded
-without stopping a given user service or set of services.
-
-.SH "SEE ALSO"
-clusvcadm(8), ccsd(8)
diff --git a/rgmanager/man/clurmtabd.8 b/rgmanager/man/clurmtabd.8
deleted file mode 100644
index 3094499..0000000
--- a/rgmanager/man/clurmtabd.8
+++ /dev/null
@@ -1,37 +0,0 @@
-.TH "clurmtabd" "8" "Jan 2005" "" "Red Hat Cluster Suite"
-.SH "NAME"
-clurmtabd \- Cluster NFS Remote Mount Table Daemon
-.SH "DESCRIPTION"
-.PP 
-Instances of 
-.B clurmtabd
-keep entries relevant to a given mount point in sync cluster-wide.  It does
-this by polling /var/lib/nfs/rmtab periodically.
-.SH "HOW IT WORKS"
-.PP
-A single instance of 
-.B clurmtabd
-is spawned by the service manager (clusvcmgrd(8)) for each mount point in a
-given user service.  Each instance polls /var/lib/nfs/rmtab every few seconds,
-looking for changes.  When changes are detected, they are merged in with the
-current in-memory view.  The entries are filtered according to the mount point
-being monitored and are subsequently written out synchronously to that
-mount point.
-.LP
-When a user service is relocated (or after a fail-over), clurmtabd reads the
-entries on a given mount point and synchronizes them with the new member's
-/var/lib/nfs/rmtab.  This is done prior to running the exportfs(8) command
-so that clients of the given service do not receive "Stale NFS file handle"
-errors.
-.SH "NOTES"
-.PP
-Clurmtabd is not a part of NFS and can not ensure that "Stale NFS file handle"
-errors are never received.  It is a best-effort attempt.  To fully prevent
-"Stale NFS file handle" errors, it is necessary to modify the Linux kernel
-as well as nfs-utils.
-
-.SH "FILES"
-/var/lib/nfs/rmtab
-
-.SH "SEE ALSO"
-clurgmgrd(8), rpc.mountd(8), exportfs(8)
diff --git a/rgmanager/man/clustat.8 b/rgmanager/man/clustat.8
deleted file mode 100644
index ca84a84..0000000
--- a/rgmanager/man/clustat.8
+++ /dev/null
@@ -1,53 +0,0 @@
-.TH "clustat" "8" "Jan 2005" "" "Red Hat Cluster Suite"
-.SH "NAME"
-clustat \- Cluster Status Utility
-.SH "SYNOPSIS"
-.B clustat
-.B [\-i
-.I delay
-.B ] 
-.B [\-I]
-.B [\-m
-.I member
-.B ] 
-.B [\-Q]
-.B [\-s
-.I service
-.B ] 
-.B [\-v]
-.B [\-x]
-
-.SH "DESCRIPTION"
-.PP 
-The
-.B clustat
-command displays the status of the cluster.  It shows membership information,
-quorum view, and the state of all configured user services. The
-.B clustat 
-command displays cluster status only from the viewpoint of the cluster system
-on which it is running.
-.SH "OPTIONS"
-.IP "\-I"
-Display the member ID of the current member.
-.IP "\-i <delay>"
-Display cluster status and refresh the status every
-.I delay
-seconds.  Mutually exclusive with the
-.B "\-x"
-option.
-.B "\-m <member>"
-Display the status of the specified member.
-.IP "\-Q"
-Return cluster quorum status to calling shell. (No output)
-.IP "\-s <service>"
-Displays the status of the specified service.
-.IP "\-x"
-Display cluster configuration combined with status in XML format. Mutually 
-exclusive with
-.B "\-i"
-option.
-.IP \-v
-Display version information and exit.
-
-.SH "SEE ALSO"
-clusvcadm(8)
diff --git a/rgmanager/man/clusvcadm.8 b/rgmanager/man/clusvcadm.8
deleted file mode 100644
index d1435ef..0000000
--- a/rgmanager/man/clusvcadm.8
+++ /dev/null
@@ -1,133 +0,0 @@
-.TH "clusvcadm" "8" "Jan 2005" "" "Red Hat Cluster Suite"
-.SH "NAME"
-clusvcadm \- Cluster User Service Administration Utility
-.SH "SYNOPSIS"
-.B clusvcadm
-.B [\-d
-.I <service>
-.B ]
-.B [\-e
-.I <service>
-.B ]
-.B [\-l]
-.B [\-u]
-.B [\-S]
-.B [\-m
-.I <member>
-.B ]
-.B [\-r
-.I <service>
-.B ]
-.B [\-R
-.I <service>
-.B ]
-.B [\-M
-.I <service>
-.B ]
-.B [\-Z
-.I <service>
-.B ]
-.B [\-U
-.I <service>
-.B ]
-.B [\-s
-.I <service>
-.B ]
-.B [\-v]
-
-.SH "DESCRIPTION"
-.PP 
-The
-.B clusvcadm
-command allows an administrator to enable, disable, relocate, and restart
-user services in a cluster.  In order to perform cluster service operations,
-the cluster daemons must be running (and have quorum) on the member system
-on which the command is invoked.
-
-.SH "OPTIONS"
-.IP "\-d <service>"
-Stops and disables the user service named
-.I
-service
-.IP "\-e <service>"
-Enables and starts the user service named
-.I
-service
-.IP \-l
-Lock services in preparation for cluster shutdown.  This should only
-be used if the administrator intends to perform a global, cluster
-wide shutdown.  This prevents services from starting (but not stopping,
-like
-.B -Z
-does).  Once the cluster quorum is dissolved, this state is reset.
-If a new instance of rgmanager boots while others are locked, the
-behavior is undefined.
-.IP \-u
-Unlock resource group managers.  This allows services to start again. 
-.IP "\-S"
-Display whether the resource group managers are locked or not.  This
-can be used to verify the correct operation of the \fB-l\fR and \fB-u\fR 
-options, but is only useful for debugging.
-.IP "\-m <member>"
-When used in conjunction with either the
-.B
-\-e
-or
-.B
-\-r
-options, this specifies the 
-.I
-preferred
-target member on which to start the 
-service.
-.IP "\-r <service>"
-Relocates the user service named
-.I
-service
-to another cluster member.
-.IP "\-R <service>"
-Restarts the user service named
-.I
-service
-on the cluster member on which it is currently running.
-.IP "\-M <service>"
-Use a special "migration" operation to move the user service named
-.I
-service
-to another cluster member.  Currently, this is only useful for
-virtual machines.  Use of migration usually requires special
-configuration of the local virtual machine manager in order
-to work correctly.
-.IP "\-Z <service>"
-Freezes the service named
-.I
-service
-on the cluster member on which it is currently running.  This will
-prevent status checks of the service as well as failover in the
-event the node fails or rgmanager is stopped.
-.IP "\-U <service>"
-Unfreezes the user service named
-.I
-service
-on the cluster member on which it is currently running.  This will
-re-enable status checks.
-.IP "\-s <service>"
-Stops the service named
-.I
-service
-until a member transition or until it is enabled again.
-
-.IP \-v
-Display version information and exit.
-
-.SH "NOTES"
-Executing
-.I -U
-(unfreeze) on a service which was frozen in the 
-.B started
-state while the service owner is offline results in an undefined
-(and possibly dangerous) condition.  Manually ensure all resources are
-clear before doing this.
-
-.SH "SEE ALSO"
-clustat(8)
diff --git a/rgmanager/src/Makefile b/rgmanager/src/Makefile
deleted file mode 100644
index c79d053..0000000
--- a/rgmanager/src/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-include ../../make/defines.mk
-include $(OBJDIR)/make/passthrough.mk
-
-SUBDIRS=resources clulib daemons utils
diff --git a/rgmanager/src/clulib/Makefile b/rgmanager/src/clulib/Makefile
deleted file mode 100644
index 0dc7a2e..0000000
--- a/rgmanager/src/clulib/Makefile
+++ /dev/null
@@ -1,49 +0,0 @@
-TARGET1= libclulib.a
-TARGET2= liblalloc.a
-TARGET3= msgtest
-
-all: ${TARGET1} ${TARGET2} ${TARGET3}
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-OBJS1=	logging.o daemon_init.o signals.o msgsimple.o \
-	gettid.o rg_strings.o message.o members.o fdops.o \
-	lock.o cman.o vft.o msg_cluster.o msg_socket.o \
-	wrap_lock.o sets.o
-
-OBJS2= alloc.o
-
-OBJS3= msgtest.o
-
-CFLAGS += -Werror -Wstrict-prototypes -Wshadow -fPIC -D_GNU_SOURCE
-CFLAGS += -I${ccsincdir} -I${cmanincdir} -I${dlmincdir}
-CFLAGS += -I${logtincdir}
-CFLAGS += -I$(S)/../../include
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L${cmanlibdir} -lcman 
-LDFLAGS += -L. -lclulib -llalloc
-LDFLAGS += -lpthread
-LDFLAGS += -L${logtlibdir} -llogthread
-LDFLAGS += -L${libdir}
-
-${TARGET1}: ${OBJS1}
-	${AR} cru $@ $^
-	${RANLIB} $@
-
-${TARGET2}: ${OBJS2}
-	${AR} cru $@ $^
-	${RANLIB} $@
-
-${TARGET3}: ${OBJS3} ${TARGET1}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-clean: generalclean
-
--include $(OBJS1:.o=.d)
--include $(OBJS2:.o=.d)
--include $(OBJS3:.o=.d)
diff --git a/rgmanager/src/clulib/alloc.c b/rgmanager/src/clulib/alloc.c
deleted file mode 100644
index 55ee632..0000000
--- a/rgmanager/src/clulib/alloc.c
+++ /dev/null
@@ -1,1233 +0,0 @@
-/**
-  @file
-
-  Bounded memory allocator.  This is designed for applications which require
-  bounded memory allocation and which ought not be swapped out to disk.
-
-  What it is:
-  - Replacement for malloc, calloc, free, and realloc which allocates
-  memory from a fixed-size heap, which is either allocated at the time
-  of the first allocation or during program initialization with a call
-  to 'malloc_init(size_t count)'.
-
-  - Designed for applications requiring small amounts of RAM.  Note
-  that though we use size_t arguments, the maximum supported in the
-  header structure is a 32-bit integer.
-
-  - Fairly fast.
-
-
-  What it's _not_:
-  - General purpose.  The heap is allocated either at the first call to
-  malloc() or the call to malloc_init(), and is a fixed size.  There is no
-  memalign/valloc/pvalloc currently. 
-
-  - Super-efficient.  It's reasonably fast in many situations compared to
-  glibc's malloc, but records states in the memory blocks to help prevent
-  accidental double-frees and such (it's still possible, mind you).  In 
-  general, your program will consume MORE memory when using this allocator,
-  because it preallocates a huge block.  However, your program should run
-  faster.  It's also probably not terribly efficient in a threaded
-  program, but it does work (and properly zap its mutex on fork()).
-
-
-  malloc algorithm in detail:
-
-  (1) Init the pool as necessary.  After the pool is initialized, we have
-  one large free block which is the size of the memory pool less the header.
-
-  (2) Whenever we get a call to malloc, we look for a free block.  If the
-  size of a free block matches within 25% of the requested size (bounded at
-  MIN_SAVE), we immediately return that chunk to the user.  If no blocks are
-  found matching this criteria, we look for chunks which are large enough
-  to split (i.e. with a size >= requested_size + MIN_EXTRA).
-
-  (3) If we find one, we split the block, create a new (smaller) free block,
-  and return the block to the user.
-
-  [ Note: Steps 4 and 5 only if AGGR_RECLAIM is 0 ]
-  (4) If none are found, we perform an aggressive consolidation which searches
-  the entire memory pool for free blocks next to each other and combines
-  them into one larger block.
-
-  (5) Repeat steps (2) and (3).
-
-  (6) If no blocks are found again, we're done.  Return NULL/ENOMEM.
-
-
-  free algorithm in detail:
-
-  (1) Sanity check the pointer and block structure it would point to.
-
-  (2) [ If AGGR_RECLAIM = 0 ] Consolidate this block with all free blocks
-  with a higher address than it in the pool.
-
-  (2) [ If AGGR_RECLAIM = 1 ] Aggressively consolidate all free blocks 
-  in the pool which are next to one another.
-
-
-  realloc:
-
-  ... Just an obvious wrapper around malloc.  Potentially could resize if
-  the next block was free and has enough space.  I.e.  Join-blocks,
-  resize, and split again if necessary.  For now, it works, so we'll
-  leave it alone.  This would be both an increase in speed and memory
-  efficiency (while performing the operation), but otherwise isn't necessary.
-
-
-  calloc:
-
-  ... Really obvious wrapper.  Uses memset to clear the memory.
-
-  TODO: Use futex, perhaps, instead of pthread stuff.
- */
-#include <stdint.h>
-#include <pthread.h>
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <string.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <malloc.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/wait.h>
-
-#ifndef DEBUG
-#define DEBUG			/* Record program counter of malloc/calloc */
-#endif				/* or realloc call; print misc stuff out */
-
-#if defined(__ia64__) || defined(__hppa__)
-#undef DEBUG
-#endif
-
-/* Tunable stuff XXX This should be external */
-#define PARANOID		/* Trade off a bit of space and speed for
-				   extra sanity checks */
-#define DIE_ON_FAULT		/* Kill program if we do something bad
-				   (double free, free after overrun, etc.
-				   for instance) */
-#undef  AGGR_RECLAIM		/* consolidate_all on free (*slow*) */
-
-//#undef  STACKSIZE	/*4	   backtrace to store if DEBUG is set */
-#define STACKSIZE 1		/* at least 1 gets you free addr */
-
-#undef	GDB_HOOK		/* Dump program addresses in malloc_table
-				   using a fork/exec of gdb (SLOW but fun)
-				   building this defeats the purpose of
-				   a bounded memory allocator, and is only
-				   useful for debugging memory leaks.
-				   This does not harm anything except code
-				   size until "malloc_dump_table" is called.
-				   Given that this is not a normal malloc
-				   API, this should not matter. */
-
-#define DEFAULT_SIZE	(1<<23) /* 8MB default giant block size */
-#define BUCKET_COUNT	(13)	/* 2^BUCKET_COUNT = max. interesting size */
-#define MIN_POWER	(3)	/* 2^MIN_POWER = minimum size */
-#define MIN_SIZE	(1<<MIN_POWER)
-#define ALIGN		(sizeof(void *))
-#define NOBUCKET	((uint16_t)(~0))
-#define MIN_EXTRA	(1<<5)	/* 64 bytes to split a block */
-
-/* Misc stuff */
-#define ST_FREE		0xfec3  /* Block is free */
-#define ST_ALLOC	0x08f7  /* Block is in use */
-
-
-#ifndef NOPTHREADS
-#include <pthread.h>
-static pthread_mutex_t _alloc_mutex = PTHREAD_MUTEX_INITIALIZER;
-#else
-#define pthread_mutex_trylock(x) (0)
-#define pthread_mutex_lock(x)
-#define pthread_mutex_unlock(x)
-#endif
-
-#ifdef DIE_ON_FAULT
-
-#include <signal.h>
-
-#define die_or_return(val)\
-do { \
-	raise(SIGSEGV); \
-	return val; \
-} while (0)
-
-#else
-
-#define die_or_return(val)\
-do { \
-	return val; \
-} while (0)
-
-#endif
-
-
-typedef struct _memblock {
-	/*
-	   Need to align for 64-bit arches, so for now, we'll keep
-	   the header size to 8 bytes.
-	 */
-	uint32_t	mb_size;
-	uint16_t	mb_bucket;
-	uint16_t	mb_state;
-#ifdef DEBUG
-#ifdef STACKSIZE
-	void		*mb_pc[STACKSIZE];
-#endif
-#endif
-	/* If PARANOID isn't defined, we use the following pointer for
-	   more space. */
-	struct _memblock *mb_next;
-} memblock_t;
-
-
-/**
-  mmap(2)ed memory pool.
- */
-static void *_pool = NULL;
-
-/**
-  Pool size
- */
-static size_t _poolsize = 0;
-
-/**
-  Free buckets
- */
-static memblock_t *free_buckets[BUCKET_COUNT];
-
-
-#ifdef PARANOID
-
-/**
-  Allocated buckets
- */
-static memblock_t *alloc_buckets[BUCKET_COUNT];
-
-/*
-   We use the next pointer for the alloc_bucket list if we're PARANOID, as
-   we record the allocated block list in that mode.
- */
-#define HDR_SIZE (sizeof(memblock_t))
-
-#else /* ... not PARANOID */
-
-/*
-   We use the next pointer for extra data space if we're secure.  Makes the
-   allocator slightly more memory efficient.
- */
-#define HDR_SIZE (sizeof(memblock_t) - sizeof(memblock_t *))
-
-#endif /* PARANOID */
-
-/* Return the user pointer for a given memblock_t structure. */
-#define pointer(block) (void *)((void *)block + HDR_SIZE)
-
-/* Return the memblock_t structure given a pointer */
-#define block(pointer) (memblock_t *)((void *)pointer - HDR_SIZE)
-
-/* Calculate and return the next memblock_t pointer in the memory pool
-   given a memblock_t pointer. */
-#define nextblock(pointer) \
-	(memblock_t *)((void *)pointer + pointer->mb_size + HDR_SIZE)
-
-/* Doesn't *ensure* a block is free, but is a pretty good heuristic */
-#define is_valid_free(block) \
-	(block->mb_bucket < BUCKET_COUNT && block->mb_state == ST_FREE)
-
-/* Doesn't *ensure* a block is allocated, but is a pretty good heuristic */
-#define is_valid_alloc(block) \
-	(block->mb_bucket == NOBUCKET && block->mb_state == ST_ALLOC && \
-	 block->mb_size != 0)
-
-
-/**
-  Find the proper bucket index, given a size
- */
-static inline int
-find_bucket(size_t size)
-{
-	int rv = 0;
-	size_t s = size;
-	
-	s >>= MIN_POWER;
-	while (s && (rv < (BUCKET_COUNT-1))) {
-		s >>= 1;
-		rv++;
-	}
-
-	return rv;
-}
-
-
-#ifdef PARANOID
-/**
-  Check for and remove a block from its free list.
- */
-static inline int
-remove_alloc_block(memblock_t *b)
-{
-	memblock_t *block, **prev;
-	uint16_t bucket;
-
-	/* Could improve performance if NOBUCKET wasn't used
-	   as an indicator of an allocated block */
-	bucket = find_bucket(b->mb_size);
-	prev = &(alloc_buckets[bucket]);
-
-	if (!(block = alloc_buckets[bucket]))
-		return 0;
-
-	do {
-		if (b == block) {
-			*prev = b->mb_next;
-			b->mb_next = NULL;
-			return 1;
-		}
-
-		prev = &(*prev)->mb_next;
-		block = block->mb_next;
-	} while (block);
-
-	/* Couldn't find in its appropriate bucket */
-	return 0;
-}
-#endif
-
-
-/**
-  Check for and remove a block from its free list.
- */
-static inline int
-remove_free_block(memblock_t *b)
-{
-	memblock_t *block, **prev;
-	uint16_t bucket;
-
-	bucket = b->mb_bucket;
-	prev = &(free_buckets[bucket]);
-
-	if (!(block = free_buckets[bucket]))
-		return 0;
-
-	do {
-		if (b == block) {
-			*prev = b->mb_next;
-			b->mb_next = NULL;
-			return 1;
-		}
-
-		prev = &(*prev)->mb_next;
-		block = block->mb_next;
-	} while (block);
-
-	/* Couldn't find in its appropriate bucket */
-	return 0;
-}
-
-
-#ifdef PARANOID
-/**
-  Insert a block on to the allocated bucket list
- */
-static inline memblock_t *
-insert_alloc_block(memblock_t *b)
-{
-	uint16_t bucket = find_bucket(b->mb_size);
-
-	b->mb_bucket = NOBUCKET;
-	b->mb_state = ST_ALLOC;
-	b->mb_next = NULL;
-
-	if (alloc_buckets[bucket] != NULL)
-		b->mb_next = alloc_buckets[bucket];
-
-	alloc_buckets[bucket] = b;
-
-	return b;
-}
-#endif
-
-
-/**
-  Insert a block on to the free bucket list
- */
-static inline memblock_t *
-insert_free_block(memblock_t *b)
-{
-	uint16_t bucket = find_bucket(b->mb_size);
-
-	b->mb_bucket = bucket;
-	b->mb_state = ST_FREE;
-	b->mb_next = NULL;
-
-	if (free_buckets[bucket] != NULL)
-		b->mb_next = free_buckets[bucket];
-
-	free_buckets[bucket] = b;
-
-	return b;
-}
-
-
-/**
-  Consolidate a block with all free blocks to the right of it in the
-  pool.
-
-  @param left		Left block
-  @return		Number of blocks consolidated.
- */
-static inline int
-consolidate(memblock_t *left)
-{
-	memblock_t *right;
-	int merged = 0;
-
-	while (1) {
-		right = nextblock(left);
-		if ((void *)right >= (_pool + _poolsize))
-			return merged;
-
-		if (!is_valid_free(right)) {
-			if (is_valid_alloc(right))
-				return merged;
-
-			/* Not valid free and not valid allocated. BAD. */
-			fprintf(stderr, "consolidate: Block %p corrupt. "
-				"(Overflow from block %p?)\n", right, left);
-			die_or_return(-1);
-		}
-		if (!remove_free_block(right))
-			return merged;
-
-		left->mb_size += (right->mb_size + HDR_SIZE);
-		right->mb_state = 0;
-
-		++merged;
-	}
-	/* Not reached */
-	return merged;
-}
-
-
-/**
-  Consolidate all free blocks next to each-other in the pool in to larger
-  blocks.  This algorithm is slow...
- */
-static inline void
-consolidate_all(void)
-{
-	memblock_t *b, *p;
-	int total = 0;
-
-	p = NULL;
-	b = _pool;
-
-	while ((void *)b < (void *)(_pool + _poolsize)) {
-
-		if (is_valid_free(b)) {
-			if (!remove_free_block(b)) {
-				fprintf(stderr, "consolidate: Free block %p "
-					"was not in our free list.\n", b);
-			}
-
-			total += consolidate(b);
-			insert_free_block(b);
-		} else if (!is_valid_alloc(b)) {
-			/* Not valid free and not valid allocated. BAD. */
-			fprintf(stderr, "consolidate_all: Block %p corrupt. "
-				"(Overflow from block %p?)\n", b, p);
-			die_or_return();
-		}
-
-		/* Consolidated or we're a valid allocated block */
-		p = b;
-		b = nextblock(b);
-	}
-
-#ifdef DEBUG
-	if (total)
-		fprintf(stderr, "%s: consolidated %d\n", __FUNCTION__, total);
-#endif
-	
-}
-
-
-#ifndef NOTHREADS
-/**
-  After a fork, we need to kill the mutex so the child can still call malloc
-  without getting stuck.
- */
-void
-malloc_zap_mutex(void)
-{
-	pthread_mutex_init(&_alloc_mutex, NULL);
-}
-#endif
-
-
-/**
-  Initialize the giant mmap pool storage.
- */
-#ifndef NOTHREADS
-static inline int
-_malloc_init(size_t poolsize)
-#else
-int
-malloc_init(size_t poolsize)
-#endif
-{
-	int e;
-	memblock_t *first = NULL;
-
-	if (_pool)
-		return -1;
-
-	if (poolsize % 32)
-		poolsize += (32 - (poolsize % 32));
-
-	_pool = mmap(NULL, poolsize, PROT_READ | PROT_WRITE, MAP_LOCKED |
-		     MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-
-	if ((_pool == MAP_FAILED) && (errno == EAGAIN)) {
-		/* Try again without MAP_LOCKED */
-		_pool = mmap(NULL, poolsize, PROT_READ | PROT_WRITE,
-			     MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-		if (_pool != MAP_FAILED)
-			fprintf(stderr, "malloc_init: Warning: using unlocked"
-				" memory pages (got root?)\n");
-	}
-
-	if (_pool == MAP_FAILED) {
-		return -1;
-	}
-
-	_poolsize = poolsize;
-
-	for (e = 0; e < BUCKET_COUNT; e++)
-		free_buckets[e] = NULL;
-
-	first = _pool;
-	first->mb_size = (_poolsize - HDR_SIZE);
-	first->mb_state = ST_FREE;
-	first->mb_next = NULL;
-	first->mb_bucket = NOBUCKET;
-
-#ifdef PARANOID
-	for (e = 0; e < BUCKET_COUNT; e++)
-		alloc_buckets[e] = NULL;
-#endif
-#if 0
-#ifdef DEBUG
-	fprintf(stderr, "malloc_init: %lu/%lu available\n",
-		(long unsigned)first->mb_size, (long unsigned)_poolsize);
-#endif
-#endif
-
-	insert_free_block(first);
-	return 0;
-}
-
-
-#ifndef NOTHREADS
-/* Same as above, but lock first! */
-int
-malloc_init(size_t poolsize)
-{
-	int e = 0, ret = -1;
-	pthread_mutex_lock(&_alloc_mutex);
-	if (!_pool) {
-		ret = _malloc_init(poolsize);
-		e = errno;
-	}
-	pthread_atfork(NULL, NULL, malloc_zap_mutex);
-	pthread_mutex_unlock(&_alloc_mutex);
-	errno = e;
-	return ret;
-}
-#endif
-
-
-static inline memblock_t *
-split(memblock_t *block, size_t size)
-{
-	memblock_t *nb;
-	size_t oldsz;
-
-	oldsz = block->mb_size;
-
-	/* Ok, we got it. */
-	block->mb_size = size;
-	block->mb_next = NULL;
-	block->mb_state = ST_ALLOC;
-	block->mb_bucket = NOBUCKET;
-
-	nb = nextblock(block);
-	nb->mb_state = ST_FREE;
-	nb->mb_bucket = NOBUCKET;
-	nb->mb_size = (size_t)(oldsz - (HDR_SIZE + size));
-	insert_free_block(nb);
-
-	/* Created a new next-block. */
-
-	return block;
-}
-
-
-/**
-  Search the freestore and return an available block which accomodates the
-  requested size, splitting up a free block if necessary.
- */
-static inline memblock_t *
-search_freestore(size_t size)
-{
-	uint16_t bucket;
-	memblock_t *block, **prev;
-
-	for (bucket = find_bucket(size); bucket < BUCKET_COUNT; bucket++) {
-		block = free_buckets[bucket];
-		if (!block)
-			continue;
-
-		prev = &(free_buckets[bucket]);
-
-		do {
-			/*
-		    	  Look for block with size within 25%
-			 */
-			if (block->mb_size >= size) {
-
-				/*
-				   Split if size >= size + MIN_EXTRA.
-
-				   25% of 1MB = 256kb -- which is way too much
-				   unused space to leave hanging around when
-				   we're tuned for small bits.
-				 */
-				if (block->mb_size >= (size + MIN_EXTRA)) {
-					*prev = block->mb_next;
-					block->mb_state = ST_ALLOC;
-					block->mb_bucket = NOBUCKET;
-					return split(block, size);
-				}
-
-				/*
-				   Otherwise, return if the size matches
-				   within 25%
-
-				   So, the max unused bytes from a malloc
-				   operation for a given size is 56 (since
-				   64 == MIN_EXTRA).  So the following is 
-				   very inefficient:
-
-				      p = malloc(280);
-				      free(p);
-				      p = malloc(224);
-				 */
-			    	if (block->mb_size < (size + size / 4)) {
-					*prev = block->mb_next;
-					block->mb_state = ST_ALLOC;
-					block->mb_bucket = NOBUCKET;
-					return block; 
-				}
-			}
-
-			prev = &(*prev)->mb_next;
-			block = block->mb_next;
-		} while (block);
-	}
-
-	/* Ok, nothing big enough in the free store */
-	return NULL;
-}
-
-
-#ifdef DEBUG
-
-#define stack_pointer(n) \
-	(__builtin_frame_address(n)?__builtin_return_address(n):NULL)
-
-#define assign_address(_ptr, _cnt) \
-{ \
-	switch(_cnt) { \
-	case 0: \
-		(_ptr)[_cnt] = stack_pointer(0); \
-		break; \
-	case 1: \
-		(_ptr)[_cnt] = stack_pointer(1); \
-		break; \
-	case 2: \
-		(_ptr)[_cnt] = stack_pointer(2); \
-		break; \
-	case 3: \
-		(_ptr)[_cnt] = stack_pointer(3); \
-		break; \
-	case 4: \
-		(_ptr)[_cnt] = stack_pointer(4); \
-		break; \
-	case 5: \
-		(_ptr)[_cnt] = stack_pointer(5); \
-		break; \
-	case 6: \
-		(_ptr)[_cnt] = stack_pointer(6); \
-		break; \
-	case 7: \
-		(_ptr)[_cnt] = stack_pointer(7); \
-		break; \
-	case 8: \
-		raise(SIGKILL); \
-		break; \
-	}\
-}
-#endif
-
-
-
-
-/**
-  Memory allocation
- */
-void *
-malloc(size_t size)
-{
-#ifndef NOROUND
-	size_t r;
-#endif
-	memblock_t *block;
-#ifdef DEBUG
-#ifdef STACKSIZE
-	int sp;
-#endif
-#endif
-
-	if (size < MIN_SIZE)
-		size = MIN_SIZE;
-#ifndef NOROUND
-	else {
-		r = size % MIN_SIZE;
-		size += (r ? (MIN_SIZE - r) : 0);
-	}
-#endif /* NOROUND */
-
-#ifndef NOTHREADS
-	while (pthread_mutex_trylock(&_alloc_mutex) != 0);
-#endif
-	if (!_pool) {
-#if 0
-#ifdef DEBUG
-		fprintf(stderr,
-			"malloc: Initializing region default size %lu\n",
-			(long unsigned)DEFAULT_SIZE);
-#endif
-#endif
-#ifndef NOTHREADS
-		if (_malloc_init(DEFAULT_SIZE) < 0)
-#else
-		if (malloc_init(DEFAULT_SIZE) < 0)
-#endif
-			return NULL;
-	}
-
-	block = search_freestore(size);
-	if (block) {
-#ifdef DEBUG
-#ifdef STACKSIZE
-		for (sp = 0; sp < STACKSIZE; sp++) {
-			assign_address(block->mb_pc, sp);
-			if (!block->mb_pc[sp])
-				break;
-		}
-#endif
-#endif
-#ifdef PARANOID
-		insert_alloc_block(block);
-#endif
-#ifndef NOTHREADS
-		pthread_mutex_unlock(&_alloc_mutex);
-#endif
-		return pointer(block);
-	}
-
-#ifdef AGGR_RECLAIM
-	consolidate_all();
-	block = search_freestore(size);
-	if (block) {
-#ifdef DEBUG
-#ifdef STACKSIZE
-		for (sp = 0; sp < STACKSIZE; sp++) {
-			assign_address(block->mb_pc, sp);
-			if (!block->mb_pc[sp])
-				break;
-		}
-#endif
-#endif
-#ifdef PARANOID
-		insert_alloc_block(block);
-#endif
-		pthread_mutex_unlock(&_alloc_mutex);
-		return pointer(block);
-	}
-#endif /* AGGR_RECLAIM */
-
-#ifdef DEBUG
-	fprintf(stderr, "Out of memory malloc(%lu) @ %p\n",
-		(long unsigned)size, __builtin_return_address(0));
-#endif
-	errno = ENOMEM;
-	return NULL;
-}
-
-
-/**
-  Memory free
- */
-void
-free(void *p)
-{
-	memblock_t *b;
-#ifdef DEBUG
-#ifdef STACKSIZE
-	void *pc = __builtin_return_address(0);
-	int x;
-#endif
-#endif
-
-	if (!p) {
-#if 0
-		fprintf(stderr, "free(NULL) @ %p\n",
-		       	__builtin_return_address(0));
-#endif
-		/* POSIX allows for free(NULL) */
-		return;
-	}
-
-	b = ((void *)p - HDR_SIZE);
-
-	pthread_mutex_lock(&_alloc_mutex);
-	if (((void *)b < _pool) || ((void *)b >= (_pool + _poolsize))) {
-		fprintf(stderr, "free(%p) @ %p - Out of bounds\n",
-			p, __builtin_return_address(0));
-		pthread_mutex_unlock(&_alloc_mutex);
-		die_or_return();
-	}
-
-	if (!is_valid_alloc(b)) {
-#ifdef DEBUG
-		if (!is_valid_free(b))
-			fprintf(stderr,
-				"free(%p) @ %p - Invalid address\n",
-				p, __builtin_return_address(0));
-		else
-#ifdef STACKSIZE
-			fprintf(stderr,
-				"free(%p) @ %p - Already free @ %p\n",
-				p, __builtin_return_address(0), b->mb_pc[0]);
-#else
-			fprintf(stderr,
-				"free(%p) @ %p - Already free\n",
-				p, __builtin_return_address(0));
-#endif
-
-#endif
-		pthread_mutex_unlock(&_alloc_mutex);
-		die_or_return();
-	}
-
-#ifdef PARANOID
-	/* Remove from the allocated list if we're tracking it. */
-	if (!remove_alloc_block(b)) {
-		fprintf(stderr, "free(%p) @ %p - Not allocated\n",
-			p, __builtin_return_address(0));
-		pthread_mutex_unlock(&_alloc_mutex);
-		die_or_return();
-	}
-#endif
-
-#ifdef DEBUG
-#ifdef STACKSIZE
-	for (x = 0; x < STACKSIZE; x++)
-		b->mb_pc[x] = NULL;
-	b->mb_pc[0] = pc;
-#endif
-#endif
-
-	b->mb_state = ST_FREE;
-	b->mb_next = NULL;
-
-#ifdef AGGR_RECLAIM
-	/* Aggressively search the whole pool and combine all side-by-side
-	   free blocks */
-	insert_free_block(b);
-	consolidate_all();
-#else
-	/* Combine with all blocks to the right in the pool */
-	b->mb_bucket = find_bucket(b->mb_size);
-	consolidate(b);
-	insert_free_block(b);
-#endif
-	pthread_mutex_unlock(&_alloc_mutex);
-}
-
-
-/**
-   Slow realloc.  It *should* resize the memory, but since we're dealing
-   with a static heap, it doesn't.
- */
-void *
-realloc(void *oldp, size_t newsize)
-{
-	memblock_t *oldb;
-#ifdef DEBUG
-	memblock_t *newb;
-#ifdef STACKSIZE
-	int sp;
-#endif
-#endif
-	void *newp;
-
-	if (oldp) {
-		oldb = block(oldp);
-		if (newsize <= oldb->mb_size)
-			return oldp;
-	}
-
-	newp = malloc(newsize);
-
-	if (!newp) {
-		return NULL;
-	}
-
-	if (oldp) {
-		oldb = block(oldp);
-		memcpy(newp, oldp, (newsize > oldb->mb_size) ?
-		       oldb->mb_size : newsize);
-		free(oldp);
-	}
-#ifdef DEBUG
-	newb = block(newp);
-#ifdef STACKSIZE
-	for (sp = 0; sp < STACKSIZE; sp++) {
-		assign_address(newb->mb_pc, sp);
-		if (!newb->mb_pc[sp])
-			break;
-	}
-#endif
-#endif
-	return newp;
-}
-
-
-/**
-   simple calloc.
- */
-void *
-calloc(size_t sz, size_t nmemb)
-{
-	void *p;
-#ifdef DEBUG
-	memblock_t *newb;
-#ifdef STACKSIZE
-	int sp;
-#endif
-#endif
-
-	sz *= nmemb;
-	p = malloc(sz);
-	if (!p)
-		return NULL;
-
-#ifdef DEBUG
-	newb = block(p);
-#ifdef STACKSIZE
-	for (sp = 0; sp < STACKSIZE; sp++) {
-		assign_address(newb->mb_pc, sp);
-		if (!newb->mb_pc[sp])
-			break;
-	}
-#endif
-#endif
-	memset(p, 0, sz);
-	return p;
-}
-
-
-void resolve_stack_gdb(void **, size_t);
-
-
-/**
-  Dump the allocated memory table.  Only does anything useful if PARANOID
-  is set.
- */
-void
-malloc_dump_table(size_t minsize, size_t maxsize)
-{
-#ifdef PARANOID
-	int any = 0;
-	int x;
-#ifdef DEBUG
-#ifdef STACKSIZE
-#ifndef GDB_HOOK
-	int sp;
-#endif
-#endif
-#endif
-	memblock_t *b;
-
-	fflush(stdout);
-	pthread_mutex_lock(&_alloc_mutex);
-	for (x=0; x<BUCKET_COUNT; x++) {
-		for (b = alloc_buckets[x]; b; b = b->mb_next) {
-
-			if (b->mb_size < minsize || b->mb_size > maxsize)
-				continue;
-
-			if (!any)
-				fprintf(stderr,
-					"+++ Memory table dump +++\n");
-			any++;
-#ifndef DEBUG
-			fprintf(stderr, "  %p (%lu bytes)\n", pointer(b),
-				(unsigned long)b->mb_size);
-#else /* DEBUG */
-			fprintf(stderr,
-				"  %p (%lu bytes) allocation trace:\n",
-				pointer(b), (unsigned long)b->mb_size);
-#ifdef STACKSIZE
-#ifdef GDB_HOOK
-			resolve_stack_gdb(b->mb_pc, STACKSIZE);
-			fprintf(stderr,"\n");
-#else
-			for (sp = 0; sp < STACKSIZE; sp++)
-				fprintf(stderr,"\t%p\n",b->mb_pc[sp]);
-#endif
-#endif /* STACKSIZE */
-#endif /* DEBUG */
-		}
-	}
-	pthread_mutex_unlock(&_alloc_mutex);
-	if (any)
-		fprintf(stderr, "--- End Memory table dump ---\n");
-
-#else /* PARANOID */
-	fprintf(stderr, "malloc_dump_table: Unimplemented\n");
-#endif /* PARANOID */
-}
-
-
-/**
-  Print general stats about how we're doing with memory.
- */
-void
-malloc_stats(void)
-{
-	int fb = 0, ub = 0, x;
-	size_t metadata = 0, ucount = 0, fcount = 0, ps = 0;
-	memblock_t *b;
-	void *p;
-
-	pthread_mutex_lock(&_alloc_mutex);
-	if (!_pool) {
-		pthread_mutex_unlock(&_alloc_mutex);
-		fprintf(stderr,"malloc_stats: No information\n");
-		return;
-	}
-
-
-	for (x=0; x<BUCKET_COUNT; x++) {
-		for (b = free_buckets[x]; b; b = b->mb_next) {
-			metadata += HDR_SIZE;
-			fcount += b->mb_size;
-			++fb;
-		}
-	}
-
-#ifdef PARANOID
-	for (x=0; x<BUCKET_COUNT; x++) {
-		for (b = alloc_buckets[x]; b; b = b->mb_next) {
-			metadata += HDR_SIZE;
-			ucount += b->mb_size;
-			++ub;
-		}
-	}
-#else
-	/* Estimate only... :( */
-	ucount = fcount - metadata;
-	ub = 0;
-#endif
-	p = _pool;
-	ps = _poolsize;
-
-	pthread_mutex_unlock(&_alloc_mutex);
-
-	fprintf(stderr, "malloc_stats:\n");
-	fprintf(stderr, "  Total: %lu bytes\n", (unsigned long)ps);
-	fprintf(stderr, "  Base address: %p\n", p);
-	fprintf(stderr, "  Free: %lu bytes in %d blocks\n",
-		(unsigned long)fcount, fb);
-#ifdef PARANOID
-	fprintf(stderr, "  Used: %lu bytes in %d blocks\n",
-		(unsigned long)ucount, ub);
-	fprintf(stderr, "  Metadata Usage: %lu bytes\n",
-		(unsigned long)metadata);
-#else
-	fprintf(stderr,
-		"  Used: %lu bytes (debugging off, block count unknown)\n",
-		(unsigned long)ucount);
-	fprintf(stderr,
-		"  Metadata Usage: %lu bytes (debugging off, estimate)\n",
-		(unsigned long)metadata);
-#endif
-}
-
-
-#ifdef DEBUG
-#ifdef STACKSIZE
-#ifdef GDB_HOOK
-void
-show_gdb_address(char *buf, size_t buflen, void *address)
-{
-	char *line;
-	char *end = buf + buflen;
-	char foo[32];
-
-	snprintf(foo, sizeof(foo), "%p", address);
-
-	line = buf;
-	while ((line = strchr(line, '\n'))) {
-
-		if ((line + strlen(foo) + 1) > end)
-			return;
-		++line;
-
-		if (!strncmp(line, foo, strlen(foo))) {
-			end = strchr(line, ':');
-			if (end)
-				*end = 0;
-			fprintf(stderr,"\t%s\n", line);
-			if (end)
-				*end = ':';
-			return;
-		}
-	}
-}
-
-
-int
-my_system(char *foo, char *outbuf, size_t buflen)
-{
-	char cmd[4096];
-	char *args[128];
-	int x = 0, y;
-	int pid, arg;
-	int p[2];
-
-	strncpy(cmd, foo, sizeof(cmd));
-	foo = NULL;
-	do {
-		if (!x)
-			args[x] = strtok_r(cmd, " ", &foo);
-		else
-			args[x] = strtok_r(NULL, " ", &foo);
-
-	} while (args[x++]);
-
-	pipe(p);
-	pid = fork();
-	if (!pid) {
-		close(STDOUT_FILENO);
-		dup2(p[1], STDOUT_FILENO);
-		execv(args[0], args);
-		exit(1);
-	}
-
-	close(p[1]);
-
-	y = 0;
-	arg = WNOHANG;
-	memset(outbuf, 0, buflen);
-	while (waitpid(pid, NULL, arg) != pid) {
-
-		/* Interrupt after we decided to block for child */
-		if (!arg)
-			continue;
-
-		if (y >= buflen) {
-			/* Out of space.  Wait for child without
-			   the WNOHANG flag now... */
-			arg = 0;
-			continue;
-		}
-		x = read(p[0], outbuf + y, 1);
-		++y;
-	}
-		
-	return 0;
-}
-	
-
-/*
-   Yes, it's slow.  Painfully slow.
- */
-void
-resolve_stack_gdb(void **stack, size_t stacksize)
-{
-	int pid, fd;
-	char fname[1024];
-	char programname[1024];
-	char commandline[4096];
-	char tmp[4096];
-	int s;
-
-	pid = fork();
-	if (pid < 0) {
-		return;
-	}
-
-	if (pid) {
-		while (waitpid(pid, &s, 0) != pid);
-		return;
-	}
-
-	/* Child */
-
-	pid = getppid();
-
-	snprintf(fname, sizeof(fname), "/proc/%d/exe", pid);
-	memset(programname, 0, sizeof(programname));
-	readlink(fname, programname, sizeof(programname));
-
-	snprintf(fname, sizeof(fname), "/tmp/alloc.gdb.XXXXXX");
-
-	fd = mkstemp(fname);
-	for (s = 0; s < stacksize; s++) {
-		if (!stack[s])
-			break;
-		snprintf(tmp, sizeof(tmp), "x/i %p\n", stack[s]);
-		write(fd, tmp, strlen(tmp));
-	}
-	snprintf(tmp, sizeof(tmp), "quit\n");
-	write(fd, tmp, strlen(tmp));
-	fsync(fd);
-	fdatasync(fd);
-
-	snprintf(commandline, sizeof(commandline),
-		 "/usr/bin/gdb %s %d -batch -x %s",
-		 programname, pid, fname);
-	my_system(commandline, tmp, sizeof(tmp));
-	for (s = 0; s < stacksize; s++) {
-		if (!stack[s])
-			break;
-		show_gdb_address(tmp, sizeof(tmp), stack[s]);
-	}
-	
-	unlink(fname);
-	close(fd);
-	exit(0);
-}
-#endif
-#endif
-#endif
-
diff --git a/rgmanager/src/clulib/ckpt_state.c b/rgmanager/src/clulib/ckpt_state.c
deleted file mode 100644
index fd85aee..0000000
--- a/rgmanager/src/clulib/ckpt_state.c
+++ /dev/null
@@ -1,535 +0,0 @@
-//#define DEBUG
-/** @file
- * Distributed states using saCkpt interface
- */
-#include <string.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/resource.h>
-#include <sys/wait.h>
-#include <stdlib.h>
-#include <sys/time.h>
-#include <pthread.h>
-#include <saAis.h>
-#include <saCkpt.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <assert.h>
-#include <ds.h>
-
-typedef struct _key_node {
-	struct _key_node *kn_next;
-	char *kn_keyid;
-	SaTimeT kn_timeout;
-	uint16_t kn_ready; 
-	SaNameT kn_cpname;
-	SaCkptCheckpointHandleT kn_cph;
-} key_node_t;
-
-
-static key_node_t *key_list = NULL;
-static SaCkptHandleT ds_ckpt;
-static int ds_ready = 0;
-static pthread_mutex_t ds_mutex = PTHREAD_MUTEX_INITIALIZER;
-
-
-int ais_to_posix(SaAisErrorT err);
-
-
-static key_node_t *
-kn_find_key(char *keyid)
-{
-	key_node_t *cur;
-
-	for (cur = key_list; cur; cur = cur->kn_next)
-		if (!strcmp(cur->kn_keyid,keyid))
-			return cur;
-
-	return NULL;
-}
-
-
-/**
- * Adds a key to key node list and sets up callback functions.
- */
-static SaAisErrorT
-ds_key_init_nt(char *keyid, int maxsize, int timeout)
-{
-	SaCkptCheckpointCreationAttributesT attrs;
-	SaCkptCheckpointOpenFlagsT flags;
-#if 0
-	SaCkptCheckpointDescriptorT status;
-#endif
-	SaAisErrorT err = SA_AIS_OK;
-	key_node_t *newnode = NULL;
-	
-	newnode = kn_find_key(keyid);
-	if (newnode) {
-		printf("Key %s already initialized\n", keyid);
-		return SA_AIS_OK;
-	}
-
-	newnode = malloc(sizeof(*newnode));
-	memset(newnode,0,sizeof(*newnode));
-	snprintf((char *)newnode->kn_cpname.value, SA_MAX_NAME_LENGTH-1,
-		 "%s", keyid);
-	newnode->kn_cpname.length = strlen(keyid);
-	newnode->kn_keyid = (char *)newnode->kn_cpname.value;
-	newnode->kn_ready = 0;
-
-	if (timeout < 5) {
-		/* Join View message timeout must exceed the
-		   coordinator timeout */
-		timeout = 5;
-	}
-	newnode->kn_timeout = timeout * SA_TIME_ONE_SECOND;
-
-	flags = SA_CKPT_CHECKPOINT_READ |
-		SA_CKPT_CHECKPOINT_WRITE;
-
-	err = saCkptCheckpointOpen(ds_ckpt,
-				   &newnode->kn_cpname,
-				   NULL,	
-				   flags,
-				   newnode->kn_timeout,
-				   &newnode->kn_cph);
-
-	if (err == SA_AIS_OK) {
-#if 0
-		saCkptCheckpointStatusGet(newnode->kn_cph,
-					  &status);
-
-		printf("Checkpoint Size = %d bytes\n", (int)
-			status.checkpointCreationAttributes.checkpointSize);
-		printf("Flags = ");
-		if (status.checkpointCreationAttributes.creationFlags &
-			SA_CKPT_WR_ALL_REPLICAS) {
-			printf("%s ", "SA_CKPT_WR_ALL_REPLICAS");
-		}
-		if (status.checkpointCreationAttributes.creationFlags &
-			SA_CKPT_WR_ACTIVE_REPLICA) {
-			printf("%s ", "SA_CKPT_WR_ACTIVE_REPLICA");
-		}
-		if (status.checkpointCreationAttributes.creationFlags &
-			SA_CKPT_WR_ACTIVE_REPLICA_WEAK) {
-			printf("%s ", "SA_CKPT_WR_ACTIVE_REPLICA_WEAK");
-		}
-		if (status.checkpointCreationAttributes.creationFlags &
-			SA_CKPT_CHECKPOINT_COLLOCATED) {
-			printf("%s ", "SA_CKPT_CHECKPOINT_COLLOCATED");
-		}
-		printf("\nMax sections = %d\n",
-			(int)status.checkpointCreationAttributes.maxSections);
-		printf("Max section size = %d\n",
-			(int)status.checkpointCreationAttributes.maxSectionSize);
-		printf("Max section ID size = %d\n",
-			(int)status.checkpointCreationAttributes.maxSectionIdSize);
-		printf("Section count = %d\n", status.numberOfSections);
-		printf("\n");
-#endif
-		goto good;
-	}
-
-	attrs.creationFlags = SA_CKPT_WR_ALL_REPLICAS;
-	attrs.checkpointSize = (SaSizeT)maxsize;
-	attrs.retentionDuration = SA_TIME_ONE_HOUR;
-	attrs.maxSections = 1;
-	attrs.maxSectionSize = (SaSizeT)maxsize;
-	attrs.maxSectionIdSize = (SaSizeT)32;
-
-	flags = SA_CKPT_CHECKPOINT_READ |
-		SA_CKPT_CHECKPOINT_WRITE |
-		SA_CKPT_CHECKPOINT_CREATE;
-
-	err = saCkptCheckpointOpen(ds_ckpt,
-				   &newnode->kn_cpname,
-				   &attrs,
-				   flags,
-				   newnode->kn_timeout,
-				   &newnode->kn_cph);
-	if (err == SA_AIS_OK)
-		goto good;
-
-	/* No checkpoint */
-	free(newnode);
-	return err;
-good:
-
-	newnode->kn_ready = 1;
-	newnode->kn_next = key_list;
-	key_list = newnode;
-#if 0
-	printf("Opened ckpt %s\n", keyid);
-#endif
-
-	return err;
-}
-
-
-int
-ds_key_init(char *keyid, int maxsize, int timeout)
-{
-	SaAisErrorT err;
-
-	pthread_mutex_lock(&ds_mutex);
-	err = ds_key_init_nt(keyid, maxsize, timeout);
-	pthread_mutex_unlock(&ds_mutex);
-
-	errno = ais_to_posix(err);
-	if (errno)
-		return -1;
-	return 0;
-}
-
-
-static SaAisErrorT
-ds_key_cleanup(key_node_t *node)
-{
-	if (!node || !node->kn_ready) {
-		printf("Key %s already freed\n", node->kn_keyid);
-		return SA_AIS_OK;
-	}
-
-	return saCkptCheckpointClose(node->kn_cph);
-}
-
-
-
-static SaAisErrorT
-ds_key_finish_nt(char *keyid)
-{
-	key_node_t *node;
-
-	node = kn_find_key(keyid);
-	/* TODO: Free list entry */
-
-	return ds_key_cleanup(node);
-}
-
-
-int
-ds_key_finish(char *keyid)
-{
-	SaAisErrorT err;
-
-	pthread_mutex_lock(&ds_mutex);
-	err = ds_key_finish_nt(keyid);
-	pthread_mutex_unlock(&ds_mutex);
-
-	errno = ais_to_posix(err);
-	if (errno)
-		return -1;
-	return 0;
-}
-
-
-
-static void
-open_callback(SaInvocationT invocation,
-	      SaCkptCheckpointHandleT handle,
-	      SaAisErrorT error)
-{
-	/* Do Open callback here.  Since we use sync calls instead
-	   of async calls, this is never used. */
-}
-
-
-static void
-sync_callback(SaInvocationT invocation,
-	      SaAisErrorT error)
-{
-	/* Do Sync callback here.  Since we use sync calls instead
-	   of async calls, this is never used. */
-}
-
-
-int
-ais_to_posix(SaAisErrorT err)
-{
-	switch (err) {
-	case SA_AIS_OK:
-		return 0;
-	case SA_AIS_ERR_LIBRARY:
-		return ELIBBAD;
-	case SA_AIS_ERR_VERSION:
-		return EPROTONOSUPPORT; //XXX
-	case SA_AIS_ERR_INIT:
-		return EFAULT; //XXX
-	case SA_AIS_ERR_TIMEOUT:
-		return ETIMEDOUT;
-	case SA_AIS_ERR_TRY_AGAIN:
-		return EAGAIN;
-	case SA_AIS_ERR_INVALID_PARAM:
-		return EINVAL;
-	case SA_AIS_ERR_NO_MEMORY:
-		return ENOMEM;
-	case SA_AIS_ERR_BAD_HANDLE:
-		return EBADF;
-	case SA_AIS_ERR_BUSY:
-		return EBUSY;
-	case SA_AIS_ERR_ACCESS:
-		return EACCES;
-	case SA_AIS_ERR_NOT_EXIST:
-		return ENOENT;
-	case SA_AIS_ERR_NAME_TOO_LONG:
-		return ENAMETOOLONG;
-	case SA_AIS_ERR_EXIST:
-		return EEXIST;
-	case SA_AIS_ERR_NO_SPACE:
-		return ENOSPC;
-	case SA_AIS_ERR_INTERRUPT:
-		return EINTR;
-	case SA_AIS_ERR_NAME_NOT_FOUND:
-		return ENOENT;
-	case SA_AIS_ERR_NO_RESOURCES:
-		return ENOMEM; //XXX
-	case SA_AIS_ERR_NOT_SUPPORTED:
-		return ENOSYS;
-	case SA_AIS_ERR_BAD_OPERATION:
-		return EINVAL; //XXX
-	case SA_AIS_ERR_FAILED_OPERATION:
-		return EIO; //XXX
-	case SA_AIS_ERR_MESSAGE_ERROR:
-		return EIO; // XXX
-	case SA_AIS_ERR_QUEUE_FULL:
-		return ENOBUFS;
-	case SA_AIS_ERR_QUEUE_NOT_AVAILABLE:
-		return ENOENT;
-	case SA_AIS_ERR_BAD_FLAGS:
-		return EINVAL;
-	case SA_AIS_ERR_TOO_BIG:
-		return E2BIG;
-	case SA_AIS_ERR_NO_SECTIONS:
-		return ENOENT; // XXX
-	}
-
-	return -1;
-}
-
-
-int
-ds_init(void)
-{
-	int ret = 0;
-	SaAisErrorT err;
-	SaVersionT ver;
-	SaCkptCallbacksT callbacks;
-
-	pthread_mutex_lock(&ds_mutex);
-	if (ds_ready) {
-		pthread_mutex_unlock(&ds_mutex);
-		return 0;
-	}
-
-	ver.releaseCode = 'B';
-	ver.majorVersion = 1;
-	ver.minorVersion = 1;
-
-	callbacks.saCkptCheckpointOpenCallback = open_callback;
-	callbacks.saCkptCheckpointSynchronizeCallback = sync_callback;
-
-	err = saCkptInitialize(&ds_ckpt, &callbacks, &ver);
-
-	if (err != SA_AIS_OK)
-		ret = -1;
-	else
-		ds_ready= 1;
-
-	pthread_mutex_unlock(&ds_mutex);
-
-	if (ret != 0)
-		errno = ais_to_posix(err);
-	return ret;
-}
-
-
-int
-ds_write(char *keyid, void *buf, size_t maxlen)
-{
-	key_node_t *node;
-	SaCkptIOVectorElementT iov = {SA_CKPT_DEFAULT_SECTION_ID,
-				      NULL, 0, 0, 0};
-	SaAisErrorT err;
-
-	//printf("writing to ckpt %s\n", keyid);
-
-	pthread_mutex_lock(&ds_mutex);
-
-	while ((node = kn_find_key(keyid)) == NULL) {
-
-		err = ds_key_init_nt(keyid,
-				(maxlen>DS_MIN_SIZE?maxlen:DS_MIN_SIZE), 5);
-		if (err != SA_AIS_OK)
-			goto out;
-	}
-
-	iov.dataBuffer = buf;
-	iov.dataSize = (SaSizeT)maxlen;
-	iov.dataOffset = 0;
-	iov.readSize = 0;
-
-	err = saCkptCheckpointWrite(node->kn_cph, &iov, 1, NULL);
-
-	if (err == SA_AIS_OK)
-		saCkptCheckpointSynchronize(node->kn_cph, node->kn_timeout);
-
-out:
-	pthread_mutex_unlock(&ds_mutex);
-	
-	errno = ais_to_posix(err);
-	if (errno)
-		return -1;
-	return maxlen; /* XXX */
-}
-
-
-int
-ds_read(char *keyid, void *buf, size_t maxlen)
-{
-	key_node_t *node;
-	SaCkptIOVectorElementT iov = {SA_CKPT_DEFAULT_SECTION_ID,
-				      NULL, 0, 0, 0};
-	SaAisErrorT err;
-
-	//printf("reading ckpt %s\n", keyid);
-
-	pthread_mutex_lock(&ds_mutex);
-
-	node = kn_find_key(keyid);
-	if (!node) {
-		pthread_mutex_unlock(&ds_mutex);
-		errno = ENOENT;
-		return -1;
-	}
-
-	iov.dataBuffer = buf;
-	iov.dataSize = (SaSizeT)maxlen;
-	iov.dataOffset = 0;
-	iov.readSize = 0;
-
-	err = saCkptCheckpointRead(node->kn_cph, &iov, 1, NULL);
-
-	pthread_mutex_unlock(&ds_mutex);
-	
-	errno = ais_to_posix(err);
-	if (errno)
-		return -1;
-	return iov.readSize; /* XXX */
-}
-
-
-int
-ds_finish(void)
-{
-	int ret = 0;
-	SaAisErrorT err;
-	key_node_t *node;
-
-	pthread_mutex_lock(&ds_mutex);
-	if (!ds_ready) {
-		pthread_mutex_unlock(&ds_mutex);
-		return 0;
-	}
-
-	/* Zap all the checkpoints */
-	for (node = key_list; node; node = node->kn_next) {
-		ds_key_cleanup(node);
-	}
-
-	err = saCkptFinalize(ds_ckpt);
-
-	if (err != SA_AIS_OK)
-		ret = -1;
-	else
-		ds_ready = 0;
-
-	pthread_mutex_unlock(&ds_mutex);
-
-	if (ret != 0)
-		errno = ais_to_posix(err);
-	return ret;
-}
-
-
-#ifdef STANDALONE
-void
-usage(int ret)
-{
-	printf("usage: ckpt <-r key|-w key -d data>\n");
-	exit(ret);
-}
-
-int
-main(int argc, char **argv)
-{
-	char *keyid = "testing";
-	char *val;
-	char buf[DS_MIN_SIZE];
-	int ret;
-	int op = 0;
-
-	while((ret = getopt(argc, argv, "w:r:d:j?")) != EOF) {
-		switch(ret) {
-		case 'w': 
-			op = 'w';
-			keyid = optarg;
-			break;
-		case 'r':
-			op = 'r';
-			keyid = optarg;
-			break;
-		case 'd':
-			val = optarg;
-			break;
-		case '?':
-		case 'h':
-			usage(0);
-		default:
-			usage(1);
-		}
-	}
-
-	if (!op) {
-		usage(1);
-	}
-
-	if (!keyid) {
-		usage(1);
-	}
-
-	if (ds_init() < 0) {
-		perror("ds_init");
-		return 1;
-	}
-
-	if (ds_key_init(keyid, DS_MIN_SIZE, 5) < 0) {
-		perror("ds_key_init");
-		return 1;
-	}
-
-	if (op == 'w') {
-		if (ds_write(keyid, val, strlen(val)+1) < 0) {
-			perror("ds_write");
-			return 1;
-		}
-	} else if (op == 'r') {
-		ret = ds_read(keyid, buf, sizeof(buf));
-		if (ret < 0) {
-			perror("ds_write");
-			return 1;
-		}
-
-		printf("%d bytes\nDATA for '%s':\n%s\n", ret, keyid,
-		       buf);
-	}
-
-	ds_key_finish(keyid);
-
-	if (ds_finish() < 0) {
-		perror("ds_finish");
-		return 0;
-	}
-
-	return 0;
-}
-#endif
diff --git a/rgmanager/src/clulib/cman.c b/rgmanager/src/clulib/cman.c
deleted file mode 100644
index 1d15d3e..0000000
--- a/rgmanager/src/clulib/cman.c
+++ /dev/null
@@ -1,248 +0,0 @@
-/**
-  pthread mutex wrapper for a global CMAN handle
- */
-#include <stdio.h>
-#include <pthread.h>
-#include <libcman.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <signal.h>
-#include <sys/socket.h>
-#include <fcntl.h>
-
-static cman_handle_t _chandle = NULL;
-static pthread_mutex_t _chandle_lock = PTHREAD_MUTEX_INITIALIZER;
-static pthread_cond_t _chandle_cond = PTHREAD_COND_INITIALIZER;
-static pthread_t _chandle_holder = 0;
-static int _chandle_preempt = 0;
-static int _wakeup_pipe[2] = { -1, -1 };
-
-static void
-_set_nonblock(int fd)
-{
-	int flags;
-
-	flags = fcntl(fd, F_GETFL, 0);
-	if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0)
-		perror("fcntl");
-}
-
-
-/**
-  Lock / return the global CMAN handle.
-
-  @param block		If nonzero, we wait until the handle is released
-  @param preempt	If nonzero, *try* to wake up the holder who has
-			taken the lock with cman_lock_preemptible.  Will not
-			wake up holders which took it with cman_lock().
-  @return		NULL / errno on failure; the global CMAN handle
-			on success.
- */
-cman_handle_t 
-cman_lock(int block, int preempt)
-{
-	int err;
-	pthread_t tid;
-	cman_handle_t *ret = NULL;
-
-	pthread_mutex_lock(&_chandle_lock);
-	if (_chandle == NULL) {
-		errno = ENOSYS;
-		goto out_unlock;
-	}
-
-	tid = pthread_self();
-	if (_chandle_holder == tid) {
-		errno = EDEADLK;
-		goto out_unlock;
-	}
-
-	if (_chandle_holder > 0) {
-		if (!block) {
-			errno = EAGAIN;
-			goto out_unlock;
-		}
-
-		/* Try to wake up the holder! */
-		if (preempt)
-			err = write(_wakeup_pipe[1], "!", 1); /** XXX we don't care about errors here **/
-
-		/* Blocking call; do the cond-thing */
-		pthread_cond_wait(&_chandle_cond, &_chandle_lock);
-	}
-		
-	_chandle_holder = tid;
-	ret = _chandle;
-out_unlock:
-	pthread_mutex_unlock(&_chandle_lock);
-	return ret;
-}
-
-
-/**
-  Lock / return the global CMAN handle.
-
-  @param block		If nonzero, we wait until the handle is released
-  @param preempt_fd	Caller should include this file descriptor in
-			blocking calls to select(2), so that we can wake
-			it up if someone calls with cman_lock(xxx, 1);
-  @return		NULL / errno on failure; the global CMAN handle
-			on success.
- */
-cman_handle_t
-cman_lock_preemptible(int block, int *preempt_fd)
-{
-	pthread_t tid;
-	cman_handle_t *ret = NULL;
-
-	if (preempt_fd == NULL) {
-		errno = EINVAL;
-		return NULL;
-	}
-
-	pthread_mutex_lock(&_chandle_lock);
-	if (_chandle == NULL) {
-		errno = ENOSYS;
-		goto out_unlock;
-	}
-
-	tid = pthread_self();
-	if (_chandle_holder == tid) {
-		errno = EDEADLK;
-		goto out_unlock;
-	}
-
-	if (_chandle_holder > 0) {
-		if (!block) {
-			errno = EAGAIN;
-			goto out_unlock;
-		}
-
-		/* Blocking call; do the cond-thing */
-		pthread_cond_wait(&_chandle_cond, &_chandle_lock);
-	}
-
-	*preempt_fd = _wakeup_pipe[0];
-	_chandle_holder = tid;
-	_chandle_preempt = 1;
-	ret = _chandle;
-out_unlock:
-	pthread_mutex_unlock(&_chandle_lock);
-	return ret;
-}
-
-
-/**
-  Release the global CMAN handle
-
-  @param ch		Should match the global handle
-  @return		-1 on failure, 0 on success
- */
-int
-cman_unlock(cman_handle_t ch)
-{
-	int err;
-	int ret = -1;
-	char c;
-
-	pthread_mutex_lock(&_chandle_lock);
-	if (_chandle == NULL) {
-		errno = ENOSYS;
-		goto out_unlock;
-	}
-
-	if (_chandle_holder != pthread_self() || !_chandle_holder) {
-		errno = EBUSY;
-		goto out_unlock;
-	}
-
-	if (_chandle != ch) {
-		errno = EINVAL;
-		goto out_unlock;
-	}
-
-	/* Empty wakeup pipe if we took it with the preempt flag */
-	if (_chandle_preempt)
-		err = read(_wakeup_pipe[0], &c, 1); /** XXX we don't care about errors here **/
-
-	_chandle_preempt = 0;
-	_chandle_holder = 0;
-	ret = 0;
-
-out_unlock:
-	pthread_mutex_unlock(&_chandle_lock);
-	if (ret == 0) 
-		pthread_cond_broadcast(&_chandle_cond);
-	return ret;
-}
-
-
-int
-cman_init_subsys(cman_handle_t *ch)
-{
-	int ret = -1;
-
-	pthread_mutex_lock(&_chandle_lock);
-	if (_chandle) {
-		errno = EAGAIN;
-		goto out_unlock;
-	}
-
-	if (!ch) {
-		errno = EAGAIN;
-		goto out_unlock;
-	}
-
-	if (pipe(_wakeup_pipe) < 0) {
-		goto out_unlock;
-	}
-
-	_set_nonblock(_wakeup_pipe[0]);
-	_chandle = ch;
-	_chandle_holder = 0;
-	ret = 0;
-
-out_unlock:
-	pthread_mutex_unlock(&_chandle_lock);
-	return ret;
-}
-
-
-int
-cman_cleanup_subsys(void)
-{
-	int ret = -1;
-
-	pthread_mutex_lock(&_chandle_lock);
-	if (!_chandle) {
-		errno = EAGAIN;
-		goto out_unlock;
-	}
-
-	if (_chandle_holder > 0) {
-		pthread_cond_wait(&_chandle_cond, &_chandle_lock);
-	}
-
-	ret = 0;
-	_chandle = NULL;
-	_chandle_holder = 0;
-
-	close(_wakeup_pipe[0]);
-	close(_wakeup_pipe[1]);
-	
-out_unlock:
-	pthread_mutex_unlock(&_chandle_lock);
-	return ret;
-}
-
-
-int
-cman_send_data_unlocked(void *buf, int len, int flags,
-			uint8_t port, int nodeid)
-{
-	return cman_send_data(_chandle, buf, len, flags, port, nodeid);
-}
diff --git a/rgmanager/src/clulib/daemon_init.c b/rgmanager/src/clulib/daemon_init.c
deleted file mode 100644
index 234c780..0000000
--- a/rgmanager/src/clulib/daemon_init.c
+++ /dev/null
@@ -1,225 +0,0 @@
-/** @file
- * daemon_init function, does sanity checks and calls daemon().
- *
- * $Id$
- *
- * Author: Jeff Moyer <moyer@mclinux.com>
- */
-/*
- * TODO: Clean this up so that only one function constructs the 
- *       pidfile /var/run/loggerd.PID, and perhaps only one function
- *       forms the /proc/PID/ path.
- *
- *       Also need to add file locking for the pid file.
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/param.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <sys/mman.h>
-#include <sys/errno.h>
-#include <libgen.h>
-#include <signal.h>
-
-/*
- * This should ultimately go in a header file.
- */
-void daemon_init(char *prog);
-int check_pid_valid(pid_t pid, char *prog);
-int check_process_running(char *prog, pid_t * pid);
-
-/*
- * Local prototypes.
- */
-static void update_pidfile(char *prog);
-static int setup_sigmask(void);
-
-
-int
-check_pid_valid(pid_t pid, char *prog)
-{
-	FILE *fp;
-	DIR *dir;
-	char filename[PATH_MAX];
-	char dirpath[PATH_MAX];
-	char proc_cmdline[64];	/* yank this from kernel somewhere */
-	char *s = NULL;
-
-	memset(filename, 0, PATH_MAX);
-	memset(dirpath, 0, PATH_MAX);
-
-	snprintf(dirpath, sizeof (dirpath), "/proc/%d", pid);
-	if ((dir = opendir(dirpath)) == NULL) {
-		closedir(dir);
-		return 0;	/* Pid has gone away. */
-	}
-	closedir(dir);
-
-	/*
-	 * proc-pid directory exists.  Now check to see if this
-	 * PID corresponds to the daemon we want to start.
-	 */
-	snprintf(filename, sizeof (filename), "/proc/%d/cmdline", pid);
-	fp = fopen(filename, "r");
-	if (fp == NULL) {
-		perror("check_pid_valid");
-		return 0;	/* Who cares.... Let's boogy on. */
-	}
-
-	if (!fgets(proc_cmdline, sizeof (proc_cmdline) - 1, fp)) {
-		/*
-		 * Okay, we've seen processes keep a reference to a
-		 * /proc/PID/stat file and not let go.  Then when
-		 * you try to read /proc/PID/cmline, you get either
-		 * \000 or -1.  In either case, we can safely assume
-		 * the process has gone away.
-		 */
-		fclose(fp);
-		return 0;
-	}
-	fclose(fp);
-
-	s = &(proc_cmdline[strlen(proc_cmdline)]);
-	if (*s == '\n')
-		*s = 0;
-
-	/*
-	 * Check to see if this is the same executable.
-	 */
-	if ((s = strstr(proc_cmdline, prog)) == NULL) {
-		return 0;
-	} else {
-		return 1;
-	}
-}
-
-
-int
-check_process_running(char *prog, pid_t * pid)
-{
-	pid_t oldpid;
-	FILE *fp;
-	char filename[PATH_MAX];
-	char *cmd;
-	int ret;
-	struct stat st;
-
-	*pid = -1;
-
-	/*
-	 * Now see if there is a pidfile associated with this cmd in /var/run
-	 */
-	fp = NULL;
-	memset(filename, 0, PATH_MAX);
-
-	cmd = basename(prog);
-	snprintf(filename, sizeof (filename), "/var/run/%s.pid", cmd);
-
-	ret = stat(filename, &st);
-	if ((ret < 0) || (!st.st_size))
-		return 0;
-
-	/*
-	 * Read the pid from the file.
-	 */
-	fp = fopen(filename, "r");
-	if (fp == NULL) {	/* error */
-		return 0;
-	}
-	ret = fscanf(fp, "%d\n", &oldpid);
-	fclose(fp);
-	if ((ret == EOF) || (ret != 1))
-		return 0;
-
-	if (check_pid_valid(oldpid, cmd)) {
-		*pid = oldpid;
-		return 1;
-	}
-	return 0;
-}
-
-
-static void
-update_pidfile(char *prog)
-{
-	FILE *fp = NULL;
-	char *cmd;
-	char filename[PATH_MAX];
-
-	memset(filename, 0, PATH_MAX);
-
-	cmd = basename(prog);
-	snprintf(filename, sizeof (filename), "/var/run/%s.pid", cmd);
-
-	fp = fopen(filename, "w");
-	if (fp == NULL) {
-		exit(1);
-	}
-
-	fprintf(fp, "%d", getpid());
-	fclose(fp);
-}
-
-
-static int
-setup_sigmask(void)
-{
-	sigset_t set;
-
-	sigfillset(&set);
-
-	/*
-	 * Dont't block signals which would cause us to dump core.
-	 */
-	sigdelset(&set, SIGQUIT);
-	sigdelset(&set, SIGILL);
-	sigdelset(&set, SIGTRAP);
-	sigdelset(&set, SIGABRT);
-	sigdelset(&set, SIGFPE);
-	sigdelset(&set, SIGSEGV);
-	sigdelset(&set, SIGBUS);
-
-	return (sigprocmask(SIG_BLOCK, &set, NULL));
-}
-
-
-void
-daemon_init(char *prog)
-{
-	uid_t uid;
-	pid_t pid;
-
-	uid = getuid();
-	if (uid) {
-		fprintf(stderr,
-			"daemon_init: Sorry, only root wants to run this.\n");
-		exit(1);
-	}
-
-	if (check_process_running(prog, &pid) && (pid != getpid())) {
-		fprintf(stderr,
-			"daemon_init: Process \"%s\" already running.\n",
-			prog);
-		exit(1);
-	}
-	if (setup_sigmask() < 0) {
-		fprintf(stderr, "daemon_init: Unable to set signal mask.\n");
-		exit(1);
-	}
-
-	if (daemon(0, 0)) {
-		fprintf(stderr, "daemon_init: Unable to daemonize.\n");
-		exit(1);
-	}
-
-	update_pidfile(prog);
-	if (nice(-1) < 0)
-		fprintf(stderr, "daemon_init: Unable to renice.\n");
-
-	//mlockall(MCL_CURRENT | MCL_FUTURE);
-}
diff --git a/rgmanager/src/clulib/fdops.c b/rgmanager/src/clulib/fdops.c
deleted file mode 100644
index ffce53d..0000000
--- a/rgmanager/src/clulib/fdops.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/** @file
- * Wrapper functions around read/write/select to retry in the event
- * of interrupts.
- */
-#include <unistd.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <errno.h>
-
-/**
- * This is a wrapper around select which will retry in the case we receive
- * EINTR.  This is necessary for _read_retry, since it wouldn't make sense
- * to have _read_retry terminate if and only if two EINTRs were received
- * in a row - one during the read() call, one during the select call...
- *
- * See select(2) for description of parameters.
- */
-int
-_select_retry(int fdmax, fd_set * rfds, fd_set * wfds, fd_set * xfds,
-	       struct timeval *timeout)
-{
-	int rv;
-
-	while (1) {
-		rv = select(fdmax, rfds, wfds, xfds, timeout);
-		if ((rv == -1) && (errno == EINTR))
-			/* return on EBADF/EINVAL/ENOMEM; continue on EINTR */
-			continue;
-		return rv;
-	}
-}
-
-/**
- * Retries a write in the event of a non-blocked interrupt signal.
- *
- * @param fd		File descriptor to which we are writing.
- * @param buf		Data buffer to send.
- * @param count		Number of bytes in buf to send.
- * @param timeout	(struct timeval) telling us how long we should retry.
- * @return		The number of bytes written to the file descriptor,
- * 			or -1 on error (with errno set appropriately).
- */
-ssize_t
-_write_retry(int fd, void *buf, int count, struct timeval * timeout)
-{
-	int n, total = 0, remain = count, rv = 0;
-	fd_set wfds, xfds;
-
-	while (total < count) {
-
-		/* Create the write FD set of 1... */
-		FD_ZERO(&wfds);
-		FD_SET(fd, &wfds);
-		FD_ZERO(&xfds);
-		FD_SET(fd, &xfds);
-
-		/* wait for the fd to be available for writing */
-		rv = _select_retry(fd + 1, NULL, &wfds, &xfds, timeout);
-		if (rv == -1)
-			return -1;
-		else if (rv == 0) {
-			errno = ETIMEDOUT;
-			return -1;
-		}
-
-		if (FD_ISSET(fd, &xfds)) {
-			errno = EPIPE;
-			return -1;
-		}
-
-		/* 
-		 * Attempt to write to fd
-		 */
-		n = write(fd, buf + (off_t) total, remain);
-
-		/*
-		 * When we know our fd was select()ed and we receive 0 bytes
-		 * when we write, the fd was closed.
-		 */
-		if ((n == 0) && (rv == 1)) {
-			errno = EPIPE;
-			return -1;
-		}
-
-		if (n == -1) {
-			if ((errno == EAGAIN) || (errno == EINTR)) {
-				/* 
-				 * Not ready?
-				 */
-				continue;
-			}
-
-			/* Other errors: EIO, EINVAL, etc */
-			return -1;
-		}
-
-		total += n;
-		remain -= n;
-	}
-
-	return total;
-}
-
-/**
- * Retry reads until we (a) time out or (b) get our data.  Of course, if
- * timeout is NULL, it'll wait forever.
- *
- * @param sockfd	File descriptor we want to read from.
- * @param buf		Preallocated buffer into which we will read data.
- * @param count		Number of bytes to read.
- * @param timeout	(struct timeval) describing how long we should retry.
- * @return 		The number of bytes read on success, or -1 on failure.
- 			Note that we will always return (count) or (-1).
- */
-ssize_t
-_read_retry(int sockfd, void *buf, int count, struct timeval * timeout)
-{
-	int n, total = 0, remain = count, rv = 0;
-	fd_set rfds, xfds;
-
-	while (total < count) {
-		FD_ZERO(&rfds);
-		FD_SET(sockfd, &rfds);
-		FD_ZERO(&xfds);
-		FD_SET(sockfd, &xfds);
-		
-		/*
-		 * Select on the socket, in case it closes while we're not
-		 * looking...
-		 */
-		rv = _select_retry(sockfd + 1, &rfds, NULL, &xfds, timeout);
-		if (rv == -1)
-			return -1;
-		else if (rv == 0) {
-			errno = ETIMEDOUT;
-			return -1;
-		}
-
-		if (FD_ISSET(sockfd, &xfds)) {
-			errno = EPIPE;
-			return -1;
-		}
-
-		/* 
-		 * Attempt to read off the socket 
-		 */
-		n = read(sockfd, buf + (off_t) total, remain);
-
-		/*
-		 * When we know our socket was select()ed and we receive 0 bytes
-		 * when we read, the socket was closed.
-		 */
-		if ((n == 0) && (rv == 1)) {
-			errno = EPIPE;
-			return -1;
-		}
-
-		if (n == -1) {
-			if ((errno == EAGAIN) || (errno == EINTR)) {
-				/* 
-				 * Not ready? Wait for data to become available
-				 */
-				continue;
-			}
-
-			/* Other errors: EPIPE, EINVAL, etc */
-			return -1;
-		}
-
-		total += n;
-		remain -= n;
-	}
-
-	return total;
-}
diff --git a/rgmanager/src/clulib/gettid.c b/rgmanager/src/clulib/gettid.c
deleted file mode 100644
index ba571c6..0000000
--- a/rgmanager/src/clulib/gettid.c
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <sys/types.h>
-#include <sys/syscall.h>
-#include <linux/unistd.h>
-#include <gettid.h>
-#include <errno.h>
-#include <unistd.h>
-
-/* Patch from Adam Conrad / Ubuntu: Don't use _syscall macro */
-
-#ifdef __NR_gettid
-pid_t gettid (void)
-{
-	return syscall(__NR_gettid);
-}
-#else
-
-#warn "gettid not available -- substituting with pthread_self()"
-
-#include <pthread.h>
-pid_t gettid (void)
-{
-	return (pid_t)pthread_self();
-}
-#endif
diff --git a/rgmanager/src/clulib/lock.c b/rgmanager/src/clulib/lock.c
deleted file mode 100644
index 3a40574..0000000
--- a/rgmanager/src/clulib/lock.c
+++ /dev/null
@@ -1,297 +0,0 @@
-/** @file
- * Locking.
- */
-#include <errno.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdio.h>
-#include <assert.h>
-#include <sys/ioctl.h>
-#include <lock.h>
-#include <sys/types.h>
-#include <sys/select.h>
-#include <pthread.h>
-
-/* Default lockspace stuff */
-static dlm_lshandle_t _default_ls = NULL;
-static pthread_mutex_t _default_lock = PTHREAD_MUTEX_INITIALIZER;
-
-
-static void
-ast_function(void * __attribute__ ((unused)) arg)
-{
-}
-
-
-static int
-wait_for_dlm_event(dlm_lshandle_t ls)
-{
-	fd_set rfds;
-	int fd = dlm_ls_get_fd(ls);
-
-	FD_ZERO(&rfds);
-	FD_SET(fd, &rfds);
-
-	if (select(fd + 1, &rfds, NULL, NULL, NULL) == 1)
-		return dlm_dispatch(fd);
-
-	return -1;
-}
-
-
-int
-clu_ls_lock(dlm_lshandle_t ls,
-	    int mode,
-	    struct dlm_lksb *lksb,
-	    int options,
-            char *resource)
-{
-        int ret;
-
-	if (!ls || !lksb || !resource || !strlen(resource)) {
-		printf("%p %p %p %d\n", ls, lksb, resource,
-		       (int)strlen(resource));
-		printf("INVAL...\n");
-		errno = EINVAL;
-		return -1;
-	}
-
-        ret = dlm_ls_lock(ls, mode, lksb, options, resource,
-                          strlen(resource), 0, ast_function, lksb,
-                          NULL, NULL);
-
-        if (ret < 0) {
-                if (errno == ENOENT)
-                        assert(0);
-
-                return -1;
-        }
-
-        if ((ret = (wait_for_dlm_event(ls) < 0))) {
-                fprintf(stderr, "wait_for_dlm_event: %d / %d\n",
-                        ret, errno);
-                return -1;
-        }
-
-	if (lksb->sb_status == 0)
-		return 0;
-
-	errno = lksb->sb_status;
-	return -1;
-}
-
-
-
-dlm_lshandle_t
-clu_open_lockspace(const char *lsname)
-{
-        dlm_lshandle_t ls = NULL;
-
-	//printf("opening lockspace %s\n", lsname);
-
-        while (!ls) {
-                ls = dlm_open_lockspace(lsname);
-                if (ls)
-                        break;
-
-		/*
-		printf("Failed to open: %s; trying create.\n",
-		       strerror(errno));
-		 */
-
-                ls = dlm_create_lockspace(lsname, 0644);
-                if (ls)
-                        break;
-
-                /* Work around race: Someone was closing lockspace as
-                   we were trying to open it.  Retry. */
-                if (errno == ENOENT)
-                        continue;
-
-                fprintf(stderr, "failed acquiring lockspace: %s\n",
-                        strerror(errno));
-
-                return NULL;
-        }
-
-        return ls;
-}
-
-
-int
-clu_ls_unlock(dlm_lshandle_t ls, struct dlm_lksb *lksb)
-{
-        int ret;
-
-	if (!ls || !lksb) {
-		errno = EINVAL;
-		return -1;
-	}
-
-        ret = dlm_ls_unlock(ls, lksb->sb_lkid, 0, lksb, NULL);
-
-        if (ret != 0)
-                return ret;
-
-        /* lksb->sb_status should be EINPROG at this point */
-
-        if (wait_for_dlm_event(ls) < 0) {
-                errno = lksb->sb_status;
-                return -1;
-        }
-
-        return 0;
-}
-
-
-int
-clu_close_lockspace(dlm_lshandle_t ls, const char *name)
-{
-        return dlm_release_lockspace(name, ls, 1);
-}
-
-
-int
-clu_lock(int mode,
-	 struct dlm_lksb *lksb,
-	 int options,
-         char *resource)
-{
-	int ret = 0, block = 0, conv = 0, err;
-
-	block = !(options & LKF_NOQUEUE);
-
-	errno = EINVAL;
-	if (!lksb)
-		return -1;
-
-	memset(lksb, 0, sizeof(struct dlm_lksb));
-
-	/*
-	   Try to use a conversion lock mechanism when possible
-	   If the caller calls explicitly with a NULL lock, then
-	   assume the caller knows what it is doing.
-
-	   Only take the NULL lock if:
-	   (a) the user isn't specifying CONVERT; if they are, they
-	       know what they are doing.
-
-	   ...and one of...
-
-	   (b) This is a blocking call, or
-	   (c) The user requested a NULL lock explicitly.  In this case,
-	       short-out early; there's no reason to convert a NULL lock
-	       to a NULL lock.
-	 */
-	if (!(options & LKF_CONVERT) &&
-	    (block || (mode == LKM_NLMODE))) {
-		/* Acquire NULL lock */
-		pthread_mutex_lock(&_default_lock);
-		ret = clu_ls_lock(_default_ls, LKM_NLMODE, lksb,
-				  (options & ~LKF_NOQUEUE),
-				  resource);
-		err = errno;
-		pthread_mutex_unlock(&_default_lock);
-		if (ret == 0) {
-			if (mode == LKM_NLMODE) {
-				/* User only wanted a NULL lock... */
-				return 0;
-			}
-			/*
-			   Ok, NULL lock was taken, rest of blocking
-			   call should be done using lock conversions.
-			 */
-			options |= LKF_CONVERT;
-			conv = 1;
-		} else {
-			switch(err) {
-			case EINVAL:
-				/* Oops, null locks don't work on this
-				   plugin; use normal spam mode */
-				break;
-			default:
-				errno = err;
-				return -1;
-			}
-		}
-	}
-
-	while (1) {
-		pthread_mutex_lock(&_default_lock);
-		ret = clu_ls_lock(_default_ls, mode, lksb,
-				  (options | LKF_NOQUEUE),
-				  resource);
-		err = errno;
-		pthread_mutex_unlock(&_default_lock);
-
-		if ((ret != 0) && (err == EAGAIN) && block) {
-			usleep(random()&32767);
-			continue;
-		}
-
-		break;
-	}
-
-	if (ret != 0 && conv) {
-		/* If we get some other error, release the NL lock we
-		 took so we don't leak locks*/
-		pthread_mutex_lock(&_default_lock);
-		clu_ls_unlock(_default_ls, lksb);
-		pthread_mutex_unlock(&_default_lock);
-		errno = err;
-	}
-
-	return ret;
-}
-
-
-int
-clu_unlock(struct dlm_lksb *lksb)
-{
-	int ret, err;
-	pthread_mutex_lock(&_default_lock);
-	ret = clu_ls_unlock(_default_ls, lksb);
-	err = errno;
-	pthread_mutex_unlock(&_default_lock);
-
-	usleep(random()&32767);
-	errno = err;
-	return ret;
-}
-
-
-int
-clu_lock_init(const char *dflt_lsname)
-{
-	int ret, err;
-
-	pthread_mutex_lock(&_default_lock);
-	if (_default_ls) {
-		pthread_mutex_unlock(&_default_lock);
-		return 0;
-	}
-
-	if (!dflt_lsname || !strlen(dflt_lsname)) {
-		pthread_mutex_unlock(&_default_lock);
-		errno = EINVAL;
-		return -1;
-	}
-
-	_default_ls = clu_open_lockspace(dflt_lsname);
-	ret = (_default_ls == NULL);
-	err = errno;
-	pthread_mutex_unlock(&_default_lock);
-
-	errno = err;
-	return ret;
-}
-
-void
-clu_lock_finished(const char *name)
-{
-	pthread_mutex_lock(&_default_lock);
-	if (_default_ls)
-		clu_close_lockspace(_default_ls, name);
-	pthread_mutex_unlock(&_default_lock);
-}
diff --git a/rgmanager/src/clulib/locktest.c b/rgmanager/src/clulib/locktest.c
deleted file mode 100644
index c0d37b7..0000000
--- a/rgmanager/src/clulib/locktest.c
+++ /dev/null
@@ -1,67 +0,0 @@
-#include <lock.h>
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <pthread.h>
-#include <signal.h>
-
-
-void *
-lock_thread(void *arg)
-{
-	struct dlm_lksb lksb;
-
-	while(1) {
-		printf("Taking lock..\n");
-		clu_lock(LKM_EXMODE, &lksb, 0, arg);
-		printf("Thread acquired lock on %s\n", (char *)arg);
-		clu_unlock(&lksb);
-	}
-}
-
-
-
-
-int
-main(int argc, char **argv)
-{
-	struct dlm_lksb lksb;
-	int ret;
-	pthread_t th;
-
-	if (clu_lock_init("Testing") != 0) {
-		perror("clu_lock_init");
-		return 1;
-	}
-
-	if (argc < 2) {
-		printf("Lock what?\n");
-		return 1;
-	}
-
-	if (argc == 3) {
-		pthread_create(&th, NULL, lock_thread, strdup(argv[1]));
-	}
-
-	memset(&lksb,0,sizeof(lksb));
-	ret = clu_lock(LKM_EXMODE, &lksb, 0, argv[1]);
-	if (ret < 0) {
-		perror("clu_lock");
-		return 1;
-	}
-
-	printf("Acquired lock on %s; press enter to release\n", argv[1]);
-	getchar();
-
-	clu_unlock(&lksb);
-
-	if (argc == 3) {
-		printf("Press enter to kill lock thread...\n");
-		getchar();
-		pthread_kill(th, SIGTERM);
-	}
-
-	clu_lock_finished("Testing");
-
-	return 0;
-}
diff --git a/rgmanager/src/clulib/logging.c b/rgmanager/src/clulib/logging.c
deleted file mode 100644
index b7bdac1..0000000
--- a/rgmanager/src/clulib/logging.c
+++ /dev/null
@@ -1,112 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#define SYSLOG_NAMES
-#include <syslog.h>
-#include <logging.h>
-#include <unistd.h>
-#include <string.h>
-#include <limits.h>
-#include <malloc.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <ccs.h>
-#include <limits.h>
-
-#define DAEMON_NAME "rgmanager"
-static char daemon_name[PATH_MAX];
-
-/* default: errors go to syslog (/var/log/messages) and <daemon>.log
-   logging/debug=on: errors continue going to syslog (/var/log/messages)
-   and <daemon>.log, debug messages are added to <daemon>.log. */
-
-#define DEFAULT_MODE		LOG_MODE_OUTPUT_SYSLOG| \
-				LOG_MODE_OUTPUT_FILE
-static int default_mode = DEFAULT_MODE;
-
-#define DEFAULT_FACILITY	SYSLOGFACILITY /* cluster config setting */
-#define DEFAULT_PRIORITY	SYSLOGLEVEL /* cluster config setting */
-static int default_priority = DEFAULT_PRIORITY;
-
-#define DEFAULT_FILE		LOGDIR "/" DAEMON_NAME ".log"
-
-
-void
-init_logging(char *name, int foreground, int default_prio)
-{
-	if (!name)
-		name = DAEMON_NAME;
-
-	strncpy(daemon_name, name, PATH_MAX);
-
-	if (foreground)
-		default_mode |= LOG_MODE_OUTPUT_STDERR;
-	if (default_prio >= 0)
-		default_priority = default_prio;
-	logt_init(name, default_mode, DEFAULT_FACILITY,
-		  DEFAULT_PRIORITY, DEFAULT_PRIORITY, DEFAULT_FILE);
-}
-
-
-int
-ccs_read_old_logging(int ccsfd, int *facility, int *priority)
-{
-	char query[256];
-	char *val;
-	int x, ret = 0;
-
-	/* Get log log_facility */
-	snprintf(query, sizeof(query), "/cluster/rm/@log_facility");
-	if (ccs_get(ccsfd, query, &val) == 0) {
-		for (x = 0; facilitynames[x].c_name; x++) {
-			if (strcasecmp(val, facilitynames[x].c_name))
-				continue;
-			*facility = facilitynames[x].c_val;
-			ret = 1;
-			break;
-		}
-		free(val);
-	}
-
-	/* Get log level */
-	snprintf(query, sizeof(query), "/cluster/rm/@log_level");
-	if (ccs_get(ccsfd, query, &val) == 0) {
-		*priority = atoi(val);
-		free(val);
-		if (*priority < 0)
-			*priority = DEFAULT_PRIORITY;
-		else
-			ret = 1;
-	}
-
-	return ret;
-}
-
-
-/* this function is also called when we get a cman config-update event */
-void
-setup_logging(int ccs_handle)
-{
-	int mode = DEFAULT_MODE;
-	int facility = DEFAULT_FACILITY;
-	int loglevel = DEFAULT_PRIORITY, filelevel = DEFAULT_PRIORITY;
-	int debug = 0;
-	char file[PATH_MAX];
-
-	memset(file, 0, PATH_MAX);
-	snprintf(file, sizeof(file)-1, DEFAULT_FILE);
-	if (ccs_read_old_logging(ccs_handle, &facility, &loglevel))
-		filelevel = loglevel;
-
-	ccs_read_logging(ccs_handle, (char *)DAEMON_NAME, &debug, &mode,
-        		 &facility, &loglevel, &filelevel, (char *)file);
-
-	/* clulog uses rgmanager's config but getppid()'s name */
-	logt_conf(daemon_name, mode, facility, loglevel,
-	    	      filelevel, file);
-}
-
-void
-close_logging(void)
-{
-	logt_exit();
-}
diff --git a/rgmanager/src/clulib/members.c b/rgmanager/src/clulib/members.c
deleted file mode 100644
index fb77cea..0000000
--- a/rgmanager/src/clulib/members.c
+++ /dev/null
@@ -1,569 +0,0 @@
-#include <sys/types.h>
-#include <arpa/inet.h>
-#include <stdint.h>
-#include <malloc.h>
-#include <libcman.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <members.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <signal.h>
-#include <string.h>
-#include <sys/socket.h>
-#include <rg_types.h>
-#include <pthread.h>
-#include <errno.h>
-
-static int my_node_id = -1;
-static pthread_rwlock_t memblock = PTHREAD_RWLOCK_INITIALIZER;
-static cluster_member_list_t *membership = NULL;
-
-
-/**
-  Return the stored node ID.  Since this should never
-  change during the duration of running rgmanager, it is
-  not protected by a lock.
- */
-int
-my_id(void)
-{
-	return my_node_id;
-}
-
-
-int
-set_my_id(int id)
-{
-	my_node_id = id;
-	return 0;
-}
-
-
-/**
-  Determine and store the local node ID.  This should
-  only ever be called once during initialization.
- */
-int
-get_my_nodeid(cman_handle_t h)
-{
-	cman_node_t node;
-	memset(&node,0,sizeof(node));
-
-	if (cman_get_node(h, CMAN_NODEID_US, &node) != 0)
-		return -1;
-
-	return node.cn_nodeid;
-}
-
-
-
-/**
-  Generate and return a list of members which are now online in a new
-  membership list, given the old membership list.  User must call
-  @ref free_member_list
-  to free the returned
-  @ref cluster_member_list_t
-  structure.
-
-  @param old		Old membership list
-  @param new		New membership list
-  @return		NULL if no members were gained, or a newly 
-  			allocated cluster_member_list_t structure.
- */
-cluster_member_list_t *
-memb_gained(cluster_member_list_t *old, cluster_member_list_t *new)
-{
-	int count, x, y;
-	char in_old = 0;
-	cluster_member_list_t *gained = NULL;
-
-	/* No nodes in new?  Then nothing could have been gained */
-	if (!new || !new->cml_count)
-		return NULL;
-
-	/* Nothing in old?  Duplicate 'new' and return it. */
-	if (!old || !old->cml_count)
-		return member_list_dup(new);
-
-	/* Use greatest possible count */
-	count = (old->cml_count > new->cml_count ?
-		 old->cml_count : new->cml_count);
-	count *= sizeof(cman_node_t);
-
-	gained = malloc(sizeof(cluster_member_list_t));
-	if (!gained)
-		return NULL;
-	memset(gained, 0, sizeof(*gained));
-
-	gained->cml_members = malloc(count);
-	if (!gained->cml_members) {
-		free(gained);
-		return NULL;
-	}
-	memset(gained->cml_members, 0, count);
-
-	for (x = 0; x < new->cml_count; x++) {
-
-		/* This one isn't active at the moment; it could not have
-		   been gained. */
-		if (!new->cml_members[x].cn_member)
-			continue;
-
-		in_old = 0;
-		for (y = 0; y < old->cml_count; y++) {
-			if ((new->cml_members[x].cn_nodeid !=
-			     old->cml_members[y].cn_nodeid) ||
-			     !old->cml_members[y].cn_member)
-				continue;
-			in_old = 1;
-			break;
-		}
-
-		if (in_old)
-			continue;
-		memcpy(&gained->cml_members[gained->cml_count++],
-		       &new->cml_members[x], sizeof(cman_node_t));
-	}
-
-	if (gained->cml_count == 0) {
-		free(gained->cml_members);
-		free(gained);
-		gained = NULL;
-	}
-
-	return gained;
-}
-
-
-/**
-  Generate and return a list of members which are lost or no longer online
-  in a new membership list, given the old membership list.  User must call
-  @ref free_member_list
-  to free the returned
-  @ref cluster_member_list_t
-  structure.
-
-  @param old		Old membership list
-  @param new		New membership list
-  @return		NULL if no members were lost, or a newly 
-  			allocated cluster_member_list_t structure.
- */
-cluster_member_list_t *
-memb_lost(cluster_member_list_t *old, cluster_member_list_t *new)
-{
-	cluster_member_list_t *ret = NULL;
-	int x;
-
-	/* Reverse. ;) */
-	ret = memb_gained(new, old);
-	if (!ret)
-		return NULL;
-
-	for (x = 0; x < ret->cml_count; x++) {
-		ret->cml_members[x].cn_member = 0;
-	}
-
-	return ret;
-}
-
-
-
-void
-member_list_update(cluster_member_list_t *new_ml)
-{
-	pthread_rwlock_wrlock(&memblock);
-	if (membership)
-		free_member_list(membership);
-	if (new_ml)
-		membership = member_list_dup(new_ml);
-	else
-		membership = NULL;
-	pthread_rwlock_unlock(&memblock);
-}
-
-
-cluster_member_list_t *
-member_list(void)
-{
-	cluster_member_list_t *ret = NULL;
-	pthread_rwlock_rdlock(&memblock);
-	if (membership) 
-		ret = member_list_dup(membership);
-	pthread_rwlock_unlock(&memblock);
-	return ret;
-}
-
-
-int
-member_online_set(int **nodes, int *nodecount)
-{
-	int ret = 1, i;
-
-	pthread_rwlock_rdlock(&memblock);
-	if (!membership)
-		goto out_unlock;
-
-	*nodes = malloc(sizeof(int) * membership->cml_count);
-	if (!*nodes)
-		goto out_unlock;
-
-	*nodecount = 0;
-	for (i = 0; i < membership->cml_count; i++) {
-		if (membership->cml_members[i].cn_member &&
-		    membership->cml_members[i].cn_nodeid != 0) {
-			(*nodes)[*nodecount] = membership->cml_members[i].cn_nodeid;
-			++(*nodecount);
-		}
-	}
-
-	ret = 0;
-out_unlock:
-	pthread_rwlock_unlock(&memblock);
-	return ret;
-}
-
-
-void
-member_set_state(int nodeid, int state)
-{
-	int x = 0;
-
-	pthread_rwlock_wrlock(&memblock);
-	if (!membership) {
-		pthread_rwlock_unlock(&memblock);
-		return;
-	}
-
-	for (x = 0; x < membership->cml_count; x++) {
-		if (membership->cml_members[x].cn_nodeid == nodeid)
-			membership->cml_members[x].cn_member = state;
-	}
-	pthread_rwlock_unlock(&memblock);
-}
-
-
-int
-member_low_id(void)
-{
-	int x = 0, low = -1;
-
-	pthread_rwlock_wrlock(&memblock);
-	if (!membership) {
-		pthread_rwlock_unlock(&memblock);
-		return low;
-	}
-
-	for (x = 0; x < membership->cml_count; x++) {
-		if ((membership->cml_members[x].cn_member) &&
-		    ((membership->cml_members[x].cn_nodeid < low) || (low == -1)))
-			low = membership->cml_members[x].cn_nodeid;
-	}
-	pthread_rwlock_unlock(&memblock);
-
-	return low;
-}
-
-
-int
-member_high_id(void)
-{
-	int x = 0, high = -1;
-
-	pthread_rwlock_wrlock(&memblock);
-	if (!membership) {
-		pthread_rwlock_unlock(&memblock);
-		return high;
-	}
-
-	for (x = 0; x < membership->cml_count; x++) {
-		if (membership->cml_members[x].cn_member &&
-		    (membership->cml_members[x].cn_nodeid > high))
-			high = membership->cml_members[x].cn_nodeid;
-	}
-	pthread_rwlock_unlock(&memblock);
-
-	return high;
-}
-
-
-int
-member_online(int nodeid)
-{
-	int x = 0, ret = 0;
-
-	pthread_rwlock_rdlock(&memblock);
-	if (!membership) {
-		pthread_rwlock_unlock(&memblock);
-		return 0;
-	}
-
-	for (x = 0; x < membership->cml_count; x++) {
-		if (membership->cml_members[x].cn_nodeid == nodeid) {
-			ret = membership->cml_members[x].cn_member;
-			break;
-		}
-	}
-	pthread_rwlock_unlock(&memblock);
-
-	return ret;
-}
-
-
-
-char *
-member_name(int id, char *buf, int buflen)
-{
-	char *n;
-
-	if (!buf || !buflen)
-		return NULL;
-
-	pthread_rwlock_rdlock(&memblock);
-	n = memb_id_to_name(membership, id);
-	if (n) {
-		strncpy(buf, n, buflen);
-	} else {
-		buf[0] = 0;
-	}
-	pthread_rwlock_unlock(&memblock);
-	return buf;
-}
-
-
-
-cluster_member_list_t *
-get_member_list(cman_handle_t h)
-{
-	int c;
-	int tries = 0, local = 0;
-	cluster_member_list_t *ml = NULL;
-	cman_node_t *nodes = NULL;
-
-	if (h == NULL) {
-		local = 1;
-		h = cman_init(NULL);
-		if (!h)
-			return NULL;
-	}
-
-	do {	
-		++tries;
-		if (nodes)
-			free(nodes);
-
-		c = cman_get_node_count(h);
-		if (c <= 0) {
-			if (errno == EINTR)
-				continue;
-			if (ml)
-				free(ml);
-			ml = NULL;
-			goto out;
-		}
-
-		if (!ml)
-			ml = malloc(sizeof(*ml));
-		if (!ml)
-			goto out;
-
-		nodes = malloc(sizeof(*nodes) * c);
-		if (!nodes) {
-			free(ml);
-			ml = NULL;
-			goto out;
-		}
-
-		memset(ml, 0, sizeof(*ml));
-		memset(nodes, 0, sizeof(*nodes)*c);
-
-		cman_get_nodes(h, c, &ml->cml_count, nodes);
-
-	} while (ml->cml_count != c);
-
-	ml->cml_members = nodes;
-	ml->cml_count = c;
-
-out:
-	if (local)
-		cman_finish(h);
-	return ml;
-}
-
-
-void
-free_member_list(cluster_member_list_t *ml)
-{
-	if (ml) {
-		if (ml->cml_members)
-			free(ml->cml_members);
-		free(ml);
-	}
-}
-
-
-int
-memb_online(cluster_member_list_t *ml, int nodeid)
-{
-	int x = 0;
-
-	if (!ml)
-		return 0;
-
-	for (x = 0; x < ml->cml_count; x++) {
-		if (ml->cml_members[x].cn_nodeid == nodeid)
-			return ml->cml_members[x].cn_member;
-	}
-
-	return 0;
-}
-
-
-int
-memb_count(cluster_member_list_t *ml)
-{
-	int x = 0, count = 0;
-
-	if (!ml)
-		return 0;
-
-	for (x = 0; x < ml->cml_count; x++) {
-		if (ml->cml_members[x].cn_member)
-			++count;
-	}
-
-	return count;
-}
-
-
-int
-memb_mark_down(cluster_member_list_t *ml, int nodeid)
-{
-	int x = 0;
-
-	if (!ml)
-		return -1;
-
-	for (x = 0; x < ml->cml_count; x++) {
-		if (ml->cml_members[x].cn_nodeid == nodeid)
-			ml->cml_members[x].cn_member = 0;
-	}
-
-	return 0;
-}
-
-
-
-char *
-memb_id_to_name(cluster_member_list_t *ml, int nodeid)
-{
-	int x = 0;
-	if (!ml)
-		return NULL;
-
-	for (x = 0; x < ml->cml_count; x++) {
-		if (ml->cml_members[x].cn_nodeid == nodeid)
-			return ml->cml_members[x].cn_name;
-	}
-
-	return NULL;
-}
-
-
-cman_node_t *
-memb_id_to_p(cluster_member_list_t *ml, int nodeid)
-{
-	int x = 0;
-	if (!ml)
-		return NULL;
-
-	for (x = 0; x < ml->cml_count; x++) {
-		if (ml->cml_members[x].cn_nodeid == nodeid)
-			return &ml->cml_members[x];
-	}
-
-	return NULL;
-}
-
-
-int
-memb_online_name(cluster_member_list_t *ml, char *name)
-{
-	int x = 0;
-	if (!ml)
-		return 0;
-
-	for (x = 0; x < ml->cml_count; x++) {
-		if (!strcasecmp(ml->cml_members[x].cn_name, name))
-			return ml->cml_members[x].cn_member;
-	}
-
-	return 0;
-}
-
-
-int
-memb_name_to_id(cluster_member_list_t *ml, char *name)
-{
-	int x = 0;
-	if (!ml)
-		return 0;
-
-	for (x = 0; x < ml->cml_count; x++) {
-		if (!strcasecmp(ml->cml_members[x].cn_name, name))
-			return ml->cml_members[x].cn_nodeid;
-	}
-
-	return 0;
-}
-
-
-cman_node_t *
-memb_name_to_p(cluster_member_list_t *ml, char *name)
-{
-	int x = 0;
-	if (!ml)
-		return NULL;
-
-	for (x = 0; x < ml->cml_count; x++) {
-		if (!strcasecmp(ml->cml_members[x].cn_name, name))
-			return &ml->cml_members[x];
-	}
-
-	return NULL;
-}
-
-/**
-  Duplicate and return a cluster member list structure, sans the DNS resolution
-  information.
-
-  @param orig		List to duplicate.
-  @return		NULL if there is nothing to duplicate or duplication
-  			fails, or a newly allocated cluster_member_list_t
-			structure.
- */
-cluster_member_list_t *
-member_list_dup(cluster_member_list_t *orig)
-{
-	cluster_member_list_t *ret = NULL;
-
-	if (!orig)
-		return NULL;
-
-	ret = malloc(sizeof(cluster_member_list_t));
-	if (!ret)
-		return NULL;
-	memset(ret, 0, sizeof(cluster_member_list_t));
-	ret->cml_members = malloc(sizeof(cman_node_t) * orig->cml_count);
-
-	if (!ret->cml_members) {
-		free(ret);
-		return NULL;
-	}
-	ret->cml_count = orig->cml_count;
-	memcpy(ret->cml_members, orig->cml_members,
-	       orig->cml_count * sizeof(cman_node_t));
-
-	return ret;
-}
-
diff --git a/rgmanager/src/clulib/message.c b/rgmanager/src/clulib/message.c
deleted file mode 100644
index 76a996d..0000000
--- a/rgmanager/src/clulib/message.c
+++ /dev/null
@@ -1,291 +0,0 @@
-#define _MESSAGE_BUILD
-#include <message.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <errno.h>
-
-/* From msg_cluster */
-int cluster_msg_init(msgctx_t *ctx);
-int cluster_msg_listen(int me, void *, msgctx_t **ctx);
-int cluster_msg_shutdown(void);
-
-/* From msg_socket  */
-int sock_msg_init(msgctx_t *ctx);
-int sock_msg_listen(int me, void *, msgctx_t **ctx);
-int sock_msg_shutdown(void);
-
-
-/**
-  Message sending API.  Sends to the cluster or a socket, depending on
-  the context.
- */
-int
-msg_send(msgctx_t *ctx, void *msg, size_t len)
-{
-	errno = EINVAL;
-	if (!ctx || !msg || !len)
-		return -1;
-
-	if (ctx->ops && ctx->ops->mo_send)
-		return ctx->ops->mo_send(ctx, msg, len);
-	errno = ENOSYS;
-	return -1;
-}
-
-
-/* XXX get API for this ready */
-int
-msg_get_nodeid(msgctx_t *ctx)
-{
-	/* XXX */
-	switch(ctx->type) {
-	case MSG_CLUSTER:
-		return ctx->u.cluster_info.nodeid;
-	case MSG_SOCKET:
-		return 0;
-	default:
-		break;
-	}
-
-	return -1;
-}
-
-
-int
-msg_fd_set(msgctx_t *ctx, fd_set *fds, int *max)
-{
-	errno = EINVAL;
-	if (!ctx)
-		return -1;
-	
-	if (ctx->ops && ctx->ops->mo_fd_set)
-		return ctx->ops->mo_fd_set(ctx, fds, max);
-	errno = ENOSYS;
-	return -1;
-}
-
-
-int
-msg_fd_isset(msgctx_t *ctx, fd_set *fds)
-{
-	errno = EINVAL;
-	if (!ctx)
-		return -1;
-	
-	if (ctx->ops && ctx->ops->mo_fd_isset)
-		return ctx->ops->mo_fd_isset(ctx, fds);
-	errno = ENOSYS;
-	return -1;
-}
-
-
-int
-msg_fd_clr(msgctx_t *ctx, fd_set *fds)
-{
-	errno = EINVAL;
-	if (!ctx)
-		return -1;
-	
-	if (ctx->ops && ctx->ops->mo_fd_clr)
-		return ctx->ops->mo_fd_clr(ctx, fds);
-	errno = ENOSYS;
-	return -1;
-}
-
-
-/**
-  This polls the context for 'timeout' seconds waiting for data
-  to become available.  Return codes are M_DATA, M_CLOSE, and M_OPEN
-
-  M_DATA - data available
-  M_OPEN - needs msg_accept(
-  M_CLOSE - context / socket closed by remote host
-  M_NONE - nothing available
-
-  For the cluster connection, the return code could also map to one of
-  the CMAN return codes
-
-  M_STATECHANGE - node has changed state
-
- */
-int
-msg_wait(msgctx_t *ctx, int timeout)
-{
-	errno = EINVAL;
-	if (!ctx)
-		return -1;
-	
-	if (ctx->ops && ctx->ops->mo_wait)
-		return ctx->ops->mo_wait(ctx, timeout);
-	errno = ENOSYS;
-	return -1;
-}
-
-
-
-int
-msg_receive(msgctx_t *ctx, void *msg, size_t maxlen, int timeout)
-{
-	errno = EINVAL;
-	if (!ctx)
-		return -1;
-
-	if (ctx->ops && ctx->ops->mo_receive)
-		return ctx->ops->mo_receive(ctx, msg, maxlen, timeout);
-	errno = ENOSYS;
-	return -1;
-}
-
-
-/**
-  Open a connection to the specified node ID.
-  If the speficied node is 0, this connects via the socket in
-  /var/run/cluster...
- */
-int
-msg_open(int type, int nodeid, int port, msgctx_t *ctx, int timeout)
-{
-	errno = EINVAL;
-	if (!ctx)
-		return -1;
-
-	/* XXX SPECIAL CASE... ow. */
-	switch(type) {
-	case MSG_SOCKET:
-		sock_msg_init(ctx);
-		break;
-	case MSG_CLUSTER:
-		cluster_msg_init(ctx);
-		break;
-	default:
-		return -1;
-	}
-
-	/* Record where this was called, in case we have to debug */
-	ctx->sp = __builtin_return_address(0);
-
-	if (ctx->ops && ctx->ops->mo_open)
-		return ctx->ops->mo_open(ctx->type, nodeid, port, ctx, timeout);
-	errno = ENOSYS;
-	return -1;
-}
-
-
-/**
-  Close a connection context (cluster or socket; it doesn't matter)
-  In the case of a cluster context, we need to clear out the 
-  receive queue and what-not.  This isn't a big deal.  Also, we
-  need to tell the other end that we're done -- just in case it does
-  not know yet ;)
-
-  With a socket, the O/S cleans up the buffers for us.
- */
-int
-msg_close(msgctx_t *ctx)
-{
-	errno = EINVAL;
-	if (!ctx)
-		return -1;
-	if (ctx->ops && ctx->ops->mo_close)
-		return ctx->ops->mo_close(ctx);
-	errno = ENOSYS;
-	return -1;
-}
-
-
-int
-msg_accept(msgctx_t *listenctx, msgctx_t *acceptctx)
-{
-	errno = EINVAL;
-	if (!listenctx || !acceptctx)
-		return -1;
-	if (listenctx->ops && listenctx->ops->mo_accept)
-		return listenctx->ops->mo_accept(listenctx, acceptctx);
-	errno = ENOSYS;
-	return -1;
-}
-
-
-/* XXX Special case */
-int
-msg_listen(int type, void *port, int me, msgctx_t **ctx)
-{
-	errno = EINVAL;
-	if (!me)
-		return -1;
-	if (type == MSG_NONE)
-		return -1;
-	if (!ctx)
-		return -1;
-
-	if (type == MSG_CLUSTER) {
-		return cluster_msg_listen(me, port, ctx);
-	} else if (type == MSG_SOCKET) {
-		return sock_msg_listen(me, port, ctx);
-	}
-
-	return -1;
-}
-
-
-void
-msg_print(msgctx_t *ctx)
-{
-	if (!ctx) {
-		printf("Attempt to call %s on NULL\n", __FUNCTION__);
-		return;
-	}
-
-	if (ctx->ops && ctx->ops->mo_print)
-		return ctx->ops->mo_print(ctx);
-
-	printf("Warning: Attempt to call %s on uninitialized context %p\n",
-	       __FUNCTION__, ctx);
-	printf("  ctx->type = %d\n", ctx->type);
-}
-
-
-/* XXX INCOMPLETE */
-int
-msg_shutdown(void)
-{
-	sock_msg_shutdown();
-	cluster_msg_shutdown();
-
-	return 0;
-}
-
-
-inline int
-msgctx_size(void)
-{
-	return sizeof(msgctx_t);
-}
-
-
-msgctx_t *
-msg_new_ctx(void)
-{
-	msgctx_t *p;
-	
-	p = malloc(sizeof(msgctx_t));
-	if (!p)
-		return NULL;
-
-	memset(p, 0, sizeof(p));
-	p->type = MSG_NONE;
-
-	return p;
-}
-
-
-void
-msg_free_ctx(msgctx_t *dead)
-{
-	free(dead);
-}
diff --git a/rgmanager/src/clulib/msg_cluster.c b/rgmanager/src/clulib/msg_cluster.c
deleted file mode 100644
index 2481fd1..0000000
--- a/rgmanager/src/clulib/msg_cluster.c
+++ /dev/null
@@ -1,1266 +0,0 @@
-#define _MESSAGE_BUILD
-#include <message.h>
-#include <stdio.h>
-#include <pthread.h>
-#include <libcman.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>
-#include <time.h>
-#include <sys/time.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <signal.h>
-#include <signals.h>
-#include <gettid.h>
-#include <cman-private.h>
-#include <logging.h>
-
-/* Ripped from ccsd's setup_local_socket */
-
-int cluster_msg_close(msgctx_t *ctx);
-
-/* Context 0 is reserved for control messages */
-
-/* Local-ish contexts */
-static pthread_mutex_t context_lock = PTHREAD_MUTEX_INITIALIZER;
-static msgctx_t *contexts[MAX_CONTEXTS];
-static int _me = 0;
-pthread_t comms_thread;
-int thread_running = 0;
-
-#define is_established(ctx) \
-	(((ctx->type == MSG_CLUSTER) && \
- 	  (ctx->u.cluster_info.remote_ctx && \
-	   ctx->u.cluster_info.local_ctx)) || \
-	 ((ctx->type == MSG_SOCKET) && \
-	  (ctx->u.local_info.sockfd != -1)))
-
-static msg_ops_t cluster_msg_ops;
-static void cluster_msg_print(msgctx_t *ctx);
-
-
-#define proto_error(ctx, msg, str) \
-do { \
-	printf("<<< CUT HERE >>>\n"); \
-	printf("[%d] PROTOCOL ERROR in %s: %s\n", gettid(), __FUNCTION__, str); \
-	msg_print(ctx); \
-	if (msg) { \
-	printf("  msg->msg_control = %d\n", ((cluster_msg_hdr_t *)msg)->msg_control); \
-	printf("  msg->src_ctx = %d\n", ((cluster_msg_hdr_t *)msg)->src_ctx); \
-	printf("  msg->dest_ctx = %d\n",  ((cluster_msg_hdr_t *)msg)->dest_ctx); \
-	printf("  msg->src_nodeid = %d\n",  ((cluster_msg_hdr_t *)msg)->src_nodeid); \
-	printf("  msg->msg_port = %d\n",  ((cluster_msg_hdr_t *)msg)->msg_port); \
-	} \
-	printf(">>> CUT HERE <<<\n"); \
-} while(0)
-
-
-
-static int
-cluster_msg_send(msgctx_t *ctx, void *msg, size_t len)
-{
-	char ALIGNED buf[4096];
-	cluster_msg_hdr_t *h = (void *)buf;
-	char *msgptr = (buf + sizeof(*h));
-	int ret;
-
-	errno = EINVAL;
-	if (ctx->type != MSG_CLUSTER)
-		return -1;
-	if (!(ctx->flags & SKF_WRITE))
-		return -1;
-	if ((len + sizeof(*h)) > sizeof(buf)) {
-		errno = E2BIG;
-		return -1;
-	}
-
-	h->msg_control = M_DATA;
-	h->dest_nodeid = ctx->u.cluster_info.nodeid;
-	h->src_ctx = ctx->u.cluster_info.local_ctx;
-	h->dest_ctx = ctx->u.cluster_info.remote_ctx;
-	h->msg_port = ctx->u.cluster_info.port;
-	memcpy(msgptr, msg, len);
-	h->src_nodeid = _me;
-
-	/*
-	printf("sending cluster message, length = %d to nodeid %d port %d\n",
-	       len + sizeof(*h), ctx->u.cluster_info.nodeid,
-	       ctx->u.cluster_info.port);
-	 */
-
-	swab_cluster_msg_hdr_t(h);
-
-	ret = cman_send_data_unlocked((void *)h, len + sizeof(*h), 0,
-			       ctx->u.cluster_info.port,
-			       ctx->u.cluster_info.nodeid);
-
-	if (ret < 0)
-		return ret;
-
-	if (ret >= (len + sizeof(*h)))
-		return len;
-
-	errno = EAGAIN;
-	return -1;
-}
-
-
-/**
-  Assign a (free) cluster context ID if possible
- */
-static int
-assign_ctx(msgctx_t *ctx)
-{
-	int start;
-	static uint32_t context_index = 1;
-
-	/* Assign context index */
-	pthread_mutex_lock(&context_lock);
-
-	start = context_index;
-	do {
-		context_index++;
-		if (context_index >= MAX_CONTEXTS)
-			context_index = 1;
-
-		if (!contexts[context_index]) {
-			contexts[context_index] = ctx;
-			ctx->u.cluster_info.local_ctx = context_index;
-			pthread_mutex_unlock(&context_lock);
-			return 0;
-		}
-	} while (context_index != start);
-	
-	pthread_mutex_unlock(&context_lock);
-
-	errno = EAGAIN;
-	return -1;
-}
-
-
-/* See if anything's on the cluster socket.  If so, dispatch it
-   on to the requisite queues
-   XXX should be passed a connection arg! */
-static int
-poll_cluster_messages(int timeout)
-{
-	int ret = -1;
-	fd_set rfds;
-	int fd, lfd, max;
-	struct timeval tv;
-	struct timeval *p = NULL;
-	cman_handle_t ch;
-
-	if (timeout >= 0) {
-		p = &tv;
-		tv.tv_sec = tv.tv_usec = timeout;
-	}
-
-	FD_ZERO(&rfds);
-
-	/* This sucks - it could cause other threads trying to get a
-	   membership list to block for a long time.  Now, that should not
-	   happen.  Basically, when we get a membership event, we generate 
-	   a new membership list in a locally cached copy and reference
-	   that.
-
-	 */
-	ch = cman_lock_preemptible(1, &lfd);
-	if (!ch) {
-		printf("%s\n", strerror(errno));
-	}
-
-	fd = cman_get_fd(ch);
-	if (fd < 0) {
-		cman_unlock(ch);
-		return 0;
-	}
-	FD_SET(fd, &rfds);
-	FD_SET(lfd, &rfds);
-
-	max = (lfd > fd ? lfd : fd);
-	if (select(max + 1, &rfds, NULL, NULL, p) > 0) {
-		/* Someone woke us up */
-		if (FD_ISSET(lfd, &rfds)) {
-			cman_unlock(ch);
-			errno = EAGAIN;
-			return -1;
-		}
-
-		cman_dispatch(ch, 0);
-		ret = 0;
-	}
-	cman_unlock(ch);
-
-	return ret;
-}
-
-
-/**
-  This is used to establish and tear down pseudo-private
-  contexts which are shared with the cluster context.
- */
-static int
-cluster_send_control_msg(msgctx_t *ctx, int type)
-{
-	cluster_msg_hdr_t cm;
-	int ret;
-
-	cm.msg_control = (uint8_t)type;
-	cm.dest_nodeid = ctx->u.cluster_info.nodeid;
-	cm.src_nodeid = _me;
-	cm.dest_ctx = ctx->u.cluster_info.remote_ctx;
-	cm.src_ctx = ctx->u.cluster_info.local_ctx;
-	cm.msg_port = ctx->u.cluster_info.port;
-
-	swab_cluster_msg_hdr_t(&cm);
-
-	ret = (cman_send_data_unlocked((void *)&cm, sizeof(cm), 0,
-			       ctx->u.cluster_info.port,
-			       ctx->u.cluster_info.nodeid) );
-	return ret;
-}
-
-
-/**
-  Wait for a message on a context.
- */
-static int
-cluster_msg_wait(msgctx_t *ctx, int timeout)
-{
-	struct timespec ts = {0, 0};
-	struct timeval tv = {0, 0};
-	int req = M_NONE;
-	int e;
-
-	errno = EINVAL;
-	if (!ctx)
-		return -1;
-	if (ctx->type != MSG_CLUSTER)
-		return -1;
-	if (!(ctx->flags & (SKF_READ | SKF_LISTEN)))
-		return -1;
-
-	if (timeout > 0) {
-		gettimeofday(&tv, NULL);
-		ts.tv_sec = tv.tv_sec + timeout;
-		ts.tv_nsec = tv.tv_usec * 1000;
-	}
-
-	pthread_mutex_lock(&ctx->u.cluster_info.mutex);
-	while (1) {
-
-		/* See if we dispatched any messages on to our queue */
-		if (ctx->u.cluster_info.queue) {
-			req = ctx->u.cluster_info.queue->message->msg_control;
-			/*printf("Queue not empty CTX%d : %d\n",
-			  	 ctx->u.cluster_info.local_ctx, req);*/
-			break;
-		}
-
-		/* Ok, someone else has the mutex on our FD.  Go to
-	   	   sleep on a cond; maybe they'll wake us up */
-		e = pthread_cond_timedwait(&ctx->u.cluster_info.cond,
-		    			   &ctx->u.cluster_info.mutex,
-		   			   &ts);
-
-		if (timeout == 0) {
-			break;
-		}
-
-		if (e == 0) {
-			continue;
-		}
-
-		if (e == ETIMEDOUT) {
-			break;
-		}
-	}
-	pthread_mutex_unlock(&ctx->u.cluster_info.mutex);
-
-	return req;
-}
-
-
-static int
-cluster_msg_fd_set(msgctx_t *ctx, fd_set *fds, int *max)
-{
-	int e;
-	msg_q_t *n;
-	
-	errno = EINVAL;
-	if (!ctx || !fds)
-		return -1;
-	if (ctx->type != MSG_CLUSTER)
-		return -1;
-
-	pthread_mutex_lock(&ctx->u.cluster_info.mutex);
-	if (ctx->u.cluster_info.select_pipe[0] < 0) {
-		if (pipe(ctx->u.cluster_info.select_pipe) < 0) {
-			e = errno;
-			pthread_mutex_unlock(&ctx->u.cluster_info.mutex);
-			errno = e;
-			return -1;
-		}
-
-		/*
-		printf("%s: Created cluster CTX select pipe "
-		       "rd=%d wr=%d\n", __FUNCTION__,
-		       ctx->u.cluster_info.select_pipe[0],
-		       ctx->u.cluster_info.select_pipe[1]);
-		 */
-
-		/* Ok, we just created the pipe.  Now, we need to write
-		   a char for every unprocessed event to the pipe, because
-		   events could be pending that would otherwise be unhandled
-		   by the caller because the caller is switching to select()
-		   semantics. (as opposed to msg_wait() ) */
-		list_do(&ctx->u.cluster_info.queue, n) {
-			if (write(ctx->u.cluster_info.select_pipe[1], "", 1) < 0) {
-				e = errno;
-				pthread_mutex_unlock(&ctx->u.cluster_info.mutex);
-				errno = e;
-				return -1;
-			}
-		} while (!list_done(&ctx->u.cluster_info.queue, n));
-	}
-
-	e = ctx->u.cluster_info.select_pipe[0];
-	//printf("%s: cluster %d\n", __FUNCTION__,  e);
-	FD_SET(e, fds);
-
-	pthread_mutex_unlock(&ctx->u.cluster_info.mutex);
-
-	if (max && (e > *max))
-		*max = e;
-	return 0;
-}
-
-
-int
-cluster_msg_fd_isset(msgctx_t *ctx, fd_set *fds)
-{
-	errno = EINVAL;
-
-	if (!fds || !ctx)
-		return -1;
-
-	if (ctx->type != MSG_CLUSTER)
-		return -1;
-
-	pthread_mutex_lock(&ctx->u.cluster_info.mutex);
-	if (ctx->u.cluster_info.select_pipe[0] >= 0 &&
-	    FD_ISSET(ctx->u.cluster_info.select_pipe[0], fds)) {
-		pthread_mutex_unlock(&ctx->u.cluster_info.mutex);
-		return 1;
-	}
-	pthread_mutex_unlock(&ctx->u.cluster_info.mutex);
-	return 0;
-}
-
-
-int
-cluster_msg_fd_clr(msgctx_t *ctx, fd_set *fds)
-{
-	errno = EINVAL;
-
-	if (!fds || !ctx)
-		return -1;
-
-	if (ctx->type != MSG_CLUSTER)
-		return -1;
-
-	pthread_mutex_lock(&ctx->u.cluster_info.mutex);
-	if (ctx->u.cluster_info.select_pipe[0] >= 0) {
-	    	FD_CLR(ctx->u.cluster_info.select_pipe[0], fds);
-		pthread_mutex_unlock(&ctx->u.cluster_info.mutex);
-		return 1;
-	}
-	pthread_mutex_unlock(&ctx->u.cluster_info.mutex);
-	return 0;
-}
-
-
-static int
-_cluster_msg_receive(msgctx_t *ctx, void **msg, size_t *len)
-{
-	cluster_msg_hdr_t *m;
-	msg_q_t *n;
-	int ret = 0;
-	char foo;
-
-	if (msg)
-		*msg = NULL;
-	if (len)
-		*len = 0;
-
-	if (ctx->u.cluster_info.local_ctx < 0 ||
-	    ctx->u.cluster_info.local_ctx >= MAX_CONTEXTS) {
-		errno = EBADF;
-		return -1;
-	}
-
-	/* trigger receive here */
-	pthread_mutex_lock(&ctx->u.cluster_info.mutex);
-
-	n = ctx->u.cluster_info.queue;
-	if (n == NULL) {
-		pthread_mutex_unlock(&ctx->u.cluster_info.mutex);
-		errno = EAGAIN;
-		return -1;
-	}
-
-	list_remove(&ctx->u.cluster_info.queue, n);
-
-	if (ctx->u.cluster_info.select_pipe[0] >= 0) {
-		//printf("%s read\n", __FUNCTION__);
-		if (read(ctx->u.cluster_info.select_pipe[0], &foo, 1) < 0) {
-			pthread_mutex_unlock(&ctx->u.cluster_info.mutex);
-			return -1;
-		}
-	}
-
-	pthread_mutex_unlock(&ctx->u.cluster_info.mutex);
-
-	m = n->message;
-	switch(m->msg_control) {
-	case M_CLOSE:
-		ctx->u.cluster_info.remote_ctx = 0;
-		break;
-	case M_OPEN_ACK:
-		/* Response to new connection */
-		ctx->u.cluster_info.remote_ctx = m->src_ctx;
-		break;
-	case M_DATA:
-		/* Kill the message control structure */
-		memmove(m, &m[1], n->len - sizeof(*m));
-		if (msg)
-			*msg = (void *)m;
-		else {
-			printf("Warning: dropping data message\n");
-			free(m);
-		}
-		if (len)
-			*len = (n->len - sizeof(*m));
-		ret = (n->len - sizeof(*m));
-		free(n);
-
-		//printf("Message received\n");
-		return ret;
-	case M_OPEN:
-		/* Someone is trying to open a connection */
-	default:
-		/* ?!! */
-		ret = -1;
-		break;
-	}
-
-	free(m);
-	free(n);
-
-	return ret;
-}
-
-
-/**
-  Receive a message from a cluster-context.  This copies out the contents
-  into the user-specified buffer, and does random other things.
- */
-static int
-cluster_msg_receive(msgctx_t *ctx, void *msg, size_t maxlen, int timeout)
-{
-	int req;
-	msg_q_t *n;
-	void *priv_msg;
-	size_t priv_len;
-	char foo;
-
-	errno = EINVAL;
-	if (!ctx)
-		return -1;
-	if (!(ctx->flags & SKF_READ))
-		return -1;
-
-	req = cluster_msg_wait(ctx, timeout);
-
-	switch (req) {
-	case M_DATA:
-		/* Copy out. */
-		req = _cluster_msg_receive(ctx, &priv_msg, &priv_len);
-		if (req < 0) {
-			printf("Ruh roh!\n");
-			return -1;
-		}
-
-		priv_len = (priv_len < maxlen ? priv_len : maxlen);
-
-		if (msg && maxlen)
-			memcpy(msg, priv_msg, priv_len);
-		free(priv_msg);
-		return req;
-	case M_CLOSE:
-		errno = ECONNRESET;
-		return -1;
-	case 0:
-		//printf("Nothing on queue\n");
-		return 0;
-	case M_STATECHANGE:
-	case M_PORTOPENED:
-	case M_PORTCLOSED:
-	case M_TRY_SHUTDOWN:
-	case M_CONFIG_UPDATE:
-		pthread_mutex_lock(&ctx->u.cluster_info.mutex);
-
-		n = ctx->u.cluster_info.queue;
-		if (n == NULL) {
-			pthread_mutex_unlock(&ctx->u.cluster_info.mutex);
-			errno = EAGAIN;
-			return -1;
-		}
-
-		list_remove(&ctx->u.cluster_info.queue, n);
-
-		if (ctx->u.cluster_info.select_pipe[0] >= 0) {
-			//printf("%s read\n", __FUNCTION__);
-			if (read(ctx->u.cluster_info.select_pipe[0], &foo, 1) < 0) {
-				pthread_mutex_unlock(&ctx->u.cluster_info.mutex);
-				return -1;
-			}
-		}
-	
-		pthread_mutex_unlock(&ctx->u.cluster_info.mutex);
-
-		if (n->message)
-			free(n->message);
-		free(n);
-		return 0;
-	default:
-		pthread_mutex_lock(&ctx->u.cluster_info.mutex);
-		n = ctx->u.cluster_info.queue;
-		list_remove(&ctx->u.cluster_info.queue, n);
-		pthread_mutex_unlock(&ctx->u.cluster_info.mutex);
-
-		proto_error(ctx, n->message, "Illegal request on established pchannel");
-		if (n->message)
-			free(n->message);
-		free(n);
-		return -1;
-	}
-
-	printf("%s: CODE PATH ERROR\n", __FUNCTION__);
-	return -1;
-}
-
-
-/**
-  Open a connection to the specified node ID.
-  If the speficied node is 0, this connects via the socket in
-  /var/run/cluster...
- */
-static int
-cluster_msg_open(int type, int nodeid, int port, msgctx_t *ctx, int timeout)
-{
-	int t = 0, ret;
-
-	errno = EINVAL;
-	if (!ctx)
-		return -1;
-
-	if (type != MSG_CLUSTER)
-		return -1;
-
-	/*printf("Opening pseudo channel to node %d\n", nodeid);*/
-	
-	ctx->type = MSG_CLUSTER;
-	ctx->ops = &cluster_msg_ops;
-	ctx->flags = 0;
-	ctx->u.cluster_info.nodeid = nodeid;
-	ctx->u.cluster_info.port = port;
-	ctx->u.cluster_info.local_ctx = -1;
-	ctx->u.cluster_info.remote_ctx = 0;
-	ctx->u.cluster_info.queue = NULL;
-
-	pthread_mutex_init(&ctx->u.cluster_info.mutex, NULL);
-	pthread_cond_init(&ctx->u.cluster_info.cond, NULL);
-
-	/* Assign context index */
-	if (assign_ctx(ctx) < 0) {
-		errno = EAGAIN;
-		return -1;
-	}
-	ctx->flags = SKF_READ | SKF_WRITE;
-
-	if (nodeid == CMAN_NODEID_US) {
-		/* Broadcast pseudo ctx; no handshake needed */
-		ctx->flags |= SKF_MCAST;
-		return 0;
-	}
-
-	//printf("  Local CTX: %d\n", ctx->u.cluster_info.local_ctx);
-
-	/* Send open */
-	//printf("  Sending control message M_OPEN\n");
-	if (cluster_send_control_msg(ctx, M_OPEN) < 0) {
-		printf("Error sending control message: %s\n", strerror(errno));
-		cluster_msg_close(ctx);
-		return -1;
-	}
-
-	/* Ok, wait for a response */
-	while (!is_established(ctx)) {
-		++t;
-		if (t > timeout) {
-			cluster_msg_close(ctx);
-			errno = ETIMEDOUT;
-			return -1;
-		}
-			
-		ret = cluster_msg_wait(ctx, 1);
-		switch(ret) {
-		case M_OPEN_ACK:
-			_cluster_msg_receive(ctx, NULL, NULL);
-			break;
-		case M_NONE:
-			continue;
-		default: 
-			proto_error(ctx, NULL, "M_OPEN_ACK not received\n");
-		}
-	}
-
-	/*	
-	printf("  Remote CTX: %d\n",
-	       ctx->u.cluster_info.remote_ctx);
-	printf("  Pseudo channel established!\n");
-	*/
-	return 0;
-}
-
-
-/**
-  Close a connection context (cluster or socket; it doesn't matter)
-  In the case of a cluster context, we need to clear out the 
-  receive queue and what-not.  This isn't a big deal.  Also, we
-  need to tell the other end that we're done -- just in case it does
-  not know yet ;)
-
-  With a socket, the O/S cleans up the buffers for us.
- */
-int
-cluster_msg_close(msgctx_t *ctx)
-{
-	msg_q_t *n = NULL;
-
-	errno = EINVAL;
-
-	if (!ctx)
-		return -1;
-	if (ctx->type != MSG_CLUSTER)
-		return -1;
-
-	if (ctx->u.cluster_info.local_ctx >= MAX_CONTEXTS) {
-		printf("Context invalid during close\n");
-		return -1;
-	}
-
-
-	pthread_mutex_lock(&context_lock);
-	/* Other threads should not be able to see this again */
-	if (contexts[ctx->u.cluster_info.local_ctx] &&
-	    (contexts[ctx->u.cluster_info.local_ctx]->u.cluster_info.local_ctx ==
-                ctx->u.cluster_info.local_ctx)) {
-		//printf("reclaimed context %d\n", 
-			//ctx->u.cluster_info.local_ctx);
-		contexts[ctx->u.cluster_info.local_ctx] = NULL;
-	}
-	pthread_mutex_unlock(&context_lock);
-
-	/* Clear receive queue */
-	while ((n = ctx->u.cluster_info.queue) != NULL) {
-		list_remove(&ctx->u.cluster_info.queue, n);
-		free(n->message);
-		free(n);
-	}
-	/* Send close message */
-	if (ctx->u.cluster_info.remote_ctx != 0) {
-		cluster_send_control_msg(ctx, M_CLOSE);
-	}
-
-	/* Close pipe if it's open */
-	if (ctx->u.cluster_info.select_pipe[0] >= 0) {
-		close(ctx->u.cluster_info.select_pipe[0]);
-		ctx->u.cluster_info.select_pipe[0] = -1;
-	}
-	if (ctx->u.cluster_info.select_pipe[1] >= 0) {
-		close(ctx->u.cluster_info.select_pipe[1]);
-		ctx->u.cluster_info.select_pipe[1] = -1;
-	}
-	ctx->type = MSG_NONE;
-	ctx->ops = NULL;
-
-
-	return 0;
-}
-
-
-static void 
-queue_for_context(msgctx_t *ctx, char *buf, int len)
-{
-	msg_q_t *node;
-
-	if (ctx->type != MSG_CLUSTER) {
-		logt_print(LOG_WARNING, "%s called on invalid context %p\n",
-		       __FUNCTION__, ctx);
-		return;
-	}
-
-	while ((node = malloc(sizeof(*node))) == NULL) {
-		sleep(1);
-	}
-	memset(node, 0, sizeof(*node));
-	while ((node->message = malloc(len)) == NULL) {
-		sleep(1);
-	}
-	memcpy(node->message, buf, len);
-	node->len = len;
-
-	pthread_mutex_lock(&ctx->u.cluster_info.mutex);
-	list_insert(&ctx->u.cluster_info.queue, node);
-	/* If a select pipe was set up, wake it up */
-	if (ctx->u.cluster_info.select_pipe[1] >= 0) {
-		//printf("QUEUE_FOR_CONTEXT write\n");
-		if (write(ctx->u.cluster_info.select_pipe[1], "", 1) < 0)
-			perror("queue_for_context write");
-	}
-	pthread_mutex_unlock(&ctx->u.cluster_info.mutex);
-	pthread_cond_signal(&ctx->u.cluster_info.cond);
-}
-
-
-/**
-  Called by cman_dispatch to deal with messages coming across the
-  cluster socket.  This function deals with fanning out the requests
-  and putting them on the per-context queues.  We don't have
-  the benefits of pre-configured buffers, so we need this.
- */
-static void
-process_cman_msg(cman_handle_t h, void *priv, char *buf, int len,
-	    uint8_t port, int nodeid)
-{
-	cluster_msg_hdr_t *m = (cluster_msg_hdr_t *)buf;
-	int x;
-
-	if (len < sizeof(*m)) {
-		printf("Message too short.\n");
-		return;
-	}
-
-	swab_cluster_msg_hdr_t(m);
-
-#ifdef DEBUG
-	printf("Processing ");
-	switch(m->msg_control) {
-	case M_NONE: 
-		printf("M_NONE\n");
-		break;
-	case M_OPEN:
-		printf("M_OPEN\n");
-		break;
-	case M_OPEN_ACK: 
-		printf("M_OPEN_ACK\n");
-		break;
-	case M_DATA: 
-		printf("M_DATA\n");
-		break;
-	case M_CLOSE: 
-		printf("M_CLOSE\n");
-		break;
-	}
-
-	printf("  Node ID: %d %d\n", m->src_nodeid, nodeid);
-	printf("  Remote CTX: %d  Local CTX: %d\n", m->src_ctx, m->dest_ctx);
-#endif
-
-	if (m->dest_ctx >= MAX_CONTEXTS || m->dest_ctx < 0) {
-		printf("Context invalid; ignoring\n");
-		return;
-	}
-
-	if (m->dest_nodeid != 0 && m->dest_nodeid != _me) {
-#ifdef DEBUG
-		printf("Skipping message meant for node %d (I am %d)\n",
-		       m->dest_nodeid, _me);
-#endif
-		return;
-	}
-
-	pthread_mutex_lock(&context_lock);
-
-	if (m->dest_ctx == 0 && m->msg_control == M_DATA) {
-		/* Copy & place on all broadcast queues if it's a broadcast
-		   M_DATA message... */
-		for (x = 0; x < MAX_CONTEXTS; x++) {
-			if (!contexts[x])
-				continue;
-			if (contexts[x]->type != MSG_CLUSTER)
-				continue;
-			if (!(contexts[x]->flags & SKF_MCAST))
-				continue;
-			if (!(contexts[x]->flags & SKF_READ))
-				continue;
-
-			queue_for_context(contexts[x], buf, len);
-		}
-	} else if (contexts[m->dest_ctx]) {
-
-#if 0
-		if (m->msg_control == M_OPEN_ACK) {
-			for (x = 0; x < MAX_CONTEXTS; x++) {
-				if (contexts[x] &&
-				    contexts[x]->dest_ctx == m->src_ctx) {
-					proto_error(contexts[x], m,
-						"Duplicate M_OPEN_ACK");
-				}
-			}
-		}
-#endif
-		if (m->msg_control == M_CLOSE &&
-		    contexts[m->dest_ctx]->type != MSG_CLUSTER) {
-			/* XXX Work around bug where M_CLOSE is called
-			   on a context which has been destroyed */
-			logt_print(LOG_WARNING, "Ignoring M_CLOSE for destroyed "
-			       "context %d\n", m->dest_ctx);
-		} else {
-			queue_for_context(contexts[m->dest_ctx], buf, len);
-		}
-	}
-	/* If none of the above, then we msg for something we've already
-	   detached from our list.  No big deal, just ignore. */
-
-	pthread_mutex_unlock(&context_lock);
-	return;
-}
-
-
-/**
-  Accept a new pseudo-private connection coming in over the
-  cluster socket.
- */
-static int
-cluster_msg_accept(msgctx_t *listenctx, msgctx_t *acceptctx)
-{
-	errno = EINVAL;
-	cluster_msg_hdr_t *m;
-	msg_q_t *n;
-	char foo;
-	int err = 0;
-
-	if (!listenctx || !acceptctx)
-		return -1;
-	if (listenctx->u.cluster_info.local_ctx != 0)
-		return -1;
-	if (!(listenctx->flags & SKF_LISTEN))
-		return -1;
-
-	listenctx->ops->mo_init(acceptctx);
-
-	pthread_mutex_lock(&listenctx->u.cluster_info.mutex);
-
-	n = listenctx->u.cluster_info.queue;
-	if (n == NULL) {
-		pthread_mutex_unlock(&listenctx->u.cluster_info.mutex);
-		errno = EAGAIN;
-		return -1;
-	}
-
-	/* the OPEN should be the first thing on the list; this loop
-	   is probably not necessary */
-	list_do(&listenctx->u.cluster_info.queue, n) {
-
-		m = n->message;
-		switch(m->msg_control) {
-		case M_OPEN:
-			/* XXX make this case statement its own function or at 
-			   least make it not a big case block . */
-			list_remove(&listenctx->u.cluster_info.queue, n);
-			/*printf("Accepting connection from %d %d\n",
-			  	 m->src_nodeid, m->src_ctx);*/
-
-			/* Release lock on listen context queue; we're done
-			   with it at this point */
-			pthread_mutex_unlock(&listenctx->u.cluster_info.mutex);
-
-			/* New connection: first, create + lock the mutex */
-			pthread_mutex_init(&acceptctx->u.cluster_info.mutex,
-					   NULL);
-			/* Lock this while we finish initializing */
-			pthread_mutex_lock(&acceptctx->u.cluster_info.mutex);
-
-			pthread_cond_init(&acceptctx->u.cluster_info.cond,
-					  NULL);
-
-			acceptctx->u.cluster_info.queue = NULL;
-			acceptctx->u.cluster_info.remote_ctx = m->src_ctx;
-			acceptctx->u.cluster_info.nodeid = m->src_nodeid;
-			acceptctx->u.cluster_info.port = m->msg_port;
-			acceptctx->flags = (SKF_READ | SKF_WRITE);
-
-			/* assign_ctx requires the context lock.  We need to 
-			ensure we don't try to take the context lock w/ a local
-			queue lock held on a context that's in progress (i.e.
-			the global cluster context...) */
-			if (assign_ctx(acceptctx) < 0)
-				printf("FAILED TO ASSIGN CONTEXT\n");
-
-			cluster_send_control_msg(acceptctx, M_OPEN_ACK);
-
-			if (listenctx->u.cluster_info.select_pipe[0] >= 0) {
-				//printf("%s read\n", __FUNCTION__);
-				if (read(listenctx->u.cluster_info.select_pipe[0], &foo, 1) < 0)
-					err = -1;
-			}
-
-			free(m);
-			free(n);
-
-			/* Let the new context go. */
-			pthread_mutex_unlock(&acceptctx->u.cluster_info.mutex);
-			return err;
-			/* notreached */
-
-		case M_DATA:
-			/* Data messages (i.e. from broadcast msgs) are
-			   okay too!...  but we don't handle them here */
-			break;
-		default:
-			/* Other message?! */
-			printf("Odd... %d\n", m->msg_control);
-			break;
-		}
-
-	} while (!list_done(&listenctx->u.cluster_info.queue, n));
-
-	pthread_mutex_unlock(&listenctx->u.cluster_info.mutex);
-
-	return 0;
-}
-
-
-/**
-  This waits for events on the cluster comms FD and
-  dispatches them using cman_dispatch.  Initially,
-  the design had no permanent threads, but that model
-  proved difficult to implement correctly.
- */
-static void *
-cluster_comms_thread(void *arg)
-{
-	/* SIGUSR2 will cause select() to abort */
-	while (thread_running) {
-		poll_cluster_messages(2);
-	}
-
-	pthread_exit(NULL);
-}
-
-
-/*
-   Transliterates a CMAN event to a control message
- */
-static void
-process_cman_event(cman_handle_t handle, void *private, int reason, int arg)
-{
-	cluster_msg_hdr_t *msg;
-	int *argp;
-	msg_q_t *node;
-	msgctx_t *ctx;
-
-#if 0
-	printf("EVENT: %p %p %d %d\n", handle, private, reason, arg);
-#endif
-
-	/* Allocate queue node */
-	while ((node = malloc(sizeof(*node))) == NULL) {
-		sleep(1);
-	}
-	memset(node, 0, sizeof(*node));
-
-	/* Allocate message: header + int (for arg) */
-	while ((msg = malloc(sizeof(int)*2 +
-			     sizeof(cluster_msg_hdr_t))) == NULL) {
-		sleep(1);
-	}
-	memset(msg, 0, sizeof(int)*2 +sizeof(cluster_msg_hdr_t));
-
-	switch(reason) {
-#if defined(LIBCMAN_VERSION)
-#if LIBCMAN_VERSION >= 2
-	case CMAN_REASON_PORTOPENED:
-		msg->msg_control = M_PORTOPENED;
-		break;
-	case CMAN_REASON_TRY_SHUTDOWN:
-		msg->msg_control = M_TRY_SHUTDOWN;
-		break;
-#if LIBCMAN_VERSION >= 3
-	case CMAN_REASON_CONFIG_UPDATE:
-		msg->msg_control = M_CONFIG_UPDATE;
-#ifdef DEBUG
-		printf("M_CONFIG_UPDATE received!\n");
-#endif
-		break;
-#endif /* >= 3 */
-#endif /* >= 2 */
-#endif /* defined... */
-	case CMAN_REASON_PORTCLOSED:
-		msg->msg_control = M_PORTCLOSED;
-		break;
-	case CMAN_REASON_STATECHANGE:
-		msg->msg_control = M_STATECHANGE;
-		break;
-	}
-
-	argp = ((void *)msg + sizeof(cluster_msg_hdr_t));
-	*argp = arg;
-
-	node->len = sizeof(cluster_msg_hdr_t) + sizeof(int);
-	node->message = msg;
-
-	pthread_mutex_lock(&context_lock);
-	ctx = contexts[0]; /* This is the cluster context... */
-	if (!ctx) {
-		/* We received a close for something we've already
-		   detached from our list.  No big deal, just
-		   ignore. */
-		free(node->message);
-		free(node);
-		pthread_mutex_unlock(&context_lock);
-		return;
-	}
-	pthread_mutex_unlock(&context_lock);
-
-	pthread_mutex_lock(&ctx->u.cluster_info.mutex);
-	list_insert(&ctx->u.cluster_info.queue, node);
-	/* If a select pipe was set up, wake it up */
-	if (ctx->u.cluster_info.select_pipe[1] >= 0) {
-		//printf("PROCESS_CMAN_EVENT write\n");
-		if (write(ctx->u.cluster_info.select_pipe[1], "", 1) < 0)
-			perror("process_cman_event write");
-	}
-	pthread_mutex_unlock(&ctx->u.cluster_info.mutex);
-	pthread_cond_signal(&ctx->u.cluster_info.cond);
-}
-
-
-/* */
-int
-cluster_msg_listen(int me, void *portp, msgctx_t **cluster_ctx)
-{
-	int e;
-	pthread_attr_t attrs;
-	cman_handle_t ch = NULL;
-	msgctx_t *ctx;
-	uint8_t port;
-
-	errno = EINVAL;
-	if (!portp)
-		return -1;
-	port = *(uint8_t *)portp;
-	if (port < 10 || port > 254)
-		return -1;
-
-	ch = cman_lock(1, 0);
-	_me = me;
-
-	/* Set up cluster context */
-	ctx = msg_new_ctx();
-	if (!ctx) {
-		cman_unlock(ch);
-		errno = EINVAL;
-		return -1;
-	}
-
-	memset(contexts, 0, sizeof(contexts));
-
-	if (cman_start_recv_data(ch, process_cman_msg, port) != 0) {
-		e = errno;
-		cman_unlock(ch);
-		msg_free_ctx((msgctx_t *)ctx);
-
-		printf("Doom\n");
-		errno = e;
-		return -1;
-	}
-
-	if (cman_start_notification(ch, process_cman_event) != 0) {
-		e = errno;
-		cman_unlock(ch);
-		msg_free_ctx((msgctx_t *)ctx);
-		errno = e;
-		return -1;
-	}
-
-	cman_unlock(ch);
-	/* Done with CMAN bits */
-
-	pthread_mutex_lock(&context_lock);
-
-	memset(contexts, 0, sizeof(contexts));
-	contexts[0] = ctx;
-
-	ctx->type = MSG_CLUSTER;
-	ctx->ops = &cluster_msg_ops;
-	ctx->u.cluster_info.local_ctx = 0;
-	ctx->u.cluster_info.remote_ctx = 0;
-	ctx->u.cluster_info.port = port; /* port! */
-	ctx->u.cluster_info.nodeid = 0; /* Broadcast! */
-	ctx->u.cluster_info.select_pipe[0] = -1;
-	ctx->u.cluster_info.select_pipe[1] = -1;
-	ctx->u.cluster_info.queue = NULL;
-	pthread_mutex_init(&ctx->u.cluster_info.mutex, NULL);
-	pthread_cond_init(&ctx->u.cluster_info.cond, NULL);
-	ctx->flags = SKF_LISTEN | SKF_READ | SKF_WRITE | SKF_MCAST;
-	pthread_mutex_unlock(&context_lock);
-
-	*cluster_ctx = ctx;
-
-       	pthread_attr_init(&attrs);
-       	pthread_attr_setinheritsched(&attrs, PTHREAD_INHERIT_SCHED);
-       	/*pthread_attr_setdetachstate(&attrs, PTHREAD_CREATE_DETACHED);*/
-
-	thread_running = 1;	
-	pthread_create(&comms_thread, &attrs, cluster_comms_thread, NULL);
-
-	pthread_attr_destroy(&attrs);
-
-	return 0;
-}
-
-
-static void
-cluster_msg_print(msgctx_t *ctx)
-{
-	if (!ctx)
-		return;
-
-	printf("Cluster Message Context %p\n", ctx);
-	printf("  Flags %08x\n", ctx->flags);
-	printf("  Node ID %d\n", ctx->u.cluster_info.nodeid);
-	printf("  Local CTX %d\n", ctx->u.cluster_info.local_ctx);
-	printf("  Remote CTX %d\n", ctx->u.cluster_info.remote_ctx);
-}
-
-
-void
-dump_cluster_ctx(FILE *fp)
-{
-	int x;
-	msgctx_t *ctx;
-
-	fprintf(fp, "CMAN/mux subsystem status\n");
-	if (thread_running) {
-		fprintf(fp, "  Thread: %d\n", (unsigned)comms_thread);
-	} else {
-		fprintf(fp, "  Thread Offline\n");
-	}
-
-	pthread_mutex_lock(&context_lock);
-	for (x = 0; x < MAX_CONTEXTS; x++) {
-		if (!contexts[x]) 
-			continue;
-		ctx = contexts[x];
-
-		fprintf(fp, "    Cluster Message Context %p\n", ctx);
-		fprintf(fp, "      Flags %08x  ", ctx->flags);
-		if (ctx->flags & SKF_READ)
-			fprintf(fp, "SKF_READ ");
-		if (ctx->flags & SKF_WRITE)
-			fprintf(fp, "SKF_WRITE ");
-		if (ctx->flags & SKF_LISTEN)
-			fprintf(fp, "SKF_LISTEN ");
-		if (ctx->flags & SKF_MCAST)
-			fprintf(fp, "SKF_MCAST ");
-		fprintf(fp, "\n");
-		fprintf(fp, "      Target node ID %d\n", ctx->u.cluster_info.nodeid);
-		fprintf(fp, "      Local Index %d\n", ctx->u.cluster_info.local_ctx);
-		fprintf(fp, "      Remote Index %d\n", ctx->u.cluster_info.remote_ctx);
-	}
-	pthread_mutex_unlock(&context_lock);
-	fprintf(fp, "\n");
-}
-
-
-int
-cluster_msg_shutdown(void)
-{
-	cman_handle_t ch;
-	cluster_msg_hdr_t m;
-	msgctx_t *ctx;
-	int x;
-
-	thread_running = 0;
-	pthread_join(comms_thread, NULL);
-
-	ch = cman_lock(1, SIGUSR2);
-	cman_end_recv_data(ch);
-	cman_unlock(ch);
-
-	/* Send close message to all open contexts */
-	memset(&m, 0, sizeof(m));
-	m.msg_control = M_CLOSE;
-
-	pthread_mutex_lock(&context_lock);
-	for (x = 0; x < MAX_CONTEXTS; x++) {
-		if (!contexts[x])
-			continue;
-
-		ctx = contexts[x];
-
-		/* Kill remote side if it exists */
-		if (is_established(ctx))
-			cluster_send_control_msg(ctx, M_CLOSE);
-
-		/* Queue close for local side */
-		queue_for_context(ctx, (void *)&m, sizeof(m));
-	}
-	pthread_mutex_unlock(&context_lock);
-
-
-	return 0;
-}
-
-
-int
-cluster_msg_init(msgctx_t *ctx)
-{
-	errno = EINVAL;
-	if (!ctx)
-		return -1;
-
-	memset(ctx, 0, sizeof(*ctx));
-	ctx->type = MSG_CLUSTER;
-	ctx->ops = &cluster_msg_ops;
-	pthread_mutex_init(&ctx->u.cluster_info.mutex, NULL);
-	pthread_cond_init(&ctx->u.cluster_info.cond, NULL);
-	ctx->u.cluster_info.select_pipe[0] = -1;
-	ctx->u.cluster_info.select_pipe[1] = -1;
-
-	return 0;
-}
-
-
-static msg_ops_t cluster_msg_ops = {
-	.mo_open = cluster_msg_open,
-	.mo_close = cluster_msg_close,
-	.mo_listen = cluster_msg_listen,
-	.mo_accept = cluster_msg_accept,
-	.mo_shutdown = cluster_msg_shutdown,
-	.mo_wait = cluster_msg_wait,
-	.mo_send = cluster_msg_send,
-	.mo_receive = cluster_msg_receive,
-	.mo_fd_set = cluster_msg_fd_set,
-	.mo_fd_isset = cluster_msg_fd_isset,
-	.mo_fd_clr = cluster_msg_fd_clr,
-	.mo_print = cluster_msg_print,
-	.mo_init = cluster_msg_init
-};
diff --git a/rgmanager/src/clulib/msg_socket.c b/rgmanager/src/clulib/msg_socket.c
deleted file mode 100644
index 6665b56..0000000
--- a/rgmanager/src/clulib/msg_socket.c
+++ /dev/null
@@ -1,426 +0,0 @@
-#define _MESSAGE_BUILD
-#include <message.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/un.h>
-#include <errno.h>
-#include <sys/time.h>
-#include <fdops.h>
-
-/* Ripped from ccsd's setup_local_socket */
-#define RGMGR_SOCK "/var/run/cluster/rgmanager.sk"
-
-static msg_ops_t sock_msg_ops;
-
-static void
-set_cloexec(int sock)
-{
-	long sock_flags;
-
-	sock_flags = fcntl(sock, F_GETFD);
-	fcntl(sock, F_SETFD, sock_flags | FD_CLOEXEC);
-}
-
-static int
-sock_connect(void)
-{
-	struct sockaddr_un sun;
-	int sock = -1, error = 0;
-
-	memset(&sun, 0, sizeof(sun));
-	sun.sun_family = PF_LOCAL;
-	snprintf(sun.sun_path, sizeof(sun.sun_path), "%s", RGMGR_SOCK);
-
-	sock = socket(PF_LOCAL, SOCK_STREAM, 0);
-	if (sock < 0) {
-		error = errno;
-		goto fail;
-	}
-
-	error = connect(sock, (struct sockaddr *)&sun, sizeof(sun));
-	if (error < 0) {
-		error = errno;
-		close(sock);
-		errno = error;
-		sock = -1;
-		goto fail;
-	}
-
-fail:
-
-	return sock;
-}
-
-
-/**
-  Wrapper around write(2)
- */
-static int
-sock_msg_send(msgctx_t *ctx, void *msg, size_t len)
-{
-	char buf[4096];
-	int ret;
-	local_msg_hdr_t *h = (local_msg_hdr_t *)buf;
-	char *msgptr = (buf + sizeof(*h));
-
-	if (!ctx)
-		return -1;
-	if (!(ctx->flags & SKF_WRITE))
-		return -1;
-
-	/* encapsulate ... ? */
-	if ((len + sizeof(*h)) > sizeof(buf)) {
-		errno = E2BIG;
-		return -1;
-	}
-
-	h->msg_control = M_DATA;
-	h->msg_len = len;
-	memcpy(msgptr, msg, len);
-
-	ret = _write_retry(ctx->u.local_info.sockfd, buf,
-			    len + sizeof(*h), NULL);
-
-	if (ret >= sizeof(*h))
-		return (ret - (sizeof(*h)));
-
-	errno = EAGAIN;
-	return -1;
-}
-
-
-static int
-peekypeeky(int fd)
-{
-	local_msg_hdr_t h;
-	int ret;
-
-	while ((ret = recv(fd, (void *)&h, sizeof(h), MSG_PEEK)) < 0) {
-		if (errno == EINTR)
-			continue;
-		return -1;
-	}
-
-	if (ret == sizeof(h))
-		return h.msg_control;
-
-	if (ret == 0)
-		/* Socket closed? */
-		return M_CLOSE;
-
-	/* XXX */
-	printf("PROTOCOL ERROR: Invalid message\n");
-	return M_CLOSE;
-}
-
-
-static int
-sock_msg_wait(msgctx_t *ctx, int timeout)
-{
-	fd_set rfds;
-	struct timeval tv = {0, 0};
-	struct timeval *p = NULL;
-
-	if (timeout >= 0) {
-		tv.tv_sec = timeout;
-		p = &tv;
-	}
-
-	FD_ZERO(&rfds);
-	FD_SET(ctx->u.local_info.sockfd, &rfds);
-
-	if (_select_retry(ctx->u.local_info.sockfd + 1, &rfds,
-			  NULL, NULL, p) == 1) {
-		return peekypeeky(ctx->u.local_info.sockfd);
-	}
-
-	return M_NONE;
-}
-
-
-static int
-sock_msg_fd_set(msgctx_t *ctx, fd_set *fds, int *max)
-{
-	errno = EINVAL;
-	if (ctx->type != MSG_SOCKET)
-		return -1;
-	if (!fds)
-		return -1;
-
-	if (ctx->u.local_info.sockfd >= 0) {
-		FD_SET(ctx->u.local_info.sockfd, fds);
-		if (ctx->u.local_info.sockfd > *max)
-			*max = ctx->u.local_info.sockfd;
-		return 0;
-	}
-
-	return -1;
-}
-
-
-static int
-sock_msg_fd_isset(msgctx_t *ctx, fd_set *fds)
-{
-	errno = EINVAL;
-	if (!fds || !ctx)
-		return -1;
-	if (ctx->type != MSG_SOCKET)
-		return -1;
-
-	if (ctx->u.local_info.sockfd >= 0 &&
-	    FD_ISSET(ctx->u.local_info.sockfd, fds)) {
-		return 1;
-	}
-	return 0;
-}
-
-
-int
-sock_msg_fd_clr(msgctx_t *ctx, fd_set *fds)
-{
-	errno = EINVAL;
-	if (!fds || !ctx)
-		return -1;
-	if (ctx->type != MSG_SOCKET)
-		return -1;
-
-	if (ctx->u.local_info.sockfd >= 0) {
-	    	FD_CLR(ctx->u.local_info.sockfd, fds);
-		return 1;
-	}
-	return 0;
-}
-
-
-static int
-_local_msg_receive(msgctx_t *ctx, void *msg, size_t maxlen, int timeout)
-{
-	struct timeval tv = {0, 0};
-	struct timeval *p = NULL;
-	local_msg_hdr_t h;
-
-	if (timeout > 0) {
-		tv.tv_sec = timeout;
-		p = &tv;
-	}
-
-	if (_read_retry(ctx->u.local_info.sockfd, &h, sizeof(h), p) < 0)
-		return -1;
-
-	if (maxlen < h.msg_len) {
-		printf("WARNING: Buffer too small for message (%d vs %d)!\n",
-			h.msg_len, (int)maxlen);
-		h.msg_len = maxlen;
-	}
-
-	return _read_retry(ctx->u.local_info.sockfd, msg, h.msg_len, p);
-}
-
-
-/**
-  Receive a message from a cluster-context.  This copies out the contents
-  into the user-specified buffer, and does random other things.
- */
-static int
-sock_msg_receive(msgctx_t *ctx, void *msg, size_t maxlen, int timeout)
-{
-	int req;
-	char priv_msg[4096];
-	size_t priv_len = sizeof(priv_msg);
-
-	errno = EINVAL;
-	if (!msg || !maxlen)
-		return -1;
-	if (ctx->type != MSG_SOCKET)
-		return -1;
-	if (!(ctx->flags & SKF_READ))
-		return -1;
-
-	req = _local_msg_receive(ctx, priv_msg, priv_len, timeout);
-
-	if (req == 0) {
-		errno = ECONNRESET;
-		return -1;
-	}
-
-	if (req < 0)
-		return -1;
-
-	/* Copy out. */
-	priv_len = (priv_len < maxlen ? priv_len : maxlen);
-
-	memcpy(msg, priv_msg, priv_len);
-	return req;
-
-	printf("%s: CODE PATH ERROR\n", __FUNCTION__);
-	return -1;
-}
-
-
-/**
-  Open a connection to the specified node ID.
-  If the speficied node is 0, this connects via the socket in
-  /var/run/cluster...
- */
-int
-sock_msg_open(int type, int nodeid, int port, msgctx_t *ctx, int timeout)
-{
-	errno = EINVAL;
-	if (!ctx || ctx->type != MSG_SOCKET)
-		return -1;
-	if (type != MSG_SOCKET)
-		return -1;
-
-	if (nodeid != CMAN_NODEID_US)
-		return -1;
-	if ((ctx->u.local_info.sockfd = sock_connect()) < 0)
-		return -1;
-	ctx->flags = (SKF_READ | SKF_WRITE);
-	return 0;
-}
-
-
-/**
-  With a socket, the O/S cleans up the buffers for us.
- */
-int
-sock_msg_close(msgctx_t *ctx)
-{
-	errno = EINVAL;
-	if (ctx->type != MSG_SOCKET)
-		return -1;
-
-	close(ctx->u.local_info.sockfd);
-	ctx->u.local_info.sockfd = -1;
-	ctx->flags = 0;
-	ctx->type = MSG_NONE;
-	return 0;
-}
-
-
-/**
-  Accept a new pseudo-private connection coming in over the
-  cluster socket.
- */
-static int
-sock_msg_accept(msgctx_t *listenctx, msgctx_t *acceptctx)
-{
-	errno = EINVAL;
-
-	if (!listenctx || !acceptctx)
-		return -1;
-	if (listenctx->u.local_info.sockfd < 0)
-		return -1;
-	if (!(listenctx->flags & SKF_LISTEN))
-		return -1;
-
-	listenctx->ops->mo_init(acceptctx);
-	acceptctx->u.local_info.sockfd =
-		accept(listenctx->u.local_info.sockfd, NULL, NULL);
-
-	if (acceptctx->u.local_info.sockfd < 0)
-		return -1;
-
-	set_cloexec(acceptctx->u.local_info.sockfd);
-
-	acceptctx->flags = (SKF_READ | SKF_WRITE);
-	return 0;
-}
-
-
-int
-sock_msg_listen(int me, void *portp, msgctx_t **listen_ctx)
-{
-	int sock;
-	struct sockaddr_un su;
-	mode_t om;
-	msgctx_t *ctx = NULL;
-	char *path = (char *)portp;
-
-	/* Set up cluster context */
-	ctx = msg_new_ctx();
-	if (!ctx)
-		return -1;
-
-	sock = socket(PF_LOCAL, SOCK_STREAM, 0);
-	if (sock < 0)
-		return -1;
-
-	set_cloexec(sock);
-	unlink(RGMGR_SOCK);
-	om = umask(077);
-	su.sun_family = PF_LOCAL;
-	snprintf(su.sun_path, sizeof(su.sun_path), "%s", path);
-
-	if (bind(sock, &su, sizeof(su)) < 0) {
-		umask(om);
-		goto fail;
-	}
-	umask(om);
-
-	if (listen(sock, SOMAXCONN) < 0)
-		goto fail;
-
-	ctx->type = MSG_SOCKET;
-	ctx->u.local_info.sockfd = sock;
-	ctx->flags = SKF_LISTEN;
-	ctx->ops = &sock_msg_ops;
-	*listen_ctx = ctx;
-	return 0;
-fail:
-	if (ctx)
-		free(ctx);
-	if (sock >= 0)
-		close(sock);
-	return -1;
-}
-
-
-/* XXX INCOMPLETE - no local_ctx setup*/
-int
-sock_msg_init(msgctx_t *ctx)
-{
-	memset(ctx,0,sizeof(*ctx));
-	ctx->type = MSG_SOCKET;
-	ctx->u.local_info.sockfd = -1;
-	ctx->ops = &sock_msg_ops;
-	return 0;
-}
-
-
-void
-sock_msg_print(msgctx_t *ctx)
-{
-	printf("Socket Message Context; fd = %d\n", ctx->u.local_info.sockfd);
-}
-
-
-/* XXX INCOMPLETE */
-int
-sock_msg_shutdown(void)
-{
-	return 0;
-}
-
-
-static msg_ops_t sock_msg_ops = {
-	.mo_open = sock_msg_open,
-	.mo_close = sock_msg_close,
-	.mo_listen = sock_msg_listen,
-	.mo_accept = sock_msg_accept,
-	.mo_shutdown = sock_msg_shutdown,
-	.mo_wait = sock_msg_wait,
-	.mo_send = sock_msg_send,
-	.mo_receive = sock_msg_receive,
-	.mo_fd_set = sock_msg_fd_set,
-	.mo_fd_isset = sock_msg_fd_isset,
-	.mo_fd_clr = sock_msg_fd_clr,
-	.mo_print = sock_msg_print,
-	.mo_init = sock_msg_init
-};
diff --git a/rgmanager/src/clulib/msgsimple.c b/rgmanager/src/clulib/msgsimple.c
deleted file mode 100644
index 0681619..0000000
--- a/rgmanager/src/clulib/msgsimple.c
+++ /dev/null
@@ -1,108 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/errno.h>
-#include <sys/socket.h>
-#include <malloc.h>
-#include <linux/limits.h>
-#include <sys/time.h>
-#include <sys/un.h>
-#include <dirent.h>
-#include <string.h>
-#include <sys/file.h>
-#include <sys/stat.h>
-#include <libgen.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <fcntl.h>
-#include <sys/syslog.h>
-#include <sys/ioctl.h>
-
-#include <message.h>
-#include <msgsimple.h>
-#include <platform.h>
-
-/*
- * msg_send_simple
- */
-int
-msg_send_simple(msgctx_t *ctx, int cmd, int arg1, int arg2)
-{
-	generic_msg_hdr msg;
-
-	msg.gh_magic = GENERIC_HDR_MAGIC;
-	msg.gh_length = sizeof (msg);
-	msg.gh_command = cmd;
-	msg.gh_arg1 = arg1;
-	msg.gh_arg2 = arg2;
-	swab_generic_msg_hdr(&msg);
-
-	return msg_send(ctx, (void *) &msg, sizeof (msg));
-}
-
-
-/*
- * receive_message
- *
- * Read a message and the corresponding buffer off of the file descriptor
- * indicated by fd.  This allocates **buf; so the user must free it when 
- * [s]he is done with it.  Also returns the length of the full buffer in
- * *buf_size.
- *
- * Returns 0 on success or -1 on failure.
- */
-int
-msg_receive_simple(msgctx_t *ctx, generic_msg_hdr ** buf, int timeout)
-{
-	int ret;
-	char msgbuf[4096];
-	generic_msg_hdr *peek_msg = (generic_msg_hdr *)msgbuf;
-
-	/*
-	 * Peek at the header.  We need the size of the inbound buffer!
-	 */
-	errno = EAGAIN;
-	ret = msg_wait(ctx, timeout);
-	if (ret == M_CLOSE) {
-		errno = ECONNRESET;
-		return -1;
-	}
-
-	ret = msg_receive(ctx, peek_msg, sizeof(msgbuf), timeout);
-
-	if (ret == -1) {
-		fprintf(stderr, "msg_receive: %s\n", strerror(errno));
-		return -1;
-	}
-
-	if (ret < sizeof(generic_msg_hdr)) {
-		fprintf(stderr, "msg_receive_simple: invalid header\n");
-		return -1;
-	}
-
-	/* Decode so we know how much to allocate */
-	swab_generic_msg_hdr(peek_msg);
-	if (peek_msg->gh_magic != GENERIC_HDR_MAGIC) {
-		fprintf(stderr, "Invalid magic: Wanted 0x%08x, got 0x%08x\n",
-		       GENERIC_HDR_MAGIC, peek_msg->gh_magic);
-		return -1;
-	}
-
-	/*
-	 * allocate enough memory to receive the header + diff buffer
-	 */
-	*buf = malloc(peek_msg->gh_length);
-	if (!*buf) {
-		fprintf(stderr, "%s: malloc: %s", __FUNCTION__,
-		       strerror(errno));
-		return -1;
-	}
-	memcpy(*buf, msgbuf, peek_msg->gh_length);
-
-	/* Put it back into the original order... */
-	swab_generic_msg_hdr((generic_msg_hdr *)(*buf));
-
-	return ret;
-}
diff --git a/rgmanager/src/clulib/msgtest.c b/rgmanager/src/clulib/msgtest.c
deleted file mode 100644
index 609cd10..0000000
--- a/rgmanager/src/clulib/msgtest.c
+++ /dev/null
@@ -1,280 +0,0 @@
-#include <message.h>
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/select.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <cman-private.h>
-
-#define MYPORT 67
-
-int my_node_id = 0;
-int running = 1;
-
-
-void
-sighandler(int sig)
-{
-	running = 0;
-}
-
-
-void *
-piggyback(void *arg)
-{
-	msgctx_t ctx;
-	char buf[4096];
-
-	if (msg_open(MSG_CLUSTER, 0, MYPORT, &ctx, 0) != 0) {
-		printf("Could not set up mcast socket!\n");
-		pthread_exit(NULL);
-	}
-
-	printf("PIGGYBACK CONTEXT\n");
-	msg_print(&ctx);
-	printf("END PIGGYBACK CONTEXT\n");
-	
-	while (running) {
-		if (msg_receive(&ctx, buf, sizeof(buf), 2) > 0) {
-			printf("Piggyback received: %s\n", buf);
-		}
-	}
-
-	msg_close(&ctx);
-
-	printf("PIGGY flies...\n");
-
-	pthread_exit(NULL);
-}
-
-
-void *
-private(void *arg)
-{
-	msgctx_t ctx;
-	char buf[4096];
-
-	while (running) {
-		sleep(3);
-
-		/* use pseudoprivate channel */
-		if (msg_open(MSG_CLUSTER, my_node_id, MYPORT, &ctx, 1) != 0) {
-			printf("Could not set up virtual-socket!\n");
-			return NULL;
-		}
-
-		printf("=== pvt thread channel info ===\n");
-		msg_print(&ctx);
-		printf("=== end pvt thread channel info ===\n");
-		fflush(stdout);
-
-		snprintf(buf, sizeof(buf), "Hello!\n");
-		msg_send(&ctx, buf, strlen(buf)+1);
-
-		if (msg_receive(&ctx, buf, sizeof(buf), 10) > 0) {
-			printf("PRIVATE: Received %s\n", buf);
-			fflush(stdout);
-		}
-
-		msg_close(&ctx);
-
-		if (msg_open(MSG_CLUSTER, 0, MYPORT, &ctx, 1) != 0) {
-			printf("Could not set up mcast socket!\n");
-			pthread_exit(NULL);
-		}
-
-		snprintf(buf, sizeof(buf), "Babble, babble\n");
-		msg_send(&ctx, buf, strlen(buf)+1);
-		if (msg_receive(&ctx, buf, sizeof(buf), 1) > 0) {
-			printf("PRIVATE: Via MCAST %s\n", buf);
-			fflush(stdout);
-		}
-		msg_close(&ctx);
-	}
-
-	printf("Private thread is outta here...\n");
-
-	pthread_exit(NULL);
-}
-
-
-void
-clu_initialize(cman_handle_t *ch)
-{
-	if (!ch)
-		exit(1);
-
-	*ch = cman_init(NULL);
-	if (!(*ch)) {
-		printf("Waiting for CMAN to start\n");
-
-		while (!(*ch = cman_init(NULL))) {
-			sleep(1);
-		}
-	}
-
-        if (!cman_is_quorate(*ch)) {
-		/*
-		   There are two ways to do this; this happens to be the simpler
-		   of the two.  The other method is to join with a NULL group 
-		   and log in -- this will cause the plugin to not select any
-		   node group (if any exist).
-		 */
-		printf("Waiting for quorum to form\n");
-
-		while (cman_is_quorate(*ch) == 0) {
-			sleep(1);
-		}
-		printf("Quorum formed, starting\n");
-	}
-}
-
-
-int
-side_message(msgctx_t *ctx)
-{
-	msgctx_t actx;
-	char buf[1024];
-
-	if (msg_accept(ctx, &actx) < 0)
-		return -1;
-
-	printf("=== MAIN: Handling side message ===\n");
-	msg_print(&actx);
-	fflush(stdout);
-
-	if (msg_receive(&actx, buf, sizeof(buf), 10) > 0) {
-		printf("MAIN: Received %s\n", buf);
-		snprintf(buf, sizeof(buf), "Goodbye!\n");
-		msg_send(&actx, buf, strlen(buf)+1);
-	}
-
-	msg_close(&actx);
-	
-	printf("=== MAIN: end side message ===\n");
-
-	return 0;
-}
-
-
-void
-malloc_dump_table(int, int);
-
-
-void
-sigusr2_handler(int sig)
-{
-}
-
-int
-main(int argc, char **argv)
-{
-	msgctx_t *cluster_ctx;
-	char recvbuf[128];
-	cman_node_t me;
-	int ret;
-	pthread_t piggy, priv;
-	fd_set rfds;
-	int max = 0;
-	uint8_t ALIGNED port = MYPORT;
-	cman_handle_t clu = NULL;
-
-
-	clu_initialize(&clu);
-
-	if (clu == NULL) {
-		printf("Failed to connect to CMAN\n");
-	}
-
-	if (cman_init_subsys(clu) < 0) {
-		perror("cman_init_subsys");
-		return -1;
-	}
-
-	memset(&me, 0, sizeof(me));
-
-        if (cman_get_node(clu, CMAN_NODEID_US, &me) < 0) {
-		perror("cman_get_node");
-		return -1;
-	}
-
-	my_node_id = me.cn_nodeid;
-	printf("I am node ID %d\n", my_node_id);
-
-	if (msg_listen(MSG_CLUSTER, (void *)&port, me.cn_nodeid, &cluster_ctx) < 0) {
-		printf("Couldn't set up cluster message system: %s\n",
-			strerror(errno));
-		return -1;
-	}
-
-	signal(SIGTERM, sigusr2_handler);
-	signal(SIGUSR2, sigusr2_handler);
-
-	pthread_create(&piggy, NULL, piggyback, NULL);
-	pthread_create(&priv, NULL, private, NULL);
-
-	msg_print(cluster_ctx);
-	while (running) {
-		max = 0;
-		FD_ZERO(&rfds);
-		FD_SET(STDIN_FILENO, &rfds);
-		msg_fd_set(cluster_ctx, &rfds, &max);
-
-		select(max+1, &rfds, NULL, NULL, NULL);
-
-		if (FD_ISSET(STDIN_FILENO, &rfds)) {
-			if (!fgets(recvbuf, 128, stdin))
-				break;
-			if (recvbuf[0] == 'q' || recvbuf[0] == 'Q')
-				break;
-			if (msg_send(cluster_ctx, recvbuf,
-			    strlen(recvbuf)+1) < 0)
-				perror("msg_send");
-			FD_CLR(STDIN_FILENO, &rfds);
-		}
-		
-		if (!msg_fd_isset(cluster_ctx, &rfds)) 
-			continue;
-
-		ret = msg_wait(cluster_ctx, 1);
-	
-		switch(ret) {
-		case M_DATA:
-			msg_receive(cluster_ctx, recvbuf, 128, 10);
-			printf("MAIN: received %s\n", recvbuf);
-			break;
-		case M_OPEN:
-			printf("MAIN: private connection detected\n");
-			side_message(cluster_ctx);
-			break;
-		case 0:	
-			/* No data; probably a control msg */
-			break;
-		default:
-			printf("Cluster EV: %d\n", ret);
-			/* Cluster events, etc. */
-			msg_receive(cluster_ctx, recvbuf, 128, 0);
-		}
-	}
-
-	printf("Shutting down...\n");
-
-	running = 0;
-
-	pthread_join(piggy, NULL);
-	pthread_join(priv, NULL);
-
-	msg_close(cluster_ctx);
-	msg_free_ctx(cluster_ctx);
-	msg_shutdown();	
-
-	cman_finish(clu);
-
-	malloc_dump_table(0, 1024);
-
-	exit(0);
-}
diff --git a/rgmanager/src/clulib/rg_strings.c b/rgmanager/src/clulib/rg_strings.c
deleted file mode 100644
index 39c6e05..0000000
--- a/rgmanager/src/clulib/rg_strings.c
+++ /dev/null
@@ -1,204 +0,0 @@
-#include <res-ocf.h>
-#include <resgroup.h>
-
-struct string_val {
-	int val;
-	char *str;
-};
-
-
-const struct string_val rg_error_strings[] = {
-	{ RG_EDOMAIN,   "Service not runnable" },
-	{ RG_ESCRIPT,   "S/Lang Script Error" },
-	{ RG_EFENCE,    "Fencing operation pending; try again later" },
-	{ RG_ENODE,     "Target node dead / nonexistent" },
-	{ RG_ERUN,      "Service is already running" },
-	{ RG_EQUORUM,	"Operation requires quorum" },
-	{ RG_EINVAL,	"Invalid operation for resource" },
-	{ RG_EDEPEND,	"Operation violates dependency rule" },
-	{ RG_EAGAIN,	"Temporary failure; try again" },
-	{ RG_EDEADLCK,	"Operation would cause a deadlock" },
-	{ RG_ENOSERVICE,"Service does not exist" },
-	{ RG_EFORWARD,	"Service not mastered locally" },
-	{ RG_EABORT,	"Aborted; service failed" },
-	{ RG_EFROZEN,	"Failure: Service is frozen"},
-	{ RG_EFAIL,	"Failure" },
-	{ RG_ESUCCESS,	"Success" },
-	{ RG_YES,	"Yes" },
-	{ RG_NO, 	"No" },
-	{ 0,		NULL }
-};
-
-
-const struct string_val rg_req_strings[] = {
-	{RG_SUCCESS, "success" },
-	{RG_FAIL, "fail"},
-	{RG_START, "start"},
-	{RG_STOP, "stop"},
-	{RG_STATUS, "status"},
-	{RG_DISABLE, "disable"},
-	{RG_STOP_RECOVER, "stop (recovery)"},
-	{RG_START_RECOVER, "start (recovery)"},
-	{RG_RESTART, "restart"},
-	{RG_EXITING, "exiting"},
-	{RG_INIT, "initialize"},
-	{RG_ENABLE, "enable"},
-	{RG_STATUS_NODE, "status inquiry"},
-	{RG_RELOCATE, "relocate"},
-	{RG_CONDSTOP, "conditional stop"},
-	{RG_CONDSTART, "conditional start"},
-	{RG_START_REMOTE,"remote start"},
-	{RG_STOP_USER, "user stop"},
-	{RG_STOP_EXITING, "stop (shutdown)"},
-	{RG_LOCK, "locking"},
-	{RG_UNLOCK, "unlocking"},
-	{RG_QUERY_LOCK, "lock status inquiry"},
-	{RG_MIGRATE, "migrate"},
-	{RG_STATUS_INQUIRY, "out of band service status inquiry"},
-	{RG_NONE, "none"},
-	{0, NULL}
-};
-
-
-const struct string_val rg_state_strings[] = {
-	{RG_STATE_STOPPED, "stopped"},
-	{RG_STATE_STARTING, "starting"},
-	{RG_STATE_STARTED, "started"},
-	{RG_STATE_STOPPING, "stopping"},
-	{RG_STATE_FAILED, "failed"},
-	{RG_STATE_UNINITIALIZED, "uninitialized"},
-	{RG_STATE_CHECK, "checking"},
-	{RG_STATE_ERROR, "recoverable"},
-	{RG_STATE_RECOVER, "recovering"},
-	{RG_STATE_DISABLED, "disabled"},
-	{RG_STATE_MIGRATE, "migrating"},
-	{0, NULL}
-};
-
-
-const struct string_val rg_flags_strings[] = {
-	{RG_FLAG_FROZEN, "frozen"},
-	{0, NULL}
-};
-
-
-const struct string_val agent_ops[] = {
-	{RS_START, "start"},
-	{RS_STOP, "stop"},
-	{RS_STATUS, "status"},
-	{RS_RESINFO, "resinfo"},
-	{RS_RESTART, "restart"},
-	{RS_RELOAD, "reload"},
-	{RS_CONDRESTART, "condrestart"},		/* Unused */
-	{RS_RECOVER, "recover"},		
-	{RS_CONDSTART, "condstart"},
-	{RS_CONDSTOP, "condstop"},
-	{RS_MONITOR, "monitor"},
-	{RS_META_DATA, "meta-data"},		/* printenv */
-	{RS_VALIDATE, "validate-all"},
-	{RS_MIGRATE, "migrate"},
-	{RS_RECONFIG, "reconfig"},
-	{0 , NULL}
-};
-
-
-static inline const char *
-rg_search_table(const struct string_val *table, int val)
-{
-	int x;
-
-	for (x = 0; table[x].str != NULL; x++) {
-		if (table[x].val == val) {
-			return table[x].str;
-		}
-	}
-
-	return "Unknown";
-}
-
-
-static inline const char *
-rg_flag_search_table(const struct string_val *table, int val)
-{
-	int x;
-
-	for (x = 0; table[x].str != NULL; x++) {
-		if (table[x].val == val) {
-			return table[x].str;
-		}
-	}
-
-	return "Unknown";
-}
-
-static inline int
-rg_search_table_by_str(const struct string_val *table, const char *val)
-{
-	int x;
-
-	for (x = 0; table[x].str != NULL; x++) {
-		if (!strcasecmp(table[x].str, val))
-			return table[x].val;
-	}
-
-	return -1;
-}
-
-
-const char *
-rg_strerror(int val)
-{
-	return rg_search_table(rg_error_strings, val);
-}
-
-	
-const char *
-rg_state_str(int val)
-{
-	return rg_search_table(rg_state_strings, val);
-}
-
-int
-rg_state_str_to_id(const char *val)
-{
-	return rg_search_table_by_str(rg_state_strings, val);
-}
-
-
-const char *
-rg_req_str(int val)
-{
-	return rg_search_table(rg_req_strings, val);
-}
-
-
-const char *
-rg_flag_str(int val)
-{
-	return rg_search_table(rg_flags_strings, val);
-}
-
-
-const char *
-rg_flags_str(char *flags_string, size_t size, int val, char *separator)
-{
-	int i;
-	const char *string;
-
-	for (i = 0; i < (sizeof(val) * 8); i++) {
-		if ( val & (1 << i)) {
-			if (strlen(flags_string))
-				strncat(flags_string, separator, size - (strlen(flags_string) + strlen(separator) + 1));
-			string = rg_search_table(rg_flags_strings, (1 << i));
-			strncat(flags_string, string, size - (strlen(flags_string) + strlen(string) + 1));
-		}
-	}
-	return flags_string;
-}
-
-
-const char *
-agent_op_str(int val)
-{
-	return rg_search_table(agent_ops, val);
-}
diff --git a/rgmanager/src/clulib/sets.c b/rgmanager/src/clulib/sets.c
deleted file mode 100644
index f4873c4..0000000
--- a/rgmanager/src/clulib/sets.c
+++ /dev/null
@@ -1,353 +0,0 @@
-/**
- @file sets.c - Order-preserving set functions (union / intersection / delta)
-                (designed for integer types; a la int, uint64_t, etc...)
- @author Lon Hohberger <lhh at redhat.com>
- */
-#include <stdio.h>
-#include <malloc.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sets.h>
-#include <sys/time.h>
-
-
-/**
- Add a value to a set.  This function disregards an add if the value is already
- in the set.  Note that the maximum length of set s must be preallocated; this
- function doesn't do error or bounds checking. 
-
- @param s		Set to modify
- @param curlen		Current length (modified if added)
- @param val		Value to add
- @return		0 if not added, 1 if added
- */
-int
-s_add(set_type_t *s, int *curlen, set_type_t val)
-{
-	int idx=0;
-
-	for (; idx < *curlen; idx++)
-		if (s[idx] == val)
-			return 0;
-	s[*curlen] = val;
-	++(*curlen);
-	return 1;
-}
-
-
-/**
- Union-set function.  Allocates and returns a new set which is the union of
- the two given sets 'left' and 'right'.  Also returns the new set length.
-
- @param left		Left set - order is preserved on this set; that is,
-			this is the set where the caller cares about ordering.
- @param ll		Length of left set.
- @param right		Right set - order is not preserved on this set during
-			the union operation
- @param rl		Length of right set
- @param ret		Return set.  Should * not * be preallocated.
- @param retl		Return set length.  Should be ready to accept 1 integer
-			upon calling this function
- @return 		0 on success, -1 on error
- */
-int
-s_union(set_type_t *left, int ll, set_type_t *right, int rl,
-	set_type_t **ret, int *retl)
-{
-	int l, r, cnt = 0, total;
-
-	total = ll + rl; /* Union will never exceed both sets */
-
-	*ret = malloc(sizeof(set_type_t)*total);
-	if (!*ret) {
-		return -1;
-	}
-	memset((void *)(*ret), 0, sizeof(set_type_t)*total);
-
-	cnt = 0;
-
-	/* Add all the ones on the left */
-	for (l = 0; l < ll; l++)
-		s_add(*ret, &cnt, left[l]);
-
-	/* Add the ones on the left */
-	for (r = 0; r < rl; r++)
-		s_add(*ret, &cnt, right[r]);
-
-	*retl = cnt;
-
-	return 0;
-}
-
-
-/**
- Intersection-set function.  Allocates and returns a new set which is the 
- intersection of the two given sets 'left' and 'right'.  Also returns the new
- set length.
-
- @param left		Left set - order is preserved on this set; that is,
-			this is the set where the caller cares about ordering.
- @param ll		Length of left set.
- @param right		Right set - order is not preserved on this set during
-			the union operation
- @param rl		Length of right set
- @param ret		Return set.  Should * not * be preallocated.
- @param retl		Return set length.  Should be ready to accept 1 integer
-			upon calling this function
- @return 		0 on success, -1 on error
- */
-int
-s_intersection(set_type_t *left, int ll, set_type_t *right, int rl,
-	       set_type_t **ret, int *retl)
-{
-	int l, r, cnt = 0, total;
-
-	total = ll; /* Intersection will never exceed one of the two set
-		       sizes */
-
-	*ret = malloc(sizeof(set_type_t)*total);
-	if (!*ret) {
-		return -1;
-	}
-	memset((void *)(*ret), 0, sizeof(set_type_t)*total);
-
-	cnt = 0;
-	/* Find duplicates */
-	for (l = 0; l < ll; l++) {
-		for (r = 0; r < rl; r++) {
-			if (left[l] != right[r])
-				continue;
-			if (s_add(*ret, &cnt, right[r]))
-				break;
-		}
-	}
-
-	*retl = cnt;
-	return 0;
-}
-
-
-/**
- Delta-set function.  Allocates and returns a new set which is the delta (i.e.
- numbers not in both sets) of the two given sets 'left' and 'right'.  Also
- returns the new set length.
-
- @param left		Left set - order is preserved on this set; that is,
-			this is the set where the caller cares about ordering.
- @param ll		Length of left set.
- @param right		Right set - order is not preserved on this set during
-			the union operation
- @param rl		Length of right set
- @param ret		Return set.  Should * not * be preallocated.
- @param retl		Return set length.  Should be ready to accept 1 integer
-			upon calling this function
- @return 		0 on success, -1 on error
- */
-int
-s_delta(set_type_t *left, int ll, set_type_t *right, int rl,
-	set_type_t **ret, int *retl)
-{
-	int l, r, cnt = 0, total, found;
-
-	total = ll + rl; /* Union will never exceed both sets */
-
-	*ret = malloc(sizeof(set_type_t)*total);
-	if (!*ret) {
-		return -1;
-	}
-	memset((void *)(*ret), 0, sizeof(set_type_t)*total);
-
-	cnt = 0;
-
-	/* not efficient, but it works */
-	/* Add all the ones on the left */
-	for (l = 0; l < ll; l++) {
-		found = 0;
-		for (r = 0; r < rl; r++) {
-			if (right[r] == left[l]) {
-				found = 1;
-				break;
-			}
-		}
-		
-		if (found)
-			continue;
-		s_add(*ret, &cnt, left[l]);
-	}
-
-
-	/* Add all the ones on the right*/
-	for (r = 0; r < rl; r++) {
-		found = 0;
-		for (l = 0; l < ll; l++) {
-			if (right[r] == left[l]) {
-				found = 1;
-				break;
-			}
-		}
-		
-		if (found)
-			continue;
-		s_add(*ret, &cnt, right[r]);
-	}
-
-	*retl = cnt;
-
-	return 0;
-}
-
-
-/**
- Subtract-set function.  Allocates and returns a new set which is the
- subtraction of the right set from the left set.
- Also returns the new set length.
-
- @param left		Left set - order is preserved on this set; that is,
-			this is the set where the caller cares about ordering.
- @param ll		Length of left set.
- @param right		Right set - order is not preserved on this set during
-			the union operation
- @param rl		Length of right set
- @param ret		Return set.  Should * not * be preallocated.
- @param retl		Return set length.  Should be ready to accept 1 integer
-			upon calling this function
- @return 		0 on success, -1 on error
- */
-int
-s_subtract(set_type_t *left, int ll, set_type_t *right, int rl,
-	   set_type_t **ret, int *retl)
-{
-	int l, r, cnt = 0, total, found;
-
-	total = ll; /* Union will never exceed left set length*/
-
-	*ret = malloc(sizeof(set_type_t)*total);
-	if (!*ret) {
-		return -1;
-	}
-	memset((void *)(*ret), 0, sizeof(set_type_t)*total);
-
-	cnt = 0;
-
-	/* not efficient, but it works */
-	for (l = 0; l < ll; l++) {
-		found = 0;
-		for (r = 0; r < rl; r++) {
-			if (right[r] == left[l]) {
-				found = 1;
-				break;
-			}
-		}
-		
-		if (found)
-			continue;
-		s_add(*ret, &cnt, left[l]);
-	}
-
-	*retl = cnt;
-
-	return 0;
-}
-
-
-/**
- Shuffle-set function.  Weakly randomizes ordering of a set in-place.
-
- @param set		Set to randomize
- @param sl		Length of set
- @return		0
- */
-int
-s_shuffle(set_type_t *set, int sl)
-{
-	int x, newidx;
-	unsigned r_state = 0;
-	set_type_t t;
-	struct timeval tv;
-
-	gettimeofday(&tv, NULL);
-	r_state = (int)(tv.tv_usec);
-
-	for (x = 0; x < sl; x++) {
-		newidx = (rand_r(&r_state) % sl);
-		if (newidx == x)
-			continue;
-		t = set[x];
-		set[x] = set[newidx];
-		set[newidx] = t;
-	}
-
-	return 0;
-}
-
-
-#ifdef STANDALONE
-/* Testbed */
-/*
-  gcc -o sets sets.c -DSTANDALONE -ggdb -I../../include \
-       -Wall -Werror -Wstrict-prototypes -Wextra
- */
-int
-main(int __attribute__ ((unused)) argc, char __attribute__ ((unused)) **argv)
-{
-	set_type_t a[] = { 1, 2, 3, 3, 3, 2, 2, 3 };
-	set_type_t b[] = { 2, 3, 4 };
-	set_type_t *i;
-	int ilen = 0, x;
-
-	s_union(a, 8, b, 3, &i, &ilen);
-
-	/* Should return length of 4 - { 1 2 3 4 } */
-	printf("set_union [%d] = ", ilen);
-	for ( x = 0; x < ilen; x++) {
-		printf("%d ", (int)i[x]);
-	}
-	printf("\n");
-
-	s_shuffle(i, ilen);
-	printf("shuffled [%d] = ", ilen);
-	for ( x = 0; x < ilen; x++) {
-		printf("%d ", (int)i[x]);
-	}
-	printf("\n");
-
-
-	free(i);
-
-	/* Should return length of 2 - { 2 3 } */
-	s_intersection(a, 8, b, 3, &i, &ilen);
-
-	printf("set_intersection [%d] = ", ilen);
-	for ( x = 0; x < ilen; x++) {
-		printf("%d ", (int)i[x]);
-	}
-	printf("\n");
-
-	free(i);
-
-	/* Should return length of 2 - { 1 4 } */
-	s_delta(a, 8, b, 3, &i, &ilen);
-
-	printf("set_delta [%d] = ", ilen);
-	for ( x = 0; x < ilen; x++) {
-		printf("%d ", (int)i[x]);
-	}
-	printf("\n");
-
-	free(i);
-
-	/* Should return length of 1 - { 1 } */
-	s_subtract(a, 8, b, 3, &i, &ilen);
-
-	printf("set_subtract [%d] = ", ilen);
-	for ( x = 0; x < ilen; x++) {
-		printf("%d ", (int)i[x]);
-	}
-	printf("\n");
-
-	free(i);
-
-
-	return 0;
-}
-#endif
diff --git a/rgmanager/src/clulib/signals.c b/rgmanager/src/clulib/signals.c
deleted file mode 100644
index 1d49ee5..0000000
--- a/rgmanager/src/clulib/signals.c
+++ /dev/null
@@ -1,68 +0,0 @@
-#include <signal.h>
-#include <stdlib.h>
-#include <string.h>
-#include <resgroup.h>
-
-void *
-setup_signal(int sig, void (*handler)(int))
-{
-	struct sigaction act;
-	struct sigaction oldact;
-
-	memset(&act, 0, sizeof(act));
-	act.sa_handler = handler;
-
-	unblock_signal(sig);
-	if (sigaction(sig, &act, &oldact) == 0) {
-		return oldact.sa_handler;
-	}
-
-	return NULL;
-}
-
-
-/**
- * Block the given signal.
- *
- * @param sig		Signal to block.
- * @return		See man sigprocmask.
- */
-int
-block_signal(int sig)
-{
-       	sigset_t set;
-
-	sigemptyset(&set);
-	sigaddset(&set, sig);
-	
-	return(sigprocmask(SIG_BLOCK, &set, NULL));
-}
-
-
-/**
- * Block the given signal.
- *
- * @param sig		Signal to block.
- * @return		See man sigprocmask.
- */
-int
-unblock_signal(int sig)
-{
-       	sigset_t set;
-
-	sigemptyset(&set);
-	sigaddset(&set, sig);
-	
-	return(sigprocmask(SIG_UNBLOCK, &set, NULL));
-}
-
-
-int
-block_all_signals(void)
-{
-       	sigset_t set;
-
-	sigfillset(&set);
-	sigdelset(&set, SIGSEGV);
-	return(sigprocmask(SIG_BLOCK, &set, NULL));
-}
diff --git a/rgmanager/src/clulib/tmgr.c b/rgmanager/src/clulib/tmgr.c
deleted file mode 100644
index 864d090..0000000
--- a/rgmanager/src/clulib/tmgr.c
+++ /dev/null
@@ -1,109 +0,0 @@
-#ifdef WRAP_THREADS
-#include <stdio.h>
-#include <sys/types.h>
-#include <gettid.h>
-#include <pthread.h>
-#include <string.h>
-#include <errno.h>
-#include <malloc.h>
-#include <string.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <pthread.h>
-#include <list.h>
-#include <execinfo.h>
-
-typedef struct _thr {
-	list_head();
-	void *(*fn)(void *arg);
-	char **name;
-	pthread_t th;
-} mthread_t;
-
-static mthread_t *_tlist = NULL;
-static int _tcount = 0;
-static pthread_rwlock_t _tlock = PTHREAD_RWLOCK_INITIALIZER;
-
-void
-dump_thread_states(FILE *fp)
-{
-	int x;
-	mthread_t *curr;
-	fprintf(fp, "Thread Information\n");
-	pthread_rwlock_rdlock(&_tlock);
-	list_for(&_tlist, curr, x) {
-		fprintf(fp, "  Thread #%d   id: %d   function: %s\n",
-			x, (unsigned)curr->th, curr->name[0]);
-	}
-	pthread_rwlock_unlock(&_tlock);
-	fprintf(fp, "\n\n");
-}
-
-
-int __real_pthread_create(pthread_t *, const pthread_attr_t *,
-			  void *(*)(void*), void *);
-int
-__wrap_pthread_create(pthread_t *th, const pthread_attr_t *attr,
-	 	      void *(*start_routine)(void*),
-	 	      void *arg)
-{
-	void *fn = start_routine;
-	mthread_t *new;
-	int ret;
-
-	new = malloc(sizeof (*new));
-
-	ret = __real_pthread_create(th, attr, start_routine, arg);
-	if (ret) {
-		if (new)
-			free(new);
-		return ret;
-	}
-
-	if (new) {
-		new->th = *th;
-		new->fn = start_routine;
-		new->name = backtrace_symbols(&new->fn, 1);
-		pthread_rwlock_wrlock(&_tlock);
-		list_insert(&_tlist, new);
-		++_tcount;
-		pthread_rwlock_unlock(&_tlock);
-	}
-
-	return ret;
-}
-
-
-void __real_pthread_exit(void *);
-void
-__wrap_pthread_exit(void *exitval)
-{
-	mthread_t *old;
-	int ret = 0, found = 0;
-	pthread_t me = pthread_self();
-
-	pthread_rwlock_rdlock(&_tlock);
-	list_for(&_tlist, old, ret) {
-		if (old->th == me) {
-			found = 1;
-			break;
-		}
-	}
-	if (!found)
-		old = NULL;
-	pthread_rwlock_unlock(&_tlock);
-
-	if (!old)
-		__real_pthread_exit(exitval);
-
-	pthread_rwlock_wrlock(&_tlock);
-	list_remove(&_tlist, old);
-	--_tcount;
-	pthread_rwlock_unlock(&_tlock);
-
-	if (old->name)
-		free(old->name);
-	free(old);
-	__real_pthread_exit(exitval);
-}
-#endif
diff --git a/rgmanager/src/clulib/vft.c b/rgmanager/src/clulib/vft.c
deleted file mode 100644
index d944aae..0000000
--- a/rgmanager/src/clulib/vft.c
+++ /dev/null
@@ -1,1803 +0,0 @@
-//#define DEBUG
-/** @file
- * View-Formation Thread Library
- *
- * Similar to a two-phase commit.  This code is not especially optimal
- * for the kind of work it's doing in rgmanager (e.g. distributing 
- * resource group state).  It's probably better to use a client/server
- * model like NFS and have clients restate their resource group states
- * after a server failure.
- */
-#include <platform.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/resource.h>
-#include <sys/wait.h>
-#include <stdlib.h>
-#include <sys/time.h>
-#include <pthread.h>
-#include <vf.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <assert.h>
-#include <signals.h>
-#include <lock.h>
-
-static key_node_t *key_list = NULL;	/** List of key nodes. */
-static int _node_id = (int)-1;/** Our node ID, set with vf_init. */
-static uint16_t _port = 0;		/** Our daemon ID, set with vf_init. */
-
-/*
- * TODO: We could make it thread safe, but this might be unnecessary work
- * Solution: Super-coarse-grained-bad-code-locking!
- */
-#ifdef WRAP_LOCKS
-static pthread_mutex_t key_list_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
-static pthread_mutex_t vf_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
-#else
-static pthread_mutex_t key_list_mutex = PTHREAD_MUTEX_INITIALIZER;
-static pthread_mutex_t vf_mutex = PTHREAD_MUTEX_INITIALIZER;
-#endif /* WRAP_LOCKS */
-static pthread_t vf_thread = (pthread_t)-1;
-static int vf_thread_ready = 0;
-static vf_vote_cb_t default_vote_cb = NULL;
-static vf_vote_cb_t default_commit_cb = NULL;
-
-
-/*
- * Internal Functions
- */
-static int _send_simple(msgctx_t *ctx, int32_t command, int arg1, int arg2,
-		        int log_errors);
-static int vf_send_abort(msgctx_t *ctx, uint32_t trans);
-static int vf_send_commit(msgctx_t *ctx, uint32_t trans);
-static key_node_t * kn_find_key(char *keyid);
-static key_node_t * kn_find_trans(uint32_t trans);
-static int vf_handle_join_view_msg(msgctx_t *ctx, int nodeid, vf_msg_t * hdrp);
-static int vf_resolve_views(key_node_t *key_node);
-static int vf_unanimous(msgctx_t *ctx, int trans, int remain, int timeout);
-static view_node_t * vn_new(uint32_t trans, uint32_t nodeid, int viewno,
-			    void *data, uint32_t datalen);
-static int vf_request_current(cluster_member_list_t *membership, char *keyid,
-		   	      uint64_t *viewno, void **data, uint32_t *datalen);
-static int _vf_purge(key_node_t *key_node, uint32_t *trans);
-
-/* Join-view buffer list functions */
-static int vn_cmp(view_node_t *left, view_node_t *right);
-static int vn_insert_sorted(view_node_t **head, view_node_t *node);
-static view_node_t * vn_remove(view_node_t **head, uint32_t trans);
-static int vf_buffer_join_msg(vf_msg_t *hdr,
-			      struct timeval *timeout);
-
-/* Commits buffer list functions */
-static int vc_cmp(commit_node_t *left, commit_node_t *right);
-static int vc_insert_sorted(commit_node_t **head, commit_node_t *node);
-static commit_node_t * vc_remove(commit_node_t **head, uint32_t trans);
-static int vf_buffer_commit(uint32_t trans);
-
-/* Simple functions which client calls to vote/abort */
-static int vf_vote_yes(msgctx_t *ctx, uint32_t trans);
-static int vf_vote_no(msgctx_t *ctx, uint32_t trans);
-static int vf_abort(uint32_t trans);
-static int tv_cmp(struct timeval *left, struct timeval *right);
-
-/* Resolution */
-static uint32_t vf_try_commit(key_node_t *key_node);
-
-int vf_init(int my_node_id, uint16_t my_port,
-	    vf_vote_cb_t vote_cb, vf_commit_cb_t commit_cb);
-int vf_key_init(char *keyid, int timeout, vf_vote_cb_t vote_cb,
-		vf_commit_cb_t commit_cb);
-static int vf_key_init_nt(char *keyid, int timeout, vf_vote_cb_t vote_cb,
-			  vf_commit_cb_t commit_cb);
-int vf_write(cluster_member_list_t *memberhip, uint32_t flags,
-	     char *keyid, void *data, uint32_t datalen);
-int vf_process_msg(msgctx_t *ctx, int nodeid, generic_msg_hdr *msgp, int nbytes);
-int vf_end(char *keyid);
-int vf_read(cluster_member_list_t *membership, char *keyid, uint64_t *view,
-	    void **data, uint32_t *datalen);
-	       
-/* Reply to request for current data */
-static int vf_send_current(msgctx_t *, char *);
-
-
-struct vf_args {
-	msgctx_t *ctx;
-	int local_node_id;
-	uint16_t port;
-};
-
-
-static int
-_send_simple(msgctx_t *ctx, int32_t command, int arg1, int arg2, int log_errors)
-{
-	generic_msg_hdr hdr;
-
-	hdr.gh_magic = GENERIC_HDR_MAGIC;
-	hdr.gh_length = sizeof(hdr);
-	hdr.gh_command = command;
-	hdr.gh_arg1 = arg1;
-	hdr.gh_arg2 = arg2;
-
-	swab_generic_msg_hdr(&hdr);
-
-	return msg_send(ctx, &hdr, sizeof(hdr));
-}
-
-
-static int 
-vf_send_abort(msgctx_t *ctx, uint32_t trans)
-{
-#ifdef DEBUG
-	printf("VF: Broadcasting ABORT (X#%08x)\n", trans);
-#endif
-	return _send_simple(ctx, VF_MESSAGE, VF_ABORT, trans, 0);
-}
-
-
-static int
-vf_send_commit(msgctx_t *ctx, uint32_t trans)
-{
-#ifdef DEBUG
-	printf("VF: Broadcasting FORMED\n");
-#endif
-	return _send_simple(ctx, VF_MESSAGE, VF_VIEW_FORMED, trans, 1);
-}
-
-
-static key_node_t *
-kn_find_key(char *keyid)
-{
-	key_node_t *cur;
-
-	for (cur = key_list; cur; cur = cur->kn_next)
-		if (!strcmp(cur->kn_keyid,keyid))
-			return cur;
-
-	return NULL;
-}
-
-
-static key_node_t *
-kn_find_trans(uint32_t trans)
-{
-	key_node_t *cur;
-	view_node_t *curvn;
-
-	for (cur = key_list; cur; cur = cur->kn_next)
-		for (curvn = cur->kn_jvlist; curvn; curvn = curvn->vn_next)
-			if (curvn->vn_transaction == trans)
-				return cur;
-
-	return NULL;
-}
-
-
-static int
-vf_handle_join_view_msg(msgctx_t *ctx, int nodeid, vf_msg_t * hdrp)
-{
-	struct timeval timeout;
-	key_node_t *key_node;
-	uint32_t trans;
-
-	trans = hdrp->vm_msg.vf_transaction;
-#ifdef DEBUG
-	printf("VF_JOIN_VIEW from member #%d! Key: %s #%d (X#%08x)\n",
-	       hdrp->vm_msg.vf_coordinator, hdrp->vm_msg.vf_keyid,
-	       (int) hdrp->vm_msg.vf_view, trans);
-#endif
-
-	pthread_mutex_lock(&key_list_mutex);
-	key_node = kn_find_key(hdrp->vm_msg.vf_keyid);
-
-	/*
-	 * Call the voting callback function to see if we should continue.
-	 */
-	if (!key_node) {
-		if ((vf_key_init_nt(hdrp->vm_msg.vf_keyid,
-				    VF_COMMIT_TIMEOUT_MIN, NULL,
-				    NULL) < 0)) {
-			pthread_mutex_unlock(&key_list_mutex);
-			printf("VF: Error: Failed to initialize %s\n",
-			       hdrp->vm_msg.vf_keyid);
-			vf_vote_no(ctx, trans);  
-			return VFR_ERROR;
-		}
-
-		key_node = kn_find_key(hdrp->vm_msg.vf_keyid);
-		assert(key_node);
-	}
-
-	if (key_node->kn_vote_cb) {
-		if ((key_node->kn_vote_cb)(hdrp->vm_msg.vf_keyid,
-					   hdrp->vm_msg.vf_view,
-					   hdrp->vm_msg.vf_data,
-					   hdrp->vm_msg.vf_datalen) == 0) {
-			pthread_mutex_unlock(&key_list_mutex);
-#ifdef DEBUG
-			printf("VF: Voting NO (via callback)\n");
-#endif
-			vf_vote_no(ctx, trans);
-			return VFR_OK;
-		}
-	}
-	
-	/*
-	 * Buffer the join-view message.
-	 */
-	timeout.tv_sec = key_node->kn_tsec;
-	timeout.tv_usec = 0;
-
-	if (vf_buffer_join_msg((vf_msg_t *) hdrp, &timeout)) {
-		pthread_mutex_unlock(&key_list_mutex);
-#ifdef DEBUG
-		printf("VF: Voting YES (X#%08x)\n", trans);
-#endif
-		vf_vote_yes(ctx, trans);
-		return VFR_OK;
-	}
-
-	pthread_mutex_unlock(&key_list_mutex);
-#ifdef DEBUG
-	printf("VF: Voting NO\n");
-#endif
-	vf_vote_no(ctx, trans);
-	return VFR_NO;
-}
-
-
-/*
- * Try to resolve (JOIN_VIEW, FORMED_VIEW) messages in the proper order.
- * Returns the number of commits.
- */
-static int
-vf_resolve_views(key_node_t *key_node)
-{
-	int commits = 0;
-	void *data;
-	uint32_t datalen;
-	uint32_t trans;
-
-	if (!key_node)
-		return 0;
-
-	while ((trans = vf_try_commit(key_node)) != 0) {
-		commits++;
-	}
-
-	if (key_node->kn_commit_cb) {
-		data = malloc(key_node->kn_datalen);
-		if (!data) {
-			/* XXX */
-			return commits;
-		}
-
-		datalen = key_node->kn_datalen;
-		memcpy(data, key_node->kn_data, datalen);
-
-		(key_node->kn_commit_cb)(key_node->kn_keyid,
-					 key_node->kn_viewno,
-					 data,
-					 datalen);
-	}
-
-	return commits;
-}
-
-
-static int
-vf_unanimous(msgctx_t *mcast_ctx, int trans, int remain,
-	     int timeout)
-{
-	generic_msg_hdr response;
-	int x;
-
-	/*
-	 * Flag hosts which we received messages from so we don't
-	 * read a second message.
-	 */
-	while (remain && timeout) {
-
-		if (msg_wait(mcast_ctx, 1) <= 0) {
-			--timeout;
-			continue;
-		}
-
-		x = msg_receive(mcast_ctx, &response, sizeof(response), 1);
-		if (x < sizeof(response))
-			continue;
-		
-		/*
-		 * Decode & validate message
-		 */
-		swab_generic_msg_hdr(&response);
-		if ((response.gh_magic != GENERIC_HDR_MAGIC) ||
-		    (response.gh_command != VF_MESSAGE)) {
-			/* Don't process anything but votes */
-			continue;
-		}
-
-		if (vf_command(response.gh_arg1) != VF_VOTE)
-			/* Don't process anything but votes */
-			continue;
-
-		if (response.gh_arg2 != trans)
-			continue;
-
-		/*
-		 * If we get a 'NO', we are done.
-		 */
-		if (!(vf_flags(response.gh_arg1) & VFMF_AFFIRM)) {
-			/*
-			 * XXX ok, it might be a mangled message;
-			 * treat it as no anyway!
-			 */
-#ifdef DEBUG
-			printf("VF: Abort: someone voted NO\n");
-#endif
-			return VFR_ABORT;
-		}
-
-#ifdef DEBUG
-		printf("VF: YES\n");
-#endif
-		--remain;
-	}
-
-	if (remain) {
-#ifdef DEBUG
-		printf("VF: Timed out waiting for %d responses\n", remain);
-#endif
-		return VFR_TIMEOUT;
-	}
-		
-
-	/*
-	 * Whohoooooooo!
-	 */
-	return VFR_OK;
-}
-
-
-/*
- * ...
- */
-static view_node_t *
-vn_new(uint32_t trans, uint32_t nodeid, int viewno, void *data,
-       uint32_t datalen)
-{
-	view_node_t *new;
-	size_t totallen;
-
-	totallen = sizeof(*new) + datalen;
-	new = malloc(totallen);
-	if (!new)
-		return NULL;
-
-	memset(new,0,totallen);
-
-	new->vn_transaction = trans;
-	new->vn_nodeid = nodeid;
-	new->vn_viewno = viewno;
-	new->vn_datalen = datalen;
-	memcpy(new->vn_data, data, datalen);
-
-	return new;
-}
-
-
-static int
-vn_cmp(view_node_t *left, view_node_t *right)
-{
-	if ((left->vn_viewno < right->vn_viewno) || 
-	    ((left->vn_viewno == right->vn_viewno) &&
-	     (left->vn_nodeid < right->vn_nodeid)))
-		return -1;
-
-	/* Equal? ERROR!!! */
-	if ((left->vn_viewno == right->vn_viewno) &&
-	    (left->vn_nodeid == right->vn_nodeid))
-		return 0;
-
-	return 1;
-}
-
-
-static int
-vn_insert_sorted(view_node_t **head, view_node_t *node)
-{
-	view_node_t *cur = *head, *back = NULL;
-
-	/* only entry */
-	if (!cur) {
-		*head = node;
-		return 1;
-	}
-
-	while (cur) {
-		switch (vn_cmp(node, cur)) {
-		case 0:
-			/* duplicate */
-			return 0;
-		case -1:
-			if (back) {
-				/* middle */
-				node->vn_next = cur;
-				back->vn_next = node;
-				return 1;
-			}
-
-			node->vn_next = *head;
-			*head = node;
-			return 1;
-		}
-
-		back = cur;
-		cur = cur->vn_next;
-	}
-
-	/* end */
-	back->vn_next = node;
-	node->vn_next = NULL;
-
-	return 1;
-}
-
-
-static view_node_t *
-vn_remove(view_node_t **head, uint32_t trans)
-{
-	view_node_t *cur = *head, *back = NULL;
-
-	if (!cur)
-		return NULL;
-
-	do {
-		if (cur->vn_transaction == trans) {
-			if (back) {
-				back->vn_next = cur->vn_next;
-				cur->vn_next = NULL;
-				return cur;
-			}
-
-			*head = cur->vn_next;
-			cur->vn_next = NULL;
-			return cur;
-		}
-
-		back = cur;
-		cur = cur->vn_next;
-	} while (cur);
-
-	return NULL;
-}
-
-
-/*
- * Buffer a join-view message.  We attempt to resolve the buffered join-view
- * messages whenever:
- * (a) we receive a commit message
- * (b) we don't receive any messages.
- */
-static int
-vf_buffer_join_msg(vf_msg_t *hdr, struct timeval *timeout)
-{
-	key_node_t *key_node;
-	view_node_t *newp;
-	int rv = 0;
-
-	key_node = kn_find_key(hdr->vm_msg.vf_keyid);
-	if (!key_node) {
-		printf("Key %s not initialized\n",
-		       hdr->vm_msg.vf_keyid);
-		return 0;
-	}
-
-	/*
-	 * Store if the view < viewno.
-	 */
-	if (hdr->vm_msg.vf_view < key_node->kn_viewno) {
-		return 0;
-	}
-
-	newp = vn_new(hdr->vm_msg.vf_transaction, hdr->vm_msg.vf_coordinator,
-		      hdr->vm_msg.vf_view, 
-		      hdr->vm_msg.vf_data, hdr->vm_msg.vf_datalen);
-
-	if (timeout && (timeout->tv_sec || timeout->tv_usec)) {
-		if (getuptime(&newp->vn_timeout) == -1) {
-			/* XXX What do we do here? */
-			free(newp);
-			return 0;
-		}
-	
-		newp->vn_timeout.tv_sec += timeout->tv_sec;
-		newp->vn_timeout.tv_usec += timeout->tv_usec;
-	}
-
-	rv = vn_insert_sorted(&key_node->kn_jvlist, newp);
-	if (!rv)
-		free(newp);
-
-	return rv;
-}
-
-
-/*
- * XXX...
- */
-static int
-vc_cmp(commit_node_t *left, commit_node_t *right)
-{
-	if (left->vc_transaction < right->vc_transaction)
-		return -1;
-
-	if (left->vc_transaction == right->vc_transaction)
-		return 0;
-
-	return 1;
-}
-
-
-static int
-vc_insert_sorted(commit_node_t **head, commit_node_t *node)
-{
-	commit_node_t *cur = *head, *back = NULL;
-
-	/* only entry */
-	if (!cur) {
-		*head = node;
-		return 1;
-	}
-
-	while (cur) {
-		switch (vc_cmp(node, cur)) {
-		case 0:
-			/* duplicate */
-			return 0;
-		case -1:
-			if (back) {
-				/* middle */
-				node->vc_next = cur;
-				back->vc_next = node;
-				return 1;
-			}
-
-			node->vc_next = *head;
-			*head = node;
-			return 1;
-		}
-
-		back = cur;
-		cur = cur->vc_next;
-	}
-
-	/* end */
-	back->vc_next = node;
-	node->vc_next = NULL;
-
-	return 1;
-}
-
-
-static commit_node_t *
-vc_remove(commit_node_t **head, uint32_t trans)
-{
-	commit_node_t *cur = *head, *back = NULL;
-
-	if (!cur)
-		return NULL;
-
-	do {
-		if (cur->vc_transaction == trans) {
-			if (back) {
-				back->vc_next = cur->vc_next;
-				cur->vc_next = NULL;
-				return cur;
-			}
-
-			*head = cur->vc_next;
-			cur->vc_next = NULL;
-			return cur;
-		}
-
-		back = cur;
-		cur = cur->vc_next;
-	} while (cur);
-
-	return NULL;
-}
-
-
-/*
- * Buffer a commit message received on a file descriptor.  We don't need
- * to know the node id; since the file descriptor will still be open from
- * the last 'join-view' message.
- */
-static int
-vf_buffer_commit(uint32_t trans)
-{
-	key_node_t *key_node;
-	commit_node_t *newp;
-	int rv;
-
-	key_node = kn_find_trans(trans);
-	if (!key_node)
-		return 0;
-
-	newp = malloc(sizeof(*newp));
-	if (!newp)
-		return 0;
-
-	newp->vc_next = NULL;
-	newp->vc_transaction = trans;
-
-	rv = vc_insert_sorted(&key_node->kn_clist, newp);
-	if (!rv)
-		free(newp);
-
-	return rv;
-}
-
-
-static int
-vf_vote_yes(msgctx_t *ctx, uint32_t trans)
-{
-	/* XXX */
-	return _send_simple(ctx, VF_MESSAGE, VF_VOTE | VFMF_AFFIRM, trans, 0);
-}
-
-
-static int
-vf_vote_no(msgctx_t *ctx, uint32_t trans)
-{
-	/* XXX */
-	return _send_simple(ctx, VF_MESSAGE, VF_VOTE, trans, 0);
-}
-
-
-static int
-vf_abort(uint32_t trans)
-{
-	key_node_t *key_node;
-	view_node_t *cur;
-
-	key_node = kn_find_trans(trans);
-	if (!key_node)
-		return -1;
-
-	cur = vn_remove(&key_node->kn_jvlist, trans);
-	if (!cur)
-		return -1;
-
-	free(cur);
-	return 0;
-}
-
-
-static int
-tv_cmp(struct timeval *left, struct timeval *right)
-{
-	if (left->tv_sec > right->tv_sec)
-		return 1;
-
-	if (left->tv_sec < right->tv_sec)
-		return -1;
-
-	if (left->tv_usec > right->tv_usec)
-		return 1;
-
-	if (left->tv_usec < right->tv_usec)
-		return -1;
-
-	return 0;
-}
-
-
-/**
- * Grab the uptime from /proc/uptime.
- * 
- * @param tv		Timeval struct to store time in.  The sec
- * 			field contains seconds, the usec field 
- * 			contains the hundredths-of-seconds (converted
- * 			to micro-seconds)
- * @return		-1 on failure, 0 on success.
- */
-int
-getuptime(struct timeval *tv)
-{
-	FILE *fp;
-	struct timeval junk;
-	int rv;
-	
-	fp = fopen("/proc/uptime","r");
-	
-	if (!fp)
-		return -1;
-
-#if defined(__sparc__)
-	rv = fscanf(fp,"%ld.%d %ld.%d\n", &tv->tv_sec, &tv->tv_usec,
-		    &junk.tv_sec, &junk.tv_usec);
-#else
-	rv = fscanf(fp,"%ld.%ld %ld.%ld\n", &tv->tv_sec, &tv->tv_usec,
-		    &junk.tv_sec, &junk.tv_usec);
-#endif
-	fclose(fp);
-	
-	if (rv != 4) {
-		return -1;
-	}
-	
-	tv->tv_usec *= 10000;
-	
-	return 0;
-}
-
-
-/**
- * Try to commit views in a given key_node.
- */
-static uint32_t
-vf_try_commit(key_node_t *key_node)
-{
-	view_node_t *vnp;
-	commit_node_t *cmp;
-	uint32_t trans = 0;
-
-	if (!key_node)
-		return 0;
-
-	if (!key_node->kn_jvlist)
-		return 0;
-
-	trans = key_node->kn_jvlist->vn_transaction;
-		
-	cmp = vc_remove(&key_node->kn_clist, trans);
-	if (!cmp) {
-		/*printf("VF: Commit for fd%d not received yet!", fd);*/
-		return 0;
-	}
-
-	free(cmp); /* no need for it any longer */
-		
-	vnp = vn_remove(&key_node->kn_jvlist, trans);
-	if (!vnp) {
-		/*
-		 * But, we know it was the first element on the list?!!
-		 */
-		fprintf(stderr,"VF: QUAAAAAAAAAAAAAACKKKK!");
-		raise(SIGSTOP);
-	}
-	
-#ifdef DEBUG
-	printf("VF: Commit Key %s #%d from member #%d\n",
-	       key_node->kn_keyid, (int)vnp->vn_viewno, vnp->vn_nodeid);
-#endif
-
-	/*
-	 * Store the current view of everything in our key node
-	 */
-	key_node->kn_viewno = vnp->vn_viewno;
-	if (key_node->kn_data)
-		free(key_node->kn_data);
-	key_node->kn_datalen = vnp->vn_datalen;
-	key_node->kn_data = malloc(vnp->vn_datalen);
-
-	/*
-	 *   Need to check return of malloc always
-	 */
-	if (key_node->kn_data == NULL) {
-		fprintf (stderr, "malloc fail err=%d\n", errno);
-		return -1;
-	}
-
-	memcpy(key_node->kn_data, vnp->vn_data, vnp->vn_datalen);
-
-	free(vnp);
-	return trans;
-}
-
-
-void
-vf_event_loop(msgctx_t *ctx, int my_node_id)
-{
-	int n;
-	generic_msg_hdr *hdrp = NULL;
-
-	if (msg_wait(ctx, 3) != 0) {
-
-		n = msg_receive_simple(ctx, &hdrp, 2);
-
-		if (n <= 0 || !hdrp) {
-			return;
-		}
-
-		swab_generic_msg_hdr(hdrp);
-		if (hdrp->gh_command == VF_MESSAGE &&
-		    hdrp->gh_arg1 != VF_CURRENT) {
-			if (vf_process_msg(ctx, 0, hdrp, n) == VFR_COMMIT) {
-#ifdef DEBUG
-				printf("VFT: View committed\n");
-#endif
-			}
-		}
-
-		if (hdrp) {
-			free(hdrp);
-			hdrp = NULL;
-		}
-	}
-}
-
-
-static void
-vf_wait_ready(void)
-{
-	pthread_mutex_lock(&vf_mutex);
-	while (!vf_thread_ready) {
-		pthread_mutex_unlock(&vf_mutex);
-		usleep(50000);
-		pthread_mutex_lock(&vf_mutex);
-	}
-	pthread_mutex_unlock(&vf_mutex);
-}
-
-
-void *
-vf_server(void *arg)
-{
-	int my_node_id;
-	uint16_t port;
-	key_node_t *cur;
-	uint32_t trans;
-	msgctx_t *ctx;
-
-	block_all_signals();
-
-	port = ((struct vf_args *)arg)->port;
-	my_node_id = ((struct vf_args *)arg)->local_node_id;
-	ctx = ((struct vf_args *)arg)->ctx;
-	free(arg);
-
-#ifdef DEBUG
-	printf("VFT: Thread id %ld starting\n", (long)pthread_self());
-#endif
-
-	pthread_mutex_lock(&vf_mutex);
-	vf_thread_ready = 1;
-	pthread_mutex_unlock(&vf_mutex);
-
-	while (vf_thread_ready) {
-		pthread_mutex_lock(&key_list_mutex);
-		for (cur = key_list; cur; cur = cur->kn_next) {
-			/* Destroy timed-out join views */
-			while (_vf_purge(cur, &trans) != VFR_NO);
-		}
-		pthread_mutex_unlock(&key_list_mutex);
-		vf_event_loop(ctx, my_node_id);
-	}
-
-	msg_close(ctx);
-	msg_free_ctx(ctx);
-	pthread_exit(NULL);
-}
-
-
-
-/**
- * Initialize VF.  Initializes the View Formation sub system.
- * @param my_node_id	The node ID of the caller.
- * @return		0 on success, -1 on failure.
- */
-int
-vf_init(int my_node_id, uint16_t my_port, vf_vote_cb_t vcb,
-	vf_commit_cb_t ccb)
-{
-	struct vf_args *args;
-	msgctx_t *ctx;
-	if (my_node_id == (int)-1)
-		return -1;
-	
-	while((ctx = msg_new_ctx()) == NULL)
-		sleep(1);
-
-	while((args = malloc(sizeof(*args))) == NULL)
-		sleep(1);
-
-	if (msg_open(MSG_CLUSTER, 0, my_port, ctx, 1) < 0) {
-		msg_free_ctx(ctx);	
-		free(args);
-		return -1;
-	}
-
-	args->port = my_port;
-	args->local_node_id = my_node_id;
-	args->ctx = ctx;
-
-
-	pthread_mutex_lock(&vf_mutex);
-	_port = my_port;
-	_node_id = my_node_id;
-	default_vote_cb = vcb;
-	default_commit_cb = ccb;
-	pthread_mutex_unlock(&vf_mutex);
-
-	pthread_create(&vf_thread, NULL, vf_server, args);
-
-	vf_wait_ready();
-
-	return 0;
-}
-
-
-int
-vf_invalidate(void)
-{
-	key_node_t *c_key;
-	view_node_t *c_jv;
-	commit_node_t *c_cn;
-
-	pthread_mutex_lock(&key_list_mutex);
-
-	while ((c_key = key_list) != NULL) {
-
-		while ((c_jv = c_key->kn_jvlist) != NULL) {
-			key_list->kn_jvlist = c_jv->vn_next;
-			free(c_jv);
-		}
-
-		while ((c_cn = c_key->kn_clist) != NULL) {
-			c_key->kn_clist = c_cn->vc_next;
-			free(c_cn);
-		}
-
-		key_list = c_key->kn_next;
-
-		if (c_key->kn_data)
-			free(c_key->kn_data);
-		free(c_key->kn_keyid);
-		free(c_key);
-	}
-
-	pthread_mutex_unlock(&key_list_mutex);
-	return 0;
-}
-
-
-/**
-  Shut down VF
-  */
-int
-vf_shutdown(void)
-{
-	pthread_mutex_lock(&vf_mutex);
-	vf_thread_ready = 0;
-	pthread_cancel(vf_thread);
-	pthread_join(vf_thread, NULL);
-	_port = 0;
-	_node_id = (int)-1;
-
-	vf_invalidate();
-
-	pthread_mutex_unlock(&vf_mutex);
-
-	return 0;
-}
-
-
-/**
- * Adds a key to key node list and sets up callback functions.
- *
- * @param keyid		The ID of the key to add.
- * @param timeout	Amount of time to wait before purging a JOIN_VIEW
- *			message from our buffers.
- * @param vote_cb	Function to call on a given data set/view number
- *			to help decide whether to vote yes or no.  This is
- *			optional, and DOES NOT obviate the need for VF's
- *			decision-making (version/node ID based).  Also,
- *			the data from the view-node is passed UNCOPIED to
- *			the callback function!
- * @param commit_cb	Function to call when a key has had one or more
- *			commits.  Same info applies: the data passed to the
- *			callback function is UNCOPIED.
- * @return 0 (always)
- */
-static int
-vf_key_init_nt(char *keyid, int timeout, vf_vote_cb_t vote_cb,
-   	       vf_commit_cb_t commit_cb)
-{
-	key_node_t *newnode = NULL;
-	
-	newnode = kn_find_key(keyid);
-	if (newnode) {
-		printf("Key %s already initialized\n", keyid);
-		pthread_mutex_unlock(&key_list_mutex);
-		return -1;
-	}
-
-	newnode = malloc(sizeof(*newnode));
-
-	if (newnode == NULL) {
-		fprintf(stderr, "malloc fail3 err=%d\n", errno);
-		pthread_mutex_unlock(&key_list_mutex);
-		return -1;
-	}
-
-	newnode->kn_data = NULL;
-	memset(newnode,0,sizeof(*newnode));
-	newnode->kn_keyid = strdup(keyid);
-
-	/* Set up callbacks */
-	if (vote_cb)
-		newnode->kn_vote_cb = vote_cb;
-	else
-		newnode->kn_vote_cb = default_vote_cb;
-
-	if (commit_cb) 
-		newnode->kn_commit_cb = commit_cb;
-	else
-		newnode->kn_commit_cb = default_commit_cb;
-
-	if (timeout < VF_COMMIT_TIMEOUT_MIN) {
-		/* Join View message timeout must exceed the
-		   coordinator timeout */
-		timeout = VF_COMMIT_TIMEOUT_MIN;
-	}
-	newnode->kn_tsec = timeout;
-
-	newnode->kn_next = key_list;
-	key_list = newnode;
-
-	return 0;
-}
-
-
-int
-vf_key_init(char *keyid, int timeout, vf_vote_cb_t vote_cb,
-	    vf_commit_cb_t commit_cb)
-{
-	int rv;
-
-	pthread_mutex_lock(&key_list_mutex);
-	rv = vf_key_init_nt(keyid, timeout, vote_cb, commit_cb);
-	pthread_mutex_unlock(&key_list_mutex);
-
-	return 0;
-}
-
-
-vf_msg_t *
-build_vf_data_message(int cmd, char *keyid, void *data, uint32_t datalen,
-		      int viewno, int trans, uint32_t *retlen)
-{
-	uint32_t totallen;
-	vf_msg_t *msg;
-	/*
-	 * build the message
-	 */
-	totallen = sizeof(vf_msg_t) + datalen;
-	msg = malloc(totallen);
-	*retlen = 0;
-	if (!msg)
-		return NULL;
-	memset(msg, 0, totallen);
-	
-	/* header */
-	msg->vm_hdr.gh_magic = GENERIC_HDR_MAGIC;
-	msg->vm_hdr.gh_length = totallen;
-	msg->vm_hdr.gh_command = VF_MESSAGE;
-	msg->vm_hdr.gh_arg1 = cmd;
-
-	/* Data */
-	strncpy(msg->vm_msg.vf_keyid,keyid,sizeof(msg->vm_msg.vf_keyid));
-	msg->vm_msg.vf_transaction = trans;
-	msg->vm_msg.vf_datalen = datalen;
-	msg->vm_msg.vf_coordinator = _node_id;
-	msg->vm_msg.vf_view = viewno;
-	memcpy(msg->vm_msg.vf_data, data, datalen);
-
-	*retlen = totallen;
-	return msg;
-}
-
-
-/**
- * Begin VF.  Begins View-Formation for agiven set of data.
- *
- * @param membership	Current membership.
- * @param flags		Operational flags.
- * @param keyid		Key ID of the data to distribute.
- * @param data		The actual data to distribute.
- * @param datalen	The length of the data.
- * @param viewno	The current view number of the data.
- * @param block		Block until completion?
- * @return		-1 on failure, or 0 on success.  The parent will
- * 			either get a SIGCHLD or can randomly call vf_end()
- * 			on keyid to cause the VF child to be cleaned up.
- * @see vf_end
- */
-int
-vf_write(cluster_member_list_t *membership, uint32_t flags, char *keyid,
-	 void *data, uint32_t datalen)
-{
-	msgctx_t everyone;
-	key_node_t *key_node;
-	vf_msg_t *join_view;
-	int remain = 0, x, y, rv = VFR_ERROR;
-	uint32_t totallen;
-#ifdef DEBUG
-	struct timeval start, end, dif;
-#endif
-	struct dlm_lksb lockp;
-	int l;
-	char lock_name[256];
-	static uint32_t trans = 0;
-
-	if (!data || !datalen || !keyid || !strlen(keyid) || !membership)
-		return -1;
-
-	pthread_mutex_lock(&vf_mutex);
-	if (!trans) {
-		trans = _node_id << 16;
-	}
-	++trans;
-
-	/* Obtain cluster lock on it. */
-	snprintf(lock_name, sizeof(lock_name), "usrm::vf");
-	l = clu_lock(LKM_EXMODE, &lockp, 0, lock_name);
-	if (l < 0) {
-		pthread_mutex_unlock(&vf_mutex);
-		return l;
-	}
-
-#ifdef DEBUG
-	getuptime(&start);
-#endif
-
-	remain = 0;
-	for (x = 0, y = 0; x < membership->cml_count; x++) {
-		if (membership->cml_members[x].cn_member) {
-			remain++;
-		}
-	}
-
-#ifdef DEBUG
-	printf("Allright, need responses from %d members\n", remain);
-#endif
-
-	pthread_mutex_lock(&key_list_mutex);
-	key_node = kn_find_key(keyid);
-	if (!key_node) {
-
-		if ((vf_key_init_nt(keyid, 10, NULL, NULL) < 0)) {
-			pthread_mutex_unlock(&key_list_mutex);
-			clu_unlock(&lockp);
-			pthread_mutex_unlock(&vf_mutex);
-			return -1;
-		}
-		key_node = kn_find_key(keyid);
-		assert(key_node);
-	}
-
-	join_view = build_vf_data_message(VF_JOIN_VIEW, keyid, data, datalen,
-					  key_node->kn_viewno+1, trans, &totallen);
-
-	pthread_mutex_unlock(&key_list_mutex);
-
-	if (!join_view) {
-		clu_unlock(&lockp);
-		pthread_mutex_unlock(&vf_mutex);
-		return -1;
-	}
-
-#ifdef DEBUG
-	printf("VF: Push %d.%d #%d (X#%08x)\n", (int)_node_id, getpid(),
-	       (int)join_view->vm_msg.vf_view, trans);
-#endif
-	/* 
-	 * Encode the package.
-	 */
-	swab_vf_msg_t(join_view);
-
-	/*
-	 * Send our message to everyone
-	 */
-	if (msg_open(MSG_CLUSTER, 0, _port, &everyone, 0) < 0) {
-		printf("msg_open: fail: %s\n", strerror(errno));
-		clu_unlock(&lockp);
-		pthread_mutex_unlock(&vf_mutex);
-		return -1;
-	}
-
-	x = msg_send(&everyone, join_view, totallen);
-	if (x < totallen) {
-		vf_send_abort(&everyone, trans);
-#ifdef DEBUG
-		printf("VF: Aborted: Send failed (%d/%d)\n", x, totallen);
-#endif
-		msg_close(&everyone);
-		free(join_view);
-		clu_unlock(&lockp);
-		pthread_mutex_unlock(&vf_mutex);
-		return -1;
-	} 
-
-#ifdef DEBUG
-	printf("VF: Checking for consensus...\n");
-#endif
-	/*
-	 * See if we have a consensus =)
-	 */
-	if ((rv = (vf_unanimous(&everyone, trans, remain,
-				5))) == VFR_OK) {
-		vf_send_commit(&everyone, trans);
-#ifdef DEBUG
-		printf("VF: Consensus reached!\n");
-#endif
-	} else {
-		vf_send_abort(&everyone, trans);
-#ifdef DEBUG
-		printf("VF: Aborted!\n");
-#endif
-	}
-
-	/*
-	 * unanimous returns 1 for true; 0 for false, so negate it and
-	 * return our value...
-	 */
-	msg_close(&everyone);
-	free(join_view);
-	clu_unlock(&lockp);
-	pthread_mutex_unlock(&vf_mutex);
-
-#ifdef DEBUG
-	if (rv == VFR_OK) {
-		getuptime(&end);
-
-		dif.tv_usec = end.tv_usec - start.tv_usec;
-		dif.tv_sec = end.tv_sec - start.tv_sec;
-		
-		if (dif.tv_usec < 0) {
-		    dif.tv_usec += 1000000;
-		    dif.tv_sec--;
-		}
-
-		printf("VF: Converge Time: %d.%06d\n", (int)dif.tv_sec,
-		       (int)dif.tv_usec);
-	}
-#endif
-
-	return rv;
-}
-
-
-/**
- * Purge an unresolved JOIN-VIEW message if it has expired.  This only
- * purges a single message; if used, it should be called in a while()
- * loop.  The function returns a file descriptor which can be closed and
- * cleaned up by the caller if a request has indeed timed out.  Also,
- * if a request has timed out, the function calls vf_resolve_views to try
- * to resolve any outstanding views which were opened up by the timed-out
- * request.
- *
- * @param keyid		Key ID on which to purge timeouts.
- * @param fd		Pointer which, upon return, will either contain -1
- *			whenever VFR_NO is the return value, or the file
- *			descriptor which was resolved.
- * @return		VFR_ERROR on error.  VFR_NO if there are no timed-out
- *			requests, or if there are no requests at all, or if
- *			keyid isn't valid.  VFR_OK if there are timed-out
- *			requests and the virtue of removing the timed-out
- *			requests did not cause commit-resolution, or
- *			VFR_COMMIT if new views	were committed.  
- */
-static int
-_vf_purge(key_node_t *key_node, uint32_t *trans)
-{
-	view_node_t *cur, *dead = NULL;
-	struct timeval tv;
-
-	*trans = 0;
-	
-	if (!key_node)
-		return VFR_NO;
-
-	cur = key_node->kn_jvlist;
-	if (!cur)
-		return VFR_NO;
-
-	if (getuptime(&tv) == -1) {
-		fprintf(stderr,"VF: getuptime(): %s\n", strerror(errno));
-		return VFR_ERROR;
-	}
-
-	for (; cur; cur = cur->vn_next) {
-		if (tv_cmp(&tv, &cur->vn_timeout) < 0)
-			continue;
-
-		*trans = cur->vn_transaction;
-		dead = vn_remove(&key_node->kn_jvlist, *trans);
-		free(dead);
-
-		printf("VF: Killed transaction %08x\n", *trans);
-		/*
-		 * returns the removed associated file descriptor
-		 * so that we can close it and get on with life
-		 */
-		break;
-	}
-
-	if (*trans == 0)
-		return VFR_NO;
-		
-	if (vf_resolve_views(key_node))
-		return VFR_COMMIT;
-	return VFR_OK;
-}
-
-
-/**
- * Process a VF message.
- *
- * @param nodeid	Node id from which msgp was received.
- * @param msgp		Pointer to already-received message.
- * @param nbytes	Length of msgp.
- * @return		-1 on failure, 0 on success.
- */
-int
-vf_process_msg(msgctx_t *ctx, int nodeid, generic_msg_hdr *msgp, int nbytes)
-{
-	vf_msg_t *hdrp;
-	int ret;
-	key_node_t *kn;
-
-	if ((nbytes <= 0) || (nbytes < sizeof(generic_msg_hdr)) ||
-	    (msgp->gh_command != VF_MESSAGE))
-		return VFR_ERROR;
-
-	switch(vf_command(msgp->gh_arg1)) {
-	case VF_CURRENT:
-#ifdef DEBUG
-		printf("VF: Received request for current data\n");
-#endif
-		
-		/* Validate size... */
-		if (nbytes < sizeof(*hdrp)) {
-			fprintf(stderr, "VF: JOIN_VIEW message too short!\n");
-			return VFR_ERROR;
-		}
-
-		hdrp = (vf_msg_t *)msgp;
-		swab_vf_msg_info_t(&hdrp->vm_msg);
-
-		return vf_send_current(ctx, hdrp->vm_msg.vf_keyid);
-	
-	case VF_JOIN_VIEW:
-		/* Validate size... */
-		if (nbytes < sizeof(*hdrp)) {
-			fprintf(stderr, "VF: JOIN_VIEW message too short!\n");
-			return VFR_ERROR;
-		}
-
-		/* Unswap so we can swab the whole message */
-		hdrp = (vf_msg_t *)msgp;
-		swab_vf_msg_info_t(&hdrp->vm_msg);
-
-		if ((hdrp->vm_msg.vf_datalen + sizeof(*hdrp)) != nbytes) {
-			fprintf(stderr, "VF: JOIN_VIEW: Invalid size %d/%d\n",
-				nbytes, hdrp->vm_msg.vf_datalen +
-				(uint32_t)sizeof(*hdrp));
-
-			return VFR_ERROR;
-		}
-		return vf_handle_join_view_msg(ctx, nodeid, hdrp);
-		
-	case VF_ABORT:
-		printf("VF: Received VF_ABORT (X#%08x)\n", msgp->gh_arg2);
-		vf_abort(msgp->gh_arg2);
-		return VFR_ABORT;
-		
-	case VF_VIEW_FORMED:
-#ifdef DEBUG
-		printf("VF: Received VF_VIEW_FORMED, %d\n",
-		       nodeid);
-#endif
-		pthread_mutex_lock(&key_list_mutex);
-		vf_buffer_commit(msgp->gh_arg2);
-		kn = kn_find_trans(msgp->gh_arg2);
-		if (!kn) {
-			pthread_mutex_unlock(&key_list_mutex);
-			return VFR_OK;
-		}
-
-		ret = (vf_resolve_views(kn) ? VFR_COMMIT : VFR_OK);
-		pthread_mutex_unlock(&key_list_mutex);
-		return ret;
-
-	default:
-		/* Ignore votes and the like from this part */
-		break;
-	}
-
-	return VFR_OK;
-}
-
-
-/**
- * Retrieves the current dataset for a given key ID.
- *
- * @param keyid		Key ID of data set to retrieve.
- * @param view		Pointer which will be filled with the current data
- *			set's view number.
- * @param data		Pointer-to-pointer which will be allocated and
- *			filled with the current data set.  Caller must free.
- * @param datalen	Pointer which will be filled with the current data
- *			set's size.
- * @return		-1 on failure, 0 on success.
- */
-int
-vf_read(cluster_member_list_t *membership, char *keyid, uint64_t *view,
-	void **data, uint32_t *datalen)
-{
-	key_node_t *key_node;
-	char lock_name[256];
-	struct dlm_lksb lockp;
-	int l;
-
-	/* Obtain cluster lock on it. */
-	pthread_mutex_lock(&vf_mutex);
-	snprintf(lock_name, sizeof(lock_name), "usrm::vf");
-	l = clu_lock(LKM_EXMODE, &lockp, 0, lock_name);
-	if (l < 0) {
-		pthread_mutex_unlock(&vf_mutex);
-		return l;
-	}
-
-	do {
-		pthread_mutex_lock(&key_list_mutex);
-
-		key_node = kn_find_key(keyid);
-		if (!key_node) {
-			if ((vf_key_init_nt(keyid, 10, NULL, NULL) < 0)) {
-				pthread_mutex_unlock(&key_list_mutex);
-				clu_unlock(&lockp);
-				pthread_mutex_unlock(&vf_mutex);
-				printf("Couldn't locate %s\n", keyid);
-				return VFR_ERROR;
-			}
-			
-			key_node = kn_find_key(keyid);
-			assert(key_node);
-		}
-
-		/* XXX Don't allow reads during commits. */
-		if (key_node->kn_jvlist || key_node->kn_clist)  {
-			pthread_mutex_unlock(&key_list_mutex);
-			usleep(10000);
-			continue;
-		}
-	} while (0);
-
-	if (!key_node->kn_data || !key_node->kn_datalen) {
-		pthread_mutex_unlock(&key_list_mutex);
-
-		if (!membership) {
-			clu_unlock(&lockp);
-			//printf("Membership NULL, can't find %s\n", keyid);
-			pthread_mutex_unlock(&vf_mutex);
-			return VFR_ERROR;
-		}
-
-		l = vf_request_current(membership, keyid, view, data,
-				       datalen);
-	       	if (l == VFR_NODATA || l == VFR_ERROR) {
-			clu_unlock(&lockp);
-			//printf("Requesting current failed %s %d\n", keyid, l);
-			pthread_mutex_unlock(&vf_mutex);
-			return l;
-		}
-	}
-
-	*data = malloc(key_node->kn_datalen);
-	if (! *data) {
-		pthread_mutex_unlock(&key_list_mutex);
-		clu_unlock(&lockp);
-		pthread_mutex_unlock(&vf_mutex);
-		printf("Couldn't malloc %s\n", keyid);
-		return VFR_ERROR;
-	}
-
-	memcpy(*data, key_node->kn_data, key_node->kn_datalen);
-	*datalen = key_node->kn_datalen;
-	*view = key_node->kn_viewno;
-
-	pthread_mutex_unlock(&key_list_mutex);
-	clu_unlock(&lockp);
-	pthread_mutex_unlock(&vf_mutex);
-
-	return VFR_OK;
-}
-
-
-int
-vf_read_local(char *keyid, int *view, void **data, uint32_t *datalen)
-{
-	key_node_t *key_node = NULL;
-
-	pthread_mutex_lock(&vf_mutex);
-	pthread_mutex_lock(&key_list_mutex);
-
-	key_node = kn_find_key(keyid);
-	if (!key_node) {
-		pthread_mutex_unlock(&key_list_mutex);
-		pthread_mutex_unlock(&vf_mutex);
-		printf("no key for %s\n", keyid);
-		return VFR_NODATA;
-	}
-
-	if (!key_node->kn_data || !key_node->kn_datalen) {
-		pthread_mutex_unlock(&key_list_mutex);
-		pthread_mutex_unlock(&vf_mutex);
-		return VFR_NODATA;
-	}
-
-	*data = malloc(key_node->kn_datalen);
-	if (! *data) {
-		pthread_mutex_unlock(&key_list_mutex);
-		pthread_mutex_unlock(&vf_mutex);
-		printf("Couldn't malloc %s\n", keyid);
-		return VFR_ERROR;
-	}
-
-	memcpy(*data, key_node->kn_data, key_node->kn_datalen);
-	*datalen = key_node->kn_datalen;
-	*view = key_node->kn_viewno;
-
-	pthread_mutex_unlock(&key_list_mutex);
-	pthread_mutex_unlock(&vf_mutex);
-
-	return VFR_OK;
-}
-
-
-static int
-vf_send_current(msgctx_t *ctx, char *keyid)
-{
-	key_node_t *key_node;
-	vf_msg_t *msg;
-	int ret;
-	uint32_t totallen;
-
-	if (!ctx || ctx->type == -1)
-		return VFR_ERROR;
-
-	pthread_mutex_lock(&key_list_mutex);
-
-	key_node = kn_find_key(keyid);
-	if (!key_node || !key_node->kn_data || !key_node->kn_datalen) {
-		pthread_mutex_unlock(&key_list_mutex);
-		printf("VFT: No data for keyid %s\n", keyid);
-		return (_send_simple(ctx, VF_NACK, 0, 0, 0) != -1)?
-			VFR_OK : VFR_ERROR;
-	}
-
-	/*
-	 * XXX check for presence of nodes on the commit lists; send
-	 * VF_AGAIN if there is any.
-	 */
-	msg = build_vf_data_message(VF_ACK, keyid, key_node->kn_data,
-				    key_node->kn_datalen,
-				    key_node->kn_viewno,
-				    0,
-				    &totallen);
-
-	pthread_mutex_unlock(&key_list_mutex);
-	if (!msg)
-		return (_send_simple(ctx, VFR_ERROR, 0, 0, 0) != -1)?
-			VFR_OK : VFR_ERROR;
-
-	swab_vf_msg_t(msg);
-	ret = (msg_send(ctx, msg, totallen) >= 0)?VFR_OK:VFR_ERROR;
-	free(msg);
-	return ret;
-}
-
-
-static int
-vf_set_current(char *keyid, int view, void *data, uint32_t datalen)
-{
-	key_node_t *key_node;
-	void *datatmp;
-
-	pthread_mutex_lock(&key_list_mutex);
-
-	key_node = kn_find_key(keyid);
-	if (!key_node) {
-		pthread_mutex_unlock(&key_list_mutex);
-		return VFR_ERROR;
-	}
-
-	datatmp = malloc(datalen);
-	if (! datatmp) {
-		pthread_mutex_unlock(&key_list_mutex);
-		return VFR_ERROR;
-	}
-	
-	if (key_node->kn_data) {
-		free(key_node->kn_data);
-		key_node->kn_data = NULL;
-	}
-
-	key_node->kn_data = datatmp;
-	memcpy(key_node->kn_data, data, datalen);
-	key_node->kn_datalen = datalen;
-	key_node->kn_viewno = view;
-
-	pthread_mutex_unlock(&key_list_mutex);
-
-	return VFR_OK;
-}
-
-
-/**
- * Request the current state of a keyid from the membership.
- * XXX This doesn't wait for outstanding transactions to complete.
- * Perhaps it should.
- *
- * @param membership	Membership mask.
- * @param keyid		VF key id (application-defined).
- * @param viewno	Return view number.  Passed in pre-allocated.
- * @param data		Return data pointer.  Allocated within.
- * @param datalen	Size of data returned.
- */
-static int
-vf_request_current(cluster_member_list_t *membership, char *keyid,
-		   uint64_t *viewno, void **data, uint32_t *datalen)
-{
-	int x, n, rv = VFR_OK, port;
-	msgctx_t ctx;
-	vf_msg_t rmsg;
-	vf_msg_t *msg = &rmsg;
-	generic_msg_hdr * gh;
-	int me;
-
-	if (_port == 0) {
-		return -1;
-	}
-
-	port = _port;
-	me = _node_id;
-
-	memset(msg, 0, sizeof(*msg));
-	msg->vm_hdr.gh_magic = GENERIC_HDR_MAGIC;
-	msg->vm_hdr.gh_length = sizeof(*msg);
-	msg->vm_hdr.gh_command = VF_MESSAGE;
-	msg->vm_hdr.gh_arg1 = VF_CURRENT;
-	strncpy(msg->vm_msg.vf_keyid, keyid,
-		sizeof(msg->vm_msg.vf_keyid));
-
-	swab_generic_msg_hdr(&(msg->vm_hdr));
-	swab_vf_msg_info_t(&(msg->vm_msg));
-
-	for (x = 0; x < membership->cml_count; x++) {
-		if (!membership->cml_members[x].cn_member)
-			continue;
-
-		/* Can't request from self. */
-		if (membership->cml_members[x].cn_nodeid == me)
-			continue;
-
-		rv = VFR_ERROR;
-		if (msg_open(MSG_CLUSTER,
-			     membership->cml_members[x].cn_nodeid,
-			     port, &ctx, 15) < 0) {
-			continue;
-		}
-
-		msg = &rmsg;
-		//printf("VF: Requesting current value of %s from %d\n",
-		       //msg->vm_msg.vf_keyid,
-		       //(int)membership->cml_members[x].cn_nodeid);
-
-		if (msg_send(&ctx, msg, sizeof(*msg)) < sizeof(*msg)) {
-			printf("Couldn't send entire message\n");
-			msg_close(&ctx);
-			continue;
-		}
-
-		gh = NULL;
-		if ((n = msg_receive_simple(&ctx, (generic_msg_hdr **)&gh, 10))
-		    < 0) {
-			if (gh)
-				free(gh);
-			msg_close(&ctx);
-			continue;
-		}
-		msg_close(&ctx);
-		msg = (vf_msg_t *)gh;
-
-		/* Uh oh */
-		if (!msg || (msg == &rmsg)) {
-			printf("VF: No valid message\n");
-			return VFR_ERROR;
-		}
-		swab_generic_msg_hdr(&(msg->vm_hdr));
-		if (msg->vm_hdr.gh_command == VF_NACK) {
-			free(msg);
-			continue;
-		}
-		if (msg->vm_hdr.gh_length < sizeof(vf_msg_t)) {
-			fprintf(stderr, "VF: Short reply from %d\n", x);
-			free(msg);
-			continue;
-		}
-		if (msg->vm_hdr.gh_length > n) {
-			fprintf(stderr,
-				"VF: Size mismatch during decode (%d > %d)\n",
-				msg->vm_hdr.gh_length, n);
-			free(msg);
-			continue;
-		}
-
-		swab_vf_msg_info_t(&(msg->vm_msg));
-
-		if (msg->vm_msg.vf_datalen != (n - sizeof(*msg))) {
-			fprintf(stderr,"VF: Size mismatch during decode (\n");
-			free(msg);
-			continue;
-		}
-
-		/* Ok... we've got data! */
-		if (vf_set_current(keyid, msg->vm_msg.vf_view,
-			   msg->vm_msg.vf_data,
-			   msg->vm_msg.vf_datalen) == VFR_ERROR) {
-			free(msg);
-			return VFR_ERROR;
-		}
-
-		free(msg);
-
-		return VFR_OK;
-	}
-
-	return VFR_NODATA;
-}
-
-
-void
-dump_vf_states(FILE *fp)
-{
-	key_node_t *cur;
-
-	fprintf(fp, "View-Formation States:\n");
-	fprintf(fp, "  Thread: %d\n", (unsigned)vf_thread);
-	fprintf(fp, "  Default callbacks:\n    Vote: %p\n    Commit: %p\n",
-		default_vote_cb, default_commit_cb);
-	fprintf(fp, "  Distributed key metadata:\n");
-
-	pthread_mutex_lock(&key_list_mutex);
-
-	for (cur = key_list; cur; cur = cur->kn_next) {
-		fprintf(fp, "    %s, View: %d, Size: %d, Address: %p\n",
-			cur->kn_keyid,
-			(int)cur->kn_viewno,
-			cur->kn_datalen,
-			cur->kn_data);
-		if (cur->kn_vote_cb != default_vote_cb) 
-			fprintf(fp, "      Vote callback: %p\n", cur->kn_vote_cb);
-		if (cur->kn_commit_cb != default_commit_cb) 
-			fprintf(fp, "      Commit callback: %p\n", cur->kn_commit_cb);
-
-		if (cur->kn_jvlist)
-			fprintf(fp, "        This key has unresolved "
-			        "new views pending\n");
- 		if (cur->kn_clist)
-			fprintf(fp, "        This key has unresolved "
-			        "commits pending\n");
-
-	}
-
-	pthread_mutex_unlock(&key_list_mutex);
-	fprintf(fp, "\n");
-}
diff --git a/rgmanager/src/clulib/wrap_lock.c b/rgmanager/src/clulib/wrap_lock.c
deleted file mode 100644
index 0bd47e6..0000000
--- a/rgmanager/src/clulib/wrap_lock.c
+++ /dev/null
@@ -1,205 +0,0 @@
-#ifdef WRAP_LOCKS
-#include <stdio.h>
-#include <sys/types.h>
-#include <gettid.h>
-#include <pthread.h>
-#include <string.h>
-#include <errno.h>
-#include <string.h>
-#include <signal.h>
-
-int __real_pthread_mutex_lock(pthread_mutex_t *lock);
-int
-__wrap_pthread_mutex_lock(pthread_mutex_t *lock)
-{
-	int status;
-	struct timespec delay;
-
-	while (1) {
-		status = __real_pthread_mutex_lock(lock);
-
-		switch(status) {
-		case EDEADLK:
-			/* Already own it: Note the error, but continue */
-			fprintf(stderr, "[%d] %s(%p): %s; continuing\n",
-				gettid(),
-				__FUNCTION__, lock, strerror(status));
-			/* deliberate fallthrough */
-		case 0:
-			return 0;
-		case EBUSY:
-			/* Try again */
-			break;
-		default:
-			/* Other return codes */
-			fprintf(stderr, "[%d] %s(%p): %s\n", gettid(),
-				__FUNCTION__, lock, strerror(status));
-			raise(SIGSEGV);
-			/* EINVAL? */
-			return 0;
-		}
-
-		delay.tv_sec = 0;
-		delay.tv_nsec = 100000;
-		nanosleep(&delay, NULL);
-	}
-
-	/* Not reached */
-	return 0;
-}
-
-
-int __real_pthread_mutex_unlock(pthread_mutex_t *lock);
-int
-__wrap_pthread_mutex_unlock(pthread_mutex_t *lock)
-{
-	int status;
-	struct timespec delay;
-
-	while (1) {
-		status = __real_pthread_mutex_unlock(lock);
-
-		switch(status) {
-		case EPERM:
-			/* Don't own it: Note the error, but continue */
-			fprintf(stderr, "[%d] %s(%p): %s; continuing\n",
-				gettid(),
-				__FUNCTION__, lock, strerror(status));
-			/* deliberate fallthrough */
-		case 0:
-			return 0;
-		default:
-			fprintf(stderr, "[%d] %s(%p): %s\n", gettid(),
-				__FUNCTION__, lock, strerror(status));
-			raise(SIGSEGV);
-			return 0;
-		}
-
-		delay.tv_sec = 0;
-		delay.tv_nsec = 100000;
-		nanosleep(&delay, NULL);
-	}
-
-	/* Not reached */
-	return 0;
-}
-
-
-int __real_pthread_rwlock_rdlock(pthread_rwlock_t *lock);
-int
-__wrap_pthread_rwlock_rdlock(pthread_rwlock_t *lock)
-{
-	int status;
-	struct timespec delay;
-
-	while (1) {
-		status = __real_pthread_rwlock_rdlock(lock);
-
-		switch(status) {
-		case EDEADLK:
-			/* Already own it: Note the error, but continue */
-			fprintf(stderr, "[%d] %s(%p): %s; continuing\n",
-				gettid(),
-				__FUNCTION__, lock, strerror(status));
-			/* deliberate fallthrough */
-		case 0:
-			return 0;
-		case EBUSY:
-			/* Try again */
-			break;
-		default:
-			/* Other return codes */
-			fprintf(stderr, "[%d] %s(%p): %s\n", gettid(),
-				__FUNCTION__, lock, strerror(status));
-			raise(SIGSEGV);
-			/* EINVAL? */
-			return 0;
-		}
-
-		delay.tv_sec = 0;
-		delay.tv_nsec = 100000;
-		nanosleep(&delay, NULL);
-	}
-
-	/* Not reached */
-	return 0;
-}
-
-
-int __real_pthread_rwlock_wrlock(pthread_rwlock_t *lock);
-int
-__wrap_pthread_rwlock_wrlock(pthread_rwlock_t *lock)
-{
-	int status;
-	struct timespec delay;
-
-	while (1) {
-		status = __real_pthread_rwlock_wrlock(lock);
-
-		switch(status) {
-		case EDEADLK:
-			/* Already own it: Note the error, but continue */
-			fprintf(stderr, "[%d] %s(%p): %s; continuing\n",
-				gettid(),
-				__FUNCTION__, lock, strerror(status));
-			/* deliberate fallthrough */
-		case 0:
-			return 0;
-		case EBUSY:
-			/* Try again */
-			break;
-		default:
-			/* Other return codes */
-			fprintf(stderr, "[%d] %s(%p): %s\n", gettid(),
-				__FUNCTION__, lock, strerror(status));
-			raise(SIGSEGV);
-			/* EINVAL? */
-			return 0;
-		}
-
-		delay.tv_sec = 0;
-		delay.tv_nsec = 100000;
-		nanosleep(&delay, NULL);
-	}
-
-	/* Not reached */
-	return 0;
-}
-
-
-int __real_pthread_rwlock_unlock(pthread_rwlock_t *lock);
-int
-__wrap_pthread_rwlock_unlock(pthread_rwlock_t *lock)
-{
-	int status;
-	struct timespec delay;
-
-	while (1) {
-		status = __real_pthread_rwlock_unlock(lock);
-
-		switch(status) {
-		case EPERM:
-			/* Don't own it: Note the error, but continue */
-			fprintf(stderr, "[%d] %s(%p): %s; continuing\n",
-				gettid(),
-				__FUNCTION__, lock, strerror(status));
-			/* deliberate fallthrough */
-		case 0:
-			return 0;
-		default:
-			fprintf(stderr, "[%d] %s(%p): %s\n", gettid(),
-				__FUNCTION__, lock, strerror(status));
-			raise(SIGSEGV);
-			return 0;
-		}
-
-		delay.tv_sec = 0;
-		delay.tv_nsec = 100000;
-		nanosleep(&delay, NULL);
-	}
-
-	/* Not reached */
-	return 0;
-}
-#endif
-
diff --git a/rgmanager/src/daemons/Makefile b/rgmanager/src/daemons/Makefile
deleted file mode 100644
index edad463..0000000
--- a/rgmanager/src/daemons/Makefile
+++ /dev/null
@@ -1,120 +0,0 @@
-TARGET1= rgmanager
-TARGET2= rg_test
-TARGET3= dtest
-TARGET4= clurgmgrd
-
-SBINDIRT=$(TARGET1) $(TARGET2)
-SBINSYMT=$(TARGET4)
-
-all: depends ${TARGET1} ${TARGET2} ${TARGET4}
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-OBJS1=	depends.o \
-	fo_domain.o \
-	groups.o \
-	main.o \
-	reslist.o \
-	resrules.o \
-	restree.o \
-	restart_counter.o \
-	rg_event.o \
-	rg_forward.o \
-	rg_locks.o \
-	rg_queue.o \
-	rg_state.o \
-	rg_thread.o \
-	service_op.o \
-	slang_event.o \
-	event_config.o \
-	watchdog.o
-
-OBJS2=	test-noccs.o
-
-OBJS3=	dtest-noccs.o
-
-SHAREDOBJS=	depends-noccs.o \
-		fo_domain-noccs.o \
-		restart_counter.o \
-		reslist-noccs.o \
-		resrules-noccs.o \
-		restree-noccs.o \
-		rg_locks-noccs.o \
-		event_config-noccs.o
-
-CFLAGS += -DSHAREDIR=\"${sharedir}\"
-CFLAGS += -Werror -Wstrict-prototypes -Wshadow -fPIC
-CFLAGS += -I${ccsincdir} -I${cmanincdir} -I${dlmincdir} -I${logtincdir}
-CFLAGS += `xml2-config --cflags` -I${readlineincdir} -I${slangincdir}
-CFLAGS += -I$(S)/../../include
-CFLAGS += -I${incdir}
-
-NOCCS_CFLAGS += -DNO_CCS
-
-LDFLAGS += -L../clulib -lclulib
-LDFLAGS += -L${libdir}
-
-CCS_LDFLAGS += -L${ccslibdir} -lccs 
-CMAN_LDFLAGS += -L${cmanlibdir} -lcman
-LOGSYS_LDFLAGS += -L${logtlibdir} -llogthread
-DLM_LDFLAGS += -L${dlmlibdir} -ldlm
-XML2_LDFLAGS += `xml2-config --libs`
-SLANG_LDFLAGS += -L${slanglibdir} -lslang
-EXTRA_LDFLAGS += -lpthread
-LOCAL_LDFLAGS += -llalloc
-READLINE_LDFLAGS += -L${readlinelibdir} -lreadline
-
-LDDEPS += ../clulib/libclulib.a
-
-LOCAL_LDDEPS += ../clulib/liblalloc.a
-
-${TARGET1}: ${OBJS1} ${LDDEPS}
-	$(CC) -o $@ $^ $(CCS_LDFLAGS) $(CMAN_LDFLAGS) \
-			$(DLM_LDFLAGS) $(XML2_LDFLAGS) \
-			$(SLANG_LDFLAGS) $(EXTRA_LDFLAGS) \
-			$(LOGSYS_LDFLAGS) $(LD_FLAGS)
-
-#
-# Our test program links against the local allocator so that
-# we can see if our program is leaking memory during XML parsing, tree
-# delta calculations, building/teardown of resource lists, etc.
-# If it's leaking memory, the 'make check' will fail.  Also, we can
-# use it to test known-good configurations for regressions.
-#
-# The data in the 'tests' directory is hand-crafted; so running 'gentests.sh'
-# will require that the developer hand-verify the correctness of the
-# resulting output prior to committing back to CVS.
-#
-# This is NOT meant to be an installed binary.  Rather, RPMs and/or other
-# packages should run 'make check' as part of the build process.
-#
-${TARGET2}: ${SHAREDOBJS} ${OBJS2} ${LDDEPS} ${LOCAL_LDDEPS}
-	$(CC) -o $@ $^ $(CMAN_LDFLAGS) $(LOCAL_LDFLAGS) $(EXTRA_LDFLAGS) \
-			$(XML2_LDFLAGS) $(LOGSYS_LDFLAGS) $(LDFLAGS)
-
-${TARGET3}: ${SHAREDOBJS} ${OBJS3} ${LDDEPS} ${LOCAL_LDDEPS}
-	$(CC) -o $@ $^ $(CCS_LDFLAGS) $(CMAN_LDFLAGS) \
-			$(LOCAL_LDFLAGS) $(EXTRA_LDFLAGS) $(XML2_LDFLAGS) \
-			$(READLINE_LDFLAGS) $(LOGSYS_LDFLAGS) $(LDFLAGS)
-
-${TARGET4}: ${TARGET1}
-	ln -sf ${TARGET1} ${TARGET4}
-
-check: rg_test
-	cd tests && ./runtests.sh
-
-depends:
-	$(MAKE) -C ../clulib all
-
-clean: generalclean
-	rm -f tests/*.out*
-
--include $(OBJS1:.o=.d)
--include $(OBJS2:.o=.d)
--include $(OBJS3:.o=.d)
--include $(OBJS4:.o=.d)
--include $(SHAREDOBJS:.o=.d)
diff --git a/rgmanager/src/daemons/depends.c b/rgmanager/src/daemons/depends.c
deleted file mode 100644
index d9dda8d..0000000
--- a/rgmanager/src/daemons/depends.c
+++ /dev/null
@@ -1,2512 +0,0 @@
-/** @file
- * CCS dependency parsing, based on failover domain parsing
- * Transition generation based on simple brute-force / best-first
- * tree search.
- * 
- * Allows specification of two types of rules concerning service states:
- * 
- * - requirement: A -> B means B must be running either for A to start or
- *                at all times (if B stops, A will be stopped)
- * - colocation: A -> B means that A must be run on the same node as B
- *               (note that colocation doesn't mean that B must be running;
- *               to do both, you must enable a requirement).
- *               A X> B means that A must be run on a different node from B.
- *
- * Known bugs:  If more than 1 error is introduced in the graph,
- *              the 'find-ideal-state' function sometimes will refuse to run
- */
-#include <string.h>
-#include <list.h>
-#include <time.h>
-#include <restart_counter.h>
-#include <logging.h>
-#include <resgroup.h>
-#include <reslist.h>
-#include <ccs.h>
-#include <pthread.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <members.h>
-#include <reslist.h>
-#include <depends.h>
-#include <ctype.h>
-
-struct _try {
-	dep_op_t *ops;
-	int score;
-	int depth;
-};
-
-void deconstruct_dep(dep_t *dep);
-int dep_graph_validate(dep_t **deps);
-fod_t *fod_find_domain(fod_t **domains, char *name);
-
-//#define DEBUG
-
-#ifdef NO_CCS
-#define ccs_get(fd, query, ret) conf_get(query, ret)
-#endif
-
-/*
-   <dependencies>
-     <dependency name="service:bar">
-       <target name="service:foo" colocate="always|never|unspec"
-               require="start|always|unspec"/>
-     </dependency>
-   </dependencies>
- */
-
-static dep_node_t *
-get_dep_node(int ccsfd, char *base, int idx, dep_t *dep, int *_done)
-{
-	dep_node_t *dn;
-	char xpath[256];
-	char *ret;
-	int c;
-
-	*_done = 0;
-	snprintf(xpath, sizeof(xpath), "%s/target[%d]/@name",
-		 base, idx);
-	if (ccs_get(ccsfd, xpath, &ret) != 0) {
-		*_done = 1;
-		return NULL;
-	}
-
-	list_for(&dep->d_nodes, dn, c) {
-		if (strcasecmp(ret, dn->dn_name))
-			continue;
-
-		printf("#XX: Target %s defined multiple times in "
-		       "dependency block %s\n", ret, dep->d_name);
-		free(ret);
-		return NULL;
-	}
-
-	dn = malloc(sizeof(*dn));
-	if (!dn)
-		return NULL;
-	memset(dn, 0, sizeof(*dn));
-
-	/* Already malloc'd; simply store */
-	dn->dn_name = ret;
-	dn->dn_ptr = NULL;
-	dn->dn_req = DEP_REQ_UNSPEC;
-	dn->dn_colo = DEP_COLO_UNSPEC;
-
-	snprintf(xpath, sizeof(xpath), "%s/target[%d]/@require",
-		 base, idx);
-	if (ccs_get(ccsfd, xpath, &ret) == 0 && ret) {
-		
-		if (!strcasecmp(ret, "start")) {
-			dn->dn_req = DEP_REQ_START;
-		} else if (!strcasecmp(ret, "always")) {
-			dn->dn_req = DEP_REQ_ALWAYS;
-		} else if (!strcasecmp(ret, "unspec")) {
-			dn->dn_req = DEP_REQ_UNSPEC;
-		} else {
-			dn->dn_req = atoi(ret);
-		}
-		
-		free(ret);
-	}
-	
-	snprintf(xpath, sizeof(xpath), "%s/target[%d]/@colocate",
-		 base, idx);
-	if (ccs_get(ccsfd, xpath, &ret) == 0 && ret) {
-		
-		if (!strcasecmp(ret, "never")) {
-			dn->dn_colo = DEP_COLO_NEVER;
-		} else if (!strcasecmp(ret, "always")) {
-			dn->dn_colo = DEP_COLO_ALWAYS;
-		} else if (!strcasecmp(ret, "unspec")) {
-			dn->dn_colo = DEP_COLO_UNSPEC;
-		} else {
-			dn->dn_colo = atoi(ret);
-		}
-		
-		free(ret);
-	}
-	
-	if (dn->dn_req == DEP_REQ_UNSPEC &&
-	    dn->dn_colo == DEP_COLO_UNSPEC) {
-		printf("Dropping dependency target %s: no rule in use\n",
-		       dn->dn_name);
-		free(dn->dn_name);
-		free(dn);
-		return NULL;
-	}
-
-	return dn;
-}
-
-
-static dep_t *
-get_dep(int ccsfd, char *base, int idx, dep_t **deps, int *_done)
-{
-	dep_t *dep;
-	dep_node_t *dn;
-	char xpath[256];
-	char *ret;
-	int x = 1, c;
-	int done;
-
-	*_done = 0;
-	snprintf(xpath, sizeof(xpath), "%s/dependency[%d]/@name",
-		 base, idx);
-	if (ccs_get(ccsfd, xpath, &ret) != 0) {
-		*_done = 1;
-		return NULL;
-	}
-
-	list_for(deps, dep, c) {
-		if (strcasecmp(dep->d_name, ret))
-			continue;
-		    
-		printf("#XX: Dependency block %s defined multiple "
-				"times\n", ret);
-		free(ret);
-		return NULL;
-	}
-
-	dep = malloc(sizeof(*dep));
-	if (!dep)
-		return NULL;
-	memset(dep, 0, sizeof(*dep));
-	dep->d_name = ret;
-	dep->d_nodes = NULL;
-	dep->d_flags = 0;
-	dep->d_hits = 0;
-	dep->d_deps = 0;
-
-	snprintf(xpath, sizeof(xpath), "%s/dependency[%d]",
-		 base, idx);
-
-	do {
-		dn = get_dep_node(ccsfd, xpath, x++, dep, &done);
-		if (dn) {
-			dep->d_deps++;
-			list_insert(&dep->d_nodes, dn);
-		}
-	} while (!done);
-	
-	if (!dep->d_nodes) {
-		printf("Dropping dependency block %s: No targets\n",
-		       dep->d_name);
-		free(dep->d_name);
-		free(dep);
-		return NULL;
-	}
-
-	return dep;
-}
-
-
-/**
- * Constructs links in the dependency tree
- */
-static void
-dep_construct_tree(dep_t **deps)
-{
-	dep_t *curr, *curr2, *dep;
-	dep_node_t *dn;
-	int done, found, a, b, c;
-	
-	do {
-		done = 1;
-		list_for(deps, curr, a) {
-			list_for(&curr->d_nodes, dn, b) {
-				found = 0;
-				list_for(deps, curr2, c) {
-					if (!strcasecmp(curr2->d_name,
-							dn->dn_name)) {
-						if (!dn->dn_ptr) {
-							dn->dn_ptr = curr2;
-							dn->dn_ptr->d_hits++;
-						}
-						found = 1;
-					}
-				}
-				
-				if (!found) {
-					done=0;
-					
-					dep = malloc(sizeof(*dep));
-					if (!dep)
-						return;
-					memset(dep, 0, sizeof(*dep));
-					dep->d_name = strdup(dn->dn_name);
-					if (!dep->d_name)
-						return;
-					dep->d_nodes = NULL;
-					dep->d_flags = DEP_FLAG_IMPLIED;
-					dep->d_hits = 1;
-					dep->d_deps = 0;
-					dn->dn_ptr = dep;
-					
-					list_insert(deps, dep);
-					
-					break;
-				}
-			}
-			
-			if (!done)
-				break;
-		}
-	} while (!done);
-}
-	
-
-/**
- * similar API to failover domain
- */
-int
-construct_depends(int ccsfd, dep_t **deps)
-{
-	char xpath[256];
-	int x = 1, done, c;
-	dep_t *dep, *curr;
-
-	snprintf(xpath, sizeof(xpath),
-		 RESOURCE_TREE_ROOT "/dependencies");
-
-	do {
-		dep = get_dep(ccsfd, xpath, x++, deps, &done);
-		if (dep) {
-			list_insert(deps, dep);
-		}
-	} while (!done);
-	
-	/* Insert terminal dependency nodes & construct tree */
-	/* XXX optimize */
-	dep_construct_tree(deps);
-
-	dep_graph_validate(deps);
-	
-	do {
-		done = 1;
-		list_for(deps, curr, c) {
-			if (curr->d_flags &
-			    (DEP_FLAG_CYCLIC | DEP_FLAG_IMPOSSIBLE)) {
-				printf("Removing dependency block %s: "
-				       "Invalid\n", curr->d_name);
-				done = 0;
-				
-				list_remove(deps, curr);
-				deconstruct_dep(curr);
-				break;
-			}
-		}
-	} while (!done);
-	
-	return 0;
-}
-
-
-void
-deconstruct_dep(dep_t *dep)
-{
-	dep_node_t *node;
-	
-	while ((node = dep->d_nodes)) {
-		list_remove(&dep->d_nodes, node);
-		if (node->dn_name)
-			free(node->dn_name);
-		free(node);
-	}
-
-	if (dep->d_name)
-		free(dep->d_name);
-	free(dep);
-}
-
-
-void
-deconstruct_depends(dep_t **deps)
-{
-	dep_t *dep = NULL;
-	
-	while ((dep = *deps)) {
-		list_remove(deps, dep);
-		deconstruct_dep(dep);
-	}
-}
-
-
-static inline dep_rs_t *
-_find_state(char *name, dep_rs_t *sl, int slen)
-{
-	int x;
-
-	for (x = 0; x < slen; x++)
-		if (!strcasecmp(sl[x].rs_status.rs_name, name))
-			return &sl[x];
-	
-	return NULL;
-}
-
-
-static int
-rs_running(char *name, dep_rs_t *sl, int slen)
-{
-	dep_rs_t *rs = NULL;
-	
-	if (name) {
-		rs = _find_state(name, sl, slen);
-	} else if (slen == 1) {
-		rs = sl;
-	}
-	
-	if (rs) {
-		if (rs->rs_flags & RS_BROKEN)
-			return -1;
-		return (rs->rs_status.rs_state == RG_STATE_STARTING ||
-			rs->rs_status.rs_state == RG_STATE_STARTED ||
-			rs->rs_status.rs_state == RG_STATE_STOPPING );
-	}
-	
-	return 0;
-}
-
-
-int
-dep_tree_dup(dep_t **dest, dep_t **src)
-{
-	dep_t *dep, *dep_cpy;
-	dep_node_t *dn, *dn_cpy;
-	int a, b;
-	
-	list_for(src, dep, a) {
-		while ((dep_cpy = malloc(sizeof(dep_t))) == NULL)
-			usleep(10000);
-		memset(dep_cpy, 0, sizeof(dep_t));
-		while ((dep_cpy->d_name = strdup(dep->d_name)) == NULL)
-			usleep(10000);
-		
-		dep_cpy->d_flags &= ~(DEP_FLAG_ALWAYS|DEP_FLAG_NEVER);
-		
-		list_for(&dep->d_nodes, dn, b) {
-			while ((dn_cpy = malloc(sizeof(dep_node_t))) == NULL)
-			 	usleep(10000);
-			memset(dn_cpy, 0, sizeof(dep_node_t));
-			while ((dn_cpy->dn_name = strdup(dn->dn_name)) == NULL)
-				usleep(10000);
-			dn_cpy->dn_colo = dn->dn_colo;
-			dn_cpy->dn_req = dn->dn_req;
-			
-			/* Flags are all errors right now... */
-			/* dn_cpy->dn_flags = dn->dn_flags; */
-			list_insert(&dep_cpy->d_nodes, dn_cpy);
-		}
-		
-		list_insert(dest, dep_cpy);
-	}
-	
-	/* Construct internal tree */
-	dep_construct_tree(dest);
-	
-	return 0;
-}
-
-
-static void
-dep_tree_print(FILE *fp, dep_t *start, dep_t *dep, int level)
-{
-	dep_node_t *dn = NULL;
-	int x, c;
-	
-	if (!dep)
-		return;
-	
-	if ((dep == start) && level) {
-		fprintf(fp, "[cycles to %s]\n", start->d_name);
-		return;
-	}
-	
-	fprintf(fp, "%s\n",dep->d_name);
-	
-	if (dep->d_nodes) {
-		list_for(&dep->d_nodes, dn, c) {
-			for (x = 0; x < level; x++)
-				fprintf(fp, "         ");
-			fprintf(fp, "|\n");
-			for (x = 0; x < level; x++)
-				fprintf(fp, "         ");
-			fprintf(fp, "+-");
-			switch(dn->dn_colo) {
-			case DEP_COLO_UNSPEC:
-				fprintf(fp, "--");
-				break;
-			case DEP_COLO_ALWAYS:
-				fprintf(fp, "Ca");
-				break;
-			case DEP_COLO_NEVER:
-				fprintf(fp, "Cn");
-				break;
-			}
-			switch(dn->dn_req) {
-			case DEP_REQ_UNSPEC:
-				fprintf(fp, "--");
-				break;
-			case DEP_REQ_START:
-				fprintf(fp, "Rs");
-				break;
-			case DEP_REQ_ALWAYS:
-				fprintf(fp, "Ra");
-				break;
-			}
-			fprintf(fp, "-> ");
-			
-			if (dn->dn_traversed) {
-				fprintf(fp, "[cycles to %s]\n",
-					dn->dn_ptr->d_name);
-			} else {
-				dn->dn_traversed = 1;
-				dep_tree_print(fp, start, dn->dn_ptr, level+1);
-				dn->dn_traversed = 0;
-			}
-			      
-		}
-	}
-}
-
-
-static void
-_dot_clean_string(char *str)
-{
-	int x;
-	
-	/*
-	if (strncmp(str, "service:", 8) == 0)
-		memmove(str, str+8, strlen(str)-8+1);
-	*/
-	
-	if (!isalpha(str[0]))
-		str[0] = '_';
-	
-	for (x = 0; x < strlen(str); x++) {
-		if (isalnum(str[x]))
-			continue;
-		if (str[x] == '_' || str[x] == '-')
-			continue;
-		str[x] = '_';
-	}
-}
-
-
-void
-print_dep_tree_dot(FILE *fp, dep_t *start, dep_t *dep, int level)
-{
-	dep_node_t *dn = NULL;
-	char src[64], dest[64];
-	int c;
-	
-	if (!dep)
-		return;
-	
-	if ((dep == start) && level)
-		return;
-	
-	if (dep->d_nodes) {
-		list_for(&dep->d_nodes, dn, c) {
-			if (dn->dn_traversed)
-				continue;
-			
-			strncpy(src, dep->d_name, sizeof(src));
-			strncpy(dest, dn->dn_name, sizeof(dest));
-			_dot_clean_string(src);
-			_dot_clean_string(dest);
-		
-			dn->dn_traversed = 1;
-			switch(dn->dn_colo) {
-			case DEP_COLO_UNSPEC:
-				break;
-			case DEP_COLO_ALWAYS:
-				fprintf(fp, "\tedge [color=black, "
-					    "arrowhead=diamond, label=\"Ca\"");
-				if (dn->dn_flags & DN_BROKEN_COLO)
-					fprintf(fp, ", style=dashed");
-				else
-					fprintf(fp, ", style=solid");
-				fprintf(fp, "];\n");
-				fprintf(fp, "\t%s -> %s;\n", src, dest);
-				break;
-			case DEP_COLO_NEVER:
-				fprintf(fp, "\tedge [color=red, "
-					    "arrowhead=diamond, label=\"Cn\"");
-				if (dn->dn_flags & DN_BROKEN_NONCOLO)
-					fprintf(fp, ", style=dashed");
-				else
-					fprintf(fp, ", style=solid");
-				fprintf(fp, "];\n");
-				fprintf(fp, "\t%s -> %s;\n", src, dest);
-				break;
-			}
-			switch(dn->dn_req) {
-			case DEP_REQ_UNSPEC:
-				break;
-			case DEP_REQ_START:
-				fprintf(fp, "\tedge [color=green, "
-					    "arrowhead=vee, label=\"Rs\"");
-				if (dn->dn_flags & DN_BROKEN_REQ)
-					fprintf(fp, ", style=dashed");
-				else
-					fprintf(fp, ", style=solid");
-				fprintf(fp, "];\n");
-				fprintf(fp, "\t%s -> %s;\n", src, dest);
-				break;
-			case DEP_REQ_ALWAYS:
-				fprintf(fp, "\tedge [color=black, "
-					    "arrowhead=vee, label=\"Ra\"");
-				if (dn->dn_flags & DN_BROKEN_REQ)
-					fprintf(fp, ", style=dashed");
-				else
-					fprintf(fp, ", style=solid");
-				fprintf(fp, "];\n");
-				fprintf(fp, "\t%s -> %s;\n", src, dest);
-				break;
-			}
-			
-			print_dep_tree_dot(fp, start, dn->dn_ptr, level+1);
-			      
-		}
-	}
-}
-
-
-/**
- * Check for cyclic 'require' dependency.
- */
-static int
-find_cyclic_req(dep_t *dep, dep_t *what)
-{
-	dep_node_t *dn;
-	int ret, c;
-	
-	if (dep == what)
-		return 2;
-	
-	if (!dep->d_nodes)
-		return 0;
-	
-	/* initialize */
-	if (what == NULL)
-		what = dep;
-	
-	list_for(&dep->d_nodes, dn, c) {
-		
-		if (!dn->dn_traversed &&
-		    dn->dn_req != DEP_REQ_UNSPEC) {
-			dn->dn_traversed = 1;
-			ret = find_cyclic_req(dn->dn_ptr, what);
-			dn->dn_traversed = 0;
-			
-			if (ret == 2) {
-				printf("Error: Cyclic Requirement: \n");
-				printf("   %s ... -> %s -> %s\n",
-					what->d_name,
-					dep->d_name,
-					dn->dn_ptr->d_name);
-			}
-			if (ret)
-				return 1;
-		} else if (dn->dn_traversed)
-			return 1;
-	}
-	
-	return 0;
-}
-
-
-/**
- * Tag all nodes which have colocation requirements
- */
-static int
-tag_colo(dep_t *dep, dep_t *what, dep_colo_t colo)
-{
-	dep_node_t *dn;
-	int ret = 0, c;
-	
-	/* How did we get here? */
-	switch(colo) {
-	case DEP_COLO_ALWAYS:
-		if (dep->d_flags & DEP_FLAG_NEVER)
-			ret = 1;
-		dep->d_flags |= DEP_FLAG_ALWAYS;
-		break;
-	case DEP_COLO_NEVER:
-		if (dep->d_flags & DEP_FLAG_ALWAYS)
-			ret = 1;
-		dep->d_flags |= DEP_FLAG_NEVER;
-		break;
-	default:
-		break;
-	}
-	
-	if (dep == what) 
-		goto out;
-	
-	if (!dep->d_nodes)
-		goto out;
-	
-	/* Start if this is the first call*/
-	if (what == NULL)
-		what = dep;
-	
-	list_for(&dep->d_nodes, dn, c) {
-		
-		if (!dn->dn_traversed) {
-			dn->dn_traversed = 1;
-			ret += tag_colo(dn->dn_ptr, what, dn->dn_colo);
-			dn->dn_traversed = 0;
-		}
-		
-	}
-	
-out:
-	if (ret)
-		dep->d_flags |= DEP_FLAG_IMPOSSIBLE;
-	return ret;
-}
-
-
-int
-dep_print_dep_errors(dep_t **deps)
-{
-	dep_t *dep;
-	dep_node_t *dn;
-	int a, b;
-	
-	list_for(deps, dep, a) {
-		list_for(&dep->d_nodes, dn, b) {
-			if (dn->dn_flags & DN_BROKEN_COLO) {
-				printf("Resource %s must colocate with "
-				       "resource %s\n", dep->d_name,
-				       dn->dn_name);
-			}
-			if (dn->dn_flags & DN_BROKEN_NONCOLO) {
-				printf("Resource %s must never colocate with "
-					"resource %s\n", dep->d_name,
-					dn->dn_name);
-			}
-			if (dn->dn_flags & DN_BROKEN_REQ) {
-				printf("Resource %s depends on "
-					"resource %s\n", dep->d_name,
-					dn->dn_name);
-			}
-		}
-	}
-	
-	return 0;
-}
-
-
-int
-dep_print_state_errors(dep_rs_t *rs, int slen)
-{
-	int x;
-	
-	for (x = 0; x < slen; x++) {
-		if (rs[x].rs_flags & RS_ILLEGAL_NODE)
-			printf("Resource %s on illegal node %d\n",
-				rs[x].rs_status.rs_name,
-				rs[x].rs_status.rs_owner);
-		if (rs[x].rs_flags & RS_DEAD_NODE)
-			printf("Resource %s on dead/offline node %d\n",
-				rs[x].rs_status.rs_name,
-				rs[x].rs_status.rs_owner);
-	}
-	return 0;
-}
-
-
-/**
- * clear our loop detection
- */
-int
-dep_clear_dep_errors(dep_t **deps)
-{
-	dep_t *dep;
-	dep_node_t *dn;
-	int a, b;
-	
-	list_for(deps, dep, a) {
-		dep->d_flags &= ~(DEP_FLAG_ALWAYS | DEP_FLAG_NEVER);
-		
-		list_for(&dep->d_nodes, dn, b) {
-			dn->dn_traversed = 0;
-			dn->dn_flags = 0;
-		}
-	}
-	
-	return 0;
-}
-
-
-int
-dep_clear_traversed(dep_t **deps)
-{
-	dep_t *dep;
-	dep_node_t *dn;
-	int a, b;
-	
-	list_for(deps, dep, a) {
-		list_for(&dep->d_nodes, dn, b) {
-			dn->dn_traversed = 0;
-		}
-	}
-	
-	return 0;
-}
-
-
-int
-dep_clear_state_errors(dep_rs_t *rs, int slen)
-{
-	int x;
-	for (x = 0; x < slen; x++)
-		rs[x].rs_flags &= ~(RS_ILLEGAL_NODE|RS_DEAD_NODE);
-	return 0;
-}
-
-
-void
-dep_reset(dep_t **deps, dep_rs_t *rs, int slen)
-{
-	dep_clear_dep_errors(deps);
-	dep_clear_state_errors(rs, slen);
-}
-
-
-void
-dep_print_errors(dep_t **deps, dep_rs_t *rs, int slen)
-{
-	dep_print_dep_errors(deps);
-	dep_print_state_errors(rs, slen);
-}
-
-
-int
-dep_graph_validate(dep_t **deps)
-{
-	dep_t *dep;
-	dep_flag_t f;
-	int a;
-	
-	list_for(deps, dep, a) {
-		
-		if (find_cyclic_req(dep, NULL)) {
-			printf("Cyclic requirement dependency in block %s\n",
-					dep->d_name);
-			dep->d_flags |= DEP_FLAG_CYCLIC;
-		}
-		
-		tag_colo(dep, NULL, 0);
-	}
-	
-	f = (DEP_FLAG_ALWAYS | DEP_FLAG_NEVER);
-	list_for(deps, dep, a) {
-		if (((dep->d_flags & f) == f) ||
-		    (dep->d_flags & DEP_FLAG_IMPOSSIBLE)) {
-			printf("Graph %s: colocation conflict\n", dep->d_name);
-			dep->d_flags |= DEP_FLAG_IMPOSSIBLE;
-		}
-	}
-	
-	return 0;
-}
-
-
-void
-print_depends(FILE *fp, dep_t **deps)
-{
-	dep_t *dep;
-	int a;
-
-	list_for(deps, dep, a) {
-		if (dep->d_nodes && !(dep->d_flags & DEP_FLAG_IMPLIED) &&
-		    dep->d_hits == 0) {
-			dep_tree_print(fp, dep, dep, 0); 
-			fprintf(fp,"\n");
-		}
-	}
-}
-
-
-static void
-_print_depends_dot(FILE *fp, dep_t **deps)
-{
-	dep_t *dep;
-	int a;
-
-	list_for(deps, dep, a) {
-		print_dep_tree_dot(fp, dep, dep, 0); 
-	}
-	
-	dep_clear_traversed(deps);
-}
-
-
-void
-print_depends_dot(FILE *fp, dep_t **deps)
-{
-	fprintf(fp, "digraph G {\n");
-	_print_depends_dot(fp, deps);
-	fprintf(fp, "}\n");
-}
-
-
-/**
- * check to ensure a resource is on an allowed node.
- * Note - makes no assumption about the actual resource state; it could be
- * in the stopped state.
- */
-int
-dep_check_res_loc(dep_rs_t *state)
-{
-	int x;
-	
-	if (!rs_running(NULL, state, 1)) {
-		/* Not running = location is perfectly fine ... sort of */
-		return 0;
-	}
-		
-	if (!state->rs_allowed || state->rs_allowed_len <= 0)
-		return 0;
-	
-	for (x = 0; x < state->rs_allowed_len; x++) {
-		if (state->rs_status.rs_owner == state->rs_allowed[x])
-			return 0;
-	}
-	
-	/* Didn't match a legal node -> fail */
-	state->rs_flags |= RS_ILLEGAL_NODE;
-	return 1;
-}
-
-
-static dep_t *
-find_dep(dep_t **deps, char *name)
-{
-	dep_t *dep = NULL;
-	int a;
-	
-	if (!deps)
-		return NULL;
-	
-	list_for(deps, dep, a) {
-		if (!strcasecmp(dep->d_name, name))
-			return dep;
-	}
-	
-	return NULL;
-}
-
-
-/**
- * traverses the requirements tree looking for 'name'
- * returns 1 if found, 0 if not
- */
-static int
-_tree_walk_req(dep_t *dep, dep_rs_t *state, dep_rs_t *sl, int slen)
-{
-	dep_node_t *dn;
-	int errors = 0, ret, a;
-	
-	if (!dep  || !dep->d_nodes)
-		return 0;
-	
-	list_for(&dep->d_nodes, dn, a) {
-		
-		/* If we have a specified requirement... */
-		ret = 0;
-		if (!dn->dn_traversed &&
-		    dn->dn_req != DEP_REQ_UNSPEC) {
-			
-			/* see if our child is running.  If not, we're done */
-			ret = rs_running(dn->dn_name, sl, slen);
-			
-			/* XXX check for req-start vs. req-always */
-			if (ret <= 0) {
-				dn->dn_flags |= DN_BROKEN_REQ;
-				state->rs_flags |= RS_BROKEN;
-				ret = 1;
-			} else {
-				dn->dn_traversed = 1;
-				ret = _tree_walk_req(dn->dn_ptr,
-						_find_state(dn->dn_name, sl, slen), sl, slen);
-				dn->dn_traversed = 0;
-			}
-			
-			if (ret) {
-				errors += ret;
-				dn->dn_flags |= DN_BROKEN_REQ;
-				state->rs_flags |= RS_BROKEN;
-			}
-		}
-	}
-	
-	return errors;
-}
-
-/*
- * Returns nonzero if something requires this resource, 0 if not
- */
-int
-dep_check_requires(dep_t **deps, dep_rs_t *state, dep_rs_t *states, int slen)
-{
-	dep_t *dep;
-	int errors = 0, a;
-	
-	/* Check to see if anything depends on this (not-running) resource */
-	list_for(deps, dep, a) {
-		errors += _tree_walk_req(dep, NULL, /*state->rs_status.rs_name,*/
-					 states, slen);
-	}
-	
-	/* Flag requirements on any broken-dep resources as broken, too... */
-	dep_clear_traversed(deps);
-	
-	return errors;
-}
-
-
-/**
- * Check to see if this resource is causing a conflict.  It can cause a
- * conflict if it is stopped but other resources depend on it.
- * If it is running, it can not cause a requirement conflict, but it might
- * cause a colocation conflict.
- */
-static int
-_dep_check_requires(dep_t **deps, dep_rs_t *state, dep_rs_t *states, int slen)
-{
-	/* if not running, it has no dependencies */
-	if (!rs_running(NULL, state, 1))
-		return 0;
-	
-	return _tree_walk_req(find_dep(deps, state->rs_status.rs_name),
-			state, states, slen);
-	
-	//return dep_check_requires(deps, state, states, slen);
-}
-
-/**
- * Checks the tree to see if there's a colocation requiremet on the given
- * resource.  Returns 1 if found, 0 if not.
- * returns 1 if found, 0 if not  We don't need to recurse on this one.
- */
-static int
-_tree_walk_colo(dep_t *dep, dep_t *start, char *name, dep_rs_t *sl, int slen)
-{
-	dep_node_t *dn;
-	dep_rs_t *state;
-	int errors = 0, a;
-	
-	if (dep == start) 
-		return 0;
-	
-	if (!dep->d_nodes)
-		return 0;
-	
-	/* Start if this is the first call*/
-	if (start == NULL)
-		start = dep;
-	
-	state = _find_state(dep->d_name, sl, slen);
-	if (!state)
-		return 0;
-	
-	list_for(&dep->d_nodes, dn, a) {
-		
-		/* If we have a specified requirement... */
-		if (!dn->dn_traversed &&
-		    dn->dn_colo == DEP_COLO_ALWAYS) {
-			
-			if (!strcasecmp(dn->dn_name, name) &&
-			    !(dn->dn_flags & DN_BROKEN_COLO)) {
-				/* Broken colocation req */
-				state->rs_flags |= RS_BROKEN;
-				dn->dn_flags |= DN_BROKEN_COLO;
-				++errors;
-			}
-			dn->dn_traversed = 1;
-			errors += _tree_walk_colo(dn->dn_ptr, start, name,
-						  sl, slen);
-			dn->dn_traversed = 0;
-		}
-	}
-	
-	return errors;
-}
-
-
-/**
- * Checks the immediate children of the given dependency to see if there's a
- * non-colocation requiremet on the given resource.  Returns 1 if found,
- * 0 if not.
- */
-static int
-_tree_walk_noncolo(dep_t *dep, dep_t *start, char *name, dep_rs_t *sl,
-		   int slen)
-{
-	dep_node_t *dn;
-	dep_rs_t *state;
-	int errors = 0, a;
-	
-	if (dep == start) 
-		return 0;
-	
-	if (!dep->d_nodes)
-		return 0;
-	
-	/* Start if this is the first call*/
-	if (start == NULL)
-		start = dep;
-	
-	state = _find_state(dep->d_name, sl, slen);
-	if (!state)
-		return 0;
-	
-	list_for(&dep->d_nodes, dn, a) {
-		
-		/* If we have a specified requirement... */
-		if (dn->dn_colo == DEP_COLO_NEVER) {
-			
-			if (!strcasecmp(dn->dn_name, name) &&
-			    !(dn->dn_flags & DN_BROKEN_COLO)) {
-				/* Broken noncolo req */
-				state->rs_flags |= RS_BROKEN;
-				dn->dn_flags |= DN_BROKEN_NONCOLO;
-				++errors;
-			}
-		}
-	}
-	
-	return errors;
-}
-
-
-int
-dep_check_colo(dep_t **deps, dep_rs_t *states, int slen,
-	       char *name, int nodeid)
-{
-	dep_t *dep;
-	int x, errors = 0;
-	
-	if (!deps)
-		return 0;
-	dep = find_dep(deps, name);
-	if (!dep)
-		return 0;
-	
-	for (x = 0; x < slen; x++) {
-		
-		if (!rs_running(NULL, &states[x], 1)) {
-			/*
-			 * Non-running resources don't cause colo/noncolo
-			 * conflicts
-			 */
-			continue;
-		}
-		
-		/*
-		 * Two resources on different nodes... see if the specified
-		 * one is causing a colocation conflict (e.g. another one
-		 * must colocate with it)
-		 */
-		if (states[x].rs_status.rs_owner != nodeid) {
-			errors += _tree_walk_colo(dep, NULL,
-					states[x].rs_status.rs_name, states,
-					slen);
-		}
-		
-		/*
-		 * two resources on the same node... see if the specified one
-		 * is causing a colocation conflict (e.g. another one must
-		 * NOT colocate with it)
-		 */
-		if (states[x].rs_status.rs_owner == nodeid) {
-			errors += _tree_walk_noncolo(dep, NULL,
-					states[x].rs_status.rs_name,
-					states, slen);
-		}
-	}
-	
-	dep_clear_traversed(deps);
-	
-	return errors;
-}
-
-
-/**
- * Check to see if this resource is causing a colocation conflict.  It can
- * not cause if it is stopped.  If it is running, it can cause a colocation
- * conflict if something must not colocate with it.
- */
-static int
-_dep_check_colo(dep_t **deps, dep_rs_t *states, int slen, dep_rs_t *state)
-{
-	if (!rs_running(NULL, state, 1)) {
-		/* not running : cannot be causing a colo conflict */
-		return 0;
-	}
-	
-	return dep_check_colo(deps,
-			      states,
-			      slen,
-			      state->rs_status.rs_name,
-			      state->rs_status.rs_owner);
-}
-
-
-int
-dep_check_online(dep_rs_t *rs, int *nodes, int nlen)
-{
-	int x;
-	
-	if (!rs_running(NULL, rs, 1)) {
-		return 0;
-	}
-	for (x = 0; x < nlen; x++){
-		if (rs->rs_status.rs_owner == nodes[x])
-			return 0;
-	}
-	
-	rs->rs_flags |= RS_DEAD_NODE;
-	return 1;
-}
-
-
-/**
- * Validate the current state of the cluster.  This traverses the dependency
- * graph looking for conflicts, as well as obvious errors (e.g. resource
- * outside failover domain constraint, for example.
- * 
- * @return		-1 for invalid, 0 for ideal, or the # of services 
- * 			which need to be started to become ideal.
- */
-int
-dep_check(dep_t **deps, dep_rs_t *states, int slen, int *nodes, int nlen)
-{
-	int x, ret = 0, errors = 0;
-	
-	dep_clear_dep_errors(deps);
-	dep_clear_state_errors(states, slen);
-	
-	for (x = 0; x < slen; x++) {
-		
-		if (states[x].rs_status.rs_state == RG_STATE_STOPPED)
-			++ret;
-			
-		/*
-		 * Pass 1: Check for services started on dead nodes
-		 */
-		errors += dep_check_online(&states[x], nodes, nlen);
-	
-		/*
-		 * Pass 2: Check obvious legal-targets for resources
-		 * (failover domain)
-		 */
-		errors += dep_check_res_loc(&states[x]);
-	
-		/*
-		 * Pass 3: Check to see if this resource has all of its a 
-		 * resource dependencies satisfied.
-		 */
-		errors += _dep_check_requires(deps, &states[x], states, slen);
-		
-		/*
-		 * Pass 4: Check to see if this resource is causing a
-		 * colocation conflict (e.g. is cohabiting with a resource
-		 * which must run apart from it)
-		 */
-		errors += _dep_check_colo(deps, states, slen, &states[x]);
-	}
-	
-	if (errors)
-		return -errors;
-	
-	return ret;
-}
-
-
-int
-dep_cluster_state_dot(FILE *fp, dep_t **deps, dep_rs_t *states, int slen,
-		      int *nodes, int nlen)
-{
-	int x, y, z, tmp, off = 0;
-	char str[64];
-	
-	fprintf(fp, "digraph G {\n");
-	
-	/* Print out node states */
-	for (x = 0; x < nlen; x++) {
-		fprintf(fp, "\tsubgraph cluster_%d {\n", x);
-		fprintf(fp, "\t\tlabel=node%d;\n", nodes[x]);
-		fprintf(fp, "\t\tstyle=filled;\n");
-		fprintf(fp, "\t\tcolor=lightgrey;\n");
-		fprintf(fp, "\t\tfontcolor=black;\n");
-		fprintf(fp, "\t\tnode [style=filled, color=lightgrey, "
-			"fontcolor=lightgrey];\n");
-		
-		z = 0;
-		
-		for (y = 0; y < slen; y++) {
-			if (rs_running(NULL, &states[y], 1) &&
-			    states[y].rs_status.rs_owner == nodes[x]) {
-				tmp = 0;
-				if (!states[y].rs_allowed_len)
-					tmp = 1;
-				else {
-					for (z = 0; z<states[y].rs_allowed_len;
-					     z++) {
-						if (states[y].rs_allowed[z] == 
-						    states[y].rs_status.rs_owner) {
-							tmp = 1;
-							break;
-						}
-					}
-				}
-				
-				++z;
-				
-				if (!tmp) {
-					fprintf(fp, "\t\tnode [style=filled, "
-						    "color=\"#ff6060\", "
-						    "shape=box, "
-						    "fontcolor=black];\n");
-				} else {
-					fprintf(fp, "\t\tnode [style=filled, "
-						    "color=white, shape=box, "
-						    "fontcolor=black];\n");
-				}
-				
-				strncpy(str, states[y].rs_status.rs_name,
-					sizeof(str));
-				_dot_clean_string(str);
-				fprintf(fp, "\t\t%s;\n", str);
-			}
-		}
-		
-		if (!z) {
-			snprintf(str, sizeof(str), "node%d", x);
-			fprintf(fp, "\t\t%s;\n", str);
-		}
-		fprintf(fp, "\t}\n");
-	}
-	
-	/* Show all 'started' on dead node resources in a red "node" */
-	off = 0;
-	for (x = 0; x < slen; x++) {
-		
-		if (!(states[x].rs_flags & RS_DEAD_NODE))
-			continue;
-		
-		if (!off) {
-			off = 1;
-			fprintf(fp, "\tsubgraph cluster_%d {\n", nlen+1);
-			fprintf(fp, "\t\tlabel=Dead;\n");
-			fprintf(fp, "\t\tstyle=filled;\n");
-			fprintf(fp, "\t\tcolor=\"#ff6060\";\n");
-			fprintf(fp, "\t\tfontcolor=black;\n");
-			fprintf(fp, "\t\tnode [color=white, style=filled, "
-				    "shape=box, fontcolor=black];\n");
-		}
-			
-		strncpy(str, states[x].rs_status.rs_name, sizeof(str));
-		_dot_clean_string(str);
-		fprintf(fp, "\t\t%s;\n", str);
-	}
-	
-	if (off)
-		fprintf(fp, "\t}\n");
-	
-	/* Show all 'stopped' in a 'stopped' "node" */
-	fprintf(fp, "\tsubgraph cluster_%d {\n", nlen+2);
-	fprintf(fp, "\t\tstyle=filled;\n");
-	fprintf(fp, "\t\tcolor=\"#60ff60\";\n");
-	fprintf(fp, "\t\tfontcolor=black;\n");
-	fprintf(fp, "\t\tlabel=Stopped;\n");
-	fprintf(fp, "\t\tnode [color=white, style=filled, shape=box, "
-		    "fontcolor=black];\n");
-	
-	z = 0;
-	for (x = 0; x < slen; x++) {
-		
-		if (states[x].rs_status.rs_state != RG_STATE_STOPPED)
-			continue;
-		
-		strncpy(str, states[x].rs_status.rs_name, sizeof(str));
-		_dot_clean_string(str);
-		
-		++z;
-		fprintf(fp, "\t\t%s;\n", str);
-	}
-	
-	if (!z) {
-		fprintf(fp, "\t\tnode [style=filled, color=\"#60ff60\", "
-			    "fontcolor=\"#60ff60\"];\n");
-		fprintf(fp, "\t\tStopped;\n");
-	}
-	
-	fprintf(fp, "\t}\n");
-	
-	/* Show all 'disabled' in a 'disabled' "node" */
-	fprintf(fp, "\tsubgraph cluster_%d {\n", nlen+3);
-	fprintf(fp, "\t\tlabel=Disabled;\n");
-	fprintf(fp, "\t\tstyle=filled;\n");
-	fprintf(fp, "\t\tcolor=\"#6060ff\";\n");
-	fprintf(fp, "\t\tfontcolor=black;\n");
-	fprintf(fp, "\t\tnode [color=white, style=filled, shape=box, "
-		    "fontcolor=black];\n");
-	
-	z = 0;
-	for (x = 0; x < slen; x++) {
-		
-		if (states[x].rs_status.rs_state != RG_STATE_DISABLED)
-			continue;
-		
-		++z;
-		strncpy(str, states[x].rs_status.rs_name, sizeof(str));
-		_dot_clean_string(str);
-		fprintf(fp, "\t\t%s;\n", str);
-	}
-	
-	if (!z) {
-		fprintf(fp, "\t\tnode [style=filled, color=\"#6060ff\", "
-			    "fontcolor=\"#6060ff\"];\n");
-		fprintf(fp, "\t\tDisabled;\n");
-	}
-		
-	fprintf(fp, "\t}\n");
-			
-	_print_depends_dot(fp, deps);
-	
-	fprintf(fp, "}\n");
-	
-	return 0;
-}
-
-
-int
-dep_cluster_state(FILE *fp, dep_t **deps, dep_rs_t *states, int slen,
-		  int *nodes, int nlen)
-{
-	int x, y, z, tmp, off = 0;
-	
-	/* Print out node states */
-	for (x = 0; x < nlen; x++) {
-		fprintf(fp, "Node %d\n", nodes[x]);
-		
-		for (y = 0; y < slen; y++) {
-			if (rs_running(NULL, &states[y], 1) &&
-			    states[y].rs_status.rs_owner == nodes[x]) {
-				tmp = 0;
-				if (!states[y].rs_allowed_len)
-					tmp = 1;
-				else {
-					for (z = 0; z<states[y].rs_allowed_len;
-					     z++) {
-						if (states[y].rs_allowed[z] == 
-						    states[y].rs_status.rs_owner) {
-							tmp = 1;
-							break;
-						}
-					}
-				}
-				
-				if (!tmp) {
-					fprintf(fp, "\t[ILLEGAL] ");
-				} else {
-					fprintf(fp, "\t");
-				}
-				
-				fprintf(fp, "%s\n",
-					states[y].rs_status.rs_name);
-			}
-		}
-		fprintf(fp, "\n");
-	}
-	
-	/* Show all 'started' on dead node resources in a red "node" */
-	off = 0;
-	for (x = 0; x < slen; x++) {
-		
-		if (!(states[x].rs_flags & RS_DEAD_NODE))
-			continue;
-		
-		if (!off) {
-			off = 1;
-			fprintf(fp, "Resources on dead nodes:\n");
-		}
-			
-		fprintf(fp, "\t%s\n", states[x].rs_status.rs_name);
-	}
-	
-	if (off)
-		fprintf(fp, "\n");
-	
-	/* Show all 'stopped' in a 'stopped' "node" */
-	fprintf(fp, "Stopped resources:\n");
-	
-	z = 0;
-	for (x = 0; x < slen; x++) {
-		
-		if (states[x].rs_status.rs_state != RG_STATE_STOPPED)
-			continue;
-		
-		fprintf(fp, "\t%s;\n", states[x].rs_status.rs_name);
-	}
-	
-	fprintf(fp, "\n");
-	
-	/* Show all 'disabled' */
-	fprintf(fp, "Disabled resources:\n");
-	
-	z = 0;
-	for (x = 0; x < slen; x++) {
-		
-		if (states[x].rs_status.rs_state != RG_STATE_DISABLED)
-			continue;
-		
-		fprintf(fp, "\t%s;\n", states[x].rs_status.rs_name);
-	}
-	
-	fprintf(fp, "\n");
-	
-	return 0;
-}
-
-/**
-   Gets an attribute of a resource group.
-
-   @param res		Resource
-   @param property	Name of property to check for
-   @param ret		Preallocated return buffer
-   @param len		Length of buffer pointed to by ret
-   @return		0 on success, -1 on failure.
- */
-int
-res_property(resource_t *res, char *property, char *ret, size_t len)
-{
-	int x = 0;
-
-	if (!res)
-		return -1;
-
-	for (; res->r_attrs[x].ra_name; x++) {
-		if (strcasecmp(res->r_attrs[x].ra_name, property))
-			continue;
-		strncpy(ret, res->r_attrs[x].ra_value, len);
-		return 0;
-	}
-
-	return 1;
-}
-
-
-static void
-_set_allowed(dep_rs_t *state, fod_t *domain, int *nodes, int nlen)
-{
-	fod_node_t *fdn;
-	int cnt = 0, allowed = 0, x, y, z, tmp;
-	
-	if (!domain) {
-		state->rs_allowed = malloc(sizeof(int)*nlen);
-		state->rs_allowed_len = nlen;
-		
-		if (!state->rs_allowed)
-			return;
-		memcpy(state->rs_allowed, nodes, sizeof(int)*nlen);
-		return;
-	}
-	
-	if (domain->fd_flags & FOD_RESTRICTED) {
-		list_for(&domain->fd_nodes, fdn, allowed);
-	} else {
-		allowed = nlen;
-	}
-	
-	state->rs_allowed = malloc(sizeof(int)*allowed);
-	state->rs_allowed_len = allowed;
-	state->rs_flags = 0;
-	
-	if (!state->rs_allowed)
-		return;
-	
-	memset(state->rs_allowed, 0, sizeof(int)*allowed);
-	
-	cnt = 0;
-	/* Failover domain prios are 1..100 */
-	if (!(domain->fd_flags & FOD_ORDERED)) {
-		
-		/* Non-prio failover domain */
-		list_for(&domain->fd_nodes, fdn, x) {
-			state->rs_allowed[cnt++] = fdn->fdn_nodeid;
-		}
-	} else {
-		for (x = 0; x <= 100; x++) {
-			list_for(&domain->fd_nodes, fdn, y) {
-				if (fdn->fdn_prio != x)
-					continue;
-				state->rs_allowed[cnt++] = fdn->fdn_nodeid;
-			}
-		}
-		
-		state->rs_flags |= RS_ORDERED;
-		
-		if (!(domain->fd_flags & FOD_NOFAILBACK))
-			state->rs_flags |= RS_FAILBACK;
-	}
-	
-	if (domain->fd_flags & FOD_RESTRICTED)
-		return;
-	
-	/* allowed == nlen */
-	/* find missing nodes and fill them in */
-	for (x = 0; x < allowed; x++) {
-		if (state->rs_allowed[x] != 0)
-			continue;
-		for (y = 0; y < nlen; y++) {
-			
-			tmp = 0;
-			for (z = 0; z < x; z++) {
-				if (nodes[y] == state->rs_allowed[z]) {
-					tmp = 1;
-					break;
-				}
-			}
-			
-			if (!tmp) {
-				state->rs_allowed[x] = nodes[y];
-			}
-		}
-	}
-}
-
-
-dep_rs_t *
-dep_rstate_alloc(resource_node_t **restree, fod_t **domains, int *nodes,
-		 int nlen, int *rs_cnt)
-{
-	dep_rs_t *rstates;
-	resource_node_t *rn;
-	int tl_res_count = 0, x;
-	char dom[64];
-	fod_t *fod;
-	
-	list_for(restree, rn, tl_res_count);
-	
-	rstates = malloc(sizeof(dep_rs_t) * tl_res_count);
-	if (!rstates)
-		return NULL;
-	
-	memset(rstates, 0, (sizeof(dep_rs_t) * tl_res_count));
-	
-	list_for(restree, rn, x) {
-		snprintf(rstates[x].rs_status.rs_name,
-			 sizeof(rstates[x].rs_status.rs_name),
-			 "%s:%s", rn->rn_resource->r_rule->rr_type,
-			 rn->rn_resource->r_attrs[0].ra_value);
-		
-		rstates[x].rs_status.rs_last_owner = 0;
-		rstates[x].rs_status.rs_owner = 0;
-		rstates[x].rs_status.rs_state = RG_STATE_STOPPED;
-		
-		fod = NULL;
-		if (!res_property(rn->rn_resource, "domain", dom,
-				sizeof(dom))) {
-			
-			fod = fod_find_domain(domains, dom);
-		} 
-		_set_allowed(&rstates[x], fod, nodes, nlen);
-	}
-	
-	*rs_cnt = tl_res_count;
-	
-	return rstates;
-}
-
-
-void
-dep_rstate_free(dep_rs_t *states, int slen)
-{
-	int x;
-	
-	if (!states)
-		return;
-	if (!slen)
-		return;
-	
-	for (x = 0; x < slen; x++) {
-		if (states[x].rs_allowed && states[x].rs_allowed_len) {
-			free(states[x].rs_allowed);
-			states[x].rs_allowed = NULL;
-			states[x].rs_allowed_len = 0;
-		}
-	}
-	
-	free(states);
-}
-
-
-dep_rs_t *
-dep_rstate_dup(dep_rs_t *states, int slen)
-{
-	dep_rs_t *states_new;
-	int x;
-	
-	while ((states_new = malloc(sizeof(dep_rs_t) * slen)) == NULL)
-		usleep(10000);
-	
-	memcpy(states_new, states, sizeof(dep_rs_t) * slen);
-	
-	for (x = 0; x < slen; x++) {
-		if (!states[x].rs_allowed || !states[x].rs_allowed_len) {
-			states_new[x].rs_allowed = NULL;
-			continue;
-		}
-		
-		while ((states_new[x].rs_allowed =
-			malloc(sizeof(int) * states[x].rs_allowed_len))==NULL)
-			usleep(10000);
-		
-		memcpy(states_new[x].rs_allowed,
-		       states[x].rs_allowed,
-		       sizeof(int) * states[x].rs_allowed_len);
-	}
-		
-	return states_new;
-}	
-
-
-/**
- * copy everything from src into dest except for the allowed pointer arrays
- */
-void
-dep_rstate_copy(dep_rs_t *dest, dep_rs_t *src, int slen)
-{
-	int x, *ap;
-	
-	for (x = 0; x < slen; x ++) {
-		ap = dest[x].rs_allowed;
-		memcpy(&dest[x], &src[x], sizeof(dep_rs_t));
-		dest[x].rs_allowed = ap;
-	}
-}	
-
-
-static int
-dep_srt_cmp(dep_t *l, dep_rs_t *ls, dep_t *r, dep_rs_t *rs)
-{
-	
-	if (ls->rs_status.rs_state == RG_STATE_STOPPED &&
-	    rs->rs_status.rs_state != RG_STATE_STOPPED)
-		return 1;
-	
-	if (ls->rs_status.rs_state != RG_STATE_STOPPED &&
-	    rs->rs_status.rs_state == RG_STATE_STOPPED)
-		return -1;
-	
-	if (ls->rs_status.rs_state != RG_STATE_STOPPED &&
-	    rs->rs_status.rs_state != RG_STATE_STOPPED) {
-		
-		if (!l && r)
-			return -1;
-		if (r && !l)
-			return 1;
-		if (!r && !l)
-			return 0;
-		
-		/* running resource */
-		/*
-		 * Left is greater if the hits exceed, or left's
-		 * hits are zero
-		 */
-		if (l->d_hits == 0 && r->d_hits != 0)
-			return -1;
-		if (l->d_hits != 0 && r->d_hits == 0)
-			return 1;
-		
-		/* Otherwise, more hits, the farther away */
-		if (l->d_hits > r->d_hits)
-			return -1;
-		if (l->d_hits < r->d_hits)
-			return 1;
-		return 0;
-	}
-	
-	/* both states are stopped */
-	if (!l && r)
-		return 1;
-	if (l && !r)
-		return -1;
-	if (!r && !l)
-		return 0;
-	if (l->d_deps > r->d_deps)
-		return -1;
-	if (l->d_deps < r->d_deps)
-		return 1;
-	if (l->d_hits > r->d_hits)
-		return -1;
-	if (l->d_hits < r->d_hits)
-		return 1;
-	return 0;
-}
-
-
-void
-dep_rstate_sort(dep_t **deps, dep_rs_t *states, int slen)
-{
-	dep_t *xd, *yd;
-	int x, y;
-	dep_rs_t tmp;
-	
-	/* brute force sort */
-	for (x = 0; x < slen; x++) {
-		for (y = 0; y < x; y++) {
-			xd = find_dep(deps, states[x].rs_status.rs_name);
-			yd = find_dep(deps, states[y].rs_status.rs_name);
-			
-			if (dep_srt_cmp(yd, &states[y], xd, &states[x]) < 0) {
-				memcpy(&tmp, &states[y], sizeof(dep_rs_t));
-				memcpy(&states[y], &states[x],
-				       sizeof(dep_rs_t));
-				memcpy(&states[x], &tmp, sizeof(dep_rs_t));
-			}
-		}
-	}
-}
-
-
-static inline int
-_alter_state_start(dep_t **deps, dep_rs_t *state, int newowner)
-{
-	/* Try starting a resource */
-	if (state->rs_flags & RS_BEEN_STARTED)
-		return 0;
-				
-	/* we just stopped this on this node */
-	if (state->rs_status.rs_last_owner == newowner)
-		return 0;
-				
-	state->rs_status.rs_state = RG_STATE_STARTED;
-	state->rs_status.rs_owner = newowner;
-				
-	/*
-	 * Optimization: don't allow start+stop+start.
-	 * of the same resource, unless it was in an
-	 * error state.
-	 */
-	state->rs_flags |= (RS_BEEN_STARTED | RS_BEEN_STOPPED);
-	
-	return 1;
-}
-
-
-static inline int
-_alter_state_stop(dep_t **deps, dep_rs_t *state)
-{
-	dep_t *dep;
-	dep_node_t *dn;
-	int x;
-	
-	if (state->rs_flags & RS_BEEN_STOPPED)
-		return 0;
-	
-	dep = find_dep(deps, state->rs_status.rs_name);
-	if (!dep) {
-		printf("Dependency missing for %s\n",
-			state->rs_status.rs_name);
-		return 0;
-	}
-	
-#if 0
-	if (dep->d_hits == 0) {
-		/* If nothing depends on this resource, stopping it is 
-		 * pointless
-		 */
-		return 0;
-	}
-#endif
-		
-	state->rs_status.rs_state = RG_STATE_STOPPED;
-	state->rs_status.rs_last_owner = state->rs_status.rs_owner;
-	state->rs_status.rs_owner = 0;
-	state->rs_flags |= RS_BEEN_STOPPED;
-	
-	/* We can clear the state now.  Set the last owner to nobody */
-	if (state->rs_flags & (RS_ILLEGAL_NODE | 
-			       RS_DEAD_NODE    )) {
-		state->rs_status.rs_last_owner = 0;
-		state->rs_flags &= ~(RS_ILLEGAL_NODE | RS_DEAD_NODE);
-		return 1;
-	}
-
-	/*
-	 * If we stopped it because of a broken dependency, then we can
-	 * restart it on the same node. 
-	 */
-	list_for(&dep->d_nodes, dn, x) {
-		if (dn->dn_flags & (DN_BROKEN_COLO   |
-				    DN_BROKEN_REQ    |
-				    DN_BROKEN_NONCOLO)) {
-			state->rs_status.rs_last_owner = 0;
-			return 1;
-		}
-	}
-	
-	return 1;
-}
-
-
-static inline int
-_alter_state(dep_t **deps, dep_rs_t *state, dep_op_t *op)
-{
-	if (!op) {
-		printf("No operation\n");
-		return 0;
-	}
-	
-	if (op->do_op == RG_START)
-		return _alter_state_start(deps, state, op->do_nodeid);
-	return _alter_state_stop(deps, state);
-}	
-
-
-static int *
-build_try_indices(struct _try *tries, int try_cnt, int idx_cnt)
-{
-	int *indices, x, y;
-	/* Build our indices according to score */
-	
-	while ((indices = malloc(sizeof(int)*idx_cnt)) == 0)
-		usleep(10000);
-	y = 0;
-	for (x = 0; x < try_cnt; x++) {
-		if (!tries[x].ops)
-			continue;
-		indices[y] = x;
-		++y;
-	}
-	
-	return indices;
-}
-
-
-static void
-nuke_op_list(dep_op_t **ops)
-{
-	dep_op_t *op;
-	
-	while ((op = *ops) != NULL) {
-		list_remove(ops, op);
-		free(op);
-	}
-}
-
-
-static void
-sort_try_indices(struct _try *tries, int *indices, int idx_cnt,
-		 dep_rs_t *states, int slen)
-{
-	int x, y, z, swp;
-	dep_rs_t *cstate;
-
-	/*
-	 * Got our list of indices into our 'tries' branch array, 
-	 * now sort.  Brutish sort..  Really should take into account error
-	 * states.; e.g. 0 1 2 3 4 5 -1 -2 -3... 
-	 */
-	for (x = 0; x < idx_cnt; x++) {
-		for (y = 0; y < x; y++) {
-			
-			if (tries[indices[x]].score < tries[indices[y]].score){
-				swp = indices[x];
-				indices[x] = indices[y];
-				indices[y] = swp;
-			}
-			
-			if (tries[indices[x]].score != tries[indices[y]].score)
-				continue;
-				
-			/* See if we're ordered */
-			cstate = NULL;
-			for (z = 0; z < slen; z++) {
-				if (!strcmp(tries[indices[y]].ops->do_res,
-					    states[z].rs_status.rs_name)) {
-					    cstate = &states[z];
-					    break;
-				}
-			}
-			
-			if (!cstate || !(cstate->rs_flags & RS_ORDERED))
-				continue;
-			
-			swp = 0;
-			for (z = 0; z < cstate->rs_allowed_len; z++) {
-				if (tries[indices[x]].ops->do_nodeid ==
-				    cstate->rs_allowed[z]) {
-					swp = 1;
-					break;
-				} else if (tries[indices[y]].ops->do_nodeid ==
-				    cstate->rs_allowed[z]) {
-					break;
-				}
-			}
-			
-			if (!swp)
-				continue;
-			
-			swp = indices[x];
-			indices[x] = indices[y];
-			indices[y] = swp;
-		}
-	}
-}
-
-
-static void
-free_try_list(struct _try *tries, int len)
-{
-	int x;
-		
-	/* Clean up all remaining branch lists */
-	for (x = 0; x < len; x++) {
-		if (!tries[x].ops)
-			continue;
-		nuke_op_list(&(tries[x].ops));
-	}
-	
-	/* Clean up branch list array */
-	free(tries);
-}
-
-
-static int
-check_online(int n, int *nodes, int nlen, int *nidx)
-{
-	for (*nidx = 0; *nidx < nlen; (*nidx)++)
-		if (n == nodes[*nidx])
-			return nodes[*nidx];
-	return -1;
-}
-
-
-static void
-insert_try(struct _try *tries, int idx, dep_op_t *op, int score, int iter)
-{
-	dep_op_t *newop;
-	
-	while ((newop = malloc(sizeof(dep_op_t))) == NULL)
-		usleep(10000);
-	memcpy(newop, op, sizeof(dep_op_t));
-	newop->do_iter = iter;
-	list_insert(&(tries[idx].ops), newop);
-	tries[idx].score = score;
-}
-
-
-/**
- * Calculate all of the possible branches from this point.
- * Returns the number of possible branches.
- */
-static int
-build_all_possible_tries(dep_t **deps, dep_rs_t *states_cpy, int slen,
-			 int *nodes, int nlen, int start_score,
-			 struct _try *tries, int iter, int depth)
-{
-	int x, y, nidx, err;
-	dep_rs_t tmp;
-	dep_op_t op;
-	int idx_cnt = 0;
-	
-	for (x = 0; x < slen; x++) {
-		
-		/* Immutable resources can't be moved */
-		if (states_cpy[x].rs_flags & RS_IMMUTABLE)
-			continue;
-		
-		/* can't bother with non-running resources */
-		if (states_cpy[x].rs_status.rs_state == RG_STATE_DISABLED ||
-		    states_cpy[x].rs_status.rs_state == RG_STATE_FAILED)
-			continue;
-		
-		/*
-		 * see if this set has already tried to manipulate this
-		 * service
-		 */
-		if ((states_cpy[x].rs_flags & 
-		    (RS_BEEN_STARTED|RS_BEEN_STOPPED)) ==
-		    (RS_BEEN_STARTED|RS_BEEN_STOPPED))
-			continue;
-		
-		/*
-		 * Since we are operating on the same allowed list (and
-		 * will not be freeing tmp), it's ok to just use memcpy here.
-		 */
-		memcpy(&tmp, &states_cpy[x], sizeof(tmp));
-		
-		op.do_op = RG_START; /* XXX the loop below must happen
-		 		        at least once...*/
-		
-		/* try for each nodeid that's a legal target */
-		for (y = 0; (op.do_op == RG_START) &&
-		            y < states_cpy[x].rs_allowed_len; y++) {
-			
-			memcpy(&states_cpy[x], &tmp, sizeof(tmp));
-			/* 
-			 * Find next node online in our allowed list
-			 * nidx is the offset into the online nodes array
-			 * where this node was found - since the online list
-			 * of nodes might be smaller than the allowed list
-			 * for the resource, we need to keep track of it for
-			 * later.
-			 * 
-			 * XXX Since we sort later in the alg., we can probably
-			 * reverse these loops to get rid of nidx.
-			 */
-			if ((err = check_online(states_cpy[x].rs_allowed[y],
-						nodes, nlen, &nidx)) < 0)
-				continue;
-			
-			/* Reset flags, etc. */
-			memset(&op, 0, sizeof(dep_op_t));
-			
-			if (rs_running(NULL, &states_cpy[x], 1)) {
-			
-				/* Try stopping a resource */
-				op.do_op = RG_STOP;
-				strncpy(op.do_res,
-					states_cpy[x].rs_status.rs_name,
-					sizeof(op.do_res));
-				/*printf("stop %s %d %d %d ", op.do_res,
-					depth, iter, start_score);*/
-				
-			} else if (states_cpy[x].rs_status.rs_state ==
-				   RG_STATE_STOPPED &&
-				   start_score >= 0) {
-			
-				/* Try starting a resource.  We can only
-				 * do this after we clear the errors (e.g. stop)
-				 * resources */
-				op.do_op = RG_START;
-				op.do_nodeid = err;
-				strncpy(op.do_res,
-					states_cpy[x].rs_status.rs_name,
-					sizeof(op.do_res));
-				/*printf("start %s %d %d %d ", op.do_res,
-					depth, iter, start_score);*/
-			} else {
-				/* Other states = can't do anything */
-				continue;
-			}
-			
-			/*
-			 * Try to apply our operation.  If it was an invalid,
-			 * operation, we just move on
-			 */
-			if (_alter_state(deps, &states_cpy[x], &op) == 0)
-				continue;
-	
-			/* Check each possible move at this level */
-			err = dep_check(deps, states_cpy, slen, nodes, nlen);
-			//printf(" [score: %d]\n", err);
-		
-			/* 
-			 * Make sure the operation does not introduce an
-			 * error
-			 */
-			if ((start_score < 0 && err <= start_score) ||
-			    (start_score >= 0 && err < 0)) {
-				/*
-				 * Introduce new error = bad; drop this
-				 * operation.
-				 */
-				/*
-				printf("%s of %s introduced new err %d %d\n",
-					op.do_op==RG_START?"start":"stop",
-					op.do_res,
-					start_score, err);
-				 */
-				continue;
-			}
-			
-			/* No new error - this op is a valid thing to do */
-			/* Insert the op on to the try list and move on */
-			insert_try(tries, x * nlen + nidx, &op, err, iter);
-			
-			/*
-			 * Keep track of how many places we actually
-			 * found a possible branch for returning
-			 */
-			++idx_cnt;
-		}
-		memcpy(&states_cpy[x], &tmp, sizeof(tmp));
-	}
-	
-	return idx_cnt;
-}
-
-			
-/**
- * Breadth-first-search.
- */
-static int
-_dep_calc_trans(dep_t **deps, dep_rs_t *states, int slen, int *nodes, int nlen,
-		int depth, int errors, dep_op_t **oplist, int *iter)
-{
-	int x, y, err;
-	struct _try *tries;
-	dep_rs_t *states_cpy;
-	dep_op_t *newop;
-	int best_idx = -1, best_score, start_score;
-	int *indices = NULL, idx_cnt = 0;
-	
-	x = dep_check(deps, states, slen, nodes, nlen);
-	/* Ideal? */
-	if (x == 0)
-		return 0;
-	/* Introduced a new error? */
-	if ((*iter) && errors < 0 && x <= errors)
-		return x;
-		
-	/* Went from sub-optimal to outright broken? */
-	if (errors > 0 && x < 0)
-		return x;
-	
-	/*
-	 * Impossible to try branch more than 2*slen times: we can only 
-	 * on the outside stop/start every resource in the cluster.
-	 */
-	if (depth > (2*slen))
-		return errors;
-	
-	/* Set up */
-	best_score = start_score = x;
-	++(*iter);
-	/*
-	printf("[%d] start depth %d errors %d init %d\n",
-		*iter, depth, errors, start_score);
-	*/
-	
-	while ((tries = malloc(sizeof(*tries) * slen * nlen)) == NULL)
-		usleep(10000);
-	memset(tries, 0, sizeof(*tries) * slen * nlen);
-	
-	/* Copy our states (don't alter parent's states) */
-	states_cpy = dep_rstate_dup(states, slen);
-	
-	/* Find all possible things to try */
-	idx_cnt = build_all_possible_tries(deps, states_cpy, slen, nodes, nlen,
-					   start_score, tries, *iter, depth);
-
-	/* Build our indices into an array */
-	indices = build_try_indices(tries, nlen*slen, idx_cnt);
-	
-	/* Sort array indices */
-	sort_try_indices(tries, indices, idx_cnt, states_cpy, slen);
-	
-	/*
-	 * Now, do a recurse on the tree in order of best-score-first...
-	 * (that's why we sorted above)
-	 */
-	dep_rstate_copy(states_cpy, states, slen);
-	for (x = 0; x < idx_cnt; x++) {
-		
-		/* state index = tries_index/node count len */
-		y = indices[x] / nlen;
-		
-		/* Back this up for later */
-		dep_rstate_copy(&states_cpy[y], &states[y], 1);
-		
-		/* Flip our state. */
-		if (_alter_state(deps, &states_cpy[y],
-				 tries[indices[x]].ops) == 0) {
-			/* :( */
-			printf("Error: Logic error\n");
-			continue;
-		}
-	
-		/* Recurse */
-		err = _dep_calc_trans(deps, states_cpy, slen, nodes, nlen,
-				      depth + 1, start_score,
-				      &(tries[indices[x]].ops), iter);
-		
-		//dep_rstate_copy(&states_cpy[y], &states[y], 1);
-		
-		/* Store the score for branching on this operation */
-		tries[indices[x]].score = err;
-		
-		/* ... and the depth.  XXX  not done yet; someday, we should
-		 * select the shortest path... 
-		tries[indices[x]].depth = 0;
-		list_for_count(&tries[indices[x]].ops, newop,
-			       tries[indices[x]].depth);
-		 */
-		
-		/* Keep track of our best score */
-		if ((best_score < 0 && err > best_score) ||
-		    (best_score >= 0 && err >= 0 && err < best_score))  {
-			best_idx = indices[x];
-			best_score = err;
-		}
-	}
-	
-	/* Free our index array; we don't need it anymore */
-	free(indices);
-	
-	/* We don't need our temporary space anymore */
-	dep_rstate_free(states_cpy, slen);
-	
-	if ((errors < 0 && best_score < errors) ||
-	    (errors >= 0 && best_score > errors)) {
-		/* No good branch to take from here */
-		best_idx = -1;
-		best_score = start_score;
-	}
-	
-	/* Append the so-called best list on to our passed-in list of
-	 * operations (this goes on tries[...] above) */
-	if (best_idx != -1) {
-		while ((newop = tries[best_idx].ops) != NULL) {
-			list_remove(&(tries[best_idx].ops), newop);
-			list_insert(oplist, newop);
-		}
-		
-		/* Get the best score */
-		best_score = tries[best_idx].score;
-	}
-	
-	free_try_list(tries, nlen * slen);
-	
-	/*
-	printf("[%d] end start score: %d, bestscore: %d  depth: %d\n", *iter,
-		start_score, best_score, depth);
-	 */
-	
-	return best_score;
-}
-
-
-int
-dep_calc_trans(dep_t **deps, dep_rs_t *_states, int slen,
-		int *nodes, int nlen, dep_op_t **op_list, int *iter)
-{
-	int x, my_i, ops = 0, err = 0;
-	dep_op_t *newop;
-	dep_rs_t *states = NULL;
-	
-	if (iter)
-		*iter = 0;
-	else {
-		my_i = 0;
-		iter = &my_i;
-	}
-	
-	x = dep_check(deps, _states, slen, nodes, nlen);
-	if (x == 0)
-		return 0;
-	
-	states = dep_rstate_dup(_states, slen);
-	for (x = 0; x < slen; x++) {
-		if (states[x].rs_flags & (RS_DEAD_NODE|RS_ILLEGAL_NODE)) {
-			states[x].rs_status.rs_state = RG_STATE_STOPPED;
-			while ((newop = malloc(sizeof(*newop))) == NULL)
-				sleep(1);
-			memset(newop, 0, sizeof(*newop));
-			newop->do_op = RG_STOP;
-			strncpy(newop->do_res, states[x].rs_status.rs_name,
-					sizeof(newop->do_res));
-			list_insert(op_list, newop);
-			++ops;
-		}
-	}
-	
-	/*
-	 * Sort: 
-	 * low...
-	 * (a) stopped resources which are not depended on (starting these
-	 *     will not affect any other resources)
-	 * (b) stopped resources which are depended on - where the # of
-	 *     deps is increasing 
-	 * (c) started resources w/ deps, ordered from lowest to highest
-	 * (d) started resources w/ no deps (transitioning these will have
-	 *     -no- effect.)
-	 * ... high
-	 */
-	dep_rstate_sort(deps, states, slen);
-	err = dep_check(deps, states, slen, nodes, nlen);
-	if (err) {
-		err = _dep_calc_trans(deps, states, slen, nodes, nlen, 0,
-				      err, op_list, iter);
-	}
-	
-	dep_rstate_free(states, slen);
-	return err;
-}
-
-
-int
-dep_apply_trans(dep_t **deps, dep_rs_t *states, int slen, dep_op_t **op_list)
-{
-	dep_op_t *op;
-	int ops = 0, x;
-
-	list_for(op_list, op, ops) {
-		for (x = 0; x < slen; x++) {
-			if (strcasecmp(op->do_res, states[x].rs_status.rs_name))
-				continue;
-			if (op->do_op == RG_START) {
-				printf("Start %s on %d [%d]\n",
-				       op->do_res, op->do_nodeid, op->do_iter);
-				states[x].rs_status.rs_state = RG_STATE_STARTED;
-				states[x].rs_status.rs_owner = op->do_nodeid;
-			} else {
-				printf("Stop %s [%d]\n", op->do_res,
-				       op->do_iter);
-				states[x].rs_status.rs_state = RG_STATE_STOPPED;
-				states[x].rs_status.rs_owner = 0;
-				states[x].rs_flags &= ~(RS_ILLEGAL_NODE|
-						        RS_DEAD_NODE);
-			}
-		}
-	}
-	
-	printf("Applied %d operations\n", ops);
-	
-	return 0;
-}
-
-
-void
-reverse_list(dep_op_t **oplist)
-{
-	dep_op_t *new_ol = NULL;
-	dep_op_t *op;
-
-	if (!*oplist)
-		return;
-	
-	while ((op = *oplist)) {
-		list_remove(oplist, op);
-		list_prepend(&new_ol, op);
-	}
-	
-	*oplist = new_ol;
-}
-
-
-void
-insert_after_stops(dep_op_t **oplist, dep_op_t *newop)
-{
-	dep_op_t *new_ol = NULL;
-	dep_op_t *op;
-
-	if (!*oplist)
-		return;
-	
-	while ((op = *oplist) && op->do_op == RG_STOP) {
-		list_remove(oplist, op);
-		list_insert(&new_ol, op);
-	}
-	
-	list_insert(&new_ol, newop);
-	
-	while ((op = *oplist)) {
-		list_remove(oplist, op);
-		list_insert(&new_ol, op);
-	}
-		
-	*oplist = new_ol;
-}
-
-
-/**
- * Generate the list of operations which would satisfy a requested (user)
- * operation (e.g. start, relocate, disable)
- */
-int
-dep_check_operation(char *res, int operation, int target, 
-		    dep_t **deps, dep_rs_t *_states,
-		    int slen, int *nodes, int nlen, dep_op_t **oplist)
-{
-	int ret = -1;
-	dep_rs_t *state = NULL, *states = NULL;
-	dep_op_t *newop = NULL;
-	int start_score, score;
-	
-	states = dep_rstate_dup(_states, slen);
-	start_score = dep_check(deps, _states, slen, nodes, nlen);
-	
-	/* Find the state dealing with */
-	if (!(state = _find_state(res, states, slen))) {
-		printf("No record of that service...\n");
-		dep_rstate_free(states, slen);
-		return -1;
-	}
-	
-	switch(operation) {
-	case RG_DISABLE:
-	case RG_STOP:
-	case RG_START:
-		while ((newop = malloc(sizeof(dep_op_t))) == NULL)
-			usleep(10000);
-		memset(newop, 0, sizeof(dep_op_t));
-	
-		/* Set it up */
-		strncpy(newop->do_res, res, sizeof(newop->do_res));
-		newop->do_op = operation;
-		newop->do_nodeid = target;
-		
-		if (_alter_state(deps, state, newop) == 0)
-			break;
-		
-		state->rs_flags |= RS_IMMUTABLE;
-		
-		start_score = dep_check(deps, states, slen, nodes, nlen);
-		score = dep_calc_trans(deps, states, slen, nodes, nlen,
-					oplist, NULL);
-		if (start_score < 0 && score <= start_score)
-			break;
-		
-		/* Reverse the list if we breake dependencies */
-		if (operation == RG_STOP || operation == RG_DISABLE) {
-			/* Append the operation */
-			reverse_list(oplist);
-			list_insert(oplist, newop);
-		} else {
-			/* append after stops... */
-			insert_after_stops(oplist, newop);
-		}
-		
-		ret = 0; /* Woot */
-		break;
-	case RG_RELOCATE:
-		if (dep_check_operation(res, RG_STOP, -1, deps, states, slen, nodes,
-					nlen, oplist) < 0)
-			break;
-		if (dep_check_operation(res, RG_START, target, deps, states, slen,
-				        nodes, nlen, oplist) < 0)
-			break;
-		ret = 0; /* Woot */
-		break;
-	case RG_MIGRATE:
-	default:
-		break;
-	}
-	
-	/* Ret will be -1 unless we succeeded */
-	if (ret < 0) {
-		if (newop)
-			free(newop);
-			
-		while ((newop = *oplist)) {
-			list_remove(oplist, newop);
-			free(newop);
-		}
-	}
-
-	if (states)
-		dep_rstate_free(states, slen);
-	return ret;
-}
diff --git a/rgmanager/src/daemons/dtest.c b/rgmanager/src/daemons/dtest.c
deleted file mode 100644
index 4e8ad9a..0000000
--- a/rgmanager/src/daemons/dtest.c
+++ /dev/null
@@ -1,817 +0,0 @@
-#include <libxml/parser.h>
-#include <libxml/xmlmemory.h>
-#include <libxml/xpath.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <restart_counter.h>
-#include <resgroup.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <list.h>
-#include <reslist.h>
-#include <pthread.h>
-#include <depends.h>
-#include <ccs.h>
-#include <readline/readline.h>
-#include <readline/history.h>
-
-
-
-#ifndef NO_CCS
-#error "Can not be built with CCS support."
-#endif
-
-#ifdef NO_CCS
-#define ccs_get(fd, query, ret) conf_get(query, ret)
-#endif
-
-void malloc_stats(void);
-void malloc_dump_table(void);
- 
-
-resource_rule_t	*rules = NULL;
-resource_t	*resources = NULL;
-resource_node_t *restree = NULL;
-dep_t		*depends = NULL;
-dep_rs_t	*resource_states = NULL;
-int	 	resource_state_count = 0;
-fod_t		*domains = NULL;
-int		*nodes_all = NULL;
-int		nodes_all_count = 0;
-int 		*nodes_online = NULL;
-int		nodes_online_count = 0;
-
-
-void
-visualize_state(char *png_viewer)
-{
-	char cmd[1024];
-	char tf_dot[128];
-	char tf_png[128];
-	FILE *fp;
-	int fd, x;
-		
-	snprintf(tf_dot, sizeof(tf_dot), "/tmp/dtest.dot.XXXXXX");
-	fd = mkstemp(tf_dot);
-	if (fd < 0) {
-		printf("Couldn't create temporary file: %s\n", strerror(errno));
-		return;
-	}
-	
-	fp = fdopen(fd, "w+");
-	if (!fp) {
-		printf("Couldn't init temporary file: %s\n", strerror(errno));
-		return;
-	}
-	
-	x = dep_check(&depends, resource_states,
-		  resource_state_count, nodes_online,
-		  nodes_online_count);
-	printf("State score: %d\n", x);
-	dep_cluster_state_dot(fp, &depends, resource_states,
-			resource_state_count, nodes_online,
-			nodes_online_count);
-	
-	fclose(fp);
-	close(fd);
-	
-	snprintf(tf_png, sizeof(tf_png), "/tmp/dtest.png.XXXXXX");
-	fd = mkstemp(tf_png);
-	if (fd < 0) {
-		printf("Couldn't init temporary file: %s\n", strerror(errno));
-		return;
-	}
-	
-	close(fd);
-	
-	snprintf(cmd, sizeof(cmd), "dot -Tpng -o %s %s", tf_png, tf_dot);
-	if (system(cmd) != 0) {
-		printf("Error: system('%s') failed\n", cmd);
-		return;
-	}
-	
-	snprintf(cmd, sizeof(cmd), "%s %s", png_viewer, tf_png);
-	if (system(cmd) != 0) {
-		printf("Error: system('%s') failed\n", cmd);
-		return;
-	}
-	
-	unlink(tf_png);
-	unlink(tf_dot);
-}
-
-
-int
-vis_dep_apply_trans(dep_op_t **op_list, char *pngviewer)
-{
-	dep_op_t *op;
-	int x;
-	int ops = 0;
-	dep_rs_t *states = resource_states;
-	int slen = resource_state_count;
-	
-	visualize_state(pngviewer);
-
-	list_do(op_list, op) {
-		
-		++ops;
-		
-		for (x = 0; x < slen; x++) {
-			if (strcasecmp(op->do_res, states[x].rs_status.rs_name))
-				continue;
-			if (op->do_op == RG_START) {
-				printf("Start %s on %d\n", op->do_res, op->do_nodeid);
-				states[x].rs_status.rs_state = RG_STATE_STARTED;
-				states[x].rs_status.rs_owner = op->do_nodeid;
-			} else {
-				printf("Stop %s\n", op->do_res);
-				states[x].rs_status.rs_state = RG_STATE_STOPPED;
-				states[x].rs_status.rs_owner = 0;
-				states[x].rs_flags &= ~(RS_ILLEGAL_NODE|
-						        RS_DEAD_NODE);
-			}
-			break;
-		}
-		
-		visualize_state(pngviewer);
-
-	} while (!list_done(op_list, op));
-	
-	printf("Applied %d operations\n", ops);
-	
-	return 0;
-}
-
-void
-print_help(void)
-{
-	printf("nodes                     view all nodes\n");
-	printf("online [id1 id2...|none]  set or view online nodes\n");
-	printf("res [resource]            view a resource state (or all)\n");
-	printf("start <res> <id>          start res on id\n");
-	printf("dep [res]                 print dependency tree(s)\n");
-	printf("stop <res1> [res2...]     stop res\n");
-	printf("disable <res1> [res2...]  disable res\n");
-	printf("check                     check cluster state against deps\n");
-	printf("calc                      calculate transition to valid state\n");
-	printf("apply [pngviewer]         Apply previous transition list\n");
-	printf("                          If pngviewer is specified, send\n");
-	printf("                          graphviz & bring up viewer\n");
-	printf("state [pngviewer]         dump cluster state in DOT format\n");
-	printf("                          If pngviewer is specified, send\n");
-	printf("                          graphviz & bring up viewer\n");
-	printf("quit, exit                exit\n");
-}
-
-
-void
-show_rs_t(dep_rs_t *rs)
-{
-	int *allowed, cnt, x;
-	
-	printf("Resource %s\n  State: %s\n  Owner: %d\n",
-	       rs->rs_status.rs_name,
-	       rg_state_str(rs->rs_status.rs_state),
-	       rs->rs_status.rs_owner);
-	
-	if (rs->rs_allowed) {
-		allowed = rs->rs_allowed;
-		cnt = rs->rs_allowed_len;
-	} else {
-		printf("  Allowed Nodes = [ all ]\n");
-		return;
-	}
-		
-	printf("  Allowed Nodes = [ ");
-	
-	for (x = 0; x < cnt; x++) {
-		printf("%d ", allowed[x]);
-	}
-	printf("]\n");
-}
-
-
-int 
-show_resources(char *name)
-{
-	int x, found = 0;
-	
-	for (x = 0; x < resource_state_count; x++) {
-		if (!name || !strcmp(name,
-		    resource_states[x].rs_status.rs_name)) {
-			found = 1;
-			
-			show_rs_t(&resource_states[x]);
-		}
-		
-		if (!name)
-			printf("\n");
-	}
-	
-	return !found;
-}
-
-
-void
-show_calc_result(int final_score, dep_op_t **ops, int iter)
-{
-	int x = 0;
-	dep_op_t *op;
-	
-	list_do(ops, op) {
-		++x;
-		if (op->do_op == RG_START) {
-			printf("Start %s on %d [%d]\n", op->do_res, op->do_nodeid, op->do_iter);
-		} else {
-			printf("Stop %s [%d]\n", op->do_res, op->do_iter);
-		}
-	} while (!list_done(ops, op));
-	
-	if (iter >= 0)
-		printf("%d operations reduced in %d iterations; final score = %d\n", x, iter,
-			final_score);
-	else
-		printf("%d operations\n", x);
-}
-		
-
-
-dep_rs_t *
-get_rs_byname(char *name)
-{
-	int x, found = 0;
-	
-	if (!name)
-		return NULL;
-	
-	for (x = 0; x < resource_state_count; x++) {
-		if (!name || !strcmp(name,
-		    resource_states[x].rs_status.rs_name)) {
-			found = 1;
-			
-			return &resource_states[x];
-		}
-		
-	}
-	
-	return NULL;
-}
-
-
-
-void
-dtest_shell(void)
-{
-	resource_t *res;
-	char name[64];
-	char *cmd = NULL;
-	int done = 0;
-	char *save, *curr, *tmp;
-	int cnt, err;
-	int *nodes;
-	int x;
-	dep_rs_t *rs;
-	dep_t *depcpy;
-	dep_op_t *ops = NULL, *op;
-	
-	nodes = malloc(sizeof(int)*nodes_all_count);
-	// FIXME: handle failed malloc
-	
-	while (!done) {
-		
-		if (cmd)
-			free(cmd);
-		cmd = readline("> ");
-		if (!cmd || !strlen(cmd)) {
-			printf("\n");
-		}
-		if (!cmd) {
-			break;
-		}
-		
-		/*
-		if (cmd && cmd[0])
-			add_history(cmd);
-		 */
-		
-		if (!cmd[0])
-			continue;
-		
-		curr = strtok_r(cmd, " ", &save);
-		err = 0;
-		
-		if (!strcmp(curr, "online")) {
-			cnt = 0;
-			err = 0;
-			while ((curr = strtok_r(NULL, " ", &save))) {
-				nodes[cnt] = atoi(curr);
-				if (nodes[cnt] <= 0) {
-					printf("Error: Node '%s' invalid\n",
-					       curr);
-					err = 1;
-					break;
-				}
-				
-				err = 1;
-				for (x = 0; x < nodes_all_count; x++) {
-					if (nodes_all[x] == nodes[cnt]) {
-						err = 0;
-						break;
-					}
-				}
-				++cnt;
-			}
-			
-			if (cnt && !err) {
-				if (nodes_online)
-					free(nodes_online);
-				
-				nodes_online = malloc(sizeof(int) * cnt);
-				// FIXME: handle failed malloc
-				
-				for (x = 0; x < cnt; x++)
-					nodes_online[x] = nodes[x];
-				nodes_online_count = cnt;
-			}
-			
-			if (!err) {
-				printf("Online = [ ");
-				for (x = 0; x < nodes_online_count; x++) {
-					printf("%d ", nodes_online[x]);
-				}
-				printf("]\n");
-			}
-		} else if (!strcmp(curr, "start")) {
-			
-			curr = strtok_r(NULL, " ", &save);
-			
-			if (!curr) {
-				printf("usage: start <resource> <nodeid>"
-					" [test]\n");
-				continue;
-			}
-			
-			if (!strchr(curr,':')) {
-				snprintf(name, sizeof(name), "service:%s",
-						curr);
-				curr = name;
-			}
-			
-			rs = get_rs_byname(curr);
-			if (!rs) {
-				printf("Error: Resource '%s' not found\n", curr);
-				++err;
-			}
-			
-			curr = strtok_r(NULL, " ", &save);
-			cnt = 0;
-			if (!curr) {
-				printf("Error: No node ID specified\n");
-				++err;
-			} else {
-				cnt = atoi(curr);
-				x = 0;
-				if (cnt <= 0) {
-					printf("Error: Node '%s' invalid\n",
-					       curr);
-					++err;
-				} else {
-					for (x = 0; x < nodes_online_count; x++) {
-						if (nodes_online[x] == cnt) {
-							x = -1;
-							break;
-						}
-					}
-				}
-				
-				if (x != -1) {
-					printf("Error: Node '%s' not online\n",
-					       curr);
-					++err;
-				}
-			}
-			
-			if (err)
-				continue;
-			
-			curr = strtok_r(NULL, " ", &save);
-			if (curr) {
-				if (strcmp(curr, "test")) 
-					printf("Error: start ... %s\n", curr);
-			
-				while ((op = ops)) {
-					list_remove(&ops, op);
-					free(op);
-				}
-				/*
-int
-dep_check_operation(char *res, int operation, int target, 
-		    dep_t **deps, dep_rs_t *_states,
-		    int slen, int *nodes, int nlen, dep_op_t **oplist)
-		    */
-				if (dep_check_operation(rs->rs_status.rs_name,
-						RG_START,
-						cnt,
-						&depends,
-						resource_states,
-						resource_state_count,
-						nodes_online,
-						nodes_online_count,
-						&ops) < 0) {
-					printf("No, thanks.\n");
-				} else
-					show_calc_result(0, &ops, 0);
-				continue;
-			} 
-			
-			
-			rs->rs_status.rs_owner = cnt;
-			rs->rs_status.rs_state = RG_STATE_STARTED;
-			printf("%s is started on %d\n", rs->rs_status.rs_name,
-				cnt);
-			
-		} else if (!strcmp(curr, "domains")) {
-			print_domains(&domains);
-			
-		} else if (!strcmp(curr, "calc")) {
-			
-			while ((op = ops)) {
-				list_remove(&ops, op);
-				free(op);
-			}
-			
-			err = dep_calc_trans(&depends, resource_states,
-					     resource_state_count,
-					     nodes_online, nodes_online_count,
-					     &ops, &x);
-			show_calc_result(err, &ops, x);
-			
-		} else if (!strcmp(curr, "apply")) {
-		
-			curr = strtok_r(NULL, " ", &save);
-			dep_check(&depends, resource_states,
-				  resource_state_count, nodes_online,
-				  nodes_online_count);
-			if (!curr) {
-				dep_apply_trans(&depends, resource_states,
-						resource_state_count,
-						&ops);
-			} else {
-				vis_dep_apply_trans(&ops, curr);
-			}
-			
-			while ((op = ops)) {
-				list_remove(&ops, op);
-				free(op);
-			}
-		} else if (!strcmp(curr, "state")) {
-			
-			x = dep_check(&depends, resource_states,
-				      resource_state_count,
-				      nodes_online, nodes_online_count);
-			
-			if (x < 0) {
-				printf("Cluster state is invalid (%d errors)\n",
-					-x);
-				dep_print_errors(&depends,
-						 resource_states,
-						 resource_state_count);
-			} else if (x > 0) {
-				printf("Cluster state is valid, "
-				       "but not ideal (%d stopped)\n",x);
-			} else {
-				printf("Cluster state is ideal\n");
-			}	
-			
-			curr = strtok_r(NULL, " ", &save);
-			if (!curr) {
-				dep_cluster_state(stdout, &depends,
-						resource_states,
-						resource_state_count, nodes_online,
-						nodes_online_count);
-			} else {
-				visualize_state(curr);
-			}
-			
-			dep_reset(&depends, resource_states,
-					resource_state_count);
-			
-		} else if (!strcmp(curr, "reslist")) {
-			list_do(&resources, res) {
-				print_resource(res);
-			} while (!list_done(&resources, res));
-			
-		} else if (!strcmp(curr, "nodes")) {
-			
-			printf("Nodes = [ ");
-			for (x = 0; x < nodes_all_count; x++) {
-				printf("%d ", nodes_all[x]);
-			}
-			printf("]\n");
-		} else if (!strcmp(curr, "stop") || !strcmp(curr, "disable")) {
-			
-			tmp = curr;
-			
-			curr = strtok_r(NULL, " ", &save);
-			
-			if (!curr) {
-				printf("usage: %s <resource>\n", tmp);
-				continue;
-			}
-		#if 0	
-			do {
-				if (!strchr(curr,':')) {
-					snprintf(name, sizeof(name), "service:%s",
-							curr);
-					curr = name;
-				}
-				rs = get_rs_byname(curr);
-				if (!rs) {
-					printf("Error: Resource '%s' not found\n",curr);
-					break;
-				}
-			
-				rs->rs_status.rs_owner = 0;
-				if (!strcmp(cmd, "stop")) {
-					rs->rs_status.rs_state = RG_STATE_STOPPED;
-					printf("%s is stopped\n",
-						rs->rs_status.rs_name);
-				} else {
-					rs->rs_status.rs_state = RG_STATE_DISABLED;
-					printf("%s is disabled\n",
-						rs->rs_status.rs_name);
-				}
-				curr = strtok_r(NULL, " ", &save);
-			} while (curr);
-			
-			curr = strtok_r(NULL, " ", &save);
-			
-			if (!curr) {
-				printf("usage: start <resource> <nodeid>"
-					" [test]\n");
-				continue;
-			}
-		#endif
-			
-			if (!strchr(curr,':')) {
-				snprintf(name, sizeof(name), "service:%s",
-						curr);
-				curr = name;
-			}
-			
-			rs = get_rs_byname(curr);
-			if (!rs) {
-				printf("Error: Resource '%s' not found\n", curr);
-				++err;
-			}
-			
-			if (err)
-				continue;
-			
-			curr = strtok_r(NULL, " ", &save);
-			if (curr) {
-				if (strcmp(curr, "test")) 
-					printf("Error: stop ... %s\n", curr);
-			
-				while ((op = ops)) {
-					list_remove(&ops, op);
-					free(op);
-				}
-				
-				if(dep_check_operation(rs->rs_status.rs_name,
-						!strcmp(tmp,"stop")?RG_STOP:RG_DISABLE,
-						-1,
-						&depends,
-						resource_states,
-						resource_state_count,
-						nodes_online,
-						nodes_online_count,
-						&ops) < 0) {
-					printf("No.\n");
-				} else 
-				show_calc_result(0, &ops, 0);
-				continue;
-			} 
-			
-			rs->rs_status.rs_owner = 0;
-			if (!strcmp(cmd, "stop")) {
-				rs->rs_status.rs_state = RG_STATE_STOPPED;
-				printf("%s is stopped\n",
-					rs->rs_status.rs_name);
-			} else {
-				rs->rs_status.rs_state = RG_STATE_DISABLED;
-				printf("%s is disabled\n",
-					rs->rs_status.rs_name);
-			}
-			
-			
-		} else if (!strcmp(curr, "res")) {
-			
-			curr = strtok_r(NULL, " ", &save);
-			
-			if (curr && !strchr(curr,':')) {
-				snprintf(name, sizeof(name), "service:%s",
-						curr);
-				curr = name;
-			}
-			err = show_resources(curr);
-			if (err) {
-				printf("Error: Invalid resource '%s'", curr);
-			}
-			
-		} else if (!strcmp(curr, "dep")) {
-			
-			curr = strtok_r(NULL, " ", &save);
-			
-			if (!curr) {
-				print_depends(stdout, &depends);
-				continue;
-			}
-			
-			if (!strcmp(curr, "dot")) {
-				print_depends_dot(stdout, &depends);
-				continue;
-			} else if (!strcmp(curr, "copy")) {
-				printf("Copying tree...");
-				depcpy = NULL;
-				dep_tree_dup(&depcpy, &depends);
-				printf("Done\n");
-				print_depends(stdout, &depcpy);
-				deconstruct_depends(&depcpy);
-				depcpy = NULL;
-			} else {
-				printf("Error: Invalid command 'dep %s'\n",
-					curr);
-			}
-				
-		} else if (!strcmp(curr, "check")) {
-			dep_reset(&depends, resource_states,
-				  resource_state_count);
-			
-			x = dep_check(&depends, resource_states,
-				      resource_state_count,
-				      nodes_online, nodes_online_count);
-			
-			if (x < 0) {
-				printf("Cluster state is invalid (%d errors)\n",
-					-x);
-				dep_print_errors(&depends,
-						 resource_states,
-						 resource_state_count);
-				dep_reset(&depends, resource_states,
-					  resource_state_count);
-			} else if (x > 0) {
-				printf("Cluster state is valid, "
-				       "but not ideal (%d stopped)\n",x);
-			} else {
-				printf("Cluster state is ideal\n");
-			}
-		} else if (!strcmp(curr, "?") || !strcmp(curr,"help")) {
-			print_help();
-		} else if (!strcmp(curr, "quit") || !strcmp(curr,"exit")) {
-			done = 1;
-		} else if (!strcmp(curr, "mem")) {
-			
-			tmp = curr;
-			curr = strtok_r(NULL, " ", &save);
-			if (!curr) {
-				malloc_stats();
-				continue;
-			}
-			
-			if (!strcmp(curr, "table")) {
-				malloc_dump_table();
-			} else {
-				printf("Unknown command '%s %s'\n", tmp , curr);
-			}
-		} else {
-			printf("Unknown command '%s'\n", curr);
-		}
-	}
-	if (cmd)
-		free(cmd);
-}
-
-
-int *
-load_node_ids(int ccsfd, int *count)
-{
-	int ncount, x;
-	int *nodes;
-	char *val;
-	char xpath[256];
-	
-	for (ncount = 1; ; ncount++) {
-		snprintf(xpath, sizeof(xpath),
-			 "/cluster/clusternodes/clusternode[%d]/@nodeid",
-			 ncount);
-		
-		if (ccs_get(ccsfd, xpath, &val)!=0) {
-			--ncount;
-			break;
-		}
-	}
-	
-	if (!ncount)
-		return NULL;
-	
-	nodes = malloc(sizeof(int) * ncount);
-	if (!nodes) {
-		fprintf(stderr, "out of memory?\n");
-		return NULL;
-	}
-	
-	for (x = 1; x <= ncount; x++) {
-		snprintf(xpath, sizeof(xpath),
-			 "/cluster/clusternodes/clusternode[%d]/@nodeid", x);
-		
-		if (ccs_get(ccsfd, xpath, &val)!=0) {
-			fprintf(stderr,
-				"Code path error: # of nodes changed\n");
-			free(nodes);
-			return NULL;
-		}
-		
-		nodes[x-1] = atoi(val);
-		free(val);
-	}
-	
-	*count = ncount;
-	return nodes;
-}
-
-
-int
-main(int argc, char **argv)
-{
-	int ccsfd, ret = 0;
-	char *agentpath;
-	char *config;
-	
-	if (argc < 3) {
-		printf("usage: %s <agentpath> <config>\n", argv[0]);
-		return -1;
-	}
-	
-	agentpath = argv[1];
-	config = argv[2];
-
-	conf_setconfig(config);
-	
-       	ccsfd = ccs_lock();
-	if (ccsfd < 0) {
-		printf("Error parsing %s\n", argv[1]);
-		return -1;
-	}
-
-	load_resource_rules(agentpath, &rules);
-	construct_domains(ccsfd, &domains);
-	load_resources(ccsfd, &resources, &rules);
-	build_resource_tree(ccsfd, &restree, &rules, &resources);
-	construct_depends(ccsfd, &depends);
-	
-	if (argc >= 4) {
-		if (!strcmp(argv[3], "dot")) {
-			print_depends_dot(stdout, &depends);
-		} else {
-			fprintf(stderr,"Invalid command: %s\n", argv[3]);
-			ret = 1;
-		}
-		goto out;
-	}
-	
-	nodes_all = load_node_ids(ccsfd, &nodes_all_count);
-		
-	ccs_unlock(ccsfd);
-	
-	printf("Nodes = [ ");
-	for (ret = 0; ret < nodes_all_count; ret++) {
-		printf("%d ", nodes_all[ret]);
-	}
-	printf("]\n");
-	
-	if ((resource_states = dep_rstate_alloc(&restree, &domains,
-			nodes_all,
-			nodes_all_count,
-			&resource_state_count)) == NULL) {
-		printf("oops\n");
-		return -1;
-	}
-	
-	/* Ok!  We have it all! */
-	dtest_shell();
-			
-out:
-	
-	deconstruct_depends(&depends);
-	destroy_resource_tree(&restree);
-	destroy_resources(&resources);
-	deconstruct_domains(&domains);
-	destroy_resource_rules(&rules);
-	
-	malloc_dump_table();
-
-	return ret;
-}
-
-
diff --git a/rgmanager/src/daemons/event_config.c b/rgmanager/src/daemons/event_config.c
deleted file mode 100644
index a8212e4..0000000
--- a/rgmanager/src/daemons/event_config.c
+++ /dev/null
@@ -1,520 +0,0 @@
-/** @file
- * CCS event parsing, based on failover domain parsing
- */
-#include <string.h>
-#include <list.h>
-#include <logging.h>
-#include <resgroup.h>
-#include <restart_counter.h>
-#include <reslist.h>
-#include <ccs.h>
-#include <pthread.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <members.h>
-#include <reslist.h>
-#include <ctype.h>
-#include <event.h>
-
-#define CONFIG_NODE_ID_TO_NAME \
-   "/cluster/clusternodes/clusternode[@nodeid=\"%d\"]/@name"
-#define CONFIG_NODE_NAME_TO_ID \
-   "/cluster/clusternodes/clusternode[@name=\"%s\"]/@nodeid"
-
-void deconstruct_events(event_table_t **);
-void print_event(event_t *ev);
-
-//#define DEBUG
-
-#ifdef NO_CCS
-#define ccs_get(fd, query, ret) conf_get(query, ret)
-#endif
-
-/*
-   <events>
-     <event name="helpful_name_here" class="node"
-            node="nodeid|nodename" nodestate="up|down">
-	    slang_script_stuff();
-	    start_service();
-     </event>
-   </events>
- */
-int
-event_match(event_t *pattern, event_t *actual)
-{
-	if (pattern->ev_type != EVENT_NONE &&
-	    actual->ev_type != pattern->ev_type)
-		return 0;
-
-	/* If there's no event class specified, the rest is
-	   irrelevant */
-	if (pattern->ev_type == EVENT_NONE)
-		return 1;
-
-	switch(pattern->ev_type) {
-	case EVENT_NODE:
-		if (pattern->ev.node.ne_nodeid >= 0 &&
-		    actual->ev.node.ne_nodeid !=
-				pattern->ev.node.ne_nodeid) {
-			return 0;
-		}
-		if (pattern->ev.node.ne_local >= 0 && 
-		    actual->ev.node.ne_local !=
-				pattern->ev.node.ne_local) {
-			return 0;
-		}
-		if (pattern->ev.node.ne_state >= 0 && 
-		    actual->ev.node.ne_state !=
-				pattern->ev.node.ne_state) {
-			return 0;
-		}
-		if (pattern->ev.node.ne_clean >= 0 && 
-		    actual->ev.node.ne_clean !=
-				pattern->ev.node.ne_clean) {
-			return 0;
-		}
-		return 1; /* All specified params match */
-	case EVENT_RG:
-		if (pattern->ev.group.rg_name[0] &&
-		    strcasecmp(actual->ev.group.rg_name, 
-			       pattern->ev.group.rg_name)) {
-			return 0;
-		}
-		if (pattern->ev.group.rg_state != (uint32_t)-1 && 
-		    actual->ev.group.rg_state !=
-				pattern->ev.group.rg_state) {
-			return 0;
-		}
-		if (pattern->ev.group.rg_owner >= 0 && 
-		    actual->ev.group.rg_owner !=
-				pattern->ev.group.rg_owner) {
-			return 0;
-		}
-		return 1;
-	case EVENT_CONFIG:
-		if (pattern->ev.config.cfg_version >= 0 && 
-		    actual->ev.config.cfg_version !=
-				pattern->ev.config.cfg_version) {
-			return 0;
-		}
-		if (pattern->ev.config.cfg_oldversion >= 0 && 
-		    actual->ev.config.cfg_oldversion !=
-				pattern->ev.config.cfg_oldversion) {
-			return 0;
-		}
-		return 1;
-	case EVENT_USER:
-		if (pattern->ev.user.u_name[0] &&
-		    strcasecmp(actual->ev.user.u_name, 
-			       pattern->ev.user.u_name)) {
-			return 0;
-		}
-		if (pattern->ev.user.u_request != 0 && 
-		    actual->ev.user.u_request !=
-				pattern->ev.user.u_request) {
-			return 0;
-		}
-		if (pattern->ev.user.u_target != 0 && 
-		    actual->ev.user.u_target !=
-				pattern->ev.user.u_target) {
-			return 0;
-		}
-		return 1;
-	default:
-		break;
-	}
-			
-	return 0;
-}
-
-
-char *
-#ifndef NO_CCS
-ccs_node_id_to_name(int ccsfd, int nodeid)
-#else
-ccs_node_id_to_name(int __attribute__ ((unused)) ccsfd, int nodeid)
-#endif
-{
-	char xpath[256], *ret = 0;
-
-	snprintf(xpath, sizeof(xpath), CONFIG_NODE_ID_TO_NAME,
-		 nodeid);
-	if (ccs_get(ccsfd, xpath, &ret) == 0)
-		return ret;
-	return NULL;
-}
-
-
-int
-#ifndef NO_CCS
-ccs_node_name_to_id(int ccsfd, char *name)
-#else
-ccs_node_name_to_id(int __attribute__((unused)) ccsfd, char *name)
-#endif
-{
-	char xpath[256], *ret = 0;
-	int rv = 0;
-
-	snprintf(xpath, sizeof(xpath), CONFIG_NODE_NAME_TO_ID,
-		 name);
-	if (ccs_get(ccsfd, xpath, &ret) == 0) {
-		rv = atoi(ret);
-		free(ret);
-		return rv;
-	}
-	return 0;
-}
-
-
-static void 
-deconstruct_event(event_t *ev)
-{
-	if (ev->ev_script)
-		free(ev->ev_script);
-	if (ev->ev_name)
-		free(ev->ev_name);
-	free(ev);
-}
-
-
-static int
-get_node_event(int ccsfd, char *base, event_t *ev)
-{
-	char xpath[256], *ret = NULL;
-
-	/* Clear out the possibilitiies */
-	ev->ev.node.ne_nodeid = -1;
-	ev->ev.node.ne_local = -1;
-	ev->ev.node.ne_state = -1;
-	ev->ev.node.ne_clean = -1;
-
-	snprintf(xpath, sizeof(xpath), "%s/@node_id", base);
-	if (ccs_get(ccsfd, xpath, &ret) == 0) {
-		ev->ev.node.ne_nodeid = atoi(ret);
-		free(ret);
-		if (ev->ev.node.ne_nodeid <= 0)
-			return -1;
-	} else {
-		/* See if there's a node name */
-		snprintf(xpath, sizeof(xpath), "%s/@node", base);
-		if (ccs_get(ccsfd, xpath, &ret) == 0) {
-			ev->ev.node.ne_nodeid =
-				ccs_node_name_to_id(ccsfd, ret);
-			free(ret);
-			if (ev->ev.node.ne_nodeid <= 0)
-				return -1;
-		}
-	}
-
-	snprintf(xpath, sizeof(xpath), "%s/@node_state", base);
-	if (ccs_get(ccsfd, xpath, &ret) == 0) {
-		if (!strcasecmp(ret, "up")) {
-			ev->ev.node.ne_state = 1;
-		} else if (!strcasecmp(ret, "down")) {
-			ev->ev.node.ne_state = 0;
-		} else {
-			ev->ev.node.ne_state = !!atoi(ret);
-		}
-		free(ret);
-	}
-
-	snprintf(xpath, sizeof(xpath), "%s/@node_clean", base);
-	if (ccs_get(ccsfd, xpath, &ret) == 0) {
-		ev->ev.node.ne_clean = !!atoi(ret);
-		free(ret);
-	}
-
-	snprintf(xpath, sizeof(xpath), "%s/@node_local", base);
-	if (ccs_get(ccsfd, xpath, &ret) == 0) {
-		ev->ev.node.ne_local = !!atoi(ret);
-		free(ret);
-	}
-
-	return 0;
-}
-
-
-static int
-get_rg_event(int ccsfd, char *base, event_t *ev)
-{
-	char xpath[256], *ret = NULL;
-
-	/* Clear out the possibilitiies */
-	ev->ev.group.rg_name[0] = 0;
-	ev->ev.group.rg_state = (uint32_t)-1;
-	ev->ev.group.rg_owner = -1;
-
-	snprintf(xpath, sizeof(xpath), "%s/@service", base);
-	if (ccs_get(ccsfd, xpath, &ret) == 0) {
-		strncpy(ev->ev.group.rg_name, ret,
-			sizeof(ev->ev.group.rg_name));
-		free(ret);
-		if (!strlen(ev->ev.group.rg_name)) {
-			return -1;
-		}
-	}
-
-	snprintf(xpath, sizeof(xpath), "%s/@service_state", base);
-	if (ccs_get(ccsfd, xpath, &ret) == 0) {
-		if (!isdigit(ret[0])) {
-			ev->ev.group.rg_state =
-			       	rg_state_str_to_id(ret);
-		} else {
-			ev->ev.group.rg_state = atoi(ret);
-		}	
-		free(ret);
-	}
-
-	snprintf(xpath, sizeof(xpath), "%s/@service_owner", base);
-	if (ccs_get(ccsfd, xpath, &ret) == 0) {
-		if (!isdigit(ret[0])) {
-			ev->ev.group.rg_owner =
-			       	ccs_node_name_to_id(ccsfd, ret);
-		} else {
-			ev->ev.group.rg_owner = !!atoi(ret);
-		}	
-		free(ret);
-	}
-
-	return 0;
-}
-
-
-static int
-get_config_event(int __attribute__((unused)) ccsfd,
-		 char __attribute__((unused)) *base,
-		 event_t __attribute__((unused)) *ev)
-{
-	errno = ENOSYS;
-	return -1;
-}
-
-
-static event_t *
-get_event(int ccsfd, char *base, int idx, int *_done)
-{
-	event_t *ev;
-	char xpath[256];
-	char *ret = NULL;
-
-	*_done = 0;
-	snprintf(xpath, sizeof(xpath), "%s/event[%d]/@name",
-		 base, idx);
-	if (ccs_get(ccsfd, xpath, &ret) != 0) {
-		*_done = 1;
-		return NULL;
-	}
-
-	ev = malloc(sizeof(*ev));
-	if (!ev)
-		return NULL;
-	memset(ev, 0, sizeof(*ev));
-	ev->ev_name = ret;
-
-	/* Get the script file / inline from config */
-	ret = NULL;
-	snprintf(xpath, sizeof(xpath), "%s/event[%d]/@file",
-		 base, idx);
-	if (ccs_get(ccsfd, xpath, &ret) == 0) {
-		ev->ev_script_file = ret;
-	} else {
-		snprintf(xpath, sizeof(xpath), "%s/event[%d]",
-		         base, idx);
-		if (ccs_get(ccsfd, xpath, &ret) == 0) {
-			ev->ev_script = ret;
-		} else {
-			goto out_fail;
-		}
-	}
-
-	/* Get the priority ordering (must be nonzero) */
-	ev->ev_prio = 99;
-	ret = NULL;
-	snprintf(xpath, sizeof(xpath), "%s/event[%d]/@priority",
-		 base, idx);
-	if (ccs_get(ccsfd, xpath, &ret) == 0) {
-		ev->ev_prio = atoi(ret);
-		if (ev->ev_prio <= 0 || ev->ev_prio > EVENT_PRIO_COUNT) {
-			logt_print(LOG_ERR,
-			       "event %s: priority %s invalid\n",
-			       ev->ev_name, ret);
-			goto out_fail;
-		}
-		free(ret);
-	}
-
-	/* Get the event class */
-	snprintf(xpath, sizeof(xpath), "%s/event[%d]/@class",
-		 base, idx);
-	ret = NULL;
-	if (ccs_get(ccsfd, xpath, &ret) == 0) {
-		snprintf(xpath, sizeof(xpath), "%s/event[%d]",
-		 	 base, idx);
-		if (!strcasecmp(ret, "node")) {
-			ev->ev_type = EVENT_NODE;
-			if (get_node_event(ccsfd, xpath, ev) < 0)
-				goto out_fail;
-		} else if (!strcasecmp(ret, "service") ||
-			   !strcasecmp(ret, "resource") ||
-			   !strcasecmp(ret, "rg") ) {
-			ev->ev_type = EVENT_RG;
-			if (get_rg_event(ccsfd, xpath, ev) < 0)
-				goto out_fail;
-		} else if (!strcasecmp(ret, "config") ||
-			   !strcasecmp(ret, "reconfig")) {
-			ev->ev_type = EVENT_CONFIG;
-			if (get_config_event(ccsfd, xpath, ev) < 0)
-				goto out_fail;
-		} else {
-			logt_print(LOG_ERR,
-			       "event %s: class %s unrecognized\n",
-			       ev->ev_name, ret);
-			goto out_fail;
-		}
-
-		free(ret);
-		ret = NULL;
-	}
-
-	return ev;
-out_fail:
-	if (ret)
-		free(ret);
-	deconstruct_event(ev);
-	return NULL;
-}
-
-
-static event_t *
-get_default_event(void)
-{
-	event_t *ev;
-	char xpath[1024];
-
-	ev = malloc(sizeof(*ev));
-	if (!ev)
-		return NULL;
-	memset(ev, 0, sizeof(*ev));
-	ev->ev_name = strdup("Default");
-
-	/* Get the script file / inline from config */
-	snprintf(xpath, sizeof(xpath), "%s/default_event_script.sl",
-		 RESOURCE_ROOTDIR);
-
-	ev->ev_prio = 100;
-	ev->ev_type = EVENT_NONE;
-	ev->ev_script_file = strdup(xpath);
-	if (!ev->ev_script_file || ! ev->ev_name) {
-		deconstruct_event(ev);
-		return NULL;
-	}
-
-	return ev;
-}
-
-
-/**
- * similar API to failover domain
- */
-int
-construct_events(int ccsfd, event_table_t **events)
-{
-	char xpath[256];
-	event_t *ev;
-	int x = 1, done = 0;
-
-	/* Allocate the event list table */
-	*events = malloc(sizeof(event_table_t) +
-			 sizeof(event_t) * (EVENT_PRIO_COUNT+1));
-	if (!*events)
-		return -1;
-	memset(*events, 0, sizeof(event_table_t) +
-	       		   sizeof(event_t) * (EVENT_PRIO_COUNT+1));
-	(*events)->max_prio = EVENT_PRIO_COUNT;
-
-	snprintf(xpath, sizeof(xpath),
-		 RESOURCE_TREE_ROOT "/events");
-
-	do {
-		ev = get_event(ccsfd, xpath, x++, &done);
-		if (ev)
-			list_insert(&((*events)->entries[ev->ev_prio]), ev);
-	} while (!done);
-
-	ev = get_default_event();
-	if (ev)
-		list_insert(&((*events)->entries[ev->ev_prio]), ev);
-	
-	return 0;
-}
-
-
-void
-print_event(event_t *ev)
-{
-	printf("  Name: %s\n", ev->ev_name);
-
-	switch(ev->ev_type) {
-	case EVENT_NODE:
-		printf("    Node %d State %d\n", ev->ev.node.ne_nodeid,
-		       ev->ev.node.ne_state);
-		break;
-	case EVENT_RG:
-		printf("    RG %s State %s\n", ev->ev.group.rg_name,
-		       rg_state_str(ev->ev.group.rg_state));
-		break;
-	case EVENT_CONFIG:
-		printf("    Config change - unsupported\n");
-		break;
-	default:
-		printf("    (Any event)\n");
-		break;
-	}
-	
-	if (ev->ev_script) {
-		printf("    Inline script.\n");
-	} else {
-		printf("    File: %s\n", ev->ev_script_file);
-	}
-}
-
-
-void
-print_events(event_table_t *events)
-{
-	int x, y;
-	event_t *ev;
-
-	for (x = 0; x <= events->max_prio; x++) {
-		if (!events->entries[x])
-			continue;
-		printf("Event Priority Level %d:\n", x);
-		list_for(&(events->entries[x]), ev, y) {
-			print_event(ev);
-		}
-	}
-}
-
-
-void
-deconstruct_events(event_table_t **eventsp)
-{
-	int x;
-	event_table_t *events = *eventsp;
-	event_t *ev = NULL;
-
-	if (!events)
-		return;
-
-	for (x = 0; x <= events->max_prio; x++) {
-		while ((ev = (events->entries[x]))) {
-			list_remove(&(events->entries[x]), ev);
-			deconstruct_event(ev);
-		}
-	}
-
-	free(events);
-	*eventsp = NULL;
-}
-
-
diff --git a/rgmanager/src/daemons/fo_domain.c b/rgmanager/src/daemons/fo_domain.c
deleted file mode 100644
index d1e53a1..0000000
--- a/rgmanager/src/daemons/fo_domain.c
+++ /dev/null
@@ -1,640 +0,0 @@
-/** @file
- * Fail-over Domain & Preferred Node Ordering Driver.  Ripped right from
- * the clumanager 1.2 code base.
- *
- * April 2006 - Nofailback option added to restrict failover behavior in ordered
- *		+ restricted failover domains by Josef Whiter
- */
-#include <string.h>
-#include <list.h>
-#include <logging.h>
-#include <resgroup.h>
-#include <restart_counter.h>
-#include <reslist.h>
-#include <ccs.h>
-#include <pthread.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <members.h>
-#include <sets.h>
-
-
-//#define DEBUG
-
-#ifdef NO_CCS
-#define ccs_get(fd, query, ret) conf_get(query, ret)
-#endif
-
-/*
-   <failoverdomains>
-     <failoverdomain name="foo">
-       <failoverdomainnode name="member" priority="1"/>
-       <failoverdomainnode name="member2" priority="1"/>
-       <failoverdomainnode name="member3" priority="2"/>
-     </failoverdomain>
-   </failoverdomains>
- */
-int group_property(char *, char *, char *, size_t);
-
-fod_node_t *
-#ifndef NO_CCS
-fod_get_node(int ccsfd, char *base, int idx, fod_t *domain)
-#else
-fod_get_node(int __attribute__((unused)) ccsfd, char *base, int idx, fod_t *domain)
-#endif
-{
-	fod_node_t *fodn;
-	char xpath[256];
-	char *ret;
-
-	snprintf(xpath, sizeof(xpath), "%s/failoverdomainnode[%d]/@name",
-		 base, idx);
-	if (ccs_get(ccsfd, xpath, &ret) != 0)
-		return NULL;
-
-	list_do(&domain->fd_nodes, fodn) {
-		if (strcasecmp(ret, fodn->fdn_name))
-			continue;
-
-		logt_print(LOG_ERR, "#30: Node %s defined multiple times in "
-		       "domain %s\n", ret, domain->fd_name);
-		free(ret);
-		return NULL;
-	} while (!list_done(&domain->fd_nodes, fodn));
-
-	fodn = malloc(sizeof(*fodn));
-	if (!fodn)
-		return NULL;
-	memset(fodn, 0, sizeof(*fodn));
-
-	/* Already malloc'd; simply store */
-	fodn->fdn_name = ret;
-	fodn->fdn_prio = 0;
-	
- 	snprintf(xpath, sizeof(xpath),
- 		 "/cluster/clusternodes/clusternode[@name=\"%s\"]/@nodeid",
- 		 ret);
- 	if (ccs_get(ccsfd, xpath, &ret) != 0) {
- 		logt_print(LOG_WARNING, "Node %s has no nodeid attribute\n",
- 		       fodn->fdn_name);
- 		fodn->fdn_nodeid = -1;
- 	} else {
- 		/* 64-bit-ism on rhel4? */
- 		fodn->fdn_nodeid = atoi(ret);
- 	}
- 
- 	/* Don't even bother getting priority if we're not ordered (it's set
- 	   to 0 above */
- 	if (!(domain->fd_flags & FOD_ORDERED))
- 		return fodn;
- 
-	snprintf(xpath, sizeof(xpath), "%s/failoverdomainnode[%d]/@priority",
-		 base, idx);
-	if (ccs_get(ccsfd, xpath, &ret) != 0)
-		return fodn;
-
-	fodn->fdn_prio = atoi(ret);
-	if (fodn->fdn_prio > 100 || fodn->fdn_prio <= 0)
-		fodn->fdn_prio = 0;
-	free(ret);
-
-	return fodn;
-}
-
-
-fod_t *
-fod_get_domain(int ccsfd, char *base, int idx, fod_t **domains)
-{
-	fod_t *fod;
-	fod_node_t *fodn;
-	char xpath[256];
-	char *ret;
-	int x = 1;
-
-	snprintf(xpath, sizeof(xpath), "%s/failoverdomain[%d]/@name",
-		 base, idx);
-	if (ccs_get(ccsfd, xpath, &ret) != 0)
-		return NULL;
-
-	list_do(domains, fod) {
-		if (strcasecmp(fod->fd_name, ret))
-			continue;
-		    
-		logt_print(LOG_ERR, "#31: Domain %s defined multiple times\n",
-		       ret);
-		free(ret);
-		return NULL;
-	} while (!list_done(domains, fod));
-
-	fod = malloc(sizeof(*fod));
-	if (!fod)
-		return NULL;
-	memset(fod, 0, sizeof(*fod));
-	fod->fd_name = ret;
-	fod->fd_nodes = 0;
-	fod->fd_flags = 0;
-
-	snprintf(xpath, sizeof(xpath), "%s/failoverdomain[%d]/@ordered",
-		 base, idx);
-	if (ccs_get(ccsfd, xpath, &ret) == 0) {
-		if (atoi(ret) != 0)
-			fod->fd_flags |= FOD_ORDERED;
-		free(ret);
-	}
-
-	snprintf(xpath, sizeof(xpath), "%s/failoverdomain[%d]/@restricted",
-		 base, idx);
-	if (ccs_get(ccsfd, xpath, &ret) == 0) {
-		if (atoi(ret) != 0)
-			fod->fd_flags |= FOD_RESTRICTED;
-		free(ret);
-	}
-
-	snprintf(xpath, sizeof(xpath), "%s/failoverdomain[%d]/@nofailback",
-		 base, idx);
-	if (ccs_get(ccsfd, xpath, &ret) == 0) {
-		if (atoi(ret) != 0)
-			fod->fd_flags |= FOD_NOFAILBACK;
-		free(ret);
-	}
-
-	snprintf(xpath, sizeof(xpath), "%s/failoverdomain[%d]",
-		 base, idx);
-
-	do {
-		fodn = fod_get_node(ccsfd, xpath, x++, fod);
-		if (fodn) {
-			/*
-			list_do(&fod->fd_nodes, curr) {
-				// insert sorted 
-				if (fodn->fdn_prio < curr->fdn_prio) {
-					list_insert(&fod->fd_nodes, fodn);
-					if (curr == fod->fd_nodes)
-						fod->fd_nodes = fodn;
-				}
-			} while (!list_done(&fod->fd_nodes, curr));
-			*/
-			list_insert(&fod->fd_nodes, fodn);
-		}
-	} while (fodn);
-	
-	return fod;
-}
-
-
-int
-construct_domains(int ccsfd, fod_t **domains)
-{
-	char xpath[256];
-	int x = 1;
-	fod_t *fod;
-
-	snprintf(xpath, sizeof(xpath),
-		 RESOURCE_TREE_ROOT "/failoverdomains");
-
-	do {
-		fod = fod_get_domain(ccsfd, xpath, x++, domains);
-		if (fod) {
-			list_insert(domains, fod);
-		}
-	} while (fod);
-
-	return 0;
-}
-
-
-fod_t *
-fod_find_domain(fod_t **domains, char *name)
-{
-	fod_t *dom;
-	
-	list_do(domains, dom) {
-		
-		if (!strcasecmp(dom->fd_name, name))
-			return dom;
-	
-	} while (!list_done(domains,dom));
-	
-	return NULL;
-}
-
-
-void
-deconstruct_domains(fod_t **domains)
-{
-	fod_t *domain = NULL;
-	fod_node_t *node;
-
-	while ((domain = *domains)) {
-		list_remove(domains, domain);
-		while ((node = domain->fd_nodes)) {
-			list_remove(&domain->fd_nodes, node);
-			if (node->fdn_name)
-				free(node->fdn_name);
-			free(node);
-		}
-
-		if (domain->fd_name)
-			free(domain->fd_name);
-		free(domain);
-	}
-}
-
-
-void
-print_domains(fod_t **domains)
-{
-	fod_t *fod;
-	fod_node_t *fodn = NULL;
-	/*
-	int x;
-	int *node_set = NULL;
-	int node_set_len = 0;
-	 */
-
-	list_do(domains, fod) {
-		printf("Failover domain: %s\n", fod->fd_name);
-		printf("Flags: ");
-		if (!fod->fd_flags) {
-			printf("none\n");
-		} else {
-			if (fod->fd_flags & FOD_ORDERED)
-				printf("Ordered ");
-			if (fod->fd_flags & FOD_RESTRICTED)
-				printf("Restricted ");
-			if (fod->fd_flags & FOD_NOFAILBACK)
-				printf("No Failback");
-			printf("\n");
-		}
-
-  		list_do(&fod->fd_nodes, fodn) {
-			printf("  Node %s (id %d, priority %d)\n",
-			       fodn->fdn_name, fodn->fdn_nodeid,
-			       fodn->fdn_prio);
- 		} while (!list_done(&fod->fd_nodes, fodn));
- 		
-	} while (!list_done(domains, fod));
-}
-
-
-/**
- * Check to see if a given node is the current preferred node within a domain
- * on which we should start the service...
- * @param nodename		Node/member name.
- * @param domain		Existing domain.
- * @param membership		Current membership mask.
- * @return			0 for No, All domain members offline.
- *				1 for No, 1+ Domain member(s) online.
- *				2 for Yes, Not lowest-ordered, online member.
- *				3 for Yes, Lowest-ordered, online member.
- */
-int
-node_in_domain(char *nodename, fod_t *domain,
-	       cluster_member_list_t *membership)
-{
-	int online = 0, member_match = 0, preferred = 100, myprio = -1;
-	fod_node_t *fodn;
-
-	list_do(&domain->fd_nodes, fodn) {
-		/*
-		 * We have to check the membership mask here so that
-		 * we can decide whether or not 'nodename' is the lowest
-		 * ordered node.
-		 */
-		if (!memb_online(membership,
-				 memb_name_to_id(membership, fodn->fdn_name)))
-			continue;
-
-		/*
-		 * If we get here, we know:
-		 * A member of the domain is online somewhere
-		 */
-		online = 1;
-		if (!strcmp(nodename, fodn->fdn_name)) {
-			/*
-			 * If we get here, we know:
-			 * We are a member of the domain.
-			 */
-			member_match = 1;
-			myprio = fodn->fdn_prio;
-		}
-
-		if (fodn->fdn_prio < preferred)
-			preferred = fodn->fdn_prio;
-	} while (!list_done(&domain->fd_nodes, fodn));
-
-	if (!online)
-		return 0;
-
-	if (!member_match)
-		return 1;
-
-	/* Figure out if we're the in the most-preferred group */
-	preferred = (myprio <= preferred);
-	if (!preferred)
-		return 2;
-
-	return 3;
-}
-
-
-int
-node_domain_set(fod_t **domains, char *name, int **ret, int *retlen, int *flags)
-{
-	int x, i, j;
-	int *tmpset;
-	int ts_count;
-	fod_node_t *fodn;
-	fod_t *domain;
-	int found = 0;
-
-	list_for(domains, domain, x) {
-		if (!strcasecmp(domain->fd_name, name)) {
-			found = 1;
-			break;
-		}
-	} // while (!list_done(&_domains, fod));
-
-	if (!found)
-		return -1;
-
-	/* Count domain length */
-	list_for(&domain->fd_nodes, fodn, x) { }
-	
-	*retlen = 0;
-	*ret = malloc(sizeof(int) * x);
-	if (!(*ret))
-		return -1;
-	tmpset = malloc(sizeof(int) * x);
-	if (!(*tmpset))
-		return -1;
-
-	*flags = domain->fd_flags;
-
-	if (domain->fd_flags & FOD_ORDERED) {
-		for (i = 1; i <= 100; i++) {
-			
-			ts_count = 0;
-			list_for(&domain->fd_nodes, fodn, x) {
-				if (fodn->fdn_prio == i) {
-					s_add(tmpset, &ts_count,
-					      fodn->fdn_nodeid);
-				}
-			}
-
-			if (!ts_count)
-				continue;
-
-			/* Shuffle stuff at this prio level */
-			if (ts_count > 1)
-				s_shuffle(tmpset, ts_count);
-			for (j = 0; j < ts_count; j++)
-				s_add(*ret, retlen, tmpset[j]);
-		}
-	}
-
-	/* Add unprioritized nodes */
-	ts_count = 0;
-	list_for(&domain->fd_nodes, fodn, x) {
-		if (!fodn->fdn_prio) {
-			s_add(tmpset, &ts_count,
-			      fodn->fdn_nodeid);
-		}
-	}
-
-	if (!ts_count)
-		return 0;
-
-	/* Shuffle stuff at this prio level */
-	if (ts_count > 1)
-		s_shuffle(tmpset, ts_count);
-	for (j = 0; j < ts_count; j++)
-		s_add(*ret, retlen, tmpset[j]);
-
-	return 0;
-}
-
-
-/**
- * See if a given nodeid should start a specified service svcid.
- *
- * @param nodeid	The node ID in question.
- * @param membership	Current membership mask.
- * @param rg_name	The resource group name in question.
- * @param domains	List of failover domains.
- * @return		0 on NO, 1 for YES
- */
-int
-node_should_start(int nodeid, cluster_member_list_t *membership,
-		  char *rg_name, fod_t **domains)
-{
-	char *nodename = NULL;
-	char domainname[128];
-	int ordered = 0;
-	int restricted = 0;
-	int nofailback = 0;
-	fod_t *fod = NULL;
-	int found = 0;
-	int owned_by_node = 0, started = 0, no_owner = 0;
-#ifndef NO_CCS
-	rg_state_t svc_state;
-	struct dlm_lksb lockp;
-#endif
-
-	/*
-	 * Um, if the node isn't online...
-	 */
-	if (!memb_online(membership, nodeid)) {
-#ifdef DEBUG
-		logt_print(LOG_DEBUG,"Member #%d is not online -> NO\n", nodeid);
-#endif
-		return FOD_ILLEGAL;
-	}
-
-	nodename = memb_id_to_name(membership, nodeid);
-
-#ifndef NO_CCS /* XXX Testing only */
-	if (group_property(rg_name, "domain",
-			    domainname, sizeof(domainname))) {
-		/*
-		 * If no domain is present, then the node in question should
-		 * try to start the service.
-		 */
-#ifdef DEBUG
-		logt_print(LOG_DEBUG,
-		       "Fail-over Domain for service %s nonexistent\n",
-		       rg_name);
-#endif
-		return FOD_BEST;
-	}
-#endif
-
-	/*
-	 * Ok, we've got a failover domain associated with the service.
-	 * Let's see if the domain actually exists...
-	 */
-	list_do(domains, fod) {
-
-		if (!strcasecmp(fod->fd_name, domainname)) {
-			found = 1;
-			break;
-		}
-	} while (!list_done(domains, fod));
-
-	if (!found) {
-		/*
-		 * Domain doesn't exist!  Weird...
-		 */
-		logt_print(LOG_WARNING, "#66: Domain '%s' specified for resource "
-		       "group %s nonexistent!\n", domainname, rg_name);
-		return FOD_BEST;
-	}
-
-	/*
-	 * Determine whtehter this domain has failback turned on or not..
-	 */
-	nofailback = !!(fod->fd_flags & FOD_NOFAILBACK);
-
-	/*
-	 * Determine whether this domain is restricted or not...
-	 */
-	restricted = !!(fod->fd_flags & FOD_RESTRICTED);
-
-	/*
-	 * Determine whether this domain is ordered or not...
-	 */
-	ordered = !!(fod->fd_flags & FOD_ORDERED);
-
-#ifndef NO_CCS
-	if(nofailback) {
-		if (rg_lock(rg_name, &lockp) != 0) {
-			logt_print(LOG_WARNING, "Error getting a lock\n");
-			return FOD_BEST;
-		}
-                
-		if (get_rg_state(rg_name, &svc_state) == RG_EFAIL) {
-                	/*
-			 * Couldn't get the service state, thats odd
-			 */
-			logt_print(LOG_WARNING, "Problem getting state information for "
-			       "%s\n", rg_name);
-			rg_unlock(&lockp);
-			return FOD_BEST;
-		}
-		rg_unlock(&lockp);
-
-		/*
-		 * Check to see if the service is started and if we are the owner in case of
-		 * restricted+owner+no failback
-		 */
-		if (svc_state.rs_state == RG_STATE_STARTED)
-			started = 1;
-		if (svc_state.rs_owner == (uint32_t)nodeid)
-			owned_by_node = 1;
-		if (!memb_online(membership, svc_state.rs_owner))
-			no_owner = 1;
-	}
-#endif
-
-	switch (node_in_domain(nodename, fod, membership)) {
-	case 0:
-		/*
-		 * Node is not a member of the domain and no members of the
-		 * domain are online.
-		 */
-#ifdef DEBUG
-		logt_print(LOG_DEBUG, "Member #%d is not a member and no "
-		       "members are online\n", nodeid);
-#endif
-		if (!restricted) {
-#ifdef DEBUG
-			logt_print(LOG_DEBUG,"Restricted mode off -> BEST\n");
-#endif
-			return FOD_BEST;
-		}
-#ifdef DEBUG
-		logt_print(LOG_DEBUG,"Restricted mode -> ILLEGAL\n");
-#endif
-		return FOD_ILLEGAL;
-	case 1:
-		/* 
-		 * Node is not a member of the domain and at least one member
-		 * of the domain is online.
-		 */
-		/* In this case, we can ignore 'restricted' */
-#ifdef DEBUG
-		logt_print(LOG_DEBUG, "Member #%d is not a member of domain %s "
-		       "and a member is online\n", nodeid, domainname);
-#endif
-		if (!restricted) {
-#ifdef DEBUG
-			logt_print(LOG_DEBUG,"Restricted mode off -> GOOD\n");
-#endif
-			return FOD_GOOD;
-		}
-#ifdef DEBUG
-		logt_print(LOG_DEBUG,"Restricted mode -> ILLEGAL\n");
-#endif
-		return FOD_ILLEGAL;
-	case 2:
-		/*
-		 * Node is a member of the domain, but is not the
-		 * lowest-ordered, online member.
-		 */
-#ifdef DEBUG
-		logt_print(LOG_DEBUG, "Member #%d is a member, but is not the "
-		       "lowest-ordered\n", nodeid);
-#endif
-		if (ordered) {
-			/*
-			 * If we are ordered we want to see if failback is
-			 * turned on
-			 */
-			if (nofailback && started && owned_by_node && !no_owner) {
-#ifdef DEBUG
-				logt_print(LOG_DEBUG,"Ordered mode and no "
-				       "failback -> BEST\n");
-#endif
-				return FOD_BEST;
-			}
-#ifdef DEBUG
-			logt_print(LOG_DEBUG,"Ordered mode -> BETTER\n");
-#endif
-			return FOD_BETTER;
-		}
-
-#ifdef DEBUG
-		logt_print(LOG_DEBUG,"Not using ordered mode -> BEST\n");
-#endif
-		return FOD_BEST;
-	case 3:
-		/*
-		 * Node is a member of the domain and is the lowest-ordered,
-		 * online member.
-		 */
-
-		if(nofailback && started && !owned_by_node && !no_owner) {
-#ifdef DEBUG
-			logt_print(LOG_DEBUG, "Member #%d is the lowest-ordered "
-			       "memeber of the domain, but is not the owner "
-			       "-> BETTER\n", nodeid);
-#endif
-			return FOD_BETTER;
-		}
- 
-		/* In this case, we can ignore 'ordered' */
-#ifdef DEBUG
-		logt_print(LOG_DEBUG, "Member #%d is the lowest-ordered member "
-		       "of the domain -> BEST\n", nodeid);
-#endif
-		return FOD_BEST;
-	default:
-		/* Do what? */
-		logt_print(LOG_ERR, "#32: Code path error: "
-		       "Invalid return from node_in_domain()\n");
-		return FOD_ILLEGAL;
-	}
-
-	/* not reached */
-	return FOD_ILLEGAL;
-}
diff --git a/rgmanager/src/daemons/groups.c b/rgmanager/src/daemons/groups.c
deleted file mode 100644
index 4047be1..0000000
--- a/rgmanager/src/daemons/groups.c
+++ /dev/null
@@ -1,1832 +0,0 @@
-//#define DEBUG
-#include <platform.h>
-#include <resgroup.h>
-#include <restart_counter.h>
-#include <reslist.h>
-#include <vf.h>
-#include <message.h>
-#include <ccs.h>
-#include <logging.h>
-#include <members.h>
-#include <list.h>
-#include <reslist.h>
-#include <assert.h>
-#include <event.h>
-#include <sets.h>
-
-/* Use address field in this because we never use it internally,
-   and there is no extra space in the cman_node_t type.
-   */
-
-#define cn_svccount cn_address.cna_address[0] /* Theses are uint8_t size */
-#define cn_svcexcl  cn_address.cna_address[1]
-
-extern event_table_t *master_event_table;
-
-static int config_version = 0;
-static resource_t *_resources = NULL;
-static resource_rule_t *_rules = NULL;
-static resource_node_t *_tree = NULL;
-static fod_t *_domains = NULL;
-
-#ifdef WRAP_LOCKS
-pthread_mutex_t config_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
-pthread_mutex_t status_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
-#else
-pthread_mutex_t config_mutex = PTHREAD_MUTEX_INITIALIZER;
-pthread_mutex_t status_mutex = PTHREAD_MUTEX_INITIALIZER;
-#endif
-pthread_rwlock_t resource_lock = PTHREAD_RWLOCK_INITIALIZER;
-
-void res_build_name(char *, size_t, resource_t *);
-int get_rg_state_local(char *, rg_state_t *);
-int group_migratory(char *groupname, int lock);
-int _group_property(char *groupname, char *property, char *ret, size_t len);
-int restart_threshold_exceeded(restart_counter_t arg);
-
-
-struct status_arg {
-	msgctx_t *ctx;
-	int fast;
-};
-
-
-/**
-   See if a given node ID should start a resource, given cluster membership
-
-   @see node_should_start
- */
-int
-node_should_start_safe(uint32_t nodeid, cluster_member_list_t *membership,
-		       char *rg_name)
-{
-	int ret;
-
-	pthread_rwlock_rdlock(&resource_lock);
-	ret = node_should_start(nodeid, membership, rg_name, &_domains);
-	pthread_rwlock_unlock(&resource_lock);
-
-	return ret;
-}
-
-
-int
-node_domain_set_safe(char *domainname, int **ret, int *retlen, int *flags)
-{
-	int rv = 0;
-	pthread_rwlock_rdlock(&resource_lock);
-	rv = node_domain_set(&_domains, domainname, ret, retlen, flags);
-	pthread_rwlock_unlock(&resource_lock);
-
-	return rv;
-}
-
-
-int
-count_resource_groups(cluster_member_list_t *ml)
-{
-	resource_t *res;
-	resource_node_t *node;
-	char rgname[64], *val;
-	int x;
-	rg_state_t st;
-	struct dlm_lksb lockp;
-	cman_node_t *mp;
-
-	for (x = 0; x < ml->cml_count; x++) {
-		ml->cml_members[x].cn_svccount = 0;
-		ml->cml_members[x].cn_svcexcl = 0;
-	}
-
-	pthread_rwlock_rdlock(&resource_lock);
-
-	list_do(&_tree, node) {
-
-		res = node->rn_resource;
-
-		res_build_name(rgname, sizeof(rgname), res);
-
-		if (rg_lock(rgname, &lockp) < 0) {
-			logt_print(LOG_ERR, "#XX: Unable to obtain cluster "
-			       "lock @ %s:%d: %s\n", __FILE__, __LINE__,
-			       strerror(errno));
-			continue;
-		}
-
-		if (get_rg_state(rgname, &st) < 0) {
-			logt_print(LOG_ERR, "#34: Cannot get status "
-			       "for service %s\n", rgname);
-			rg_unlock(&lockp);
-			continue;
-		}
-
-		rg_unlock(&lockp);
-
-		if (st.rs_state != RG_STATE_STARTED &&
-		     st.rs_state != RG_STATE_STARTING)
-			continue;
-
-		mp = memb_id_to_p(ml, st.rs_owner);
-		if (!mp)
-			continue;
-
-		++mp->cn_svccount;
-
-		val = res_attr_value(res, "exclusive");
-		if (val && ((!strcmp(val, "yes") ||
-				     (atoi(val)>0))) ) {
-			++mp->cn_svcexcl;
-		}
-
-	} while (!list_done(&_tree, node));
-
-	pthread_rwlock_unlock(&resource_lock);
-	return 0;
-}
-
-
-static inline int 
-is_exclusive_res(resource_t *res)
-{
-	char *val;
-
-	val = res_attr_value(res, "exclusive");
-	if (val && ((!strcmp(val, "yes") ||
-			(atoi(val)>0))) ) {
-		return 1;
-	}
-	return 0;
-}
-
-
-/* Locked exported function */
-int 
-is_exclusive(char *svcName)
-{
-	int ret = 0;
-	resource_t *res = NULL;
-
-	pthread_rwlock_rdlock(&resource_lock);
-	res = find_root_by_ref(&_resources, svcName);
-
-	if (!res)
-		ret = RG_ENOSERVICE;
-	else
-		ret = is_exclusive_res(res);
-
-	pthread_rwlock_unlock(&resource_lock);
-	return ret;
-}
-
-
-resource_node_t *
-node_by_ref(resource_node_t **tree, char *name)
-{
-	resource_t *res;
-	resource_node_t *node, *ret = NULL;
-	char rgname[64];
-	int x;
-
-	list_for(tree, node, x) {
-
-		res = node->rn_resource;
-		res_build_name(rgname, sizeof(rgname), res);
-
-		if (!strcasecmp(name, rgname)) {
-			ret = node;
-			break;
-		}
-	}
-
-	return ret;
-}
-
-
-int
-count_resource_groups_local(cman_node_t *mp)
-{
-	resource_t *res;
-	resource_node_t *node;
-	char rgname[64];
-	rg_state_t st;
-
-	mp->cn_svccount = 0;
-	mp->cn_svcexcl = 0;
-
-	pthread_rwlock_rdlock(&resource_lock);
-
-	list_do(&_tree, node) {
-
-		res = node->rn_resource;
-
-		res_build_name(rgname, sizeof(rgname), res);
-
-		if (get_rg_state_local(rgname, &st) < 0) {
-			continue;
-		}
-
-		if (st.rs_state != RG_STATE_STARTED &&
-		     st.rs_state != RG_STATE_STARTING)
-			continue;
-
-		if (mp->cn_nodeid != (int)st.rs_owner)
-			continue;
-
-		++mp->cn_svccount;
-
-		if (is_exclusive_res(res))
-			++mp->cn_svcexcl;
-
-	} while (!list_done(&_tree, node));
-
-	pthread_rwlock_unlock(&resource_lock);
-	return 0;
-}
-
-
-int
-have_exclusive_resources(void)
-{
-	resource_t *res;
-
-	pthread_rwlock_rdlock(&resource_lock);
-
-	list_do(&_resources, res) {
-		if (is_exclusive_res(res)) {
-			pthread_rwlock_unlock(&resource_lock);
-			return 1;
-		}
-
-	} while (!list_done(&_resources, res));
-
-	pthread_rwlock_unlock(&resource_lock);
-
-	return 0;
-}
-
-
-int
-check_exclusive_resources(cluster_member_list_t *membership, char *svcName)
-{
-	cman_node_t *mp;
-	int exclusive, count, excl; 
-	resource_t *res;
-
-	mp = memb_id_to_p(membership, my_id());
-	assert(mp);
-	count_resource_groups_local(mp);
-	exclusive = mp->cn_svcexcl;
-	count = mp->cn_svccount;
-	pthread_rwlock_rdlock(&resource_lock);
-	res = find_root_by_ref(&_resources, svcName);
-	if (!res) {
-		pthread_rwlock_unlock(&resource_lock);
-		return RG_ENOSERVICE;
-	}
-
-	excl = is_exclusive_res(res);
-	pthread_rwlock_unlock(&resource_lock);
-	if (exclusive || (count && excl))
-		return RG_YES;
-
-	return 0;
-}
-
-
-/**
-   Find the best target node for a service *besides* the current service
-   owner.  Takes into account:
-
-   - Failover domain (ordering / restricted policy)
-   - Exclusive service policy
- */
-uint32_t
-best_target_node(cluster_member_list_t *allowed, uint32_t owner,
-		 char *rg_name, int lock)
-{
-	int x;
-	int highscore = 1;
-	int score;
-	uint32_t highnode = owner, nodeid;
-	char *val;
-	resource_t *res;
-	int exclusive;
-
-	if (lock)
-		pthread_rwlock_rdlock(&resource_lock);
-	count_resource_groups(allowed);
-	if (lock)
-		pthread_rwlock_unlock(&resource_lock);
-
-	for (x=0; x < allowed->cml_count; x++) {
-		if (!allowed->cml_members[x].cn_member)
-			continue;
-
-		nodeid = allowed->cml_members[x].cn_nodeid;
-
-		/* Don't allow trying a restart just yet */
-		if (owner != 0 && nodeid == owner)
-			continue;
-		
-		if (lock)
-			pthread_rwlock_rdlock(&resource_lock);
-		score = node_should_start(nodeid, allowed, rg_name, &_domains);
-		if (!score) { /* Illegal -- failover domain constraint */
-			if (lock)
-				pthread_rwlock_unlock(&resource_lock);
-			continue;
-		}
-
-		/* Add 2 to score if it's an exclusive service and nodeid
-		   isn't running any services currently.  Set score to 0 if
-		   it's an exclusive service and the target node already
-		   is running a service. */
-		res = find_root_by_ref(&_resources, rg_name);
-		val = res_attr_value(res, "exclusive");
-		exclusive = val && ((!strcmp(val, "yes") || (atoi(val)>0)));
-
-		if (lock)
-			pthread_rwlock_unlock(&resource_lock);
-
-		if (exclusive) {
-
-			if (allowed->cml_members[x].cn_svccount > 0) {
-				/* Definitely not this guy */
-				continue;
-			} else {
-				score += 2;
-			}
-		} else if (allowed->cml_members[x].cn_svcexcl) {
-			/* This guy has an exclusive resource group.
-			   Can't relocate / failover to him. */
-			continue;
-		}
-
-		if (score < highscore)
-			continue;
-
-		highnode = nodeid;
-		highscore = score;
-	}
-
-	return highnode;
-}
-
-
-int
-check_depend(resource_t *res)
-{
-	char *val;
-	rg_state_t rs;
-
-	val = res_attr_value(res, "depend");
-	if (!val)
-		/* No dependency */
-		return -1;
-
-	if (get_rg_state_local(val, &rs) == 0)
-		return (rs.rs_state == RG_STATE_STARTED);
-
-	return 1;
-}
-
-
-int
-check_depend_safe(char *rg_name)
-{
-	resource_t *res;
-	int ret;
-
-	pthread_rwlock_rdlock(&resource_lock);
-	res = find_root_by_ref(&_resources, rg_name);
-	if (!res)
-		return -1;
-
-	ret = check_depend(res);
-	pthread_rwlock_unlock(&resource_lock);
-
-	return ret;
-}
-
-
-int
-check_rdomain_crash(char *svcName)
-{
-	int *nodes = NULL, nodecount = 0;
-	int *fd_nodes = NULL, fd_nodecount = 0, fl = 0;
-	int *isect = NULL, icount = 0;
-	char fd_name[256];
-
-	if (_group_property(svcName, "domain", fd_name, sizeof(fd_name)) != 0)
-		goto out_free;
-
-	if (node_domain_set(&_domains, fd_name, &fd_nodes,
-			    &fd_nodecount, &fl) != 0)
-		goto out_free;
-
-	if (!(fl & FOD_RESTRICTED))
-		goto out_free;
-	
-	if (s_intersection(fd_nodes, fd_nodecount, nodes, nodecount, 
-		    &isect, &icount) < 0)
-		goto out_free;
-
-	if (icount == 0) {
-		logt_print(LOG_NOTICE, "Marking %s as stopped: "
-		       "Restricted domain unavailable\n", svcName);
-		rt_enqueue_request(svcName, RG_STOP, NULL, 0, 0,
-				   0, 0);
-	}
-
-out_free:
-	if (fd_nodes)
-		free(fd_nodes);
-	if (nodes)
-		free(nodes);
-	if (isect)
-		free(isect);
-
-	return 0;
-}
-
-
-/**
-  Start or failback a resource group: if it's not running, start it.
-  If it is running and we're a better member to run it, then ask for
-  it.
- */
-void
-consider_start(resource_node_t *node, char *svcName, rg_state_t *svcStatus,
-	       cluster_member_list_t *membership)
-{
-	char *val;
-	cman_node_t *mp;
-	int autostart, exclusive;
-	struct dlm_lksb lockp;
-	int fod_ret;
-
-	mp = memb_id_to_p(membership, my_id());
-	assert(mp);
-
-	/* Service cannot be started if Frozen */
-	if (svcStatus->rs_flags & RG_FLAG_FROZEN)
-		return;
-	/*
-	 * Service must be not be running elsewhere to consider for a
-	 * local start.
-	 */
-	if (svcStatus->rs_state == RG_STATE_STARTED &&
-	    svcStatus->rs_owner == (uint32_t)mp->cn_nodeid)
-		return;
-
-	if (svcStatus->rs_state == RG_STATE_DISABLED)
-		return;
-
-	/* Stopped, and hasn't been started yet.  See if
-	   autostart is disabled.  If it is, leave it stopped */
-	if (svcStatus->rs_state == RG_STATE_STOPPED &&
-		    svcStatus->rs_transition == 0) {
-		val = res_attr_value(node->rn_resource, "autostart");
-		autostart = !(val && ((!strcmp(val, "no") ||
-				     (atoi(val)==0))));
-		if (!autostart) {
-			/*
-			logt_print(LOG_DEBUG,
-			       "Skipping RG %s: Autostart disabled\n",
-			       svcName);
-			 */
-			/*
-			   Mark non-autostart services as disabled to avoid
-			   confusion!
-			 */
-			if (rg_lock(svcName, &lockp) < 0) {
-				logt_print(LOG_ERR, "#XX: Unable to obtain cluster "
-				       "lock @ %s:%d: %s\n", __FILE__, __LINE__,
-				       strerror(errno));
-				return;
-			}
-
-			if (get_rg_state(svcName, svcStatus) != 0) {
-				logt_print(LOG_ERR, "#34: Cannot get status "
-				       "for service %s\n", svcName);
-				rg_unlock(&lockp);
-				return;
-			}
-
-			if (svcStatus->rs_transition == 0 &&
-			    svcStatus->rs_state == RG_STATE_STOPPED) {
-				svcStatus->rs_state = RG_STATE_DISABLED;
-				set_rg_state(svcName, svcStatus);
-			}
-
-			rg_unlock(&lockp);
-
-			return;
-		}
-	}
-
-	/* See if service this one depends on is running.  If not,
-           don't start it */
-	if (check_depend(node->rn_resource) == 0) {
-		logt_print(LOG_DEBUG,
-		       "Skipping RG %s: Dependency missing\n", svcName);
-		return;
-	}
-
-	val = res_attr_value(node->rn_resource, "exclusive");
-	exclusive = val && ((!strcmp(val, "yes") || (atoi(val)>0)));
-
-	if (exclusive && mp->cn_svccount) {
-		logt_print(LOG_DEBUG,
-		       "Skipping RG %s: Exclusive and I am running services\n",
-		       svcName);
-		return;
-	}
-
-	/*
-	   Don't start other services if I'm running an exclusive
-	   service.
-	 */
-	if (mp->cn_svcexcl) {
-		logt_print(LOG_DEBUG,
-		       "Skipping RG %s: I am running an exclusive service\n",
-		       svcName);
-		return;
-	}
-
-	/*
-	 * Start any stopped services, or started services
-	 * that are owned by a down node.
-	 */
-	fod_ret = node_should_start(mp->cn_nodeid, membership,
-				    svcName, &_domains);
-	if (fod_ret == FOD_BEST)
-		rt_enqueue_request(svcName, RG_START, NULL, 0, mp->cn_nodeid,
-				   0, 0);
-	else if (fod_ret == FOD_ILLEGAL)
-		check_rdomain_crash(svcName);
-}
-
-
-void
-consider_relocate(char *svcName, rg_state_t *svcStatus, uint32_t nodeid,
-		  cluster_member_list_t *membership)
-{
-	int a, b, req = RG_RELOCATE;
-
-	/*
-	   Service must be running locally in order to consider for
-	   a relocate
-	 */
-	if ((svcStatus->rs_state != RG_STATE_STARTING &&
-	    svcStatus->rs_state != RG_STATE_STARTED) ||
-	    svcStatus->rs_owner != (uint32_t)my_id())
-		return;
-
-	/*
-	 * Send the resource group to a node if it's got a higher prio
-	 * to run the resource group.
-	 */
-#if 0
-	if (best_target_node(membership, my_id(), svcName, 0) !=
-	    nodeid) {
-		return;
-	}
-#endif
-	a = node_should_start(nodeid, membership, svcName, &_domains);
-	b = node_should_start(my_id(), membership, svcName, &_domains);
-
-	if (a <= b)
-		return;
-
-	if (group_migratory(svcName, 1)) {
-		req = RG_MIGRATE;
-	}
-
-	logt_print(LOG_NOTICE, "%s %s to better node %s\n",
-	       req==RG_MIGRATE ? "Migrating":"Relocating",
-	       svcName,
-	       memb_id_to_name(membership, nodeid));
-
-	rt_enqueue_request(svcName, req, NULL, 0, nodeid, 0, 0);
-}
-
-
-char **
-get_service_names(int *len)
-{
-	resource_node_t *node = NULL;
-	int nservices, ncopied = 0, x;
-	char **ret = NULL;
-	char rg_name[64];
-
-	pthread_rwlock_rdlock(&resource_lock);
-
-	nservices = 0;
-	list_do(&_tree, node) {
-		++nservices;
-	} while (!list_done(&_tree, node));
-	
-	ret = malloc(sizeof(char *) * (nservices + 1));
-	if (!ret)
-		goto out_fail;
-
-	memset(ret, 0, sizeof(char *) * (nservices + 1));
-	nservices = 0;
-	list_for(&_tree, node, nservices) {
-		res_build_name(rg_name, sizeof(rg_name),
-			       node->rn_resource);
-
-		if (!strlen(rg_name))
-			continue;
-
-		ret[ncopied] = strdup(rg_name);
-		if (ret[ncopied]) {
-			ncopied++;
-		} else {
-			goto out_fail;
-		}
-	}
-
-	if (len)
-		*len = ncopied;
-	pthread_rwlock_unlock(&resource_lock);
-	return ret;
-
-out_fail:
-	pthread_rwlock_unlock(&resource_lock);
-	for (x = 0; x < ncopied; x++)
-		free(ret[x]);
-	if (ret)
-		free(ret);
-	return NULL;
-}
-
-
-
-
-
-/**
- * Called to decide what services to start locally during a node_event.
- * Originally a part of node_event, it is now its own function to cut down
- * on the length of node_event.
- * 
- * @see			node_event
- */
-int
-eval_groups(int local, uint32_t nodeid, int nodeStatus)
-{
-	struct dlm_lksb lockp;
-	char svcName[64], *nodeName;
-	resource_node_t *node;
-	rg_state_t svcStatus;
-	cluster_member_list_t *membership;
-	int ret;
-
-	if (rg_locked()) {
-		logt_print(LOG_DEBUG,
-			"Resource groups locked; not evaluating\n");
-		return -EAGAIN;
-	}
-
-	membership = member_list();
-
-	pthread_rwlock_rdlock(&resource_lock);
-
-	/* Requires read lock */
-	count_resource_groups(membership);
-
-	list_do(&_tree, node) {
-
-		res_build_name(svcName, sizeof(svcName), node->rn_resource);
-
-		/*
-		 * Lock the service information and get the current service
-		 * status.
-		 */
-		if ((ret = rg_lock(svcName, &lockp)) < 0) {
-			logt_print(LOG_ERR,
-			       "#33: Unable to obtain cluster lock: %s\n",
-			       strerror(-ret));
-			pthread_rwlock_unlock(&resource_lock);
-			free_member_list(membership);
-			return ret;
-		}
-		
-		if (get_rg_state(svcName, &svcStatus) != 0) {
-			logt_print(LOG_ERR,
-			       "#34: Cannot get status for service %s\n",
-			       svcName);
-			rg_unlock(&lockp);
-			continue;
-		}
-
-		rg_unlock(&lockp);
-
-		if (svcStatus.rs_owner == 0)
-			nodeName = "none";
-		else
-			nodeName = memb_id_to_name(membership,
-						   svcStatus.rs_owner);
-
-		/* Disabled/failed/in recovery?  Do nothing */
-		if ((svcStatus.rs_state == RG_STATE_DISABLED) ||
-		    (svcStatus.rs_state == RG_STATE_FAILED) ||
-		    (svcStatus.rs_state == RG_STATE_RECOVER)) {
-			continue;
-		}
-
-		logt_print(LOG_DEBUG, "Evaluating RG %s, state %s, owner "
-		       "%s\n", svcName,
-		       rg_state_str(svcStatus.rs_state),
-		       nodeName);
-
-		if ((local && nodeStatus) ||
-		    svcStatus.rs_state == RG_STATE_STOPPED) {
-
-			consider_start(node, svcName, &svcStatus, membership);
-
-		} else if (!local && !nodeStatus) {
-
-			/*
-			 * Start any stopped services, or started services
-			 * that are owned by a down node.
-			 */
-			consider_start(node, svcName, &svcStatus, membership);
-
-			/*
-			 * TODO
-			 * Mark a service as 'stopped' if no members in its
-			 * restricted fail-over domain are running.
-			 */
-		} else {
-			/* Send to the node if that ndoe is a better
-			   owner for this service */
-			consider_relocate(svcName, &svcStatus, nodeid,
-					  membership);
-		}
-
-	} while (!list_done(&_tree, node));
-
-	pthread_rwlock_unlock(&resource_lock);
-	free_member_list(membership);
-
-	logt_print(LOG_DEBUG, "Event (%d:%d:%d) Processed\n", local,
-	       (int)nodeid, nodeStatus);
-
-	return 0;
-}
-
-
-/**
- * Called to decide what services to start locally after a service event.
- * 
- * @see			eval_groups
- */
-int
-group_event(char __attribute__ ((unused)) *rg_name,
-	    uint32_t state,
-	    int __attribute__ ((unused)) owner)
-{
-	char svcName[64], *nodeName;
-	resource_node_t *node;
-	rg_state_t svcStatus;
-	cluster_member_list_t *membership;
-	int depend;
-
-	if (rg_locked()) {
-		logt_print(LOG_DEBUG,
-			"Resource groups locked; not evaluating\n");
-		return -EAGAIN;
-	}
-
-	membership = member_list();
-	if (!membership)
-		return -1;
-
-	pthread_rwlock_rdlock(&resource_lock);
-
-	/* Requires read lock */
-	count_resource_groups(membership);
-
-	list_do(&_tree, node) {
-
-		res_build_name(svcName, sizeof(svcName), node->rn_resource);
-
-		if (get_rg_state_local(svcName, &svcStatus) != 0)
-			continue;
-
-		if (svcStatus.rs_owner == 0)
-			nodeName = "none";
-		else
-			nodeName = memb_id_to_name(membership,
-						   svcStatus.rs_owner);
-
-		/* Disabled/failed/in recovery?  Do nothing */
-		if ((svcStatus.rs_state == RG_STATE_DISABLED) ||
-		    (svcStatus.rs_state == RG_STATE_FAILED) ||
-		    (svcStatus.rs_state == RG_STATE_RECOVER)) {
-			continue;
-		}
-
-		depend = check_depend(node->rn_resource);
-
-		/* Skip if we have no dependency */
-		if (depend == -1)
-			continue;
-
-		/*
-		   If we have:
-		   (a) a met dependency
-		   (b) we're in the STOPPED state, and
-		   (c) our new service event is a started service
-
-		   Then see if we should start this other service as well.
-		 */
-		if (depend == 1 &&
-		    svcStatus.rs_state == RG_STATE_STOPPED &&
-		    state == RG_STATE_STARTED) {
-
-			logt_print(LOG_DEBUG, "Evaluating RG %s, state %s, owner "
-			       "%s\n", svcName,
-			       rg_state_str(svcStatus.rs_state),
-			       nodeName);
-			consider_start(node, svcName, &svcStatus, membership);
-			continue;
-		}
-		
-		/*
-		   If we lost a dependency for this service and it's running
-		   locally, stop it.
-		 */
-		if (depend == 0 &&
-		    svcStatus.rs_state == RG_STATE_STARTED &&
-		    svcStatus.rs_owner == (uint32_t)my_id()) {
-
-			logt_print(LOG_WARNING, "Stopping service %s: Dependency missing\n",
-			       svcName);
-			rt_enqueue_request(svcName, RG_STOP, NULL, 0, my_id(),
-					   0, 0);
-		}
-
-	} while (!list_done(&_tree, node));
-
-	pthread_rwlock_unlock(&resource_lock);
-	free_member_list(membership);
-
-	return 0;
-}
-
-
-/**
-  Tells us if a resource group can be migrated.
- */
-int
-group_migratory(char *groupname, int lock)
-{
-	resource_node_t *rn;
-	resource_t *res;
-	int migrate = 0, x, ret = 0;
-
-	if (lock)
-		pthread_rwlock_rdlock(&resource_lock);
-
-	res = find_root_by_ref(&_resources, groupname);
-	if (!res) {
-		/* Nonexistent or non-TL RG cannot be migrated */
-		return 0;
-	}
-
-	for (x = 0; res->r_rule->rr_actions[x].ra_name; x++) {
-		if (!strcmp(res->r_rule->rr_actions[x].ra_name,
-		    "migrate")) {
-			migrate = 1;
-			break;
-		}
-	}
-
-	if (!migrate)
-		goto out_unlock;
-
-	list_do(&_tree, rn) {
-		if (rn->rn_resource == res && rn->rn_child) {
-			/* TL service w/ children cannot be migrated */
-			goto out_unlock;
-		}
-	} while (!list_done(&_tree, rn));
-
-
-	/* Ok, we have a migrate option to the resource group,
-	   the resource group has no children, and the resource
-	   group exists.  We're all good */
-	ret = 1;
-
-out_unlock:
-	if (lock)
-		pthread_rwlock_unlock(&resource_lock);
-	return ret;
-}
-
-
-
-/**
-   Perform an operation on a resource group.  That is, walk down the
-   tree for that resource group, performing the given operation on
-   all children in the necessary order.
-
-   XXX Needs to handle more return codes to be more OCF compliant
-
-   @param groupname	Resource group to operate on
-   @param op		Operation to perform
-   @return 		0 on success, 1 on failure/error.
- */
-int
-group_op(char *groupname, int op)
-{
-	resource_t *res;
-	int ret = -1;
-
-	pthread_rwlock_rdlock(&resource_lock);
-	/* XXX get group from somewhere else */
-	res = find_root_by_ref(&_resources, groupname);
-	if (!res) {
-		pthread_rwlock_unlock(&resource_lock);
-		return -1;
-	}
-
-	switch (op) {
-	case RG_START:
-		ret = res_start(&_tree, res, NULL);
-		break;
-	case RG_STOP:
-		ret = res_stop(&_tree, res, NULL);
-		break;
-	case RG_STATUS:
-		ret = res_status(&_tree, res, NULL);
-		break;
-	case RG_CONDSTOP:
-		ret = res_condstop(&_tree, res, NULL);
-		break;
-	case RG_CONDSTART:
-		ret = res_condstart(&_tree, res, NULL);
-		break;
-	}
-	pthread_rwlock_unlock(&resource_lock);
-
-#if 0
-	/*
-	   Do NOT return error codes if we failed to stop for one of these
-	   reasons.  It didn't start, either, so it's safe to assume that
-	   if the program wasn't installed, there's nothing to tear down.
-	 */
-	if (op == RG_STOP) {
-		switch(ret) {
-		case OCF_RA_SUCCESS:
-		case OCF_RA_NOT_INSTALLED:
-		case OCF_RA_NOT_CONFIGURED:
-			ret = 0;
-			break;
-		default:
-			ret = 1;
-			break;
-		}
-	}
-#endif
-
-	return ret;
-}
-
-
-int
-group_migrate(char *groupname, int target)
-{
-	resource_node_t *rn = NULL, *tmp;
-	resource_t *res;
-	char *tgt_name;
-	int ret = RG_ENOSERVICE;
-	cluster_member_list_t *membership;
-
-	if (target <= 0) {
-		logt_print(LOG_WARNING,
-		       "Illegal node ID %d during migrate operation\n",
-		       target);
-		return RG_EINVAL;
-	}
-
-	membership = member_list();
-	if (!membership) {
-		logt_print(LOG_ERR, "Unable to determine membership during "
-		       "migrate operation\n");
-		return RG_EFAIL;
-	}
-
-	pthread_rwlock_rdlock(&resource_lock);
-	
-	tgt_name = memb_id_to_name(membership, target);
-	if (!tgt_name) {
-		logt_print(LOG_WARNING, "Node ID %d not in membership during "
-		       "migrate operation\n", target);
-		ret = RG_EINVAL;
-		goto out;
-	}
-
-	res = find_root_by_ref(&_resources, groupname);
-	if (!res) {
-		logt_print(LOG_WARNING,
-		       "Unable to find '%s' in resource list during"
-		       "migrate operation\n", groupname);
-		goto out;
-	}
-
-	list_do(&_tree, tmp) {
-		if (tmp->rn_resource == res) {
-			rn = tmp;
-			break;
-		}
-	} while (!list_done(&_tree, tmp));
-
-	if (!rn) {
-		logt_print(LOG_WARNING,
-		       "Unable to find '%s' it top level of resource "
-		       "tree during migrate operation\n", groupname);
-		goto out;
-	}
-	
-	logt_print(LOG_NOTICE, "Migrating %s to %s\n", groupname, tgt_name);
-	ret = res_exec(rn, RS_MIGRATE, tgt_name, 0);
-	if (ret == 0) {
-		logt_print(LOG_NOTICE,
-		       "Migration of %s to %s completed\n",
-		       groupname, tgt_name);
-	} else {
-		logt_print(LOG_ERR, 
-		       "Migration of %s to %s failed; return code %d\n",
-		       groupname, tgt_name, ret);
-	}
-
-out:
-	pthread_rwlock_unlock(&resource_lock);
-	free_member_list(membership);
-	return ret;
-}
-
-
-/**
-   Gets an attribute of a resource group.
-
-   @param groupname	Name of group
-   @param property	Name of property to check for
-   @param ret		Preallocated return buffer
-   @param len		Length of buffer pointed to by ret
-   @return		0 on success, -1 on failure.
- */
-int
-_group_property(char *groupname, char *property, char *ret, size_t len)
-{
-	resource_t *res = NULL;
-	int x = 0;
-
-	res = find_root_by_ref(&_resources, groupname);
-	if (!res) {
-		return -1;
-	}
-
-	for (; res->r_attrs[x].ra_name; x++) {
-		if (strcasecmp(res->r_attrs[x].ra_name, property))
-			continue;
-		strncpy(ret, res->r_attrs[x].ra_value, len);
-		return 0;
-	}
-
-	return -1;
-}
-
-
-int
-group_property(char *groupname, char *property, char *ret_val, size_t len)
-{
-	int ret = -1;
-	pthread_rwlock_rdlock(&resource_lock);
-	ret = _group_property(groupname, property, ret_val, len);
-	pthread_rwlock_unlock(&resource_lock);
-	return ret;
-}
-	
-
-/**
-  Send the state of a resource group to a given file descriptor.
-
-  @param fd		File descriptor to send state to
-  @param rgname		Resource group name whose state we want to send.
-  @see send_rg_states
- */
-void
-send_rg_state(msgctx_t *ctx, char *rgname, int fast)
-{
-	rg_state_msg_t msg, *msgp = &msg;
-	struct dlm_lksb lockp;
-
-	msgp->rsm_hdr.gh_magic = GENERIC_HDR_MAGIC;
-	msgp->rsm_hdr.gh_length = sizeof(msg);
-	msgp->rsm_hdr.gh_command = RG_STATUS;
-
-	/* try fast read -- only if it fails and fast is not 
-	   specified should we do the full locked read */
-	if (get_rg_state_local(rgname, &msgp->rsm_state) != 0 &&
-	    !fast) {
-		if (rg_lock(rgname, &lockp) < 0)
-			return;
-		if (get_rg_state(rgname, &msgp->rsm_state) < 0) {
-			rg_unlock(&lockp);
-			return;
-		}
-		rg_unlock(&lockp);
-	}
-
-	swab_rg_state_msg_t(msgp);
-
-	if (msg_send(ctx, msgp, sizeof(msg)) < 0)
-		perror("msg_send");
-}
-
-
-/**
-  Send status from a thread because we don't want rgmanager's
-  main thread to block in the case of DLM issues
- */
-static void *
-status_check_thread(void *arg)
-{
-	msgctx_t *ctx = ((struct status_arg *)arg)->ctx;
-	int fast = ((struct status_arg *)arg)->fast;
-	resource_node_t *node;
-	generic_msg_hdr hdr;
-	char rg[64];
-
-	free(arg);
-
-	if (central_events_enabled()) {
-		/* Never call get_rg_state() (distributed) if 
-		   central events are enabled, otherwise we
-		   might overwrite the rg state with 'stopped' 
-		   when it should be 'disabled' (e.g. autostart="0") */
-		fast = 1;
-	}
-
-	/* See if we have a slot... */
-	if (rg_inc_status() < 0) {
-		/* Too many outstanding status checks.  try again later. */
-		msg_send_simple(ctx, RG_FAIL, RG_EAGAIN, 0);
-		msg_close(ctx);
-		msg_free_ctx(ctx);
-		pthread_exit(NULL);
-	}
-	
-	/*send_master_state(ctx);*/
-
-	pthread_rwlock_rdlock(&resource_lock);
-
-	list_do(&_tree, node) {
-
-		res_build_name(rg, sizeof(rg), node->rn_resource);
-		send_rg_state(ctx, rg, fast);
-	} while (!list_done(&_tree, node));
-
-	pthread_rwlock_unlock(&resource_lock);
-
-	msg_send_simple(ctx, RG_SUCCESS, 0, 0);
-
-	/* XXX wait for client to tell us it's done; I don't know why
-	   this is needed when doing fast I/O, but it is. */
-	msg_receive(ctx, &hdr, sizeof(hdr), 10);
-	msg_close(ctx);
-	msg_free_ctx(ctx);
-	
-	rg_dec_status();
-
-	pthread_exit(NULL);
-}
-
-
-/**
-  Send all resource group states to a file descriptor
-
-  @param fd		File descriptor to send states to.
-  @return		0
- */
-int
-send_rg_states(msgctx_t *ctx, int fast)
-{
-	struct status_arg *arg;
-	pthread_t newthread;
-	pthread_attr_t attrs;
-
-	arg = malloc(sizeof(struct status_arg));
-	if (!arg) {
-		msg_send_simple(ctx, RG_FAIL, 0, 0);
-		return -1;
-	}
-
-	arg->ctx = ctx;
-	arg->fast = fast;
-
-        pthread_attr_init(&attrs);
-        pthread_attr_setinheritsched(&attrs, PTHREAD_INHERIT_SCHED);
-        pthread_attr_setdetachstate(&attrs, PTHREAD_CREATE_DETACHED);
-	pthread_attr_setstacksize(&attrs, 65535);
-
-	pthread_create(&newthread, &attrs, status_check_thread, arg);
-        pthread_attr_destroy(&attrs);
-
-	return 0;
-}
-
-
-int
-svc_exists(char *svcname)
-{
-	resource_node_t *node;
-	int ret = 0;
-	char rg[64];
-
-	pthread_rwlock_rdlock(&resource_lock);
-
-	list_do(&_tree, node) {
-		res_build_name(rg, sizeof(rg), node->rn_resource);
-
-		if (strcmp(rg, svcname) == 0) {
-			ret = 1;
-			break;
-		}
-	} while (!list_done(&_tree, node));
-
-	pthread_rwlock_unlock(&resource_lock);
-
-	return ret;
-}
-
-
-void
-rg_doall(int request, int block, char __attribute__ ((unused)) *debugfmt)
-{
-	resource_node_t *curr;
-	rg_state_t svcblk;
-	char rg[64];
-
-	pthread_rwlock_rdlock(&resource_lock);
-	list_do(&_tree, curr) {
-
-		/* Group name */
-		res_build_name(rg, sizeof(rg), curr->rn_resource);
-
-		//if (debugfmt)
-			//logt_print(LOG_DEBUG, debugfmt, rg);
-
-		/* Optimization: Don't bother even queueing the request
-		   during the exit case if we don't own it */
-		if (request == RG_STOP_EXITING) {
-			if (get_rg_state_local(rg, &svcblk) < 0)
-				continue;
-
-			/* Always run stop if we're the owner, regardless
-			   of state; otherwise, don't run stop */
-			if (svcblk.rs_owner != (uint32_t)my_id())
-				continue;
-		}
-
-		rt_enqueue_request(rg, request, NULL, 0,
-				   0, 0, 0);
-	} while (!list_done(&_tree, curr));
-
-	pthread_rwlock_unlock(&resource_lock);
-
-	/* XXX during shutdown, if we're doing a simultaenous shutdown,
-	   this will cause this rgmanager to hang waiting for all the
-	   other rgmanagers to complete. */
-	if (block) 
-		rg_wait_threads();
-}
-
-
-/**
-  Stop changed resources.
- */
-void *
-q_status_checks(void __attribute__ ((unused)) *arg)
-{
-	resource_node_t *curr;
-	rg_state_t svcblk;
-	char rg[64];
-	struct dlm_lksb lockp;
-	
-	/* Only one status thread at a time, please! */
-	if (pthread_mutex_trylock(&status_mutex) != 0)
-		pthread_exit(NULL);
-
-	pthread_rwlock_rdlock(&resource_lock);
-	list_do(&_tree, curr) {
-
-		/* Group name */
-		res_build_name(rg, sizeof(rg), curr->rn_resource);
-
-		/* Local check - no one will make us take a service */
-		if (get_rg_state_local(rg, &svcblk) < 0) {
-			if (rg_lock(rg, &lockp) != 0)
-				continue;
-			if (get_rg_state(rg, &svcblk) < 0) {
-				rg_unlock(&lockp);
-				continue;
-			}
-			rg_unlock(&lockp);
-		}
-
-		if (svcblk.rs_owner != (uint32_t)my_id() ||
-		    (svcblk.rs_state != RG_STATE_STARTED &&
-		     svcblk.rs_state != RG_STATE_MIGRATE))
-			continue;
-
-		rt_enqueue_request(rg, RG_STATUS,
-				   NULL, 1, 0, 0, 0);
-
-	} while (!list_done(&_tree, curr));
-
-	pthread_rwlock_unlock(&resource_lock);
-	pthread_mutex_unlock(&status_mutex);
-
-	pthread_exit(NULL);
-}
-
-
-void
-do_status_checks(void)
-{
-	pthread_attr_t attrs;
-	pthread_t newthread;
-
-        pthread_attr_init(&attrs);
-        pthread_attr_setinheritsched(&attrs, PTHREAD_INHERIT_SCHED);
-        pthread_attr_setdetachstate(&attrs, PTHREAD_CREATE_DETACHED);
-	pthread_attr_setstacksize(&attrs, 65535);
-
-	pthread_create(&newthread, &attrs, q_status_checks, NULL);
-        pthread_attr_destroy(&attrs);
-}
-
-
-/**
-  Stop changed resources.
- */
-void
-do_condstops(void)
-{
-	resource_node_t *curr;
-	struct dlm_lksb lockp;
-	rg_state_t svcblk;
-	int need_kill;
-	char rg[64];
-
-	logt_print(LOG_INFO, "Stopping changed resources.\n");
-
-	pthread_rwlock_rdlock(&resource_lock);
-	list_do(&_tree, curr) {
-
-		/* Group name */
-		res_build_name(rg, sizeof(rg), curr->rn_resource);
-
-		/* If we're not running it, no need to CONDSTOP */
-		if (get_rg_state_local(rg, &svcblk) < 0) {
-			continue;
-		}
-
-		if (svcblk.rs_owner != (uint32_t)my_id())
-			continue;
-
-		/* Set state to uninitialized if we're killing a RG */
-		need_kill = 0;
-		if (curr->rn_resource->r_flags & RF_NEEDSTOP) {
-			need_kill = 1;
-			logt_print(LOG_DEBUG, "Removing %s\n", rg);
-		}
-
-		if (!curr->rn_child && ((curr->rn_resource->r_rule->rr_flags &
-		    RF_DESTROY) == 0) && group_migratory(rg, 0) &&
-		    need_kill == 1) {
-			/* Do something smart here: flip state? */
-			logt_print(LOG_NOTICE,
-			       "%s removed from the config, but I am not stopping it.\n",
-			       rg);
-			if (rg_lock(rg, &lockp) != 0)
-				continue;
-			if (get_rg_state(rg, &svcblk) < 0)
-		       		goto cont;
-			svcblk.rs_state = RG_STATE_DISABLED;
-			set_rg_state(rg, &svcblk);
-cont:
-			rg_unlock(&lockp);
-			continue;
-		}
-
-		rt_enqueue_request(rg, need_kill ? RG_DISABLE : RG_CONDSTOP,
-				   NULL, 0, 0, 0, 0);
-
-	} while (!list_done(&_tree, curr));
-
-	pthread_rwlock_unlock(&resource_lock);
-	rg_wait_threads();
-}
-
-
-/**
-  Start changed resources.
- */
-void
-do_condstarts(void)
-{
-	resource_node_t *curr;
-	char rg[64], *val;
-	rg_state_t svcblk;
-	int need_init, new_groups = 0, autostart;
-	struct dlm_lksb lockp;
-
-	logt_print(LOG_INFO, "Starting changed resources.\n");
-
-	/* Pass 1: Start any normally changed resources */
-	pthread_rwlock_rdlock(&resource_lock);
-	list_do(&_tree, curr) {
-
-		/* Group name */
-		res_build_name(rg, sizeof(rg), curr->rn_resource);
-
-		/* New RG.  We'll need to initialize it. */
-		need_init = 0;
-		if (!(curr->rn_resource->r_flags & RF_RECONFIG) &&
-		    (curr->rn_resource->r_flags & RF_NEEDSTART))
-			need_init = 1;
-
-		if (!need_init) {
-			if (get_rg_state_local(rg, &svcblk) < 0)
-				continue;
-		} else {
-			if (rg_lock(rg, &lockp) != 0)
-				continue;
-
-			if (get_rg_state(rg, &svcblk) < 0) {
-				rg_unlock(&lockp);
-				continue;
-			}
-
-			rg_unlock(&lockp);
-		}
-
-		if (!need_init && svcblk.rs_owner != (uint32_t)my_id())
-			continue;
-
-		if (need_init) {
-			++new_groups;
-			logt_print(LOG_NOTICE, "Initializing %s\n", rg);
-		}
-
-		if (!curr->rn_child && ((curr->rn_resource->r_rule->rr_flags &
-		    RF_INIT) == 0) && group_migratory(rg, 0) &&
-		    need_init == 1) {
-			/* Do something smart here? */
-			logt_print(LOG_NOTICE,
-			       "%s was added to the config, but I am not initializing it.\n",
-			       rg);
-			continue;
-		}
-
-		rt_enqueue_request(rg, need_init ? RG_INIT : RG_CONDSTART,
-				   NULL, 0, 0, 0, 0);
-
-	} while (!list_done(&_tree, curr));
-
-	pthread_rwlock_unlock(&resource_lock);
-	rg_wait_threads();
-
-	if (!new_groups)
-		return;
-
-	/* Pass 2: Tag all new resource groups as stopped */
-	pthread_rwlock_rdlock(&resource_lock);
-	list_do(&_tree, curr) {
-
-		/* Group name */
-		res_build_name(rg, sizeof(rg), curr->rn_resource);
-
-		/* New RG.  We'll need to initialize it. */
-		if (!(curr->rn_resource->r_flags & RF_NEEDSTART))
-			continue;
-
-		if (rg_lock(rg, &lockp) != 0)
-			continue;
-
-		if (get_rg_state(rg, &svcblk) < 0) {
-			rg_unlock(&lockp);
-			continue;
-		}
-
-		/* If it is a replacement of an old RG, it will
-		   be in the DISABLED state, which will prevent it
-		   from restarting.  That's bad.  However, if it's
-		   a truly new service, it will be in the UNINITIALIZED
-		   state, which will be caught by eval_groups. */
-		if (svcblk.rs_state != RG_STATE_DISABLED) {
-			rg_unlock(&lockp);
-			continue;
-		}
-
-		/* Set it up for an auto-start */
-		val = res_attr_value(curr->rn_resource, "autostart");
-		autostart = !(val && ((!strcmp(val, "no") ||
-				     (atoi(val)==0))));
-		if (autostart)
-			svcblk.rs_state = RG_STATE_STOPPED;
-		else
-			svcblk.rs_state = RG_STATE_DISABLED;
-
-		set_rg_state(rg, &svcblk);
-
-		rg_unlock(&lockp);
-
-	} while (!list_done(&_tree, curr));
-	pthread_rwlock_unlock(&resource_lock);
-
-	/* Pass 3: See if we should start new resource groups */
-	eval_groups(1, my_id(), 1);
-}
-
-
-void
-dump_config_version(FILE *fp)
-{
-	fprintf(fp, "Cluster configuration version %d\n\n", config_version);
-}
-
-
-/**
-  Initialize resource groups.  This reads all the resource groups from 
-  CCS, builds the tree, etc.  Ideally, we'll have a similar function 
-  performing deltas on the two trees so that we can fully support online
-  resource group modification.
- */
-int
-init_resource_groups(int reconfigure, int do_init)
-{
-	int fd, x, y, cnt;
-
-	event_table_t *evt = NULL;
-	resource_t *reslist = NULL, *res;
-	resource_rule_t *rulelist = NULL, *rule;
-	resource_node_t *tree = NULL;
-	fod_t *domains = NULL, *fod;
-	event_t *evp;
-	char *val;
-
-	if (reconfigure)
-		logt_print(LOG_NOTICE, "Reconfiguring\n");
-
-	logt_print(LOG_INFO, "Loading Service Data\n");
-	logt_print(LOG_DEBUG, "Loading Resource Rules\n");
-	if (load_resource_rules(RESOURCE_ROOTDIR, &rulelist) != 0) {
-		return -1;
-	}
-	x = 0;
-	list_do(&rulelist, rule) { ++x; } while (!list_done(&rulelist, rule));
-	logt_print(LOG_DEBUG, "%d rules loaded\n", x);
-
-       	fd = ccs_lock();
-	if (fd == -1) {
-		logt_print(LOG_CRIT, "#5: Couldn't connect to ccsd!\n");
-		return -1;
-	}
-
-	if (ccs_get(fd, "/cluster/@config_version", &val) == 0) {
-		pthread_mutex_lock(&config_mutex);
-		config_version = atoi(val);
-		pthread_mutex_unlock(&config_mutex);
-		free(val);
-	}
-	
-	if (ccs_get(fd, "/cluster/rm/@statusmax", &val) == 0) {
-		if (strlen(val)) 
-			rg_set_statusmax(atoi(val));
-		free(val);
-	}
-
-	/* Wait for any pending requests */
-	rg_wait_threads();
-	/* Block operations that would break during configuration
-	   changes */
-	rg_clear_initialized(FL_CONFIG);
-
-	logt_print(LOG_DEBUG, "Building Resource Trees\n");
-	/* About to update the entire resource tree... */
-	if (load_resources(fd, &reslist, &rulelist) != 0) {
-		logt_print(LOG_CRIT, "#6: Error loading services\n");
-		destroy_resources(&reslist);
-		destroy_resource_rules(&rulelist);
-		ccs_unlock(fd);
-		return -1;
-	}
-
-	if (build_resource_tree(fd, &tree, &rulelist, &reslist) != 0) {
-		logt_print(LOG_CRIT, "#7: Error building resource tree\n");
-		destroy_resource_tree(&tree);
-		destroy_resources(&reslist);
-		destroy_resource_rules(&rulelist);
-		ccs_unlock(fd);
-		return -1;
-	}
-
-	x = 0;
-	list_do(&reslist, res) { ++x; } while (!list_done(&reslist, res));
-	logt_print(LOG_DEBUG, "%d resources defined\n", x);
-
-	logt_print(LOG_DEBUG, "Loading Failover Domains\n");
-	construct_domains(fd, &domains);
-	x = 0;
-	list_do(&domains, fod) { ++x; } while (!list_done(&domains, fod));
-	logt_print(LOG_DEBUG, "%d domains defined\n", x);
-	construct_events(fd, &evt);
-	cnt = 0;
-	if (evt) {
-		for (x=0; x <= evt->max_prio; x++) {
-			if (!evt->entries[x])
-				continue;
-			
-			y = 0;
-
-			list_do(&evt->entries[x], evp) {
-				++y;
-			} while (!list_done(&evt->entries[x], evp));
-
-			cnt += y;
-		}
-	}
-	logt_print(LOG_DEBUG, "%d events defined\n", x);
-	
-
-	/* Reconfiguration done */
-	ccs_unlock(fd);
-
-	if (reconfigure) {
-		/* Calc tree deltas */
-		pthread_rwlock_wrlock(&resource_lock);
-		resource_delta(&_resources, &reslist);
-		resource_tree_delta(&_tree, &tree);
-		pthread_rwlock_unlock(&resource_lock);
-
-		do_condstops();
-	}
-
-	/* Swap in the new configuration */
-	pthread_rwlock_wrlock(&resource_lock);
-	if (_tree)
-		destroy_resource_tree(&_tree);
-	_tree = tree;
-	if (_resources)
-		destroy_resources(&_resources);
-	_resources = reslist;
-	if (_rules)
-		destroy_resource_rules(&_rules);
-	_rules = rulelist;
-	if (_domains)
-		deconstruct_domains(&_domains);
-	_domains = domains;
-	if (master_event_table)
-		deconstruct_events(&master_event_table);
-	master_event_table = evt;
-	pthread_rwlock_unlock(&resource_lock);
-
-	if (reconfigure) {
-		/* Switch to read lock and do the up-half of the
-		   reconfig request */
-		logt_print(LOG_INFO, "Restarting changed resources.\n");
-		do_condstarts();
-	} else {
-		if (do_init) {
-			/* Do initial stop-before-start */
-			logt_print(LOG_INFO, "Initializing Services\n");
-			rg_doall(RG_INIT, 1, "Initializing %s\n");
-			logt_print(LOG_INFO, "Services Initialized\n");
-		} else {
-			logt_print(LOG_INFO, "Skipping stop-before-start: overridden by administrator\n");
-		}
-		rg_set_initialized(FL_INIT);
-	}
-	rg_set_initialized(FL_CONFIG);
-
-	return 0;
-}
-
-
-void
-get_recovery_policy(char *rg_name, char *buf, size_t buflen)
-{
-	resource_t *res;
-	char *val;
-
-	pthread_rwlock_rdlock(&resource_lock);
-
-	strncpy(buf, "restart", buflen);
-	res = find_root_by_ref(&_resources, rg_name);
-	if (res) {
-		val = res_attr_value(res, "recovery");
-		if (val) {
-			strncpy(buf, val, buflen);
-		}
-	}
-
-	pthread_rwlock_unlock(&resource_lock);
-}
-
-
-int
-get_service_property(char *rg_name, char *prop, char *buf, size_t buflen)
-{
-	int ret = 0;
-	resource_t *res;
-	char *val;
-
-	memset(buf, 0, buflen);
-
-#if 0
-	if (!strcmp(prop, "domain")) {
-		/* not needed */
-		strncpy(buf, "", buflen);
-	} else if (!strcmp(prop, "autostart")) {
-		strncpy(buf, "1", buflen);
-	} else if (!strcmp(prop, "hardrecovery")) {
-		strncpy(buf, "0", buflen);
-	} else if (!strcmp(prop, "exclusive")) {
-		strncpy(buf, "0", buflen);
-	} else if (!strcmp(prop, "nfslock")) {
-		strncpy(buf, "0", buflen);
-	} else if (!strcmp(prop, "recovery")) {
-		strncpy(buf, "restart", buflen);
-	} else if (!strcmp(prop, "depend")) {
-		/* not needed */
-		strncpy(buf, "", buflen);
-	} else {
-		/* not found / no defaults */
-		ret = -1;
-	}
-#endif
-
-	pthread_rwlock_rdlock(&resource_lock);
-	res = find_root_by_ref(&_resources, rg_name);
-	if (res) {
-		val = res_attr_value(res, prop);
-		if (val) {
-			ret = 0;
-			strncpy(buf, val, buflen);
-		}
-	}
-	pthread_rwlock_unlock(&resource_lock);
-
-#if 0
-	if (ret == 0)
-		printf("%s(%s, %s) = %s\n", __FUNCTION__, rg_name, prop, buf);
-	else 
-		printf("%s(%s, %s) = NOT FOUND\n", __FUNCTION__, rg_name, prop);
-#endif
-
-	return ret;
-}
-
-
-int
-check_restart(char *rg_name)
-{
-	resource_node_t *node;
-	int ret = 1;
-
-	pthread_rwlock_rdlock(&resource_lock);
-	node = node_by_ref(&_tree, rg_name);
-	if (node) {
-		ret = restart_add(node->rn_restart_counter);
-		if (ret) {
-			/* Clear it out - caller is about 
-			   to relocate the service anyway */
-			restart_clear(node->rn_restart_counter);
-		}
-	}
-	pthread_rwlock_unlock(&resource_lock);
-
-	return ret;
-}
-
-
-void
-kill_resource_groups(void)
-{
-	pthread_rwlock_wrlock(&resource_lock);
-
-	destroy_resource_tree(&_tree);
-	destroy_resources(&_resources);
-	destroy_resource_rules(&_rules);
-	deconstruct_domains(&_domains);
-
-	pthread_rwlock_unlock(&resource_lock);
-}
diff --git a/rgmanager/src/daemons/main.c b/rgmanager/src/daemons/main.c
deleted file mode 100644
index 6a1fe0a..0000000
--- a/rgmanager/src/daemons/main.c
+++ /dev/null
@@ -1,1110 +0,0 @@
-#include <message.h>
-#include <platform.h>
-#include <ccs.h>
-#include <stdio.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <rg_locks.h>
-#include <fcntl.h>
-#include <resgroup.h>
-#include <logging.h>
-#include <members.h>
-#include <msgsimple.h>
-#include <vf.h>
-#include <lock.h>
-#include <rg_queue.h>
-#include <malloc.h>
-#include <cman-private.h>
-#include <event.h>
-#include <members.h>
-
-#define L_SHUTDOWN (1<<2)
-#define L_SYS (1<<1)
-#define L_USER (1<<0)
-
-#ifdef WRAP_THREADS
-void dump_thread_states(FILE *);
-#endif
-int configure_rgmanager(int ccsfd, int debug);
-void set_transition_throttling(int);
-
-void node_event(int, int, int, int);
-void node_event_q(int, int, int, int);
-int daemon_init(char *);
-void kill_resource_groups(void);
-void set_my_id(int);
-void flag_shutdown(int sig);
-void hard_exit(void);
-int send_rg_states(msgctx_t *, int);
-int svc_exists(char *);
-int watchdog_init(void);
-int32_t master_event_callback(char *key, uint64_t viewno, void *data, uint32_t datalen);
-
-int node_has_fencing(int nodeid);
-int fence_domain_joined(void);
-
-int shutdown_pending = 0, running = 1, need_reconfigure = 0;
-char debug = 0; /* XXX* */
-static int signalled = 0;
-static uint8_t ALIGNED port = RG_PORT;
-static char *rgmanager_lsname = "rgmanager"; /* XXX default */
-static int status_poll_interval = DEFAULT_CHECK_INTERVAL;
-
-int next_node_id(cluster_member_list_t *membership, int me);
-void malloc_dump_table(FILE *, size_t, size_t);
-
-void
-segfault(int __attribute__ ((unused)) sig)
-{
-	char ow[64];
-	int err; // dumb error checking... will be replaced by logsys
-
-	snprintf(ow, sizeof(ow)-1, "PID %d Thread %d: SIGSEGV\n", getpid(),
-		 gettid());
-	err = write(2, ow, strlen(ow));
-	while(1)
-		sleep(60);
-}
-
-
-int
-send_exit_msg(msgctx_t *ctx)
-{
-	msg_send_simple(ctx, RG_EXITING, my_id(), 0);
-
-	return 0;
-}
-
-
-void
-send_node_states(msgctx_t *ctx)
-{
-	int x;
-	event_master_t master;
-	generic_msg_hdr hdr;
-	cluster_member_list_t *ml = member_list();
-
-	master.m_nodeid = 0;
-	event_master_info_cached(&master);
-
-	for (x = 0; x < ml->cml_count; x++) {
-		if (ml->cml_members[x].cn_member == 1) {
-			msg_send_simple(ctx, RG_STATUS_NODE,
-					ml->cml_members[x].cn_nodeid, 
-					(ml->cml_members[x].cn_nodeid &&
-					 (ml->cml_members[x].cn_nodeid == 
-					  (int)master.m_nodeid)));
-		}
-	}
-	msg_send_simple(ctx, RG_SUCCESS, 0, 0);
-	msg_receive(ctx, &hdr, sizeof(hdr), 10);
-	free_member_list(ml);
-}
-
-
-void
-flag_reconfigure(int __attribute__ ((unused)) sig)
-{
-	need_reconfigure++;
-}
-
-
-/**
-  This updates our local membership view and handles whether or not we
-  should exit, as well as determines node transitions (thus, calling
-  node_event()).
- 
-  @see				node_event
-  @return			0
- */
-int
-membership_update(void)
-{
-	cluster_member_list_t *new_ml = NULL, *node_delta = NULL,
-			      *old_membership = NULL;
-	int		x;
-	int		me = 0;
-	cman_handle_t 	h;
-	int 		quorate;
-
-	h = cman_init(NULL);
-	quorate = cman_is_quorate(h);
-	if (!quorate) {
-		cman_finish(h);
-
-		if (!rg_quorate())
-			return -1;
-
-		logt_print(LOG_EMERG, "#1: Quorum Dissolved\n");
-		rg_set_inquorate();
-		member_list_update(NULL);/* Clear member list */
-		rg_lockall(L_SYS);
-		rg_doall(RG_INIT, 1, "Emergency stop of %s\n");
-#ifndef USE_OPENAIS
-		logt_print(LOG_DEBUG, "Invalidating local VF cache\n");
-		vf_invalidate();
-#endif
-		logt_print(LOG_DEBUG, "Flushing resource group cache\n");
-		kill_resource_groups();
-		rg_clear_initialized(0);
-		return -1;
-	} else if (!rg_quorate()) {
-
-		rg_set_quorate();
-		rg_unlockall(L_SYS);
-		rg_unlockall(L_USER);
-		logt_print(LOG_NOTICE, "Quorum Regained\n");
-	}
-
-	old_membership = member_list();
-	new_ml = get_member_list(h);
-	memb_mark_down(new_ml, 0);
-
-	for(x=0; new_ml && x<new_ml->cml_count;x++) {
-		if (new_ml->cml_members[x].cn_nodeid == 0) {
-		    new_ml->cml_members[x].cn_member = 0;
-		}
-	}
-
-	for (x = 0; new_ml && x < new_ml->cml_count; x++) {
-
-		if (new_ml->cml_members[x].cn_member == 0) {
-			printf("skipping %d - node not member\n",
-			       new_ml->cml_members[x].cn_nodeid);
-			continue;
-		}
-		if (new_ml->cml_members[x].cn_nodeid == my_id())
-			continue;
-
-#ifdef DEBUG
-		printf("Checking for listening status of %d\n",
-		       new_ml->cml_members[x].cn_nodeid);
-#endif
-
-		do {
-			quorate = cman_is_listening(h,
-					new_ml->cml_members[x].cn_nodeid,
-					port);
-
-			if (quorate == 0) {
-				logt_print(LOG_DEBUG, "Node %d is not listening\n",
-					new_ml->cml_members[x].cn_nodeid);
-				new_ml->cml_members[x].cn_member = 0;
-				break;
-			} else if (quorate < 0) {
-				if (errno == ENOTCONN) {
-					new_ml->cml_members[x].cn_member = 0;
-					break;
-				}
-				perror("cman_is_listening");
-				usleep(50000);
-				continue;
-			}
-#ifdef DEBUG
-		       	else {
-				printf("Node %d IS listening\n",
-				       new_ml->cml_members[x].cn_nodeid);
-			}
-#endif
-			break;
-		} while(1);
-	}
-
-	cman_finish(h);
-	member_list_update(new_ml);
-
-	/*
-	 * Handle nodes lost.  Do our local node event first.
-	 */
-	node_delta = memb_lost(old_membership, new_ml);
-
-	me = memb_online(node_delta, my_id());
-	if (me) {
-		/* Should not happen */
-		logt_print(LOG_INFO, "State change: LOCAL OFFLINE\n");
-		if (node_delta)
-			free_member_list(node_delta);
-		node_event(1, my_id(), 0, 0);
-		/* NOTREACHED */
-	}
-
-	for (x=0; node_delta && x < node_delta->cml_count; x++) {
-
-		logt_print(LOG_INFO, "State change: %s DOWN\n",
-		       node_delta->cml_members[x].cn_name);
-		/* Don't bother evaluating anything resource groups are
-		   locked.  This is just a performance thing */
-		if (!rg_locked()) {
-			node_event_q(0, node_delta->cml_members[x].cn_nodeid,
-				     0, 0);
-		} else {
-			logt_print(LOG_DEBUG, "Not taking action - services"
-			       " locked\n");
-		}
-	}
-
-	free_member_list(node_delta);
-
-	/*
-	 * Handle nodes gained.  Do our local node event first.
-	 */
-	node_delta = memb_gained(old_membership, new_ml);
-
-	me = memb_online(node_delta, my_id());
-	if (me) {
-		logt_print(LOG_INFO, "State change: Local UP\n");
-		node_event_q(1, my_id(), 1, 1);
-	}
-
-	for (x=0; node_delta && x < node_delta->cml_count; x++) {
-
-		if (!node_delta->cml_members[x].cn_member)
-			continue;
-
-		if (node_delta->cml_members[x].cn_nodeid == my_id())
-			continue;
-
-		logt_print(LOG_INFO, "State change: %s UP\n",
-		       node_delta->cml_members[x].cn_name);
-		node_event_q(0, node_delta->cml_members[x].cn_nodeid, 1, 1);
-	}
-
-	free_member_list(node_delta);
-	free_member_list(new_ml);
-	free_member_list(old_membership);
-
-	rg_unlockall(L_SYS);
-
-	return 0;
-}
-
-
-int
-lock_commit_cb(char __attribute__ ((unused)) *key,
-	       uint64_t __attribute__ ((unused)) viewno,
-	       void *data, uint32_t datalen)
-{
-	char lockstate;
-
-	if (datalen != 1) {
-		logt_print(LOG_WARNING, "%s: invalid data length!\n", __FUNCTION__);
-		free(data);
-		return 0;
-	}
-
-       	lockstate = *(char *)data;
-	free(data);
-
-	if (lockstate == 0) {
-		rg_unlockall(L_USER); /* Doing this multiple times
-					 has no effect */
-		logt_print(LOG_NOTICE, "Resource Groups Unlocked\n");
-		return 0;
-	}
-
-	if (lockstate == 1) {
-		rg_lockall(L_USER); /* Doing this multiple times
-				       has no effect */
-		logt_print(LOG_NOTICE, "Resource Groups Locked\n");
-		return 0;
-	}
-
-	logt_print(LOG_DEBUG, "Invalid lock state in callback: %d\n", lockstate);
-	return 0;
-}
-
-
-#if 0
-struct lr_arg {
-	msgctx_t *ctx;
-	int req;
-};
-
-
-void *
-lockreq_th(void *a)
-{
-	int ret;
-	char state;
-	struct lr_arg *lr_arg = (struct lr_arg *)a;
-	cluster_member_list_t *m = member_list();
-
-	state = (lr_arg->req==RG_LOCK)?1:0;
-	ret = vf_write(m, VFF_IGN_CONN_ERRORS, "rg_lockdown", &state, 1);
-	free_member_list(m);
-
-	if (ret == 0) {
-		msg_send_simple(lr_arg->ctx, RG_SUCCESS, 0, 0);
-	} else {
-		msg_send_simple(lr_arg->ctx, RG_FAIL, 0, 0);
-	}
-
-	msg_close(lr_arg->ctx);
-	msg_free_ctx(lr_arg->ctx);
-	free(lr_arg);
-	return NULL;
-}
-
-
-void
-do_lockreq(msgctx_t *ctx, int req)
-{
-	pthread_t th;
-	struct lr_arg *arg;
-
-	arg = malloc(sizeof(*arg));
-	if (!arg) {
-		msg_send_simple(ctx, RG_FAIL, 0, 0);
-		msg_close(ctx);
-		msg_free_ctx(ctx);
-		return 0;
-	}
-
-	arg->ctx = ctx;
-	arg->req = req;
-
-	pthread_create(&th, NULL, lockreq_th, (void *)arg);
-}
-#else
-void 
-do_lockreq(msgctx_t *ctx, int req)
-{
-	int ret;
-	char state;
-#ifdef OPENAIS
-	msgctx_t everyone;
-#else
-	cluster_member_list_t *m = member_list();
-#endif
-
-	state = (req==RG_LOCK)?1:0;
-
-#ifdef OPENAIS
-	ret = ds_write("rg_lockdown", &state, 1);
-	logt_print(LOG_INFO, "FIXME: send RG_LOCK update to all!\n");
-#else
-	ret = vf_write(m, VFF_IGN_CONN_ERRORS, "rg_lockdown", &state, 1);
-	free_member_list(m);
-#endif
-
-	if (ret == 0) {
-		msg_send_simple(ctx, RG_SUCCESS, 0, 0);
-	} else {
-		msg_send_simple(ctx, RG_FAIL, 0, 0);
-	}
-}
-#endif
-
-
-
-/**
- * Receive and process a message on a file descriptor and decide what to
- * do with it.  This function doesn't handle messages from the quorum daemon.
- *
- * @param fd		File descriptor with a waiting message.S
- * @return		-1 - failed to receive/handle message, or invalid
- *			data received.  0 - handled message successfully.
- * @see			quorum_msg
- */
-int
-dispatch_msg(msgctx_t *ctx, int nodeid, int need_close)
-{
-	int ret = 0, sz = -1, nid;
-	char msgbuf[4096];
-	generic_msg_hdr	*msg_hdr = (generic_msg_hdr *)msgbuf;
-	SmMessageSt	*msg_sm = (SmMessageSt *)msgbuf;
-
-	memset(msgbuf, 0, sizeof(msgbuf));
-
-	/* Peek-a-boo */
-	sz = msg_receive(ctx, msg_hdr, sizeof(msgbuf), 1);
-	if (sz < (int)sizeof (generic_msg_hdr)) {
-		logt_print(LOG_ERR,
-		       "#37: Error receiving header from %d sz=%d CTX %p\n",
-		       nodeid, sz, ctx);
-		goto out;
-	}
-
-	if (sz < 0)
-		return -1;
-
-	if (sz > (int)sizeof(msgbuf)) {
-		raise(SIGSTOP);
-	}
-
-	/*
-	printf("RECEIVED %d %d %d %p\n", sz, (int)sizeof(msgbuf),
-	       (int)sizeof(generic_msg_hdr), ctx);
-	msg_print(ctx);
-	 */
-
-	/* Decode the header */
-	swab_generic_msg_hdr(msg_hdr);
-	if ((msg_hdr->gh_magic != GENERIC_HDR_MAGIC)) {
-		logt_print(LOG_ERR,
-		       "#38: Invalid magic: Wanted 0x%08x, got 0x%08x\n",
-		       GENERIC_HDR_MAGIC, msg_hdr->gh_magic);
-		goto out;
-	}
-
-	if ((int)msg_hdr->gh_length != sz) {
-		logt_print(LOG_ERR, "#XX: Read size mismatch: %d %d\n",
-		       ret, msg_hdr->gh_length);
-		goto out;
-	}
-
-	switch (msg_hdr->gh_command) {
-	case RG_STATUS:
-		//logt_print(LOG_DEBUG, "Sending service states to CTX%p\n",ctx);
-		if (send_rg_states(ctx, msg_hdr->gh_arg1) == 0)
-			need_close = 0;
-		break;
-
-	case RG_STATUS_NODE:
-		//log_printf(LOG_DEBUG, "Sending node states to CTX%p\n",ctx);
-		send_node_states(ctx);
-		break;
-
-	case RG_LOCK:
-	case RG_UNLOCK:
-		if (rg_quorate())
-			do_lockreq(ctx, msg_hdr->gh_command);
-		break;
-
-	case RG_QUERY_LOCK:
-		if (rg_quorate()) {
-			ret = (rg_locked() & L_USER) ? RG_LOCK : RG_UNLOCK;
-			msg_send_simple(ctx, ret, 0, 0);
-		}
-		break;
-
-	case RG_ACTION_REQUEST:
-
-		if (sz < (int)sizeof(msg_sm)) {
-			logt_print(LOG_ERR,
-			       "#39: Error receiving entire request (%d/%d)\n",
-			       ret, (int)sizeof(msg_sm));
-			ret = -1;
-			goto out;
-		}
-
-		/* XXX perf: reencode header */
-		swab_generic_msg_hdr(msg_hdr);
-		/* Decode SmMessageSt message */
-		swab_SmMessageSt(msg_sm);
-
-		if (!svc_exists(msg_sm->sm_data.d_svcName)) {
-			msg_sm->sm_data.d_ret = RG_ENOSERVICE;
-			/* No such service! */
-			swab_SmMessageSt(msg_sm);
-
-			if (msg_send(ctx, msg_sm, sizeof (SmMessageSt)) <
-		    	    (int)sizeof (SmMessageSt))
-				logt_print(LOG_ERR, "#40: Error replying to "
-				       "action request.\n");
-			ret = -1;
-			goto out;
-		}
-
-		if (central_events_enabled() &&
-		    msg_sm->sm_hdr.gh_arg1 != RG_ACTION_MASTER) {
-			
-			/* Centralized processing or request is from
-			   clusvcadm */
-			nid = event_master();
-			if (nid != my_id()) {
-				/* Forward the message to the event master */
-				forward_message(ctx, msg_sm, nid);
-			} else {
-				/* for us: queue it */
-				user_event_q(msg_sm->sm_data.d_svcName,
-					     msg_sm->sm_data.d_action,
-					     msg_sm->sm_hdr.gh_arg1,
-					     msg_sm->sm_hdr.gh_arg2,
-					     msg_sm->sm_data.d_svcOwner,
-					     ctx);
-			}
-
-			return 0;
-		}
-
-		/* Distributed processing and/or request is from master node
-		   -- Queue request */
-		rt_enqueue_request(msg_sm->sm_data.d_svcName,
-		  		   msg_sm->sm_data.d_action,
-		  		   ctx, 0, msg_sm->sm_data.d_svcOwner,
-		  		   msg_sm->sm_hdr.gh_arg1,
-		  		   msg_sm->sm_hdr.gh_arg2);
-		return 0;
-
-	case RG_EVENT:
-		/* Service event.  Run a dependency check */
-		if (sz < (int)sizeof(msg_sm)) {
-			logt_print(LOG_ERR,
-			       "#39: Error receiving entire request (%d/%d)\n",
-			       ret, (int)sizeof(msg_sm));
-			ret = -1;
-			goto out;
-		}
-
-		/* XXX perf: reencode header */
-		swab_generic_msg_hdr(msg_hdr);
-		/* Decode SmMessageSt message */
-		swab_SmMessageSt(msg_sm);
-
-		/* Send to our rg event handler */
-		rg_event_q(msg_sm->sm_data.d_svcName,
-			   msg_sm->sm_data.d_action,
-			   msg_sm->sm_hdr.gh_arg1,
-			   msg_sm->sm_hdr.gh_arg2);
-		break;
-
-	case RG_EXITING:
-		if (!member_online(msg_hdr->gh_arg1))
-			break;
-
-		logt_print(LOG_NOTICE, "Member %d shutting down\n",
-		       msg_hdr->gh_arg1);
-	       	member_set_state(msg_hdr->gh_arg1, 0);
-		node_event_q(0, msg_hdr->gh_arg1, 0, 1);
-		break;
-
-	case VF_MESSAGE:
-		/* Ignore; our VF thread handles these
-		    - except for VF_CURRENT XXX (bad design) */
-		if (msg_hdr->gh_arg1 == VF_CURRENT)
-			vf_process_msg(ctx, 0, msg_hdr, sz);
-		break;
-
-	default:
-		logt_print(LOG_DEBUG, "unhandled message request %d\n",
-		       msg_hdr->gh_command);
-		break;
-	}
-out:
-	if (need_close) {
-		msg_close(ctx);
-		msg_free_ctx(ctx);
-	}
-	return ret;
-}
-
-/**
-  Grab an event off of the designated context
-
-  @param fd		File descriptor to check
-  @return		Event
- */
-int
-handle_cluster_event(msgctx_t *ctx)
-{
-	int ret;
-	msgctx_t *newctx;
-	int nodeid;
-	
-	ret = msg_wait(ctx, 0);
-
-	switch(ret) {
-	case M_PORTOPENED:
-		msg_receive(ctx, NULL, 0, 0);
-		logt_print(LOG_DEBUG, "Event: Port Opened\n");
-		membership_update();
-		break;
-	case M_PORTCLOSED:
-		/* Might want to handle powerclosed like membership change */
-		msg_receive(ctx, NULL, 0, 0);
-		logt_print(LOG_DEBUG, "Event: Port Closed\n");
-		membership_update();
-		break;
-	case M_NONE:
-		msg_receive(ctx, NULL, 0, 0);
-		logt_print(LOG_DEBUG, "NULL cluster message\n");
-		break;
-	case M_OPEN:
-		newctx = msg_new_ctx();
-		if (msg_accept(ctx, newctx) >= 0 &&
-		    rg_quorate()) {
-			/* Handle message */
-			/* When request completes, the fd is closed */
-			nodeid = msg_get_nodeid(newctx);
-			dispatch_msg(newctx, nodeid, 1);
-			break;
-		}
-		break;
-
-	case M_DATA:
-		nodeid = msg_get_nodeid(ctx);
-		dispatch_msg(ctx, nodeid, 0);
-		break;
-		
-	case M_OPEN_ACK:
-	case M_CLOSE:
-		logt_print(LOG_DEBUG, "I should NOT get here: %d\n",
-		       ret);
-		break;
-	case M_STATECHANGE:
-		msg_receive(ctx, NULL, 0, 0);
-		logt_print(LOG_DEBUG, "Membership Change Event\n");
-		if (running) {
-			rg_unlockall(L_SYS);
-			membership_update();
-		}
-		break;
-	case M_TRY_SHUTDOWN:
-		msg_receive(ctx, NULL, 0, 0);
-		logt_print(LOG_WARNING, "#67: Shutting down uncleanly\n");
-		rg_set_inquorate();
-		rg_doall(RG_INIT, 1, "Emergency stop of %s");
-		rg_clear_initialized(0);
-#if defined(LIBCMAN_VERSION) && LIBCMAN_VERSION >= 2
-		/* cman_replyto_shutdown() */
-#endif
-		running = 0;
-		break;
-	case M_CONFIG_UPDATE:
-		msg_receive(ctx, NULL, 0, 0);
-		need_reconfigure = 1;
-		break;
-	}
-
-	return ret;
-}
-
-
-void dump_threads(FILE *fp);
-void dump_config_version(FILE *fp);
-void dump_vf_states(FILE *fp);
-void dump_cluster_ctx(FILE *fp);
-
-void
-dump_internal_state(char *loc)
-{
-	FILE *fp;
-	fp=fopen(loc, "w+");
- 	dump_config_version(fp);
- 	dump_threads(fp);
- 	dump_vf_states(fp);
-#ifdef WRAP_THREADS
-	dump_thread_states(fp);
-#endif
-	dump_cluster_ctx(fp);
-	//malloc_dump_table(fp, 1, 16384); /* Only works if alloc.c us used */
- 	fclose(fp);
-}
-
-int
-event_loop(msgctx_t *localctx, msgctx_t *clusterctx)
-{
- 	int n = 0, max, ret;
-	fd_set rfds;
-	msgctx_t *newctx;
-	struct timeval tv;
-	int nodeid;
-
-	tv.tv_sec = status_poll_interval;
-	tv.tv_usec = 0;
-
-	if (signalled) {
-		signalled = 0;
-
-		dump_internal_state("/var/lib/cluster/rgmanager-dump");
-	}
-
-	while (running && (tv.tv_sec || tv.tv_usec)) {
-		FD_ZERO(&rfds);
-		max = -1;
-		msg_fd_set(clusterctx, &rfds, &max);
-		msg_fd_set(localctx, &rfds, &max);
-
-		n = select(max + 1, &rfds, NULL, NULL, &tv);
-
-		if (n <= 0)
-			break;
-
-		if (msg_fd_isset(clusterctx, &rfds)) {
-			msg_fd_clr(clusterctx, &rfds);
-			handle_cluster_event(clusterctx);
-			if (need_reconfigure)
-				break;
-			continue;
-		}
-
-		if (!msg_fd_isset(localctx, &rfds)) {
-			continue;
-		}
-
-		msg_fd_clr(localctx, &rfds);
-		newctx = msg_new_ctx();
-		ret = msg_accept(localctx, newctx);
-
-		if (ret == -1)
-			continue;
-
-		if (rg_quorate()) {
-			/* Handle message */
-			/* When request completes, the fd is closed */
-			nodeid = msg_get_nodeid(newctx);
-			dispatch_msg(newctx, nodeid, 1);
-			continue;
-		}
-			
-		if (!rg_initialized()) {
-			msg_send_simple(newctx, RG_FAIL, RG_EQUORUM, 0);
-			msg_close(newctx);
-			msg_free_ctx(newctx);
-			continue;
-		}
-
-		if (!rg_quorate()) {
-			printf("Dropping connect: NO QUORUM\n");
-			msg_send_simple(newctx, RG_FAIL, RG_EQUORUM, 0);
-			msg_close(newctx);
-			msg_free_ctx(newctx);
-		}
-	}
-
-	if (!running)
-		return 0;
-
-	if (need_reconfigure) {
-		need_reconfigure = 0;
-		configure_rgmanager(-1, 0);
-		config_event_q();
-		return 0;
-	}
-
-	/* Did we receive a SIGTERM? */
-	if (n < 0)
-		return 0;
-
-	/* No new messages.  Drop in the status check requests.  */
-	if (n == 0 && rg_quorate()) {
-		do_status_checks();
-		return 0;
-	}
-
-	return 0;
-}
-
-
-void
-flag_shutdown(int __attribute__ ((unused)) sig)
-{
-	shutdown_pending = 1;
-}
-
-
-void
-hard_exit(void)
-{
-	rg_lockall(L_SYS);
-	rg_doall(RG_INIT, 1, "Emergency stop of %s");
-	//vf_shutdown();
-	exit(1);
-}
-
-
-void
-cleanup(msgctx_t *clusterctx)
-{
-	kill_resource_groups();
-	send_exit_msg(clusterctx);
-}
-
-
-
-void
-statedump(int __attribute__ ((unused)) sig)
-{
-	signalled++;
-}
-
-
-void malloc_dump_table(FILE *, size_t, size_t);
-
-
-/*
- * Configure logging based on data in cluster.conf
- */
-int
-configure_rgmanager(int ccsfd, int dbg)
-{
-	char *v;
-	char internal = 0;
-
-	if (ccsfd < 0) {
-		internal = 1;
-		ccsfd = ccs_connect();
-		if (ccsfd < 0)
-			return -1;
-	}
-
-	setup_logging(ccsfd);
-
-	if (ccs_get(ccsfd, "/cluster/rm/@transition_throttling", &v) == 0) {
-		set_transition_throttling(atoi(v));
-		free(v);
-	}
-
-	if (ccs_get(ccsfd, "/cluster/rm/@central_processing", &v) == 0) {
-		set_central_events(atoi(v));
-		if (atoi(v))
-			logt_print(LOG_NOTICE,
-			       "Centralized Event Processing enabled\n");
-		free(v);
-	}
-
-	if (ccs_get(ccsfd, "/cluster/rm/@status_poll_interval", &v) == 0) {
-		status_poll_interval = atoi(v);
-		if (status_poll_interval >= 1) {
-			logt_print(LOG_NOTICE,
-			       "Status Polling Interval set to %d\n",
-			       status_poll_interval);
-		} else {
-			logt_print(LOG_WARNING, "Ignoring illegal "
-			       "status_poll_interval of %s\n", v);
-			status_poll_interval = 10;
-		}
-		
-		free(v);
-	}
-
-
-	if (internal)
-		ccs_disconnect(ccsfd);
-
-	return 0;
-}
-
-
-void
-clu_initialize(cman_handle_t *ch)
-{
-	if (!ch)
-		exit(1);
-
-	*ch = cman_init(NULL);
-	if (!(*ch)) {
-		logt_print(LOG_NOTICE, "Waiting for CMAN to start\n");
-
-		while (!(*ch = cman_init(NULL))) {
-			sleep(1);
-		}
-	}
-
-        if (!cman_is_quorate(*ch)) {
-		/*
-		   There are two ways to do this; this happens to be the simpler
-		   of the two.  The other method is to join with a NULL group 
-		   and log in -- this will cause the plugin to not select any
-		   node group (if any exist).
-		 */
-		logt_print(LOG_NOTICE, "Waiting for quorum to form\n");
-
-		while (cman_is_quorate(*ch) == 0) {
-			sleep(1);
-		}
-		logt_print(LOG_NOTICE, "Quorum formed\n");
-	}
-
-}
-
-
-void
-wait_for_fencing(void)
-{
-        if (node_has_fencing(my_id()) && !fence_domain_joined()) {
-		logt_print(LOG_INFO, "Waiting for fence domain join operation "
-		       "to complete\n");
-
-		while (fence_domain_joined() == 0)
-			sleep(1);
-		logt_print(LOG_INFO, "Fence domain joined\n");
-	} else {
-		logt_print(LOG_DEBUG, "Fence domain already joined "
-		       "or no fencing configured\n");
-	}
-}
-
-
-void
-set_nonblock(int fd)
-{
-       int flags;
-
-       flags = fcntl(fd, F_GETFL, 0);
-       fcntl(fd, F_SETFL, flags | O_NONBLOCK);
-}
-
-
-void *
-shutdown_thread(void __attribute__ ((unused)) *arg)
-{
-	rg_lockall(L_SYS|L_SHUTDOWN);
-	rg_doall(RG_STOP_EXITING, 1, NULL);
-	running = 0;
-
-	pthread_exit(NULL);
-}
-
-
-#ifdef WRAP_THREADS
-void dump_thread_states(FILE *);
-#endif
-int
-main(int argc, char **argv)
-{
-	int rv, do_init = 1;
-	char foreground = 0, wd = 1;
-	cman_node_t me;
-	msgctx_t *cluster_ctx;
-	msgctx_t *local_ctx;
-	pthread_t th;
-	cman_handle_t clu = NULL;
-
-	while ((rv = getopt(argc, argv, "wfdN")) != EOF) {
-		switch (rv) {
-		case 'w':
-			wd = 0;
-			break;
-		case 'd':
-			debug = 1;
-			break;
-		case 'N':
-			do_init = 0;
-			break;
-		case 'f':
-			foreground = 1;
-			break;
-		default:
-			return 1;
-			break;
-		}
-	}
-
-	if (!foreground && (geteuid() == 0)) {
-		daemon_init(argv[0]);
-		if (wd && !debug && !watchdog_init())
-			logt_print(LOG_NOTICE, "Failed to start watchdog\n");
-	}
-
-	setup_signal(SIGINT, flag_shutdown);
-	setup_signal(SIGTERM, flag_shutdown);
-	setup_signal(SIGUSR1, statedump);
-	unblock_signal(SIGCHLD);
-	setup_signal(SIGPIPE, SIG_IGN);
-
-	if (debug) {
-		setup_signal(SIGSEGV, segfault);
-	} else {
-		unblock_signal(SIGSEGV);
-	}
-
-	init_logging(NULL, foreground, (debug? LOG_DEBUG : SYSLOGLEVEL));
-	clu_initialize(&clu);
-	if (cman_init_subsys(clu) < 0) {
-		perror("cman_init_subsys");
-		return -1;
-	}
-
-	if (clu_lock_init(rgmanager_lsname) != 0) {
-		printf("Locks not working!\n");
-		return -1;
-	}
-
-	memset(&me, 0, sizeof(me));
-        cman_get_node(clu, CMAN_NODEID_US, &me);
-
-	if (me.cn_nodeid == 0) {
-		printf("Unable to determine local node ID\n");
-		perror("cman_get_node");
-		return -1;
-	}
-	set_my_id(me.cn_nodeid);
-
-	logt_print(LOG_INFO, "I am node #%d\n", my_id());
-
-	wait_for_fencing();
-
-	/*
-	   We know we're quorate.  At this point, we need to
-	   read the resource group trees from ccsd.
-	 */
-	configure_rgmanager(-1, debug);
-	logt_print(LOG_NOTICE, "Resource Group Manager Starting\n");
-
-	if (init_resource_groups(0, do_init) != 0) {
-		logt_print(LOG_CRIT, "#8: Couldn't initialize services\n");
-		return -1;
-	}
-
-	if (msg_listen(MSG_SOCKET, RGMGR_SOCK, me.cn_nodeid, &local_ctx) < 0) {
-		logt_print(LOG_CRIT,
-		       "#10: Couldn't set up cluster message system: %s\n",
-		       strerror(errno));
-		return -1;
-	}
-
-	if (msg_listen(MSG_CLUSTER, &port, me.cn_nodeid, &cluster_ctx) < 0) {
-		logt_print(LOG_CRIT,
-		       "#10b: Couldn't set up cluster message system: %s\n",
-		       strerror(errno));
-		return -1;
-	}
-
-	rg_set_quorate();
-
-	/*
-	msg_print(local_ctx);
-	msg_print(cluster_ctx);
-	 */
-
-	/*
-	   Initialize the VF stuff.
-	 */
-#ifdef OPENAIS
-	if (ds_init() < 0) {
-		logt_print(LOG_CRIT, "#11b: Couldn't initialize SAI AIS CKPT\n");
-		return -1;
-	}
-
-	ds_key_init("rg_lockdown", 32, 10);
-#else
-	if (vf_init(me.cn_nodeid, port, NULL, NULL) != 0) {
-		logt_print(LOG_CRIT, "#11: Couldn't set up VF listen socket\n");
-		return -1;
-	}
-
-	vf_key_init("rg_lockdown", 10, NULL, lock_commit_cb);
-	vf_key_init("Transition-Master", 10, NULL, master_event_callback);
-#endif
-
-	/*
-	   Do everything useful
-	 */
-	while (running) {
-		event_loop(local_ctx, cluster_ctx);
-
-		if (shutdown_pending == 1) {
-			/* Kill local socket; local requests need to
-			   be ignored here */
-			msg_close(local_ctx);
-			++shutdown_pending;
-			logt_print(LOG_NOTICE, "Shutting down\n");
-			pthread_create(&th, NULL, shutdown_thread, NULL);
-		}
-	}
-
-	if (rg_initialized())
-		cleanup(cluster_ctx);
-	logt_print(LOG_NOTICE, "Shutdown complete, exiting\n");
-	clu_lock_finished(rgmanager_lsname);
-	cman_finish(clu);
-	
-	close_logging();
-	/*malloc_dump_table(); */ /* Only works if alloc.c us used */
-	/*malloc_stats();*/
-
-	exit(0);
-}
diff --git a/rgmanager/src/daemons/reslist.c b/rgmanager/src/daemons/reslist.c
deleted file mode 100644
index b327245..0000000
--- a/rgmanager/src/daemons/reslist.c
+++ /dev/null
@@ -1,872 +0,0 @@
-#include <libxml/parser.h>
-#include <libxml/xmlmemory.h>
-#include <libxml/xpath.h>
-#include <ccs.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <resgroup.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <list.h>
-#include <restart_counter.h>
-#include <reslist.h>
-#include <pthread.h>
-#include <libgen.h>
-#ifndef NO_CCS
-#include <logging.h>
-#endif
-
-
-char *attr_value(resource_node_t *node, char *attrname);
-char *rg_attr_value(resource_node_t *node, char *attrname);
-
-void
-res_build_name(char *buf, size_t buflen, resource_t *res)
-{
-	snprintf(buf, buflen, "%s:%s", res->r_rule->rr_type,
-		 res->r_attrs[0].ra_value);
-}
-
-/**
-   Find and determine an attribute's value. 
-
-   @param res		Resource node to look examine
-   @param attrname	Attribute to retrieve.
-   @return 		value of attribute or NULL if not found
- */
-char *
-res_attr_value(resource_t *res, char *attrname)
-{
-	resource_attr_t *ra;
-	int x;
-
-	for (x = 0; res->r_attrs && res->r_attrs[x].ra_name; x++) {
-		if (strcmp(attrname, res->r_attrs[x].ra_name))
-			continue;
-
-		ra = &res->r_attrs[x];
-
-		if (ra->ra_flags & RA_INHERIT)
-			/* Can't check inherited resources */
-			return NULL;
-
-		return ra->ra_value;
-	}
-
-	return NULL;
-}
-
-
-/**
-   Find and determine an attribute's value.  Takes into account inherited
-   attribute flag, and append attribute flag, which isn't implemented yet.
-
-   @param node		Resource tree node to look examine
-   @param attrname	Attribute to retrieve.
-   @param ptype		Resource type to look for (if inheritance)
-   @return 		value of attribute or NULL if not found
- */
-static char *
-_attr_value(resource_node_t *node, char *attrname, char *ptype)
-{
-	resource_t *res;
-	resource_attr_t *ra;
-	char *c, p_type[32];
-	ssize_t len;
-	int x;
-
-	if (!node)
-		return NULL;
-
-	res = node->rn_resource;
-
-	/* Go up the tree if it's not the right parent type */
-	if (ptype && strcmp(res->r_rule->rr_type, ptype))
-		return _attr_value(node->rn_parent, attrname, ptype);
-
-	for (x = 0; res->r_attrs && res->r_attrs[x].ra_name; x++) {
-		if (strcmp(attrname, res->r_attrs[x].ra_name))
-			continue;
-
-		ra = &res->r_attrs[x];
-
-		if (!(ra->ra_flags & RA_INHERIT))
-			return ra->ra_value;
-		/* 
-		   Handle resource_type%field to be more precise, so we
-		   don't have to worry about this being a child
-		   of an unexpected type.  E.g. lots of things have the
-		   "name" attribute.
-		 */
-		c = strchr(ra->ra_value, '%');
-		if (!c) {
-			/* Someone doesn't care or uses older
-			   semantics on inheritance */
-			return _attr_value(node->rn_parent, ra->ra_value,
-					   NULL);
-		}
-		
-		len = (c - ra->ra_value);
-		memset(p_type, 0, sizeof(p_type));
-		memcpy(p_type, ra->ra_value, len);
-		
-		/* Skip the "%" and recurse */
-		return _attr_value(node->rn_parent, ++c, p_type);
-	}
-
-	return NULL;
-}
-
-
-char *
-attr_value(resource_node_t *node, char *attrname)
-{
-	return _attr_value(node, attrname, NULL);
-}
-
-
-/**
-  Run to the top of the tree.  Used to determine certain attributes of the
-  resource group in-line, during resource tree operations.
- */
-char *
-rg_attr_value(resource_node_t *node, char *attrname)
-{
-	for (; node->rn_parent; node = node->rn_parent);
-	return res_attr_value(node->rn_resource, attrname);
-}
-
-
-char *
-primary_attr_value(resource_t *res)
-{
-	int x;
-	resource_attr_t *ra;
-
-	for (x = 0; res->r_attrs && res->r_attrs[x].ra_name; x++) {
-		ra = &res->r_attrs[x];
-
-		if (!(ra->ra_flags & RA_PRIMARY))
-			continue;
-
-		return ra->ra_value;
-	}
-
-	return NULL;
-}
-
-
-
-/**
-   Compare two resources.
-
-  @param left	Left resource
-  @param right	Right resource	
-  @return	-1 on different resource, 0 if the same, 1 if different,
-		2 if different, but only safe resources are different
-
- */
-int
-rescmp(resource_t *left, resource_t *right)
-{
-	int x, y = 0, found = 0, ret = 0;
-
-
-	/* Completely different resource class... */
-	if (strcmp(left->r_rule->rr_type, right->r_rule->rr_type)) {
-		return -1;
-	}
-
-	/*
-	printf("Comparing %s:%s to %s:%s\n",
-	       left->r_rule->rr_type, left->r_attrs[0].ra_value,
-	       right->r_rule->rr_type, right->r_attrs[0].ra_value)
-	 */
-
-	for (x = 0; left->r_attrs && left->r_attrs[x].ra_name; x++) {
-
-		found = 0;
-		for (y = 0; right->r_attrs && right->r_attrs[y].ra_name; y++) {
-			if (!strcmp(right->r_attrs[y].ra_name,
-			 	    left->r_attrs[x].ra_name))
-				found = 1;
-			else
-				/* Different attribute name */
-				continue;
-
-			if (right->r_attrs[y].ra_flags !=
-			    left->r_attrs[x].ra_flags) {
-				/* Flags are different.  Change in
-				   resource agents? */
-				/*
-				printf("* flags differ %08x vs %08x\n",
-				       left->r_attrs[x].ra_flags,
-				       right->r_attrs[y].ra_flags);
-				 */
-				return 1;
-			}
-
-			if (strcmp(right->r_attrs[y].ra_value,
-				   left->r_attrs[x].ra_value)) {
-				/* Different attribute value. */
-				/*
-				printf("* different value for attr '%s':"
-				       " '%s' vs '%s'",
-				       right->r_attrs[y].ra_name,
-				       left->r_attrs[x].ra_value,
-				       right->r_attrs[y].ra_value);
-				 */
-				if (left->r_attrs[x].ra_flags & RA_RECONFIG) {
-					/* printf(" [SAFE]\n"); */
-					ret = 2;
-			 	} else {
-					/* printf("\n"); */
-					return 1;
-				}
-			}
-		}
-
-		/* Attribute missing -> different attribute value. */
-		if (!found) {
-			/*
-			printf("* Attribute '%s' deleted\n",
-			       left->r_attrs[x].ra_name);
-			 */
-			return 1;
-		}
-	}
-
-	/* Different attribute count */
-	if (x != y) {
-		/* printf("* Attribute count differ (attributes added!) "); */
-		return 1;
-	}
-
-	/* All the same */
-	return ret;
-}
-
-
-/**
-   Find a resource given its reference.  A reference is the value of the
-   primary attribute.
-
-   @param reslist	List of resources to traverse.
-   @param type		Type of resource to look for.
-   @param ref		Reference
-   @return		Resource matching type/ref or NULL if none.
- */   
-resource_t *
-find_resource_by_ref(resource_t **reslist, char *type, char *ref)
-{
-	resource_t *curr;
-	int x;
-
-	list_do(reslist, curr) {
-		if (strcmp(curr->r_rule->rr_type, type))
-			continue;
-
-		/*
-		   This should be one operation - the primary attr
-		   is generally at the head of the array.
-		 */
-		for (x = 0; curr->r_attrs && curr->r_attrs[x].ra_name;
-		     x++) {
-			if (!(curr->r_attrs[x].ra_flags & RA_PRIMARY))
-				continue;
-			if (strcmp(ref, curr->r_attrs[x].ra_value))
-				continue;
-
-			return curr;
-		}
-	} while (!list_done(reslist, curr));
-
-	return NULL;
-}
-
-
-/**
-   Find a root resource by ref (service, usually).  No name is required.
-   Only one type of root resource may exist because of the primary
-   attribute flag
-
-   @param reslist	List of resources to traverse.
-   @param ref		Reference
-   @return		Resource matching type/ref or NULL if none.
- */   
-resource_t *
-find_root_by_ref(resource_t **reslist, char *ref)
-{
-	resource_t *curr;
-	char ref_buf[128];
-	char *type;
-	char *name = ref;
-	int x;
-
-	snprintf(ref_buf, sizeof(ref_buf), "%s", ref);
-
-	type = ref_buf;
-	if ((name = strchr(ref_buf, ':'))) {
-		*name = 0;
-		name++;
-	} else {
-		/* Default type */
-		type = "service";
-		name = ref;
-	}
-
-	list_do(reslist, curr) {
-
-		/*
-		   This should be one operation - the primary attr
-		   is generally at the head of the array.
-		 */
-		for (x = 0; curr->r_attrs && curr->r_attrs[x].ra_name;
-		     x++) {
-			if (strcmp(type, curr->r_rule->rr_type))
-				continue;
-			if (!(curr->r_attrs[x].ra_flags & RA_PRIMARY))
-				continue;
-			if (strcmp(name, curr->r_attrs[x].ra_value))
-				continue;
-
-			return curr;
-		}
-	} while (!list_done(reslist, curr));
-
-
-	return NULL;
-}
-
-
-/**
-   Store a resource in the resource list if it's legal to do so.
-   Otherwise, don't store it.
-   Note: This function needs to be rewritten; it's way too long and way
-   too indented.
-
-   @param reslist	Resource list to store the new resource.
-   @param newres	Resource to store
-   @return 		0 on succes; nonzero on failure.
- */
-int
-store_resource(resource_t **reslist, resource_t *newres)
-{
-	resource_t *curr;
-	int x, y;
-
-	if (!*reslist) {
-		/* first resource */
-		list_insert(reslist, newres);
-		return 0;
-	}
-
-	list_do(reslist, curr) {
-
-		if (strcmp(curr->r_rule->rr_type, newres->r_rule->rr_type))
-		    	continue;
-
-		for (x = 0; newres->r_attrs && newres->r_attrs[x].ra_name;
-		     x++) {
-			/*
-			   Look for conflicting primary/unique keys
-			 */
-			if (!(newres->r_attrs[x].ra_flags &
-			    (RA_PRIMARY | RA_UNIQUE)))
-				continue;
-
-			for (y = 0; curr->r_attrs[y].ra_name; y++) {
-				if (curr->r_attrs[y].ra_flags & RA_INHERIT)
-					continue;
-
-				if (strcmp(curr->r_attrs[y].ra_name,
-					   newres->r_attrs[x].ra_name))
-					continue;
-				if (!strcmp(curr->r_attrs[y].ra_value,
-					    newres->r_attrs[x].ra_value)) {
-					/*
-					   Unique/primary is not unique
-					 */
-#ifdef NO_CCS
-					printf("Error: "
-                                               "%s attribute collision. "
-                                               "type=%s attr=%s value=%s\n",
-					       (newres->r_attrs[x].ra_flags&
-                                                RA_PRIMARY)?"Primary":
-                                               "Unique",
-					       newres->r_rule->rr_type,
-					       newres->r_attrs[x].ra_name,
-					       newres->r_attrs[x].ra_value
-					       );
-#else 
-					logt_print(LOG_ERR,
-                                               "%s attribute collision. "
-                                               "type=%s attr=%s value=%s\n",
-					       (newres->r_attrs[x].ra_flags&
-                                                RA_PRIMARY)?"Primary":
-                                               "Unique",
-					       newres->r_rule->rr_type,
-					       newres->r_attrs[x].ra_name,
-					       newres->r_attrs[x].ra_value
-					       );
-#endif
-					return -1;
-				}
-				break;
-			}
-		}
-	} while (!list_done(reslist, curr));
-
-	list_insert(reslist, newres);
-	return 0;
-}
-
-
-/**
-   Execute an XPath query, returning the first match.  Multiple matches are
-   ignored.  Please be advised that this is quite inefficient.
-
-   @param doc		Loaded XML document to search
-   @param ctx		Predefined XML XPath context
-   @param query		Query to execute.
-   @return		newly allocated pointer to value or NULL if not found.
- */
-char *
-xpath_get_one(xmlDocPtr __attribute__ ((unused)) doc,
-	      xmlXPathContextPtr ctx, char *query)
-{
-	char *val = NULL, *ret = NULL;
-	xmlXPathObjectPtr obj;
-	xmlNodePtr node;
-	size_t size = 0;
-	int nnv = 0;
-
-	obj = xmlXPathEvalExpression((unsigned char *)query, ctx);
-	if (!obj)
-		return NULL;
-	if (!obj->nodesetval)
-		goto out;
-	if (obj->nodesetval->nodeNr <= 0)
-		goto out;
-
-	node = obj->nodesetval->nodeTab[0];
-	if(!node)
-		goto out;
-
-	if (((node->type == XML_ATTRIBUTE_NODE) && strstr(query, "@*")) ||
-	    ((node->type == XML_ELEMENT_NODE) && strstr(query, "child::*"))){
-		if (node->children && node->children->content)
-	  		size = strlen((char *)node->children->content)+
-				      strlen((char *)node->name)+2;
-		else 
-			size = strlen((char *)node->name)+2;
-		nnv = 1;
-	} else {
-		if (node->children && node->children->content) {
-			size = strlen((char *)node->children->content)+1;
-		} else {
-			goto out;
-		}
-	}
-
-	val = (char *)malloc(size);
-	if(!val)
-		goto out;
-	memset(val, 0, size);
-	if (nnv) {
-		sprintf(val, "%s=%s", node->name, node->children ?
-			(char *)node->children->content:"");
-	} else {
-		sprintf(val, "%s", node->children ? node->children->content :
-			node->name);
-	}
-
-	ret = val;
-out:
-	xmlXPathFreeObject(obj);
-
-	return ret;
-}
-
-
-/**
-   Obliterate a resource_t structure.
-
-   @param res		Resource to free.
- */
-void
-destroy_resource(resource_t *res)
-{
-	int x;
-
-	if (res->r_name)
-		free(res->r_name);
-
-	if (res->r_attrs) {
-		for (x = 0; res->r_attrs && res->r_attrs[x].ra_name; x++) {
-			free(res->r_attrs[x].ra_name);
-			free(res->r_attrs[x].ra_value);
-		}
-
-		free(res->r_attrs);
-	}
-
-	if (res->r_actions) {
-		/* Don't free the strings; they're part of the rule */
-		free(res->r_actions);
-	}
-
-	free(res);
-}
-
-
-
-/**
-   Obliterate a resource_t list.
-
-   @param list		Resource list to free.
- */
-void
-destroy_resources(resource_t **list)
-{
-	resource_t *res;
-
-	while ((res = *list)) {
-		list_remove(list, res);
-		destroy_resource(res);
-	}
-}
-
-
-/**
-   Print a resource_t structure to stdout
-   
-   @param res		Resource to print.
- */
-void
-print_resource(resource_t *res)
-{
-	int x;
-
-	printf("Resource type: %s", res->r_rule->rr_type);
-	if (res->r_flags & RF_INLINE)
-		printf(" [INLINE]");
-	if (res->r_flags & RF_NEEDSTART)
-		printf(" [NEEDSTART]");
-	if (res->r_flags & RF_NEEDSTOP)
-		printf(" [NEEDSTOP]");
-	if (res->r_flags & RF_COMMON)
-		printf(" [COMMON]");
-	if (res->r_flags & RF_RECONFIG)
-		printf(" [RECONFIG]");
-	printf("\n");
-
-	if (res->r_rule->rr_maxrefs)
-		printf("Instances: %d/%d\n", res->r_refs,
-		       res->r_rule->rr_maxrefs);
-	if (res->r_rule->rr_agent)
-		printf("Agent: %s\n", basename(res->r_rule->rr_agent));
-	
-	printf("Attributes:\n");
-	if (!res->r_attrs) {
-		printf("  - None -\n\n");
-		return;
-	}
-
-	for (x = 0; res->r_attrs[x].ra_name; x++) {
-
-		if (!(res->r_attrs[x].ra_flags & RA_INHERIT)) {
-			printf("  %s = %s", res->r_attrs[x].ra_name,
-			       res->r_attrs[x].ra_value);
-		} else {
-			printf("  %s", res->r_attrs[x].ra_name);
-		}
-
-		if (!res->r_attrs[x].ra_flags) {
-			printf("\n");
-			continue;
-		}
-
-		printf(" [");
-		if (res->r_attrs[x].ra_flags & RA_PRIMARY)
-			printf(" primary");
-		if (res->r_attrs[x].ra_flags & RA_UNIQUE)
-			printf(" unique");
-		if (res->r_attrs[x].ra_flags & RA_REQUIRED)
-			printf(" required");
-		if (res->r_attrs[x].ra_flags & RA_RECONFIG)
-			printf(" reconfig");
-		if (res->r_attrs[x].ra_flags & RA_INHERIT)
-			printf(" inherit(\"%s\")", res->r_attrs[x].ra_value);
-		printf(" ]\n");
-	}
-
-	printf("\n");
-}
-
-
-void *
-act_dup(resource_act_t *acts)
-{
-	int x;
-	resource_act_t *newacts;
-
-	for (x = 0; acts[x].ra_name; x++);
-
-	++x;
-	x *= sizeof(resource_act_t);
-
-	newacts = malloc(x);
-	if (!newacts)
-		return NULL;
-
-	memcpy(newacts, acts, x);
-
-	return newacts;
-}
-
-
-/* Copied from resrules.c -- _get_actions */
-void
-#ifndef NO_CCS
-_get_actions_ccs(int ccsfd, char *base, resource_t *res)
-#else
-_get_actions_ccs(int __attribute__((unused)) ccsfd, char *base, resource_t *res)
-#endif
-{
-	char xpath[256];
-	int idx = 0;
-	char *act, *ret;
-	int interval, timeout, depth;
-
-	do {
-		/* setting these to -1 prevents overwriting with 0 */
-		interval = -1;
-		depth = -1;
-		act = NULL;
-		timeout = -1;
-
-		snprintf(xpath, sizeof(xpath),
-			 "%s/action[%d]/@name", base, ++idx);
-
-#ifndef NO_CCS
-		if (ccs_get(ccsfd, xpath, &act) != 0)
-#else
-		if (conf_get(xpath, &act) != 0)
-#endif
-			break;
-
-		snprintf(xpath, sizeof(xpath),
-			 "%s/action[%d]/@timeout", base, idx);
-#ifndef NO_CCS
-		if (ccs_get(ccsfd, xpath, &ret) == 0 && ret) {
-#else
-		if (conf_get(xpath, &ret) == 0 && ret) {
-#endif
-			timeout = expand_time(ret);
-			if (timeout < 0)
-				timeout = 0;
-			free(ret);
-		}
-
-		snprintf(xpath, sizeof(xpath),
-			 "%s/action[%d]/@interval", base, idx);
-#ifndef NO_CCS
-		if (ccs_get(ccsfd, xpath, &ret) == 0 && ret) {
-#else
-		if (conf_get(xpath, &ret) == 0 && ret) {
-#endif
-			interval = expand_time(ret);
-			if (interval < 0)
-				interval = 0;
-			free(ret);
-		}
-
-		if (!strcmp(act, "status") || !strcmp(act, "monitor")) {
-			snprintf(xpath, sizeof(xpath),
-				 "%s/action[%d]/@depth", base, idx);
-#ifndef NO_CCS
-			if (ccs_get(ccsfd, xpath, &ret) == 0 && ret) {
-#else
-			if (conf_get(xpath, &ret) == 0 && ret) {
-#endif
-				depth = atoi(ret);
-				if (depth < 0)
-					depth = 0;
-				
-				/* */
-				if (ret[0] == '*')
-					depth = -1;
-				free(ret);
-			}
-		}
-
-		if (store_action(&res->r_actions, act, depth, timeout,
-				 interval) != 0)
-			free(act);
-	} while (1);
-}
-
-
-/**
-   Try to load all the attributes in our rule set.  If none are found,
-   or an error occurs, return NULL and move on to the next one.
-
-   @param ccsfd		File descriptor connected to CCS
-   @param rule		Resource rule set to use when looking for data
-   @param base		Base XPath path to start with.
-   @return		New resource if legal or NULL on failure/error
- */
-resource_t *
-load_resource(int ccsfd, resource_rule_t *rule, char *base)
-{
-	resource_t *res = NULL;
-	char ccspath[1024];
-	char *attrname, *attr;
-	int x, found = 0, flags;
-
-	res = malloc(sizeof(*res));
-	if (!res) {
-		printf("Out of memory\n");
-		return NULL;
-	}
-
-	memset(res, 0, sizeof(*res));
-	res->r_rule = rule;
-
-	for (x = 0; res->r_rule->rr_attrs &&
-	     res->r_rule->rr_attrs[x].ra_name; x++) {
-
-		flags = rule->rr_attrs[x].ra_flags;
-		attrname = strdup(rule->rr_attrs[x].ra_name);
-		if (!attrname) {
-			destroy_resource(res);
-			return NULL;
-		}
-
-		/*
-		   Ask CCS for the respective attribute
-		 */
-		attr = NULL;
-		snprintf(ccspath, sizeof(ccspath), "%s/@%s", base, attrname);
-
-#ifndef NO_CCS
-		if (ccs_get(ccsfd, ccspath, &attr) != 0) {
-#else
-		if (conf_get(ccspath, &attr) != 0) {
-#endif
-
-			if (flags & (RA_REQUIRED | RA_PRIMARY)) {
-				/* Missing required attribute.  We're done. */
-				free(attrname);
-				destroy_resource(res);
-				return NULL;
-			}
-
-			if (!(flags & RA_INHERIT)) {
-				/*
-				   If we don't have the inherit flag, see if
-				   we have a value anyway.  If we do,
-				   this value is the default value, and
-				   should be used.
-				 */
-				if (!rule->rr_attrs[x].ra_value) {
-					free(attrname);
-					continue;
-				}
-
-				/* Copy default value from resource rule */
-				attr = strdup(rule->rr_attrs[x].ra_value);
-			}
-		}
-
-		found = 1;
-
-		/*
-		   If we are supposed to inherit and we don't have an
-		   instance of the specified attribute in CCS, then we
-		   keep the inherit flag and use it as the attribute.
-
-		   However, if we _do_ have the attribute for this instance,
-		   we drop the inherit flag and use the attribute.
-		 */
-		if (flags & RA_INHERIT) {
-		       	if (attr) {
-				flags &= ~RA_INHERIT;
-			} else {
-				attr = strdup(rule->rr_attrs[x].ra_value);
-				if (!attr) {
-					destroy_resource(res);
-					free(attrname);
-					return NULL;
-				}
-			}
-		}
-
-		/*
-		   Store the attribute.  We'll ensure all required
-		   attributes are present soon.
-		 */
-		if (attrname && attr)
-			store_attribute(&res->r_attrs, attrname, attr, flags);
-	}
-
-	if (!found) {
-		destroy_resource(res);
-		return NULL;
-	}
-
-	res->r_actions = act_dup(rule->rr_actions);
-	_get_actions_ccs(ccsfd, base, res);
-
-	return res;
-}
-
-
-/**
-   Read all resources in the resource manager block in CCS.
-
-   @param ccsfd		File descriptor connected to CCS.
-   @param reslist	Empty list to fill with resources.
-   @param rulelist	List of rules to use when searching CCS.
-   @return		0 on success, nonzero on failure.
- */
-int
-load_resources(int ccsfd, resource_t **reslist, resource_rule_t **rulelist)
-{
-	int resID = 0;
-	resource_t *newres = NULL;
-	resource_rule_t *currule;
-	char tok[256];
-
-	list_do(rulelist, currule) {
-
-		for (resID = 1; ; resID++) {
-			snprintf(tok, sizeof(tok), RESOURCE_BASE "/%s[%d]",
-				 currule->rr_type, resID);
-			
-			newres = load_resource(ccsfd, currule, tok);
-			if (!newres)
-				break;
-
-		       if (store_resource(reslist, newres) != 0) {
-#ifdef NO_CCS
-	       		       printf("Error storing %s resource\n",
-				      newres->r_rule->rr_type);
-#else
-	       		       logt_print(LOG_ERR,
-				      "Error storing %s resource\n",
-				      newres->r_rule->rr_type);
-#endif
-
-			       destroy_resource(newres);
-		       }
-
-		       /* Just information */
-		       newres->r_flags = RF_DEFINED;
-		}
-	} while (!list_done(rulelist, currule));
-
-	return 0;
-}
-
diff --git a/rgmanager/src/daemons/resrules.c b/rgmanager/src/daemons/resrules.c
deleted file mode 100644
index a57e3e0..0000000
--- a/rgmanager/src/daemons/resrules.c
+++ /dev/null
@@ -1,1174 +0,0 @@
-#include <libxml/parser.h>
-#include <libxml/xmlmemory.h>
-#include <libxml/xpath.h>
-#include <ccs.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <resgroup.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <list.h>
-#include <ctype.h>
-#include <restart_counter.h>
-#include <reslist.h>
-#include <pthread.h>
-#include <dirent.h>
-#include <libgen.h>
-#ifndef NO_CCS
-#include <logging.h>
-#endif
-
-
-/**
-   Store a new resource rule in the given rule list.
-
-   @param rulelist	List of rules to store new rule in.
-   @param newrule	New rule to store.
-   @return		0 on success or -1 if rule with same name
-			already exists in rulelist
- */
-int
-store_rule(resource_rule_t **rulelist, resource_rule_t *newrule)
-{
-	resource_rule_t *curr;
-
-	list_do(rulelist, curr) {
-		if (!strcasecmp(newrule->rr_type, curr->rr_type)) {
-#ifdef NO_CCS
-			fprintf(stderr, "Error storing %s: Duplicate\n",
-				newrule->rr_type);
-#else
-			logt_print(LOG_ERR, "Error storing %s: Duplicate\n",
-			       newrule->rr_type);
-#endif
-			return -1;
-		}
-
-	} while (!list_done(rulelist, curr));
-	
-	/* insert sorted in alphabetical order so rg_test produces
-	 * reproducible output all the time */
-	list_do(rulelist, curr) {
-		if (strcasecmp(newrule->rr_type, curr->rr_type) < 0) {
-			list_insert(&curr, newrule);
-			/* reset list if we have a new low */
-			if (curr == *rulelist)
-				*rulelist = newrule;
-			return 0;
-		}
-	} while (!list_done(rulelist, curr));
-		
-	list_insert(rulelist, newrule);
-	return 0;
-}
-
-
-/**
-   Obliterate a resource_rule_t structure.
-
-   @param rr		Resource rule to free.
- */
-void
-destroy_resource_rule(resource_rule_t *rr)
-{
-	int x;
-
-	if (rr->rr_type)
-		free(rr->rr_type);
-	if (rr->rr_agent)
-		free(rr->rr_agent);
-	if (rr->rr_version)
-		free(rr->rr_version);
-
-	if (rr->rr_attrs) {
-		for (x = 0; rr->rr_attrs &&
-		     rr->rr_attrs[x].ra_name; x++) {
-			free(rr->rr_attrs[x].ra_name);
-			if (rr->rr_attrs[x].ra_value)
-				free(rr->rr_attrs[x].ra_value);
-		}
-
-		free(rr->rr_attrs);
-	}
-
-	if (rr->rr_actions) {
-		for (x = 0; rr->rr_actions &&
-		     rr->rr_actions[x].ra_name; x++) {
-			free(rr->rr_actions[x].ra_name);
-		}
-
-		free(rr->rr_actions);
-	}
-
-	if (rr->rr_childtypes) {
-		for (x = 0; rr->rr_childtypes &&
-		     rr->rr_childtypes[x].rc_name; x++)
-			free(rr->rr_childtypes[x].rc_name);
-		free(rr->rr_childtypes);
-	}
-
-	free(rr);
-}
-
-
-/**
-   Destroy a list of resource rules.
-
-   @param rules		List of rules to destroy.
- */
-void
-destroy_resource_rules(resource_rule_t **rules)
-{
-	resource_rule_t *rr;
-
-	while ((rr = *rules)) {
-		list_remove(rules, rr);
-		destroy_resource_rule(rr);
-	}
-}
-
-
-/**
-   Get and store the maxparents (max instances) attribute for a given
-   resource rule set.
-
-   @param doc		Pre-parsed XML document pointer.
-   @param ctx		Pre-allocated XML XPath context pointer.
-   @param base		XPath prefix to search
-   @param rr		Resource rule to store new information in.
- */
-void
-_get_maxparents(xmlDocPtr doc, xmlXPathContextPtr ctx, char *base,
-	       	resource_rule_t *rr)
-{
-	char xpath[256];
-	char *ret = NULL;
-
-	snprintf(xpath, sizeof(xpath),
-		 "%s/attributes/@maxinstances",
-		 base);
-	ret = xpath_get_one(doc, ctx, xpath);
-	if (ret) {
-		rr->rr_maxrefs = atoi(ret);
-		if (rr->rr_maxrefs < 0)
-			rr->rr_maxrefs = 0;
-		free(ret);
-	}
-}
-
-
-/**
-   Get and store a bit field.
-
-   @param doc		Pre-parsed XML document pointer.
-   @param ctx		Pre-allocated XML XPath context pointer.
-   @param base		XPath prefix to search
-   @param rr		Resource rule to store new information in.
- */
-void
-_get_rule_flag(xmlDocPtr doc, xmlXPathContextPtr ctx, char *base,
-	       resource_rule_t *rr, char *flag, int bit)
-{
-	char xpath[256];
-	char *ret = NULL;
-
-	snprintf(xpath, sizeof(xpath),
-		 "%s/attributes/@%s",
-		 base, flag);
-	ret = xpath_get_one(doc, ctx, xpath);
-	if (ret) {
-		if (atoi(ret)) {
-			rr->rr_flags |= bit;
-		} else {
-			rr->rr_flags &= ~bit;
-		}
-		free(ret);
-	}
-}
-
-
-/**
-   Get and store the version
-
-   @param doc		Pre-parsed XML document pointer.
-   @param ctx		Pre-allocated XML XPath context pointer.
-   @param base		XPath prefix to search
-   @param rr		Resource rule to store new information in.
- */
-void
-_get_version(xmlDocPtr doc, xmlXPathContextPtr ctx, char *base,
-	     resource_rule_t *rr)
-{
-	char xpath[256];
-	char *ret = NULL;
-
-	snprintf(xpath, sizeof(xpath), "%s/@version", base);
-	ret = xpath_get_one(doc, ctx, xpath);
-	if (ret) {
-		rr->rr_version = ret;
-		free(ret);
-	}
-	rr->rr_version = NULL;
-}
-
-
-int
-expand_time (char *val)
-{
-	int curval, len;
-	int ret = 0;
-	char *start = val, ival[16];
-
-	if (!val)
-		return (time_t)0;
-
-	while (start[0]) {
-
-		len = 0;
-		curval = 0;
-		memset(ival, 0, sizeof(ival));
-
-		while (isdigit(start[len])) {
-			ival[len] = start[len];
-			len++;
-		}
-
-		if (len) {
-			curval = atoi(ival);
-		} else {
-			len = 1;
-		}
-
-		switch(start[len]) {
-		case 0:
-		case 'S':
-		case 's':
-			break;
-		case 'M':
-        	case 'm':
-			curval *= 60;
-			break;
-		case 'h':
-		case 'H':
-			curval *= 3600;
-			break;
-		case 'd':
-		case 'D':
-			curval *= 86400;
-			break;
-		case 'w':
-		case 'W':
-			curval *= 604800;
-			break;
-		case 'y':
-		case 'Y':
-			curval *= 31536000;
-			break;
-		default:
-			curval = 0;
-		}
-
-		ret += (time_t)curval;
-		start += len;
-	}
-
-	return ret;
-}
-
-
-
-/**
- * Store a resource action
- * @param actsp		Action array; may be modified and returned!
- * @param name		Name of the action
- * @param depth		Resource depth (status/monitor; -1 means *ALL LEVELS*
- * 			... this means that only the highest-level check depth
- * 			will ever be performed!)
- * @param timeout	Timeout (not used)
- * @param interval	Time interval for status/monitor
- * @return		0 on success, -1 on failure
- * 
- */
-int
-store_action(resource_act_t **actsp, char *name, int depth,
-	     int timeout, int interval)
-{
-	int x = 0, replace = 0;
-	resource_act_t *acts = *actsp;
-
-	if (!name)
-		return -1;
-	
-	if (depth < 0 && timeout < 0 && interval < 0)
-		return -1;
-
-	if (!acts) {
-		/* Can't create with anything < 0 */
-		if (depth < 0 || timeout < 0 || interval < 0)
-			return -1;
-		
-		acts = malloc(sizeof(resource_act_t) * 2);
-		if (!acts)
-			return -1;
-		acts[0].ra_name = name;
-		acts[0].ra_depth = depth;
-		acts[0].ra_timeout = timeout;
-		acts[0].ra_interval = interval;
-		acts[0].ra_last = 0;
-		acts[1].ra_name = NULL;
-
-		*actsp = acts;
-		return 0;
-	}
-
-	for (x = 0; acts[x].ra_name; x++) {
-		if (!strcmp(acts[x].ra_name, name) &&
-		    (depth == acts[x].ra_depth || depth == -1)) {
-			printf("Replacing action '%s' depth %d: ",
-			       name, acts[x].ra_depth);
-			if (timeout >= 0) {
-				printf("timeout: %d->%d ",
-				       (int)acts[x].ra_timeout,
-				       (int)timeout);
-				acts[x].ra_timeout = timeout;
-			}
-			if (interval >= 0) {
-				printf("interval: %d->%d",
-				       (int)acts[x].ra_interval,
-				       (int)interval);
-				acts[x].ra_interval = interval;
-			}
-			acts[x].ra_last = 0;
-			printf("\n");
-			replace = 1;
-		}
-	}
-	
-	if (replace)
-		/* If we replaced something, we're done */
-		return 1;
-	
-	/* Can't create with anything < 0 */
-	if (depth < 0 || timeout < 0 || interval < 0)
-		return -1;
-
-	acts = realloc(acts, sizeof(resource_act_t) * (x+2));
-	if (!acts)
-		return -1;
-	
-	acts[x].ra_name = name;
-	acts[x].ra_depth = depth;
-	acts[x].ra_timeout = timeout;
-	acts[x].ra_interval = interval;
-	acts[x].ra_last = 0;
-
-	acts[x+1].ra_name = NULL;
-
-	*actsp = acts;
-	return 0;
-}
-
-
-
-void
-_get_actions(xmlDocPtr doc, xmlXPathContextPtr ctx, char *base,
-		 resource_rule_t *rr)
-{
-	char xpath[256];
-	int idx = 0;
-	char *act, *ret;
-	int interval, timeout, depth;
-
-	do {
-		interval = 0;
-		depth = 0;
-		act = NULL;
-		timeout = 0;
-
-		snprintf(xpath, sizeof(xpath),
-			 "%s/action[%d]/@name", base, ++idx);
-
-		act = xpath_get_one(doc,ctx,xpath);
-		if (!act)
-			break;
-
-		snprintf(xpath, sizeof(xpath),
-			 "%s/action[%d]/@timeout", base, idx);
-		ret = xpath_get_one(doc, ctx, xpath);
-		if (ret) {
-			timeout = expand_time(ret);
-			if (timeout < 0)
-				timeout = 0;
-			free(ret);
-		}
-
-		snprintf(xpath, sizeof(xpath),
-			 "%s/action[%d]/@interval", base, idx);
-		ret = xpath_get_one(doc, ctx, xpath);
-		if (ret) {
-			interval = expand_time(ret);
-			if (interval < 1)
-				interval = 1;
-			free(ret);
-		}
-
-		if (!strcmp(act, "status") || !strcmp(act, "monitor")) {
-			snprintf(xpath, sizeof(xpath),
-				 "%s/action[%d]/@depth", base, idx);
-			ret = xpath_get_one(doc, ctx, xpath);
-			if (ret) {
-				depth = atoi(ret);
-				if (depth < 0)
-					depth = 0;
-				free(ret);
-			}
-		}
-
-		if (store_action(&rr->rr_actions, act, depth, timeout,
-				 interval) != 0)
-			free(act);
-	} while (1);
-}
-
-
-
-
-/**
-   Store an attribute with the given name, value, and flags in a resource_t
-   structure.
-   XXX This could be rewritten to use the list macros.
-
-   @param attrsp	Attribute array to store new attribute in.
-   @param name		Name of attribute (must be non-null)
-   @param value		Value of attribute
-   @param flags		Attribute flags, or 0 if none.
-   @return		0 on success, nonzero on error/failure
- */
-int
-store_attribute(resource_attr_t **attrsp, char *name, char *value, int flags)
-{
-	int x = 0;
-	resource_attr_t *attrs = *attrsp;
-
-	if (!name)
-		return -1;
-
-	if (!attrs) {
-		attrs = malloc(sizeof(resource_attr_t) * 2);
-		if (!attrs)
-			return -1;
-		attrs[0].ra_name = name;
-		attrs[0].ra_value = value;
-		attrs[0].ra_flags = flags;
-		attrs[1].ra_name = NULL;
-		attrs[1].ra_value= NULL;
-
-		*attrsp = attrs;
-		return 0;
-	}
-
-	for (x = 0; attrs[x].ra_name; x++);
-
-	attrs = realloc(attrs, sizeof(resource_attr_t) * (x+2));
-	if (!attrs)
-		return -1;
-
-	/* Primary attribute goes first.  This makes this interaction
-	with CCS work way faster. */
-	if (flags & RA_PRIMARY) {
-		attrs[x].ra_name = attrs[0].ra_name;
-		attrs[x].ra_value = attrs[0].ra_value;
-		attrs[x].ra_flags = attrs[0].ra_flags;
-		attrs[0].ra_name = name;
-		attrs[0].ra_value = value;
-		attrs[0].ra_flags = flags;
-	} else {
-		attrs[x].ra_name = name;
-		attrs[x].ra_value = value;
-		attrs[x].ra_flags = flags;
-	}
-	attrs[x+1].ra_name = NULL;
-	attrs[x+1].ra_value = NULL;
-
-	*attrsp = attrs;
-	return 0;
-}
-
-
-/**
-   Store a child type in the child array of a resource rule.
-   XXX Could be rewritten to use list macros.
-
-   @param childp	Child array.  Might be modified.
-   @param name		Name of child type
-   @param start		Start level
-   @param stop		Stop level
-   @param forbid	Do NOT allow this child type to exist
-   @param flags		set to 1 to note that it was defined inline
-   @return		0 on success, nonzero on failure
- */
-int
-store_childtype(resource_child_t **childp, char *name, int start, int stop,
-		int forbid, int flags)
-{
-	int x = 0;
-	resource_child_t *child = *childp;
-
-	if (!name)
-		return -1;
-
-	if (!child) {
-		child = malloc(sizeof(resource_child_t) * 2);
-		if (!child)
-			return -1;
-		child[0].rc_name = name;
-		child[0].rc_startlevel = start;
-		child[0].rc_stoplevel = stop;
-		child[0].rc_forbid = forbid;
-		child[0].rc_flags = flags;
-		child[1].rc_name = NULL;
-
-		*childp = child;
-		return 0;
-	}
-
-	for (x = 0; child[x].rc_name; x++);
-
-	child = realloc(child, sizeof(resource_child_t) * (x+2));
-	if (!child)
-		return -1;
-
-	child[x].rc_name = name;
-	child[x].rc_startlevel = start;
-	child[x].rc_stoplevel = stop;
-	child[x].rc_forbid = forbid;
-	child[x].rc_flags = flags;
-	child[x+1].rc_name = NULL;
-
-	*childp = child;
-	return 0;
-}
-
-
-/**
-   Print a resource_t structure to stdout
-
-   @param rr		Resource rule to print.
- */
-void
-print_resource_rule(resource_rule_t *rr)
-{
-	int x;
-
-	printf("Resource Rules for \"%s\"\n", rr->rr_type);
-
-	if (rr->rr_version)
-		printf("OCF API Version: %s\n", rr->rr_version);
-
-	if (rr->rr_maxrefs)
-		printf("Max instances: %d\n", rr->rr_maxrefs);
-	if (rr->rr_agent)
-		printf("Agent: %s\n", basename(rr->rr_agent));
-
-	printf("Flags: ");
-	if (rr->rr_flags) {
-		if (rr->rr_flags & RF_INIT)
-			printf("init_on_add ");
-		if (rr->rr_flags & RF_DESTROY)
-			printf("destroy_on_delete ");
-	} else {
-		printf("(none)");
-	}
-	printf("\n");
-	
-	printf("Attributes:\n");
-	if (!rr->rr_attrs) {
-		printf("  - None -\n");
-		goto actions;
-	}
-
-	for (x = 0; rr->rr_attrs[x].ra_name; x++) {
-		printf("  %s", rr->rr_attrs[x].ra_name);
-
-		if (!rr->rr_attrs[x].ra_flags && !rr->rr_attrs[x].ra_value) {
-			printf("\n");
-			continue;
-		}
-
-		if (rr->rr_attrs[x].ra_flags) {
-			printf(" [");
-			if (rr->rr_attrs[x].ra_flags & RA_PRIMARY)
-				printf(" primary");
-			if (rr->rr_attrs[x].ra_flags & RA_UNIQUE)
-				printf(" unique");
-			if (rr->rr_attrs[x].ra_flags & RA_REQUIRED)
-				printf(" required");
-			if (rr->rr_attrs[x].ra_flags & RA_INHERIT)
-				printf(" inherit");
-			if (rr->rr_attrs[x].ra_flags & RA_RECONFIG)
-				printf(" reconfig");
-			printf(" ]");
-		}
-
-		if (rr->rr_attrs[x].ra_value)
-			printf(" default=\"%s\"\n", rr->rr_attrs[x].ra_value);
-		else
-			printf("\n");
-	}
-
-actions:
-	printf("Actions:\n");
-	if (!rr->rr_actions) {
-		printf("  - None -\n");
-		goto children;
-	}
-
-	for (x = 0; rr->rr_actions[x].ra_name; x++) {
-		printf("  %s\n", rr->rr_actions[x].ra_name);
-		if (rr->rr_actions[x].ra_timeout)
-			printf("    Timeout (hint): %d seconds\n",
-			       (int)rr->rr_actions[x].ra_timeout);
-		if (rr->rr_actions[x].ra_depth)
-			printf("    OCF Check Depth (status/monitor): "
-			       "%d seconds\n",
-			       (int)rr->rr_actions[x].ra_depth);
-		if (rr->rr_actions[x].ra_interval)
-			printf("    Check Interval: %d seconds\n",
-			       (int)rr->rr_actions[x].ra_interval);
-	}
-
-
-children:
-	printf("Explicitly defined child resource types:\n");
-	if (!rr->rr_childtypes) {
-		printf("  - None -\n\n");
-		return;
-	}
-	for (x = 0; rr->rr_childtypes[x].rc_name; x++) {
-		printf("  %s", rr->rr_childtypes[x].rc_name);
-		if (rr->rr_childtypes[x].rc_forbid) {
-			printf(" (forbidden)\n");
-			continue;
-		}
-		if (rr->rr_childtypes[x].rc_startlevel ||
-		    rr->rr_childtypes[x].rc_stoplevel) {
-			printf(" [");
-
-			if (rr->rr_childtypes[x].rc_startlevel) {
-				printf(" startlevel = %d",
-				       rr->rr_childtypes[x].rc_startlevel);
-			}
-
-			if (rr->rr_childtypes[x].rc_stoplevel) {
-				printf(" stoplevel = %d",
-				       rr->rr_childtypes[x].rc_stoplevel);
-			}
-			printf(" ] ");
-		}
-
-		printf("\n");
-	}
-
-	printf("\n");
-}
-
-
-/**
-   Get and store attributes for a given instance of a resource rule.
-
-   @param doc		Pre-parsed XML document pointer.
-   @param ctx		Pre-allocated XML XPath context pointer.
-   @param base		XPath prefix to search
-   @param rr		Resource rule to store new information in.
-   @return		0
- */
-int
-_get_rule_attrs(xmlDocPtr doc, xmlXPathContextPtr ctx, char *base,
-		resource_rule_t *rr)
-{
-	char *ret, *attrname, *dflt = NULL, xpath[256];
-	int x, flags, primary_found = 0;
-
-	for (x = 1; 1; x++) {
-		snprintf(xpath, sizeof(xpath), "%s/parameter[%d]/@name",
- 			 base, x);
-
-		ret = xpath_get_one(doc,ctx,xpath);
-		if (!ret)
-			break;
-
-		flags = 0;
-		attrname = ret;
-		
-		/*
-		   See if there's a default value.
-		 */
-		snprintf(xpath, sizeof(xpath),
-			 "%s/parameter[%d]/content/@default", base, x);
-		dflt = xpath_get_one(doc,ctx,xpath);
-
-		/*
-		   See if this is either the primary identifier or
-		   a required field.
-		 */
-		snprintf(xpath, sizeof(xpath), "%s/parameter[%d]/@required",
-			 base, x);
-		if ((ret = xpath_get_one(doc,ctx,xpath))) {
-			if ((atoi(ret) != 0) || (ret[0] == 'y')) 
-				flags |= RA_REQUIRED;
-			free(ret);
-		}
-
-		/*
-		   See if this is supposed to be unique
-		 */
-		snprintf(xpath, sizeof(xpath), "%s/parameter[%d]/@unique",
-			 base, x);
-		if ((ret = xpath_get_one(doc,ctx,xpath))) {
-			if ((atoi(ret) != 0) || (ret[0] == 'y'))
-				flags |= RA_UNIQUE;
-			free(ret);
-		}
-
-		snprintf(xpath, sizeof(xpath), "%s/parameter[%d]/@primary",
-			 base, x);
-		if ((ret = xpath_get_one(doc,ctx,xpath))) {
-			if ((atoi(ret) != 0) || (ret[0] == 'y')) {
-				if (primary_found) {
-					free(ret);
-					printf("Multiple primary "
-					       "definitions for "
-					       "resource type %s\n",
-					       rr->rr_type);
-					return -1;
-				}
-				flags |= RA_PRIMARY;
-				primary_found = 1;
-			}
-			free(ret);
-		}
-
-		/*
-		   See if this can be reconfigured on the fly without a 
-		   stop/start
-		 */
-		snprintf(xpath, sizeof(xpath), "%s/parameter[%d]/@reconfig",
-			 base, x);
-		if ((ret = xpath_get_one(doc,ctx,xpath))) {
-			if ((atoi(ret) != 0) || (ret[0] == 'y'))
-				flags |= RA_RECONFIG;
-			free(ret);
-		}
-
-		/*
-		   See if this is supposed to be inherited
-		 */
-		snprintf(xpath, sizeof(xpath), "%s/parameter[%d]/@inherit",
-			 base, x);
-		if ((ret = xpath_get_one(doc,ctx,xpath))) {
-			flags |= RA_INHERIT;
-
-			if (flags & (RA_REQUIRED | RA_PRIMARY | RA_UNIQUE)) {
-				free(ret);
-				printf("Can not inherit and be primary, "
-				       "unique, or required\n");
-				return -1;
-			}
-			/*
-			   don't free ret.  Store as attr value.  If we had
-			   a default value specified from above, free it;
-			   inheritance supercedes a specified default value.
-			 */
-			if (dflt)
-				free(dflt);
-		} else {
-			/*
-			   Use default value, if specified, as the attribute
-			   value.
-			 */
-			ret = dflt;
-		}
-
-		/*
-		   Store the attribute.  We'll ensure all required
-		   attributes are present soon.
-		 */
-		if (attrname)
-			store_attribute(&rr->rr_attrs, attrname, ret, flags);
-	}
-
-	return 0;
-}
-
-
-/**
-   Get and store attributes for a given instance of a resource.
-
-   @param doc		Pre-parsed XML document pointer.
-   @param ctx		Pre-allocated XML XPath context pointer.
-   @param base		XPath prefix to search
-   @param rr		Resource rule to store new information in.
-   @return		0
- */
-int
-_get_childtypes(xmlDocPtr doc, xmlXPathContextPtr ctx, char *base,
-		resource_rule_t *rr)
-{
-	char *ret, *childname, xpath[256];
-	int x, startlevel = 0, stoplevel = 0, forbid = 0;
-
-	for (x = 1; 1; x++) {
-		snprintf(xpath, sizeof(xpath), "%s/child[%d]/@type",
-			 base, x);
-
-		ret = xpath_get_one(doc,ctx,xpath);
-		if (!ret)
-			break;
-
-		startlevel = stoplevel = forbid = 0;
-		childname = ret;
-
-		/*
-		   Try to get the start level if it exists
-		 */
-		snprintf(xpath, sizeof(xpath), "%s/child[%d]/@start",
-			 base, x);
-		if ((ret = xpath_get_one(doc,ctx,xpath))) {
-			startlevel = atoi(ret);
-			free(ret);
-		}
-
-
-		/*
-		   Try to get the stop level if it exists
-		 */
-		snprintf(xpath, sizeof(xpath), "%s/child[%d]/@stop",
-			 base, x);
-		if ((ret = xpath_get_one(doc,ctx,xpath))) {
-			stoplevel = atoi(ret);
-			free(ret);
-		}
-
-		/*
-		   Get the 'forbidden' flag if it exists
-		 */
-		snprintf(xpath, sizeof(xpath), "%s/child[%d]/@forbid",
-			 base, x);
-		if ((ret = xpath_get_one(doc,ctx,xpath))) {
-			forbid = atoi(ret);
-			free(ret);
-		}
-
-		/*
-		   Store the attribute.  We'll ensure all required
-		   attributes are present soon.
-		 */
-		if (childname)
-			store_childtype(&rr->rr_childtypes, childname,
-					startlevel, stoplevel, forbid, 0);
-	}
-
-	return 0;
-}
-
-
-/**
-  Read a file from a stdout pipe.
- */
-int
-read_pipe(int fd, char **file, size_t *length)
-{
-	char buf[4096];
-	int n, done = 0;
-
-	*file = NULL;
-	*length = 0;
-
-	while (!done) {
-
-		n = read(fd, buf, sizeof(buf));
-		if (n < 0) {
-
-			if (errno == EINTR)
-				continue;
-
-			if (*file)
-				free(*file);
-			return -1;
-		}
-
-		if (n == 0 && (!*length))
-			return 0;
-
-		if (n == 0) {
-			done = 1;
-		}
-
-		if (*file)
-			*file = realloc(*file, (*length) + n + done);
-		else
-			*file = malloc(n + done);
-
-		if (!*file)
-			return -1;
-
-		memcpy((*file) + (*length), buf, n);
-		*length += (done + n);
-	}
-
-	/* Null terminator */
-	(*file)[(*length) - 1] = 0;
-
-	return 0;
-}
-
-
-xmlDocPtr
-read_resource_agent_metadata(char *filename)
-{
-	int pid;
-	int _pipe[2];
-	char *data;
-	size_t size;
-	xmlDocPtr doc;
-
-	if (pipe(_pipe) == -1)
-		return NULL;
-
-	pid = fork();
-	if (pid == -1) {
-		close(_pipe[0]);
-		close(_pipe[1]);
-	}
-
-	if (pid == 0) {
-		/* child */
-		close(0);
-		close(1);
-		close(2);
-
-		close(_pipe[0]);
-		dup2(_pipe[1], 1);
-		close(_pipe[1]);
-		
-		/* exec */
-		execl(filename, filename, "meta-data", NULL);
-		exit(1);
-	}
-
-	close(_pipe[1]);
-	/* parent */
-	if (read_pipe(_pipe[0], &data, &size) == -1) {
-		close(_pipe[0]);
-		return NULL;
-	}
-
-	waitpid(pid, NULL, 0);
-	close(_pipe[0]);
-
-	if (!size)
-		return NULL;
-
-	doc = xmlParseMemory(data, size);
-	free(data);
-	return doc;
-}
-
-
-/**
-   Load the XML rule set for a resource and store attributes, constructing
-   a new resource_t structure.
-
-   @param filename	File name to load rules from
-   @param rules		Rule list to add new rules to
-   @return		0
- */
-int
-load_resource_rulefile(char *filename, resource_rule_t **rules)
-{
-	resource_rule_t *rr = NULL;
-	xmlDocPtr doc = NULL;
-	xmlXPathContextPtr ctx = NULL;
-	int ruleid=0;
-	char *type;
-	char base[256];
-
-	doc = read_resource_agent_metadata(filename);
-	if (!doc)
-		return 0;
-	ctx = xmlXPathNewContext(doc);
-
-	do {
-		/* Look for resource types */
-		snprintf(base, sizeof(base), "/resource-agent[%d]/@name",
-			 ++ruleid);
-		type = xpath_get_one(doc, ctx, base);
-		if (!type)
-			break;
-		
-		if (!strcasecmp(type, "action")) {
-#ifdef NO_CCS
-			fprintf(stderr,
-				"Error: Resource type '%s' is reserved",
-				type);
-#else
-			logt_print(LOG_ERR,
-				"Error: Resource type '%s' is reserved",
-				type);
-#endif
-			free(type);
-			break;
-		}
-
-		rr = malloc(sizeof(*rr));
-		if (!rr)
-			break;
-		memset(rr,0,sizeof(*rr));
-
-		rr->rr_flags = RF_INIT | RF_DESTROY;
-		rr->rr_type = type;
-		snprintf(base, sizeof(base), "/resource-agent[%d]", ruleid);
-
-		/*
-		   First, grab the global attributes if existent
-		 */
-		_get_version(doc, ctx, base, rr);
-
-		snprintf(base, sizeof(base),
-			 "/resource-agent[%d]/special[@tag=\"rgmanager\"]",
-			 ruleid);
-		_get_maxparents(doc, ctx, base, rr);
-		_get_rule_flag(doc, ctx, base, rr, "init_on_add", RF_INIT);
-		_get_rule_flag(doc, ctx, base, rr, "destroy_on_delete", RF_DESTROY);
-		rr->rr_agent = strdup(filename);
-
-		/*
-		   Second, add the children fields
-		 */
-		_get_childtypes(doc, ctx, base, rr);
-
-		/*
-		   Get the OCF status check intervals/monitor.
-		 */
-		snprintf(base, sizeof(base), "/resource-agent[%d]/actions",
-			 ruleid);
-		_get_actions(doc, ctx, base, rr);
-
-	
-		/*
-		   Last, load the attributes from our XML file and their
-		   respective instantiations from CCS
-		 */
-		snprintf(base, sizeof(base),
-			 "/resource-agent[%d]/parameters", ruleid);
-		if (_get_rule_attrs(doc, ctx, base, rr) < 0) {
-			destroy_resource_rule(rr);
-			rr = NULL;
-		}
-
-		if (!rr)
-			continue;
-
-		if (store_rule(rules, rr) != 0) {
-			destroy_resource_rule(rr);
-			rr = NULL;
-		}
-	} while (1);
-
-	if (ctx)
-		xmlXPathFreeContext(ctx);
-	if (doc)
-		xmlFreeDoc(doc);
-
-	return 0;
-}
-
-
-/**
-   Load all the resource rules we can find from our resource root 
-   directory.
-
-   @param rules		Rule list to create/add to
-   @return		0 on success, -1 on failure.  Sucess does not
-   			imply any rules have been found; only that no
-			errors were encountered.
-  */
-int
-load_resource_rules(const char *rpath, resource_rule_t **rules)
-{
-	DIR *dir;
-	struct dirent *de;
-	char *fn, *dot;
-	char path[2048];
-	struct stat st_buf;
-
-	dir = opendir(rpath);
-	if (!dir)
-		return -1;
-
-	xmlInitParser();
-	while ((de = readdir(dir))) {
-		
-		fn = basename(de->d_name);
-		if (!fn)
-			continue;
-		
-		/* Ignore files with common backup extension */
-		if ((fn != NULL) && (strlen(fn) > 0) && 
-			(fn[strlen(fn)-1] == '~')) 
-			continue;
-
- 		dot = strrchr(fn, '.');
- 		if (dot) {
- 			/* Ignore RPM installed save files, patches,
- 			   diffs, etc. */
- 			if (!strncasecmp(dot, ".rpm", 4)) {
- 				fprintf(stderr, "Warning: "
- 					"Ignoring %s/%s: Bad extension %s\n",
- 					rpath, de->d_name, dot);
- 				continue;
- 			}
- 		}
-
-		snprintf(path, sizeof(path), "%s/%s",
-			 rpath, de->d_name);
-		
-		if (stat(path, &st_buf))
-			continue;
-		
-		if (S_ISDIR(st_buf.st_mode))
-			continue;
-		
-  		if (st_buf.st_mode & (S_IXUSR|S_IXOTH|S_IXGRP)) {
-  			printf("Loading resource rule from %s\n", path);
-   			load_resource_rulefile(path, rules);
-  		}
-	}
-	xmlCleanupParser();
-
-	closedir(dir);
-
-	return 0;
-}
-
-
-/**
-   Find a resource rule given its type.
-
-   @param rulelist	Rule list to search
-   @param type		Rule type identifier
-   @return		Resource rule or NULL if not found.
- */
-resource_rule_t *
-find_rule_by_type(resource_rule_t **rulelist, char *type)
-{
-	resource_rule_t *curr = NULL;
-
-	list_do(rulelist, curr) {
-		if (!strcmp(curr->rr_type, type))
-			return curr;
-	} while (!list_done(rulelist, curr));
-
-	return NULL;
-}
diff --git a/rgmanager/src/daemons/restart_counter.c b/rgmanager/src/daemons/restart_counter.c
deleted file mode 100644
index 9b2e3c6..0000000
--- a/rgmanager/src/daemons/restart_counter.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/* Time-based restart counters for rgmanager */
-
-#include <stdio.h>
-#include <list.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <time.h>
-#include <restart_counter.h>
-
-
-
-#define RESTART_INFO_MAGIC 0x184820ab
-
-typedef struct {
-	list_head();
-	time_t restart_time;
-} restart_item_t;
-
-typedef struct {
-	int magic;
-	time_t expire_timeout;
-	int max_restarts;
-	int restart_count;
-	restart_item_t *restart_nodes;
-} restart_info_t;
-
-
-#define VALIDATE(arg, ret) \
-do { \
-	if (((restart_info_t *)arg)->magic != RESTART_INFO_MAGIC) {\
-		errno = EINVAL; \
-		return ret; \
-	} \
-} while(0)
-
-
-/* Remove expired restarts */
-static int
-restart_timer_purge(restart_counter_t arg, time_t now)
-{
-	restart_info_t *restarts = (restart_info_t *)arg;
-	restart_item_t *i;
-	int x, done = 0;
-
-	VALIDATE(arg, -1);
-
-	/* No timeout */
-	if (restarts->expire_timeout == 0)
-		return 0;
-
-	do {
-		done = 1;
-		list_for(&restarts->restart_nodes, i, x) {
-			if ((now - i->restart_time) >=
-			    restarts->expire_timeout) {
-				restarts->restart_count--;
-				list_remove(&restarts->restart_nodes, i);
-				done = 0;
-				break;
-			}
-		}
-	} while(!done);
-
-	return 0;
-}
-
-
-int
-restart_count(restart_counter_t arg)
-{
-	restart_info_t *restarts = (restart_info_t *)arg;
-	time_t now;
-
-	VALIDATE(arg, -1);
-	now = time(NULL);
-	restart_timer_purge(arg, now);
-	return restarts->restart_count;
-}
-
-
-/* Add a restart entry to the list.  Returns 1 if restart
-   count is exceeded */
-int
-restart_add(restart_counter_t arg)
-{
-	restart_info_t *restarts = (restart_info_t *)arg;
-	restart_item_t *i;
-	time_t t;
-
-	if (!arg)
-		/* No max restarts / threshold = always
-		   ok to restart! */
-		return 0;
-
-	VALIDATE(arg, -1);
-
-	i = malloc(sizeof(*i));
-	if (!i) {
-		return -1;
-	}
-
-	t = time(NULL);
-	i->restart_time = t;
-
-	list_insert(&restarts->restart_nodes, i);
-	restarts->restart_count++;
-
-	/* Check and remove old entries */
-	restart_timer_purge(restarts, t);
-
-	if (restarts->restart_count > restarts->max_restarts)
-		return 1;
-
-	return 0;
-}
-
-
-int
-restart_clear(restart_counter_t arg)
-{
-	restart_info_t *restarts = (restart_info_t *)arg;
-	restart_item_t *i;
-
-	VALIDATE(arg, -1);
-	while ((i = restarts->restart_nodes)) {
-		list_remove(&restarts->restart_nodes, i);
-		free(i);
-	}
-
-	restarts->restart_count = 0;
-
-	return 0;
-}
-
-
-restart_counter_t
-restart_init(time_t expire_timeout, int max_restarts)
-{
-	restart_info_t *info;
-
-	if (max_restarts < 0) {
-		errno = EINVAL;
-		return NULL;
-	}
-
-	info = malloc(sizeof(*info));
-	if (info == NULL)
-		return NULL;
-
-	info->magic = RESTART_INFO_MAGIC;
-	info->expire_timeout = expire_timeout;
-	info->max_restarts = max_restarts;
-	info->restart_count = 0;
-
-	return (void *)info;
-}
-
-
-int
-restart_cleanup(restart_counter_t arg)
-{
-	VALIDATE(arg, -1);
-	restart_clear(arg);
-	free(arg);
-	return 0;
-}
diff --git a/rgmanager/src/daemons/restree.c b/rgmanager/src/daemons/restree.c
deleted file mode 100644
index ecef62c..0000000
--- a/rgmanager/src/daemons/restree.c
+++ /dev/null
@@ -1,1682 +0,0 @@
-#include <libxml/parser.h>
-#include <libxml/xmlmemory.h>
-#include <libxml/xpath.h>
-#include <ccs.h>
-#include <rg_locks.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <resgroup.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <list.h>
-#include <restart_counter.h>
-#include <reslist.h>
-#include <pthread.h>
-#include <logging.h>
-#include <assert.h>
-
-#ifdef INTERNAL_MALLOC
-void malloc_zap_mutex(void);
-#endif
-
-/* XXX from resrules.c */
-int store_childtype(resource_child_t **childp, char *name, int start,
-		    int stop, int forbid, int flags);
-int _res_op(resource_node_t **tree, resource_t *first, char *type,
-	    void * __attribute__((unused))ret, int op);
-static inline int
-_res_op_internal(resource_node_t **tree, resource_t *first,
-		 char *type, void *__attribute__((unused))ret, int realop,
-		 resource_node_t *node);
-void print_env(char **env);
-static inline int _res_op_internal(resource_node_t **tree, resource_t *first,
-		 char *type, void *__attribute__((unused))ret, int realop,
-		 resource_node_t *node);
-
-/* XXX from reslist.c */
-void * act_dup(resource_act_t *acts);
-
-
-/* XXX from reslist.c */
-void * act_dup(resource_act_t *acts);
-
-
-/* XXX from reslist.c */
-void * act_dup(resource_act_t *acts);
-time_t get_time(char *action, int depth, resource_node_t *node);
-
-
-
-const char *ocf_errors[] = {
-	"success",				// 0
-	"generic error",			// 1
-	"invalid argument(s)",			// 2
-	"function not implemented",		// 3
-	"insufficient privileges",		// 4
-	"program not installed",		// 5
-	"program not configured",		// 6
-	"not running",
-	NULL
-};
-
-
-/* XXX MEGA HACK */
-#ifdef NO_CCS
-static int _no_op_mode_ = 0;
-void
-_no_op_mode(int arg)
-{
-	_no_op_mode_ = arg;
-}
-#endif
-
-
-/**
-   ocf_strerror
- */
-const char *
-ocf_strerror(int ret)
-{
-	if (ret >= 0 && ret < OCF_RA_MAX)
-		return ocf_errors[ret];
-
-	return "unspecified";
-}
-
-
-/**
-   Destroys an environment variable array.
-
-   @param env		Environment var to kill
-   @see			build_env
- */
-static void
-kill_env(char **env)
-{
-	int x;
-
-	for (x = 0; env[x]; x++)
-		free(env[x]);
-	free(env);
-}
-
-
-/**
-   Adds OCF environment variables to a preallocated  environment var array
-
-   @param res		Resource w/ additional variable stuff
-   @param args		Preallocated environment variable array
-   @see			build_env
- */
-static void
-add_ocf_stuff(resource_t *res, char **env, int depth, int refcnt)
-{
-	char ver[10];
-	char *minor, *val;
-	size_t n;
-
-	if (!res->r_rule->rr_version)
-		strncpy(ver, OCF_API_VERSION, sizeof(ver)-1);
-	else 
-		strncpy(ver, res->r_rule->rr_version, sizeof(ver)-1);
-
-	minor = strchr(ver, '.');
-	if (minor) {
-		*minor = 0;
-		minor++;
-	} else
-		minor = "0";
-		
-	/*
-	   Store the OCF major version
-	 */
-	n = strlen(OCF_RA_VERSION_MAJOR_STR) + strlen(ver) + 2;
-	val = malloc(n);
-	if (!val)
-		return;
-	snprintf(val, n, "%s=%s", OCF_RA_VERSION_MAJOR_STR, ver);
-	*env = val; env++;
-
-	/*
-	   Store the OCF minor version
-	 */
-	n = strlen(OCF_RA_VERSION_MINOR_STR) + strlen(minor) + 2;
-	val = malloc(n);
-	if (!val)
-		return;
-	snprintf(val, n, "%s=%s", OCF_RA_VERSION_MINOR_STR, minor);
-	*env = val; env++;
-
-	/*
-	   Store the OCF root
-	 */
-	n = strlen(OCF_ROOT_STR) + strlen(OCF_ROOT) + 2;
-	val = malloc(n);
-	if (!val)
-		return;
-	snprintf(val, n, "%s=%s", OCF_ROOT_STR, OCF_ROOT);
-	*env = val; env++;
-
-	/*
-	   Store the OCF Resource Instance (primary attr)
-	 */
-	n = strlen(OCF_RESOURCE_INSTANCE_STR) +
-		strlen(res->r_rule->rr_type) + 1 +
-		strlen(res->r_attrs[0].ra_value) + 2;
-	val = malloc(n);
-	if (!val)
-		return;
-	snprintf(val, n, "%s=%s:%s", OCF_RESOURCE_INSTANCE_STR,
-		 res->r_rule->rr_type,
-		 res->r_attrs[0].ra_value);
-	*env = val; env++;
-
-	/*
-	   Store the OCF Resource Type
-	 */
-	n = strlen(OCF_RESOURCE_TYPE_STR) +
-		strlen(res->r_rule->rr_type) + 2;
-	val = malloc(n);
-	if (!val)
-		return;
-	snprintf(val, n, "%s=%s", OCF_RESOURCE_TYPE_STR, 
-		 res->r_rule->rr_type);
-	*env = val; env++;
-
-	/*
-	   Store the OCF Check Level (0 for now)
-	 */
-	snprintf(ver, sizeof(ver), "%d", depth);
-	n = strlen(OCF_CHECK_LEVEL_STR) + strlen(ver) + 2;
-	val = malloc(n);
-	if (!val)
-		return;
-	snprintf(val, n, "%s=%s", OCF_CHECK_LEVEL_STR, ver);
-	*env = val; env++;
-
-	/*
-	   Store the resource local refcnt (0 for now)
-	 */
-	snprintf(ver, sizeof(ver), "%d", refcnt);
-	n = strlen(OCF_REFCNT_STR) + strlen(ver) + 2;
-	val = malloc(n);
-	if (!val)
-		return;
-	snprintf(val, n, "%s=%s", OCF_REFCNT_STR, ver);
-	*env = val; env++;
-}
-
-
-/**
-   Allocate and fill an environment variable array.
-
-   @param node		Node in resource tree to use for parameters
-   @param depth		Depth (status/monitor/etc.)
-   @return		Newly allocated environment array or NULL if
-   			one could not be formed.
-   @see			kill_env res_exec add_ocf_stuff
- */
-static char **
-build_env(resource_node_t *node, int depth, int refcnt)
-{
-	resource_t *res = node->rn_resource;
-	char **env;
-	char *val;
-	int x, attrs, n;
-
-	for (attrs = 0; res->r_attrs && res->r_attrs[attrs].ra_name; attrs++);
-	attrs += 8; /*
-		   Leave space for:
-		   OCF_RA_VERSION_MAJOR
-		   OCF_RA_VERSION_MINOR
-		   OCF_ROOT
-		   OCF_RESOURCE_INSTANCE
-		   OCF_RESOURCE_TYPE
-		   OCF_CHECK_LEVEL
-		   OCF_RESKEY_RGMANAGER_meta_refcnt
-		   (null terminator)
-		 */
-
-	env = malloc(sizeof(char *) * attrs);
-	if (!env)
-		return NULL;
-
-	memset(env, 0, sizeof(char *) * attrs);
-
-	/* Reset */
-	attrs = 0;
-	for (x = 0; res->r_attrs && res->r_attrs[x].ra_name; x++) {
-
-		val = attr_value(node, res->r_attrs[x].ra_name);
-		if (!val)
-			continue;
-
-		/* Strlen of both + '=' + 'OCF_RESKEY' + '\0' terminator' */
-		n = strlen(res->r_attrs[x].ra_name) + strlen(val) + 2 +
-			strlen(OCF_RES_PREFIX);
-
-		env[attrs] = malloc(n);
-		if (!env[attrs]) {
-			kill_env(env);
-			return NULL;
-		}
-
-		/* Prepend so we don't conflict with normal shell vars */
-		snprintf(env[attrs], n, "%s%s=%s", OCF_RES_PREFIX,
-			 res->r_attrs[x].ra_name, val);
-
-#if 0
-		/* Don't uppercase; OCF-spec */
-		for (n = 0; env[x][n] != '='; n++)
-			env[x][n] &= ~0x20; /* Convert to uppercase */
-#endif
-		++attrs;
-	}
-
-	add_ocf_stuff(res, &env[attrs], depth, refcnt);
-
-	return env;
-}
-
-
-/**
-   Print info in an environment array
-
-   @param env		Environment to print.
- */
-void
-print_env(char **env)
-{
-	int x;
-
-	for (x = 0; env[x]; x++) {
-		printf("%s\n", env[x]);
-	}
-}
-
-
-/**
-   Set all signal handlers to default for exec of a script.
-   ONLY do this after a fork().
- */
-void
-restore_signals(void)
-{
-	sigset_t set;
-	int x;
-
-	for (x = 1; x < _NSIG; x++)
-		signal(x, SIG_DFL);
-
-	sigfillset(&set);
-	sigprocmask(SIG_UNBLOCK, &set, NULL);
-}
-
-
-/** Find the index for a given operation / depth in a resource node */
-int
-res_act_index(resource_node_t *node, const char *op_str, int depth)
-{
-	int x = 0;
-	resource_act_t *act;
-
-	for (x = 0; node->rn_actions[x].ra_name; x++) {
-		act = &node->rn_actions[x];
-		if (depth != act->ra_depth)
-			continue;
-		if (strcasecmp(act->ra_name, op_str))
-			continue;
-		return x;
-	}
-
-	return -1;
-}
-
-
-/**
-   Execute a resource-specific agent for a resource node in the tree.
-
-   @param node		Resource tree node we're dealing with
-   @param op		Operation to perform (stop/start/etc.)
-   @param depth		OCF Check level/depth
-   @return		Return value of script.
-   @see			build_env
- */
-int
-res_exec(resource_node_t *node, int op, const char *arg, int depth)
-{
-	int childpid, pid;
-	int ret = 0;
-	int act_index;
-	time_t sleeptime = 0;
-	char **env = NULL;
-	resource_t *res = node->rn_resource;
-	const char *op_str = agent_op_str(op);
-	char fullpath[2048];
-
-	if (!res->r_rule->rr_agent)
-		return 0;
-
-	/* Get the action index for later */
-	act_index = res_act_index(node, op_str, depth);
-
-	/* This shouldn't happen, but execing an action for which 
-	   we have an incorrect depth or no status action does not
-	   indicate a problem.  This allows people writing resource
-	   agents to write agents which have no status/monitor function
-	   at their option, in violation of the OCF RA API specification. */
-	if (act_index < 0)
-		return 0;
-
-#ifdef DEBUG
-	env = build_env(node, depth, node->rn_resource->r_incarnations);
-	if (!env)
-		return -errno;
-#endif
-
-#ifdef NO_CCS
-	if (_no_op_mode_) {
-		printf("[%s] %s:%s\n", op_str, res->r_rule->rr_type,
-		       res->r_attrs->ra_value);
-		return 0;
-	}
-#endif
-
-	childpid = fork();
-	if (childpid < 0)
-		return -errno;
-
-	if (!childpid) {
-		/* Child */ 
-#ifdef INTERNAL_MALLOC
-		malloc_zap_mutex();
-#endif
-#if 0
-		printf("Exec of script %s, action %s type %s\n",
-			res->r_rule->rr_agent, agent_op_str(op),
-			res->r_rule->rr_type);
-#endif
-
-#ifndef DEBUG
-		env = build_env(node, depth, node->rn_resource->r_incarnations);
-#endif
-
-		if (!env)
-			exit(-ENOMEM);
-
-		if (res->r_rule->rr_agent[0] != '/')
-			snprintf(fullpath, sizeof(fullpath), "%s/%s",
-				 RESOURCE_ROOTDIR, res->r_rule->rr_agent);
-		else
-			snprintf(fullpath, sizeof(fullpath), "%s",
-				 res->r_rule->rr_agent);
-
-		restore_signals();
-
-		if (arg)
-			execle(fullpath, fullpath, op_str, arg, NULL, env);
-		else
-			execle(fullpath, fullpath, op_str, NULL, env);
-	}
-
-#ifdef DEBUG
-	kill_env(env);
-#endif
-
-	if (node->rn_flags & RF_ENFORCE_TIMEOUTS)
-		sleeptime = node->rn_actions[act_index].ra_timeout;
-
-	if (sleeptime > 0) {
-
-		/* There's a better way to do this, but this is easy and
-		   doesn't introduce signal woes */
-		while (sleeptime) {
-			pid = waitpid(childpid, &ret, WNOHANG);
-
-			if (pid == childpid)
-				break;
-			sleep(1);
-			--sleeptime;
-		}
-
-		if (pid != childpid && sleeptime == 0) {
-
-			logt_print(LOG_ERR,
-			       "%s on %s:%s timed out after %d seconds\n",
-			       op_str, res->r_rule->rr_type,
-			       res->r_attrs->ra_value,
-			       (int)node->rn_actions[act_index].ra_timeout);
-			
-			/* This can't be guaranteed to kill even the child
-			   process if the child is in disk-wait :( */
-			kill(childpid, SIGKILL);
-			sleep(1);
-			pid = waitpid(childpid, &ret, WNOHANG);
-			if (pid == 0) {
-				logt_print(LOG_ERR,
-				       "Task %s PID %d did not exit "
-				       "after SIGKILL\n",
-				       op_str, childpid);
-			}
-
-			/* Always an error if we time out */
-			return 1;
-		}
-	} else {
-		do {
-			pid = waitpid(childpid, &ret, 0);
-			if ((pid < 0) && (errno == EINTR))
-				continue;
-		} while (0);
-	}
-
-	if (WIFEXITED(ret)) {
-
-		ret = WEXITSTATUS(ret);
-
-#ifndef NO_CCS
-		if ((op == RS_STATUS &&
-		     node->rn_state == RES_STARTED && ret) ||
-		    (op != RS_STATUS && ret)) {
-#else
-		if (ret) {
-#endif
-			logt_print(LOG_NOTICE,
-			       "%s on %s \"%s\" returned %d (%s)\n",
-			       op_str, res->r_rule->rr_type,
-			       res->r_attrs->ra_value, ret,
-			       ocf_strerror(ret));
-		}
-
-		return ret;
-	}
-
-	if (!WIFSIGNALED(ret))
-		assert(0);
-
-	return -EFAULT;
-}
-
-
-static inline void
-assign_restart_policy(resource_t *curres, resource_node_t *parent,
-		      resource_node_t *node)
-{
-	char *val;
-	int max_restarts = 0;
-	time_t restart_expire_time = 0;
-
-	node->rn_restart_counter = NULL;
-
-	if (!curres || !node)
-		return;
-	if (parent) /* Non-parents don't get one for now */
-		return;
-
-	val = res_attr_value(curres, "max_restarts");
-	if (!val)
-		return;
-	max_restarts = atoi(val);
-	if (max_restarts <= 0)
-		return;
-	val = res_attr_value(curres, "restart_expire_time");
-	if (val) {
-		restart_expire_time = (time_t)expand_time(val);
-		if ((int64_t)restart_expire_time < 0)
-			return;
-	}
-
-	node->rn_restart_counter = restart_init(restart_expire_time,
-						max_restarts);
-}
-
-
-static inline int
-do_load_resource(int ccsfd, char *base,
-	         resource_rule_t *rule,
-	         resource_node_t **tree,
-		 resource_t **reslist,
-		 resource_node_t *parent,
-		 resource_node_t **newnode)
-{
-	char tok[512];
-	char *ref;
-	resource_node_t *node;
-	resource_t *curres;
-
-	snprintf(tok, sizeof(tok), "%s/@ref", base);
-
-#ifndef NO_CCS
-	if (ccs_get(ccsfd, tok, &ref) != 0) {
-#else
-	if (conf_get(tok, &ref) != 0) {
-#endif
-		/* There wasn't an existing resource. See if there
-		   is one defined inline */
-		curres = load_resource(ccsfd, rule, base);
-		if (!curres) {
-			/* No ref and no new one inline == 
-			   no more of the selected type */
-			return 1;
-		}
-
-	       	if (store_resource(reslist, curres) != 0) {
-	 		printf("Error storing %s resource\n",
-	 		       curres->r_rule->rr_type);
-	 		destroy_resource(curres);
-			return -1;
-	 	}
-
-		curres->r_flags = RF_INLINE;
-
-	} else {
-
-		curres = find_resource_by_ref(reslist, rule->rr_type,
-						      ref);
-		if (!curres) {
-			printf("Error: Reference to nonexistent "
-			       "resource %s (type %s)\n", ref,
-			       rule->rr_type);
-			free(ref);
-			return -1;
-		}
-
-		if (curres->r_flags & RF_INLINE) {
-			printf("Error: Reference to inlined "
-			       "resource %s (type %s) is illegal\n",
-			       ref, rule->rr_type);
-			free(ref);
-			return -1;
-		}
-		free(ref);
-	}
-
-	/* Load it if its max refs hasn't been exceeded */
-	if (rule->rr_maxrefs && (curres->r_refs >= rule->rr_maxrefs)){
-		printf("Warning: Max references exceeded for resource"
-		       " %s (type %s)\n", curres->r_attrs[0].ra_name,
-		       rule->rr_type);
-		return -1;
-	}
-
-	node = malloc(sizeof(*node));
-	if (!node)
-		return -1;
-
-	memset(node, 0, sizeof(*node));
-
-	//printf("New resource tree node: %s:%s \n", curres->r_rule->rr_type,curres->r_attrs->ra_value);
-
-	node->rn_child = NULL;
-	node->rn_parent = parent;
-	node->rn_resource = curres;
-	node->rn_state = RES_STOPPED;
-	node->rn_flags = 0;
-	node->rn_actions = (resource_act_t *)act_dup(curres->r_actions);
-	assign_restart_policy(curres, parent, node);
-
-	snprintf(tok, sizeof(tok), "%s/@__independent_subtree", base);
-#ifndef NO_CCS
-	if (ccs_get(ccsfd, tok, &ref) == 0) {
-#else
-	if (conf_get(tok, &ref) == 0) {
-#endif
-		if (atoi(ref) > 0 || strcasecmp(ref, "yes") == 0)
-			node->rn_flags |= RF_INDEPENDENT;
-		free(ref);
-	}
-
-	snprintf(tok, sizeof(tok), "%s/@__enforce_timeouts", base);
-#ifndef NO_CCS
-	if (ccs_get(ccsfd, tok, &ref) == 0) {
-#else
-	if (conf_get(tok, &ref) == 0) {
-#endif
-		if (atoi(ref) > 0 || strcasecmp(ref, "yes") == 0)
-			node->rn_flags |= RF_ENFORCE_TIMEOUTS;
-		free(ref);
-	}
-
-	curres->r_refs++;
-
-	*newnode = node;
-
-	list_insert(tree, node);
-
-	return 0;
-}
-
-
-/**
-   Build the resource tree.  If a new resource is defined inline, add it to
-   the resource list.  All rules, however, must have already been read in.
-
-   @param ccsfd		File descriptor connected to CCS
-   @param tree		Tree to modify/insert on to
-   @param parent	Parent node, if one exists.
-   @param rule		Rule surrounding the new node
-   @param rulelist	List of all rules allowed in the tree.
-   @param reslist	List of all currently defined resources
-   @param base		Base CCS path.
-   @see			destroy_resource_tree
- */
-#define RFL_FOUND 0x1
-#define RFL_FORBID 0x2
-static int
-build_tree(int ccsfd, resource_node_t **tree,
-	   resource_node_t *parent,
-	   resource_rule_t *rule,
-	   resource_rule_t **rulelist,
-	   resource_t **reslist, char *base)
-{
-	char tok[512];
-	resource_rule_t *childrule;
-	resource_node_t *node = NULL;
-	char *ref;
-	char *tmp;
-	int ccount = 0, x = 0, y = 0, flags = 0;
-
-	//printf("DESCEND: %s / %s\n", rule?rule->rr_type:"(none)", base);
-
-	/* Pass 1: typed / defined children */
-	for (y = 0; rule && rule->rr_childtypes &&
-     	     rule->rr_childtypes[y].rc_name; y++) {
-		
-	
-		flags = 0;
-		list_for(rulelist, childrule, x) {
-			if (strcmp(rule->rr_childtypes[y].rc_name,
-				   childrule->rr_type))
-				continue;
-
-			flags |= RFL_FOUND;
-
-			if (rule->rr_childtypes[y].rc_forbid)
-				flags |= RFL_FORBID;
-
-			break;
-		}
-
-		if (flags & RFL_FORBID)
-			/* Allow all *but* forbidden */
-			continue;
-
-		if (!(flags & RFL_FOUND))
-			/* Not found?  Wait for pass 2 */
-			continue;
-
-		//printf("looking for %s %s @ %s\n",
-			//rule->rr_childtypes[y].rc_name,
-			//childrule->rr_type, base);
-		for (x = 1; ; x++) {
-
-			/* Search for base/type[x]/@ref - reference an existing
-			   	resource */
-			snprintf(tok, sizeof(tok), "%s/%s[%d]", base,
-				 childrule->rr_type, x);
-
-			flags = 1;
-			switch(do_load_resource(ccsfd, tok, childrule, tree,
-						reslist, parent, &node)) {
-			case -1:
-				continue;
-			case 1:
-				/* 1 == no more */
-				//printf("No resource found @ %s\n", tok);
-				flags = 0;
-				break;
-			case 0:
-				break;
-			}
-			if (!flags)
-				break;
-
-			/* Got a child :: bump count */
-			snprintf(tok, sizeof(tok), "%s/%s[%d]", base,
-				 childrule->rr_type, x);
-
-			/* Kaboom */
-			build_tree(ccsfd, &node->rn_child, node, childrule,
-				   rulelist, reslist, tok);
-
-		}
-	}
-
-
-	/* Pass 2: untyped children */
-	for (ccount=1; ; ccount++) {
-		snprintf(tok, sizeof(tok), "%s/child::*[%d]", base, ccount);
-
-#ifndef NO_CCS
-		if (ccs_get(ccsfd, tok, &ref) != 0) {
-#else
-		if (conf_get(tok, &ref) != 0) {
-#endif
-			/* End of the line. */
-			//printf("End of the line: %s\n", tok);
-			break;
-		}
-
-		tmp = strchr(ref, '=');
-		if (tmp) {
-			*tmp = 0;
-		} else {
-			/* no = sign... bad */
-			free(ref);
-			continue;
-		}
-
-		/* Find the resource rule */
-		flags = 0;
-		list_for(rulelist, childrule, x) {
-			if (!strcasecmp(childrule->rr_type, ref)) {
-				/* Ok, matching rule found */
-				flags = 1;
-				break;
-			}
-		}
-		/* No resource rule matching the child?  Press on... */
-		if (!flags) {
-			free(ref);
-			continue;
-		}
-
-		flags = 0;
-		/* Don't descend on anything we should have already picked
-		   up on in the above loop */
-		for (y = 0; rule && rule->rr_childtypes &&
-		     rule->rr_childtypes[y].rc_name; y++) {
-			/* SKIP defined child types of any type */
-			if (strcmp(rule->rr_childtypes[y].rc_name, ref))
-				continue;
-			if (rule->rr_childtypes[y].rc_flags == 0) {
-				/* 2 = defined as a real child */
-				flags = 2;
-				break;
-			}
-
-			flags = 1;
-			break;
-		}
-
-		free(ref);
-		if (flags == 2)
-			continue;
-
-		x = 1;
-		switch(do_load_resource(ccsfd, tok, childrule, tree,
-				        reslist, parent, &node)) {
-		case -1:
-			continue;
-		case 1:
-			/* no more found */
-			x = 0;
-			printf("No resource found @ %s\n", tok);
-			break;
-		case 0:
-			/* another is found */
-			break;
-		}
-		if (!x) /* no more found */
-			break;
-
-		/* childrule = rule set of this child at this point */
-		/* tok = set above; if we got this far, we're all set */
-		/* Kaboom */
-
-		build_tree(ccsfd, &node->rn_child, node, childrule,
-			   rulelist, reslist, tok);
-	}
-
-	//printf("ASCEND: %s / %s\n", rule?rule->rr_type:"(none)", base);
-	return 0;
-}
-
-
-/**
-   Set up to call build_tree.  Hides the nastiness from the user.
-
-   @param ccsfd		File descriptor connected to CCS
-   @param tree		Tree pointer.  Should start as a pointer to NULL.
-   @param rulelist	List of all rules allowed
-   @param reslist	List of all currently defined resources
-   @return 		0
-   @see			build_tree destroy_resource_tree
- */
-int
-build_resource_tree(int ccsfd, resource_node_t **tree,
-		    resource_rule_t **rulelist,
-		    resource_t **reslist)
-{
-	resource_node_t *root = NULL;
-	char tok[512];
-
-	snprintf(tok, sizeof(tok), "%s", RESOURCE_TREE_ROOT);
-
-	/* Find and build the list of root nodes */
-	build_tree(ccsfd, &root, NULL, NULL/*curr*/, rulelist, reslist, tok);
-
-	if (root)
-		*tree = root;
-
-	return 0;
-}
-
-
-/**
-   Deconstruct a resource tree.
-
-   @param tree		Tree to obliterate.
-   @see			build_resource_tree
- */
-void
-destroy_resource_tree(resource_node_t **tree)
-{
-	resource_node_t *node = NULL;
-
-	while ((node = *tree)) {
-		if ((*tree)->rn_child)
-			destroy_resource_tree(&(*tree)->rn_child);
-
-		list_remove(tree, node);
-
-		if (node->rn_restart_counter) {
-			restart_cleanup(node->rn_restart_counter);
-		}
-
-		if(node->rn_actions){
-			free(node->rn_actions);
-		}
-		free(node);
-	}
-}
-
-
-void
-_print_resource_tree(resource_node_t **tree, int level)
-{
-	resource_node_t *node;
-	int x, y;
-
-	list_do(tree, node) {
-		for (x = 0; x < level; x++)
-			printf("  ");
-
-		printf("%s", node->rn_resource->r_rule->rr_type);
-		if (node->rn_flags) {
-			printf(" [ ");
-			if (node->rn_flags & RF_NEEDSTOP)
-				printf("NEEDSTOP ");
-			if (node->rn_flags & RF_NEEDSTART)
-				printf("NEEDSTART ");
-			if (node->rn_flags & RF_COMMON)
-				printf("COMMON ");
-			if (node->rn_flags & RF_INDEPENDENT)
-				printf("INDEPENDENT ");
-			if (node->rn_flags & RF_ENFORCE_TIMEOUTS)
-				printf("ENFORCE-TIMEOUTS ");
-			printf("]");
-		}
-		printf(" {\n");
-
-		for (x = 0; node->rn_resource->r_attrs &&
-		     node->rn_resource->r_attrs[x].ra_value; x++) {
-			for (y = 0; y < level+1; y++)
-				printf("  ");
-			printf("%s = \"%s\";\n",
-			       node->rn_resource->r_attrs[x].ra_name,
-			       attr_value(node,
-					  node->rn_resource->r_attrs[x].ra_name)
-			      );
-		}
-
-		_print_resource_tree(&node->rn_child, level + 1);
-
-		for (x = 0; x < level; x++)
-			printf("  ");
-		printf("}\n");
-	} while (!list_done(tree, node));
-}
-
-
-void
-print_resource_tree(resource_node_t **tree)
-{
-	_print_resource_tree(tree, 0);
-}
-
-
-static inline int
-_do_child_levels(resource_node_t **tree, resource_t *first, void *ret,
-		 int op)
-{
-	resource_node_t *node = *tree;
-	resource_t *res = node->rn_resource;
-	resource_rule_t *rule = res->r_rule;
-	int l, lev, x, rv = 0;
-
-	for (l = 1; l <= RESOURCE_MAX_LEVELS; l++) {
-
-		for (x = 0; rule->rr_childtypes &&
-		     rule->rr_childtypes[x].rc_name; x++) {
-
-			if(op == RS_STOP)
-				lev = rule->rr_childtypes[x].rc_stoplevel;
-			else
-				lev = rule->rr_childtypes[x].rc_startlevel;
-
-			if (!lev || lev != l)
-				continue;
-
-#if 0
-			printf("%s children of %s type %s (level %d)\n",
-			       agent_op_str(op),
-			       node->rn_resource->r_rule->rr_type,
-			       rule->rr_childtypes[x].rc_name, l);
-#endif
-
-			/* Do op on all children at our level */
-			rv |= _res_op(&node->rn_child, first,
-			     	     rule->rr_childtypes[x].rc_name, 
-		     		     ret, op);
-
-			if (rv & SFL_FAILURE && op != RS_STOP)
-				return rv;
-		}
-
-		if (rv != 0 && op != RS_STOP)
-			return rv;
-	}
-
-	return rv;
-}
-
-
-static inline int
-_xx_child_internal(resource_node_t *node, resource_t *first,
-		   resource_node_t *child, void *ret, int op)
-{
-	int x;
-	resource_rule_t *rule = node->rn_resource->r_rule;
-
-	for (x = 0; rule->rr_childtypes &&
-     	     rule->rr_childtypes[x].rc_name; x++) {
-		if (!strcmp(child->rn_resource->r_rule->rr_type,
-			    rule->rr_childtypes[x].rc_name)) {
-			if (rule->rr_childtypes[x].rc_startlevel ||
-			    rule->rr_childtypes[x].rc_stoplevel) {
-				return 0;
-			}
-		}
-	}
-
-	return _res_op_internal(&child, first,
-	 		       child->rn_resource->r_rule->rr_type,
-			       ret, op, child);
-}
-
-
-static inline int
-_do_child_default_level(resource_node_t **tree, resource_t *first,
-			void *ret, int op)
-{
-	resource_node_t *node = *tree, *child;
-	int y, rv = 0;
-
-	if (op == RS_START || op == RS_STATUS) {
-		list_for(&node->rn_child, child, y) {
-			rv |= _xx_child_internal(node, first, child, ret, op);
-
-			if (rv & SFL_FAILURE)
-				return rv;
-		}
-	} else {
-		list_for_rev(&node->rn_child, child, y) {
-			rv |= _xx_child_internal(node, first, child, ret, op);
-		}
-	}
-
-	return rv;
-}
-
-
-
-
-
-/**
-   Nasty codependent function.  Perform an operation by numerical level
-   at some point in the tree.  This allows indirectly-dependent resources
-   (such as IP addresses and user scripts) to have ordering without requiring
-   a direct dependency.
-
-   @param tree		Resource tree to search/perform operations on
-   @param first		Resource we're looking to perform the operation on,
-   			if one exists.
-   @param ret		Unused, but will be used to store status information
-   			such as resources consumed, etc, in the future.
-   @param op		Operation to perform if either first is found,
-   			or no first is declared (in which case, all nodes
-			in the subtree).
-   @see			_res_op res_exec
- */
-int
-_res_op_by_level(resource_node_t **tree, resource_t *first, void *ret,
-		 int op)
-{
-	resource_node_t *node = *tree;
-	resource_t *res = node->rn_resource;
-	resource_rule_t *rule = res->r_rule;
-	int rv = 0;
-
-	if (!rule->rr_childtypes)
-		return _res_op(&node->rn_child, first, NULL, ret, op);
-
-	if (op == RS_START || op == RS_STATUS) {
-		rv |= _do_child_levels(tree, first, ret, op);
-	       	if (rv & SFL_FAILURE)
-			return rv;
-
-		/* Start default level after specified ones */
-		rv |= _do_child_default_level(tree, first, ret, op);
-
-	} /* stop */ else {
-
-		rv |= _do_child_default_level(tree, first, ret, op);
-		rv |= _do_child_levels(tree, first, ret, op);
-	}
-
-	return rv;
-}
-
-
-void
-mark_nodes(resource_node_t *node, int state, int flags)
-{
-	int x;
-	resource_node_t *child;
-
-	list_for(&node->rn_child, child, x) {
-		if (child->rn_child)
-			mark_nodes(child->rn_child, state, flags);
-	}
-
-	node->rn_state = state;
-	node->rn_flags |= (RF_NEEDSTART | RF_NEEDSTOP);
-}
-
-
-/**
-   Do a status on a resource node.  This takes into account the last time the
-   status operation was run and selects the highest possible resource depth
-   to use given the elapsed time.
-  */
-int
-do_status(resource_node_t *node)
-{
-	int x = 0, idx = -1;
-	int has_recover = 0;
-	time_t delta = 0, now = 0;
-
-	now = time(NULL);
-
-	for (; node->rn_actions[x].ra_name; x++) {
-		if (!has_recover &&
-		    !strcmp(node->rn_actions[x].ra_name, "recover")) {
-			has_recover = 1;
-			continue;
-		}
-
-		if (strcmp(node->rn_actions[x].ra_name, "status"))
-			continue;
-
-		delta = now - node->rn_actions[x].ra_last;
-
-		/*
-		printf("%s:%s %s level %d interval = %d  elapsed = %d\n",
-			node->rn_resource->r_rule->rr_type,
-			node->rn_resource->r_attrs->ra_value,
-			node->rn_actions[x].ra_name, node->rn_actions[x].ra_depth,
-			(int)node->rn_actions[x].ra_interval, (int)delta);
-		 */
-
-		/* Ok, it's a 'status' action. See if enough time has
-		   elapsed for a given type of status action */
-		if (delta < node->rn_actions[x].ra_interval ||
-		    !node->rn_actions[x].ra_interval)
-			continue;
-
-		if (idx == -1 ||
-		    node->rn_actions[x].ra_depth > node->rn_actions[idx].ra_depth)
-			idx = x;
-	}
-
-	/* No check levels ready at the moment. */
-	if (idx == -1) {
-		if (node->rn_checked)
-			return node->rn_last_status;
-		return 0;
-	}
-
-
-	node->rn_actions[idx].ra_last = now;
-	x = res_exec(node, RS_STATUS, NULL, node->rn_actions[idx].ra_depth);
-
-	node->rn_last_status = x;
-	node->rn_last_depth = node->rn_actions[idx].ra_depth;
-	node->rn_checked = 1;
-
-	if (x == 0)
-		return 0;
-
-	if (!has_recover)
-		return x;
-
-	/* Strange/failed status. Try to recover inline. */
-	if ((x = res_exec(node, RS_RECOVER, NULL, 0)) == 0)
-		return 0;
-
-	return x;
-}
-
-
-void
-set_time(char *action, int depth, resource_node_t *node)
-{
-	time_t now;
-	int x = 0;
-
-	time(&now);
-
-	for (; node->rn_actions[x].ra_name; x++) {
-
-		if (strcmp(node->rn_actions[x].ra_name, action) ||
-	    	    node->rn_actions[x].ra_depth != depth)
-			continue;
-
-		node->rn_actions[x].ra_last = now;
-		break;
-	}
-}
-
-
-time_t
-get_time(char *action, int depth, resource_node_t *node)
-{
-	int x = 0;
-
-	for (; node->rn_actions[x].ra_name; x++) {
-
-		if (strcmp(node->rn_actions[x].ra_name, action) ||
-	    	    node->rn_actions[x].ra_depth != depth)
-			continue;
-
-		return node->rn_actions[x].ra_last;
-	}
-
-	return (time_t)0;
-}
-
-
-void
-clear_checks(resource_node_t *node)
-{
-	time_t now;
-	int x = 0;
-	resource_t *res = node->rn_resource;
-
-	now = res->r_started;
-
-	for (; node->rn_actions[x].ra_name; x++) {
-
-		if (strcmp(node->rn_actions[x].ra_name, "monitor") &&
-		    strcmp(node->rn_actions[x].ra_name, "status"))
-			continue;
-
-		node->rn_actions[x].ra_last = now;
-	}
-
-	node->rn_checked = 0;
-	node->rn_last_status = 0;
-	node->rn_last_depth = 0;
-}
-
-
-/**
-   Nasty codependent function.  Perform an operation by type for all siblings
-   at some point in the tree.  This allows indirectly-dependent resources
-   (such as IP addresses and user scripts) to have ordering without requiring
-   a direct dependency.
-
-   @param tree		Resource tree to search/perform operations on
-   @param first		Resource we're looking to perform the operation on,
-   			if one exists.
-   @param type		Type to look for.
-   @param ret		Unused, but will be used to store status information
-   			such as resources consumed, etc, in the future.
-   @param realop	Operation to perform if either first is found,
-   			or no first is declared (in which case, all nodes
-			in the subtree).
-   @see			_res_op_by_level res_exec
- */
-static inline int
-_res_op_internal(resource_node_t __attribute__ ((unused)) **tree,
-		 resource_t *first,
-		 char *type, void *__attribute__((unused))ret, int realop,
-		 resource_node_t *node)
-{
-	int rv = 0, me, op;
-
-	/* Restore default operation. */
-	op = realop;
-
-	/* If we're starting by type, do that funky thing. */
-	if (type && strlen(type) &&
-	    strcmp(node->rn_resource->r_rule->rr_type, type))
-		return 0;
-
-	/* If the resource is found, all nodes in the subtree must
-	   have the operation performed as well. */
-	me = !first || (node->rn_resource == first);
-
-	//printf("begin %s: %s %s [0x%x]\n", res_ops[op],
-	       //node->rn_resource->r_rule->rr_type,
-	       //primary_attr_value(node->rn_resource),
-	       //node->rn_flags);
-
-	if (me) {
-		/*
-		   If we've been marked as a node which
-		   needs to be started or stopped, clear
-		   that flag and start/stop this resource
-		   and all resource babies.
-
-		   Otherwise, don't do anything; look for
-		   children with RF_NEEDSTART and
-		   RF_NEEDSTOP flags.
-
-		   CONDSTART and CONDSTOP are no-ops if
-		   the appropriate flag is not set.
-		 */
-	       	if ((op == RS_CONDSTART) &&
-		    (node->rn_flags & RF_NEEDSTART)) {
-			printf("Node %s:%s - CONDSTART\n",
-			       node->rn_resource->r_rule->rr_type,
-			       primary_attr_value(node->rn_resource));
-			op = RS_START;
-		}
-
-		if ((op == RS_CONDSTOP) &&
-		    (node->rn_flags & RF_NEEDSTOP)) {
-			printf("Node %s:%s - CONDSTOP\n",
-			       node->rn_resource->r_rule->rr_type,
-			       primary_attr_value(node->rn_resource));
-			op = RS_STOP;
-		}
-	}
-
-	/* Start starts before children */
-	if (me && (op == RS_START)) {
-
-		if (node->rn_flags & RF_RECONFIG &&
-		    realop == RS_CONDSTART) {
-			rv = res_exec(node, RS_RECONFIG, NULL, 0);
-			op = realop; /* reset to CONDSTART */
-		} else {
-			rv = res_exec(node, op, NULL, 0);
-		}
-		node->rn_flags &= ~(RF_NEEDSTART | RF_RECONFIG);
-		if (rv != 0) {
-			node->rn_state = RES_FAILED;
-			return SFL_FAILURE;
-		}
-
-		set_time("start", 0, node);
-		clear_checks(node);
-
-		if (node->rn_state != RES_STARTED) {
-			++node->rn_resource->r_incarnations;
-			node->rn_state = RES_STARTED;
-		}
-	} else if (me && (op == RS_STATUS)) {
-		/* Check status before children*/
-		rv = do_status(node);
-		if (rv != 0) {
-			/*
-			   If this node's status has failed, all of its
-			   dependent children are failed, whether or not this
-			   node is independent or not.
-			 */
-			mark_nodes(node, RES_FAILED,
-				   RF_NEEDSTART | RF_NEEDSTOP);
-
-			/* If we're an independent subtree, return a flag
-			   stating that this section is recoverable apart
-			   from siblings in the resource tree.  All child
-			   resources of this node must be restarted,
-			   but siblings of this node are not affected. */
-			if (node->rn_flags & RF_INDEPENDENT)
-				return SFL_RECOVERABLE;
-
-			return SFL_FAILURE;
-		}
-
-	}
-
-       if (node->rn_child) {
-                rv |= _res_op_by_level(&node, me?NULL:first, ret, op);
-
-               /* If one or more child resources are failed and at least one
-		  of them is not an independent subtree then let's check if
-		  if we are an independent subtree.  If so, mark ourself
-		  and all our children as failed and return a flag stating
-		  that this section is recoverable apart from siblings in
-		  the resource tree. */
-		if (op == RS_STATUS && (rv & SFL_FAILURE) &&
-		    (node->rn_flags & RF_INDEPENDENT)) {
-			mark_nodes(node, RES_FAILED,
-				   RF_NEEDSTART | RF_NEEDSTOP);
-			rv = SFL_RECOVERABLE;
-		}
-	}
- 			
-	/* Stop should occur after children have stopped */
-	if (me && (op == RS_STOP)) {
-		node->rn_flags &= ~RF_NEEDSTOP;
-		rv |= res_exec(node, op, NULL, 0);
-
-		if (rv != 0) {
-			node->rn_state = RES_FAILED;
-			return SFL_FAILURE;
-		}
-
-		if (node->rn_state != RES_STOPPED) {
-			--node->rn_resource->r_incarnations;
-			node->rn_state = RES_STOPPED;
-		}
-	}
-
-	//printf("end %s: %s %s\n", res_ops[op],
-	       //node->rn_resource->r_rule->rr_type,
-	       //primary_attr_value(node->rn_resource));
-	
-	return rv;
-}
-
-
-/**
-   Nasty codependent function.  Perform an operation by type for all siblings
-   at some point in the tree.  This allows indirectly-dependent resources
-   (such as IP addresses and user scripts) to have ordering without requiring
-   a direct dependency.
-
-   @param tree		Resource tree to search/perform operations on
-   @param first		Resource we're looking to perform the operation on,
-   			if one exists.
-   @param type		Type to look for.
-   @param ret		Unused, but will be used to store status information
-   			such as resources consumed, etc, in the future.
-   @param realop	Operation to perform if either first is found,
-   			or no first is declared (in which case, all nodes
-			in the subtree).
-   @see			_res_op_by_level res_exec
- */
-int
-_res_op(resource_node_t **tree, resource_t *first,
-	char *type, void * __attribute__((unused))ret, int realop)
-{
-  	resource_node_t *node;
- 	int count = 0, rv = 0;
- 	
- 	if (realop == RS_STOP) {
- 		list_for_rev(tree, node, count) {
- 			rv |= _res_op_internal(tree, first, type, ret, realop,
- 					       node);
- 		}
- 	} else {
- 		list_for(tree, node, count) {
- 			rv |= _res_op_internal(tree, first, type, ret, realop,
- 					       node);
-
-			/* If we hit a problem during a 'status' op in an
-			   independent subtree, rv will have the
-			   SFL_RECOVERABLE bit set, but not SFL_FAILURE.
-			   If we ever hit SFL_FAILURE during a status
-			   operation, we're *DONE* - even if the subtree
-			   is flagged w/ indy-subtree */
-			  
- 			if (rv & SFL_FAILURE) 
- 				return rv;
- 		}
- 	}
-
-	return rv;
-}
-
-/**
-   Start all occurrences of a resource in a tree
-
-   @param tree		Tree to search for our resource.
-   @param res		Resource to start/stop
-   @param ret		Unused
- */
-int
-res_start(resource_node_t **tree, resource_t *res, void *ret)
-{
-	return _res_op(tree, res, NULL, ret, RS_START);
-}
-
-
-/**
-   Start all occurrences of a resource in a tree
-
-   @param tree		Tree to search for our resource.
-   @param res		Resource to start/stop
-   @param ret		Unused
- */
-int
-res_condstop(resource_node_t **tree, resource_t *res, void *ret)
-{
-	return _res_op(tree, res, NULL, ret, RS_CONDSTOP);
-}
-
-
-/**
-   Start all occurrences of a resource in a tree
-
-   @param tree		Tree to search for our resource.
-   @param res		Resource to start/stop
-   @param ret		Unused
- */
-int
-res_condstart(resource_node_t **tree, resource_t *res, void *ret)
-{
-	return _res_op(tree, res, NULL, ret, RS_CONDSTART);
-}
-
-
-/**
-   Stop all occurrences of a resource in a tree
-
-   @param tree		Tree to search for our resource.
-   @param res		Resource to start/stop
-   @param ret		Unused
- */
-int
-res_stop(resource_node_t **tree, resource_t *res, void *ret)
-{
-	return _res_op(tree, res, NULL, ret, RS_STOP);
-}
-
-
-/**
-   Check status of all occurrences of a resource in a tree
-
-   @param tree		Tree to search for our resource.
-   @param res		Resource to start/stop
-   @param ret		Unused
- */
-int
-res_status(resource_node_t **tree, resource_t *res, void *ret)
-{
-	return _res_op(tree, res, NULL, ret, RS_STATUS);
-}
-
-
-/**
-   Grab resource info for all occurrences of a resource in a tree
-
-   @param tree		Tree to search for our resource.
-   @param res		Resource to start/stop
-   @param ret		Unused
- */
-int
-res_resinfo(resource_node_t **tree, resource_t *res, void *ret)
-{
-	return _res_op(tree, res, NULL, ret, RS_RESINFO);
-}
-
-
-/**
-   Find the delta of two resource lists and flag the resources which need
-   to be restarted/stopped/started. 
-  */
-int
-resource_delta(resource_t **leftres, resource_t **rightres)
-{
-	resource_t *lc, *rc;
-	int ret;
-
-	list_do(leftres, lc) {
-		rc = find_resource_by_ref(rightres, lc->r_rule->rr_type,
-					  primary_attr_value(lc));
-
-		/* No restart.  It's gone. */
-		if (!rc) {
-			lc->r_flags |= RF_NEEDSTOP;
-			continue;
-		}
-
-		/* Ok, see if the resource is the same */
-		ret = rescmp(lc, rc);
-		if (ret	== 0) {
-			rc->r_flags |= RF_COMMON;
-			continue;
-		}
-
-		if (ret == 2) {
-			/* return of 2 from rescmp means
-			   the two resources differ only 
-			   by reconfigurable bits */
-			/* Do nothing on condstop phase;
-			   do a "reconfig" instead of 
-			   "start" on conststart phase */
-			rc->r_flags |= RF_COMMON;
-			rc->r_flags |= RF_NEEDSTART;
-			rc->r_flags |= RF_RECONFIG;
-			continue;
-		}
-
-		rc->r_flags |= RF_COMMON;
-
-		/* Resource has changed.  Flag it. */
-		lc->r_flags |= RF_NEEDSTOP;
-		rc->r_flags |= RF_NEEDSTART;
-
-	} while (!list_done(leftres, lc));
-
-	/* Ok, if we weren't existing, flag as a needstart. */
-	list_do(rightres, rc) {
-		if (rc->r_flags & RF_COMMON)
-			rc->r_flags &= ~RF_COMMON;
-		else
-			rc->r_flags |= RF_NEEDSTART;
-	} while (!list_done(rightres, rc));
-	/* Easy part is done. */
-	return 0;
-}
-
-
-/**
-   Part 2 of online mods:  Tree delta.  Ow.  It hurts.  It hurts.
-   We need to do this because resources can be moved from one RG
-   to another with nothing changing (not even refcnt!).
-  */
-int
-resource_tree_delta(resource_node_t **ltree, resource_node_t **rtree)
-{
-	resource_node_t *ln, *rn;
-	int rc;
-
-	list_do(ltree, ln) {
-		/*
-		   Ok.  Run down the left tree looking for obsolete resources.
-		   (e.g. those that need to be stopped)
-
-		   If it's obsolete, continue.  All children will need to be
-		   restarted too, so we don't need to compare the children
-		   of this node.
-		 */
-		if (ln->rn_resource->r_flags & RF_NEEDSTOP) {
-			ln->rn_flags |= RF_NEEDSTOP;
-			continue;
-		}
-
-		/*
-		   Ok.  This particular node wasn't flagged. 
-		 */
-		list_do(rtree, rn) {
-
-			rc = rescmp(ln->rn_resource, rn->rn_resource);
-
-			/* Wildly different resource? */
-			if (rc <= -1)
-				continue;
-
-			/*
-			   If it needs to be started (e.g. it's been altered
-			   or is new), then we don't really care about its
-			   children.
-			 */
-
-			if (rn->rn_resource->r_flags & RF_NEEDSTART) {
-				rn->rn_flags |= RF_NEEDSTART;
-				if ((rn->rn_resource->r_flags & RF_RECONFIG) == 0)
-					continue;
-			}
-
-			if (rc == 0 || rc == 2) {
-				if (rc == 2)
-					rn->rn_flags |= RF_NEEDSTART | RF_RECONFIG;
-
-				/* Ok, same resource.  Recurse. */
-				ln->rn_flags |= RF_COMMON;
-				rn->rn_flags |= RF_COMMON;
-				resource_tree_delta(&ln->rn_child,
-						    &rn->rn_child);
-			}
-
-		} while (!list_done(rtree, rn));
-
-		if (ln->rn_flags & RF_COMMON)
-			ln->rn_flags &= ~RF_COMMON;
-		else 
-			ln->rn_flags |= RF_NEEDSTOP;
-
-	} while (!list_done(ltree, ln));
-
-	/*
-	   See if we need to start anything.  Stuff which wasn't flagged
-	   as COMMON needs to be started.
-
-	   As always, if we have to start a node, everything below it
-	   must also be started.
-	 */
-	list_do(rtree, rn) {
-		if (rn->rn_flags & RF_COMMON)
-			rn->rn_flags &= ~RF_COMMON;
-		else
-			rn->rn_flags |= RF_NEEDSTART;
-	} while (!list_done(rtree, rn));
-
-	return 0;
-}
diff --git a/rgmanager/src/daemons/rg_event.c b/rgmanager/src/daemons/rg_event.c
deleted file mode 100644
index cb36db6..0000000
--- a/rgmanager/src/daemons/rg_event.c
+++ /dev/null
@@ -1,585 +0,0 @@
-#include <resgroup.h>
-#include <rg_locks.h>
-#include <gettid.h>
-#include <assert.h>
-#include <libcman.h>
-#include <ccs.h>
-#include <logging.h>
-#include <lock.h>
-#include <event.h>
-#include <stdint.h>
-#include <vf.h>
-#include <members.h>
-#include <time.h>
-
-
-/**
- * resource group event queue.
- */
-static event_t *event_queue = NULL;
-#ifdef WRAP_LOCKS
-static pthread_mutex_t event_queue_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
-static pthread_mutex_t mi_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
-#else
-static pthread_mutex_t event_queue_mutex = PTHREAD_MUTEX_INITIALIZER;
-static pthread_mutex_t mi_mutex = PTHREAD_MUTEX_INITIALIZER;
-#endif
-static pthread_cond_t event_queue_cond = PTHREAD_COND_INITIALIZER;
-static pthread_t event_thread = 0;
-static int transition_throttling = 5;
-static int central_events = 0;
-
-extern int running;
-extern int shutdown_pending;
-static int _master = 0;
-static struct dlm_lksb _master_lock;
-static int _xid = 0;
-static event_master_t *mi = NULL;
-
-void hard_exit(void);
-void flag_shutdown(int sig);
-void flag_reconfigure(int sig);
-
-event_table_t *master_event_table = NULL;
-
-
-void
-set_transition_throttling(int nsecs)
-{
-	if (nsecs < 0)
-		nsecs = 0;
-	transition_throttling = nsecs;
-}
-
-
-void
-set_central_events(int flag)
-{
-	central_events = flag;
-}
-
-
-int
-central_events_enabled(void)
-{
-	return central_events;
-}
-
-
-/**
-  Called to handle the transition of a cluster member from up->down or
-  down->up.  This handles initializing services (in the local node-up case),
-  exiting due to loss of quorum (local node-down), and service fail-over
-  (remote node down).  This is the distributed node event processor;
-  for the local-only node event processor, see slang_event.c
- 
-  @param nodeID		ID of the member which has come up/gone down.
-  @param nodeStatus		New state of the member in question.
-  @see eval_groups
- */
-void
-node_event(int local, int nodeID, int nodeStatus,
-	   int __attribute__((unused)) clean)
-{
-	if (!running)
-		return;
-
-	if (local) {
-
-		/* Local Node Event */
-		if (nodeStatus == 0) {
-			logt_print(LOG_ERR, "Exiting uncleanly\n");
-			hard_exit();
-		}
-
-		if (!rg_initialized()) {
-			if (init_resource_groups(0, 0) != 0) {
-				logt_print(LOG_ERR,
-				       "#36: Cannot initialize services\n");
-				hard_exit();
-			}
-		}
-
-		if (shutdown_pending) {
-			logt_print(LOG_NOTICE, "Processing delayed exit signal\n");
-			running = 0;
-			return;
-		}
-		setup_signal(SIGINT, flag_shutdown);
-		setup_signal(SIGTERM, flag_shutdown);
-		setup_signal(SIGHUP, flag_reconfigure);
-
-		eval_groups(1, nodeID, 1);
-		return;
-	}
-
-	/*
-	 * Nothing to do for events from other nodes if we are not ready.
-	 */
-	if (!rg_initialized()) {
-		logt_print(LOG_DEBUG, "Services not initialized.\n");
-		return;
-	}
-
-	eval_groups(0, nodeID, nodeStatus);
-}
-
-
-/**
-   Query CCS to see whether a node has fencing enabled or not in
-   the configuration.  This does not check to see if it's in the
-   fence domain.
- */
-int
-node_has_fencing(int nodeid)
-{
-	int ccs_desc;
-	char *val = NULL;
-	char buf[1024];
-	int ret = 1;
-	
-	ccs_desc = ccs_connect();
-	if (ccs_desc < 0) {
-		logt_print(LOG_ERR, "Unable to connect to ccsd; cannot handle"
-		       " node event!\n");
-		/* Assume node has fencing */
-		return 1;
-	}
-
-	snprintf(buf, sizeof(buf), 
-		 "/cluster/clusternodes/clusternode[@nodeid=\"%d\"]"
-		 "/fence/method/device/@name", nodeid);
-
-	if (ccs_get(ccs_desc, buf, &val) != 0)
-		ret = 0;
-	if (val) 
-		free(val);
-	ccs_disconnect(ccs_desc);
-	return ret;
-}
-
-
-/* Since the API for groupd is private, use group_tool to find
-   out if we've joined the fence domain */ 
-int
-fence_domain_joined(void)
-{
-	int rv;
-
-	rv = system("group_tool ls fence default &> /dev/null");	
-	if (rv == 0)
-		return 1;
-	return 0;
-}
-
-
-/**
-   Quick query to cman to see if a node has been fenced.
- */
-int
-node_fenced(int nodeid)
-{
-	cman_handle_t ch;
-	int fenced = 0;
-	uint64_t fence_time;
-
-	ch = cman_init(NULL);
-	if (cman_get_fenceinfo(ch, nodeid, &fence_time, &fenced, NULL) < 0)
-		fenced = 0;
-
-	cman_finish(ch);
-
-	return fenced;
-}
-
-
-/**
-   Callback from view-formation when a commit occurs for the Transition-
-   Master key.
- */
-int32_t
-master_event_callback(char __attribute__ ((unused)) *key,
-		      uint64_t __attribute__ ((unused)) viewno,
-		      void *data, uint32_t datalen)
-{
-	event_master_t *m;
-
-	m = data;
-	if (datalen != (uint32_t)sizeof(*m)) {
-		logt_print(LOG_ERR, "%s: wrong size\n", __FUNCTION__);
-		return 1;
-	}
-
-	swab_event_master_t(m);
-	if (m->m_magic != EVENT_MASTER_MAGIC) {
-		logt_print(LOG_ERR, "%s: wrong size\n", __FUNCTION__);
-		return 1;
-	}
-
-	if (m->m_nodeid == (uint32_t)my_id())
-		logt_print(LOG_DEBUG, "Master Commit: I am master\n");
-	else 
-		logt_print(LOG_DEBUG, "Master Commit: %d is master\n", m->m_nodeid);
-
-	pthread_mutex_lock(&mi_mutex);
-	if (mi)
-		free(mi);
-	mi = m;
-	pthread_mutex_unlock(&mi_mutex);
-
-	return 0;
-}
-
-
-/**
-  Read the Transition-Master key from vf if it exists.  If it doesn't,
-  attempt to become the transition-master.
- */
-static int
-find_master(void)
-{
-	event_master_t *masterinfo = NULL;
-	void *data;
-	uint32_t sz;
-	cluster_member_list_t *m;
-	uint64_t vn;
-	int master_id = -1;
-
-	m = member_list();
-	if (vf_read(m, "Transition-Master", &vn,
-		    (void **)(&data), &sz) < 0) {
-		logt_print(LOG_ERR, "Unable to discover master"
-		       " status\n");
-		masterinfo = NULL;
-	} else {
-		masterinfo = (event_master_t *)data;
-	}
-	free_member_list(m);
-
-	if (masterinfo && (sz >= sizeof(*masterinfo))) {
-		swab_event_master_t(masterinfo);
-		if (masterinfo->m_magic == EVENT_MASTER_MAGIC) {
-			logt_print(LOG_DEBUG, "Master Locate: %d is master\n",
-			       masterinfo->m_nodeid);
-			pthread_mutex_lock(&mi_mutex);
-			if (mi)
-				free(mi);
-			mi = masterinfo;
-			pthread_mutex_unlock(&mi_mutex);
-			master_id = masterinfo->m_nodeid;
-		}
-	}
-
-	return master_id;
-}
-
-
-/**
-  Return a copy of the cached event_master_t structure to the
-  caller.
- */
-int
-event_master_info_cached(event_master_t *mi_out)
-{
-	if (!central_events || !mi_out) {
-		errno = -EINVAL;
-		return -1;
-	}
-
-	pthread_mutex_lock(&mi_mutex);
-	if (!mi) {
-		pthread_mutex_unlock(&mi_mutex);
-		errno = -ENOENT;
-		return -1;
-	}
-
-	memcpy(mi_out, mi, sizeof(*mi));
-	pthread_mutex_unlock(&mi_mutex);
-	return 0;
-}
-
-
-/**
-  Return the node ID of the master.  If none exists, become
-  the master and return our own node ID.
- */
-int
-event_master(void)
-{
-	cluster_member_list_t *m = NULL;
-	event_master_t masterinfo;
-	int master_id = -1;
-
-	/* We hold this forever. */
-	if (_master)
-		return my_id();
-
-	m = member_list();
-	pthread_mutex_lock(&mi_mutex);
-
-	if (mi) {
-		master_id = mi->m_nodeid;
-		pthread_mutex_unlock(&mi_mutex);
-		if (memb_online(m, master_id)) {
-			//logt_print(LOG_DEBUG, "%d is master\n", mi->m_nodeid);
-			goto out;
-		}
-	}
-
-	pthread_mutex_unlock(&mi_mutex);
-
-	memset(&_master_lock, 0, sizeof(_master_lock));
-	if (clu_lock(LKM_EXMODE, &_master_lock, LKF_NOQUEUE,
-		     "Transition-Master") < 0) {
-		/* not us, find out who is master */
-		master_id = find_master();
-		goto out;
-	}
-
-	if (_master_lock.sb_status != 0) {
-		master_id = -1;
-		goto out;
-	}
-
-	_master = 1;
-
-	memset(&masterinfo, 0, sizeof(masterinfo));
-	masterinfo.m_magic = EVENT_MASTER_MAGIC;
-	masterinfo.m_nodeid = my_id();
-	masterinfo.m_master_time = (uint64_t)time(NULL);
-	swab_event_master_t(&masterinfo);
-
-	if (vf_write(m, VFF_IGN_CONN_ERRORS | VFF_RETRY,
-		     "Transition-Master", &masterinfo,
-		     sizeof(masterinfo)) < 0) {
-		logt_print(LOG_ERR, "Unable to advertise master"
-		       " status to all nodes\n");
-	}
-
-	master_id = my_id();
-out:
-	free_member_list(m);
-	return master_id;
-}
-
-
-
-void group_event(char *name, uint32_t state, int owner);
-
-/**
-  Event handling function.  This only stays around as long as
-  events are on the queue.
- */
-void *
-_event_thread_f(void __attribute__ ((unused)) *arg)
-{
-	event_t *ev;
-	struct timeval now;
-	struct timespec expire;
-	int notice = 0, count = 0;
-
-	/* Event thread usually doesn't hang around.  When it's
-   	   spawned, sleep for this many seconds in order to let
-   	   some events queue up */
-	if (transition_throttling && !central_events) {
-		sleep(transition_throttling);
-	}
-
-	while (1) {
-		pthread_mutex_lock(&event_queue_mutex);
-		ev = event_queue;
-		if (!ev && !central_events) {
-			gettimeofday(&now, NULL);
-			expire.tv_sec = now.tv_sec + 5;
-			expire.tv_nsec = now.tv_usec * 1000;
-			pthread_cond_timedwait(&event_queue_cond,
-						&event_queue_mutex,
-						&expire);
-			ev = event_queue;
-		}
-		if (!ev)
-			break; /* We're outta here */
-
-		list_remove(&event_queue, ev);
-
-		++count;
-		pthread_mutex_unlock(&event_queue_mutex);
-
-		if (ev->ev_type == EVENT_CONFIG) {
-			/*
-			logt_print(LOG_NOTICE, "Config Event: %d -> %d\n",
-			       ev->ev.config.cfg_oldversion,
-			       ev->ev.config.cfg_version);
-			 */
-			init_resource_groups(1, 0);
-			free(ev);
-			continue;
-		}
-
-		if (central_events) {
-			/* If the master node died or there isn't
-			   one yet, take the master lock. */
-			if (event_master() == my_id()) {
-				slang_process_event(master_event_table,
-						    ev);
-			} 
-			free(ev);
-			continue;
-			/* ALL OF THE CODE BELOW IS DISABLED
-			   when using central_events */
-		}
-
-		if (ev->ev_type == EVENT_RG) {
-			/*
-			logt_print(LOG_NOTICE, "RG Event: %s %s %d\n",
-			       ev->ev.group.rg_name,
-			       rg_state_str(ev->ev.group.rg_state),
-			       ev->ev.group.rg_owner);
-			 */
-			group_event(ev->ev.group.rg_name,
-				    ev->ev.group.rg_state,
-				    ev->ev.group.rg_owner);
-		} else if (ev->ev_type == EVENT_NODE) {
-			/*
-			logt_print(LOG_NOTICE, "Node Event: %s %d %s %s\n",
-			       ev->ev.node.ne_local?"Local":"Remote",
-			       ev->ev.node.ne_nodeid,
-			       ev->ev.node.ne_state?"UP":"DOWN",
-			       ev->ev.node.ne_clean?"Clean":"Dirty")
-			 */
-
-			if (ev->ev.node.ne_state == 0 &&
-			    !ev->ev.node.ne_clean &&
-			    node_has_fencing(ev->ev.node.ne_nodeid)) {
-				notice = 0;
-				while (!node_fenced(ev->ev.node.ne_nodeid)) {
-					if (!notice) {
-						notice = 1;
-						logt_print(LOG_INFO, "Waiting for "
-						       "node #%d to be fenced\n",
-						       ev->ev.node.ne_nodeid);
-					}
-					sleep(2);
-				}
-
-				if (notice)
-					logt_print(LOG_INFO, "Node #%d fenced; "
-					       "continuing\n",
-					       ev->ev.node.ne_nodeid);
-			}
-
-			node_event(ev->ev.node.ne_local,
-				   ev->ev.node.ne_nodeid,
-				   ev->ev.node.ne_state,
-				   ev->ev.node.ne_clean);
-		}
-
-		free(ev);
-	}
-
-	if (!central_events || _master) {
-		logt_print(LOG_DEBUG, "%d events processed\n", count);
-	}
-	/* Mutex held */
-	event_thread = 0;
-	pthread_mutex_unlock(&event_queue_mutex);
-	pthread_exit(NULL);
-}
-
-
-static void
-insert_event(event_t *ev)
-{
-	pthread_attr_t attrs;
-	pthread_mutex_lock (&event_queue_mutex);
-	ev->ev_transaction = ++_xid;
-	list_insert(&event_queue, ev);
-	if (event_thread == 0) {
-        	pthread_attr_init(&attrs);
-        	pthread_attr_setinheritsched(&attrs, PTHREAD_INHERIT_SCHED);
-        	pthread_attr_setdetachstate(&attrs, PTHREAD_CREATE_DETACHED);
-		pthread_attr_setstacksize(&attrs, 262144);
-
-		pthread_create(&event_thread, &attrs, _event_thread_f, NULL);
-        	pthread_attr_destroy(&attrs);
-	} else {
-		pthread_cond_broadcast(&event_queue_cond);
-	}
-	pthread_mutex_unlock (&event_queue_mutex);
-}
-
-
-static event_t *
-new_event(void)
-{
-	event_t *ev;
-
-	while (1) {
-		ev = malloc(sizeof(*ev));
-		if (ev) {
-			break;
-		}
-		sleep(1);
-	}
-	memset(ev,0,sizeof(*ev));
-	ev->ev_type = EVENT_NONE;
-
-	return ev;
-}
-
-
-void
-rg_event_q(char *name, uint32_t state, int owner, int last)
-{
-	event_t *ev = new_event();
-
-	ev->ev_type = EVENT_RG;
-
-	strncpy(ev->ev.group.rg_name, name, 128);
-	ev->ev.group.rg_state = state;
-	ev->ev.group.rg_owner = owner;
-	ev->ev.group.rg_last_owner = last;
-
-	insert_event(ev);
-}
-
-
-void
-node_event_q(int local, int nodeID, int state, int clean)
-{
-	event_t *ev = new_event();
-
-	ev->ev_type = EVENT_NODE;
-	ev->ev.node.ne_state = state;
-	ev->ev.node.ne_local = local;
-	ev->ev.node.ne_nodeid = nodeID;
-	ev->ev.node.ne_clean = clean;
-	insert_event(ev);
-}
-
-
-void
-config_event_q(void)
-{
-	event_t *ev = new_event();
-
-	ev->ev_type = EVENT_CONFIG;
-	insert_event(ev);
-}
-
-void
-user_event_q(char *svc, int request,
-	     int arg1, int arg2, int target, msgctx_t *ctx)
-{
-	event_t *ev = new_event();
-
-	ev->ev_type = EVENT_USER;
-	strncpy(ev->ev.user.u_name, svc, sizeof(ev->ev.user.u_name));
-	ev->ev.user.u_request = request;
-	ev->ev.user.u_arg1 = arg1;
-	ev->ev.user.u_arg2 = arg2;
-	ev->ev.user.u_target = target;
-	ev->ev.user.u_ctx = ctx;
-	insert_event(ev);
-}
-
diff --git a/rgmanager/src/daemons/rg_forward.c b/rgmanager/src/daemons/rg_forward.c
deleted file mode 100644
index 7a2c87d..0000000
--- a/rgmanager/src/daemons/rg_forward.c
+++ /dev/null
@@ -1,279 +0,0 @@
-//#define DEBUG
-#include <rg_types.h>
-#include <resgroup.h>
-#include <rg_queue.h>
-#include <platform.h>
-#include <msgsimple.h>
-#include <logging.h>
-#include <message.h>
-#include <members.h>
-
-
-struct fw_message {
-	msgctx_t *ctx;
-	SmMessageSt msg;
-	int nodeid;
-};
-
-
-void
-build_message(SmMessageSt *msgp, int action, char *svcName, int target,
-	      int arg1, int arg2)
-{
-	msgp->sm_hdr.gh_magic = GENERIC_HDR_MAGIC;
-	msgp->sm_hdr.gh_command = RG_ACTION_REQUEST;
-	msgp->sm_hdr.gh_arg1 = arg1;
-	msgp->sm_hdr.gh_arg2 = arg2;
-	msgp->sm_hdr.gh_length = sizeof(*msgp);
-	msgp->sm_data.d_action = action;
-	strncpy(msgp->sm_data.d_svcName, svcName,
-		sizeof(msgp->sm_data.d_svcName));
-	msgp->sm_data.d_svcOwner = target;
-	msgp->sm_data.d_ret = 0;
-
-	swab_SmMessageSt(msgp);
-}
-
-
-void *
-forwarding_thread(void *arg)
-{
-	rg_state_t rgs;
-	request_t *req = (request_t *)arg;
-	struct dlm_lksb lockp;
-	msgctx_t *ctx = NULL;
-	cluster_member_list_t *m = NULL;
-	SmMessageSt msg;
-	int response_code = RG_EAGAIN, ret;
-	int new_owner = 0, retries = 0;
-
-	if (rg_lock(req->rr_group, &lockp) != 0) {
-		logt_print(LOG_WARNING, "FW: Forwarding failed; lock unavailable for %s\n",
-		       req->rr_group);
-		goto out_fail;
-	}
-	if (get_rg_state(req->rr_group, &rgs) != 0) {
-		rg_unlock(&lockp);
-		logt_print(LOG_WARNING, "FW: Forwarding failed; state unavailable for %s\n",
-		       req->rr_group);
-		goto out_fail;
-	}
-	rg_unlock(&lockp);
-
-	if (rgs.rs_owner == 0)
-		rgs.rs_owner = req->rr_target;
-	if (rgs.rs_owner == 0) {
-		logt_print(LOG_ERR, "FW: Attempt to forward to invalid node ID\n");
-       		goto out_fail;
-	}
-	if (rgs.rs_owner == (uint32_t)my_id()) {
-		logt_print(LOG_WARNING, "BUG! Attempt to forward to myself!\n");
-       		goto out_fail;
-	}
-
-	logt_print(LOG_DEBUG, "FW: Forwarding %s request to %d\n",
-	       rg_req_str(req->rr_request), rgs.rs_owner);
-
-	ctx = msg_new_ctx();
-	if (ctx == NULL) {
-		logt_print(LOG_DEBUG, "FW: Failed to allocate socket context: %s\n",
-		       strerror(errno));
-		goto out_fail;
-	}
-
-	/* Construct message */
-	build_message(&msg, req->rr_request, req->rr_group, req->rr_target,
-		      req->rr_arg0, req->rr_arg1);
-
-	if (msg_open(MSG_CLUSTER, rgs.rs_owner, RG_PORT, ctx, 10) < 0) {
-		logt_print(LOG_DEBUG, "FW: Failed to open channel to %d CTX: %p\n",
-		       rgs.rs_owner, ctx);
-		goto out_fail;
-	}
-	if (msg_send(ctx, &msg, sizeof(msg)) < (int)sizeof(msg)) {
-		logt_print(LOG_DEBUG, "FW: Failed to send message to %d CTX: %p\n",
-		       rgs.rs_owner, ctx);
-		goto out_fail;
-	}
-
-        /*
-	 * Ok, we're forwarding a message to another node.  Keep tabs on
-	 * the node to make sure it doesn't die.  Basically, wake up every
-	 * now and again to make sure it's still online.  If it isn't, send
-	 * a response back to the caller.
-	 */
-	do {
-		ret = msg_receive(ctx, &msg, sizeof(msg), 10);
-		if (ret < (int)sizeof(msg)) {
-			if (ret < 0 && errno == ETIMEDOUT) {
-				m = member_list();
-				if (!memb_online(m, rgs.rs_owner)) {
-					response_code = RG_ENODE;
-					goto out_fail;
-				}
-				free_member_list(m);
-				m = NULL;
-				continue;
-			}
-
-			if (ret == 0)
-				continue;
-		}
-		break;
-	} while(++retries < 60); /* old 600 second rule */
-
-	swab_SmMessageSt(&msg);
-
-	response_code = msg.sm_data.d_ret;
-	new_owner = msg.sm_data.d_svcOwner;
-
-out_fail:
-	send_response(response_code, new_owner, req);
-	msg_close(req->rr_resp_ctx);
-	msg_free_ctx(req->rr_resp_ctx);
-
-	if (ctx) {
-		msg_close(ctx);
-		msg_free_ctx(ctx);
-	}
-	if (m)
-		free_member_list(m);
-
-	rq_free(req);
-	pthread_exit(NULL);
-}
-
-
-void
-forward_request(request_t *req)
-{
-	pthread_t newthread;
-	pthread_attr_t attrs;
-
-        pthread_attr_init(&attrs);
-        pthread_attr_setinheritsched(&attrs, PTHREAD_INHERIT_SCHED);
-        pthread_attr_setdetachstate(&attrs, PTHREAD_CREATE_DETACHED);
-	pthread_attr_setstacksize(&attrs, 262144);
-
-	pthread_create(&newthread, &attrs, forwarding_thread, req);
-        pthread_attr_destroy(&attrs);
-}
-
-
-
-void *
-forwarding_thread_v2(void *arg)
-{
-	msgctx_t *ctx = NULL, *resp_ctx = NULL;
-	cluster_member_list_t *m = NULL;
-	SmMessageSt *msgp = NULL, msg;
-	int response_code = RG_EAGAIN, ret, target = -1;
-	int retries = 0;
-	struct fw_message *fwmsg = (struct fw_message *)arg;
-
-	msgp = &fwmsg->msg;
-	resp_ctx = fwmsg->ctx;
-	target = fwmsg->nodeid;
-
-	logt_print(LOG_DEBUG, "FW: Forwarding SM request to %d\n",
-	       target);
-
-	ctx = msg_new_ctx();
-	if (ctx == NULL) {
-		logt_print(LOG_DEBUG, "FW: Failed to allocate socket context: %s\n",
-		       strerror(errno));
-		goto out_fail;
-	}
-	if (msg_open(MSG_CLUSTER, target, RG_PORT, ctx, 10) < 0) {
-		logt_print(LOG_DEBUG, "FW: Failed to open channel to %d CTX: %p\n",
-		       target, ctx);
-		goto out_fail;
-	}
-
-	/* swap + send */
-	swab_SmMessageSt(msgp);
-	if (msg_send(ctx, msgp, sizeof(*msgp)) < (int)sizeof(*msgp)) {
-		logt_print(LOG_DEBUG, "FW: Failed to send message to %d CTX: %p\n",
-		       target, ctx);
-		goto out_fail;
-	}
-
-
-        /*
-	 * Ok, we're forwarding a message to another node.  Keep tabs on
-	 * the node to make sure it doesn't die.  Basically, wake up every
-	 * now and again to make sure it's still online.  If it isn't, send
-	 * a response back to the caller.
-	 */
-	do {
-		ret = msg_receive(ctx, &msg, sizeof(msg), 10);
-		if (ret < (int)sizeof(msg)) {
-			if (ret < 0 && errno == ETIMEDOUT) {
-				m = member_list();
-				if (!memb_online(m, target)) {
-					response_code = RG_ENODE;
-					goto out_fail;
-				}
-				free_member_list(m);
-				m = NULL;
-				continue;
-			}
-
-			if (ret == 0)
-				continue;
-		}
-		break;
-	} while(++retries < 60); /* old 600 second rule */
-
-	swab_SmMessageSt(&msg);
-
-	response_code = msg.sm_data.d_ret;
-	target = msg.sm_data.d_svcOwner;
-
-out_fail:
-	free(fwmsg); 
-
-	if (resp_ctx) {
-		send_ret(resp_ctx, msgp->sm_data.d_svcName, response_code,
-			 msgp->sm_data.d_action, target);
-		msg_close(resp_ctx);
-		msg_free_ctx(resp_ctx);
-	}
-
-	if (ctx) {
-		msg_close(ctx);
-		msg_free_ctx(ctx);
-	}
-	if (m)
-		free_member_list(m);
-
-	pthread_exit(NULL);
-}
-
-
-void
-forward_message(msgctx_t *ctx, void *msgp, int nodeid)
-{
-	pthread_t newthread;
-	pthread_attr_t attrs;
-	struct fw_message *fwmsg;
-
-	fwmsg = malloc(sizeof(struct fw_message));
-	if (!fwmsg) {
-		msg_close(ctx);
-		msg_free_ctx(ctx);
-		return;
-	}
-
-	memcpy(&fwmsg->msg, msgp, sizeof(fwmsg->msg));
-	fwmsg->ctx = ctx;
-	fwmsg->nodeid = nodeid;
-
-        pthread_attr_init(&attrs);
-        pthread_attr_setinheritsched(&attrs, PTHREAD_INHERIT_SCHED);
-        pthread_attr_setdetachstate(&attrs, PTHREAD_CREATE_DETACHED);
-	pthread_attr_setstacksize(&attrs, 262144);
-
-	pthread_create(&newthread, &attrs, forwarding_thread_v2, fwmsg);
-        pthread_attr_destroy(&attrs);
-}
diff --git a/rgmanager/src/daemons/rg_locks.c b/rgmanager/src/daemons/rg_locks.c
deleted file mode 100644
index e66cf1c..0000000
--- a/rgmanager/src/daemons/rg_locks.c
+++ /dev/null
@@ -1,318 +0,0 @@
-#include <pthread.h>
-#include <stdio.h>
-#ifdef NO_CCS
-#include <libxml/xmlmemory.h>
-#include <libxml/parser.h>
-#include <libxml/xpath.h>
-#include <string.h>
-char*xpath_get_one(xmlDocPtr, xmlXPathContextPtr, char *);
-#else
-#include <ccs.h>
-#endif
-
-static int __rg_quorate = 0;
-static int __rg_lock = 0;
-static int __rg_threadcnt = 0;
-static int __rg_initialized = 0;
-
-static int _rg_statuscnt = 0;
-static int _rg_statusmax = 5; /* XXX */
-
-static pthread_cond_t unlock_cond = PTHREAD_COND_INITIALIZER;
-static pthread_cond_t zero_cond = PTHREAD_COND_INITIALIZER;
-static pthread_cond_t init_cond = PTHREAD_COND_INITIALIZER;
-
-#ifdef WRAP_LOCKS
-static pthread_mutex_t locks_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
-static pthread_mutex_t _ccs_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
-#else
-static pthread_mutex_t locks_mutex = PTHREAD_MUTEX_INITIALIZER;
-static pthread_mutex_t _ccs_mutex = PTHREAD_MUTEX_INITIALIZER;
-#endif
-
-#ifdef NO_CCS
-static xmlDocPtr ccs_doc = NULL;
-static char *conffile = DEFAULT_CONFIG_DIR "/" DEFAULT_CONFIG_FILE;
-#endif
-
-int
-rg_initialized(void)
-{
-	int ret;
-	pthread_mutex_lock(&locks_mutex);
-	ret = __rg_initialized;
-	pthread_mutex_unlock(&locks_mutex);
-	return ret;
-}
-
-
-int
-rg_set_initialized(int flag)
-{
-	if (!flag)
-		flag = ~0;
-
-	pthread_mutex_lock(&locks_mutex);
-	__rg_initialized |= flag;
-	pthread_cond_broadcast(&init_cond);
-	pthread_mutex_unlock(&locks_mutex);
-	return 0;
-}
-
-
-int
-rg_clear_initialized(int flag)
-{
-	if (!flag)
-		flag = ~0;
-	pthread_mutex_lock(&locks_mutex);
-	__rg_initialized &= ~flag;
-	pthread_mutex_unlock(&locks_mutex);
-	return 0;
-}
-
-
-int
-rg_wait_initialized(int flag)
-{
-	pthread_mutex_lock(&locks_mutex);
-	if (flag) {
-		while ((__rg_initialized & flag) != flag)
-			pthread_cond_wait(&init_cond, &locks_mutex);
-	} else {
-		while (!__rg_initialized)
-			pthread_cond_wait(&init_cond, &locks_mutex);
-	}
-	pthread_mutex_unlock(&locks_mutex);
-	return 0;
-}
-
-
-/**
-  not sure if ccs is thread safe or not
-  */
-int
-ccs_lock(void)
-#ifndef NO_CCS
-{
-	int ret;
-	pthread_mutex_lock(&_ccs_mutex);
-       	ret = ccs_connect();
-	if (ret < 0) {
-		pthread_mutex_unlock(&_ccs_mutex);
-		return -1;
-	}
-	return ret;
-}
-#else /* No ccs support */
-{
-	pthread_mutex_lock(&_ccs_mutex);
-	xmlInitParser();
-       	ccs_doc = xmlParseFile(conffile);
-	xmlCleanupParser();
-	if (!ccs_doc)
-		return -1;
-	return 0;
-}
-#endif
-
-
-int
-#ifndef NO_CCS
-ccs_unlock(int fd)
-{
-	int ret;
-
-       	ret = ccs_disconnect(fd);
-	pthread_mutex_unlock(&_ccs_mutex);
-	if (ret < 0) {
-		return -1;
-	}
-	return 0;
-}
-#else
-ccs_unlock(int __attribute__((unused)) fd)
-{
-	xmlFreeDoc(ccs_doc);
-	ccs_doc = NULL;
-	pthread_mutex_unlock(&_ccs_mutex);
-	return 0;
-}
-
-
-void
-conf_setconfig(char *path)
-{
-	pthread_mutex_lock(&_ccs_mutex);
-	conffile = path;
-	pthread_mutex_unlock(&_ccs_mutex);
-}
-
-
-int
-conf_get(char *path, char **value)
-{
-	char *foo;
-	xmlXPathContextPtr ctx;
-
-	ctx = xmlXPathNewContext(ccs_doc);
-	foo = xpath_get_one(ccs_doc, ctx, path);
-	xmlXPathFreeContext(ctx);
-
-	if (foo) {
-		*value = foo;
-		return 0;	
-	}
-	return 1;
-}
-#endif
-
-
-int
-rg_lockall(int flag)
-{
-	pthread_mutex_lock(&locks_mutex);
-	if (!__rg_lock)
-		__rg_lock |= flag;
-	pthread_mutex_unlock(&locks_mutex);
-	return 0;
-}
-
-
-int
-rg_locked(void)
-{
-	int ret;
-	pthread_mutex_lock(&locks_mutex);
-	ret = __rg_lock;
-	pthread_mutex_unlock(&locks_mutex);
-	return ret;
-}
-
-
-int
-rg_unlockall(int flag)
-{
-	pthread_mutex_lock(&locks_mutex);
-	if (__rg_lock)
-		__rg_lock &= ~flag;
-	pthread_cond_broadcast(&unlock_cond);
-	pthread_mutex_unlock(&locks_mutex);
-	return 0;
-}
-
-
-int
-rg_set_quorate(void)
-{
-	pthread_mutex_lock(&locks_mutex);
-	if (!__rg_quorate)
-		__rg_quorate = 1;
-	pthread_mutex_unlock(&locks_mutex);
-	return 0;
-}
-
-
-int
-rg_set_inquorate(void)
-{
-	pthread_mutex_lock(&locks_mutex);
-	if (__rg_quorate)
-		__rg_quorate = 0;
-	pthread_mutex_unlock(&locks_mutex);
-	return 0;
-}
-
-
-int
-rg_quorate(void)
-{
-	int ret;
-	pthread_mutex_lock(&locks_mutex);
-	ret = __rg_quorate;
-	pthread_mutex_unlock(&locks_mutex);
-	return ret;
-}
-
-
-int
-rg_inc_threads(void)
-{
-	pthread_mutex_lock(&locks_mutex);
-	++__rg_threadcnt;
-#ifdef DEBUG
-	printf("%s: %d threads active\n", __FILE__, __rg_threadcnt);
-#endif
-	pthread_mutex_unlock(&locks_mutex);
-	return 0;
-}
-
-
-int
-rg_dec_threads(void)
-{
-	pthread_mutex_lock(&locks_mutex);
-	--__rg_threadcnt;
-	if (__rg_threadcnt <= 0) {
-		__rg_threadcnt = 0;
-		pthread_cond_broadcast(&zero_cond);
-	}
-#ifdef DEBUG
-	printf("%s: %d threads active\n", __FILE__, __rg_threadcnt);
-#endif
-	pthread_mutex_unlock(&locks_mutex);
-	return 0;
-}
-
-
-int
-rg_set_statusmax(int max)
-{
-	int old;
-	
-	if (max <= 3)
-		max = 3;
-	
-	pthread_mutex_lock(&locks_mutex);
-	old = _rg_statusmax;
-	_rg_statusmax = max;
-	pthread_mutex_unlock(&locks_mutex);
-	return old;
-}
-
-
-int
-rg_inc_status(void)
-{
-	pthread_mutex_lock(&locks_mutex);
-	if (_rg_statuscnt >= _rg_statusmax) {
-		pthread_mutex_unlock(&locks_mutex);
-		return -1;
-	}
-	++_rg_statuscnt;
-	pthread_mutex_unlock(&locks_mutex);
-	return 0;
-}
-
-
-int
-rg_dec_status(void)
-{
-	pthread_mutex_lock(&locks_mutex);
-	--_rg_statuscnt;
-	if (_rg_statuscnt < 0)
-		_rg_statuscnt = 0;
-	pthread_mutex_unlock(&locks_mutex);
-	return 0;
-}
-
-
-int
-rg_wait_threads(void)
-{
-	pthread_mutex_lock(&locks_mutex);
-	if (__rg_threadcnt)
-		pthread_cond_wait(&zero_cond, &locks_mutex);
-	pthread_mutex_unlock(&locks_mutex);
-	return 0;
-}
diff --git a/rgmanager/src/daemons/rg_queue.c b/rgmanager/src/daemons/rg_queue.c
deleted file mode 100644
index f060af7..0000000
--- a/rgmanager/src/daemons/rg_queue.c
+++ /dev/null
@@ -1,67 +0,0 @@
-#include <rg_queue.h>
-#include <malloc.h>
-#include <string.h>
-#include <stdio.h>
-#include <message.h>
-
-
-int
-_rq_queue_request(request_t **queue, char *name, uint32_t request,
-		 uint32_t err, uint32_t oldreq, msgctx_t *ctx, time_t when,
-		 uint32_t target, uint32_t arg0, uint32_t arg1, char *file,
-		 int line)
-{
-	request_t *req;
-
-	req = malloc(sizeof(*req));
-	if (!req)
-		return -1;
-
-	if (name && strlen(name)) {
-		strncpy(req->rr_group, name, sizeof(req->rr_group));
-	}
-	req->rr_request = request;
-	req->rr_errorcode = err;
-	req->rr_orig_request = oldreq;
-	req->rr_resp_ctx = ctx;
-	req->rr_target = target;
-	req->rr_when = when;
-	req->rr_arg0 = arg0;
-	req->rr_arg1 = arg1;
-	req->rr_file = file;
-	req->rr_line = line;
-
-	list_insert(queue, req);
-
-	return 0;
-}
-
-
-void
-rq_free(request_t *dead)
-{
-	if (!dead)
-		return;
-
-	free(dead);
-}
-
-
-request_t *
-rq_next_request(request_t **queue)
-{
-	request_t *req = NULL;
-
-	req = *queue;
-	if (req)
-		list_remove(queue, req);
-
-	return req;
-}
-
-
-int
-rq_queue_empty(request_t **queue)
-{
-	return !(*queue);
-}
diff --git a/rgmanager/src/daemons/rg_state.c b/rgmanager/src/daemons/rg_state.c
deleted file mode 100644
index 7756d29..0000000
--- a/rgmanager/src/daemons/rg_state.c
+++ /dev/null
@@ -1,2189 +0,0 @@
-//#define DEBUG
-#include <assert.h>
-#include <platform.h>
-#include <message.h>
-#include <members.h>
-#ifdef OPENAIS
-#include <ds.h>
-#else
-#include <vf.h>
-#endif
-#include <stdio.h>
-#include <string.h>
-#include <resgroup.h>
-#include <logging.h>
-#include <lock.h>
-#include <rg_locks.h>
-#include <ccs.h>
-#include <rg_queue.h>
-#include <msgsimple.h>
-#include <res-ocf.h>
-#include <event.h>
-
-/* XXX - copied :( */
-#define cn_svccount cn_address.cna_address[0] /* Theses are uint8_t size */
-#define cn_svcexcl  cn_address.cna_address[1]
-
-int node_should_start_safe(uint32_t, cluster_member_list_t *, char *);
-
-int next_node_id(cluster_member_list_t *membership, int me);
-
-int rg_exec_script(char *rgname, char *script, char *action);
-static int _svc_stop_finish(char *svcName, int failed, uint32_t newstate);
-
-int set_rg_state(char *servicename, rg_state_t *svcblk);
-int get_rg_state(char *servicename, rg_state_t *svcblk);
-void get_recovery_policy(char *rg_name, char *buf, size_t buflen);
-int check_depend_safe(char *servicename);
-int group_migratory(char *servicename, int lock);
-int have_exclusive_resources(void);
-int check_exclusive_resources(cluster_member_list_t *membership, char *svcName);
-static int msvc_check_cluster(char *svcName);
-static inline int handle_started_status(char *svcName, int ret, rg_state_t *svcStatus);
-static inline int handle_migrate_status(char *svcName, int ret, rg_state_t *svcStatus);
-int count_resource_groups_local(cman_node_t *mp);
-int is_exclusive(char *svcName);
-
-
-int 
-next_node_id(cluster_member_list_t *membership, int me)
-{
-	int low = (int)(-1);
-	int next = me, curr;
-	int x;
-
-	for (x = 0; x < membership->cml_count; x++) {
-		curr = membership->cml_members[x].cn_nodeid;
-		if (curr < low)
-			low = curr;
-
-		if ((curr > me) && ((next == me) || (curr < next)))
-			next = curr;
-	}
-
-	/* I am highest ID; go to lowest */
-	if (next == me)
-		next = low;
-
-	return next;
-}
-
-
-char *
-c_name(char *svcName)
-{
-	char *ptr, *ret = svcName;
-
-	ptr = strchr(svcName,':');
-	if (!ptr)
-		return ret;
-	if ((int)(ptr - svcName) == 7 &&
-	    !memcmp(svcName, "service", 7)) /* strlen("service") */
-		ret = ptr + 1;
-
-	return ret;
-}
-
-
-void
-broadcast_event(char *svcName, uint32_t state, int owner, int last)
-{
-	SmMessageSt msgp;
-	msgctx_t everyone;
-
-	msgp.sm_hdr.gh_magic = GENERIC_HDR_MAGIC;
-	msgp.sm_hdr.gh_command = RG_EVENT;
-	msgp.sm_hdr.gh_length = sizeof(msgp);
-	msgp.sm_hdr.gh_arg1 = owner; 
-	msgp.sm_hdr.gh_arg2 = last; 
-	msgp.sm_data.d_action = state;
-	strncpy(msgp.sm_data.d_svcName, svcName,
-		sizeof(msgp.sm_data.d_svcName));
-	msgp.sm_data.d_svcOwner = owner;
-	msgp.sm_data.d_ret = 0;
-
-	swab_SmMessageSt(&msgp);
-
-	if (msg_open(MSG_CLUSTER, 0, RG_PORT, &everyone, 0) < 0)
-		return;
-
-	msg_send(&everyone, &msgp, sizeof(msgp));
-	msg_close(&everyone);
-}
-
-
-int
-svc_report_failure(char *svcName)
-{
-	struct dlm_lksb lockp;
-	rg_state_t svcStatus;
-	char *nodeName;
-	cluster_member_list_t *membership;
-
-	if (rg_lock(svcName, &lockp) == -1) {
-		logt_print(LOG_ERR, "#41: Couldn't obtain lock for RG %s: %s\n",
-		       svcName, strerror(errno));
-		return -1;
-	}
-
-	if (get_rg_state(svcName, &svcStatus) != 0) {
-		logt_print(LOG_ERR, "#42: Couldn't obtain status for RG %s\n",
-		       svcName);
-		rg_unlock(&lockp);
-		return -1;
-	}
-	rg_unlock(&lockp);
-
-	membership = member_list();
-	nodeName = memb_id_to_name(membership, svcStatus.rs_last_owner);
-	if (nodeName) {
-		logt_print(LOG_ALERT, "#2: Service %s returned failure "
-		       "code.  Last Owner: %s\n", svcName, nodeName);
-	} else {
-		logt_print(LOG_ALERT, "#3: Service %s returned failure "
-		       "code.  Last Owner: %d\n",
-		       svcName, (int)svcStatus.rs_last_owner);
-	}
-
-	free_member_list(membership);
-
-	logt_print(LOG_ALERT,
-	       "#4: Administrator intervention required.\n");
-
-	return 0;
-}
-
-
-int
-#ifdef DEBUG
-_rg_lock(char *name, struct dlm_lksb *p)
-#else
-rg_lock(char *name, struct dlm_lksb *p)
-#endif
-{
-	char res[256];
-
-	snprintf(res, sizeof(res), "rg=\"%s\"", name);
-	return clu_lock(LKM_EXMODE, p, 0, res);
-}
-
-
-#ifdef DEBUG
-int
-_rg_lock_dbg(char *name, struct dlm_lksb *p, char *file, int line)
-{
-	dbg_printf("rg_lock(%s) @ %s:%d\n", name, file, line);
-	return _rg_lock(name, p);
-}
-#endif
-
-
-int
-#ifdef DEBUG
-_rg_unlock(struct dlm_lksb *p)
-#else
-rg_unlock(struct dlm_lksb *p)
-#endif
-{
-	return clu_unlock(p);
-}
-
-
-#ifdef DEBUG
-int
-_rg_unlock_dbg(struct dlm_lksb *p, char *file, int line)
-{
-	dbg_printf("rg_unlock() @ %s:%d\n", file, line);
-	return _rg_unlock(p);
-}
-#endif
-
-
-void
-send_ret(msgctx_t *ctx, char *name, int ret, int orig_request, int new_owner)
-{
-	SmMessageSt msg, *msgp = &msg;
-	if (!ctx)
-		return;
-
-	msgp->sm_hdr.gh_magic = GENERIC_HDR_MAGIC;
-	msgp->sm_hdr.gh_command = RG_ACTION_REQUEST;
-	msgp->sm_hdr.gh_length = sizeof(*msgp);
-	msgp->sm_data.d_action = orig_request;
-	strncpy(msgp->sm_data.d_svcName, name,
-		sizeof(msgp->sm_data.d_svcName));
-	if (!new_owner)
-		new_owner = my_id();
-	msgp->sm_data.d_svcOwner = new_owner; /* XXX Broken */
-	msgp->sm_data.d_ret = ret;
-
-	swab_SmMessageSt(msgp);
-	msg_send(ctx, msgp, sizeof(*msgp));
-}
-
-	
-void
-send_response(int ret, int nodeid, request_t *req)
-{
-	SmMessageSt msg, *msgp = &msg;
-
-	if (req->rr_resp_ctx == NULL)
-		return;
-
-	msgp->sm_hdr.gh_magic = GENERIC_HDR_MAGIC;
-	msgp->sm_hdr.gh_command = RG_ACTION_REQUEST;
-	msgp->sm_hdr.gh_length = sizeof(*msgp);
-	msgp->sm_data.d_action = req->rr_orig_request;
-	strncpy(msgp->sm_data.d_svcName, req->rr_group,
-		sizeof(msgp->sm_data.d_svcName));
-	if (!nodeid)
-		msgp->sm_data.d_svcOwner = my_id();
-	else 
-		msgp->sm_data.d_svcOwner = nodeid;
-	msgp->sm_data.d_ret = ret;
-
-	swab_SmMessageSt(msgp);
-	msg_send(req->rr_resp_ctx, msgp, sizeof(*msgp));
-}
-
-
-int
-set_rg_state(char *name, rg_state_t *svcblk)
-{
-	char res[256];
-	rg_state_t svcblk_store;
-#ifndef OPENAIS
-	cluster_member_list_t *membership;
-	int ret, tries = 0;
-#endif
-
-	if (name)
-		strncpy(svcblk->rs_name, name, sizeof(svcblk->rs_name));
-
-	snprintf(res, sizeof(res), "rg=\"%s\"", name);
-
-	memcpy(&svcblk_store, svcblk, sizeof(svcblk_store));
-	swab_rg_state_t(&svcblk_store);
-
-#ifdef OPENAIS
-	if (ds_write(res, &svcblk_store, sizeof(svcblk_store)) < 0)
-		return -1;
-	return 0;
-#else
-	do {
-		/* Retry up to 3 times just in case members transition
-		   while we're trying to commit something */
-		membership = member_list();
-		ret = vf_write(membership, VFF_IGN_CONN_ERRORS, res,
-			       &svcblk_store,
-       		       	       sizeof(svcblk_store));
-		free_member_list(membership);
-	} while (ret == VFR_TIMEOUT && ++tries < 3);
-
-	return (ret==VFR_OK?0:-1);
-#endif
-}
-
-
-static int
-init_rg(char *name, rg_state_t *svcblk)
-{
-	svcblk->rs_owner = 0;
-	svcblk->rs_last_owner = 0;
-	svcblk->rs_state = RG_STATE_STOPPED;
-       	svcblk->rs_flags = 0;
-       	svcblk->rs_restarts = 0;
-	svcblk->rs_transition = 0;	
-	strncpy(svcblk->rs_name, name, sizeof(svcblk->rs_name));
-
-	return set_rg_state(name, svcblk);
-}
-
-
-int
-get_rg_state(char *name, rg_state_t *svcblk)
-{
-	char res[256];
-	int ret;
-#ifdef OPENAIS
-	char data[DS_MIN_SIZE];
-	int datalen;
-#else
-	uint64_t viewno;
-	void *data = NULL;
-	cluster_member_list_t *membership;
-	uint32_t datalen = 0;
-#endif
-
-	/* ... */
-	if (name)
-		strncpy(svcblk->rs_name, name, sizeof(svcblk->rs_name));
-
-	snprintf(res, sizeof(res),"rg=\"%s\"", svcblk->rs_name);
-
-#ifdef OPENAIS
-	while((datalen = ds_read(res, data, sizeof(data))) < 0) {
-		if (errno == ENOENT) {
-			ds_key_init(res, DS_MIN_SIZE, 10);
-		} else {
-			perror("ds_read");
-			return -1;
-		}
-	}
-
-	if (datalen <= 0) {
-
-		ret = init_rg(name, svcblk);
-		if (ret < 0) {
-			printf("Couldn't initialize rg %s!\n", name);
-			return RG_EFAIL;
-		}
-
-		datalen = ds_read(res, &data, sizeof(data));
-		if (ret < 0) {
-			printf("Couldn't reread rg %s! (%d)\n", name, ret);
-			return RG_EFAIL;
-		}
-	}
-
-	memcpy(svcblk, data, sizeof(*svcblk));
-	swab_rg_state_t(svcblk);
-
-	return 0;
-#else
-	membership = member_list();
-
-	ret = vf_read(membership, res, &viewno, &data, &datalen);
-
-	if (ret != VFR_OK || datalen == 0) {
-		if (data)
-			free(data);
-
-		ret = init_rg(name, svcblk);
-		if (ret != VFR_OK) {
-			free_member_list(membership);
-			printf("Couldn't initialize rg %s!\n", name);
-			return RG_EFAIL;
-		}
-
-		ret = vf_read(membership, res, &viewno, &data, &datalen);
-		if (ret != VFR_OK) {
-			if (data)
-				free(data);
-			free_member_list(membership);
-			printf("Couldn't reread rg %s! (%d)\n", name, ret);
-			return RG_EFAIL;
-		}
-	}
-
-	if (datalen < sizeof(*svcblk)) {
-		printf("Size mismatch; expected %d got %d\n",
-		       (int)sizeof(*svcblk), datalen);
-		if (data)
-			free(data);
-		free_member_list(membership);
-		return RG_EFAIL;
-	}
-
-	/* Copy out the data. */
-	memcpy(svcblk, data, sizeof(*svcblk));
-	swab_rg_state_t(svcblk);
-	free(data);
-	free_member_list(membership);
-
-	return 0;
-#endif
-}
-
-
-int vf_read_local(char *, uint64_t *, void *, uint32_t *);
-int
-get_rg_state_local(char *name, rg_state_t *svcblk)
-{
-	char res[256];
-	int ret;
-#ifdef OPENAIS
-	char data[1024];
-	int datalen;
-#else
-	void *data = NULL;
-	uint64_t viewno;
-	uint32_t datalen;
-#endif
-
-	/* ... */
-	if (name)
-		strncpy(svcblk->rs_name, name, sizeof(svcblk->rs_name));
-
-	snprintf(res, sizeof(res),"rg=\"%s\"", svcblk->rs_name);
-
-#ifdef OPENAIS
-	ret = ds_read(res, data, sizeof(data));
-	if (ret <= 0) {
-#else
-	ret = vf_read_local(res, &viewno, &data, &datalen);
-
-	if (ret != VFR_OK || datalen == 0 ||
-	    datalen != sizeof(*svcblk)) {
-		if (data)
-			free(data);
-#endif
-		svcblk->rs_owner = 0;
-		svcblk->rs_last_owner = 0;
-		svcblk->rs_state = RG_STATE_UNINITIALIZED;
-       		svcblk->rs_flags = 0;
-       		svcblk->rs_restarts = 0;
-		svcblk->rs_transition = 0;	
-		strncpy(svcblk->rs_name, name, sizeof(svcblk->rs_name));
-
-		return RG_EFAIL;
-	}
-
-	/* Copy out the data. */
-	memcpy(svcblk, data, sizeof(*svcblk));
-	swab_rg_state_t(svcblk);
-#ifndef OPENAIS
-	free(data);
-#endif
-	return 0;
-}
-
-
-/**
- * Advise service manager as to whether or not to stop a service, given
- * that we already know it's legal to run the service.
- *
- * @param svcStatus	Current service status.
- * @param svcName	Service name
- * @param req		Specify request to perform
- * @return		0 = DO NOT stop service, return RG_EFAIL
- *			1 = STOP service - return whatever it returns.
- *			2 = DO NOT stop service, return 0 (success)
- *                      3 = DO NOT stop service, return RG_EFORWARD
- *			4 = DO NOT stop service, return RG_EAGAIN
- *			5 = DO NOT stop service, return RG_EFROZEN
- *			6 = DO NOT stop service, mark stopped and return
- *			    RG_SUCCESS (0)
- */
-int
-svc_advise_stop(rg_state_t *svcStatus, char *svcName, int req)
-{
-	cluster_member_list_t *membership = member_list();
-	int ret = 0;
-	
-	if (svcStatus->rs_flags & RG_FLAG_FROZEN) {
-		logt_print(LOG_DEBUG, "Service %s frozen.\n", svcName);
-		return 5;
-	}
-
-	switch(svcStatus->rs_state) {
-	case RG_STATE_FAILED:
-		if (req == RG_DISABLE)
-			ret = 1; /* Failed services can be disabled */
-		else
-			ret = 0; /* Failed services may not be stopped */
-		break;
-		
-	case RG_STATE_STOPPING:
-	case RG_STATE_STARTED:
-	case RG_STATE_CHECK:
-	case RG_STATE_STARTING:
-	case RG_STATE_RECOVER:
-	case RG_STATE_MIGRATE:
-		if ((svcStatus->rs_owner != (uint32_t)my_id()) &&
-		    memb_online(membership, svcStatus->rs_owner)) {
-			/*
-			   Service is running and the owner is online.
-			   Forward the request if it's a user request
-			   (e.g. disable).
-			 */
-			if (req == RG_STOP) {
-				/*
-				   It's running somewhere, but not here,
-				   and it's not a user request.  Toss
-				   it out the window.
-				 */
-				ret = 2;
-				break;
-			}
-
-			/* Disable or relocate request here. */
-			logt_print(LOG_DEBUG, "Forwarding req. to %s.\n",
-			       memb_id_to_name(membership,
-					       svcStatus->rs_owner));
-			ret = 3;
-			break;
-		}
-
-		if (svcStatus->rs_owner == 0 ||
-		    (svcStatus->rs_owner == (uint32_t)my_id())) {
-			/*
-			   Service is marked as running locally or on
-			   0 (e.g. no member).  Safe
-			   to do a full stop.
-			 */
-			ret = 1;
-			break;
-		}
-
-		/*
-		   Service is marked as running but node is down.
-		   Doesn't make much sense to stop it - but we need
-		   to mark it stopped
-		 */
-		ret = 6;
-		break;
-
-	case RG_STATE_ERROR:
-		/* Don't stop; return failure. */
-		if (req == RG_DISABLE) {
-			ret = 1;
-			break;
-		}
-		logt_print(LOG_DEBUG,
-		       "Not stopping %s: service is failed\n",
-		       svcName);
-		ret = 0;
-		break;
-
-	case RG_STATE_STOPPED:
-		/* Allow disabling of stopped services */
-		if (req == RG_DISABLE)
-			ret = 1;
-		else
-			ret = 2; /* if it's already stopped, do nothing */
-		break;
-	
-	case RG_STATE_DISABLED:
-	case RG_STATE_UNINITIALIZED:
-		if (req == RG_DISABLE) {
-			logt_print(LOG_NOTICE,
-			       "Disabling disabled service %s\n",
-			       svcName);
-			ret = 1;
-			break;
-		}
-
-		ret = 2;
-		logt_print(LOG_DEBUG, "Not stopping disabled service %s\n",
-		       svcName);
-		break;
-
-	default:
-		logt_print(LOG_ERR,
-		       "#42: Cannot stop RG %s: Invalid State %d\n",
-		       svcName, svcStatus->rs_state);
-		break;
-	}
-
-	free_member_list(membership);
-	return ret;
-}
-
-
-/**
- * Advise service manager as to whether or not to start a service, given
- * that we already know it's legal to run the service.
- *
- * @param svcStatus	Current service status.
- * @param svcName	Service name
- * @param flags		Specify whether or not it's legal to start a 
- *			disabled service, etc.
- * @return		0 = DO NOT start service, return RG_EFAIL
- *			1 = START service - return whatever it returns.
- *			2 = DO NOT start service, return 0
- *			3 = DO NOT start service, return RG_EAGAIN
- *			4 = DO NOT start service, return RG_ERUN
- *			5 = DO NOT start service, return RG_EFROZEN
- */
-int
-svc_advise_start(rg_state_t *svcStatus, char *svcName, int req)
-{
-	cluster_member_list_t *membership = member_list();
-	int ret = 0;
-	
-	if (svcStatus->rs_flags & RG_FLAG_FROZEN) {
-		logt_print(LOG_DEBUG, "Service %s frozen.\n", svcName);
-		return 5;
-	}
-
-	switch(svcStatus->rs_state) {
-	case RG_STATE_FAILED:
-		logt_print(LOG_ERR,
-		       "#43: Service %s has failed; can not start.\n",
-		       svcName);
-		break;
-
-	case RG_STATE_MIGRATE:
-		ret = 4;
-		break;
-		
-	case RG_STATE_STOPPING:
-	case RG_STATE_STARTED:
-	case RG_STATE_CHECK:
-	case RG_STATE_STARTING:
-		if (svcStatus->rs_owner == (uint32_t)my_id()) {
-		    	/*
-			 * Service is already running locally
-			logt_print(LOG_DEBUG,
-			       "RG %s is already running locally\n", svcName);
-			 */
-			ret = 4;
-			break;
-		}
-
-		if (svcStatus->rs_owner != (uint32_t)my_id() &&
-		    memb_online(membership, svcStatus->rs_owner)) {
-			/*
-			 * Service is running and the owner is online!
-			logt_print(LOG_DEBUG, "RG %s is running on member %s.\n",
-			       svcName,
-			       memb_id_to_name(membership,svcStatus->rs_owner));
-			 */
-			ret = 4;
-			break;
-		}
-
-		/* We are allowed to do something with the service.  Make
-		   sure we're not locked */
-		if (svcStatus->rs_owner == 0) {
-			if (rg_locked()) {
-				ret = 3;
-				break;
-			}
-
-			logt_print(LOG_NOTICE,
-			       "Starting stopped service%s\n",
-			       svcName);
-			ret = 1;
-			break;
-		}
-
-		if (rg_locked()) {
-			logt_print(LOG_WARNING, "Not initiating failover of %s: "
-			       "Resource groups locked!\n", svcName);
-			ret = 3;
-			break;
-		}
-
-		/*
-		 * Service is running but owner is down -> RG_EFAILOVER
-		 */
-		logt_print(LOG_NOTICE,
-		       "Taking over service %s from down member %s\n",
-		       svcName, memb_id_to_name(membership,
-						svcStatus->rs_owner));
-		ret = 1;
-		break;
-
-	case RG_STATE_RECOVER:
-		/*
-		 * Starting failed service...
-		 */
-		if (req == RG_START_RECOVER || central_events_enabled()) {
-			logt_print(LOG_NOTICE,
-			       "Recovering failed service %s\n",
-			       svcName);
-			svcStatus->rs_state = RG_STATE_STOPPED;
-			/* Start! */
-			ret = 1;
-			break;
-		}
-
-		/* Don't start, but return success. */
-		logt_print(LOG_DEBUG,
-		       "Not starting %s: recovery state\n",
-		       svcName);
-		ret = 2;
-		break;
-
-	case RG_STATE_STOPPED:
-	case RG_STATE_ERROR:
-		/* Don't actually enable if the RG is locked! */
-		if (rg_locked()) {
-			ret = 3;
-			break;
-		}
-
-		logt_print(LOG_NOTICE, "Starting stopped service %s\n",
-		       svcName);
-		ret = 1;
-		break;
-	
-	case RG_STATE_DISABLED:
-	case RG_STATE_UNINITIALIZED:
-		if (req == RG_ENABLE || req == RG_START_REMOTE) {
-			/* Don't actually enable if the RG is locked! */
-			if (rg_locked()) {
-				ret = 3;
-				break;
-			}
-
-			logt_print(LOG_NOTICE,
-			       "Starting disabled service %s\n",
-			       svcName);
-			ret = 1;
-			break;
-		}
-		if (req == RG_START_RECOVER) {
-			ret = 1;
-			break;
-		}
-
-		logt_print(LOG_DEBUG, "Not starting disabled RG %s\n",
-		       svcName);
-		break;
-
-	default:
-		logt_print(LOG_ERR,
-		       "#44: Cannot start RG %s: Invalid State %d\n",
-		       svcName, svcStatus->rs_state);
-		break;
-	}
-
-	free_member_list(membership);
-	return ret;
-}
-
-
-/**
- * Start a cluster service.
- *
- * @param svcName	Service ID to start.
- * @param flags		Service-operation specific flags to take into account.
- * @see svc_advise_start
- * @return		FAIL, 0
- */
-int
-svc_start(char *svcName, int req)
-{
-	struct dlm_lksb lockp;
-	int ret;
-	rg_state_t svcStatus;
-
-	if (rg_lock(svcName, &lockp) < 0) {
-		logt_print(LOG_ERR, "#45: Unable to obtain cluster lock: %s\n",
-		       strerror(errno));
-		return RG_EFAIL;
-	}
-
-	if (get_rg_state(svcName, &svcStatus) != 0) {
-		rg_unlock(&lockp);
-		logt_print(LOG_ERR, "#46: Failed getting status for RG %s\n",
-		       svcName);
-		return RG_EFAIL;
-	}
-
-	/* LOCK HELD */
-	switch (svc_advise_start(&svcStatus, svcName, req)) {
-	case 0: /* Don't start service, return RG_EFAIL */
-		rg_unlock(&lockp);
-		return RG_EFAIL;
-	case 2: /* Don't start service, return 0 */
-		rg_unlock(&lockp);
-		return 0;
-	case 3:
-		rg_unlock(&lockp);
-		return RG_EAGAIN;
-	case 4:
-		rg_unlock(&lockp);
-		return RG_ERUN;
-	case 5:
-		rg_unlock(&lockp);
-		return RG_EFROZEN;
-	default:
-		break;
-	}
-
-	/* LOCK HELD if we get here */
-
-	svcStatus.rs_owner = my_id();
-	svcStatus.rs_state = RG_STATE_STARTING;
-	svcStatus.rs_transition = (uint64_t)time(NULL);
-
-	if (req == RG_START_RECOVER)
-		svcStatus.rs_restarts++;
-	else
-		svcStatus.rs_restarts = 0;
-
-	if (set_rg_state(svcName, &svcStatus) < 0) {
-		logt_print(LOG_ERR,
-		       "#47: Failed changing service status\n");
-		rg_unlock(&lockp);
-		return RG_EFAIL;
-	}
-	
-	rg_unlock(&lockp);
-
-	ret = group_op(svcName, RG_START);
-	ret = !!ret; /* Either it worked or it didn't.  Ignore all the
-			cute values scripts might return */
-
-	if (rg_lock(svcName, &lockp) < 0) {
-		logt_print(LOG_ERR, "#74: Unable to obtain cluster lock: %s\n",
-		       strerror(errno));
-		return RG_EFAIL;
-	}
-
-	svcStatus.rs_state = RG_STATE_STARTED;
-	if (set_rg_state(svcName, &svcStatus) != 0) {
-		logt_print(LOG_ERR,
-		       "#75: Failed changing service status\n");
-		rg_unlock(&lockp);
-		return RG_EFAIL;
-	}
-	rg_unlock(&lockp);
-       
-	if (ret == 0) {
-		logt_print(LOG_NOTICE,
-		       "Service %s started\n",
-		       svcName);
-
-		broadcast_event(svcName, RG_STATE_STARTED, svcStatus.rs_owner,
-				svcStatus.rs_last_owner);
-	} else {
-		logt_print(LOG_WARNING,
-		       "#68: Failed to start %s; return value: %d\n",
-		       svcName, ret);
-	}
-
-	return ret;
-}
-
-
-/**
- * Migrate a service to another node.
- */
-int
-svc_migrate(char *svcName, int target)
-{
-	struct dlm_lksb lockp;
-	rg_state_t svcStatus;
-	int ret;
-	cluster_member_list_t *membership;
-	cman_node_t *m;
-
-	if (!group_migratory(svcName, 1))
-		return RG_EINVAL;
-
-	membership = member_list();
-	m = memb_id_to_p(membership, target);
-	if (!m) {
-		free_member_list(membership);
-		return RG_EINVAL;
-	}
-
-	count_resource_groups_local(m);
-	if (m->cn_svcexcl ||
-	    (m->cn_svccount && is_exclusive(svcName))) {
-		free_member_list(membership);
-		return RG_EDEPEND;
-	}
-	free_member_list(membership);
-
-	if (rg_lock(svcName, &lockp) < 0) {
-		logt_print(LOG_ERR, "#45: Unable to obtain cluster lock: %s\n",
-		       strerror(errno));
-		return RG_EFAIL;
-	}
-
-	if (get_rg_state(svcName, &svcStatus) != 0) {
-		rg_unlock(&lockp);
-		logt_print(LOG_ERR, "#46: Failed getting status for RG %s\n",
-		       svcName);
-		return RG_EFAIL;
-	}
-
-	if (svcStatus.rs_owner == (uint32_t)target) {
-		rg_unlock(&lockp);
-		/* Do not allow migration to its current owner! */
-		return 0;
-	}
-
-	if (svcStatus.rs_owner != (uint32_t)my_id()) {
-		rg_unlock(&lockp);
-		return RG_EFORWARD;
-	}
-
-	switch(svcStatus.rs_state) {
-	case RG_STATE_STARTED:
-		break;
-	case RG_STATE_STARTING:
-	case RG_STATE_STOPPING:
-	case RG_STATE_RECOVER:
-	case RG_STATE_MIGRATE:
-	case RG_STATE_ERROR:
-		rg_unlock(&lockp);
-		return RG_EAGAIN;
-	default:
-		rg_unlock(&lockp);
-		return RG_EFAIL;
-	}
-
-	/* LOCK HELD */
-	svcStatus.rs_owner = target;
-	svcStatus.rs_last_owner = my_id();
-	svcStatus.rs_state = RG_STATE_MIGRATE;
-	svcStatus.rs_transition = (uint64_t)time(NULL);
-
-	if (set_rg_state(svcName, &svcStatus) != 0) {
-		logt_print(LOG_ERR,
-		       "#75: Failed changing service status\n");
-		rg_unlock(&lockp);
-		return RG_EFAIL;
-	}
-	rg_unlock(&lockp);
-       
-	ret = group_migrate(svcName, target);
-
-	switch(ret) {
-	default:
-	case -1:
-	case OCF_RA_ERROR:
-		svc_fail(svcName);
-		/* XXX run svc_status again here to see if it's still
-		   healthy; if it is, don't FAIL it; it could be that
-		   the target node simply died; in this case, set status
-		   back to started */
-		return RG_EFAIL;
-		break;
-	case OCF_RA_NOT_RUNNING:
-		/* For these two, the VM was either not running or 
-		   migration is simply impossible. */
-		/* Don't mark the service as failed; since it's either
-		   recoverable or still running. */
-		ret = RG_EFAIL;
-		break;
-	case OCF_RA_NOT_CONFIGURED:
-		ret = RG_EINVAL;
-		break;
-	case 0:
-		return 0;
-	}
-
-	/* Ok, we've hit a recoverable condition.  Since VMs and migratory
-	   services are ... well, migratable, we can just flip the state
-	   back to 'started' and error checking will fix it later. */
-	if (rg_lock(svcName, &lockp) < 0) {
-		logt_print(LOG_ERR, "#45: Unable to obtain cluster lock: %s\n",
-		       strerror(errno));
-		return ret;
-	}
-
-	if (get_rg_state(svcName, &svcStatus) != 0) {
-		rg_unlock(&lockp);
-		logt_print(LOG_ERR, "#46: Failed getting status for RG %s\n",
-		       svcName);
-		return ret;
-	}
-
-	if (svcStatus.rs_last_owner != (uint32_t)my_id() ||
-	    svcStatus.rs_owner != (uint32_t)target ||
-	    svcStatus.rs_state != RG_STATE_MIGRATE) {
-		rg_unlock(&lockp);
-		return ret;
-	}
-
-	svcStatus.rs_owner = my_id();
-	svcStatus.rs_state = RG_STATE_STARTED;
-
-	set_rg_state(svcName, &svcStatus);
-	rg_unlock(&lockp);
-
-	return ret;
-}
-
-
-/**
- * Ask the other nodes if they've seen this service.  This can be used
- * to allow users the ability to use non-rgmanager tools to migrate
- * a virtual machine to another node in the cluster.
- * 
- * Returns the node ID of the new owner, if any.  -1 if no one in the
- * cluster has seen the service.
- */
-int
-get_new_owner(char *svcName)
-{
-	SmMessageSt msgp, response;
-	msgctx_t ctx;
-	cluster_member_list_t *membership;
-	int x, ret = -1, me = my_id();
-
-	/* Build message */
-	msgp.sm_hdr.gh_magic = GENERIC_HDR_MAGIC;
-	msgp.sm_hdr.gh_command = RG_ACTION_REQUEST;
-	msgp.sm_hdr.gh_arg1 = RG_STATUS_INQUIRY;
-	msgp.sm_hdr.gh_length = sizeof(msgp);
-	msgp.sm_data.d_action = RG_STATUS_INQUIRY;
-	strncpy(msgp.sm_data.d_svcName, svcName,
-		sizeof(msgp.sm_data.d_svcName));
-	msgp.sm_data.d_svcOwner = 0;
-	msgp.sm_data.d_ret = 0;
-
-	swab_SmMessageSt(&msgp);
-
-	membership = member_list();
-	for (x = 0; x < membership->cml_count && ret < 0; x++) {
-
-		/* don't query down members */
-		if (!membership->cml_members[x].cn_member)
-			continue;
-		/* don't query self */
-		if (membership->cml_members[x].cn_nodeid == me)
-			continue;
-
-		if (msg_open(MSG_CLUSTER, membership->cml_members[x].cn_nodeid,
-			     RG_PORT, &ctx, 2) < 0) {
-			/* failed to open: better to claim false successful
-			   status rather than claim a failure and possibly
-			   end up with a service on >1 node */
-			goto out;
-		}
-
-		msg_send(&ctx, &msgp, sizeof(msgp));
-		if (msg_receive(&ctx, &response, sizeof (response), 5) != sizeof(response))
-			goto cont;;
-
-		swab_SmMessageSt(&response);
-		if (response.sm_data.d_ret == RG_SUCCESS)
-			ret = response.sm_data.d_svcOwner;
-		else
-			ret = -1;
-
-cont:
-		msg_close(&ctx);
-	}
-
-out:
-	free_member_list(membership);
-	
-	return ret;
-}
-
-
-/**
-   If a service is 'migratory' - that is, it has the 'migratory' attribute
-   and has no children, this will query other nodes in the cluster, checking
-   to see if the service has migrated to that node using a status inquiry
-   message.  Note that this is a very inefficient thing to do; it would be
-   much, much better to simply use the cluster tools to migrate rather than
-   using the standard management tools for the service/virtual machine.
- */
-static int
-msvc_check_cluster(char *svcName)
-{
-	struct dlm_lksb lockp;
-	int newowner;
-	rg_state_t svcStatus;
-
-	if (!group_migratory(svcName, 1))
-		return -1;
-
-	newowner = get_new_owner(svcName);
-	if (newowner < 0) {
-		logt_print(LOG_DEBUG, "No other nodes have seen %s\n", svcName);
-		return -1;
-	}
-
-	/* New owner found */
-	logt_print(LOG_NOTICE, "Migration: %s is running on %d\n", svcName, newowner);
-
-	/* If the check succeeds (returns 0), then flip the state back to
-	   'started' - with a new owner */
-	if (rg_lock(svcName, &lockp) < 0) {
-		logt_print(LOG_ERR, "#451: Unable to obtain cluster lock: %s\n",
-			strerror(errno));
-		return -1;
-	}
-
-	if (get_rg_state(svcName, &svcStatus) != 0) {
-		rg_unlock(&lockp);
-		logt_print(LOG_ERR, "#452: Failed getting status for RG %s\n",
-		       svcName);
-		return -1;
-	}
-
-	svcStatus.rs_state = RG_STATE_STARTED;
-	svcStatus.rs_owner = newowner;
-
-	if (set_rg_state(svcName, &svcStatus) != 0) {
-		rg_unlock(&lockp);
-		logt_print(LOG_ERR, "#453: Failed setting status for RG %s\n",
-		       svcName);
-		return -1;
-	}
-	rg_unlock(&lockp);
-
-	return newowner;
-}
-
-
-/**
- * Check status of a cluster service 
- *
- * @param svcName	Service name to check.
- * @return		RG_EFORWARD, RG_EFAIL, 0
- */
-int
-svc_status(char *svcName)
-{
-	struct dlm_lksb lockp;
-	rg_state_t svcStatus;
-	int ret;
-
-	if (rg_lock(svcName, &lockp) < 0) {
-		logt_print(LOG_ERR, "#48: Unable to obtain cluster lock: %s\n",
-		       strerror(errno));
-		return RG_EFAIL;
-	}
-
-	if (get_rg_state(svcName, &svcStatus) != 0) {
-		rg_unlock(&lockp);
-		logt_print(LOG_ERR, "#49: Failed getting status for RG %s\n",
-		       svcName);
-		return RG_EFAIL;
-	}
-	rg_unlock(&lockp);
-
-	if (svcStatus.rs_flags & RG_FLAG_FROZEN)
-		/* Don't check status if the service is frozen */
-		return 0;
-
-	if (svcStatus.rs_owner != (uint32_t)my_id())
-		/* Don't check status for anything not owned */
-		return 0;
-
-	if (svcStatus.rs_state != RG_STATE_STARTED &&
-	    svcStatus.rs_state != RG_STATE_MIGRATE)
-		/* Not-running RGs should not be checked either. */
-		return 0;
-
-	ret = group_op(svcName, RG_STATUS);
-
-	/* For running services, if the return code is 0, we're done*/
-	if (svcStatus.rs_state == RG_STATE_STARTED)
-		return handle_started_status(svcName, ret, &svcStatus);
-	
-	return handle_migrate_status(svcName, ret, &svcStatus);
-}
-
-
-static inline int
-handle_started_status(char *svcName, int ret,
-		      rg_state_t __attribute__((unused)) *svcStatus)
-{
-	int newowner;
-
-	if (ret & SFL_FAILURE) {
-		newowner = msvc_check_cluster(svcName);
-		if (newowner >= 0)
-			return 0; /* running but not here */
-		return ret;	  /* not running anymore */
-	}
-
-	/* Ok, we have a recoverable service.  Try to perform
-	   inline recovery */
-	if (ret & SFL_RECOVERABLE) {
-
-		logt_print(LOG_WARNING, "Some independent resources in %s failed; "
-		       "Attempting inline recovery\n", svcName);
-
-		ret = group_op(svcName, RG_CONDSTOP);
-		if (!(ret & SFL_FAILURE)) {
-			ret = group_op(svcName, RG_CONDSTART);
-		}
-
-		if (ret) {
-			logt_print(LOG_WARNING, "Inline recovery of %s failed\n",
-			       svcName);
-		} else {
-			logt_print(LOG_NOTICE,
-			       "Inline recovery of %s succeeded\n",
-			       svcName);
-			return 0;
-		}
-	}
-
-	return ret;
-}
-
-
-static inline int
-handle_migrate_status(char *svcName, int ret, rg_state_t *svcStatus)
-{
-	struct dlm_lksb lockp;
-	/* For service(s) migrating to the local node, ignore invalid
-	   return codes.
-	   XXX Should put a timeout on migrating services */
-	if (ret != 0)
-		return 0;
-
-	/* If the check succeeds (returns 0), then flip the state back to
-	   'started' - we now own the service */
-	if (rg_lock(svcName, &lockp) < 0) {
-		logt_print(LOG_ERR, "#45: Unable to obtain cluster lock: %s\n",
-			strerror(errno));
-		return RG_EFAIL;
-	}
-
-	svcStatus->rs_state = RG_STATE_STARTED;
-	if (set_rg_state(svcName, svcStatus) != 0) {
-		rg_unlock(&lockp);
-		logt_print(LOG_ERR, "#46: Failed getting status for RG %s\n",
-		       svcName);
-		return RG_EFAIL;
-	}
-	rg_unlock(&lockp);
-
-	logt_print(LOG_NOTICE, "%s is now running locally\n", svcName);
-
-	return 0;
-}
-
-
-int
-svc_status_inquiry(char *svcName)
-{
-	rg_state_t svcStatus;
-
-	if (get_rg_state_local(svcName, &svcStatus) != 0) {
-		logt_print(LOG_ERR, "Failed getting local status for RG %s\n",
-		       svcName);
-		return RG_EFAIL;
-	}
-
-	if (svcStatus.rs_flags & RG_FLAG_FROZEN)
-		return 0;
-	
-	return group_op(svcName, RG_STATUS);
-}
-
-
-/**
- * Stop a cluster service.
- *
- * @param svcName	Service ID to stop.
- * @param flags		Service-operation specific flags to take into account.
- * @see svc_advise_stop
- * @return		FAIL, 0
- */
-static int
-_svc_stop(char *svcName, int req, int recover, uint32_t newstate)
-{
-	struct dlm_lksb lockp;
-	rg_state_t svcStatus;
-	int ret;
-	int old_state;
-
-	if (!rg_quorate()) {
-		logt_print(LOG_WARNING, "#69: Unclean %s of %s\n", 
-		       rg_req_str(req), svcName);
-		return group_op(svcName, RG_STOP);
-	}
-
-	if (rg_lock(svcName, &lockp) == RG_EFAIL) {
-		logt_print(LOG_ERR, "#50: Unable to obtain cluster lock: %s\n",
-		       strerror(errno));
-		return RG_EFAIL;
-	}
-
-	if (get_rg_state(svcName, &svcStatus) != 0) {
-		rg_unlock(&lockp);
-		logt_print(LOG_ERR, "#51: Failed getting status for RG %s\n",
-		       svcName);
-		return RG_EFAIL;
-	}
-
-	switch (svc_advise_stop(&svcStatus, svcName, req)) {
-	case 0:
-		rg_unlock(&lockp);
-		logt_print(LOG_DEBUG, "Unable to stop RG %s in %s state\n",
-		       svcName, rg_state_str(svcStatus.rs_state));
-		return RG_EFAIL;
-	case 6:
-		/* Mark stopped, but do not do anything */
-		svcStatus.rs_last_owner = svcStatus.rs_owner;
-		svcStatus.rs_owner = 0;
-		svcStatus.rs_state = RG_STATE_STOPPED;
-		if (set_rg_state(svcName, &svcStatus) != 0) {
-			rg_unlock(&lockp);
-			return RG_EFAIL;
-		}
-		/* FALLTHROUGH */
-	case 2:
-		rg_unlock(&lockp);
-		return RG_ESUCCESS;
-	case 3:
-		rg_unlock(&lockp);
-		return RG_EFORWARD;
-	case 4:
-		rg_unlock(&lockp);
-		return RG_EAGAIN;
-	case 5:
-		rg_unlock(&lockp);
-		return RG_EFROZEN;
-	default:
-		break;
-	}
-
-	old_state = svcStatus.rs_state;
-
-	logt_print(LOG_NOTICE, "Stopping service %s\n", svcName);
-
-	if (recover) 
-	       	svcStatus.rs_state = RG_STATE_ERROR;
-	else
-		svcStatus.rs_state = RG_STATE_STOPPING;
-	svcStatus.rs_transition = (uint64_t)time(NULL);
-
-	//printf("rg state = %s\n", rg_state_str(svcStatus.rs_state));
-
-	if (set_rg_state(svcName, &svcStatus) != 0) {
-		rg_unlock(&lockp);
-		logt_print(LOG_ERR, "#52: Failed changing RG status\n");
-		return RG_EFAIL;
-	}
-	rg_unlock(&lockp);
-
-	ret = group_op(svcName, RG_STOP);
-
-	if (old_state == RG_STATE_FAILED && newstate == RG_STATE_DISABLED) {
-		if (ret)
-			logt_print(LOG_ALERT, "Marking %s as 'disabled', "
-			       "but some resources may still be allocated!\n",
-			       svcName);
-		_svc_stop_finish(svcName, 0, newstate);
-	} else {
-		_svc_stop_finish(svcName, ret, newstate);
-	}
-
-	return ret;
-}
-
-
-static int
-_svc_stop_finish(char *svcName, int failed, uint32_t newstate)
-{
-	rg_state_t svcStatus;
-	struct dlm_lksb lockp;
-
-	if (rg_lock(svcName, &lockp) == RG_EFAIL) {
-		logt_print(LOG_ERR, "#53: Unable to obtain cluster lock: %s\n",
-		       strerror(errno));
-		return RG_EFAIL;
-	}
-
-	if (get_rg_state(svcName, &svcStatus) != 0) {
-		rg_unlock(&lockp);
-		logt_print(LOG_ERR, "#54: Failed getting status for RG %s\n",
-		       svcName);
-		return RG_EFAIL;
-	}
-
-	if ((svcStatus.rs_state != RG_STATE_STOPPING) &&
-	    (svcStatus.rs_state != RG_STATE_ERROR) &&
-	    (svcStatus.rs_state != RG_STATE_RECOVER)) {
-		rg_unlock(&lockp);
-		return 0;
-	}
-
-	svcStatus.rs_last_owner = svcStatus.rs_owner;
-	svcStatus.rs_owner = 0;
-
-	if (failed) {
-		logt_print(LOG_CRIT, "#12: RG %s failed to stop; intervention "
-		       "required\n", svcName);
-		newstate = RG_STATE_FAILED;
-	} else if (svcStatus.rs_state == RG_STATE_ERROR) {
-		svcStatus.rs_state = RG_STATE_RECOVER;
-		newstate = RG_STATE_RECOVER;
-	}
-
-	svcStatus.rs_state = newstate;
-
-	logt_print(LOG_NOTICE, "Service %s is %s\n", svcName,
-	       rg_state_str(svcStatus.rs_state));
-	//printf("rg state = %s\n", rg_state_str(svcStatus.rs_state));
-
-	svcStatus.rs_transition = (uint64_t)time(NULL);
-	if (set_rg_state(svcName, &svcStatus) != 0) {
-		rg_unlock(&lockp);
-		logt_print(LOG_ERR, "#55: Failed changing RG status\n");
-		return RG_EFAIL;
-	}
-	rg_unlock(&lockp);
-
-	broadcast_event(svcName, newstate, -1, svcStatus.rs_last_owner);
-
-	return 0;
-}
-
-
-/**
- * Disable a cluster service.  Services in the disabled state are never
- * automatically started by the service manager - one must send a SVC_START
- * message.
- *
- * @param svcName	Service ID to stop.
- * @return		FAIL, 0
- */
-int
-svc_disable(char *svcName)
-{
-	return _svc_stop(svcName, RG_DISABLE, 0, RG_STATE_DISABLED);
-}
-
-
-int
-svc_stop(char *svcName, int req)
-{
-	return _svc_stop(svcName, req, (req == RG_STOP_RECOVER),
-			 RG_STATE_STOPPED);
-}
-
-
-/**
- * Mark a cluster service as failed.  User intervention required.
- *
- * @param svcName	Service ID to stop.
- * @return		FAIL, 0
- */
-int
-svc_fail(char *svcName)
-{
-	struct dlm_lksb lockp;
-	rg_state_t svcStatus;
-
-	if (rg_lock(svcName, &lockp) == RG_EFAIL) {
-		logt_print(LOG_ERR, "#55: Unable to obtain cluster lock: %s\n",
-		       strerror(errno));
-		return RG_EFAIL;
-	}
-
-	logt_print(LOG_DEBUG, "Handling failure request for RG %s\n", svcName);
-
-	if (get_rg_state(svcName, &svcStatus) != 0) {
-		rg_unlock(&lockp);
-		logt_print(LOG_ERR, "#56: Failed getting status for RG %s\n",
-		       svcName);
-		return RG_EFAIL;
-	}
-
-	if ((svcStatus.rs_state == RG_STATE_STARTED) &&
-	    (svcStatus.rs_owner != (uint32_t)my_id())) {
-		rg_unlock(&lockp);
-		logt_print(LOG_DEBUG, "Unable to disable RG %s in %s state\n",
-		       svcName, rg_state_str(svcStatus.rs_state));
-		return RG_EFAIL;
-	}
-
-	/*
-	 * Leave a bread crumb so we can debug the problem with the service!
-	 */
-	if (svcStatus.rs_owner != 0) {
-		svcStatus.rs_last_owner = svcStatus.rs_owner;
-		svcStatus.rs_owner = 0;
-	}
-	svcStatus.rs_state = RG_STATE_FAILED;
-	svcStatus.rs_transition = (uint64_t)time(NULL);
-	svcStatus.rs_restarts = 0;
-	if (set_rg_state(svcName, &svcStatus) != 0) {
-		rg_unlock(&lockp);
-		logt_print(LOG_ERR, "#57: Failed changing RG status\n");
-		return RG_EFAIL;
-	}
-	rg_unlock(&lockp);
-
-	broadcast_event(svcName, RG_STATE_FAILED, -1,
-			svcStatus.rs_last_owner);
-
-	return 0;
-}
-
-/**
- * Flag/Unflag a cluster service as frozen.
- *
- * @param svcName	Service ID to flag/unflag as frozen.
- * @return		FAIL, 0
- */
-int
-_svc_freeze(char *svcName, int enabled)
-{
-	struct dlm_lksb lockp;
-	rg_state_t svcStatus;
-
-	if (rg_lock(svcName, &lockp) == RG_EFAIL) {
-		logt_print(LOG_ERR, "#55: Unable to obtain cluster lock: %s\n",
-		       strerror(errno));
-		return RG_EFAIL;
-	}
-
-	logt_print(LOG_DEBUG, "Handling %s request for RG %s\n", enabled?"freeze":"unfreeze",
-	       svcName);
-
-	if (get_rg_state(svcName, &svcStatus) != 0) {
-		rg_unlock(&lockp);
-		logt_print(LOG_ERR, "#56: Failed getting status for RG %s\n",
-		       svcName);
-		return RG_EFAIL;
-	}
-
-	switch(svcStatus.rs_state) {
-	case RG_STATE_STOPPED:
-	case RG_STATE_STARTED:
-	case RG_STATE_DISABLED:
-
-		if (enabled == 1) {
-			logt_print(LOG_DEBUG, "Freezing RG %s\n", svcName);
-			svcStatus.rs_flags |= RG_FLAG_FROZEN;
-		} else {
-			logt_print(LOG_DEBUG, "Unfreezing RG %s\n", svcName);
-			svcStatus.rs_flags &= ~RG_FLAG_FROZEN;
-		}
-
-		if (set_rg_state(svcName, &svcStatus) != 0) {
-			rg_unlock(&lockp);
-			logt_print(LOG_ERR, "#57: Failed changing RG status\n");
-			return RG_EFAIL;
-		}
-		break;
-
-	default:
-		rg_unlock(&lockp);
-		return RG_EAGAIN;
-		break;
-	}
-
-	rg_unlock(&lockp);
-
-	return 0;
-}
-
-int
-svc_freeze(char *svcName)
-{
-	return _svc_freeze(svcName, 1);
-}
-
-int
-svc_unfreeze(char *svcName)
-{
-	return _svc_freeze(svcName, 0);
-}
-
-
-/*
- * Send a message to the target node to start the service.
- */
-int
-svc_start_remote(char *svcName, int request, uint32_t target)
-{
-	SmMessageSt msg_relo;
-	int msg_ret;
-	cluster_member_list_t *ml;
-	msgctx_t ctx;
-
-	/* Build the message header */
-	msg_relo.sm_hdr.gh_magic = GENERIC_HDR_MAGIC;
-	msg_relo.sm_hdr.gh_command = RG_ACTION_REQUEST;
-	/* XXX XXX */
-	msg_relo.sm_hdr.gh_arg1 = RG_ACTION_MASTER;
-	msg_relo.sm_hdr.gh_length = sizeof (SmMessageSt);
-	msg_relo.sm_data.d_action = request;
-	strncpy(msg_relo.sm_data.d_svcName, svcName,
-		sizeof(msg_relo.sm_data.d_svcName));
-	msg_relo.sm_data.d_ret = 0;
-	msg_relo.sm_data.d_svcOwner = target;
-	/* Open a connection to the other node */
-
-	if (msg_open(MSG_CLUSTER, target, RG_PORT, &ctx, 2)< 0) {
-		logt_print(LOG_ERR,
-		       "#58: Failed opening connection to member #%d\n",
-		       target);
-		return -1;
-	}
-
-	/* Encode */
-	swab_SmMessageSt(&msg_relo);
-
-	/* Send relocate message to the other node */
-	if (msg_send(&ctx, &msg_relo, sizeof (SmMessageSt)) < 
-	    (int)sizeof (SmMessageSt)) {
-		logt_print(LOG_ERR,
-		       "#59: Error sending remote-start request to member #%d\n",
-		       target);
-		msg_close(&ctx);
-		return -1;
-	}
-
-	logt_print(LOG_DEBUG, "Sent remote-start request to %d\n", (int)target);
-
-	/* Check the response */
-	do {
-		msg_ret = msg_receive(&ctx, &msg_relo,
-					      sizeof (SmMessageSt), 10);
-
-		if ((msg_ret == -1 && errno != ETIMEDOUT) ||
-		    (msg_ret > 0)) {
-			break;
-		}
-
-		/* Check to see if resource groups are locked for local
-		   shutdown */
-		if (rg_locked()) {
-			logt_print(LOG_WARNING,
-			       "#XX: Cancelling relocation: Shutting down\n");
-			msg_close(&ctx);
-			return RG_NO;
-		}
-
-		/* Check for node transition in the middle of a relocate */
-		ml = member_list();
-		if (memb_online(ml, target)) {
-			free_member_list(ml);
-			continue;
-		}
-		logt_print(LOG_WARNING,
-		       "#XX: Cancelling relocation: Target node down\n");
-		free_member_list(ml);
-		msg_close(&ctx);
-		return RG_EFAIL;
-	} while (1);
-
-	if (msg_ret != sizeof (SmMessageSt)) {
-		/* 
-		 * In this case, we don't restart the service, because the 
-		 * service state is actually unknown to us at this time.
-		 */
-		logt_print(LOG_ERR, "#60: Mangled reply from member #%d during RG "
-		       "relocate\n", target);
-		msg_close(&ctx);
-		return 0;	/* XXX really UNKNOWN */
-	}
-
-	/* Got a valid response from other node. */
-	msg_close(&ctx);
-
-	/* Decode */
-	swab_SmMessageSt(&msg_relo);
-
-	return msg_relo.sm_data.d_ret;
-}
-
-
-/**
- * handle_relocate_req - Relocate a service.  This seems like a huge
- * deal, except it really isn't.
- *
- * @param svcID		Service ID in question.
- * @param flags		If (flags & SVCF_PENDING), we were called from
- *			handle_start_req - and so we should ignore all local
- *			restarts/stops - since handle_start_req does this
- *			for us.
- * @param preferred_target	When sent a relocate message from the
- *				management software, a destination node
- *				is sent as well.  This causes us to try
- *				starting the service on that node *first*,
- *				but does NOT GUARANTEE that the service
- *				will end up on that node.  It will end up
- *				on whatever node actually successfully
- *				starts it.
- * @param new_owner	Member who actually ends up owning the service.
- */
-int
-handle_relocate_req(char *svcName, int request, int preferred_target,
-		    int *new_owner)
-{
-	cluster_member_list_t *allowed_nodes = NULL, *backup = NULL;
-	cman_node_t *m;
-	int target = preferred_target, me = my_id();
-	int ret, x;
-	rg_state_t svcStatus;
-	
-	get_rg_state_local(svcName, &svcStatus);
-	if (svcStatus.rs_state == RG_STATE_DISABLED ||
-	    svcStatus.rs_state == RG_STATE_UNINITIALIZED)
-		return RG_EINVAL;
-
-	if (preferred_target > 0) {
-		/* TODO: simplify this and don't keep alloc/freeing 
-		   member lists */
-		allowed_nodes = member_list();
-		/* Avoid even bothering the other node if we can */
-		m = memb_id_to_p(allowed_nodes, preferred_target);
-		if (!m) {
-			free_member_list(allowed_nodes);
-			return RG_EINVAL;
-		}
-
-		count_resource_groups_local(m);
-		if (m->cn_svcexcl ||
-	    	    (m->cn_svccount && is_exclusive(svcName))) {
-			free_member_list(allowed_nodes);
-			return RG_EDEPEND;
-		}
-		free_member_list(allowed_nodes);
-	}
-
-	/*
-	 * Stop the service - if we haven't already done so.
-	 */
-	if (request != RG_START_RECOVER) {
-		ret = _svc_stop(svcName, request, 0, RG_STATE_STOPPED);
-		if (ret == RG_EFAIL) {
-			svc_fail(svcName);
-			return RG_EFAIL;
-		}
-		if (ret == RG_EFROZEN) {
-			return RG_EFROZEN;
-		}
-		if (ret == RG_EFORWARD)
-			return RG_EFORWARD;
-	}
-
-	if (preferred_target > 0) {
-
-		allowed_nodes = member_list();
-		/*
-	   	   Mark everyone except me and the preferred target DOWN for now
-		   If we can't start it on the preferred target, then we'll try
-	 	   other nodes.
-		 */
-		//count_resource_groups(allowed_nodes);
-		backup = member_list_dup(allowed_nodes);
-
-		for (x = 0; x < allowed_nodes->cml_count; x++) {
-			if (allowed_nodes->cml_members[x].cn_nodeid == me ||
-		    	    allowed_nodes->cml_members[x].cn_nodeid ==
-			    		preferred_target)
-				continue;
-			allowed_nodes->cml_members[x].cn_member = 0;
-		}
-
-		/*
-		 * First, see if it's legal to relocate to the target node.
-		 * Legal means: the node is online and is in the
-		 * [restricted] failover domain of the service, or the
-		 * service has no failover domain.
-		 */
-		target = best_target_node(allowed_nodes, me, svcName, 1);
-
-		free_member_list(allowed_nodes);
-
-		/*
-		 * I am the ONLY one capable of running this service,
-		 * PERIOD...
-		 */
-		if (target == me && me != preferred_target) {
-			free_member_list(backup);
-			goto exhausted;
-		}
-
-		if (target == me) {
-			/*
-			   Relocate to self.  Don't send a network request
-			   to do it; it would block.
-			 */
-			if (svc_start(svcName, RG_START) == 0) {
-				*new_owner = me;
-				return 0;
-			}
-		} else if (target == preferred_target) {
-			/*
-		 	 * It's legal to start the service on the given
-		 	 * node.  Try to do so.
-		 	 */
-			if (svc_start_remote(svcName, request, target) == 0) {
-				*new_owner = target;
-				/*
-				 * Great! We're done...
-				 */
-				return 0;
-			}
-		}
-	}
-
-	/*
-	 * Ok, so, we failed to send it to the preferred target node.
-	 * Try to start it on all other nodes.
-	 */
-	if (backup) {
-		allowed_nodes = backup;
-	} else {
-		allowed_nodes = member_list();
-		//count_resource_groups(allowed_nodes);
-	}
-
-	if (preferred_target > 0)
-		memb_mark_down(allowed_nodes, preferred_target);
-	memb_mark_down(allowed_nodes, me);
-
-	while (memb_count(allowed_nodes)) {
-		target = best_target_node(allowed_nodes, me, svcName, 1);
-		if (target == me)
-			goto exhausted;
-
-		ret = svc_start_remote(svcName, request, target);
-		switch (ret) {
-		case RG_ERUN:
-			/* Someone stole the service while we were 
-			   trying to relo it */
-			get_rg_state_local(svcName, &svcStatus);
-			*new_owner = svcStatus.rs_owner;
-			free_member_list(allowed_nodes);
-			return 0;
-		case RG_EDEPEND:
-		case RG_EFAIL:
-			memb_mark_down(allowed_nodes, target);
-			continue;
-		case RG_EABORT:
-			svc_report_failure(svcName);
-			free_member_list(allowed_nodes);
-			return RG_EFAIL;
-		default:
-			/* deliberate fallthrough */
-			logt_print(LOG_ERR,
-			       "#61: Invalid reply from member %d during"
-			       " relocate operation!\n", target);
-		case RG_NO:
-			/* state uncertain */
-			free_member_list(allowed_nodes);
-			logt_print(LOG_CRIT, "State Uncertain: svc:%s "
-			       "nid:%d req:%s ret:%d\n", svcName,
-			       target, rg_req_str(request), ret);
-			return 0;
-		case 0:
-			*new_owner = target;
-			logt_print(LOG_NOTICE, "Service %s is now running "
-			       "on member %d\n", svcName, (int)target);
-			free_member_list(allowed_nodes);
-			return 0;
-		}
-	}
-	free_member_list(allowed_nodes);
-
-	/*
-	 * We got sent here from handle_start_req.
-	 * We're DONE.
-	 */
-	if (request == RG_START_RECOVER) {
-		_svc_stop_finish(svcName, 0, RG_STATE_STOPPED);
-		return RG_EFAIL;
-	}
-
-	/*
-	 * All potential places for the service to start have been exhausted.
-	 * We're done.
-	 */
-exhausted:
-	if (!rg_locked()) {
-		logt_print(LOG_WARNING,
-		       "#70: Failed to relocate %s; restarting locally\n",
-		       svcName);
-		if (svc_start(svcName, RG_START_RECOVER) == 0) {
-			*new_owner = me;
-			return RG_EFAIL;
-		}
-	}
-
-	if (svc_stop(svcName, RG_STOP) != 0) {
-		svc_fail(svcName);
-		svc_report_failure(svcName);
-	}
-
-	return RG_EFAIL;
-}
-
-
-pthread_mutex_t exclusive_mutex = PTHREAD_MUTEX_INITIALIZER;
-/**
- * handle_start_req - Handle a generic start request from a user or during
- * service manager boot.
- *
- * @param svcID		Service ID to start.
- * @param flags
- * @param new_owner	Owner which actually started the service.
- * @return		FAIL - Failure.
- *			0 - The service is running.
- */
-int
-handle_start_req(char *svcName, int req, int *new_owner)
-{
-	int ret, tolerance = FOD_BEST;
-	cluster_member_list_t *membership;
-	int need_check, actual_failure = 0;
-  
- 	/* When we get an enable req. for a migratory service, 
- 	   check other nodes to see if they are already running
- 	   said service - and ignore failover domain constraints 
- 	 */
-	if ((ret = msvc_check_cluster(svcName)) >= 0) {
-		*new_owner = ret;
-		return RG_SUCCESS;
-	}
- 
-	need_check = have_exclusive_resources();
-	membership = member_list();
-
-	/*
-	 * When a service request is from a user application (eg, clusvcadm),
-	 * accept FOD_GOOD instead of FOD_BEST
-	 */
-	if (req == RG_ENABLE)
-		tolerance = FOD_GOOD;
-	if (req != RG_RESTART &&
-	    req != RG_START_RECOVER &&
-	    (node_should_start_safe(my_id(), membership, svcName) <
-	     tolerance)) {
-		free_member_list(membership);
-		return RG_EFAIL;
-	}
-	if (need_check) {
-		pthread_mutex_lock(&exclusive_mutex);
-		ret = check_exclusive_resources(membership, svcName);
-		if (ret != 0) {
-			free_member_list(membership);
-			pthread_mutex_unlock(&exclusive_mutex);
-			if (ret > 0)
-				goto relocate;
-			else
-				return RG_EFAIL;
-		}
-	}
-	free_member_list(membership);
-
-	/* Check for dependency.  We cannot start unless our
-	   dependency is met */
-	if (check_depend_safe(svcName) == 0)
-		return RG_EDEPEND;
-	
-	/*
-	 * This is a 'root' start request.  We need to clear out our failure
-	 * mask here - so that we can try all nodes if necessary.
-	 */
-	ret = svc_start(svcName, req);
-	if (need_check)
-		pthread_mutex_unlock(&exclusive_mutex);
-
-	/* 
-	   If services are locked, return the error 
-	  */
-	if (ret == RG_EAGAIN || ret == RG_ERUN || ret == RG_EFROZEN)
-		return ret;
-
-	/*
-	 * If we succeeded, then we're done.
-	 */
-	if (ret == RG_ESUCCESS) {
-		*new_owner = my_id();
-		return RG_ESUCCESS;
-	}
-
-	/* Already running? */
-	if (ret == RG_NO) {
-		return RG_ESUCCESS;
-	}
-	
-	/* 
-	 * Keep the state open so the other nodes don't try to start
-	 * it.  This allows us to be the 'root' of a given service.
-	 */
-	logt_print(LOG_DEBUG, "Stopping failed service %s\n", svcName);
-	if (svc_stop(svcName, RG_STOP_RECOVER) != 0) {
-		logt_print(LOG_CRIT,
-		       "#13: Service %s failed to stop cleanly\n",
-		       svcName);
-		(void) svc_fail(svcName);
-
-		/*
-		 * If we failed to stop the service, we're done.  At this
-		 * point, we can't determine the service's status - so
-		 * trying to start it on other nodes is right out.
-		 */
-		return RG_EABORT;
-	}
-	actual_failure = 1;
-	
-relocate:
-	/*
-	 * OK, it failed to start - but succeeded to stop.  Now,
-	 * we should relocate the service.
-	 */
-	if (actual_failure)
-		logt_print(LOG_WARNING, "#71: Relocating failed service %s\n",
-	       	       svcName);
-	ret = handle_relocate_req(svcName, RG_START_RECOVER, -1, new_owner);
-
-	/* If we leave the service stopped, instead of disabled, someone
-	   will try to start it after the next node transition */
-	if (ret == RG_EFAIL) {
-		if (svc_stop(svcName, RG_STOP) != 0) {
-			svc_fail(svcName);
-			svc_report_failure(svcName);
-		}
-	}
-
-	return ret;
-}
-
-
-/**
- * handle_start_remote_req - Handle a remote start request.
- *
- * @param svcID		Service ID to start.
- * @param flags		Flags to use to determine start behavior.
- * @return		FAIL - Local failure.  ABORT - Unrecoverable error:
- *			the service didn't start, nor stop cleanly. 0
- *			- We started the service.
- */
-int
-handle_start_remote_req(char *svcName, int req)
-{
-	int tolerance = FOD_BEST;
-	int x;
-	uint32_t me = my_id();
-	cluster_member_list_t *membership;
-	int need_check;
-
-	if (rg_locked()) {
-		/* don't even calc if rg's locked */
-		return RG_EFAIL;
-	}
-
-	need_check = have_exclusive_resources();
-	membership = member_list();
-
-	/* XXX ok, so we need to say "should I start this if I was the
-	   only cluster member online */
-	for (x = 0; x < (int)membership->cml_count; x++) {
-		if (membership->cml_members[x].cn_nodeid == (int)me)
-			continue;
-
-		membership->cml_members[x].cn_member = 0;
-	}
-
-	if (req == RG_ENABLE)
-		tolerance = FOD_GOOD;
-
-	/*
-	 * See if we agree with our ability to start the given service.
-	 */
-	if (node_should_start_safe(me, membership, svcName) < tolerance){
-		free_member_list(membership);
-		return RG_EFAIL;
-	}
-	if (need_check) {
-		pthread_mutex_lock(&exclusive_mutex);
-		if (check_exclusive_resources(membership, svcName) != 0) {
-			free_member_list(membership);
-			pthread_mutex_unlock(&exclusive_mutex);
-			return RG_EEXCL;
-		}
-	}
-	free_member_list(membership);
-
-	x = svc_start(svcName, req);
-
-	if ((x == 0) || (x == RG_ERUN)) {
-		if (need_check)
-			pthread_mutex_unlock(&exclusive_mutex);
-		return x;
-	}
-	if (need_check)
-		pthread_mutex_unlock(&exclusive_mutex);
-
-	if (svc_stop(svcName, RG_STOP_RECOVER) == 0)
-		return RG_EFAIL;
-
-	svc_fail(svcName);
-	return RG_EABORT;
-}
-
-
-/**
-  handle_recover_req
- */
-int
-handle_recover_req(char *svcName, int *new_owner)
-{
-	char policy[20];
-
-	get_recovery_policy(svcName, policy, sizeof(policy));
-
-	if (!strcasecmp(policy, "disable")) {
-		return svc_disable(svcName);
-	} else if (!strcasecmp(policy, "relocate")) {
-		return handle_relocate_req(svcName, RG_START_RECOVER, -1,
-					   new_owner);
-	}
-
-	/* Check restart counter/timer for this resource */
-	if (check_restart(svcName) > 0) {
-		logt_print(LOG_NOTICE, "Restart threshold for %s exceeded; "
-		       "attempting to relocate\n", svcName);
-		return handle_relocate_req(svcName, RG_START_RECOVER, -1,
-					   new_owner);
-	}
-
-	return handle_start_req(svcName, RG_START_RECOVER, new_owner);
-}
-
-
-int
-handle_fd_start_req(char *svcName, int request, int *new_owner)
-{
-	cluster_member_list_t *allowed_nodes;
-	int target, me = my_id();
-	int ret = RG_EFAIL;
-
-	/* When we get an enable req. for a migratory service, 
-	   check other nodes to see if they are already running
-	   said service - and ignore failover domain constraints 
-	 */
-	if ((ret = msvc_check_cluster(svcName)) >= 0) {
-		*new_owner = ret;
-		return RG_SUCCESS;
-	}
-
-	allowed_nodes = member_list();
-
-	while (memb_count(allowed_nodes)) {
-		target = best_target_node(allowed_nodes, 0,
-	 				  svcName, 1);
-	  	if (target == me) {
-	   		ret = handle_start_remote_req(svcName, request);
-			if (ret == RG_EAGAIN)
-				goto out;
-	    	} else if (target < 0) {
-			goto out;
-	       	} else {
-			ret = svc_start_remote(svcName, RG_START_REMOTE,
-					       target);
-		}
-
-		switch(ret) {
-		case RG_ESUCCESS:
-		    	ret = RG_ESUCCESS;
-			goto out;
-		case RG_ERUN:
-		      	ret = RG_ERUN;
-			goto out;
-		case RG_EFAIL:
-			memb_mark_down(allowed_nodes, target);
-			continue;
-		case RG_EABORT:
-			svc_report_failure(svcName);
-			ret = RG_EFAIL;
-			goto out;
-      		default:
-			logt_print(LOG_ERR,
-	 		       "#6X: Invalid reply [%d] from member %d during"
-	  		       " relocate operation!\n", ret, target);
-	   	}
-	}
-
-out:
-	free_member_list(allowed_nodes);
-	return ret;
-}
diff --git a/rgmanager/src/daemons/rg_thread.c b/rgmanager/src/daemons/rg_thread.c
deleted file mode 100644
index fdcca30..0000000
--- a/rgmanager/src/daemons/rg_thread.c
+++ /dev/null
@@ -1,732 +0,0 @@
-#include <message.h>
-#include <resgroup.h>
-#include <rg_locks.h>
-#include <gettid.h>
-#include <rg_queue.h>
-#include <assert.h>
-#include <members.h>
-
-/**
- * Resource thread list entry.
- */
-typedef struct __resthread {
-	list_head();
-	pthread_t	rt_thread;		/** Thread identifier */
-	int		rt_request;		/** Current pending operation */
-	int		rt_status;		/** Used for init */
-	char		rt_name[256];		/** RG name */
-	request_t	**rt_queue;		/** RG event queue */
-	pthread_mutex_t	*rt_queue_mutex;	/** Mutex for event queue */
-	pthread_cond_t	*rt_queue_cond;		/** pthread cond */
-} resthread_t;
-
-
-/**
- * Resource thread queue head.
- */
-static resthread_t *resthread_list = NULL;
-
-#ifdef WRAP_LOCKS
-static pthread_mutex_t reslist_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;
-#else
-static pthread_mutex_t reslist_mutex = PTHREAD_MUTEX_INITIALIZER;
-#endif
-
-static resthread_t *find_resthread_byname(const char *resgroupname);
-static int spawn_if_needed(const char *resgroupname);
-int rt_enqueue_request(const char *resgroupname, int request,
-		       msgctx_t *response_ctx, int max, uint32_t target,
-		       int arg0, int arg1);
-int central_events_enabled(void);
-
-
-/**
-  SIGUSR1 output
- */
-void
-dump_threads(FILE *fp)
-{
-	resthread_t *rt;
-	request_t *req;
-	int x = 0, y = 0;
-
-	fprintf(fp, "Resource Group Threads \n");
-	pthread_mutex_lock(&reslist_mutex);
-	list_for(&resthread_list, rt, x) {
-		fprintf(fp, "  %s id:%d (@ %p) processing %s request (%d)\n",
-		        rt->rt_name,
-		        (unsigned)rt->rt_thread,
-			rt,
-			rg_req_str(rt->rt_request),
-			rt->rt_request);
-		if (!*rt->rt_queue) {
-			fprintf(fp, "    Pending requests: \n");
-			list_for(rt->rt_queue, req, y) {
-				fprintf(fp, "      %s tgt:%d  ctx:%p  a0:%d  a1:%d\n",
-				        rg_req_str(req->rr_request),
-					req->rr_target,
-					req->rr_resp_ctx,
-					req->rr_arg0,
-					req->rr_arg1);
-			}
-		}
-	}
-
-	x = !!resthread_list;
-	pthread_mutex_unlock(&reslist_mutex);
-	if (!x)
-		fprintf(fp, "  (none)\n");
-	fprintf(fp, "\n");
-}
-
-
-static int 
-wait_initialize(const char *name)
-{
-	resthread_t *t;
-
-	while (1) {
-		pthread_mutex_lock(&reslist_mutex);
-		t = find_resthread_byname(name);
-
-		if (!t) {
-			pthread_mutex_unlock(&reslist_mutex);
-			return -1;
-		}
-
-		if (t->rt_status != RG_STATE_UNINITIALIZED)  {
-			pthread_mutex_unlock(&reslist_mutex);
-			return 0;
-		}
-
-		pthread_mutex_unlock(&reslist_mutex);
-		usleep(50000);
-	}
-
-	assert(0);
-}
-
-
-static void
-rg_sighandler_setup(void)
-{
-	block_all_signals();
-	unblock_signal(SIGCHLD);
-}
-
-
-static void
-purge_status_checks(request_t **list)
-{
-	request_t *curr;
-	int found;
-	
-	if (!list)
-		return;
-
-	do {
-		found = 0;
-		list_do(list, curr) {
-			if (curr->rr_request == RG_STATUS) {
-				list_remove(list, curr);
-				rq_free(curr);
-				found = 1;
-				break;
-			}
-		} while (!list_done(list, curr));
-	} while (found);
-}
-
-
-static void
-purge_all(request_t **list)
-{
-	request_t *curr;
-	
-	if (!list)
-		return;
-
-	if (!*list)
-		return;
-
-	while((curr = *list)) {
-
-		list_remove(list, curr);
-		dbg_printf("Removed request %d\n", curr->rr_request);
-		if (curr->rr_resp_ctx) {
-			send_response(RG_EABORT, 0, curr);
-			msg_close(curr->rr_resp_ctx);
-			msg_free_ctx(curr->rr_resp_ctx);
-		}
-		rq_free(curr);
-	}
-}
-
-
-static void *
-resgroup_thread_main(void *arg)
-{
-	pthread_mutex_t my_queue_mutex;
-	pthread_cond_t my_queue_cond;
-	request_t *my_queue = NULL;
-	int newowner = 0;
-	char myname[256];
-	resthread_t *myself;
-	request_t *req;
-	int ret = RG_EFAIL, error = 0, mystatus;
-
-	rg_inc_threads();
-
-	strncpy(myname, arg, 256);
-	dbg_printf("Thread %s (tid %d) starting\n",myname,gettid());
-
-	pthread_mutex_init(&my_queue_mutex, NULL);
-	pthread_mutex_lock(&my_queue_mutex);
-	pthread_cond_init(&my_queue_cond, NULL);
-
-	/*
-	 * Wait until we're inserted.  The code herein should never be 
-	 * reached.
-	 */
-	while (1) {
-		pthread_mutex_lock(&reslist_mutex);
-
-		myself = find_resthread_byname(myname);
-		if (myself)
-			break;
-
-		pthread_mutex_unlock(&reslist_mutex);
-		usleep(250000);
-	}
-
-	myself->rt_queue = &my_queue;
-	myself->rt_queue_mutex = &my_queue_mutex;
-	myself->rt_queue_cond = &my_queue_cond;
-	myself->rt_status = RG_STATE_STARTED; /* Ok, we're ready to go */
-	rg_sighandler_setup();
-
-	/* Wait for first event */
-	pthread_mutex_unlock(&reslist_mutex);
-
-	/* My mutex is still held */
-	pthread_cond_wait(&my_queue_cond, &my_queue_mutex);
-	pthread_mutex_unlock(&my_queue_mutex);
-
-	while(1) {
-		pthread_mutex_lock(&reslist_mutex);
- 		pthread_mutex_lock(&my_queue_mutex);
-		if ((req = rq_next_request(&my_queue)) == NULL) {
-			/* We're done.  No more requests.
-			   We're about to kill our thread, so exit the
-			   loop with the lock held. */
-			break;
-		}
-		pthread_mutex_unlock(&my_queue_mutex);
-		pthread_mutex_unlock(&reslist_mutex);
-
-		ret = RG_FAIL;
-		error = 0;
-
-		dbg_printf("Processing request %s, resource group %s\n",
-			rg_req_str(req->rr_request), myname);
-
-		/* find ourselves. */
-		pthread_mutex_lock(&reslist_mutex);
-		myself = find_resthread_byname(myname);
-		assert(myself);
-		myself->rt_request = req->rr_request;
-		if (req->rr_request == RG_STOP_EXITING)
-			myself->rt_status = RG_STATE_STOPPING;
-		pthread_mutex_unlock(&reslist_mutex);
-
-		switch(req->rr_request) {
-		case RG_START_REMOTE:
-		case RG_START_RECOVER:
-			error = handle_start_remote_req(myname,
-							req->rr_request);
-			break;
-
-		case RG_ENABLE:
-			if (req->rr_target != 0 &&
-			    req->rr_target != (unsigned)my_id()) {
-				error = RG_EFORWARD;
-				ret = RG_NONE;
-				break;
-			}
-		case RG_START:
-			if (req->rr_arg0) {
-				error = handle_fd_start_req(myname,
-						req->rr_request,
-						&newowner);
-			} else {
-				error = handle_start_req(myname,
-						req->rr_request,
-						&newowner);
-			}
-			break;
-
-		case RG_RELOCATE:
-			/* Relocate requests are user requests and must be
-			   forwarded */
-			error = handle_relocate_req(myname, RG_START_REMOTE,
-   						    req->rr_target,
-   						    &newowner);
-			if (error == RG_EFORWARD)
-				ret = RG_NONE;
-			break;
-
-		case RG_MIGRATE:
-			error = svc_migrate(myname, req->rr_target);
-
-			if (error == 0) {
-				ret = RG_SUCCESS;
-
-				pthread_mutex_lock(&my_queue_mutex);
-				purge_status_checks(&my_queue);
-				pthread_mutex_unlock(&my_queue_mutex);
-			} else if (error == RG_EFORWARD) {
-				ret = RG_NONE;
-				break;
-			} else {
-				/*
-				 * Bad news. 
-				 */
-				ret = RG_EFAIL;
-			}
-			break;
-
-		case RG_INIT:
-			/* Stop without changing shared state of it */
-			error = group_op(myname, RG_STOP);
-
-			pthread_mutex_lock(&my_queue_mutex);
-			purge_all(&my_queue);
-			pthread_mutex_unlock(&my_queue_mutex);
-
-			if (error == 0)
-				ret = RG_SUCCESS;
-			else
-				ret = RG_EFAIL;
-			break;
-
-		case RG_CONDSTOP:
-			/* CONDSTOP doesn't change RG state by itself */
-			group_op(myname, RG_CONDSTOP);
-			break;
-
-		case RG_CONDSTART:
-			/* CONDSTART doesn't change RG state by itself */
-			group_op(myname, RG_CONDSTART);
-			break;
-
-		case RG_STOP:
-		case RG_STOP_USER:
-			/* Disable and user stop requests need to be
-			   forwarded; they're user requests */
-			error = svc_stop(myname, req->rr_request);
-
-			if (error == 0) {
-				ret = RG_SUCCESS;
-
-				pthread_mutex_lock(&my_queue_mutex);
-				purge_status_checks(&my_queue);
-				pthread_mutex_unlock(&my_queue_mutex);
-			} else if (error == RG_EFORWARD) {
-				ret = RG_NONE;
-				break;
-			} else {
-				/*
-				 * Bad news. 
-				 */
-				ret = RG_EFAIL;
-			}
-
-			break;
-
-		case RG_STOP_EXITING:
-			/* We're out of here. Don't allow starts anymore */
-			error = svc_stop(myname, RG_STOP);
-
-			if (error == 0) {
-				ret = RG_SUCCESS;
-
-			} else if (error == RG_EFORWARD) {
-				ret = RG_NONE;
-				break;
-			} else {
-				/*
-				 * Bad news. 
-				 */
-				ret = RG_EFAIL;
-			}
-
-			pthread_mutex_lock(&my_queue_mutex);
-			purge_all(&my_queue);
-			pthread_mutex_unlock(&my_queue_mutex);
-
-			break;
-
-
-		case RG_DISABLE:
-			/* Disable and user stop requests need to be
-			   forwarded; they're user requests */
-			error = svc_disable(myname);
-
-			if (error == 0) {
-				ret = RG_SUCCESS;
-
-				pthread_mutex_lock(&my_queue_mutex);
-				purge_status_checks(&my_queue);
-				pthread_mutex_unlock(&my_queue_mutex);
-			} else if (error == RG_EFORWARD) {
-				ret = RG_NONE;
-				break;
-			} else {
-				/*
-				 * Bad news. 
-				 */
-				ret = RG_EFAIL;
-			}
-
-			break;
-
-		case RG_RESTART:
-			error = svc_stop(myname, RG_STOP_USER);
-
-			if (error == 0) {
-				pthread_mutex_lock(&my_queue_mutex);
-				purge_status_checks(&my_queue);
-				pthread_mutex_unlock(&my_queue_mutex);
-
-				error = handle_start_req(myname,
-							 req->rr_request,
-							 &newowner);
-				break;
-
-			} else if (error == RG_EFORWARD) {
-				ret = RG_NONE;
-				break;
-			} else {
-				/*
-				 * Bad news. 
-				 */
-				ret = RG_EFAIL;
-			}
-
-			break;
-
-		case RG_STATUS:
-			if (!(rg_initialized()&FL_CONFIG)) {
-				ret = RG_SUCCESS;
-				break;
-			}
-			/* Need to make sure we don't check status of
-			   resource groups we don't own */
-			error = svc_status(myname);
-
-			/* Recover dead service */
-			if (error == 0) {
-				ret = RG_SUCCESS;
-				break;
-			}
-
-			error = svc_stop(myname, RG_STOP_RECOVER);
-			if (error == 0) {
-				/* Stop generates an event - whatever the
-				   result.  If central events are enabled
-				   don't bother trying to recover */
-				if (central_events_enabled())
-					break;
-				error = handle_recover_req(myname, &newowner);
-				if (error == 0)
-					ret = RG_SUCCESS;
-			}
-
-			break;
-
-		case RG_FREEZE:
-			error = svc_freeze(myname);
-			if (error != 0)
-				ret = RG_EFAIL;
-			break;
-
-		case RG_UNFREEZE:
-			error = svc_unfreeze(myname);
-			if (error != 0)
-				ret = RG_EFAIL;
-			break;
-
-		case RG_STATUS_INQUIRY:
-			error = svc_status_inquiry(myname);
-
-			if (error == 0) {
-				ret = RG_SUCCESS;
-				newowner = my_id();
-			} else {
-				ret = RG_EFAIL;
-				newowner = -1;
-			}
-
-			break;
-
-		default:
-			printf("Unhandled request %d\n", req->rr_request);
-			ret = RG_NONE;
-			break;
-		}
-
-		pthread_mutex_lock(&reslist_mutex);
-		myself = find_resthread_byname(myname);
-		myself->rt_request = RG_NONE;
-		pthread_mutex_unlock(&reslist_mutex);
-
-		if (error == RG_EFORWARD) {
-			/* Forward_request frees this and closes the
-			   file descriptor, so we can just move on
-			   with life. */
-			forward_request(req);
-			continue;
-		}
-
-		if (ret != RG_NONE && rg_initialized() &&
-		    (req->rr_resp_ctx)) {
-			send_response(error, newowner, req);
-			msg_close(req->rr_resp_ctx);
-			msg_free_ctx(req->rr_resp_ctx);
-		}
-		
-		rq_free(req);
-	}
-
-	/* reslist_mutex and my_queue_mutex held */
-	myself = find_resthread_byname(myname);
-
-	if (!myself) {
-		dbg_printf("I don't exist...\n");
-		raise(SIGSEGV);
-	}
-
-	mystatus = pthread_mutex_destroy(&my_queue_mutex);
-	if (mystatus != 0)
-	{
-		if (mystatus == EBUSY) {
-			pthread_mutex_unlock(&my_queue_mutex);
-		}
-
-		mystatus = pthread_mutex_destroy(&my_queue_mutex);
-		if (mystatus != 0) {
-			fprintf (stderr, "mutex_destroy=%d err=%d %p\n", 
-			    mystatus, errno, &my_queue_mutex);
-
-			fflush (stderr);
-		}
-	}
-
-	list_remove(&resthread_list, myself);
-	free(myself);
-
-	pthread_mutex_unlock(&reslist_mutex);
-
-	dbg_printf("RGth %s (tid %d): No more requests"
-		"; exiting.\n", myname, gettid());
-
-	/* Thread's outta here */
-	rg_dec_threads();
-	pthread_exit((void *)NULL);
-}
-
-
-/**
- * Start a resgroup thread.
- */
-static int
-spawn_resgroup_thread(const char *name)
-{
-        pthread_attr_t attrs;
-	resthread_t *newthread = NULL;
-	int ret = 0;
-
-        pthread_attr_init(&attrs);
-        pthread_attr_setinheritsched(&attrs, PTHREAD_INHERIT_SCHED);
-        pthread_attr_setdetachstate(&attrs, PTHREAD_CREATE_DETACHED);
-
-	newthread = malloc(sizeof(*newthread));
-	if (!newthread)
-		return -1;
-	memset(newthread, 0, sizeof(*newthread));
-
-	newthread->rt_status = RG_STATE_UNINITIALIZED;
-	strncpy(newthread->rt_name, name, sizeof(newthread->rt_name));
-
-	ret = pthread_create(&newthread->rt_thread, &attrs,
-			     resgroup_thread_main, (void *)name);
-	pthread_attr_destroy(&attrs);
-
-	if (ret != 0) {
-		free(newthread);
-		return ret;
-	}
-
-	list_insert(&resthread_list, newthread);
-
-	return 0;
-}
-
-
-/**
-  Spawn a resource group thread if necessary
- */
-int
-spawn_if_needed(const char *resgroupname)
-{
-	int ret;
-	resthread_t *resgroup = NULL;
-
-	pthread_mutex_lock(&reslist_mutex);
-	while (resgroup == NULL) {
-		resgroup = find_resthread_byname(resgroupname);
-		if (resgroup != NULL)
-			break;
-
-		ret = spawn_resgroup_thread(resgroupname);
-		if (ret == 0)
-			continue;
-		pthread_mutex_unlock(&reslist_mutex);
-
-		return ret;
-	}
-
-	ret = (resgroup->rt_status == RG_STATE_STOPPING);
-
-	pthread_mutex_unlock(&reslist_mutex);
-	if (wait_initialize(resgroupname) < 0) {
-		return -1;
-	}
-
-	return ret;
-}
-
-
-/**
- * Call with mutex locked.
- */
-static resthread_t *
-find_resthread_byname(const char *resgroupname)
-{
-	resthread_t *curr = NULL;
-
-	if (!resthread_list)
-		return NULL;
-
-	list_do(&resthread_list, curr) {
-		if (!strncmp(resgroupname, curr->rt_name,
-		    sizeof(curr->rt_name)))
-			return curr;
-	} while (!list_done(&resthread_list, curr));
-
-	return NULL;
-}
-
-
-/**
- * queues a request for a resgroup.
- *
- * @param resgroupname		Service name to perform operations on
- * @param request		Request to perform
- * @param response_ctx		Send response to this file descriptor when
- *				this request completes.
- * @param max			Don't insert this request if there already
- * 				are this many requests of this type in the
- *				queue.
- * @param arg			Argument to the decoder.
- * @param arglen		Length of argument.
- * @return			-1 on failure, 0 on success, or 1 if
- *				the request was dropped.
- * @see rq_queue_request
- */
-int
-rt_enqueue_request(const char *resgroupname, int request, 
-		   msgctx_t *response_ctx,
-   		   int max, uint32_t target, int arg0, int arg1)
-{
-	request_t *curr;
-	int count = 0, ret;
-	resthread_t *resgroup;
-
-	if (spawn_if_needed(resgroupname) != 0) {
-		/* Usually, we get here if the thread is killing
-		   stuff.  This prevents us from queueing START requests
-		   while we're exiting */
-		return -1;
-	}
-
-	pthread_mutex_lock(&reslist_mutex);
-	resgroup = find_resthread_byname(resgroupname);
-	if (resgroup == NULL) {
-		/* DOOOOM */
-		pthread_mutex_unlock(&reslist_mutex);
-		return -1;
-	}
-
-	/* Main mutex held */
-	if (resgroup->rt_request == request)
-		count++;
-
-	pthread_mutex_lock(resgroup->rt_queue_mutex);
-
-	if (request == RG_INIT) {
-		/* If we're initializing it, zap the queue if there
-		   is one */
-		purge_all(resgroup->rt_queue);
-	} else {
-		if (max) {
-			list_do(resgroup->rt_queue, curr) {
-				if ((int)curr->rr_request == request)
-					count++;
-			} while (!list_done(resgroup->rt_queue, curr));
-	
-			if (count >= max) {
-				pthread_mutex_unlock(resgroup->rt_queue_mutex);
-				pthread_mutex_unlock(&reslist_mutex);
-				/*
-				 * Maximum reached.
-				 */
-				return 1;
-			}
-		}
-	}
-
-	if (resgroup->rt_request == RG_RELOCATE) {
-		switch(request) {
-		case RG_RELOCATE:
-		case RG_START_REMOTE:
-		case RG_START_RECOVER:
-		case RG_START:
-		case RG_ENABLE:
-			send_ret(response_ctx, resgroup->rt_name, RG_EDEADLCK,
-				 request, 0);
-			msg_close(response_ctx);
-			msg_free_ctx(response_ctx);
-			break;
-		}
-		fprintf(stderr, "Failed to queue request: Would block\n");
-		/* EWOULDBLOCK */
-		pthread_mutex_unlock(resgroup->rt_queue_mutex);
-		pthread_mutex_unlock(&reslist_mutex);
-		return -1;
-	}
-
-	ret = rq_queue_request(resgroup->rt_queue, resgroup->rt_name,
-			       request, 0, 0, response_ctx, 0, target,
-			       arg0, arg1);
-	pthread_cond_broadcast(resgroup->rt_queue_cond);
-	pthread_mutex_unlock(resgroup->rt_queue_mutex);
-	pthread_mutex_unlock(&reslist_mutex);
-
-	if (ret < 0)
-		return ret;
-
-	dbg_printf("Queued request for %d for %s\n", request, resgroupname);
-	
-	return 0;	
-}
diff --git a/rgmanager/src/daemons/sbuf.c b/rgmanager/src/daemons/sbuf.c
deleted file mode 100644
index d98617f..0000000
--- a/rgmanager/src/daemons/sbuf.c
+++ /dev/null
@@ -1,85 +0,0 @@
-#include <string.h>
-#include <sys/types.h>
-#include <stdio.h>
-#include <errno.h>
-
-struct _retbuf {
-	char *data;
-	ssize_t maxsize;
-	ssize_t cursize;
-	char magic[8];
-};
-
-static char _x_buf_magic[]="m461kz31";
-
-void *
-buf_init(void *buf, size_t len)
-{
-	struct _retbuf *b = (struct _retbuf *)buf;
-
-	errno = EINVAL;
-	if (!len || !buf)
-		return NULL;
-	if (len < sizeof(*b) + 16)
-		return NULL;
-
-	memset(b, 0, len);
-	b->data = buf + sizeof(*b);
-	b->maxsize = len - sizeof (*b);
-	b->cursize = 0;
-	memcpy(b->magic, _x_buf_magic, sizeof(b->magic));
-
-	return buf;
-}
-
-ssize_t
-buf_append(void *buf, char *info)
-{
-	struct _retbuf *b = (struct _retbuf *)buf;
-	ssize_t len;
-
-	errno = EINVAL;
-	if (!buf)
-		return -1;
-	if (memcmp(b->magic, _x_buf_magic, sizeof(b->magic)))
-		return -1;
-	if (!info)
-		return 0;
-       	len = strlen(info);
-	if (!len)
-		return 0;
-
-	errno = ENOSPC;
-	if (b->maxsize - b->cursize < len)
-		return -1;
-
-	memcpy(&(b->data[b->cursize]), info, len);
-	b->cursize += len;
-	return len;
-}
-
-char *
-buf_data(void *buf)
-{
-	struct _retbuf *b = (struct _retbuf *)buf;
-	errno = EINVAL;
-	if (!buf)
-		return NULL;
-	if (memcmp(b->magic, _x_buf_magic, sizeof(b->magic)))
-		return NULL;
-	return ((struct _retbuf *)buf)->data;
-}
-
-
-int
-buf_finished(void *buf)
-{
-	struct _retbuf *b = (struct _retbuf *)buf;
-	errno = EINVAL;
-	if (!buf)
-		return -1;
-	if (memcmp(b->magic, _x_buf_magic, sizeof(b->magic)))
-		return -1;
-	memset(b->magic, 0, sizeof(b->magic));
-	return 0;
-}
diff --git a/rgmanager/src/daemons/service_op.c b/rgmanager/src/daemons/service_op.c
deleted file mode 100644
index 699dd2d..0000000
--- a/rgmanager/src/daemons/service_op.c
+++ /dev/null
@@ -1,196 +0,0 @@
-#include <assert.h>
-#include <platform.h>
-#include <message.h>
-#include <members.h>
-#include <stdio.h>
-#include <string.h>
-#include <resgroup.h>
-#include <logging.h>
-#include <lock.h>
-#include <rg_locks.h>
-#include <ccs.h>
-#include <rg_queue.h>
-#include <msgsimple.h>
-#include <res-ocf.h>
-#include <event.h>
-
-
-/*
- * Send a message to the target node to start the service.
- */
-int svc_start_remote(char *svcName, int request, uint32_t target);
-void svc_report_failure(char *);
-int get_service_state_internal(char *svcName, rg_state_t *svcStatus);
-
-
-/**
- *
- */
-int
-service_op_start(char *svcName,
-		 int *target_list,
-		 int target_list_len,
-		 int *new_owner)
-{
-	int target;
-	int ret, x;
-	int excl = 0, dep = 0, fail = 0;
-	rg_state_t svcStatus;
-	
-	if (get_service_state_internal(svcName, &svcStatus) < 0) {
-		return RG_EFAIL;
-	}
-
-	if (svcStatus.rs_state == RG_STATE_FAILED ||
-	    svcStatus.rs_state == RG_STATE_UNINITIALIZED)
-		return RG_EINVAL;
-
-	for (x = 0; x < target_list_len; x++) {
-
-		target = target_list[x];
-		ret = svc_start_remote(svcName, RG_START_REMOTE,
-				       target);
-		switch (ret) {
-		case RG_ERUN:
-			/* Someone stole the service while we were 
-			   trying to start it */
-			get_rg_state_local(svcName, &svcStatus);
-			if (new_owner)
-				*new_owner = svcStatus.rs_owner;
-			return 0;
-		case RG_EEXCL:
-			++excl;
-			continue;
-		case RG_EDEPEND:
-			++dep;
-			continue;
-		case RG_EFAIL:
-			++fail;
-			continue;
-		case RG_EABORT:
-			svc_report_failure(svcName);
-			return RG_EFAIL;
-		default:
-			/* deliberate fallthrough */
-			logt_print(LOG_ERR,
-			       "#61: Invalid reply from member %d during"
-			       " start operation!\n", target);
-		case RG_NO:
-			/* state uncertain */
-			logt_print(LOG_CRIT, "State Uncertain: svc:%s "
-			       "nid:%d req:%s ret:%d\n", svcName,
-			       target, rg_req_str(RG_START_REMOTE), ret);
-			return 0;
-		case 0:
-			if (new_owner)
-				*new_owner = target;
-			logt_print(LOG_NOTICE, "Service %s is now running "
-			       "on member %d\n", svcName, (int)target);
-			return 0;
-		}
-	}
-
-	ret = RG_EFAIL;
-	if (excl == target_list_len) 
-		ret = RG_EEXCL;
-	else if (dep == target_list_len)
-		ret = RG_EDEPEND;
-
-	logt_print(LOG_INFO, "Start failed; node reports: %d failures, "
-	       "%d exclusive, %d dependency errors\n", fail, excl, dep);
-	return ret;
-}
-
-
-int
-service_op_stop(char *svcName, int do_disable, int event_type)
-{
-	SmMessageSt msg;
-	int msg_ret;
-	msgctx_t ctx;
-	rg_state_t svcStatus;
-	int msgtarget = my_id();
-
-	/* Build the message header */
-	msg.sm_hdr.gh_magic = GENERIC_HDR_MAGIC;
-	msg.sm_hdr.gh_command = RG_ACTION_REQUEST;
-	msg.sm_hdr.gh_arg1 = RG_ACTION_MASTER; 
-	msg.sm_hdr.gh_length = sizeof (SmMessageSt);
-
-	msg.sm_data.d_action = ((!do_disable) ? RG_STOP:RG_DISABLE);
-
-	if (msg.sm_data.d_action == RG_STOP && event_type == EVENT_USER)
-		msg.sm_data.d_action = RG_STOP_USER;
-
-	strncpy(msg.sm_data.d_svcName, svcName,
-		sizeof(msg.sm_data.d_svcName));
-	msg.sm_data.d_ret = 0;
-	msg.sm_data.d_svcOwner = 0;
-
-	/* Open a connection to the local node - it will decide what to
-	   do in this case. XXX inefficient; should queue requests
-	   locally and immediately forward requests otherwise */
-
-	if (get_service_state_internal(svcName, &svcStatus) < 0)
-		return RG_EFAIL;
-	if (svcStatus.rs_owner > 0) {
-		if (member_online(svcStatus.rs_owner)) {
-			msgtarget = svcStatus.rs_owner;
-		} else {
-			/* If the owner is not online, 
-			   mark the service as 'stopped' but
-			   otherwise, do nothing.
-			 */
-			return svc_stop(svcName, RG_STOP);
-		}
-	}
-
-	if (msg_open(MSG_CLUSTER, msgtarget, RG_PORT, &ctx, 2)< 0) {
-		logt_print(LOG_ERR,
-		       "#58: Failed opening connection to member #%d\n",
-		       my_id());
-		return -1;
-	}
-
-	/* Encode */
-	swab_SmMessageSt(&msg);
-
-	/* Send stop message to the other node */
-	if (msg_send(&ctx, &msg, sizeof (SmMessageSt)) < 
-	    (int)sizeof (SmMessageSt)) {
-		logt_print(LOG_ERR, "Failed to send complete message\n");
-		msg_close(&ctx);
-		return -1;
-	}
-
-	/* Check the response */
-	do {
-		msg_ret = msg_receive(&ctx, &msg,
-				      sizeof (SmMessageSt), 10);
-		if ((msg_ret == -1 && errno != ETIMEDOUT) ||
-		    (msg_ret > 0)) {
-			break;
-		}
-	} while(1);
-
-	if (msg_ret != sizeof (SmMessageSt)) {
-		logt_print(LOG_WARNING, "Strange response size: %d vs %d\n",
-		       msg_ret, (int)sizeof(SmMessageSt));
-		return 0;	/* XXX really UNKNOWN */
-	}
-
-	/* Got a valid response from other node. */
-	msg_close(&ctx);
-
-	/* Decode */
-	swab_SmMessageSt(&msg);
-
-	return msg.sm_data.d_ret;
-}
-
-
-/*
-   TODO
-   service_op_migrate()
- */
-
diff --git a/rgmanager/src/daemons/slang_event.c b/rgmanager/src/daemons/slang_event.c
deleted file mode 100644
index b215ef9..0000000
--- a/rgmanager/src/daemons/slang_event.c
+++ /dev/null
@@ -1,1241 +0,0 @@
-/**
-  @file S/Lang event handling & intrinsic functions + vars
- */
-#include <platform.h>
-#include <resgroup.h>
-#include <list.h>
-#include <restart_counter.h>
-#include <reslist.h>
-#include <logging.h>
-#include <members.h>
-#include <assert.h>
-#include <event.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <slang.h>
-#include <sys/syslog.h>
-#include <malloc.h>
-#include <logging.h>
-#include <sets.h>
-
-static int __sl_initialized = 0;
-
-static char **_service_list = NULL;
-static int _service_list_len = 0;
-
-char **get_service_names(int *len); /* from groups.c */
-int get_service_property(char *rg_name, char *prop, char *buf, size_t buflen);
-void push_int_array(int *stuff, int len);
-
-
-/* ================================================================
- * Node states 
- * ================================================================ */
-static const int
-   _ns_online = 1,
-   _ns_offline = 0;
-
-/* ================================================================
- * Event information 
- * ================================================================ */
-static const int
-   _ev_none = EVENT_NONE,
-   _ev_node = EVENT_NODE,
-   _ev_service = EVENT_RG,
-   _ev_config = EVENT_CONFIG,
-   _ev_user = EVENT_USER;
-
-static const int
-   _rg_fail = RG_EFAIL,
-   _rg_success = RG_ESUCCESS,
-   _rg_edomain = RG_EDOMAIN,
-   _rg_edepend = RG_EDEPEND,
-   _rg_eabort = RG_EABORT,
-   _rg_einval = RG_EINVAL,
-   _rg_erun = RG_ERUN;
-
-static int
-   _stop_processing = 0,
-   _my_node_id = 0,
-   _node_state = 0,
-   _node_id = 0,
-   _node_clean = 0,
-   _service_owner = 0,
-   _service_last_owner = 0,
-   _user_request = 0,
-   _user_arg1 = 0,
-   _user_arg2 = 0,
-   _user_return = 0,
-   _rg_err = 0,
-   _event_type = 0;
-
-static char
-   *_node_name = NULL,
-   *_service_name = NULL,
-   *_service_state = NULL,
-   *_rg_err_str = "No Error";
-
-static int
-   _user_enable = RG_ENABLE,
-   _user_disable = RG_DISABLE,
-   _user_stop = RG_STOP_USER,		/* From clusvcadm */
-   _user_relo = RG_RELOCATE,
-   _user_restart = RG_RESTART,
-   _user_migrate = RG_MIGRATE,
-   _user_freeze = RG_FREEZE,
-   _user_unfreeze = RG_UNFREEZE;
-
-
-SLang_Intrin_Var_Type rgmanager_vars[] =
-{
-	/* Log levels (constants) */
-
-	/* Node state information */
-	MAKE_VARIABLE("NODE_ONLINE",	&_ns_online,	SLANG_INT_TYPE, 1),
-	MAKE_VARIABLE("NODE_OFFLINE",	&_ns_offline,	SLANG_INT_TYPE, 1),
-
-	/* Node event information */
-	MAKE_VARIABLE("node_self",	&_my_node_id,	SLANG_INT_TYPE, 1),
-	MAKE_VARIABLE("node_state",	&_node_state,	SLANG_INT_TYPE, 1),
-	MAKE_VARIABLE("node_id",	&_node_id,	SLANG_INT_TYPE, 1),
-	MAKE_VARIABLE("node_name",	&_node_name,	SLANG_STRING_TYPE,1),
-	MAKE_VARIABLE("node_clean",	&_node_clean,	SLANG_INT_TYPE, 1),
-
-	/* Service event information */
-	MAKE_VARIABLE("service_name",	&_service_name,	SLANG_STRING_TYPE,1),
-	MAKE_VARIABLE("service_state",	&_service_state,SLANG_STRING_TYPE,1),
-	MAKE_VARIABLE("service_owner",	&_service_owner,SLANG_INT_TYPE, 1),
-	MAKE_VARIABLE("service_last_owner", &_service_last_owner,
-		      					SLANG_INT_TYPE, 1),
-
-	/* User event information */
-	MAKE_VARIABLE("user_request",	&_user_request,	SLANG_INT_TYPE,1),
-	MAKE_VARIABLE("user_arg1",	&_user_arg1,	SLANG_INT_TYPE,1),
-	MAKE_VARIABLE("user_arg2",	&_user_arg2,	SLANG_INT_TYPE,1),
-	MAKE_VARIABLE("user_service",	&_service_name, SLANG_STRING_TYPE,1),
-	MAKE_VARIABLE("user_target",	&_service_owner,SLANG_INT_TYPE, 1),
-	/* Return code to user requests; i.e. clusvcadm */
-	MAKE_VARIABLE("user_return",	&_user_return,	SLANG_INT_TYPE, 0),
-
-	/* General event information */
-	MAKE_VARIABLE("event_type",	&_event_type,	SLANG_INT_TYPE, 1),
-	MAKE_VARIABLE("EVENT_NONE",	&_ev_none,	SLANG_INT_TYPE, 1),
-	MAKE_VARIABLE("EVENT_NODE",	&_ev_node,	SLANG_INT_TYPE, 1),
-	MAKE_VARIABLE("EVENT_CONFIG",	&_ev_config,	SLANG_INT_TYPE, 1),
-	MAKE_VARIABLE("EVENT_SERVICE",	&_ev_service,	SLANG_INT_TYPE, 1),
-	MAKE_VARIABLE("EVENT_USER",	&_ev_user,	SLANG_INT_TYPE, 1),
-
-	/* User request constants */
-	MAKE_VARIABLE("USER_ENABLE",	&_user_enable,	SLANG_INT_TYPE, 1),
-	MAKE_VARIABLE("USER_DISABLE",	&_user_disable,	SLANG_INT_TYPE, 1),
-	MAKE_VARIABLE("USER_STOP",	&_user_stop,	SLANG_INT_TYPE, 1),
-	MAKE_VARIABLE("USER_RELOCATE",	&_user_relo,	SLANG_INT_TYPE, 1),
-	MAKE_VARIABLE("USER_RESTART",	&_user_restart,	SLANG_INT_TYPE, 1),
-	MAKE_VARIABLE("USER_MIGRATE",	&_user_migrate,	SLANG_INT_TYPE, 1),
-	MAKE_VARIABLE("USER_FREEZE",	&_user_freeze,	SLANG_INT_TYPE, 1),
-	MAKE_VARIABLE("USER_UNFREEZE",	&_user_unfreeze,SLANG_INT_TYPE, 1),
-
-	/* Errors */
-	MAKE_VARIABLE("rg_error",	&_rg_err,	SLANG_INT_TYPE, 1),
-	MAKE_VARIABLE("rg_error_string",&_rg_err_str,	SLANG_STRING_TYPE,1),
-
-	/* From constants.c */
-	MAKE_VARIABLE("FAIL",		&_rg_fail,	SLANG_INT_TYPE, 1),
-	MAKE_VARIABLE("SUCCESS",	&_rg_success,	SLANG_INT_TYPE, 1),
-	MAKE_VARIABLE("ERR_ABORT",	&_rg_eabort,	SLANG_INT_TYPE, 1),
-	MAKE_VARIABLE("ERR_INVALID",	&_rg_einval,	SLANG_INT_TYPE, 1),
-	MAKE_VARIABLE("ERR_DEPEND",	&_rg_edepend,	SLANG_INT_TYPE, 1),
-	MAKE_VARIABLE("ERR_DOMAIN",	&_rg_edomain,	SLANG_INT_TYPE, 1),
-	MAKE_VARIABLE("ERR_RUNNING",	&_rg_erun,	SLANG_INT_TYPE, 1),
-
-	SLANG_END_INTRIN_VAR_TABLE
-};
-
-
-#define rg_error(errortype) \
-do { \
-	_rg_err = errortype; \
-	_rg_err_str = ##errortype; \
-} while(0)
-
-
-int
-get_service_state_internal(char *svcName, rg_state_t *svcStatus)
-{
-	struct dlm_lksb lock;
-	char buf[32];
-
-	get_rg_state_local(svcName, svcStatus);
-	if (svcStatus->rs_state == RG_STATE_UNINITIALIZED) {
-		if (rg_lock(svcName, &lock) < 0) {
-			errno = ENOLCK;
-			return -1;
-		}
-
-		if (get_rg_state(svcName, svcStatus) < 0) {
-			errno = ENOENT;
-			rg_unlock(&lock);
-			return -1;
-		}
-
-		if (get_service_property(svcName, "autostart",
-					 buf, sizeof(buf)) == 0) {
-			if (buf[0] == '0' || !strcasecmp(buf, "no")) {
-				svcStatus->rs_state = RG_STATE_DISABLED;
-			} else {
-				svcStatus->rs_state = RG_STATE_STOPPED;
-			}
-		}
-
-		set_rg_state(svcName, svcStatus);
-
-		rg_unlock(&lock);
-	}
-
-	return 0;
-}
-
-
-/*
-   (restarts, last_owner, owner, state) = get_service_status(servicename)
- */
-void
-sl_service_status(char *svcName)
-{
-	rg_state_t svcStatus;
-	char *state_str;
-
-	if (get_service_state_internal(svcName, &svcStatus) < 0) {
-		SLang_verror(SL_RunTime_Error,
-			     "%s: Failed to get status for %s",
-			     __FUNCTION__,
-			     svcName);
-		return;
-	}
-
-	if (SLang_push_integer(svcStatus.rs_restarts) < 0) {
-		SLang_verror(SL_RunTime_Error,
-			     "%s: Failed to push restarts for %s",
-			     __FUNCTION__,
-			     svcName);
-		return;
-	}
-
-	if (SLang_push_integer(svcStatus.rs_last_owner) < 0) {
-		SLang_verror(SL_RunTime_Error,
-			     "%s: Failed to push last owner of %s",
-			     __FUNCTION__,
-			     svcName);
-		return;
-	}
-
-	switch(svcStatus.rs_state) {
-	case RG_STATE_DISABLED:
-	case RG_STATE_STOPPED:
-	case RG_STATE_FAILED:
-	case RG_STATE_RECOVER:
-	case RG_STATE_ERROR:
-		/* There is no owner for these states.  Ever.  */
-		svcStatus.rs_owner = -1;
-	}
-
-	if (SLang_push_integer(svcStatus.rs_owner) < 0) {
-		SLang_verror(SL_RunTime_Error,
-			     "%s: Failed to push owner of %s",
-			     __FUNCTION__,
-			     svcName);
-		return;
-	}
-
-	if (svcStatus.rs_flags & RG_FLAG_FROZEN) {
-		/* Special case: "frozen" is a flag, but user scripts should
-		   treat it as a state. */
-		state_str = strdup(rg_flag_str(RG_FLAG_FROZEN));
-	} else {
-		state_str = strdup(rg_state_str(svcStatus.rs_state));
-	}
-
-	if (!state_str) {
-		SLang_verror(SL_RunTime_Error,
-			     "%s: Failed to duplicate state of %s",
-			     __FUNCTION__,
-			     svcName);
-		return;
-	}
-
-	if (SLang_push_malloced_string(state_str) < 0) {
-		SLang_verror(SL_RunTime_Error,
-			     "%s: Failed to push state of %s",
-			     __FUNCTION__,
-			     svcName);
-		free(state_str);
-	}
-}
-
-
-/* These can be done by the master node */
-int
-sl_service_freeze(char *svcName)
-{
-	return svc_freeze(svcName);
-}
-
-
-int
-sl_service_unfreeze(char *svcName)
-{
-	return svc_unfreeze(svcName);
-}
-
-
-/**
-  (nofailback, restricted, ordered, nodelist) = service_domain_info(svcName);
- */
-void
-sl_domain_info(char *svcName)
-{
-	int *nodelist = NULL, listlen;
-	char buf[64];
-	int flags = 0;
-
-	if (get_service_property(svcName, "domain", buf, sizeof(buf)) < 0) {
-		/* no nodes */
-		SLang_push_integer(0);
-
-		/* no domain? */
-/*
-		str = strdup("none");
-		if (SLang_push_malloced_string(str) < 0) {
-			free(state_str);
-			return;
-		}
-*/
-
-		/* not ordered */
-		SLang_push_integer(0);
-		/* not restricted */
-		SLang_push_integer(0);
-		/* nofailback not set */
-		SLang_push_integer(0);
-	}
-
-	if (node_domain_set_safe(buf, &nodelist, &listlen, &flags) < 0) {
-		SLang_push_integer(0);
-		SLang_push_integer(0);
-		SLang_push_integer(0);
-		SLang_push_integer(0);
-		return;
-	}
-
-	SLang_push_integer(!!(flags & FOD_NOFAILBACK));
-	SLang_push_integer(!!(flags & FOD_RESTRICTED));
-	SLang_push_integer(!!(flags & FOD_ORDERED));
-
-	push_int_array(nodelist, listlen);
-	free(nodelist);
-
-/*
-	str = strdup(buf);
-	if (SLang_push_malloced_string(str) < 0) {
-		free(state_str);
-		return;
-	}
-*/
-}
-
-
-static int
-get_int_array(int **nodelist, int *len)
-{
-	SLang_Array_Type *a = NULL;
-	SLindex_Type i;
-	int *nodes = NULL, t, ret = -1;
-
-	if (!nodelist || !len)
-		return -1;
-
-	t = SLang_peek_at_stack();
-	if (t == SLANG_INT_TYPE) {
-
-		nodes = malloc(sizeof(int) * 1);
-		if (!nodes)
-			goto out;
-		if (SLang_pop_integer(&nodes[0]) < 0)
-			goto out;
-
-		*len = 1;
-		ret = 0;
-
-	} else if (t == SLANG_ARRAY_TYPE) {
-		if (SLang_pop_array_of_type(&a, SLANG_INT_TYPE) < 0)
-			goto out;
-		if (a->num_dims > 1)
-			goto out;
-		if (a->dims[0] < 0)
-			goto out;
-		nodes = malloc(sizeof(int) * a->dims[0]);
-		if (!nodes)
-			goto out;
-		for (i = 0; i < a->dims[0]; i++)
-			SLang_get_array_element(a, &i, &nodes[i]);
-
-		*len = a->dims[0];
-		ret = 0;
-	}
-
-out:
-	if (a)
-		SLang_free_array(a);
-	if (ret == 0) {
-		*nodelist = nodes;
-	} else {
-		if (nodes)
-			free(nodes);
-	}
-	
-	return ret;
-}
-
-
-/**
-  get_service_property(service_name, property)
- */
-char *
-sl_service_property(char *svcName, char *prop)
-{
-	char buf[96];
-
-	if (get_service_property(svcName, prop, buf, sizeof(buf)) < 0)
-		return NULL;
-
-	/* does this work or do I have to push a malloce'd string? */
-	return strdup(buf);
-}
-
-
-/**
-  usage:
-
-  stop_service(name, disable_flag);
- */
-int
-sl_stop_service(void)
-{
-	char *svcname = NULL;
-	int nargs, t, ret = -1;
-	int do_disable = 0;
-
-	nargs = SLang_Num_Function_Args;
-
-	/* Takes one or two args */
-	if (nargs <= 0 || nargs > 2) {
-		SLang_verror(SL_Syntax_Error,
-		     "%s: Wrong # of args (%d), must be 1 or 2\n",
-		     __FUNCTION__,
-		     nargs);
-		return -1;
-	}
-
-	if (nargs == 2) {
-		t = SLang_peek_at_stack();
-		if (t != SLANG_INT_TYPE) {
-			SLang_verror(SL_Syntax_Error,
-				     "%s: expected type %d got %d\n",
-				     __FUNCTION__, SLANG_INT_TYPE, t);
-			goto out;
-		}
-
-		if (SLang_pop_integer(&do_disable) < 0) {
-			SLang_verror(SL_Syntax_Error,
-			    "%s: Failed to pop integer from stack!\n",
-			    __FUNCTION__);
-			goto out;
-		}
-
-		--nargs;
-	}
-
-	if (nargs == 1) {
-		t = SLang_peek_at_stack();
-		if (t != SLANG_STRING_TYPE) {
-			SLang_verror(SL_Syntax_Error,
-				     "%s: expected type %d got %d\n",
-				     __FUNCTION__,
-				     SLANG_STRING_TYPE, t);
-			goto out;
-		}
-
-		if (SLpop_string(&svcname) < 0) {
-			SLang_verror(SL_Syntax_Error,
-			    "%s: Failed to pop string from stack!\n",
-			    __FUNCTION__);
-			goto out;
-		}
-	}
-
-	/* TODO: Meat of function goes here */
-	ret = service_op_stop(svcname, do_disable, _event_type);
-out:
-	if (svcname)
-		free(svcname);
-	_user_return = ret;
-	return ret;
-}
-
-
-/**
-  usage:
-
-  start_service(name, <array>ordered_node_list_allowed,
-  		      <array>node_list_illegal)
- */
-int
-sl_start_service(void)
-{
-	char *svcname = NULL;
-	int *pref_list = NULL, pref_list_len = 0;
-	int *illegal_list = NULL, illegal_list_len = 0;
-	int nargs, t, newowner = 0, ret = -1;
-
-	nargs = SLang_Num_Function_Args;
-
-	/* Takes one, two, or three */
-	if (nargs <= 0 || nargs > 3) {
-		SLang_verror(SL_Syntax_Error,
-		     "%s: Wrong # of args (%d), must be 1 or 2\n",
-		     __FUNCTION__, nargs);
-		return -1;
-	}
-
-	if (nargs == 3) {
-		if (get_int_array(&illegal_list, &illegal_list_len) < 0)
-			goto out;
-		--nargs;
-	}
-
-	if (nargs == 2) {
-		if (get_int_array(&pref_list, &pref_list_len) < 0)
-			goto out;
-		--nargs;
-	}
-
-	if (nargs == 1) {
-		/* Just get the service name */
-		t = SLang_peek_at_stack();
-		if (t != SLANG_STRING_TYPE) {
-			SLang_verror(SL_Syntax_Error,
-				     "%s: expected type %d got %d\n",
-				     __FUNCTION__,
-				     SLANG_STRING_TYPE, t);
-			goto out;
-		}
-
-		if (SLpop_string(&svcname) < 0)
-			goto out;
-	}
-
-	/* TODO: Meat of function goes here */
-	ret = service_op_start(svcname, pref_list,
-			       pref_list_len, &newowner);
-
-	if (ret == 0 && newowner > 0)
-		ret = newowner;
-out:
-	if (svcname)
-		free(svcname);
-	if (illegal_list)
-		free(illegal_list);
-	if (pref_list)
-		free(pref_list);
-	_user_return = ret;
-	return ret;
-}
-
-
-/* Take an array of integers given its length and
-   push it on to the S/Lang stack */
-void
-push_int_array(int *stuff, int len)
-{
-	SLindex_Type arrlen, x;
-	SLang_Array_Type *arr;
-	int i;
-
-	arrlen = len;
-	arr = SLang_create_array(SLANG_INT_TYPE, 0, NULL, &arrlen, 1);
-	if (!arr)
-		return;
-
-	x = 0;
-	for (x = 0; x < len; x++) {
-		i = stuff[x];
-		SLang_set_array_element(arr, &x, &i);
-	}
-	SLang_push_array(arr, 1);
-}
-
-
-/*
-   Returns an array of rgmanager-visible nodes online.  How cool is that?
- */
-void
-sl_nodes_online(void)
-{
-	int x, *nodes = NULL, nodecount = 0;
-
-	x = member_online_set(&nodes, &nodecount);
-	if (x < 0 || !nodes || !nodecount)
-		return;
-
-	push_int_array(nodes, nodecount);
-	free(nodes);
-}
-
-
-/*
-   Returns an array of rgmanager-defined services, in type:name format
-   We allocate/kill this list *once* per event to ensure we don't leak
-   memory
- */
-void
-sl_service_list(void)
-{
-	SLindex_Type svccount = _service_list_len, x = 0;
-	SLang_Array_Type *svcarray;
-
-	svcarray = SLang_create_array(SLANG_STRING_TYPE, 0, NULL, &svccount, 1);
-	if (!svcarray)
-		return;
-
-	for (; x < _service_list_len; x++) 
-		SLang_set_array_element(svcarray, &x, &_service_list[x]);
-
-	SLang_push_array(svcarray, 1);
-}
-
-
-/* s_union hook (see sets.c) */
-void
-sl_union(void)
-{
-	int *arr1 = NULL, a1len = 0;
-	int *arr2 = NULL, a2len = 0;
-	int *ret = NULL, retlen = 0;
-	int nargs = SLang_Num_Function_Args;
-
-	if (nargs != 2)
-		return;
-		
-	/* Remember: args on the stack are reversed */
-	get_int_array(&arr2, &a2len);
-	get_int_array(&arr1, &a1len);
-	s_union(arr1, a1len, arr2, a2len, &ret, &retlen);
-	push_int_array(ret, retlen);
-	if (arr1)
-		free(arr1);
-	if (arr2)
-		free(arr2);
-	if (ret)
-		free(ret);
-	return;
-}
-
-
-/* s_intersection hook (see sets.c) */
-void
-sl_intersection(void)
-{
-	int *arr1 = NULL, a1len = 0;
-	int *arr2 = NULL, a2len = 0;
-	int *ret = NULL, retlen = 0;
-	int nargs = SLang_Num_Function_Args;
-
-	if (nargs != 2)
-		return;
-		
-	/* Remember: args on the stack are reversed */
-	get_int_array(&arr2, &a2len);
-	get_int_array(&arr1, &a1len);
-	s_intersection(arr1, a1len, arr2, a2len, &ret, &retlen);
-	push_int_array(ret, retlen);
-	if (arr1)
-		free(arr1);
-	if (arr2)
-		free(arr2);
-	if (ret)
-		free(ret);
-	return;
-}
-
-
-/* s_delta hook (see sets.c) */
-void
-sl_delta(void)
-{
-	int *arr1 = NULL, a1len = 0;
-	int *arr2 = NULL, a2len = 0;
-	int *ret = NULL, retlen = 0;
-	int nargs = SLang_Num_Function_Args;
-
-	if (nargs != 2)
-		return;
-		
-	/* Remember: args on the stack are reversed */
-	get_int_array(&arr2, &a2len);
-	get_int_array(&arr1, &a1len);
-	s_delta(arr1, a1len, arr2, a2len, &ret, &retlen);
-	push_int_array(ret, retlen);
-	if (arr1)
-		free(arr1);
-	if (arr2)
-		free(arr2);
-	if (ret)
-		free(ret);
-	return;
-}
-
-
-/* s_subtract hook (see sets.c) */
-void
-sl_subtract(void)
-{
-	int *arr1 = NULL, a1len = 0;
-	int *arr2 = NULL, a2len = 0;
-	int *ret = NULL, retlen = 0;
-	int nargs = SLang_Num_Function_Args;
-
-	if (nargs != 2)
-		return;
-		
-	/* Remember: args on the stack are reversed */
-	get_int_array(&arr2, &a2len);
-	get_int_array(&arr1, &a1len);
-	s_subtract(arr1, a1len, arr2, a2len, &ret, &retlen);
-	push_int_array(ret, retlen);
-	if (arr1)
-		free(arr1);
-	if (arr2)
-		free(arr2);
-	if (ret)
-		free(ret);
-	return;
-}
-
-
-/* Shuffle array (see sets.c) */
-void
-sl_shuffle(void)
-{
-	int *arr1 = NULL, a1len = 0;
-	int nargs = SLang_Num_Function_Args;
-
-	if (nargs != 1)
-		return;
-		
-	/* Remember: args on the stack are reversed */
-	get_int_array(&arr1, &a1len);
-	s_shuffle(arr1, a1len);
-	push_int_array(arr1, a1len);
-	if (arr1)
-		free(arr1);
-	return;
-}
-
-
-/* Converts an int array to a string so we can log it in one shot */
-static int
-array_to_string(char *buf, int buflen, int *array, int arraylen)
-{
-	char intbuf[16];
-	int x, len, remain = buflen;
-
-	memset(intbuf, 0, sizeof(intbuf));
-	memset(buf, 0, buflen);
-	len = snprintf(buf, buflen - 1, "[ ");
-	if (len == buflen)
-		return -1;
-
-	remain -= len;
-	for (x = 0; x < arraylen; x++) {
-		len = snprintf(intbuf, sizeof(intbuf) - 1, "%d ", array[x]);
-		remain -= len;
-		if (remain > 0) {
-			strncat(buf, intbuf, len);
-		} else {
-			return -1;
-		}
-	}
-
-	len = snprintf(intbuf, sizeof(intbuf) - 1 ,  "]");
-	remain -= len;
-	if (remain > 0) {
-		strncat(buf, intbuf, len);
-	} else {
-		return -1;
-	}
-	return (buflen - remain);
-}
-
-
-/**
-  Start at the end of the arg list and work backwards, prepending a string.
-  This does not support standard logt_print / printf formattting; rather, we 
-  just allow integers / strings to be mixed on the stack, figure out the
-  type, convert it to the right type, and prepend it on to our log message
-
-  The last must be a log level, as specified above:
-     LOG_DEBUG
-     ...
-     LOG_EMERG
-
-  This matches up with logt_print / syslog mappings in the var table; the above
-  are constants in the S/Lang interpreter.  Any number of arguments may
-  be provided.  Examples are:
-
-    log(LOG_INFO, "String", 1, "string2");
-
-  Result:  String1string2
-
-    log(LOG_INFO, "String ", 1, " string2");
-
-  Result:  String 1 string2
-
- */
-void
-sl_logt_print(int level)
-{
-	int t, nargs, len;
-	//int level;
-	int s_intval;
-	char *s_strval;
-	int *nodes = 0, nlen = 0;
-	char logbuf[512];
-	char tmp[256];
-	int need_free;
-	int remain = sizeof(logbuf)-2;
-
-	nargs = SLang_Num_Function_Args;
-	if (nargs < 1)
-		return;
-
-	memset(logbuf, 0, sizeof(logbuf));
-	memset(tmp, 0, sizeof(tmp));
-	logbuf[sizeof(logbuf)-1] = 0;
-	logbuf[sizeof(logbuf)-2] = '\n';
-
-	while (nargs && (t = SLang_peek_at_stack()) >= 0 && remain) {
-		switch(t) {
-		case SLANG_ARRAY_TYPE:
-			if (get_int_array(&nodes, &nlen) < 0)
-				return;
-			len = array_to_string(tmp, sizeof(tmp),
-					      nodes, nlen);
-			if (len < 0) {
-				free(nodes);
-				return;
-			}
-			free(nodes);
-			break;
-		case SLANG_INT_TYPE:
-			if (SLang_pop_integer(&s_intval) < 0)
-				return;
-			len=snprintf(tmp, sizeof(tmp) - 1, "%d", s_intval);
-			break;
-		case SLANG_STRING_TYPE:
-			need_free = 0;
-			if (SLpop_string(&s_strval) < 0)
-				return;
-			len=snprintf(tmp, sizeof(tmp) - 1, "%s", s_strval);
-			SLfree(s_strval);
-			break;
-		default:
-			need_free = 0;
-			len=snprintf(tmp, sizeof(tmp) - 1,
-				     "{UnknownType %d}", t);
-			break;
-		}
-
-		--nargs;
-
-		if (len > remain)
-			return;
-		remain -= len;
-
-		memcpy(&logbuf[remain], tmp, len);
-	}
-
-#if 0
-	printf("<%d> %s\n", level, &logbuf[remain]);
-#endif
-	logt_print(level, "%s", &logbuf[remain]);
-	return;
-}
-
-
-/* Logging functions */
-void
-sl_log_debug(void)
-{
-	sl_logt_print(LOG_DEBUG);
-}
-
-
-void
-sl_log_info(void)
-{
-	sl_logt_print(LOG_INFO);
-}
-
-
-void
-sl_log_notice(void)
-{
-	sl_logt_print(LOG_NOTICE);
-}
-
-
-void
-sl_log_warning(void)
-{
-	sl_logt_print(LOG_WARNING);
-}
-
-
-void
-sl_log_err(void)
-{
-	sl_logt_print(LOG_ERR);
-}
-
-
-void
-sl_log_crit(void)
-{
-	sl_logt_print(LOG_CRIT);
-}
-
-
-void
-sl_log_alert(void)
-{
-	sl_logt_print(LOG_ALERT);
-}
-
-
-void
-sl_log_emerg(void)
-{
-	sl_logt_print(LOG_EMERG);
-}
-
-
-void
-sl_die(void)
-{
-	_stop_processing = 1;
-	return;
-}
-
-
-SLang_Intrin_Fun_Type rgmanager_slang[] =
-{
-	MAKE_INTRINSIC_0("nodes_online", sl_nodes_online, SLANG_VOID_TYPE),
-	MAKE_INTRINSIC_0("service_list", sl_service_list, SLANG_VOID_TYPE),
-
-	MAKE_INTRINSIC_SS("service_property", sl_service_property,
-			  SLANG_STRING_TYPE),
-	MAKE_INTRINSIC_S("service_domain_info", sl_domain_info, SLANG_VOID_TYPE),
-	MAKE_INTRINSIC_0("service_stop", sl_stop_service, SLANG_INT_TYPE),
-	MAKE_INTRINSIC_0("service_start", sl_start_service, SLANG_INT_TYPE),
-	MAKE_INTRINSIC_S("service_status", sl_service_status,
-			 SLANG_VOID_TYPE),
-	MAKE_INTRINSIC_S("service_freeze", sl_service_freeze,
-			 SLANG_INT_TYPE),
-	MAKE_INTRINSIC_S("service_unfreeze", sl_service_unfreeze,
-			 SLANG_INT_TYPE),
-
-	/* Node list manipulation */
-	MAKE_INTRINSIC_0("union", sl_union, SLANG_VOID_TYPE),
-	MAKE_INTRINSIC_0("intersection", sl_intersection, SLANG_VOID_TYPE),
-	MAKE_INTRINSIC_0("delta", sl_delta, SLANG_VOID_TYPE),
-	MAKE_INTRINSIC_0("subtract", sl_subtract, SLANG_VOID_TYPE),
-	MAKE_INTRINSIC_0("shuffle", sl_shuffle, SLANG_VOID_TYPE),
-
-	/* Logging */
-	MAKE_INTRINSIC_0("debug", sl_log_debug, SLANG_VOID_TYPE),
-	MAKE_INTRINSIC_0("info", sl_log_info, SLANG_VOID_TYPE),
-	MAKE_INTRINSIC_0("notice", sl_log_notice, SLANG_VOID_TYPE),
-	MAKE_INTRINSIC_0("warning", sl_log_warning, SLANG_VOID_TYPE),
-	MAKE_INTRINSIC_0("err", sl_log_err, SLANG_VOID_TYPE),
-	MAKE_INTRINSIC_0("crit", sl_log_crit, SLANG_VOID_TYPE),
-	MAKE_INTRINSIC_0("alert", sl_log_alert, SLANG_VOID_TYPE),
-	MAKE_INTRINSIC_0("emerg", sl_log_emerg, SLANG_VOID_TYPE),
-
-	MAKE_INTRINSIC_0("stop_processing", sl_die, SLANG_VOID_TYPE),
-
-	SLANG_END_INTRIN_FUN_TABLE
-};
-
-
-/* Hook for when we generate a script error */
-void
-rgmanager_slang_error_hook(char *errstr)
-{
-	/* Don't just send errstr, because it might contain
-	   "%s" for example which would result in a crash!
-	   plus, we like the newline :) */
-	logt_print(LOG_ERR, "[S/Lang] %s\n", errstr);
-}
-
-
-
-/* ================================================================
- * S/Lang initialization
- * ================================================================ */
-int
-do_init_slang(void)
-{
-	SLang_init_slang();
-	SLang_init_slfile();
-
-	if (SLadd_intrin_fun_table(rgmanager_slang, NULL) < 0)
-		return 1;
-    	if (SLadd_intrin_var_table (rgmanager_vars, NULL) < 0)
-		return 1;
-
-	/* TODO: Make rgmanager S/Lang conformant.  Though, it
-	   might be a poor idea to provide access to all the 
-	   S/Lang libs */
-	SLpath_set_load_path(RESOURCE_ROOTDIR);
-
-	_my_node_id = my_id();
-	__sl_initialized = 1;
-
-	SLang_Error_Hook = rgmanager_slang_error_hook;
-
-	return 0;
-}
-
-
-/*
-   Execute a script / file and return the result to the caller
-   Log an error if we receive one.
- */
-int
-do_slang_run(const char *file, const char *script)
-{
-	int ret = 0;
-
-	if (file) 
-		ret = SLang_load_file((char *)file);
-	else
-		ret = SLang_load_string((char *)script);
-
-	if (ret < 0) {
-		logt_print(LOG_ERR, "[S/Lang] Script Execution Failure\n");
-		SLang_restart(1);
-	}
-
-	return ret;
-}
-
-
-int
-S_node_event(const char *file, const char *script, int nodeid,
-	     int state, int clean)
-{
-	int ret;
-	cluster_member_list_t *membership = member_list();
-
-	_node_name = strdup(memb_id_to_name(membership, nodeid));
-	_node_state = state;
-	_node_clean = clean;
-	_node_id = nodeid;
-	free_member_list(membership);
-
-	ret = do_slang_run(file, script);
-
-	_node_state = 0;
-	_node_clean = 0;
-	_node_id = 0;
-	if (_node_name)
-		free(_node_name);
-	_node_name = NULL;
-
-	return ret;
-}
-
-
-int
-S_service_event(const char *file, const char *script, char *name,
-	        int state, int owner, int last_owner)
-{
-	int ret;
-
-	_service_name = name;
-	_service_state = (char *)rg_state_str(state);
-	_service_owner = owner;
-	_service_last_owner = last_owner;
-
-	switch(state) {
-	case RG_STATE_DISABLED:
-	case RG_STATE_STOPPED:
-	case RG_STATE_FAILED:
-	case RG_STATE_RECOVER:
-	case RG_STATE_ERROR:
-		/* There is no owner for these states.  Ever.  */
-		_service_owner = -1;
-	}
-
-	ret = do_slang_run(file, script);
-
-	_service_name = NULL;
-	_service_state = 0;
-	_service_owner = 0;
-	_service_last_owner = 0;
-
-	return ret;
-}
-
-
-int
-S_user_event(const char *file, const char *script, char *name,
-	     int request, int arg1, int arg2, int target, msgctx_t *ctx)
-{
-	int ret = RG_SUCCESS;
-
-	_service_name = name;
-	_service_owner = target;
-	_user_request = request;
-	_user_arg1 = arg1;
-	_user_arg2 = arg2;
-	_user_return = 0;
-
-	ret = do_slang_run(file, script);
-	if (ret < 0) {
-		_user_return = RG_ESCRIPT;
-	}
-
-	_service_name = NULL;
-	_service_owner = 0;
-	_user_request = 0;
-	_user_arg1 = 0;
-	_user_arg2 = 0;
-
-	/* XXX Send response code to caller - that 0 should be the
-	   new service owner, if there is one  */
-	if (ctx) {
-		if (_user_return > 0) {
-			/* sl_start_service() squashes return code and
-			   node ID into one value.  <0 = error, >0 =
-			   success, return-value == node id running
-			   service */
-			send_ret(ctx, name, 0, request, _user_return);
-		} else {
-			/* return value < 0 ... pass directly back;
-			   don't transpose */
-			send_ret(ctx, name, _user_return, request, 0);
-		}
-		msg_close(ctx);
-		msg_free_ctx(ctx);
-	}
-	_user_return = 0;
-	return ret;
-}
-
-
-int
-slang_do_script(event_t *pattern, event_t *ev)
-{
-	_event_type = ev->ev_type;
-	int ret = 0;
-
-	switch(ev->ev_type) {
-	case EVENT_NODE:
-		ret = S_node_event(
-				pattern->ev_script_file,
-				pattern->ev_script,
-				ev->ev.node.ne_nodeid,
-				ev->ev.node.ne_state,
-				ev->ev.node.ne_clean);
-		break;
-	case EVENT_RG:
-		ret = S_service_event(
-				pattern->ev_script_file,
-				pattern->ev_script,
-				ev->ev.group.rg_name,
-				ev->ev.group.rg_state,
-				ev->ev.group.rg_owner,
-				ev->ev.group.rg_last_owner);
-		break;
-	case EVENT_USER:
-		ret = S_user_event(
-				pattern->ev_script_file,
-				pattern->ev_script,
-				ev->ev.user.u_name,
-				ev->ev.user.u_request,
-				ev->ev.user.u_arg1,
-				ev->ev.user.u_arg2,
-				ev->ev.user.u_target,
-				ev->ev.user.u_ctx);
-		break;
-	default:
-		break;
-	}
-
-	_event_type = EVENT_NONE;
-	return ret;
-}
-
-
-
-/**
-  Process an event given our event table and the event that
-  occurred.  Note that the caller is responsible for freeing the
-  event - do not free (ev) ...
- */
-int
-slang_process_event(event_table_t *event_table, event_t *ev)
-{
-	int x, y;
-	event_t *pattern;
-
-	if (!__sl_initialized)
-		do_init_slang();
-
-	/* Get the service list once before processing events */
-	if (!_service_list || !_service_list_len)
-		_service_list = get_service_names(&_service_list_len);
-
-	_stop_processing = 0;
-	for (x = 1; x <= event_table->max_prio; x++) {
-		list_for(&event_table->entries[x], pattern, y) {
-			if (event_match(pattern, ev))
-				slang_do_script(pattern, ev);
-			if (_stop_processing)
-				goto out;
-		}
-	}
-
-	/* Default level = 0 */
-	list_for(&event_table->entries[0], pattern, y) {
-		if (event_match(pattern, ev))
-			slang_do_script(pattern, ev);
-		if (_stop_processing)
-			goto out;
-	}
-
-out:
-	/* Free the service list */
-	if (_service_list) {
-		for(x = 0; x < _service_list_len; x++) {
-			free(_service_list[x]);
-		}
-		free(_service_list);
-		_service_list = NULL;
-		_service_list_len = 0;
-	}
-
-	return 0;
-}
diff --git a/rgmanager/src/daemons/test.c b/rgmanager/src/daemons/test.c
deleted file mode 100644
index 26033b6..0000000
--- a/rgmanager/src/daemons/test.c
+++ /dev/null
@@ -1,490 +0,0 @@
-#include <libxml/parser.h>
-#include <libxml/xmlmemory.h>
-#include <libxml/xpath.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <resgroup.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <list.h>
-#include <restart_counter.h>
-#include <reslist.h>
-#include <pthread.h>
-#include <libgen.h>
-#include <depends.h>
-#include <event.h>
-
-#ifndef NO_CCS
-#error "Can not be built with CCS support."
-#endif
-
-void res_build_name(char *, size_t, resource_t *);
-
-
-/**
-  Tells us if a resource group can be migrated.
- */
-int
-group_migratory(resource_t **resources, resource_node_t **tree, char *groupname)
-{
-	resource_node_t *rn;
-	resource_t *res;
-	int migrate = 0, x, ret = 0;
-
-	res = find_root_by_ref(resources, groupname);
-	if (!res) {
-		/* Nonexistent or non-TL RG cannot be migrated */
-		return 0;
-	}
-
-	for (x = 0; res->r_rule->rr_actions[x].ra_name; x++) {
-		if (!strcmp(res->r_rule->rr_actions[x].ra_name,
-		    "migrate")) {
-			migrate = 1;
-			break;
-		}
-	}
-
-	if (!migrate)
-		goto out_unlock;
-
-	list_do(tree, rn) {
-		if (rn->rn_resource == res && rn->rn_child) {
-			/* TL service w/ children cannot be migrated */
-			goto out_unlock;
-		}
-	} while (!list_done(tree, rn));
-
-
-	/* Ok, we have a migrate option to the resource group,
-	   the resource group has no children, and the resource
-	   group exists.  We're all good */
-	ret = 1;
-
-out_unlock:
-	return ret;
-}
-
-#define shift() {++argv; --argc;}
-
-#define USAGE_TEST \
-	"\ttest <configfile> [args..]\n" \
-	"\t\tstart <type> <resource>\n" \
-	"\t\tstatus <type> <resource>\n" \
-	"\t\tstop <type> <resource>\n" \
-	"\n"
-
-#define USAGE_DELTA \
-	"\tdelta <configfile1> <configfile2>\n\n"
-
-#define USAGE_RULES \
-	"\trules\n\n"
-
-
-void _no_op_mode(int);
-void malloc_dump_table(void);
-char *agentpath = RESOURCE_ROOTDIR;
-
-
-int
-rules_func(int __attribute__((unused)) argc,
-	   char __attribute__((unused)) **argv)
-{
-	resource_rule_t *rulelist = NULL, *currule;
-	int rules = 0;
-
-	fprintf(stderr,"Running in rules mode.\n");
-
-	load_resource_rules(agentpath, &rulelist);
-	list_do(&rulelist, currule) {
-		++rules;
-	} while (!list_done(&rulelist, currule));
-	fprintf(stderr, "Loaded %d resource rules\n",
-		rules);
-	list_do(&rulelist, currule) {
-		print_resource_rule(currule);
-	} while (!list_done(&rulelist, currule));
-
-	destroy_resource_rules(&rulelist);
-
-	return 0;
-}
-
-
-int
-deps_func(int argc, char**argv)
-{
-	dep_t *depends = NULL;
-	int ccsfd;
-
-	conf_setconfig(argv[1]);
-       	ccsfd = ccs_lock();
-	if (ccsfd < 0) {
-		printf("Error parsing %s\n", argv[1]);
-		goto out;
-	}
-
-	construct_depends(ccsfd, &depends);
-	if (depends) {
-		print_depends(stdout, &depends);
-	}
-	
-	deconstruct_depends(&depends);
-
-out:
-	ccs_unlock(ccsfd);
-	return 0;
-}
-
-
-
-int
-test_func(int argc, char **argv)
-{
-	fod_t *domains = NULL;
-	dep_t *depends = NULL;
-	resource_rule_t *rulelist = NULL, *currule;
-	resource_t *reslist = NULL, *curres;
-	resource_node_t *tree = NULL, *tmp, *rn = NULL;
-	int ccsfd, ret = 0, rules = 0;
-	event_table_t *events = NULL;
-
-	fprintf(stderr,"Running in test mode.\n");
-
-	conf_setconfig(argv[1]);
-       	ccsfd = ccs_lock();
-	if (ccsfd < 0) {
-		printf("Error parsing %s\n", argv[1]);
-		goto out;
-	}
-
-	load_resource_rules(agentpath, &rulelist);
-	construct_domains(ccsfd, &domains);
-	construct_events(ccsfd, &events);
-	construct_depends(ccsfd, &depends);
-	load_resources(ccsfd, &reslist, &rulelist);
-	build_resource_tree(ccsfd, &tree, &rulelist, &reslist);
-
-	shift();
-
-	if (argc == 1) {
-		/*
-		printf("=== Resource XML Rules ===\n");
-		list_do(&rulelist, currule) {
-			print_resource_rule(currule);
-		} while (!list_done(&rulelist, currule));
-		 */
-		list_do(&rulelist, currule) {
-			++rules;
-		} while (!list_done(&rulelist, currule));
-		fprintf(stderr, "Loaded %d resource rules\n",
-			rules);
-
-		if (reslist) {
-			printf("=== Resources List ===\n");
-			list_do(&reslist, curres) {
-				print_resource(curres);
-			} while (!list_done(&reslist, curres));
-		}
-
-		if (tree) {
-			printf("=== Resource Tree ===\n");
-			print_resource_tree(&tree);
-		}
-
-		if (domains) {
-			printf("=== Failover Domains ===\n");
-			print_domains(&domains);
-		}
-		
-		if (depends) {
-			printf("=== Dependencies ===\n");
-			print_depends(stdout, &depends);
-		}
-
-		if (events) {
-			printf("=== Event Triggers ===\n");
-			print_events(events);
-		}
-	}
-
-	ccs_unlock(ccsfd);
-
-	if (argc < 4)
-		goto out;
-
-	curres = find_resource_by_ref(&reslist, argv[2], argv[3]);
-	if (!curres) {
-		printf("No resource %s of type %s found\n",
-		       argv[3], argv[2]);
-		goto out;
-	}
-
-	list_do(&tree, tmp) {
-		if (tmp->rn_resource == curres) {
-			rn = tmp;
-			break;
-		}
-	} while (!list_done(&tree, tmp));
-
-	if (!strcmp(argv[1], "start")) {
-		printf("Starting %s...\n", argv[3]);
-
-		if (res_start(&tree, curres, NULL)) {
-			printf("Failed to start %s\n", argv[3]);
-			ret = -1;
-			goto out;
-		}
-		printf("Start of %s complete\n", argv[3]);
-		goto out;
-	} else if (!strcmp(argv[1], "stop")) {
-		printf("Stopping %s...\n", argv[3]);
-
-		if (res_stop(&tree, curres, NULL)) {
-			ret = -1;
-			goto out;
-		}
-		printf("Stop of %s complete\n", argv[3]);
-		goto out;
-	} else if (!strcmp(argv[1], "migrate")) {
-		printf("Migrating %s to %s...\n", argv[3], argv[4]);
-
-	#if 0
-		if (!group_migratory(curres)) {
-			printf("No can do\n");
-			ret = -1;
-			goto out;
-		}
-	#endif
-
-		if (res_exec(rn, RS_MIGRATE, argv[4], 0)) {
-			ret = -1;
-			goto out;
-		}
-		printf("Migration of %s complete\n", argv[3]);
-		goto out;
-	} else if (!strcmp(argv[1], "status")) {
-		printf("Checking status of %s...\n", argv[3]);
-
-		ret = res_status(&tree, curres, NULL);
-		if (ret) {
-			printf("Status check of %s failed\n", argv[3]);
-			goto out;
-		}
-		printf("Status of %s is good\n", argv[3]);
-		goto out;
-	}
-
-out:
-	deconstruct_depends(&depends);
-	deconstruct_events(&events);
-	deconstruct_domains(&domains);
-	destroy_resource_tree(&tree);
-	destroy_resources(&reslist);
-	destroy_resource_rules(&rulelist);
-
-	return ret;
-}
-
-
-int
-tree_delta_test(int argc, char **argv)
-{
-	resource_rule_t *rulelist = NULL, *currule, *rulelist2 = NULL;
-	resource_t *reslist = NULL, *curres, *reslist2 = NULL;
-	resource_node_t *tree = NULL, *tree2 = NULL;
-	resource_node_t *tn;
-	int ccsfd, ret = 0, need_init, need_kill;
-	char rg[64];
-
-	if (argc < 2) {
-		printf("Operation requires two arguments\n");
-		printf(USAGE_DELTA);
-		return -1;
-	}
-
-	currule = NULL;
-	curres = NULL;
-
-	fprintf(stderr,"Running in resource tree delta test mode.\n");
-
-	conf_setconfig(argv[1]);
-
-       	ccsfd = ccs_lock();
-	if (ccsfd < 0) {
-		printf("Error parsing %s\n", argv[1]);
-		ret = 1;
-		goto out;
-	}
-
-	load_resource_rules(agentpath, &rulelist);
-	load_resources(ccsfd, &reslist, &rulelist);
-	build_resource_tree(ccsfd, &tree, &rulelist, &reslist);
-	ccs_unlock(ccsfd);
-
-	conf_setconfig(argv[2]);
-
-       	ccsfd = ccs_lock();
-	if (ccsfd < 0) {
-		printf("Error parsing %s\n", argv[2]);
-		ret = 1;
-		goto out;
-	}
-
-	load_resource_rules(agentpath, &rulelist2);
-	load_resources(ccsfd, &reslist2, &rulelist2);
-	build_resource_tree(ccsfd, &tree2, &rulelist2, &reslist2);
-	ccs_unlock(ccsfd);
-
-	resource_delta(&reslist, &reslist2);
-
-	printf("=== Old Resource List ===\n");
-	list_do(&reslist, curres) {
-		print_resource(curres);
-	} while (!list_done(&reslist, curres));
-	printf("=== New Resource List ===\n");
-	list_do(&reslist2, curres) {
-		print_resource(curres);
-	} while (!list_done(&reslist2, curres));
-
-	resource_tree_delta(&tree, &tree2);
-	printf("=== Old Resource Tree ===\n");
-	print_resource_tree(&tree);
-	printf("=== New Resource Tree ===\n");
-	print_resource_tree(&tree2);
-	printf("=== Operations (down-phase) ===\n");
-	list_do(&tree, tn) {
-		res_build_name(rg, sizeof(rg), tn->rn_resource);
-		/* Set state to uninitialized if we're killing a RG */
-		need_init = 0;
-
-		/* Set state to uninitialized if we're killing a RG */
-		need_kill = 0;
-		if (tn->rn_resource->r_flags & RF_NEEDSTOP) {
-			need_kill = 1;
-			printf("[kill] ");
-		}
-
-		if (!tn->rn_child && ((tn->rn_resource->r_rule->rr_flags &
-		    RF_DESTROY) == 0) && group_migratory(&reslist, &tree, rg) &&
-		    need_kill == 1) {
-			/* Do something smart here: flip state? */
-			printf("[no-op] %s was removed from the config, but I am not stopping it.\n",
-			       rg);
-			continue;
-		}
-
-		res_condstop(&tn, tn->rn_resource, NULL);
-	} while (!list_done(&tree, tn));
-	printf("=== Operations (up-phase) ===\n");
-	list_do(&tree2, tn) {
-		res_build_name(rg, sizeof(rg), tn->rn_resource);
-		/* New RG.  We'll need to initialize it. */
-		need_init = 0;
-		if (!(tn->rn_resource->r_flags & RF_RECONFIG) &&
-		    (tn->rn_resource->r_flags & RF_NEEDSTART))
-			need_init = 1;
-
-		if (need_init) {
-			printf("[init] ");
-		}
-
-		if (!tn->rn_child && ((tn->rn_resource->r_rule->rr_flags &
-		    RF_INIT) == 0) && group_migratory(&reslist2, &tree2, rg) &&
-		    need_init == 1) {
-			/* Do something smart here? */
-			printf("[noop] %s was added, but I am not initializing it\n", rg);
-			continue;
-		}
-
-		if (need_init) {
-			res_stop(&tn, tn->rn_resource, NULL);
-		} else {
-			res_condstart(&tn, tn->rn_resource, NULL);
-		}
-	} while (!list_done(&tree2, tn));
-
-out:
-	destroy_resource_tree(&tree2);
-	destroy_resources(&reslist2);
-	destroy_resource_rules(&rulelist2);
-
-	destroy_resource_tree(&tree);
-	destroy_resources(&reslist);
-	destroy_resource_rules(&rulelist);
-
-	return ret;
-}
-
-
-int
-usage(char *arg0)
-{
-	printf("usage: %s [agent_path] <args..>\n\n", arg0);
-	printf(USAGE_TEST);
-	printf(USAGE_DELTA);
-	printf(USAGE_RULES);
-
-	exit(1);
-}
-
-
-int
-main(int argc, char **argv)
-{
-	char *arg0 = basename(argv[0]);
-	int ret;
-	struct stat st;
-
-	if (argc < 2) {
-		usage(arg0);
-		return 1;
-	}
-
-	xmlInitParser();
-	while (argc > 1) {
-		if (!strcmp(argv[1], "test")) {
-			shift();
-			ret = test_func(argc, argv);
-			goto out;
-		} else if (!strcmp(argv[1], "depends")) {
-			shift();
-			ret = deps_func(argc, argv);
-			goto out;
-		} else if (!strcmp(argv[1], "noop")) {
-			shift();
-			_no_op_mode(1);
-			ret = test_func(argc, argv);
-			goto out;
-		} else if (!strcmp(argv[1], "rules")) {
-			shift();
-			ret = rules_func(argc, argv);
-			goto out;
-		} else if (!strcmp(argv[1], "delta")) {
-			shift();
-			_no_op_mode(1);
-			ret = tree_delta_test(argc, argv);
-			goto out;
-		} else {
-			ret = stat(argv[1], &st);
-			if (ret == -1 || !S_ISDIR(st.st_mode)) {
-				break;
-			}
-			fprintf(stderr,
-				"Using %s as resource agent path\n",
-			       argv[1]);
-			agentpath = argv[1];
-			shift();
-		}
-	}
-
-	usage(arg0);
-	xmlCleanupParser();
-	malloc_dump_table();
-	return 1;
-
-out:
-	xmlCleanupParser();
-	malloc_dump_table();
-	return ret;
-}
diff --git a/rgmanager/src/daemons/tests/delta-test001-test002.expected b/rgmanager/src/daemons/tests/delta-test001-test002.expected
deleted file mode 100644
index 5e35839..0000000
--- a/rgmanager/src/daemons/tests/delta-test001-test002.expected
+++ /dev/null
@@ -1,22 +0,0 @@
-=== Old Resource List ===
-Resource type: service [INLINE]
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== New Resource List ===
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== Old Resource Tree ===
-service {
-  name = "test1";
-}
-=== New Resource Tree ===
-service {
-  name = "test1";
-}
diff --git a/rgmanager/src/daemons/tests/delta-test002-test003.expected b/rgmanager/src/daemons/tests/delta-test002-test003.expected
deleted file mode 100644
index 28de03f..0000000
--- a/rgmanager/src/daemons/tests/delta-test002-test003.expected
+++ /dev/null
@@ -1,34 +0,0 @@
-=== Old Resource List ===
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== New Resource List ===
-Resource type: script [NEEDSTART]
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/httpd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== Old Resource Tree ===
-service {
-  name = "test1";
-}
-=== New Resource Tree ===
-service {
-  name = "test1";
-  script [ NEEDSTART ] {
-    name = "initscript";
-    file = "/etc/init.d/httpd";
-    service_name = "test1";
-  }
-}
diff --git a/rgmanager/src/daemons/tests/delta-test003-test004.expected b/rgmanager/src/daemons/tests/delta-test003-test004.expected
deleted file mode 100644
index 6280a48..0000000
--- a/rgmanager/src/daemons/tests/delta-test003-test004.expected
+++ /dev/null
@@ -1,46 +0,0 @@
-=== Old Resource List ===
-Resource type: script [NEEDSTOP]
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/httpd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== New Resource List ===
-Resource type: script [NEEDSTART]
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== Old Resource Tree ===
-service {
-  name = "test1";
-  script [ NEEDSTOP ] {
-    name = "initscript";
-    file = "/etc/init.d/httpd";
-    service_name = "test1";
-  }
-}
-=== New Resource Tree ===
-service {
-  name = "test1";
-  script [ NEEDSTART ] {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
diff --git a/rgmanager/src/daemons/tests/delta-test004-test005.expected b/rgmanager/src/daemons/tests/delta-test004-test005.expected
deleted file mode 100644
index b50c1a8..0000000
--- a/rgmanager/src/daemons/tests/delta-test004-test005.expected
+++ /dev/null
@@ -1,58 +0,0 @@
-=== Old Resource List ===
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== New Resource List ===
-Resource type: ip [NEEDSTART]
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.2 [ primary unique ]
-  monitor_link = 1
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== Old Resource Tree ===
-service {
-  name = "test1";
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
-=== New Resource Tree ===
-service {
-  name = "test1";
-  ip [ NEEDSTART ] {
-    address = "192.168.1.2";
-    monitor_link = "1";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
diff --git a/rgmanager/src/daemons/tests/delta-test005-test006.expected b/rgmanager/src/daemons/tests/delta-test005-test006.expected
deleted file mode 100644
index 8a77765..0000000
--- a/rgmanager/src/daemons/tests/delta-test005-test006.expected
+++ /dev/null
@@ -1,70 +0,0 @@
-=== Old Resource List ===
-Resource type: ip [NEEDSTOP]
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.2 [ primary unique ]
-  monitor_link = 1
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== New Resource List ===
-Resource type: ip [NEEDSTART]
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.2 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== Old Resource Tree ===
-service {
-  name = "test1";
-  ip [ NEEDSTOP ] {
-    address = "192.168.1.2";
-    monitor_link = "1";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
-=== New Resource Tree ===
-service {
-  name = "test1";
-  ip [ NEEDSTART ] {
-    address = "192.168.1.2";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
diff --git a/rgmanager/src/daemons/tests/delta-test006-test007.expected b/rgmanager/src/daemons/tests/delta-test006-test007.expected
deleted file mode 100644
index dd99fef..0000000
--- a/rgmanager/src/daemons/tests/delta-test006-test007.expected
+++ /dev/null
@@ -1,70 +0,0 @@
-=== Old Resource List ===
-Resource type: ip [NEEDSTOP]
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.2 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== New Resource List ===
-Resource type: ip [NEEDSTART]
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== Old Resource Tree ===
-service {
-  name = "test1";
-  ip [ NEEDSTOP ] {
-    address = "192.168.1.2";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
-=== New Resource Tree ===
-service {
-  name = "test1";
-  ip [ NEEDSTART ] {
-    address = "192.168.1.3";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
diff --git a/rgmanager/src/daemons/tests/delta-test007-test008.expected b/rgmanager/src/daemons/tests/delta-test007-test008.expected
deleted file mode 100644
index f9c93b1..0000000
--- a/rgmanager/src/daemons/tests/delta-test007-test008.expected
+++ /dev/null
@@ -1,80 +0,0 @@
-=== Old Resource List ===
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== New Resource List ===
-Resource type: fs [NEEDSTART]
-Instances: 0/1
-Agent: fs.sh
-Attributes:
-  name = mount1 [ primary ]
-  mountpoint = /mnt/cluster [ unique required ]
-  device = /dev/sdb8 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== Old Resource Tree ===
-service {
-  name = "test1";
-  ip {
-    address = "192.168.1.3";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
-=== New Resource Tree ===
-service {
-  name = "test1";
-  ip {
-    address = "192.168.1.3";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
diff --git a/rgmanager/src/daemons/tests/delta-test008-test009.expected b/rgmanager/src/daemons/tests/delta-test008-test009.expected
deleted file mode 100644
index 2a8b568..0000000
--- a/rgmanager/src/daemons/tests/delta-test008-test009.expected
+++ /dev/null
@@ -1,96 +0,0 @@
-=== Old Resource List ===
-Resource type: fs
-Instances: 0/1
-Agent: fs.sh
-Attributes:
-  name = mount1 [ primary ]
-  mountpoint = /mnt/cluster [ unique required ]
-  device = /dev/sdb8 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== New Resource List ===
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount1 [ primary ]
-  mountpoint = /mnt/cluster [ unique required ]
-  device = /dev/sdb8 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== Old Resource Tree ===
-service {
-  name = "test1";
-  ip {
-    address = "192.168.1.3";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
-=== New Resource Tree ===
-service {
-  name = "test1";
-  fs [ NEEDSTART ] {
-    name = "mount1";
-    mountpoint = "/mnt/cluster";
-    device = "/dev/sdb8";
-    fstype = "ext3";
-      }
-  ip {
-    address = "192.168.1.3";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
diff --git a/rgmanager/src/daemons/tests/delta-test009-test010.expected b/rgmanager/src/daemons/tests/delta-test009-test010.expected
deleted file mode 100644
index 15b06db..0000000
--- a/rgmanager/src/daemons/tests/delta-test009-test010.expected
+++ /dev/null
@@ -1,110 +0,0 @@
-=== Old Resource List ===
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount1 [ primary ]
-  mountpoint = /mnt/cluster [ unique required ]
-  device = /dev/sdb8 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== New Resource List ===
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount1 [ primary ]
-  mountpoint = /mnt/cluster [ unique required ]
-  device = /dev/sdb8 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: nfsexport [NEEDSTART]
-Agent: nfsexport.sh
-Attributes:
-  name = Dummy Export [ primary ]
-  device [ inherit("device") ]
-  path [ inherit("mountpoint") ]
-  fsid [ inherit("fsid") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== Old Resource Tree ===
-service {
-  name = "test1";
-  fs {
-    name = "mount1";
-    mountpoint = "/mnt/cluster";
-    device = "/dev/sdb8";
-    fstype = "ext3";
-      }
-  ip {
-    address = "192.168.1.3";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
-=== New Resource Tree ===
-service {
-  name = "test1";
-  fs {
-    name = "mount1";
-    mountpoint = "/mnt/cluster";
-    device = "/dev/sdb8";
-    fstype = "ext3";
-      }
-  ip {
-    address = "192.168.1.3";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
diff --git a/rgmanager/src/daemons/tests/delta-test010-test011.expected b/rgmanager/src/daemons/tests/delta-test010-test011.expected
deleted file mode 100644
index 8ae5a44..0000000
--- a/rgmanager/src/daemons/tests/delta-test010-test011.expected
+++ /dev/null
@@ -1,180 +0,0 @@
-=== Old Resource List ===
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount1 [ primary ]
-  mountpoint = /mnt/cluster [ unique required ]
-  device = /dev/sdb8 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: nfsexport
-Agent: nfsexport.sh
-Attributes:
-  name = Dummy Export [ primary ]
-  device [ inherit("device") ]
-  path [ inherit("mountpoint") ]
-  fsid [ inherit("fsid") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== New Resource List ===
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount1 [ primary ]
-  mountpoint = /mnt/cluster [ unique required ]
-  device = /dev/sdb8 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: nfsclient [NEEDSTART]
-Agent: nfsclient.sh
-Attributes:
-  name = User group [ primary unique ]
-  target = @users [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = ro
-
-Resource type: nfsclient [NEEDSTART]
-Agent: nfsclient.sh
-Attributes:
-  name = Admin group [ primary unique ]
-  target = @admin [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsclient [NEEDSTART]
-Agent: nfsclient.sh
-Attributes:
-  name = yellow [ primary unique ]
-  target = yellow [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient [NEEDSTART]
-Agent: nfsclient.sh
-Attributes:
-  name = magenta [ primary unique ]
-  target = magenta [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient [NEEDSTART]
-Agent: nfsclient.sh
-Attributes:
-  name = red [ primary unique ]
-  target = red [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsexport
-Agent: nfsexport.sh
-Attributes:
-  name = Dummy Export [ primary ]
-  device [ inherit("device") ]
-  path [ inherit("mountpoint") ]
-  fsid [ inherit("fsid") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== Old Resource Tree ===
-service {
-  name = "test1";
-  fs {
-    name = "mount1";
-    mountpoint = "/mnt/cluster";
-    device = "/dev/sdb8";
-    fstype = "ext3";
-      }
-  ip {
-    address = "192.168.1.3";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
-=== New Resource Tree ===
-service {
-  name = "test1";
-  fs {
-    name = "mount1";
-    mountpoint = "/mnt/cluster";
-    device = "/dev/sdb8";
-    fstype = "ext3";
-        nfsexport [ NEEDSTART ] {
-      name = "Dummy Export";
-      device = "/dev/sdb8";
-      path = "/mnt/cluster";
-            nfsclient {
-        name = "Admin group";
-        target = "@admin";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-      nfsclient {
-        name = "User group";
-        target = "@users";
-        path = "/mnt/cluster";
-                options = "ro";
-      }
-    }
-  }
-  ip {
-    address = "192.168.1.3";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
diff --git a/rgmanager/src/daemons/tests/delta-test011-test012.expected b/rgmanager/src/daemons/tests/delta-test011-test012.expected
deleted file mode 100644
index f08d30d..0000000
--- a/rgmanager/src/daemons/tests/delta-test011-test012.expected
+++ /dev/null
@@ -1,248 +0,0 @@
-=== Old Resource List ===
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount1 [ primary ]
-  mountpoint = /mnt/cluster [ unique required ]
-  device = /dev/sdb8 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = User group [ primary unique ]
-  target = @users [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = ro
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = Admin group [ primary unique ]
-  target = @admin [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = yellow [ primary unique ]
-  target = yellow [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = magenta [ primary unique ]
-  target = magenta [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient [NEEDSTOP]
-Agent: nfsclient.sh
-Attributes:
-  name = red [ primary unique ]
-  target = red [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsexport
-Agent: nfsexport.sh
-Attributes:
-  name = Dummy Export [ primary ]
-  device [ inherit("device") ]
-  path [ inherit("mountpoint") ]
-  fsid [ inherit("fsid") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== New Resource List ===
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount1 [ primary ]
-  mountpoint = /mnt/cluster [ unique required ]
-  device = /dev/sdb8 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = User group [ primary unique ]
-  target = @users [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = ro
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = Admin group [ primary unique ]
-  target = @admin [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = yellow [ primary unique ]
-  target = yellow [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = magenta [ primary unique ]
-  target = magenta [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient [NEEDSTART]
-Agent: nfsclient.sh
-Attributes:
-  name = red [ primary unique ]
-  target = red [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = ro
-
-Resource type: nfsexport
-Agent: nfsexport.sh
-Attributes:
-  name = Dummy Export [ primary ]
-  device [ inherit("device") ]
-  path [ inherit("mountpoint") ]
-  fsid [ inherit("fsid") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== Old Resource Tree ===
-service {
-  name = "test1";
-  fs {
-    name = "mount1";
-    mountpoint = "/mnt/cluster";
-    device = "/dev/sdb8";
-    fstype = "ext3";
-        nfsexport {
-      name = "Dummy Export";
-      device = "/dev/sdb8";
-      path = "/mnt/cluster";
-            nfsclient {
-        name = "Admin group";
-        target = "@admin";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-      nfsclient {
-        name = "User group";
-        target = "@users";
-        path = "/mnt/cluster";
-                options = "ro";
-      }
-    }
-  }
-  ip {
-    address = "192.168.1.3";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
-=== New Resource Tree ===
-service {
-  name = "test1";
-  fs {
-    name = "mount1";
-    mountpoint = "/mnt/cluster";
-    device = "/dev/sdb8";
-    fstype = "ext3";
-        nfsexport {
-      name = "Dummy Export";
-      device = "/dev/sdb8";
-      path = "/mnt/cluster";
-            nfsclient {
-        name = "Admin group";
-        target = "@admin";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-      nfsclient {
-        name = "User group";
-        target = "@users";
-        path = "/mnt/cluster";
-                options = "ro";
-      }
-      nfsclient [ NEEDSTART ] {
-        name = "red";
-        target = "red";
-        path = "/mnt/cluster";
-                options = "ro";
-      }
-    }
-  }
-  ip {
-    address = "192.168.1.3";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
diff --git a/rgmanager/src/daemons/tests/delta-test012-test013.expected b/rgmanager/src/daemons/tests/delta-test012-test013.expected
deleted file mode 100644
index b704e40..0000000
--- a/rgmanager/src/daemons/tests/delta-test012-test013.expected
+++ /dev/null
@@ -1,254 +0,0 @@
-=== Old Resource List ===
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount1 [ primary ]
-  mountpoint = /mnt/cluster [ unique required ]
-  device = /dev/sdb8 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = User group [ primary unique ]
-  target = @users [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = ro
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = Admin group [ primary unique ]
-  target = @admin [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = yellow [ primary unique ]
-  target = yellow [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = magenta [ primary unique ]
-  target = magenta [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient [NEEDSTOP]
-Agent: nfsclient.sh
-Attributes:
-  name = red [ primary unique ]
-  target = red [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = ro
-
-Resource type: nfsexport
-Agent: nfsexport.sh
-Attributes:
-  name = Dummy Export [ primary ]
-  device [ inherit("device") ]
-  path [ inherit("mountpoint") ]
-  fsid [ inherit("fsid") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== New Resource List ===
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount1 [ primary ]
-  mountpoint = /mnt/cluster [ unique required ]
-  device = /dev/sdb8 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = User group [ primary unique ]
-  target = @users [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = ro
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = Admin group [ primary unique ]
-  target = @admin [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = yellow [ primary unique ]
-  target = yellow [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = magenta [ primary unique ]
-  target = magenta [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient [NEEDSTART]
-Agent: nfsclient.sh
-Attributes:
-  name = red [ primary unique ]
-  target = red [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsexport
-Agent: nfsexport.sh
-Attributes:
-  name = Dummy Export [ primary ]
-  device [ inherit("device") ]
-  path [ inherit("mountpoint") ]
-  fsid [ inherit("fsid") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== Old Resource Tree ===
-service {
-  name = "test1";
-  fs {
-    name = "mount1";
-    mountpoint = "/mnt/cluster";
-    device = "/dev/sdb8";
-    fstype = "ext3";
-        nfsexport {
-      name = "Dummy Export";
-      device = "/dev/sdb8";
-      path = "/mnt/cluster";
-            nfsclient {
-        name = "Admin group";
-        target = "@admin";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-      nfsclient {
-        name = "User group";
-        target = "@users";
-        path = "/mnt/cluster";
-                options = "ro";
-      }
-      nfsclient [ NEEDSTOP ] {
-        name = "red";
-        target = "red";
-        path = "/mnt/cluster";
-                options = "ro";
-      }
-    }
-  }
-  ip {
-    address = "192.168.1.3";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
-=== New Resource Tree ===
-service {
-  name = "test1";
-  fs {
-    name = "mount1";
-    mountpoint = "/mnt/cluster";
-    device = "/dev/sdb8";
-    fstype = "ext3";
-        nfsexport {
-      name = "Dummy Export";
-      device = "/dev/sdb8";
-      path = "/mnt/cluster";
-            nfsclient {
-        name = "Admin group";
-        target = "@admin";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-      nfsclient {
-        name = "User group";
-        target = "@users";
-        path = "/mnt/cluster";
-                options = "ro";
-      }
-      nfsclient [ NEEDSTART ] {
-        name = "red";
-        target = "red";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-    }
-  }
-  ip {
-    address = "192.168.1.3";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
diff --git a/rgmanager/src/daemons/tests/delta-test013-test014.expected b/rgmanager/src/daemons/tests/delta-test013-test014.expected
deleted file mode 100644
index 9e9504a..0000000
--- a/rgmanager/src/daemons/tests/delta-test013-test014.expected
+++ /dev/null
@@ -1,319 +0,0 @@
-=== Old Resource List ===
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount1 [ primary ]
-  mountpoint = /mnt/cluster [ unique required ]
-  device = /dev/sdb8 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = User group [ primary unique ]
-  target = @users [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = ro
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = Admin group [ primary unique ]
-  target = @admin [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = yellow [ primary unique ]
-  target = yellow [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = magenta [ primary unique ]
-  target = magenta [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = red [ primary unique ]
-  target = red [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsexport
-Agent: nfsexport.sh
-Attributes:
-  name = Dummy Export [ primary ]
-  device [ inherit("device") ]
-  path [ inherit("mountpoint") ]
-  fsid [ inherit("fsid") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== New Resource List ===
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount1 [ primary ]
-  mountpoint = /mnt/cluster [ unique required ]
-  device = /dev/sdb8 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: fs [NEEDSTART]
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount2 [ primary ]
-  mountpoint = /mnt/cluster2 [ unique required ]
-  device = /dev/sdb9 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: ip [NEEDSTART]
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.4 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = User group [ primary unique ]
-  target = @users [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = ro
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = Admin group [ primary unique ]
-  target = @admin [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = yellow [ primary unique ]
-  target = yellow [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = magenta [ primary unique ]
-  target = magenta [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = red [ primary unique ]
-  target = red [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsexport
-Agent: nfsexport.sh
-Attributes:
-  name = Dummy Export [ primary ]
-  device [ inherit("device") ]
-  path [ inherit("mountpoint") ]
-  fsid [ inherit("fsid") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-Resource type: service [NEEDSTART]
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test2 [ primary unique required ]
-
-=== Old Resource Tree ===
-service {
-  name = "test1";
-  fs {
-    name = "mount1";
-    mountpoint = "/mnt/cluster";
-    device = "/dev/sdb8";
-    fstype = "ext3";
-        nfsexport {
-      name = "Dummy Export";
-      device = "/dev/sdb8";
-      path = "/mnt/cluster";
-            nfsclient {
-        name = "Admin group";
-        target = "@admin";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-      nfsclient {
-        name = "User group";
-        target = "@users";
-        path = "/mnt/cluster";
-                options = "ro";
-      }
-      nfsclient {
-        name = "red";
-        target = "red";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-    }
-  }
-  ip {
-    address = "192.168.1.3";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
-=== New Resource Tree ===
-service {
-  name = "test1";
-  fs {
-    name = "mount1";
-    mountpoint = "/mnt/cluster";
-    device = "/dev/sdb8";
-    fstype = "ext3";
-        nfsexport {
-      name = "Dummy Export";
-      device = "/dev/sdb8";
-      path = "/mnt/cluster";
-            nfsclient {
-        name = "Admin group";
-        target = "@admin";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-      nfsclient {
-        name = "User group";
-        target = "@users";
-        path = "/mnt/cluster";
-                options = "ro";
-      }
-      nfsclient {
-        name = "red";
-        target = "red";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-    }
-  }
-  ip {
-    address = "192.168.1.3";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
-service [ NEEDSTART ] {
-  name = "test2";
-  fs {
-    name = "mount2";
-    mountpoint = "/mnt/cluster2";
-    device = "/dev/sdb9";
-    fstype = "ext3";
-        nfsexport {
-      name = "Dummy Export";
-      device = "/dev/sdb9";
-      path = "/mnt/cluster2";
-            nfsclient {
-        name = "Admin group";
-        target = "@admin";
-        path = "/mnt/cluster2";
-                options = "rw";
-      }
-      nfsclient {
-        name = "User group";
-        target = "@users";
-        path = "/mnt/cluster2";
-                options = "ro";
-      }
-      nfsclient {
-        name = "red";
-        target = "red";
-        path = "/mnt/cluster2";
-                options = "rw";
-      }
-    }
-  }
-  ip {
-    address = "192.168.1.4";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test2";
-  }
-}
diff --git a/rgmanager/src/daemons/tests/delta-test014-test015.expected b/rgmanager/src/daemons/tests/delta-test014-test015.expected
deleted file mode 100644
index 931d4a4..0000000
--- a/rgmanager/src/daemons/tests/delta-test014-test015.expected
+++ /dev/null
@@ -1,384 +0,0 @@
-=== Old Resource List ===
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount1 [ primary ]
-  mountpoint = /mnt/cluster [ unique required ]
-  device = /dev/sdb8 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount2 [ primary ]
-  mountpoint = /mnt/cluster2 [ unique required ]
-  device = /dev/sdb9 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.4 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: nfsclient [NEEDSTOP]
-Agent: nfsclient.sh
-Attributes:
-  name = User group [ primary unique ]
-  target = @users [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = ro
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = Admin group [ primary unique ]
-  target = @admin [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = yellow [ primary unique ]
-  target = yellow [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = magenta [ primary unique ]
-  target = magenta [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = red [ primary unique ]
-  target = red [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsexport
-Agent: nfsexport.sh
-Attributes:
-  name = Dummy Export [ primary ]
-  device [ inherit("device") ]
-  path [ inherit("mountpoint") ]
-  fsid [ inherit("fsid") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test2 [ primary unique required ]
-
-=== New Resource List ===
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount1 [ primary ]
-  mountpoint = /mnt/cluster [ unique required ]
-  device = /dev/sdb8 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount2 [ primary ]
-  mountpoint = /mnt/cluster2 [ unique required ]
-  device = /dev/sdb9 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.4 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: nfsclient [NEEDSTART]
-Agent: nfsclient.sh
-Attributes:
-  name = User group [ primary unique ]
-  target = @users [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,sync
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = Admin group [ primary unique ]
-  target = @admin [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = yellow [ primary unique ]
-  target = yellow [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = magenta [ primary unique ]
-  target = magenta [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = red [ primary unique ]
-  target = red [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsexport
-Agent: nfsexport.sh
-Attributes:
-  name = Dummy Export [ primary ]
-  device [ inherit("device") ]
-  path [ inherit("mountpoint") ]
-  fsid [ inherit("fsid") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test2 [ primary unique required ]
-
-=== Old Resource Tree ===
-service {
-  name = "test1";
-  fs {
-    name = "mount1";
-    mountpoint = "/mnt/cluster";
-    device = "/dev/sdb8";
-    fstype = "ext3";
-        nfsexport {
-      name = "Dummy Export";
-      device = "/dev/sdb8";
-      path = "/mnt/cluster";
-            nfsclient {
-        name = "Admin group";
-        target = "@admin";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-      nfsclient [ NEEDSTOP ] {
-        name = "User group";
-        target = "@users";
-        path = "/mnt/cluster";
-                options = "ro";
-      }
-      nfsclient {
-        name = "red";
-        target = "red";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-    }
-  }
-  ip {
-    address = "192.168.1.3";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
-service {
-  name = "test2";
-  fs {
-    name = "mount2";
-    mountpoint = "/mnt/cluster2";
-    device = "/dev/sdb9";
-    fstype = "ext3";
-        nfsexport {
-      name = "Dummy Export";
-      device = "/dev/sdb9";
-      path = "/mnt/cluster2";
-            nfsclient {
-        name = "Admin group";
-        target = "@admin";
-        path = "/mnt/cluster2";
-                options = "rw";
-      }
-      nfsclient [ NEEDSTOP ] {
-        name = "User group";
-        target = "@users";
-        path = "/mnt/cluster2";
-                options = "ro";
-      }
-      nfsclient {
-        name = "red";
-        target = "red";
-        path = "/mnt/cluster2";
-                options = "rw";
-      }
-    }
-  }
-  ip {
-    address = "192.168.1.4";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test2";
-  }
-}
-=== New Resource Tree ===
-service {
-  name = "test1";
-  fs {
-    name = "mount1";
-    mountpoint = "/mnt/cluster";
-    device = "/dev/sdb8";
-    fstype = "ext3";
-        nfsexport {
-      name = "Dummy Export";
-      device = "/dev/sdb8";
-      path = "/mnt/cluster";
-            nfsclient {
-        name = "Admin group";
-        target = "@admin";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-      nfsclient [ NEEDSTART ] {
-        name = "User group";
-        target = "@users";
-        path = "/mnt/cluster";
-                options = "rw,sync";
-      }
-      nfsclient {
-        name = "red";
-        target = "red";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-    }
-  }
-  ip {
-    address = "192.168.1.3";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
-service {
-  name = "test2";
-  fs {
-    name = "mount2";
-    mountpoint = "/mnt/cluster2";
-    device = "/dev/sdb9";
-    fstype = "ext3";
-        nfsexport {
-      name = "Dummy Export";
-      device = "/dev/sdb9";
-      path = "/mnt/cluster2";
-            nfsclient {
-        name = "Admin group";
-        target = "@admin";
-        path = "/mnt/cluster2";
-                options = "rw";
-      }
-      nfsclient [ NEEDSTART ] {
-        name = "User group";
-        target = "@users";
-        path = "/mnt/cluster2";
-                options = "rw,sync";
-      }
-      nfsclient {
-        name = "red";
-        target = "red";
-        path = "/mnt/cluster2";
-                options = "rw";
-      }
-    }
-  }
-  ip {
-    address = "192.168.1.4";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test2";
-  }
-}
diff --git a/rgmanager/src/daemons/tests/delta-test015-test016.expected b/rgmanager/src/daemons/tests/delta-test015-test016.expected
deleted file mode 100644
index 4239fc3..0000000
--- a/rgmanager/src/daemons/tests/delta-test015-test016.expected
+++ /dev/null
@@ -1,385 +0,0 @@
-Warning: Max references exceeded for resource address (type ip)
-=== Old Resource List ===
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount1 [ primary ]
-  mountpoint = /mnt/cluster [ unique required ]
-  device = /dev/sdb8 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount2 [ primary ]
-  mountpoint = /mnt/cluster2 [ unique required ]
-  device = /dev/sdb9 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.4 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = User group [ primary unique ]
-  target = @users [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,sync
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = Admin group [ primary unique ]
-  target = @admin [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = yellow [ primary unique ]
-  target = yellow [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = magenta [ primary unique ]
-  target = magenta [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = red [ primary unique ]
-  target = red [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsexport
-Agent: nfsexport.sh
-Attributes:
-  name = Dummy Export [ primary ]
-  device [ inherit("device") ]
-  path [ inherit("mountpoint") ]
-  fsid [ inherit("fsid") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test2 [ primary unique required ]
-
-=== New Resource List ===
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount1 [ primary ]
-  mountpoint = /mnt/cluster [ unique required ]
-  device = /dev/sdb8 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount2 [ primary ]
-  mountpoint = /mnt/cluster2 [ unique required ]
-  device = /dev/sdb9 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.4 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = User group [ primary unique ]
-  target = @users [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,sync
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = Admin group [ primary unique ]
-  target = @admin [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = yellow [ primary unique ]
-  target = yellow [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = magenta [ primary unique ]
-  target = magenta [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = red [ primary unique ]
-  target = red [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsexport
-Agent: nfsexport.sh
-Attributes:
-  name = Dummy Export [ primary ]
-  device [ inherit("device") ]
-  path [ inherit("mountpoint") ]
-  fsid [ inherit("fsid") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test2 [ primary unique required ]
-
-=== Old Resource Tree ===
-service {
-  name = "test1";
-  fs {
-    name = "mount1";
-    mountpoint = "/mnt/cluster";
-    device = "/dev/sdb8";
-    fstype = "ext3";
-        nfsexport {
-      name = "Dummy Export";
-      device = "/dev/sdb8";
-      path = "/mnt/cluster";
-            nfsclient {
-        name = "Admin group";
-        target = "@admin";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-      nfsclient {
-        name = "User group";
-        target = "@users";
-        path = "/mnt/cluster";
-                options = "rw,sync";
-      }
-      nfsclient {
-        name = "red";
-        target = "red";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-    }
-  }
-  ip {
-    address = "192.168.1.3";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
-service {
-  name = "test2";
-  fs {
-    name = "mount2";
-    mountpoint = "/mnt/cluster2";
-    device = "/dev/sdb9";
-    fstype = "ext3";
-        nfsexport {
-      name = "Dummy Export";
-      device = "/dev/sdb9";
-      path = "/mnt/cluster2";
-            nfsclient {
-        name = "Admin group";
-        target = "@admin";
-        path = "/mnt/cluster2";
-                options = "rw";
-      }
-      nfsclient {
-        name = "User group";
-        target = "@users";
-        path = "/mnt/cluster2";
-                options = "rw,sync";
-      }
-      nfsclient {
-        name = "red";
-        target = "red";
-        path = "/mnt/cluster2";
-                options = "rw";
-      }
-    }
-  }
-  ip {
-    address = "192.168.1.4";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test2";
-  }
-}
-=== New Resource Tree ===
-service {
-  name = "test1";
-  fs {
-    name = "mount1";
-    mountpoint = "/mnt/cluster";
-    device = "/dev/sdb8";
-    fstype = "ext3";
-        nfsexport {
-      name = "Dummy Export";
-      device = "/dev/sdb8";
-      path = "/mnt/cluster";
-            nfsclient {
-        name = "Admin group";
-        target = "@admin";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-      nfsclient {
-        name = "User group";
-        target = "@users";
-        path = "/mnt/cluster";
-                options = "rw,sync";
-      }
-      nfsclient {
-        name = "red";
-        target = "red";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-    }
-  }
-  ip {
-    address = "192.168.1.3";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
-service {
-  name = "test2";
-  fs {
-    name = "mount2";
-    mountpoint = "/mnt/cluster2";
-    device = "/dev/sdb9";
-    fstype = "ext3";
-        nfsexport {
-      name = "Dummy Export";
-      device = "/dev/sdb9";
-      path = "/mnt/cluster2";
-            nfsclient {
-        name = "Admin group";
-        target = "@admin";
-        path = "/mnt/cluster2";
-                options = "rw";
-      }
-      nfsclient {
-        name = "User group";
-        target = "@users";
-        path = "/mnt/cluster2";
-                options = "rw,sync";
-      }
-      nfsclient {
-        name = "red";
-        target = "red";
-        path = "/mnt/cluster2";
-                options = "rw";
-      }
-    }
-  }
-  ip {
-    address = "192.168.1.4";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test2";
-  }
-}
diff --git a/rgmanager/src/daemons/tests/delta-test016-test017.expected b/rgmanager/src/daemons/tests/delta-test016-test017.expected
deleted file mode 100644
index 06abbff..0000000
--- a/rgmanager/src/daemons/tests/delta-test016-test017.expected
+++ /dev/null
@@ -1,408 +0,0 @@
-Warning: Max references exceeded for resource address (type ip)
-=== Old Resource List ===
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount1 [ primary ]
-  mountpoint = /mnt/cluster [ unique required ]
-  device = /dev/sdb8 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount2 [ primary ]
-  mountpoint = /mnt/cluster2 [ unique required ]
-  device = /dev/sdb9 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.4 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = User group [ primary unique ]
-  target = @users [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,sync
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = Admin group [ primary unique ]
-  target = @admin [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = yellow [ primary unique ]
-  target = yellow [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = magenta [ primary unique ]
-  target = magenta [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = red [ primary unique ]
-  target = red [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsexport
-Agent: nfsexport.sh
-Attributes:
-  name = Dummy Export [ primary ]
-  device [ inherit("device") ]
-  path [ inherit("mountpoint") ]
-  fsid [ inherit("fsid") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test2 [ primary unique required ]
-
-=== New Resource List ===
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount1 [ primary ]
-  mountpoint = /mnt/cluster [ unique required ]
-  device = /dev/sdb8 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount2 [ primary ]
-  mountpoint = /mnt/cluster2 [ unique required ]
-  device = /dev/sdb9 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.4 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = User group [ primary unique ]
-  target = @users [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,sync
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = Admin group [ primary unique ]
-  target = @admin [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = yellow [ primary unique ]
-  target = yellow [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = magenta [ primary unique ]
-  target = magenta [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = red [ primary unique ]
-  target = red [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsexport
-Agent: nfsexport.sh
-Attributes:
-  name = Dummy Export [ primary ]
-  device [ inherit("device") ]
-  path [ inherit("mountpoint") ]
-  fsid [ inherit("fsid") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: script [NEEDSTART]
-Agent: script.sh
-Attributes:
-  name = script2 [ primary unique ]
-  file = /etc/init.d/script2 [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: script [NEEDSTART]
-Agent: script.sh
-Attributes:
-  name = script3 [ primary unique ]
-  file = /etc/init.d/script3 [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test2 [ primary unique required ]
-
-=== Old Resource Tree ===
-service {
-  name = "test1";
-  fs {
-    name = "mount1";
-    mountpoint = "/mnt/cluster";
-    device = "/dev/sdb8";
-    fstype = "ext3";
-        nfsexport {
-      name = "Dummy Export";
-      device = "/dev/sdb8";
-      path = "/mnt/cluster";
-            nfsclient {
-        name = "Admin group";
-        target = "@admin";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-      nfsclient {
-        name = "User group";
-        target = "@users";
-        path = "/mnt/cluster";
-                options = "rw,sync";
-      }
-      nfsclient {
-        name = "red";
-        target = "red";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-    }
-  }
-  ip [ NEEDSTOP ] {
-    address = "192.168.1.3";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
-service {
-  name = "test2";
-  fs [ NEEDSTOP ] {
-    name = "mount2";
-    mountpoint = "/mnt/cluster2";
-    device = "/dev/sdb9";
-    fstype = "ext3";
-        nfsexport {
-      name = "Dummy Export";
-      device = "/dev/sdb9";
-      path = "/mnt/cluster2";
-            nfsclient {
-        name = "Admin group";
-        target = "@admin";
-        path = "/mnt/cluster2";
-                options = "rw";
-      }
-      nfsclient {
-        name = "User group";
-        target = "@users";
-        path = "/mnt/cluster2";
-                options = "rw,sync";
-      }
-      nfsclient {
-        name = "red";
-        target = "red";
-        path = "/mnt/cluster2";
-                options = "rw";
-      }
-    }
-  }
-  ip [ NEEDSTOP ] {
-    address = "192.168.1.4";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test2";
-  }
-}
-=== New Resource Tree ===
-service {
-  name = "test1";
-  fs {
-    name = "mount1";
-    mountpoint = "/mnt/cluster";
-    device = "/dev/sdb8";
-    fstype = "ext3";
-        nfsexport {
-      name = "Dummy Export";
-      device = "/dev/sdb8";
-      path = "/mnt/cluster";
-            nfsclient {
-        name = "Admin group";
-        target = "@admin";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-      nfsclient {
-        name = "User group";
-        target = "@users";
-        path = "/mnt/cluster";
-                options = "rw,sync";
-      }
-      nfsclient {
-        name = "red";
-        target = "red";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-    }
-  }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
-service {
-  name = "test2";
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test2";
-    ip [ NEEDSTART ] {
-      address = "192.168.1.3";
-      monitor_link = "yes";
-          }
-    fs [ NEEDSTART ] {
-      name = "mount2";
-      mountpoint = "/mnt/cluster2";
-      device = "/dev/sdb9";
-      fstype = "ext3";
-            nfsexport {
-        name = "Dummy Export";
-        device = "/dev/sdb9";
-        path = "/mnt/cluster2";
-                nfsclient {
-          name = "Admin group";
-          target = "@admin";
-          path = "/mnt/cluster2";
-                    options = "rw";
-        }
-        nfsclient {
-          name = "User group";
-          target = "@users";
-          path = "/mnt/cluster2";
-                    options = "rw,sync";
-        }
-        nfsclient {
-          name = "red";
-          target = "red";
-          path = "/mnt/cluster2";
-                    options = "rw";
-        }
-      }
-    }
-    script [ NEEDSTART ] {
-      name = "script2";
-      file = "/etc/init.d/script2";
-          }
-    ip [ NEEDSTART ] {
-      address = "192.168.1.4";
-      monitor_link = "yes";
-          }
-  }
-  script [ NEEDSTART ] {
-    name = "script3";
-    file = "/etc/init.d/script3";
-    service_name = "test2";
-  }
-}
diff --git a/rgmanager/src/daemons/tests/deptest1.conf b/rgmanager/src/daemons/tests/deptest1.conf
deleted file mode 100644
index c520134..0000000
--- a/rgmanager/src/daemons/tests/deptest1.conf
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0"?>
-<!--
-  Basic "whiteboard" case:
-
-  * 4 nodes
-  * 2 restricted failover domains:
-    * A is allowed to run on {1 4}
-    * B is allowed to run on {3 4}
-  * 3 services
-    * A requires B to operate
-    * B requires C to operate
-    * A must NEVER run on the same node as B.
-
-  Setup:
-  * Start service C on node 2
-  * Start service B on node 4
-  * Start service A on node 1
-  * Nothing is running on node 3
-
-  Introduce a failure:
-  * Kill off node 1
-
-  Solution:
-  * A must be moved to the stopped state (its owner is dead)
-  * B must be stopped on node 4, and started on node 3
-  * A must be started on node 4, since that is the only legal target
-    of service A
-
-  try: ../dtest ../../resources deptest1.conf < deptest1.in
--->
-<cluster>
-	<clusternodes>
-		<clusternode name="node1" nodeid="1"/>
-		<clusternode name="node2" nodeid="2"/>
-		<clusternode name="node3" nodeid="3"/>
-		<clusternode name="node4" nodeid="4"/>
-	</clusternodes>
-	<rm>
-		<dependencies>
-			<dependency name="service:a">
-				<target name="service:b" require="always" colocate="never"/>
-			</dependency>
-			<dependency name="service:b">
-				<target name="service:c" require="always" />
-			</dependency>
-		</dependencies>
-		<failoverdomains>
-			<failoverdomain name="nodes-14" restricted="1">
-				<failoverdomainnode name="node1" priority="1"/>
-				<failoverdomainnode name="node4" priority="1"/>
-			</failoverdomain>
-			<failoverdomain name="nodes-34" restricted="1">
-				<failoverdomainnode name="node3" priority="1"/>
-				<failoverdomainnode name="node4" priority="1"/>
-			</failoverdomain>
-		</failoverdomains>
-		<resources/>
-		<service name="a" domain="nodes-14" />
-		<service name="b" domain="nodes-34" />
-		<service name="c" />
-	</rm>
-	<fence_daemon post_fail_delay="0" post_join_delay="3"/>
-</cluster>
diff --git a/rgmanager/src/daemons/tests/deptest1.in b/rgmanager/src/daemons/tests/deptest1.in
deleted file mode 100644
index b10bd44..0000000
--- a/rgmanager/src/daemons/tests/deptest1.in
+++ /dev/null
@@ -1,11 +0,0 @@
-dep
-online 1 2 3 4
-start a 1
-start c 2
-start b 4
-state
-online 2 3 4
-check
-calc
-apply
-state
diff --git a/rgmanager/src/daemons/tests/deptest2.conf b/rgmanager/src/daemons/tests/deptest2.conf
deleted file mode 100644
index 7ce7c82..0000000
--- a/rgmanager/src/daemons/tests/deptest2.conf
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0"?>
-<!--
-
-  * 4 nodes
-  * 3 services
-    * A requires colocation with B to operate
-    * C requires colocation with B to operate
-
-  Setup:
-  * Start service B on node 1
-  * Start service A on node 1
-  * Start service C on node 1
-
-  Introduce a failure:
-  * Stop service B
-
-  Solution:
-  * Stop A (or C)
-  * Stop C (or A)
-  * Stop B
-  * start B
-  * start A (or C)
-  * start C (or A)
-
-  try: ../dtest ../../resources deptest2.conf < deptest2.in
--->
-<cluster>
-	<clusternodes>
-		<clusternode name="node1" nodeid="1"/>
-		<clusternode name="node2" nodeid="2"/>
-		<clusternode name="node3" nodeid="3"/>
-		<clusternode name="node4" nodeid="4"/>
-	</clusternodes>
-	<rm>
-		<dependencies>
-			<dependency name="service:a">
-				<target name="service:b" require="always" colocate="always"/>
-			</dependency>
-			<dependency name="service:c">
-				<target name="service:b" require="always" colocate="always" />
-			</dependency>
-		</dependencies>
-		<failoverdomains>
-		</failoverdomains>
-		<resources/>
-		<service name="a" />
-		<service name="b" />
-		<service name="c" />
-	</rm>
-</cluster>
diff --git a/rgmanager/src/daemons/tests/deptest2.in b/rgmanager/src/daemons/tests/deptest2.in
deleted file mode 100644
index cb5e12c..0000000
--- a/rgmanager/src/daemons/tests/deptest2.in
+++ /dev/null
@@ -1,11 +0,0 @@
-dep
-online 1 2 3 4
-start b 1
-start a 1 
-start c 1
-state
-check
-stop b
-calc
-apply
-state
diff --git a/rgmanager/src/daemons/tests/gentests.sh b/rgmanager/src/daemons/tests/gentests.sh
deleted file mode 100644
index e55bbbc..0000000
--- a/rgmanager/src/daemons/tests/gentests.sh
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/bin/sh
-
-LANG=C
-LC_ALL=C
-LOCALE=C
-export LANG LC_ALL LOCALE
-
-. testlist
-
-echo "WARNING:"
-echo "  You will need to MANUALLY verify these test cases after generation!"
-echo "  Do NOT commit them to CVS without first hand-checking each and"
-echo "  every one!  These are meant to help determine possible regressions"
-echo "  in the tree handling code and the resource code."
-echo ""
-
-echo -n "Are you sure [y/N] ?"
-read foo
-if [ "$foo" != "y" ]; then
-	echo "Ok, aborting..."
-	exit 0
-fi
-
-#
-# Basic config tests.
-#
-for t in $TESTS; do
-	echo -n "Generating $t..."
-	../rg_test ../../resources test $t.conf > $t.expected 2> /dev/null
-	if grep "Error" $t.expected; then
-		echo "FAILED"
-		exit 1
-	fi
-	echo OK
-done
-
-
-#
-# Start/stop tests (noop)
-#
-for t in $TESTS; do
-	declare SERVICES=$(echo "xpath /cluster/rm/service" | xmllint $t.conf --shell | grep content | cut -f2 -d'=')
-	declare phase svc
-	echo -n "Generating $t exec..."
-	for phase in start stop; do
-		echo -n "$phase..."
-		rm -f $t.$phase.expected
-		for svc in $SERVICES; do
-			../rg_test ../../resources noop $t.conf $phase service $svc >> $t.$phase.expected 2> /dev/null
-		done
-	done
-	echo "OK"
-done
-
-
-#
-# Delta tests
-#
-prev=
-for t in $TESTS; do
-	if [ -z "$prev" ]; then
-		prev=$t
-		continue
-	fi
-	echo -n "Generating delta between $prev and $t..."
-	../rg_test ../../resources delta \
-		$prev.conf $t.conf > delta-$prev-$t.expected 2> /dev/null
-	if grep "Error" delta-$prev-$t.expected; then
-		echo "FAILED"
-		exit 1
-	fi
-	prev=$t
-	echo OK
-done
diff --git a/rgmanager/src/daemons/tests/runtests.sh b/rgmanager/src/daemons/tests/runtests.sh
deleted file mode 100644
index 4da6bbb..0000000
--- a/rgmanager/src/daemons/tests/runtests.sh
+++ /dev/null
@@ -1,122 +0,0 @@
-#!/bin/sh
-#
-# Super primitive sanity check test program.  If the output format of
-# any of the trees/lists changes, the tests will need to be regenerated
-# and manually checked.
-#
-# Poor design, but it does effectively detect memory leaks. (when linked
-# against the alloc.c in ../../clulib)
-#
-
-LANG=C
-LC_ALL=C
-LOCALE=C
-export LANG LC_ALL LOCALE
-
-. ./testlist
-
-echo "Running sanity+memory leak checks on rgmanager tree operations..."
-
-#
-# Basic config tests.
-#
-for t in $TESTS; do
-	echo -n "  Checking $t.conf..."
-	../rg_test ../../resources test $t.conf > $t.out 2> $t.out.stderr
-	diff -uw $t.expected $t.out
-	if [ $? -ne 0 ]; then
-		echo "FAILED"
-		echo "*** Basic Test $t failed"
-		echo -n "Accept new output [y/N] ? "
-		read ovr
-		if [ "$ovr" = "y" ]; then
-			cp $t.out $t.expected
-		else 
-			exit 1
-		fi
-	fi
-	if grep -q "allocation trace" $t.out.stderr; then
-		echo "FAILED - memory leak"
-		echo "*** Memory Test $t failed"
-		echo
-		echo Output:
-		echo
-		cat $t.out.stderr
-		exit 1
-	fi
-	rm -f $t.out $t.out.stderr
-	echo OK
-done
-
-
-#
-# Start/stop tests (noop)
-#
-for t in $TESTS; do
-	declare SERVICES=$(echo "xpath /cluster/rm/service" | xmllint $t.conf --shell | grep content | cut -f2 -d'=')
-	declare phase svc
-	echo -n "  Checking $t.conf..."
-	for phase in start stop; do
-		echo -n "$phase..."
-		rm -f $t.$phase.out
-		for svc in $SERVICES; do
-			../rg_test ../../resources noop $t.conf $phase service $svc >> $t.$phase.out 2> $t.$phase.out.stderr
-		done
-		diff -w $t.$phase.expected $t.$phase.out
-		if [ $? -ne 0 ]; then
-			echo "FAILED"
-			echo "*** Start Test $t failed"
-			exit 1
-		fi
-		if grep -q "allocation trace" $t.$phase.out.stderr; then
-			echo "FAILED - memory leak"
-			echo "*** Memory Test $t failed"
-			echo
-			echo Output:
-			echo
-			cat $t.$phase.out.stderr
-			exit 1
-		fi
-		rm -f $t.$phase.out $t.$phase.out.stderr
-	done
-	echo "OK"
-done
-
-
-#
-# Delta tests
-#
-prev=
-for t in $TESTS; do
-	if [ -z "$prev" ]; then
-		prev=$t
-		continue
-	fi
-	echo -n "  Checking delta between $prev and $t..."
-	../rg_test ../../resources delta \
-		$prev.conf $t.conf > delta-$prev-$t.out 2> delta-$prev-$t.out.stderr
-	diff -uw delta-$prev-$t.expected delta-$prev-$t.out 
-	if [ $? -ne 0 ]; then
-		echo "FAILED"
-		echo "*** Differential test between $prev and $t failed"
-		echo -n "Accept new output [y/N] ? "
-		read ovr
-		if [ "$ovr" = "y" ]; then
-			cp delta-$prev-$t.out delta-$prev-$t.expected
-		else 
-			exit 1
-		fi
-	fi
-	if grep -q "allocation trace" delta-$prev-$t.out.stderr; then
-		echo "FAILED - memory leak"
-		echo "*** Memory Test $t failed"
-		echo
-		echo Output:
-		echo
-		cat delta-$prev-$t.out.stderr
-		exit 1
-	fi
-	rm -f delta-$prev-$t.out delta-$prev-$t.out.stderr
-	prev=$t
-	echo OK
-done
diff --git a/rgmanager/src/daemons/tests/test001.conf b/rgmanager/src/daemons/tests/test001.conf
deleted file mode 100644
index b95ba86..0000000
--- a/rgmanager/src/daemons/tests/test001.conf
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0"?>
-<!-- inline resource group -->
-<cluster>
-<rm>
-	<service name="test1"/>
-</rm>
-</cluster>
diff --git a/rgmanager/src/daemons/tests/test001.expected b/rgmanager/src/daemons/tests/test001.expected
deleted file mode 100644
index a291576..0000000
--- a/rgmanager/src/daemons/tests/test001.expected
+++ /dev/null
@@ -1,11 +0,0 @@
-=== Resources List ===
-Resource type: service [INLINE]
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== Resource Tree ===
-service {
-  name = "test1";
-}
diff --git a/rgmanager/src/daemons/tests/test001.start.expected b/rgmanager/src/daemons/tests/test001.start.expected
deleted file mode 100644
index 9b991d7..0000000
--- a/rgmanager/src/daemons/tests/test001.start.expected
+++ /dev/null
@@ -1,3 +0,0 @@
-Starting test1...
-[start] service:test1
-Start of test1 complete
diff --git a/rgmanager/src/daemons/tests/test001.stop.expected b/rgmanager/src/daemons/tests/test001.stop.expected
deleted file mode 100644
index 993cf06..0000000
--- a/rgmanager/src/daemons/tests/test001.stop.expected
+++ /dev/null
@@ -1,3 +0,0 @@
-Stopping test1...
-[stop] service:test1
-Stop of test1 complete
diff --git a/rgmanager/src/daemons/tests/test002.conf b/rgmanager/src/daemons/tests/test002.conf
deleted file mode 100644
index 2782312..0000000
--- a/rgmanager/src/daemons/tests/test002.conf
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0"?>
-<!-- normal resource group -->
-<!-- If compared with the inline resource group in test1,
-     this should not make this resource group restart since no
-     attributes have changed. -->
-<cluster>
-<rm>
-	<resources>
-    		<service name="test1"/>
-	</resources>
-	<service ref="test1"/>
-</rm>
-</cluster>
diff --git a/rgmanager/src/daemons/tests/test002.expected b/rgmanager/src/daemons/tests/test002.expected
deleted file mode 100644
index 5bf60f7..0000000
--- a/rgmanager/src/daemons/tests/test002.expected
+++ /dev/null
@@ -1,11 +0,0 @@
-=== Resources List ===
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== Resource Tree ===
-service {
-  name = "test1";
-}
diff --git a/rgmanager/src/daemons/tests/test002.start.expected b/rgmanager/src/daemons/tests/test002.start.expected
deleted file mode 100644
index 9b991d7..0000000
--- a/rgmanager/src/daemons/tests/test002.start.expected
+++ /dev/null
@@ -1,3 +0,0 @@
-Starting test1...
-[start] service:test1
-Start of test1 complete
diff --git a/rgmanager/src/daemons/tests/test002.stop.expected b/rgmanager/src/daemons/tests/test002.stop.expected
deleted file mode 100644
index 993cf06..0000000
--- a/rgmanager/src/daemons/tests/test002.stop.expected
+++ /dev/null
@@ -1,3 +0,0 @@
-Stopping test1...
-[stop] service:test1
-Stop of test1 complete
diff --git a/rgmanager/src/daemons/tests/test003.conf b/rgmanager/src/daemons/tests/test003.conf
deleted file mode 100644
index 9514516..0000000
--- a/rgmanager/src/daemons/tests/test003.conf
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0"?>
-<!-- Add an initscript to our regular resource group.
-     The initscript should get a 'NEEDSTART' flag. -->
-<cluster>
-<rm>
-	<resources>
-    		<service name="test1"/>
-		<script name="initscript" file="/etc/init.d/httpd"/>
-	</resources>
-	<service ref="test1">
-		<script ref="initscript"/>
-	</service>
-</rm>
-</cluster>
diff --git a/rgmanager/src/daemons/tests/test003.expected b/rgmanager/src/daemons/tests/test003.expected
deleted file mode 100644
index 1681209..0000000
--- a/rgmanager/src/daemons/tests/test003.expected
+++ /dev/null
@@ -1,23 +0,0 @@
-=== Resources List ===
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/httpd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== Resource Tree ===
-service {
-  name = "test1";
-  script {
-    name = "initscript";
-    file = "/etc/init.d/httpd";
-    service_name = "test1";
-  }
-}
diff --git a/rgmanager/src/daemons/tests/test003.start.expected b/rgmanager/src/daemons/tests/test003.start.expected
deleted file mode 100644
index fd37d3a..0000000
--- a/rgmanager/src/daemons/tests/test003.start.expected
+++ /dev/null
@@ -1,4 +0,0 @@
-Starting test1...
-[start] service:test1
-[start] script:initscript
-Start of test1 complete
diff --git a/rgmanager/src/daemons/tests/test003.stop.expected b/rgmanager/src/daemons/tests/test003.stop.expected
deleted file mode 100644
index bdbee27..0000000
--- a/rgmanager/src/daemons/tests/test003.stop.expected
+++ /dev/null
@@ -1,4 +0,0 @@
-Stopping test1...
-[stop] script:initscript
-[stop] service:test1
-Stop of test1 complete
diff --git a/rgmanager/src/daemons/tests/test004.conf b/rgmanager/src/daemons/tests/test004.conf
deleted file mode 100644
index c71fe0b..0000000
--- a/rgmanager/src/daemons/tests/test004.conf
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0"?>
-<!-- Change the script, keeping the reference the same.
-     the test3 (old) tree should note NEEDSTOP while the new
-     tree should note NEEDSTART for the script resource -->
-<cluster>
-<rm>
-	<resources>
-    		<service name="test1"/>
-		<script name="initscript" file="/etc/init.d/sshd"/>
-	</resources>
-	<service ref="test1">
-		<script ref="initscript"/>
-	</service>
-</rm>
-</cluster>
diff --git a/rgmanager/src/daemons/tests/test004.expected b/rgmanager/src/daemons/tests/test004.expected
deleted file mode 100644
index 640b367..0000000
--- a/rgmanager/src/daemons/tests/test004.expected
+++ /dev/null
@@ -1,23 +0,0 @@
-=== Resources List ===
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== Resource Tree ===
-service {
-  name = "test1";
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
diff --git a/rgmanager/src/daemons/tests/test004.start.expected b/rgmanager/src/daemons/tests/test004.start.expected
deleted file mode 100644
index fd37d3a..0000000
--- a/rgmanager/src/daemons/tests/test004.start.expected
+++ /dev/null
@@ -1,4 +0,0 @@
-Starting test1...
-[start] service:test1
-[start] script:initscript
-Start of test1 complete
diff --git a/rgmanager/src/daemons/tests/test004.stop.expected b/rgmanager/src/daemons/tests/test004.stop.expected
deleted file mode 100644
index bdbee27..0000000
--- a/rgmanager/src/daemons/tests/test004.stop.expected
+++ /dev/null
@@ -1,4 +0,0 @@
-Stopping test1...
-[stop] script:initscript
-[stop] service:test1
-Stop of test1 complete
diff --git a/rgmanager/src/daemons/tests/test005.conf b/rgmanager/src/daemons/tests/test005.conf
deleted file mode 100644
index bce3070..0000000
--- a/rgmanager/src/daemons/tests/test005.conf
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0"?>
-<!-- Add an IP address.  The new tree should note NEEDSTART for this
-     new IP address, but nothing else.  -->
-<cluster>
-<rm>
-	<resources>
-    		<service name="test1"/>
-		<script name="initscript" file="/etc/init.d/sshd"/>
-		<ip address="192.168.1.2"/>
-	</resources>
-	<service ref="test1">
-		<ip ref="192.168.1.2"/>
-		<script ref="initscript"/>
-	</service>
-</rm>
-</cluster>
diff --git a/rgmanager/src/daemons/tests/test005.expected b/rgmanager/src/daemons/tests/test005.expected
deleted file mode 100644
index 6a26533..0000000
--- a/rgmanager/src/daemons/tests/test005.expected
+++ /dev/null
@@ -1,35 +0,0 @@
-=== Resources List ===
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.2 [ primary unique ]
-  monitor_link = 1
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== Resource Tree ===
-service {
-  name = "test1";
-  ip {
-    address = "192.168.1.2";
-    monitor_link = "1";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
diff --git a/rgmanager/src/daemons/tests/test005.start.expected b/rgmanager/src/daemons/tests/test005.start.expected
deleted file mode 100644
index 8d18f77..0000000
--- a/rgmanager/src/daemons/tests/test005.start.expected
+++ /dev/null
@@ -1,5 +0,0 @@
-Starting test1...
-[start] service:test1
-[start] ip:192.168.1.2
-[start] script:initscript
-Start of test1 complete
diff --git a/rgmanager/src/daemons/tests/test005.stop.expected b/rgmanager/src/daemons/tests/test005.stop.expected
deleted file mode 100644
index 7f6cabc..0000000
--- a/rgmanager/src/daemons/tests/test005.stop.expected
+++ /dev/null
@@ -1,5 +0,0 @@
-Stopping test1...
-[stop] script:initscript
-[stop] ip:192.168.1.2
-[stop] service:test1
-Stop of test1 complete
diff --git a/rgmanager/src/daemons/tests/test006.conf b/rgmanager/src/daemons/tests/test006.conf
deleted file mode 100644
index 1383a9a..0000000
--- a/rgmanager/src/daemons/tests/test006.conf
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0"?>
-<!-- The IP address should have a NEEDSTOP in the old tree and NEEDSTART
-     in the new tree, -->
-<cluster>
-<rm>
-	<resources>
-    		<service name="test1"/>
-		<script name="initscript" file="/etc/init.d/sshd"/>
-		<ip address="192.168.1.2" monitor_link="yes"/>
-	</resources>
-	<service ref="test1">
-		<ip ref="192.168.1.2"/>
-		<script ref="initscript"/>
-	</service>
-</rm>
-</cluster>
diff --git a/rgmanager/src/daemons/tests/test006.expected b/rgmanager/src/daemons/tests/test006.expected
deleted file mode 100644
index eba3ea9..0000000
--- a/rgmanager/src/daemons/tests/test006.expected
+++ /dev/null
@@ -1,35 +0,0 @@
-=== Resources List ===
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.2 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== Resource Tree ===
-service {
-  name = "test1";
-  ip {
-    address = "192.168.1.2";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
diff --git a/rgmanager/src/daemons/tests/test006.start.expected b/rgmanager/src/daemons/tests/test006.start.expected
deleted file mode 100644
index 8d18f77..0000000
--- a/rgmanager/src/daemons/tests/test006.start.expected
+++ /dev/null
@@ -1,5 +0,0 @@
-Starting test1...
-[start] service:test1
-[start] ip:192.168.1.2
-[start] script:initscript
-Start of test1 complete
diff --git a/rgmanager/src/daemons/tests/test006.stop.expected b/rgmanager/src/daemons/tests/test006.stop.expected
deleted file mode 100644
index 7f6cabc..0000000
--- a/rgmanager/src/daemons/tests/test006.stop.expected
+++ /dev/null
@@ -1,5 +0,0 @@
-Stopping test1...
-[stop] script:initscript
-[stop] ip:192.168.1.2
-[stop] service:test1
-Stop of test1 complete
diff --git a/rgmanager/src/daemons/tests/test007.conf b/rgmanager/src/daemons/tests/test007.conf
deleted file mode 100644
index 6122c2f..0000000
--- a/rgmanager/src/daemons/tests/test007.conf
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0"?>
-<!-- When comapred with test6, the old IP address (192.168.1.2) should
-     have a NEEDSTOP while the new IP address should have a NEEDSTART
-     flag -->
-<cluster>
-<rm>
-	<resources>
-    		<service name="test1"/>
-		<script name="initscript" file="/etc/init.d/sshd"/>
-		<ip address="192.168.1.3" monitor_link="yes"/>
-	</resources>
-	<service ref="test1">
-		<ip ref="192.168.1.3"/>
-		<script ref="initscript"/>
-	</service>
-</rm>
-</cluster>
diff --git a/rgmanager/src/daemons/tests/test007.expected b/rgmanager/src/daemons/tests/test007.expected
deleted file mode 100644
index 394a01b..0000000
--- a/rgmanager/src/daemons/tests/test007.expected
+++ /dev/null
@@ -1,35 +0,0 @@
-=== Resources List ===
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== Resource Tree ===
-service {
-  name = "test1";
-  ip {
-    address = "192.168.1.3";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
diff --git a/rgmanager/src/daemons/tests/test007.start.expected b/rgmanager/src/daemons/tests/test007.start.expected
deleted file mode 100644
index c30c7c2..0000000
--- a/rgmanager/src/daemons/tests/test007.start.expected
+++ /dev/null
@@ -1,5 +0,0 @@
-Starting test1...
-[start] service:test1
-[start] ip:192.168.1.3
-[start] script:initscript
-Start of test1 complete
diff --git a/rgmanager/src/daemons/tests/test007.stop.expected b/rgmanager/src/daemons/tests/test007.stop.expected
deleted file mode 100644
index 238fab5..0000000
--- a/rgmanager/src/daemons/tests/test007.stop.expected
+++ /dev/null
@@ -1,5 +0,0 @@
-Stopping test1...
-[stop] script:initscript
-[stop] ip:192.168.1.3
-[stop] service:test1
-Stop of test1 complete
diff --git a/rgmanager/src/daemons/tests/test008.conf b/rgmanager/src/daemons/tests/test008.conf
deleted file mode 100644
index ebedd3e..0000000
--- a/rgmanager/src/daemons/tests/test008.conf
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0"?>
-<!-- When comapred with test7,
-     there should be no NEEDSTART flags in any of the output trees, because
-     although we have now defined "mount1", we have not assigned it
-     to any resource groups.  There SHOULD be a NEEDSTART in the resource
-     list, just not any of the trees. -->
-<cluster>
-<rm>
-	<resources>
-    		<service name="test1"/>
-		<script name="initscript" file="/etc/init.d/sshd"/>
-		<ip address="192.168.1.3" monitor_link="yes"/>
-    		<fs fstype="ext3" name="mount1" mountpoint="/mnt/cluster" device="/dev/sdb8"/>
-	</resources>
-	<service ref="test1">
-		<ip ref="192.168.1.3"/>
-		<script ref="initscript"/>
-	</service>
-</rm>
-</cluster>
diff --git a/rgmanager/src/daemons/tests/test008.expected b/rgmanager/src/daemons/tests/test008.expected
deleted file mode 100644
index ba618e1..0000000
--- a/rgmanager/src/daemons/tests/test008.expected
+++ /dev/null
@@ -1,45 +0,0 @@
-=== Resources List ===
-Resource type: fs
-Instances: 0/1
-Agent: fs.sh
-Attributes:
-  name = mount1 [ primary ]
-  mountpoint = /mnt/cluster [ unique required ]
-  device = /dev/sdb8 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== Resource Tree ===
-service {
-  name = "test1";
-  ip {
-    address = "192.168.1.3";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
diff --git a/rgmanager/src/daemons/tests/test008.start.expected b/rgmanager/src/daemons/tests/test008.start.expected
deleted file mode 100644
index c30c7c2..0000000
--- a/rgmanager/src/daemons/tests/test008.start.expected
+++ /dev/null
@@ -1,5 +0,0 @@
-Starting test1...
-[start] service:test1
-[start] ip:192.168.1.3
-[start] script:initscript
-Start of test1 complete
diff --git a/rgmanager/src/daemons/tests/test008.stop.expected b/rgmanager/src/daemons/tests/test008.stop.expected
deleted file mode 100644
index 238fab5..0000000
--- a/rgmanager/src/daemons/tests/test008.stop.expected
+++ /dev/null
@@ -1,5 +0,0 @@
-Stopping test1...
-[stop] script:initscript
-[stop] ip:192.168.1.3
-[stop] service:test1
-Stop of test1 complete
diff --git a/rgmanager/src/daemons/tests/test009.conf b/rgmanager/src/daemons/tests/test009.conf
deleted file mode 100644
index 00fbacd..0000000
--- a/rgmanager/src/daemons/tests/test009.conf
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0"?>
-<!-- When comapred with test8,
-     We've now bound the fs "mount1" to "test1".  There should be a 
-     NEEDSTART flag in the output of the "new" tree. -->
-<cluster>
-<rm>
-	<resources>
-    		<service name="test1"/>
-		<script name="initscript" file="/etc/init.d/sshd"/>
-		<ip address="192.168.1.3" monitor_link="yes"/>
-    		<fs fstype="ext3" name="mount1" mountpoint="/mnt/cluster" device="/dev/sdb8"/>
-	</resources>
-	<service ref="test1">
-		<ip ref="192.168.1.3"/>
-		<script ref="initscript"/>
-		<fs ref="mount1"/>
-	</service>
-</rm>
-</cluster>
diff --git a/rgmanager/src/daemons/tests/test009.expected b/rgmanager/src/daemons/tests/test009.expected
deleted file mode 100644
index 413170b..0000000
--- a/rgmanager/src/daemons/tests/test009.expected
+++ /dev/null
@@ -1,51 +0,0 @@
-=== Resources List ===
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount1 [ primary ]
-  mountpoint = /mnt/cluster [ unique required ]
-  device = /dev/sdb8 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== Resource Tree ===
-service {
-  name = "test1";
-  fs {
-    name = "mount1";
-    mountpoint = "/mnt/cluster";
-    device = "/dev/sdb8";
-    fstype = "ext3";
-      }
-  ip {
-    address = "192.168.1.3";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
diff --git a/rgmanager/src/daemons/tests/test009.start.expected b/rgmanager/src/daemons/tests/test009.start.expected
deleted file mode 100644
index 93d3e1a..0000000
--- a/rgmanager/src/daemons/tests/test009.start.expected
+++ /dev/null
@@ -1,6 +0,0 @@
-Starting test1...
-[start] service:test1
-[start] fs:mount1
-[start] ip:192.168.1.3
-[start] script:initscript
-Start of test1 complete
diff --git a/rgmanager/src/daemons/tests/test009.stop.expected b/rgmanager/src/daemons/tests/test009.stop.expected
deleted file mode 100644
index b30788f..0000000
--- a/rgmanager/src/daemons/tests/test009.stop.expected
+++ /dev/null
@@ -1,6 +0,0 @@
-Stopping test1...
-[stop] script:initscript
-[stop] ip:192.168.1.3
-[stop] fs:mount1
-[stop] service:test1
-Stop of test1 complete
diff --git a/rgmanager/src/daemons/tests/test010.conf b/rgmanager/src/daemons/tests/test010.conf
deleted file mode 100644
index c375bb4..0000000
--- a/rgmanager/src/daemons/tests/test010.conf
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0"?>
-<!-- Add NFS export to the mix.  Should have no NEEDSTOPS/NEEDSTARTS
-     in the resource tree outputs.  -->
-<cluster>
-<rm>
-	<resources>
-    		<service name="test1"/>
-		<script name="initscript" file="/etc/init.d/sshd"/>
-		<ip address="192.168.1.3" monitor_link="yes"/>
-    		<fs fstype="ext3" name="mount1" mountpoint="/mnt/cluster" device="/dev/sdb8"/>
-		<nfsexport name="Dummy Export"/>
-	</resources>
-	<service ref="test1">
-		<ip ref="192.168.1.3"/>
-		<script ref="initscript"/>
-		<fs ref="mount1"/>
-	</service>
-</rm>
-</cluster>
diff --git a/rgmanager/src/daemons/tests/test010.expected b/rgmanager/src/daemons/tests/test010.expected
deleted file mode 100644
index fe4e257..0000000
--- a/rgmanager/src/daemons/tests/test010.expected
+++ /dev/null
@@ -1,59 +0,0 @@
-=== Resources List ===
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount1 [ primary ]
-  mountpoint = /mnt/cluster [ unique required ]
-  device = /dev/sdb8 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: nfsexport
-Agent: nfsexport.sh
-Attributes:
-  name = Dummy Export [ primary ]
-  device [ inherit("device") ]
-  path [ inherit("mountpoint") ]
-  fsid [ inherit("fsid") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== Resource Tree ===
-service {
-  name = "test1";
-  fs {
-    name = "mount1";
-    mountpoint = "/mnt/cluster";
-    device = "/dev/sdb8";
-    fstype = "ext3";
-      }
-  ip {
-    address = "192.168.1.3";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
diff --git a/rgmanager/src/daemons/tests/test010.start.expected b/rgmanager/src/daemons/tests/test010.start.expected
deleted file mode 100644
index 93d3e1a..0000000
--- a/rgmanager/src/daemons/tests/test010.start.expected
+++ /dev/null
@@ -1,6 +0,0 @@
-Starting test1...
-[start] service:test1
-[start] fs:mount1
-[start] ip:192.168.1.3
-[start] script:initscript
-Start of test1 complete
diff --git a/rgmanager/src/daemons/tests/test010.stop.expected b/rgmanager/src/daemons/tests/test010.stop.expected
deleted file mode 100644
index b30788f..0000000
--- a/rgmanager/src/daemons/tests/test010.stop.expected
+++ /dev/null
@@ -1,6 +0,0 @@
-Stopping test1...
-[stop] script:initscript
-[stop] ip:192.168.1.3
-[stop] fs:mount1
-[stop] service:test1
-Stop of test1 complete
diff --git a/rgmanager/src/daemons/tests/test011.conf b/rgmanager/src/daemons/tests/test011.conf
deleted file mode 100644
index ac158ca..0000000
--- a/rgmanager/src/daemons/tests/test011.conf
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0"?>
-<!-- Add NFS clients to the mix.
-     Between test 10 and this one, there should be NEEDSTARTS in the
-     new resource tree for Dummy Export.
-
-     Because everything below an element is started if there's a NEEDSTART
-     flag (and everything below an element is stopped if there's a
-     NEEDSTOP, too), Admin group and User group will not need NEEDSTART
-     flags in the resource trees, but their output in the resource list
-     should show that they do have NEEDSTART flags.
--->
-<cluster>
-<rm>
-	<resources>
-    		<service name="test1"/>
-		<script name="initscript" file="/etc/init.d/sshd"/>
-		<ip address="192.168.1.3" monitor_link="yes"/>
-    		<fs fstype="ext3" name="mount1" mountpoint="/mnt/cluster" device="/dev/sdb8"/>
-		<nfsexport name="Dummy Export"/>
-    		<nfsclient name="User group" target="@users" options="ro"/>
-    		<nfsclient name="Admin group" target="@admin" options="rw"/>
-    		<nfsclient name="yellow" target="yellow" options="rw,no_root_squash"/>
-    		<nfsclient name="magenta" target="magenta" options="rw,no_root_squash"/>
-    		<nfsclient name="red" target="red" options="rw,no_root_squash"/>
-		
-	</resources>
-	<service ref="test1">
-		<ip ref="192.168.1.3"/>
-		<script ref="initscript"/>
-		<fs ref="mount1">
-			<nfsexport ref="Dummy Export">
-				<nfsclient ref="Admin group"/>
-				<nfsclient ref="User group"/>
-			</nfsexport>
-		</fs>
-	</service>
-</rm>
-</cluster>
diff --git a/rgmanager/src/daemons/tests/test011.expected b/rgmanager/src/daemons/tests/test011.expected
deleted file mode 100644
index 9a82f01..0000000
--- a/rgmanager/src/daemons/tests/test011.expected
+++ /dev/null
@@ -1,121 +0,0 @@
-=== Resources List ===
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount1 [ primary ]
-  mountpoint = /mnt/cluster [ unique required ]
-  device = /dev/sdb8 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = User group [ primary unique ]
-  target = @users [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = ro
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = Admin group [ primary unique ]
-  target = @admin [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = yellow [ primary unique ]
-  target = yellow [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = magenta [ primary unique ]
-  target = magenta [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = red [ primary unique ]
-  target = red [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsexport
-Agent: nfsexport.sh
-Attributes:
-  name = Dummy Export [ primary ]
-  device [ inherit("device") ]
-  path [ inherit("mountpoint") ]
-  fsid [ inherit("fsid") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== Resource Tree ===
-service {
-  name = "test1";
-  fs {
-    name = "mount1";
-    mountpoint = "/mnt/cluster";
-    device = "/dev/sdb8";
-    fstype = "ext3";
-        nfsexport {
-      name = "Dummy Export";
-      device = "/dev/sdb8";
-      path = "/mnt/cluster";
-            nfsclient {
-        name = "Admin group";
-        target = "@admin";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-      nfsclient {
-        name = "User group";
-        target = "@users";
-        path = "/mnt/cluster";
-                options = "ro";
-      }
-    }
-  }
-  ip {
-    address = "192.168.1.3";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
diff --git a/rgmanager/src/daemons/tests/test011.start.expected b/rgmanager/src/daemons/tests/test011.start.expected
deleted file mode 100644
index c75b535..0000000
--- a/rgmanager/src/daemons/tests/test011.start.expected
+++ /dev/null
@@ -1,9 +0,0 @@
-Starting test1...
-[start] service:test1
-[start] fs:mount1
-[start] nfsexport:Dummy Export
-[start] nfsclient:Admin group
-[start] nfsclient:User group
-[start] ip:192.168.1.3
-[start] script:initscript
-Start of test1 complete
diff --git a/rgmanager/src/daemons/tests/test011.stop.expected b/rgmanager/src/daemons/tests/test011.stop.expected
deleted file mode 100644
index 2962100..0000000
--- a/rgmanager/src/daemons/tests/test011.stop.expected
+++ /dev/null
@@ -1,9 +0,0 @@
-Stopping test1...
-[stop] script:initscript
-[stop] ip:192.168.1.3
-[stop] nfsclient:User group
-[stop] nfsclient:Admin group
-[stop] nfsexport:Dummy Export
-[stop] fs:mount1
-[stop] service:test1
-Stop of test1 complete
diff --git a/rgmanager/src/daemons/tests/test012.conf b/rgmanager/src/daemons/tests/test012.conf
deleted file mode 100644
index 939b455..0000000
--- a/rgmanager/src/daemons/tests/test012.conf
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0"?>
-<!--
-     NEEDSTOP in the resource list for client "red".  NEEDSTART in the
-     new resource TREE for client "red"
--->
-<cluster>
-<rm>
-	<resources>
-    		<service name="test1"/>
-		<script name="initscript" file="/etc/init.d/sshd"/>
-		<ip address="192.168.1.3" monitor_link="yes"/>
-    		<fs fstype="ext3" name="mount1" mountpoint="/mnt/cluster" device="/dev/sdb8"/>
-		<nfsexport name="Dummy Export"/>
-    		<nfsclient name="User group" target="@users" options="ro"/>
-    		<nfsclient name="Admin group" target="@admin" options="rw"/>
-    		<nfsclient name="yellow" target="yellow" options="rw,no_root_squash"/>
-    		<nfsclient name="magenta" target="magenta" options="rw,no_root_squash"/>
-    		<nfsclient name="red" target="red" options="ro"/>
-		
-	</resources>
-	<service ref="test1">
-		<ip ref="192.168.1.3"/>
-		<script ref="initscript"/>
-		<fs ref="mount1">
-			<nfsexport ref="Dummy Export">
-				<nfsclient ref="Admin group"/>
-				<nfsclient ref="User group"/>
-				<nfsclient ref="red"/>
-			</nfsexport>
-		</fs>
-	</service>
-</rm>
-</cluster>
diff --git a/rgmanager/src/daemons/tests/test012.expected b/rgmanager/src/daemons/tests/test012.expected
deleted file mode 100644
index 48bca23..0000000
--- a/rgmanager/src/daemons/tests/test012.expected
+++ /dev/null
@@ -1,127 +0,0 @@
-=== Resources List ===
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount1 [ primary ]
-  mountpoint = /mnt/cluster [ unique required ]
-  device = /dev/sdb8 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = User group [ primary unique ]
-  target = @users [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = ro
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = Admin group [ primary unique ]
-  target = @admin [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = yellow [ primary unique ]
-  target = yellow [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = magenta [ primary unique ]
-  target = magenta [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = red [ primary unique ]
-  target = red [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = ro
-
-Resource type: nfsexport
-Agent: nfsexport.sh
-Attributes:
-  name = Dummy Export [ primary ]
-  device [ inherit("device") ]
-  path [ inherit("mountpoint") ]
-  fsid [ inherit("fsid") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== Resource Tree ===
-service {
-  name = "test1";
-  fs {
-    name = "mount1";
-    mountpoint = "/mnt/cluster";
-    device = "/dev/sdb8";
-    fstype = "ext3";
-        nfsexport {
-      name = "Dummy Export";
-      device = "/dev/sdb8";
-      path = "/mnt/cluster";
-            nfsclient {
-        name = "Admin group";
-        target = "@admin";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-      nfsclient {
-        name = "User group";
-        target = "@users";
-        path = "/mnt/cluster";
-                options = "ro";
-      }
-      nfsclient {
-        name = "red";
-        target = "red";
-        path = "/mnt/cluster";
-                options = "ro";
-      }
-    }
-  }
-  ip {
-    address = "192.168.1.3";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
diff --git a/rgmanager/src/daemons/tests/test012.start.expected b/rgmanager/src/daemons/tests/test012.start.expected
deleted file mode 100644
index e7fd06f..0000000
--- a/rgmanager/src/daemons/tests/test012.start.expected
+++ /dev/null
@@ -1,10 +0,0 @@
-Starting test1...
-[start] service:test1
-[start] fs:mount1
-[start] nfsexport:Dummy Export
-[start] nfsclient:Admin group
-[start] nfsclient:User group
-[start] nfsclient:red
-[start] ip:192.168.1.3
-[start] script:initscript
-Start of test1 complete
diff --git a/rgmanager/src/daemons/tests/test012.stop.expected b/rgmanager/src/daemons/tests/test012.stop.expected
deleted file mode 100644
index 5218b3a..0000000
--- a/rgmanager/src/daemons/tests/test012.stop.expected
+++ /dev/null
@@ -1,10 +0,0 @@
-Stopping test1...
-[stop] script:initscript
-[stop] ip:192.168.1.3
-[stop] nfsclient:red
-[stop] nfsclient:User group
-[stop] nfsclient:Admin group
-[stop] nfsexport:Dummy Export
-[stop] fs:mount1
-[stop] service:test1
-Stop of test1 complete
diff --git a/rgmanager/src/daemons/tests/test013.conf b/rgmanager/src/daemons/tests/test013.conf
deleted file mode 100644
index fd62271..0000000
--- a/rgmanager/src/daemons/tests/test013.conf
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0"?>
-<!--
-     NEEDSTOP in the old resource _tree_ for client red.
-     NEEDSTART in the new resource _tree_ for client red.  We have
-     changed the options to "rw".
--->
-<cluster>
-<rm>
-	<resources>
-    		<service name="test1"/>
-		<script name="initscript" file="/etc/init.d/sshd"/>
-		<ip address="192.168.1.3" monitor_link="yes"/>
-    		<fs fstype="ext3" name="mount1" mountpoint="/mnt/cluster" device="/dev/sdb8"/>
-		<nfsexport name="Dummy Export"/>
-    		<nfsclient name="User group" target="@users" options="ro"/>
-    		<nfsclient name="Admin group" target="@admin" options="rw"/>
-    		<nfsclient name="yellow" target="yellow" options="rw,no_root_squash"/>
-    		<nfsclient name="magenta" target="magenta" options="rw,no_root_squash"/>
-    		<nfsclient name="red" target="red" options="rw"/>
-		
-	</resources>
-	<service ref="test1">
-		<ip ref="192.168.1.3"/>
-		<script ref="initscript"/>
-		<fs ref="mount1">
-			<nfsexport ref="Dummy Export">
-				<nfsclient ref="Admin group"/>
-				<nfsclient ref="User group"/>
-				<nfsclient ref="red"/>
-			</nfsexport>
-		</fs>
-	</service>
-</rm>
-</cluster>
diff --git a/rgmanager/src/daemons/tests/test013.expected b/rgmanager/src/daemons/tests/test013.expected
deleted file mode 100644
index 2e18327..0000000
--- a/rgmanager/src/daemons/tests/test013.expected
+++ /dev/null
@@ -1,127 +0,0 @@
-=== Resources List ===
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount1 [ primary ]
-  mountpoint = /mnt/cluster [ unique required ]
-  device = /dev/sdb8 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = User group [ primary unique ]
-  target = @users [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = ro
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = Admin group [ primary unique ]
-  target = @admin [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = yellow [ primary unique ]
-  target = yellow [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = magenta [ primary unique ]
-  target = magenta [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = red [ primary unique ]
-  target = red [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsexport
-Agent: nfsexport.sh
-Attributes:
-  name = Dummy Export [ primary ]
-  device [ inherit("device") ]
-  path [ inherit("mountpoint") ]
-  fsid [ inherit("fsid") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-=== Resource Tree ===
-service {
-  name = "test1";
-  fs {
-    name = "mount1";
-    mountpoint = "/mnt/cluster";
-    device = "/dev/sdb8";
-    fstype = "ext3";
-        nfsexport {
-      name = "Dummy Export";
-      device = "/dev/sdb8";
-      path = "/mnt/cluster";
-            nfsclient {
-        name = "Admin group";
-        target = "@admin";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-      nfsclient {
-        name = "User group";
-        target = "@users";
-        path = "/mnt/cluster";
-                options = "ro";
-      }
-      nfsclient {
-        name = "red";
-        target = "red";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-    }
-  }
-  ip {
-    address = "192.168.1.3";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
diff --git a/rgmanager/src/daemons/tests/test013.start.expected b/rgmanager/src/daemons/tests/test013.start.expected
deleted file mode 100644
index e7fd06f..0000000
--- a/rgmanager/src/daemons/tests/test013.start.expected
+++ /dev/null
@@ -1,10 +0,0 @@
-Starting test1...
-[start] service:test1
-[start] fs:mount1
-[start] nfsexport:Dummy Export
-[start] nfsclient:Admin group
-[start] nfsclient:User group
-[start] nfsclient:red
-[start] ip:192.168.1.3
-[start] script:initscript
-Start of test1 complete
diff --git a/rgmanager/src/daemons/tests/test013.stop.expected b/rgmanager/src/daemons/tests/test013.stop.expected
deleted file mode 100644
index 5218b3a..0000000
--- a/rgmanager/src/daemons/tests/test013.stop.expected
+++ /dev/null
@@ -1,10 +0,0 @@
-Stopping test1...
-[stop] script:initscript
-[stop] ip:192.168.1.3
-[stop] nfsclient:red
-[stop] nfsclient:User group
-[stop] nfsclient:Admin group
-[stop] nfsexport:Dummy Export
-[stop] fs:mount1
-[stop] service:test1
-Stop of test1 complete
diff --git a/rgmanager/src/daemons/tests/test014.conf b/rgmanager/src/daemons/tests/test014.conf
deleted file mode 100644
index ced4848..0000000
--- a/rgmanager/src/daemons/tests/test014.conf
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0"?>
-<!--
-     NEEDSTART for resource group "test2".
--->
-<cluster>
-<rm>
-	<resources>
-    		<service name="test1"/>
-    		<service name="test2"/>
-		<script name="initscript" file="/etc/init.d/sshd"/>
-		<ip address="192.168.1.3" monitor_link="yes"/>
-		<ip address="192.168.1.4" monitor_link="yes"/>
-    		<fs fstype="ext3" name="mount1" mountpoint="/mnt/cluster" device="/dev/sdb8"/>
-    		<fs fstype="ext3" name="mount2" mountpoint="/mnt/cluster2" device="/dev/sdb9"/>
-		<nfsexport name="Dummy Export"/>
-    		<nfsclient name="User group" target="@users" options="ro"/>
-    		<nfsclient name="Admin group" target="@admin" options="rw"/>
-    		<nfsclient name="yellow" target="yellow" options="rw,no_root_squash"/>
-    		<nfsclient name="magenta" target="magenta" options="rw,no_root_squash"/>
-    		<nfsclient name="red" target="red" options="rw"/>
-		
-	</resources>
-	<service ref="test1">
-		<ip ref="192.168.1.3"/>
-		<script ref="initscript"/>
-		<fs ref="mount1">
-			<nfsexport ref="Dummy Export">
-				<nfsclient ref="Admin group"/>
-				<nfsclient ref="User group"/>
-				<nfsclient ref="red"/>
-			</nfsexport>
-		</fs>
-	</service>
-	<service ref="test2">
-		<ip ref="192.168.1.4"/>
-		<script ref="initscript"/>
-		<fs ref="mount2">
-			<nfsexport ref="Dummy Export">
-				<nfsclient ref="Admin group"/>
-				<nfsclient ref="User group"/>
-				<nfsclient ref="red"/>
-			</nfsexport>
-		</fs>
-	</service>
-</rm>
-</cluster>
diff --git a/rgmanager/src/daemons/tests/test014.expected b/rgmanager/src/daemons/tests/test014.expected
deleted file mode 100644
index 0b50522..0000000
--- a/rgmanager/src/daemons/tests/test014.expected
+++ /dev/null
@@ -1,192 +0,0 @@
-=== Resources List ===
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount1 [ primary ]
-  mountpoint = /mnt/cluster [ unique required ]
-  device = /dev/sdb8 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount2 [ primary ]
-  mountpoint = /mnt/cluster2 [ unique required ]
-  device = /dev/sdb9 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.4 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = User group [ primary unique ]
-  target = @users [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = ro
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = Admin group [ primary unique ]
-  target = @admin [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = yellow [ primary unique ]
-  target = yellow [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = magenta [ primary unique ]
-  target = magenta [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = red [ primary unique ]
-  target = red [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsexport
-Agent: nfsexport.sh
-Attributes:
-  name = Dummy Export [ primary ]
-  device [ inherit("device") ]
-  path [ inherit("mountpoint") ]
-  fsid [ inherit("fsid") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test2 [ primary unique required ]
-
-=== Resource Tree ===
-service {
-  name = "test1";
-  fs {
-    name = "mount1";
-    mountpoint = "/mnt/cluster";
-    device = "/dev/sdb8";
-    fstype = "ext3";
-        nfsexport {
-      name = "Dummy Export";
-      device = "/dev/sdb8";
-      path = "/mnt/cluster";
-            nfsclient {
-        name = "Admin group";
-        target = "@admin";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-      nfsclient {
-        name = "User group";
-        target = "@users";
-        path = "/mnt/cluster";
-                options = "ro";
-      }
-      nfsclient {
-        name = "red";
-        target = "red";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-    }
-  }
-  ip {
-    address = "192.168.1.3";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
-service {
-  name = "test2";
-  fs {
-    name = "mount2";
-    mountpoint = "/mnt/cluster2";
-    device = "/dev/sdb9";
-    fstype = "ext3";
-        nfsexport {
-      name = "Dummy Export";
-      device = "/dev/sdb9";
-      path = "/mnt/cluster2";
-            nfsclient {
-        name = "Admin group";
-        target = "@admin";
-        path = "/mnt/cluster2";
-                options = "rw";
-      }
-      nfsclient {
-        name = "User group";
-        target = "@users";
-        path = "/mnt/cluster2";
-                options = "ro";
-      }
-      nfsclient {
-        name = "red";
-        target = "red";
-        path = "/mnt/cluster2";
-                options = "rw";
-      }
-    }
-  }
-  ip {
-    address = "192.168.1.4";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test2";
-  }
-}
diff --git a/rgmanager/src/daemons/tests/test014.start.expected b/rgmanager/src/daemons/tests/test014.start.expected
deleted file mode 100644
index 562e1a5..0000000
--- a/rgmanager/src/daemons/tests/test014.start.expected
+++ /dev/null
@@ -1,20 +0,0 @@
-Starting test1...
-[start] service:test1
-[start] fs:mount1
-[start] nfsexport:Dummy Export
-[start] nfsclient:Admin group
-[start] nfsclient:User group
-[start] nfsclient:red
-[start] ip:192.168.1.3
-[start] script:initscript
-Start of test1 complete
-Starting test2...
-[start] service:test2
-[start] fs:mount2
-[start] nfsexport:Dummy Export
-[start] nfsclient:Admin group
-[start] nfsclient:User group
-[start] nfsclient:red
-[start] ip:192.168.1.4
-[start] script:initscript
-Start of test2 complete
diff --git a/rgmanager/src/daemons/tests/test014.stop.expected b/rgmanager/src/daemons/tests/test014.stop.expected
deleted file mode 100644
index c3eb880..0000000
--- a/rgmanager/src/daemons/tests/test014.stop.expected
+++ /dev/null
@@ -1,20 +0,0 @@
-Stopping test1...
-[stop] script:initscript
-[stop] ip:192.168.1.3
-[stop] nfsclient:red
-[stop] nfsclient:User group
-[stop] nfsclient:Admin group
-[stop] nfsexport:Dummy Export
-[stop] fs:mount1
-[stop] service:test1
-Stop of test1 complete
-Stopping test2...
-[stop] script:initscript
-[stop] ip:192.168.1.4
-[stop] nfsclient:red
-[stop] nfsclient:User group
-[stop] nfsclient:Admin group
-[stop] nfsexport:Dummy Export
-[stop] fs:mount2
-[stop] service:test2
-Stop of test2 complete
diff --git a/rgmanager/src/daemons/tests/test015.conf b/rgmanager/src/daemons/tests/test015.conf
deleted file mode 100644
index e1f76bf..0000000
--- a/rgmanager/src/daemons/tests/test015.conf
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0"?>
-<!--
-	NEEDSTOP in old tree for "User group"
-	NEEDSTART in new tree for "User group".
-
-	We have changed the options again.  Please make sure that BOTH
-	tree nodes (the one in "test1" AND in "Test2") have NEEDSTOP/NEEDSTART
-	flags!
--->
-<cluster>
-<rm>
-	<resources>
-    		<service name="test1"/>
-    		<service name="test2"/>
-		<script name="initscript" file="/etc/init.d/sshd"/>
-		<ip address="192.168.1.3" monitor_link="yes"/>
-		<ip address="192.168.1.4" monitor_link="yes"/>
-    		<fs fstype="ext3" name="mount1" mountpoint="/mnt/cluster" device="/dev/sdb8"/>
-    		<fs fstype="ext3" name="mount2" mountpoint="/mnt/cluster2" device="/dev/sdb9"/>
-		<nfsexport name="Dummy Export"/>
-    		<nfsclient name="User group" target="@users" options="rw,sync"/>
-    		<nfsclient name="Admin group" target="@admin" options="rw"/>
-    		<nfsclient name="yellow" target="yellow" options="rw,no_root_squash"/>
-    		<nfsclient name="magenta" target="magenta" options="rw,no_root_squash"/>
-    		<nfsclient name="red" target="red" options="rw"/>
-		
-	</resources>
-	<service ref="test1">
-		<ip ref="192.168.1.3"/>
-		<script ref="initscript"/>
-		<fs ref="mount1">
-			<nfsexport ref="Dummy Export">
-				<nfsclient ref="Admin group"/>
-				<nfsclient ref="User group"/>
-				<nfsclient ref="red"/>
-			</nfsexport>
-		</fs>
-	</service>
-	<service ref="test2">
-		<ip ref="192.168.1.4"/>
-		<script ref="initscript"/>
-		<fs ref="mount2">
-			<nfsexport ref="Dummy Export">
-				<nfsclient ref="Admin group"/>
-				<nfsclient ref="User group"/>
-				<nfsclient ref="red"/>
-			</nfsexport>
-		</fs>
-	</service>
-</rm>
-</cluster>
diff --git a/rgmanager/src/daemons/tests/test015.expected b/rgmanager/src/daemons/tests/test015.expected
deleted file mode 100644
index 3a509ca..0000000
--- a/rgmanager/src/daemons/tests/test015.expected
+++ /dev/null
@@ -1,192 +0,0 @@
-=== Resources List ===
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount1 [ primary ]
-  mountpoint = /mnt/cluster [ unique required ]
-  device = /dev/sdb8 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount2 [ primary ]
-  mountpoint = /mnt/cluster2 [ unique required ]
-  device = /dev/sdb9 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.4 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = User group [ primary unique ]
-  target = @users [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,sync
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = Admin group [ primary unique ]
-  target = @admin [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = yellow [ primary unique ]
-  target = yellow [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = magenta [ primary unique ]
-  target = magenta [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = red [ primary unique ]
-  target = red [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsexport
-Agent: nfsexport.sh
-Attributes:
-  name = Dummy Export [ primary ]
-  device [ inherit("device") ]
-  path [ inherit("mountpoint") ]
-  fsid [ inherit("fsid") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test2 [ primary unique required ]
-
-=== Resource Tree ===
-service {
-  name = "test1";
-  fs {
-    name = "mount1";
-    mountpoint = "/mnt/cluster";
-    device = "/dev/sdb8";
-    fstype = "ext3";
-        nfsexport {
-      name = "Dummy Export";
-      device = "/dev/sdb8";
-      path = "/mnt/cluster";
-            nfsclient {
-        name = "Admin group";
-        target = "@admin";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-      nfsclient {
-        name = "User group";
-        target = "@users";
-        path = "/mnt/cluster";
-                options = "rw,sync";
-      }
-      nfsclient {
-        name = "red";
-        target = "red";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-    }
-  }
-  ip {
-    address = "192.168.1.3";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
-service {
-  name = "test2";
-  fs {
-    name = "mount2";
-    mountpoint = "/mnt/cluster2";
-    device = "/dev/sdb9";
-    fstype = "ext3";
-        nfsexport {
-      name = "Dummy Export";
-      device = "/dev/sdb9";
-      path = "/mnt/cluster2";
-            nfsclient {
-        name = "Admin group";
-        target = "@admin";
-        path = "/mnt/cluster2";
-                options = "rw";
-      }
-      nfsclient {
-        name = "User group";
-        target = "@users";
-        path = "/mnt/cluster2";
-                options = "rw,sync";
-      }
-      nfsclient {
-        name = "red";
-        target = "red";
-        path = "/mnt/cluster2";
-                options = "rw";
-      }
-    }
-  }
-  ip {
-    address = "192.168.1.4";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test2";
-  }
-}
diff --git a/rgmanager/src/daemons/tests/test015.start.expected b/rgmanager/src/daemons/tests/test015.start.expected
deleted file mode 100644
index 562e1a5..0000000
--- a/rgmanager/src/daemons/tests/test015.start.expected
+++ /dev/null
@@ -1,20 +0,0 @@
-Starting test1...
-[start] service:test1
-[start] fs:mount1
-[start] nfsexport:Dummy Export
-[start] nfsclient:Admin group
-[start] nfsclient:User group
-[start] nfsclient:red
-[start] ip:192.168.1.3
-[start] script:initscript
-Start of test1 complete
-Starting test2...
-[start] service:test2
-[start] fs:mount2
-[start] nfsexport:Dummy Export
-[start] nfsclient:Admin group
-[start] nfsclient:User group
-[start] nfsclient:red
-[start] ip:192.168.1.4
-[start] script:initscript
-Start of test2 complete
diff --git a/rgmanager/src/daemons/tests/test015.stop.expected b/rgmanager/src/daemons/tests/test015.stop.expected
deleted file mode 100644
index c3eb880..0000000
--- a/rgmanager/src/daemons/tests/test015.stop.expected
+++ /dev/null
@@ -1,20 +0,0 @@
-Stopping test1...
-[stop] script:initscript
-[stop] ip:192.168.1.3
-[stop] nfsclient:red
-[stop] nfsclient:User group
-[stop] nfsclient:Admin group
-[stop] nfsexport:Dummy Export
-[stop] fs:mount1
-[stop] service:test1
-Stop of test1 complete
-Stopping test2...
-[stop] script:initscript
-[stop] ip:192.168.1.4
-[stop] nfsclient:red
-[stop] nfsclient:User group
-[stop] nfsclient:Admin group
-[stop] nfsexport:Dummy Export
-[stop] fs:mount2
-[stop] service:test2
-Stop of test2 complete
diff --git a/rgmanager/src/daemons/tests/test016.conf b/rgmanager/src/daemons/tests/test016.conf
deleted file mode 100644
index ed3501f..0000000
--- a/rgmanager/src/daemons/tests/test016.conf
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0"?>
-<!--
-     Negative test: Attempting to assign an IP address to multiple resource
-     groups.  Only ONE copy of "192.168.1.3" should appear in the tree.
-
-     There should be _no_ NEEDSTOPs/NEEDSTARTs anywhere.
--->
-<cluster>
-<rm>
-	<resources>
-    		<service name="test1"/>
-    		<service name="test2"/>
-		<script name="initscript" file="/etc/init.d/sshd"/>
-		<ip address="192.168.1.3" monitor_link="yes"/>
-		<ip address="192.168.1.4" monitor_link="yes"/>
-    		<fs fstype="ext3" name="mount1" mountpoint="/mnt/cluster" device="/dev/sdb8"/>
-    		<fs fstype="ext3" name="mount2" mountpoint="/mnt/cluster2" device="/dev/sdb9"/>
-		<nfsexport name="Dummy Export"/>
-    		<nfsclient name="User group" target="@users" options="rw,sync"/>
-    		<nfsclient name="Admin group" target="@admin" options="rw"/>
-    		<nfsclient name="yellow" target="yellow" options="rw,no_root_squash"/>
-    		<nfsclient name="magenta" target="magenta" options="rw,no_root_squash"/>
-    		<nfsclient name="red" target="red" options="rw"/>
-		
-	</resources>
-	<service ref="test1">
-		<ip ref="192.168.1.3"/>
-		<script ref="initscript"/>
-		<fs ref="mount1">
-			<nfsexport ref="Dummy Export">
-				<nfsclient ref="Admin group"/>
-				<nfsclient ref="User group"/>
-				<nfsclient ref="red"/>
-			</nfsexport>
-		</fs>
-	</service>
-	<service ref="test2">
-		<ip ref="192.168.1.3"/>
-		<ip ref="192.168.1.4"/>
-		<script ref="initscript"/>
-		<fs ref="mount2">
-			<nfsexport ref="Dummy Export">
-				<nfsclient ref="Admin group"/>
-				<nfsclient ref="User group"/>
-				<nfsclient ref="red"/>
-			</nfsexport>
-		</fs>
-	</service>
-</rm>
-</cluster>
diff --git a/rgmanager/src/daemons/tests/test016.expected b/rgmanager/src/daemons/tests/test016.expected
deleted file mode 100644
index d286c2f..0000000
--- a/rgmanager/src/daemons/tests/test016.expected
+++ /dev/null
@@ -1,193 +0,0 @@
-Warning: Max references exceeded for resource address (type ip)
-=== Resources List ===
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount1 [ primary ]
-  mountpoint = /mnt/cluster [ unique required ]
-  device = /dev/sdb8 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount2 [ primary ]
-  mountpoint = /mnt/cluster2 [ unique required ]
-  device = /dev/sdb9 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.4 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = User group [ primary unique ]
-  target = @users [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,sync
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = Admin group [ primary unique ]
-  target = @admin [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = yellow [ primary unique ]
-  target = yellow [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = magenta [ primary unique ]
-  target = magenta [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = red [ primary unique ]
-  target = red [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsexport
-Agent: nfsexport.sh
-Attributes:
-  name = Dummy Export [ primary ]
-  device [ inherit("device") ]
-  path [ inherit("mountpoint") ]
-  fsid [ inherit("fsid") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test2 [ primary unique required ]
-
-=== Resource Tree ===
-service {
-  name = "test1";
-  fs {
-    name = "mount1";
-    mountpoint = "/mnt/cluster";
-    device = "/dev/sdb8";
-    fstype = "ext3";
-        nfsexport {
-      name = "Dummy Export";
-      device = "/dev/sdb8";
-      path = "/mnt/cluster";
-            nfsclient {
-        name = "Admin group";
-        target = "@admin";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-      nfsclient {
-        name = "User group";
-        target = "@users";
-        path = "/mnt/cluster";
-                options = "rw,sync";
-      }
-      nfsclient {
-        name = "red";
-        target = "red";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-    }
-  }
-  ip {
-    address = "192.168.1.3";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
-service {
-  name = "test2";
-  fs {
-    name = "mount2";
-    mountpoint = "/mnt/cluster2";
-    device = "/dev/sdb9";
-    fstype = "ext3";
-        nfsexport {
-      name = "Dummy Export";
-      device = "/dev/sdb9";
-      path = "/mnt/cluster2";
-            nfsclient {
-        name = "Admin group";
-        target = "@admin";
-        path = "/mnt/cluster2";
-                options = "rw";
-      }
-      nfsclient {
-        name = "User group";
-        target = "@users";
-        path = "/mnt/cluster2";
-                options = "rw,sync";
-      }
-      nfsclient {
-        name = "red";
-        target = "red";
-        path = "/mnt/cluster2";
-                options = "rw";
-      }
-    }
-  }
-  ip {
-    address = "192.168.1.4";
-    monitor_link = "yes";
-      }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test2";
-  }
-}
diff --git a/rgmanager/src/daemons/tests/test016.start.expected b/rgmanager/src/daemons/tests/test016.start.expected
deleted file mode 100644
index 3f49953..0000000
--- a/rgmanager/src/daemons/tests/test016.start.expected
+++ /dev/null
@@ -1,22 +0,0 @@
-Warning: Max references exceeded for resource address (type ip)
-Starting test1...
-[start] service:test1
-[start] fs:mount1
-[start] nfsexport:Dummy Export
-[start] nfsclient:Admin group
-[start] nfsclient:User group
-[start] nfsclient:red
-[start] ip:192.168.1.3
-[start] script:initscript
-Start of test1 complete
-Warning: Max references exceeded for resource address (type ip)
-Starting test2...
-[start] service:test2
-[start] fs:mount2
-[start] nfsexport:Dummy Export
-[start] nfsclient:Admin group
-[start] nfsclient:User group
-[start] nfsclient:red
-[start] ip:192.168.1.4
-[start] script:initscript
-Start of test2 complete
diff --git a/rgmanager/src/daemons/tests/test016.stop.expected b/rgmanager/src/daemons/tests/test016.stop.expected
deleted file mode 100644
index dfc1cc1..0000000
--- a/rgmanager/src/daemons/tests/test016.stop.expected
+++ /dev/null
@@ -1,22 +0,0 @@
-Warning: Max references exceeded for resource address (type ip)
-Stopping test1...
-[stop] script:initscript
-[stop] ip:192.168.1.3
-[stop] nfsclient:red
-[stop] nfsclient:User group
-[stop] nfsclient:Admin group
-[stop] nfsexport:Dummy Export
-[stop] fs:mount1
-[stop] service:test1
-Stop of test1 complete
-Warning: Max references exceeded for resource address (type ip)
-Stopping test2...
-[stop] script:initscript
-[stop] ip:192.168.1.4
-[stop] nfsclient:red
-[stop] nfsclient:User group
-[stop] nfsclient:Admin group
-[stop] nfsexport:Dummy Export
-[stop] fs:mount2
-[stop] service:test2
-Stop of test2 complete
diff --git a/rgmanager/src/daemons/tests/test017.conf b/rgmanager/src/daemons/tests/test017.conf
deleted file mode 100644
index c300e47..0000000
--- a/rgmanager/src/daemons/tests/test017.conf
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0"?>
-<!--
-	Lots of needstarts/needstops; this one is meant to test the ordering 
-	of untyped resources.  In the test 2 service, the start/stop ordering
-	should be:
-
-	start test2
-	start initscript
-	start ip .1.3
-	start mount2
-	start dummy export
-	start admin group
-	start user group
-	start red
-	start script2
-	start .1.4
-	start script3
-
-
-	
--->
-<cluster>
-<rm>
-	<resources>
-    		<service name="test1"/>
-    		<service name="test2"/>
-		<script name="initscript" file="/etc/init.d/sshd"/>
-		<script name="script2" file="/etc/init.d/script2"/>
-		<script name="script3" file="/etc/init.d/script3"/>
-		<ip address="192.168.1.3" monitor_link="yes"/>
-		<ip address="192.168.1.4" monitor_link="yes"/>
-    		<fs fstype="ext3" name="mount1" mountpoint="/mnt/cluster" device="/dev/sdb8"/>
-    		<fs fstype="ext3" name="mount2" mountpoint="/mnt/cluster2" device="/dev/sdb9"/>
-		<nfsexport name="Dummy Export"/>
-    		<nfsclient name="User group" target="@users" options="rw,sync"/>
-    		<nfsclient name="Admin group" target="@admin" options="rw"/>
-    		<nfsclient name="yellow" target="yellow" options="rw,no_root_squash"/>
-    		<nfsclient name="magenta" target="magenta" options="rw,no_root_squash"/>
-    		<nfsclient name="red" target="red" options="rw"/>
-		
-	</resources>
-	<service ref="test1">
-		<script ref="initscript"/>
-		<fs ref="mount1">
-			<nfsexport ref="Dummy Export">
-				<nfsclient ref="Admin group"/>
-				<nfsclient ref="User group"/>
-				<nfsclient ref="red"/>
-			</nfsexport>
-		</fs>
-	</service>
-	<service ref="test2">
-		<script ref="initscript">
-			<ip ref="192.168.1.3"/>
-			<fs ref="mount2">
-				<nfsexport ref="Dummy Export">
-					<nfsclient ref="Admin group"/>
-					<nfsclient ref="User group"/>
-					<nfsclient ref="red"/>
-				</nfsexport>
-			</fs>
-			<script ref="script2"/>
-			<ip ref="192.168.1.4"/>
-		</script>
-		<script ref="script3"/>
-	</service>
-</rm>
-</cluster>
diff --git a/rgmanager/src/daemons/tests/test017.expected b/rgmanager/src/daemons/tests/test017.expected
deleted file mode 100644
index ae72496..0000000
--- a/rgmanager/src/daemons/tests/test017.expected
+++ /dev/null
@@ -1,215 +0,0 @@
-=== Resources List ===
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount1 [ primary ]
-  mountpoint = /mnt/cluster [ unique required ]
-  device = /dev/sdb8 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: fs
-Instances: 1/1
-Agent: fs.sh
-Attributes:
-  name = mount2 [ primary ]
-  mountpoint = /mnt/cluster2 [ unique required ]
-  device = /dev/sdb9 [ unique required ]
-  fstype = ext3
-  nfslock [ inherit("nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.3 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: ip
-Instances: 1/1
-Agent: ip.sh
-Attributes:
-  address = 192.168.1.4 [ primary unique ]
-  monitor_link = yes
-  nfslock [ inherit("service%nfslock") ]
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = User group [ primary unique ]
-  target = @users [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,sync
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = Admin group [ primary unique ]
-  target = @admin [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = yellow [ primary unique ]
-  target = yellow [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = magenta [ primary unique ]
-  target = magenta [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw,no_root_squash
-
-Resource type: nfsclient
-Agent: nfsclient.sh
-Attributes:
-  name = red [ primary unique ]
-  target = red [ required ]
-  path [ inherit("path") ]
-  fsid [ inherit("fsid") ]
-  options = rw
-
-Resource type: nfsexport
-Agent: nfsexport.sh
-Attributes:
-  name = Dummy Export [ primary ]
-  device [ inherit("device") ]
-  path [ inherit("mountpoint") ]
-  fsid [ inherit("fsid") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = initscript [ primary unique ]
-  file = /etc/init.d/sshd [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = script2 [ primary unique ]
-  file = /etc/init.d/script2 [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: script
-Agent: script.sh
-Attributes:
-  name = script3 [ primary unique ]
-  file = /etc/init.d/script3 [ unique required ]
-  service_name [ inherit("service%name") ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test1 [ primary unique required ]
-
-Resource type: service
-Instances: 1/1
-Agent: service.sh
-Attributes:
-  name = test2 [ primary unique required ]
-
-=== Resource Tree ===
-service {
-  name = "test1";
-  fs {
-    name = "mount1";
-    mountpoint = "/mnt/cluster";
-    device = "/dev/sdb8";
-    fstype = "ext3";
-        nfsexport {
-      name = "Dummy Export";
-      device = "/dev/sdb8";
-      path = "/mnt/cluster";
-            nfsclient {
-        name = "Admin group";
-        target = "@admin";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-      nfsclient {
-        name = "User group";
-        target = "@users";
-        path = "/mnt/cluster";
-                options = "rw,sync";
-      }
-      nfsclient {
-        name = "red";
-        target = "red";
-        path = "/mnt/cluster";
-                options = "rw";
-      }
-    }
-  }
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test1";
-  }
-}
-service {
-  name = "test2";
-  script {
-    name = "initscript";
-    file = "/etc/init.d/sshd";
-    service_name = "test2";
-    ip {
-      address = "192.168.1.3";
-      monitor_link = "yes";
-          }
-    fs {
-      name = "mount2";
-      mountpoint = "/mnt/cluster2";
-      device = "/dev/sdb9";
-      fstype = "ext3";
-            nfsexport {
-        name = "Dummy Export";
-        device = "/dev/sdb9";
-        path = "/mnt/cluster2";
-                nfsclient {
-          name = "Admin group";
-          target = "@admin";
-          path = "/mnt/cluster2";
-                    options = "rw";
-        }
-        nfsclient {
-          name = "User group";
-          target = "@users";
-          path = "/mnt/cluster2";
-                    options = "rw,sync";
-        }
-        nfsclient {
-          name = "red";
-          target = "red";
-          path = "/mnt/cluster2";
-                    options = "rw";
-        }
-      }
-    }
-    script {
-      name = "script2";
-      file = "/etc/init.d/script2";
-          }
-    ip {
-      address = "192.168.1.4";
-      monitor_link = "yes";
-          }
-  }
-  script {
-    name = "script3";
-    file = "/etc/init.d/script3";
-    service_name = "test2";
-  }
-}
diff --git a/rgmanager/src/daemons/tests/test017.start.expected b/rgmanager/src/daemons/tests/test017.start.expected
deleted file mode 100644
index 054809f..0000000
--- a/rgmanager/src/daemons/tests/test017.start.expected
+++ /dev/null
@@ -1,22 +0,0 @@
-Starting test1...
-[start] service:test1
-[start] fs:mount1
-[start] nfsexport:Dummy Export
-[start] nfsclient:Admin group
-[start] nfsclient:User group
-[start] nfsclient:red
-[start] script:initscript
-Start of test1 complete
-Starting test2...
-[start] service:test2
-[start] script:initscript
-[start] ip:192.168.1.3
-[start] fs:mount2
-[start] nfsexport:Dummy Export
-[start] nfsclient:Admin group
-[start] nfsclient:User group
-[start] nfsclient:red
-[start] script:script2
-[start] ip:192.168.1.4
-[start] script:script3
-Start of test2 complete
diff --git a/rgmanager/src/daemons/tests/test017.stop.expected b/rgmanager/src/daemons/tests/test017.stop.expected
deleted file mode 100644
index ccc056c..0000000
--- a/rgmanager/src/daemons/tests/test017.stop.expected
+++ /dev/null
@@ -1,22 +0,0 @@
-Stopping test1...
-[stop] script:initscript
-[stop] nfsclient:red
-[stop] nfsclient:User group
-[stop] nfsclient:Admin group
-[stop] nfsexport:Dummy Export
-[stop] fs:mount1
-[stop] service:test1
-Stop of test1 complete
-Stopping test2...
-[stop] script:script3
-[stop] ip:192.168.1.4
-[stop] script:script2
-[stop] nfsclient:red
-[stop] nfsclient:User group
-[stop] nfsclient:Admin group
-[stop] nfsexport:Dummy Export
-[stop] fs:mount2
-[stop] ip:192.168.1.3
-[stop] script:initscript
-[stop] service:test2
-Stop of test2 complete
diff --git a/rgmanager/src/daemons/tests/test018.conf b/rgmanager/src/daemons/tests/test018.conf
deleted file mode 100644
index da7ed6e..0000000
--- a/rgmanager/src/daemons/tests/test018.conf
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0"?>
-<!--
-	while testing for #212121, I found that if you had multiple
-	instances of untyped children where the untyped children were 
-	multi-instance resources, you could end up with resource duplication
-	the second time around.
-
-        For example:
-
-	start test2
-	start initscript
-	start clusterfs    - this should not happen twice
-	start clusterfs
-	start ip .1.3
-	start mount2
-	start dummy export
-	start admin group
-	start user group
-	start red
-	start script2
-	start .1.4
-	start script3
-
-        ... would occur without the change to restree.c which removes
-	the addition of newchild to the known-children.
-	
--->
-<cluster>
-<rm>
-	<resources>
-    		<service name="test1"/>
-    		<service name="test2"/>
-		<script name="initscript" file="/etc/init.d/sshd"/>
-		<script name="script2" file="/etc/init.d/script2"/>
-		<script name="script3" file="/etc/init.d/script3"/>
-		<ip address="192.168.1.3" monitor_link="yes"/>
-		<ip address="192.168.1.4" monitor_link="yes"/>
-    		<fs fstype="ext3" name="mount1" mountpoint="/mnt/cluster" device="/dev/sdb8"/>
-    		<fs fstype="ext3" name="mount2" mountpoint="/mnt/cluster2" device="/dev/sdb9"/>
-		<nfsexport name="Dummy Export"/>
-    		<nfsclient name="User group" target="@users" options="rw,sync"/>
-    		<nfsclient name="Admin group" target="@admin" options="rw"/>
-    		<nfsclient name="yellow" target="yellow" options="rw,no_root_squash"/>
-    		<nfsclient name="magenta" target="magenta" options="rw,no_root_squash"/>
-    		<nfsclient name="red" target="red" options="rw"/>
-		<clusterfs name="argle" mountpoint="/mnt/cluster3" device="/dev/sdb10"/>
-		
-	</resources>
-	<service ref="test1">
-		<script ref="initscript">
-			<clusterfs ref="argle"/>
-		</script>
-		<fs ref="mount1">
-			<nfsexport ref="Dummy Export">
-				<nfsclient ref="Admin group"/>
-				<nfsclient ref="User group"/>
-				<nfsclient ref="red"/>
-			</nfsexport>
-		</fs>
-	</service>
-	<service ref="test2">
-		<script ref="initscript">
-			<clusterfs ref="argle"/>
-			<ip ref="192.168.1.3"/>
-			<fs ref="mount2">
-				<nfsexport ref="Dummy Export">
-					<nfsclient ref="Admin group"/>
-					<nfsclient ref="User group"/>
-					<nfsclient ref="red"/>
-				</nfsexport>
-			</fs>
-			<script ref="script2"/>
-			<ip ref="192.168.1.4"/>
-		</script>
-		<script ref="script3"/>
-	</service>
-</rm>
-</cluster>
diff --git a/rgmanager/src/daemons/tests/test018.start.expected b/rgmanager/src/daemons/tests/test018.start.expected
deleted file mode 100644
index b633297..0000000
--- a/rgmanager/src/daemons/tests/test018.start.expected
+++ /dev/null
@@ -1,24 +0,0 @@
-Starting test1...
-[start] service:test1
-[start] fs:mount1
-[start] nfsexport:Dummy Export
-[start] nfsclient:Admin group
-[start] nfsclient:User group
-[start] nfsclient:red
-[start] script:initscript
-[start] clusterfs:argle
-Start of test1 complete
-Starting test2...
-[start] service:test2
-[start] script:initscript
-[start] clusterfs:argle
-[start] ip:192.168.1.3
-[start] fs:mount2
-[start] nfsexport:Dummy Export
-[start] nfsclient:Admin group
-[start] nfsclient:User group
-[start] nfsclient:red
-[start] script:script2
-[start] ip:192.168.1.4
-[start] script:script3
-Start of test2 complete
diff --git a/rgmanager/src/daemons/tests/test018.stop.expected b/rgmanager/src/daemons/tests/test018.stop.expected
deleted file mode 100644
index 5df827b..0000000
--- a/rgmanager/src/daemons/tests/test018.stop.expected
+++ /dev/null
@@ -1,24 +0,0 @@
-Stopping test1...
-[stop] clusterfs:argle
-[stop] script:initscript
-[stop] nfsclient:red
-[stop] nfsclient:User group
-[stop] nfsclient:Admin group
-[stop] nfsexport:Dummy Export
-[stop] fs:mount1
-[stop] service:test1
-Stop of test1 complete
-Stopping test2...
-[stop] script:script3
-[stop] ip:192.168.1.4
-[stop] script:script2
-[stop] nfsclient:red
-[stop] nfsclient:User group
-[stop] nfsclient:Admin group
-[stop] nfsexport:Dummy Export
-[stop] fs:mount2
-[stop] ip:192.168.1.3
-[stop] clusterfs:argle
-[stop] script:initscript
-[stop] service:test2
-Stop of test2 complete
diff --git a/rgmanager/src/daemons/tests/testlist b/rgmanager/src/daemons/tests/testlist
deleted file mode 100644
index 045a3e1..0000000
--- a/rgmanager/src/daemons/tests/testlist
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-# Tests to run.
-#
-TESTS=$(/bin/ls -1 test*.conf | cut -f1 -d.)
diff --git a/rgmanager/src/daemons/watchdog.c b/rgmanager/src/daemons/watchdog.c
deleted file mode 100644
index 7dc004d..0000000
--- a/rgmanager/src/daemons/watchdog.c
+++ /dev/null
@@ -1,79 +0,0 @@
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/reboot.h>
-#include <stdlib.h>
-
-#include <signals.h>
-#include <logging.h>
-
-static pid_t child = 0;
-
-static void 
-signal_handler(int signum)
-{
-        kill(child, signum);
-}
-static void 
-redirect_signals(void)
-{
-        int i;
-        for (i = 0; i < _NSIG; i++) {
-	        switch (i) {
-		case SIGCHLD:
-		case SIGILL:
-		case SIGFPE:
-		case SIGSEGV:
-		case SIGBUS:
-		        setup_signal(i, SIG_DFL);
-			break;
-		default:
-		        setup_signal(i, signal_handler);
-		}
-	}
-}
-
-/**
- return watchdog's pid, or 0 on failure
-*/
-int 
-watchdog_init(void)
-{
-	int status;
-	pid_t parent;
-	
-	parent = getpid();
-	child = fork();
-	if (child < 0)
-	        return 0;
-	else if (!child)
-		return parent;
-	
-	redirect_signals();
-	
-	while (1) {
-	        if (waitpid(child, &status, 0) <= 0)
-		        continue;
-		
-		if (WIFEXITED(status))
-		        exit(WEXITSTATUS(status));
-		
-		if (WIFSIGNALED(status)) {
-		        if (WTERMSIG(status) == SIGKILL) {
-				logt_print(LOG_CRIT, "Watchdog: Daemon killed, exiting\n");
-				raise(SIGKILL);
-				while(1) ;
-			}
-			else {
-#ifdef DEBUG
-			        logt_print(LOG_CRIT, "Watchdog: Daemon died, but not rebooting because DEBUG is set\n");
-#else
-				logt_print(LOG_CRIT, "Watchdog: Daemon died, rebooting...\n");
-				sync();
-			        reboot(RB_AUTOBOOT);
-#endif
-				exit(255);
-			}
-		}
-	}
-}
diff --git a/rgmanager/src/resources/ASEHAagent.sh b/rgmanager/src/resources/ASEHAagent.sh
deleted file mode 100644
index 4c906a9..0000000
--- a/rgmanager/src/resources/ASEHAagent.sh
+++ /dev/null
@@ -1,900 +0,0 @@
-#!/bin/bash
-
-# 
-# Sybase Availability Agent for Red Hat Cluster v15.0.2 
-# Copyright (C) - 2007
-# Sybase, Inc. All rights reserved.
-#
-# Sybase Availability Agent for Red Hat Cluster v15.0.2 is licensed
-# under the GNU General Public License Version 2.
-#
-# Author(s):
-#    Jian-ping Hui <jphui@sybase.com>
-#
-# Description: Service script for starting/stopping/monitoring \
-#              Sybase Adaptive Server on: \
-#                            Red Hat Enterprise Linux 5 ES \
-#                            Red Hat Enterprise Linux 5 AS
-#
-# NOTES:
-#
-# (1) Before running this script, we assume that user has installed
-#     Sybase ASE 15.0.2 or higher version on the machine. Please
-#     customize your configuration in /etc/cluster/cluster.conf according
-#     to your actual environment. We assume the following files exist before
-#     you start the service:
-#         /$sybase_home/SYBASE.sh
-#         /$sybase_home/$sybase_ase/install/RUN_$server_name
-#
-# (2) You can customize the interval value in the meta-data section if needed:
-#                <action name="start" timeout="300" />
-#                <action name="stop" timeout="300" />
-#                
-#                <!-- Checks to see if it''s mounted in the right place -->
-#                <action name="status"  interval="30" timeout="100" />
-#                <action name="monitor" interval="30" timeout="100" />
-#                
-#                <!--Checks to see if we can read from the mountpoint -->
-#                <action name="status" depth="10" timeout="100" interval="120" />
-#                <action name="monitor" depth="10" timeout="100" interval="120" />
-#                
-#                <action name="meta-data" timeout="5" />
-#                <action name="validate-all" timeout="5" />
-#     The timeout value is not supported by Redhat in RHCS5.0. 
-# 
-# (3) This script should be put under /usr/share/cluster. Its owner should be "root" with 
-#     execution permission.
-#
-
-. /etc/init.d/functions
-. $(dirname $0)/ocf-shellfuncs
-
-PROG=${0}
-
-export LD_POINTER_GUARD=0
-
-#######################################################################################
-# Declare some variables we will use in the script. Please don't change their values. #
-#######################################################################################
-declare login_string=""
-declare RUNSERVER_SCRIPT=$OCF_RESKEY_sybase_home/$OCF_RESKEY_sybase_ase/install/RUN_$OCF_RESKEY_server_name
-declare CONSOLE_LOG=$OCF_RESKEY_sybase_home/$OCF_RESKEY_sybase_ase/install/$OCF_RESKEY_server_name.log
-
-##################################################################################################
-# This function will be called by rgmanager to get the meta data of resource agent "ASEHAagent". #
-# NEVER CHANGE ANYTHING IN THIS FUNCTION.
-##################################################################################################
-meta_data()
-{
-	cat <<EOT
-<?xml version="1.0" ?>
-<resource-agent name="ASEHAagent" version="rgmanager 2.0">
-	<version>1.0</version>
-
-	<longdesc lang="en">
-		Sybase ASE Failover Instance
-	</longdesc>
-	<shortdesc lang="en">
-		Sybase ASE Failover Instance
-	</shortdesc>
-
-	<parameters>
-		<parameter name="name" unique="1" primary="1">
-			<longdesc lang="en">
-				Instance name of resource agent "ASEHAagent"
-			</longdesc>
-			<shortdesc lang="en">
-				name
-			</shortdesc>
-			<content type="string" />
-		</parameter>
-
-		<parameter name="sybase_home" unique="1" required="1">
-			<longdesc lang="en">
-				The home directory of sybase products
-			</longdesc>
-			<shortdesc lang="en">
-				SYBASE home directory
-			</shortdesc>
-			<content type="string" />
-		</parameter>
-
-		<parameter name="sybase_ase" unique="1" required="1">
-			<longdesc lang="en">
-				The directory name under sybase_home where ASE products are installed
-			</longdesc>
-			<shortdesc lang="en">
-				SYBASE_ASE directory name
-			</shortdesc>
-			<content type="string" default="ASE-15_0" />
-		</parameter>
-
-		<parameter name="sybase_ocs" unique="1" required="1">
-			<longdesc lang="en">
-				The directory name under sybase_home where OCS products are installed, i.e. ASE-15_0
-			</longdesc>
-			<shortdesc lang="en">
-				SYBASE_OCS directory name
-			</shortdesc>
-			<content type="string" default="OCS-15_0" />
-		</parameter>
-
-		<parameter name="server_name" unique="1" required="1">
-			<longdesc lang="en">
-				The ASE server name which is configured for the HA service
-			</longdesc>
-			<shortdesc lang="en">
-				ASE server name
-			</shortdesc>
-			<content type="string" />
-		</parameter>
-
-		<parameter name="login_file" unique="1" required="1">
-			<longdesc lang="en">
-				The full path of login file which contains the login/password pair
-			</longdesc>
-			<shortdesc lang="en">
-				Login file
-			</shortdesc>
-			<content type="string" />
-		</parameter>
-
-		<parameter name="interfaces_file" unique="1" required="1">
-			<longdesc lang="en">
-				The full path of interfaces file which is used to start/access the ASE server
-			</longdesc>
-			<shortdesc lang="en">
-				Interfaces file
-			</shortdesc>
-			<content type="string" />
-		</parameter>
-
-		<parameter name="sybase_user" unique="1" required="1">
-			<longdesc lang="en">
-				The user who can run ASE server
-			</longdesc>
-			<shortdesc lang="en">
-				Sybase user
-			</shortdesc>
-			<content type="string" default="sybase" />
-		</parameter>
-
-		<parameter name="shutdown_timeout" unique="1" required="1">
-			<longdesc lang="en">
-				The maximum seconds to wait for the ASE server to shutdown before killing the process directly
-			</longdesc>
-			<shortdesc>
-				Shutdown timeout value
-			</shortdesc>
-			<content type="integer" default="0" />
-		</parameter>
-
-		<parameter name="start_timeout" unique="1" required="1">
-			<longdesc lang="en">
-				The maximum seconds to wait for an ASE server to complete before determining that the server had failed to start
-			</longdesc>
-			<shortdesc lang="en">
-				Start timeout value
-			</shortdesc>
-			<content type="integer" default="0" />
-		</parameter>
-
-		<parameter name="deep_probe_timeout" unique="1" required="1">
-			<longdesc lang="en">
-				The maximum seconds to wait for the response of ASE server before determining that the server had no response while running deep probe
-			</longdesc>
-			<shortdesc lang="en">
-				Deep probe timeout value
-			</shortdesc>
-			<content type="integer" default="0" />
-		</parameter>
-	</parameters>
-	<actions>
-		<action name="start" timeout="300" />
-		<action name="stop" timeout="300" />
-		
-		<!-- Checks to see if it''s mounted in the right place -->
-		<action name="status"  interval="30" timeout="100" />
-		<action name="monitor" interval="30" timeout="100" />
-		
-		<!--Checks to see if we can read from the mountpoint -->
-		<action name="status" depth="10" timeout="100" interval="120" />
-		<action name="monitor" depth="10" timeout="100" interval="120" />
-		
-		<action name="meta-data" timeout="5" />
-		<action name="validate-all" timeout="5" />
-	</actions>
-
-	<special tag="rgmanager">
-	</special>
-</resource-agent>
-EOT
-}
-
-##################################################################################################
-# Function Name: validate_all                                                                    #
-# Parameter: None                                                                                #
-# Return value:                                                                                  #
-#             0               SUCCESS                                                            #
-#             OCF_ERR_ARGS    Parameters are invalid                                             #
-# Description: Do some validation on the user-configurable stuff at the beginning of the script. #
-##################################################################################################
-verify_all() 
-{
-	ocf_log debug "ASEHAagent: Start 'verify_all'"
-
-	# Check if the parameter 'sybase_home' is set.	
-	if [[ -z "$OCF_RESKEY_sybase_home" ]]
-	then
-		ocf_log err "ASEHAagent: The parameter 'sybase_home' is not set."
-		return $OCF_ERR_ARGS
-	fi
-
-	# Check if the parameter 'sybase_home' is a valid path.
-	if [[ ! -d $OCF_RESKEY_sybase_home ]]
-	then
-		ocf_log err "ASEHAagent: The sybase_home '$OCF_RESKEY_sybase_home' doesn't exist."
-		return $OCF_ERR_ARGS
-	fi
-
-	# Check if the script file SYBASE.sh exists
-	if [[ ! -f $OCF_RESKEY_sybase_home/SYBASE.sh ]]
-	then
-		ocf_log err "ASEHAagent: The file $OCF_RESKEY_sybase_home/SYBASE.sh is required to run this script. Failed to run the script."
-		return $OCF_ERR_ARGS
-	fi
-
-	# Check if the parameter 'sybase_ase' is set.
-	if [[ -z "$OCF_RESKEY_sybase_ase" ]] 
-	then
-		ocf_log err "ASEHAagent: The parameter 'sybase_ase' is not set."
-		return $OCF_ERR_ARGS
-	fi
-
-	# Check if the directory /$OCF_RESKEY_sybase_home/$OCF_RESKEY_sybase_ase exists.
-	if [[ ! -d $OCF_RESKEY_sybase_home/$OCF_RESKEY_sybase_ase ]]
-	then
-		ocf_log err "ASEHAagent: The directory '$OCF_RESKEY_sybase_home/$OCF_RESKEY_sybase_ase' doesn't exist."
-		return $OCF_ERR_ARGS
-	fi
-
-	# Check if the parameter 'sybase_ocs' is set.
-	if [[ -z "$OCF_RESKEY_sybase_ocs" ]] 
-	then
-		ocf_log err "ASEHAagent: The parameter 'sybase_ocs' is not set."
-		return $OCF_ERR_ARGS
-	fi
-
-	# Check if the directory /$OCF_RESKEY_sybase_home/$OCF_RESKEY_sybase_ocs exists.
-	if [[ ! -d $OCF_RESKEY_sybase_home/$OCF_RESKEY_sybase_ocs ]]
-	then
-		ocf_log err "ASEHAagent: The directory '$OCF_RESKEY_sybase_home/$OCF_RESKEY_sybase_ocs' doesn't exist."
-		return $OCF_ERR_ARGS
-	fi
-
-	# Check if the parameter 'server_name' is set.	
-	if [[ -z "$OCF_RESKEY_server_name" ]]
-	then
-		ocf_log err "ASEHAagent: The parameter 'server_name' is not set."
-		return $OCF_ERR_ARGS
-	fi
-
-	# Check if the Run_server file exists.
-	if [[ ! -f $RUNSERVER_SCRIPT ]]
-	then
-		ocf_log err "ASEHAagent: There file $RUNSERVER_SCRIPT doesn't exist. The sybase directory may be incorrect."
-		return $OCF_ERR_ARGS
-	fi
-
-	# Check if the parameter 'login_file' is set.	
-	if [[ -z "$OCF_RESKEY_login_file" ]]
-	then
-		ocf_log err "ASEHAagent: The parameter 'login_file' is not set."
-		return $OCF_ERR_ARGS
-	fi
-
-	# Check if the login file exist.
-	if [[ ! -f $OCF_RESKEY_login_file ]]
-	then
-		ocf_log err "ASEHAagent: The login file '$OCF_RESKEY_login_file' doesn't exist."
-		return $OCF_ERR_ARGS
-	fi
-
-	# Check if the parameter 'sybase_user' is set
-	if [[ -z "$OCF_RESKEY_sybase_user" ]]
-	then
-		ocf_log err "ASEHAagent: The parameter 'sybase_user' is not set."
-		return $OCF_ERR_ARGS
-	fi
-
-	# Check if the user 'sybase_user' exist
-	id -u $OCF_RESKEY_sybase_user
-	if [[ $? != 0 ]]
-	then
-		ocf_log err "ASEHAagent: The user '$OCF_RESKEY_sybase_user' doesn't exist in the system."
-		return $OCF_ERR_ARGS
-	fi
-
-	# Check if the parameter 'interfaces_file' is set
-	if [[ -z "$OCF_RESKEY_interfaces_file" ]]
-	then
-		ocf_log err "ASEHAagent: The parameter 'interfaces_file' is not set."
-		return $OCF_ERR_ARGS
-	fi
-
-	# Check if the file 'interfaces_file' exists
-	if [[ ! -f $OCF_RESKEY_interfaces_file ]]
-	then
-		ocf_log err "ASEHAagent: The interfaces file '$OCF_RESKEY_interfaces_file' doesn't exist."
-		return $OCF_ERR_ARGS
-	fi
-
-	# Check if the parameter 'shutdown_timeout' is a valid value
-	if [[ $OCF_RESKEY_shutdown_timeout -eq 0 ]]
-	then
-		ocf_log err "ASEHAagent: The parameter 'shutdown_timeout' is not set. Its value cannot be zero."
-		return $OCF_ERR_ARGS
-	fi
-
-	# Check if the parameter 'start_timeout' is a valid value
-	if [[ $OCF_RESKEY_start_timeout -eq 0 ]]
-	then
-		ocf_log err "ASEHAagent: The parameter 'start_timeout' is not set. Its value cannot be zero."
-		return $OCF_ERR_ARGS
-	fi
-
-	# Check if the parameter 'deep_probe_timeout' is a valid value
-	if [[ $OCF_RESKEY_deep_probe_timeout -eq 0 ]]
-	then
-		ocf_log err "ASEHAagent: The parameter 'deep_probe_timeout' is not set. Its value cannot be zero."
-		return $OCF_ERR_ARGS
-	fi
-
-	ocf_log debug "ASEHAagent: End 'verify_all' successfully."
-
-	return 0
-}
-
-################################################################################################################
-# Function name: get_login_string                                                                              #
-# Parameter: None                                                                                              #
-# Return value:                                                                                                #
-#              0    SUCCESS                                                                                    #
-#              1    FAIL                                                                                       #
-# Description: Analyze the login_file to format the login string. This function will set the global variable   #
-#              "login_string". If the login/password is clear text, the "login_string" will become to "-Ulogin #
-#              -Ppassword" if there is no error. If there are any errors in this function, the string          #
-#              "login_string" will be still empty. In current stage, the encrypted string is not supported     #
-#              because "haisql" is not available on this platform.                                             #
-################################################################################################################
-get_login_string()
-{
-	tmpstring=""
-	login_sting=""
-
-	# Read the first column. The valid value will be "normal" or "encrypted". Any other values are invalid.
-	login_type=`head -1 $OCF_RESKEY_login_file | awk '{print $1}'`
-	if [[ $login_type = "normal" ]]
-	then
-		# The login/password pair is saved in clear text.
-		# Abstract the login/password from the line. 
-		tmpstring=`head -1 $OCF_RESKEY_login_file | awk '{print $2}'`
-
-		# Abstract "user" from the string.
-		user=`echo $tmpstring | awk -F'/' '{print $1}'`
-		# Check if the "user" string is NULL. If it is NULL, it means this is not a valid user.
-		if  [[ -z $user ]]
-		then
-			ocf_log err "ASEHAagent: Login username is not specified in the file '$OCF_RESKEY_login_file'"
-			return 1
-		fi
-
-		# Abstract "password" from the string.
-		passwd=`echo $tmpstring | awk -F'/' '{print $2}'`
-
-		# Format the "login_string".
-		login_string="-U$user -P$passwd"
-	else
-		# The login_type is invalid value.
-		ocf_log err "ASEHAagent: Login type specified in the file $OCF_RESKEY_login_file is not 'normal' or 'encrypted' which are only supported values."
-		return 1
-	fi
-
-	# The "login_file" has been analyzed successfully. Now, the value of "login_string" contains the login/password information.
-	return 0
-}
-
-##############################################################################################
-# Function name: ase_start                                                                   #
-# Parameter: None                                                                            #
-# Return value:                                                                              #
-#             0  SUCCESS                                                                     #
-#             1  FAIL                                                                        #
-# Description: This function is used to start the ASE server in primary or secondary server. #
-##############################################################################################
-ase_start()
-{
-	ocf_log debug "ASEHAagent: Start 'ase_start'"
-
-	# Check if the server is running. If yes, return SUCCESS directly. Otherwise, continue the start work.
-	ase_is_running
-	if [[ $? = 0 ]]
-	then
-		# The server is running. 
-		ocf_log info "ASEHAagent: Server is running. Start is success."
-		return 0
-	fi
-
-	# The server is not running. We need to start it.
-	# If the log file existed, delete it.
-	if [[ -f $CONSOLE_LOG ]]
-	then
-		rm -f $CONSOLE_LOG
-	fi
-		
-	ocf_log debug "ASEHAagent: Starting '$OCF_RESKEY_server_name'..."
-
-	# Run runserver script to start the server. Since this script will be run by root and ASE server
-	# needs to be run by another user, we need to change the user to sybase_user first. Then, run
-	# the script to start the server.
-	su $OCF_RESKEY_sybase_user -c ksh << EOF
-		# set required SYBASE environment by running SYBASE.sh.
-		. $OCF_RESKEY_sybase_home/SYBASE.sh
-		# Run the RUNSERVER_SCRIPT to start the server.
-                . $RUNSERVER_SCRIPT > $CONSOLE_LOG 2>&1 &
-EOF
-
-	# Monitor every 1 seconds if the server has
-	# recovered, until RECOVERY_TIMEOUT.
-	t=0
-	while [[ $t -le $OCF_RESKEY_start_timeout ]]
-	do
-		grep -s "Recovery complete." $CONSOLE_LOG > /dev/null 2>&1
-		if [[ $? != 0 ]]
-		then
-			# The server has not completed the recovery. We need to continue to monitor the recovery
-			# process.
-			t=`expr $t + 1`
-		else
-			# The server has completed the recovery.
-			ocf_log info "ASEHAagent: ASE server '$OCF_RESKEY_server_name' started successfully."
-			break
-		fi
-		sleep 1
-	done
-
-	# If $t is larger than start_timeout, it means the ASE server cannot start in given time. Otherwise, it 
-	# means the ASE server has started successfully.
-	if [[ $t -gt $OCF_RESKEY_start_timeout ]]
-	then
-		# The server cannot start in specified time. We think the start is failed.
-		ocf_log err "ASEHAagent: Failed to start ASE server '$OCF_RESKEY_server_name'. Please check the server error log $CONSOLE_LOG for possible problems."
-		return 1
-	fi
-
-	ocf_log debug "ASEHAagent: End 'ase_start' successfully."
-
-	return 0
-}
-
-#############################################################################################
-# Function name: ase_stop                                                                   #
-# Parameter: None                                                                           #
-# Return value:                                                                             #
-#             0  SUCCESS                                                                    #
-#             1  FAIL                                                                       #
-# Description: This function is used to stop the ASE server in primary or secondary server. #
-#############################################################################################
-ase_stop()
-{
-	ocf_log debug "ASEHAagent: Start 'ase_stop'"
-
-	# Check if the ASE server is still running.
-	ase_is_running
-	if [[ $? != 0 ]]
-	then
-		# The ASE server is not running. We need not to shutdown it.
-		ocf_log info "ASEHAagent: The dataserver $OCF_RESKEY_server_name is not running."
-		return 0
-	fi
-
-	# Call get_login_string() to parse the login/password string
-	get_login_string
-	if [[ $? = 1 ]]
-	then
-		# The login account cannot be used. So we will kill the process directly.
-		ocf_log info "ASEHAagent: Cannot parse the login file $OCF_RESKEY_login_file. Kill the processes of ASE directly."
-		# Kill the OS processes immediately.
-		kill_ase 0
-		return $?
-	fi
-
-	# Just in case things are hung, start a process that will wait for the
-	# timeout period, then kill any remaining porcesses.  We'll need to
-	# monitor this process (set -m), so we can terminate it later if it is
-	# not needed.
-	set -m
-	$PROG kill &
-	KILL_PID=$!     # If successful, we will also terminate watchdog process
-
-	# Run "shutdown with nowait" from isql command line to shutdown the server
-	su $OCF_RESKEY_sybase_user -c ksh << EOF
-		# set required SYBASE environment by running SYBASE.sh.
-		. $OCF_RESKEY_sybase_home/SYBASE.sh
-		# Run "shutdown with nowait" to shutdown the server immediately.
-		(echo "use master" ; echo go ; echo "shutdown with nowait"; echo go) | \
-		\$SYBASE/\$SYBASE_OCS/bin/isql $login_string -S$OCF_RESKEY_server_name -I$OCF_RESKEY_interfaces_file  &
-EOF
-
-	sleep 5
-
-	# Check if the server has been shutted down successfully
-	t=0
-	while [[ $t -lt $OCF_RESKEY_shutdown_timeout ]]
-	do
-		# Search "usshutdown: exiting" in the server log. If found, it means the server has been shutted down. 
-		# Otherwise, we need to wait.
-		tail $CONSOLE_LOG | grep "ueshutdown: exiting" > /dev/null 2>&1
-		if [[ $? != 0 ]]
-		then
-			# The shutdown is still in processing. Wait...
-			sleep 2
-			t=`expr $t+2`
-		else
-			# The shutdown is success.
-			ocf_log info "ASEHAagent: ASE server '$OCF_RESKEY_server_name' shutdown with isql successfully."
-			break
-		fi
-	done
-
-	# If $t is larger than shutdown_timeout, it means the ASE server cannot be shutted down in given time. We need
-	# to wait for the background kill process to kill the OS processes directly.
-	if  [[ $t -ge $OCF_RESKEY_shutdown_timeout ]]
-	then
-		ocf_log err "ASEHAagent: Shutdown of '$OCF_RESKEY_server_name' from isql failed.  Server is either down or unreachable."
-	fi
-
-	# Here, the ASE server has been shutted down by isql command or killed by background process. We need to do
-	# further check to make sure all processes have gone away before saying shutdown is complete. This stops the
-	# other node from starting up the package before it has been stopped and the file system has been unmounted.
-	
-	# Get all processes ids from log file
-	declare -a ENGINE_ALL=(`sed -n -e '/engine /s/^.*os pid \([0-9]*\).*online$/\1/p' $CONSOLE_LOG`)
-	typeset -i num_procs=${#ENGINE_ALL[@]}
-
-	# We cannot find any process id from log file. It may be because the log file is corrupted or be deleted.
-	# In this case, we determine the shutdown is failed.
-	if [[ "${ENGINE_ALL[@]}" = "" ]]
-	then
-		ocf_log err "ASEHAagent: Unable to find the process id from $CONSOLE_LOG."
-		ocf_log err "ASEHAagent: Stop ASE server failed."
-		return 1
-	fi
-
-	# Monitor the system processes to make sure all ASE related processes have gone away.
-	while true
-	do
-		# To every engine process, search it in system processes list. If it is not in the
-		# list, it means this process has gone away. Otherwise, we need to wait for it is
-		# killed by background process.
-		for i in ${ENGINE_ALL[@]}
-		do
-			ps -fu $OCF_RESKEY_sybase_user | awk '{print $2}' | grep $i | grep -v grep
-			if [[ $? != 0 ]]
-			then
-				ocf_log debug "ASEHAagent: $i process has stopped."
-				c=0
-				while (( c < $num_procs ))
-				do
-					if [[ ${ENGINE_ALL[$c]} = $i ]]
-					then
-						unset ENGINE_ALL[$c]
-						c=$num_procs
-					fi
-					(( c = c + 1 ))	
-				done
-			fi
-		done
-		
-		# To here, all processes should have gone away. 
-		if [[ ${ENGINE_ALL[@]} = "" ]]
-		then
-			#
-			# Looks like shutdown was successful, so kill the
-			# script to kill any hung processes, which we started earlier.
-			# Check to see if the script is still running.  If jobs
-			# returns that the script is done, then we don't need to kill
-			# it.
-			#
-			job=$(jobs | grep -v Done)
-			if [[ ${job} != "" ]]
-			then
-				ocf_log debug "ASEHAagent: Killing the kill_ase script."
-
-				kill -15 $KILL_PID > /dev/null 2>&1
-			fi
-			break
-	        fi
-		sleep 5
-	done
-
-	ocf_log debug "ASEHAagent: End 'ase_stop'."
-
-	return 0
-}
-
-####################################################################################
-# Function name: ase_is_running                                                    #
-# Parameter: None                                                                  #
-# Return value:                                                                    #
-#             0   ASE server is running                                            #
-#             1   ASE server is not running or there are errors                    #
-# Description: This function is used to check if the ASE server is still running . #
-####################################################################################
-ase_is_running()
-{
-	# If the error log doesn't exist, we can say there is no ASE is running.
-	if [[ ! -f $CONSOLE_LOG ]]
-	then
-		return 1
-	fi
-
-	# The error log file exists. Check if the engine 0 is alive.
-	ENGINE_0=(`sed -n -e '/engine 0/s/^.*os pid \([0-9]*\).*online$/\1/p' $CONSOLE_LOG`)
-	if [[ "$ENGINE_0" = "" ]]
-	then
-		# The engine 0 is down.
-		return 1 
-	else
-		kill -s 0 $ENGINE_0 > /dev/null 2>&1
-		if [[ $? != 0 ]]
-		then
-			# The engine 0 is not running.
-			return 1
-		else
-			# The engine 0 is running.
-			return 0
-		fi
-        fi
-
-	return 1
-}
-
-####################################################################################
-# Function name: ase_is_running                                                    #
-# Parameter:                                                                       #
-#             DELAY  The seconds to wait before killing the ASE processes. 0 means #
-#                    kill the ASE processes immediately.                           #
-# Return value: None                                                               #
-#             1   ASE server is not running or there are errors                    #
-# Description: This function is used to check if the ASE server is still running . #
-####################################################################################
-kill_ase()
-{
-	ocf_log debug "ASEHAagent: Start 'kill_ase'."
-
-	DELAY=$1
-
-	# Wait for sometime before sending a kill signal.  
-	t=0
-        while [[ $t -lt $DELAY ]]
-        do
-     		sleep 1
-		t=`expr $t+1`
-        done
-
-	# Get the process ids from log file
-	declare -a ENGINE_ALL=`sed -n -e '/engine /s/^.*os pid \([0-9]*\).*online$/\1/p' $CONSOLE_LOG`
-
-	# If there is no process id found in the log file, we need not to continue.
-	if [[ "${ENGINE_ALL[@]}" = "" ]]
-	then
-		ocf_log err "ASEHAagent: Unable to find the process id from $CONSOLE_LOG."
-		return
-	fi
-
-	# Kill the datasever process(es)
-	for pid in ${ENGINE_ALL[@]}
-	do
-		kill -9 $pid > /dev/null 2>&1
-		if [[ $? != 0 ]]
-		then
-			ocf_log info "ASEHAagent: kill_ase function did NOT find process $pid running."
-		else
-			ocf_log info "ASEHAagent: kill_ase function did find process $pid running.  Sent SIGTERM."
-		fi
-	done
-
-	ocf_log debug "ASEHAagent: End 'kill_ase'."
-}
-
-
-#######################################################################################
-# Function name: terminate                                                            #
-# Parameter: None                                                                     #
-# Return value: Always be 1                                                           #
-# Description: This function is called automatically after this script is terminated. #
-#######################################################################################
-terminate()
-{
-	ocf_log debug "ASEHAagent: This monitor script has been signaled to terminate."
-	exit 1
-}
-
-#####################################################################################
-# Function name: ase_status                                                         #
-# Parameter:                                                                        #
-#             0   Level 0 probe. In this level, we just check if engine 0 is alive  #
-#             10  Level 10 probe. In this level, we need to probe if the ASE server #
-#                 still has response.                                               #              
-# Return value:                                                                     #
-#             0   The server is still alive                                         #
-#             1   The server is down                                                #
-# Description: This function is used to check if the ASE server is still running.   #
-#####################################################################################
-ase_status()
-{
-	ocf_log debug "ASEHAagent: Start 'ase_status'."
-
-	# Step 1: Check if the engine 0 is alive
-	ase_is_running
-	if [[ $? = 1 ]]
-	then
-		# ASE is down. Return fail to rgmanager to trigger the failover process.
-		ocf_log err "ASEHAagent: ASE server is down."
-		return 1
-	fi
-
-	# ASE process is still alive. 
-	# Step2: If this is level 10 probe, We need to check if the ASE server still has response.
-	if [[ $1 -gt 0 ]]
-	then
-		ocf_log debug "ASEHAagent: Need to run deep probe."
-		# Run deep probe
-		deep_probe
-		if [[ $? = 1 ]]
-		then
-			# Deep probe failed. This means the server has been down.
-			ocf_log err "ASEHAagent: Deep probe found the ASE server is down."
-			return 1
-		fi
-	fi
-
-	ocf_log debug "ASEHAagent: End 'ase_status'."
-
-	return 0
-}
-
-####################################################################################
-# Function name: deep_probe                                                        #
-# Parameter: None                                                                  #
-# Return value:                                                                    #
-#             0   ASE server is alive                                              #
-#             1   ASE server is down                                               #
-# Description: This function is used to run deep probe to make sure the ASE server #
-#              still has response.                                                 #
-####################################################################################
-deep_probe()
-{
-	declare -i rv
-	
-	ocf_log debug "ASEHAagent: Start 'deep_probe'."	
-
-	# Declare two temporary files which will be used in this probe.
-	tmpfile1="$(mktemp /tmp/ASEHAagent.1.XXXXXX)"
-	tmpfile2="$(mktemp /tmp/ASEHAagent.2.XXXXXX)"
-	
-	# Get the login_string by analyzing the login_file.
-	get_login_string
-	if [[ $? = 1 ]]
-	then
-		# Login string cannot be fetched. Cannot continue the deep probe.
-		ocf_log err "ASEHAagent: Cannot run the deep probe because of incorrect login file $OCF_RESKEY_login_file. Deep probe failed."
-		return 1
-	fi
-
-	rm -f $tmpfile1
-	rm -f $tmpfile2
-
-	# The login file is correct. We have gotten the login account and password from it.
-	# Run isql command in background.
-	su $OCF_RESKEY_sybase_user -c ksh << EOF
-		# set required SYBASE environment by running SYBASE.sh.
-		. $OCF_RESKEY_sybase_home/SYBASE.sh
-		# Run a very simple SQL statement to make sure the server is still ok. The output will be put to
-		# tmpfile1.
-		(echo "select 1"; echo "go") |
-		\$SYBASE/\$SYBASE_OCS/bin/isql $login_string -S$OCF_RESKEY_server_name -I$OCF_RESKEY_interfaces_file -t $OCF_RESKEY_deep_probe_timeout -e -o$tmpfile1 &
-		# Record the isql command process id to temporary file. If the isql is hung, we need this process id
-                # to kill the hung process.
-		echo \$! > $tmpfile2	
-EOF
-	
-	declare -i t=0
-		
-	# Monitor the output file tmpfile1.
-	while [[ $t -lt $OCF_RESKEY_deep_probe_timeout ]]
-	do
-		# If the SQL statement is executed successfully, we will get the following output:
-		# 1> select 1
-		# 
-		# -----------
-		#           1
-		# 
-		# (1 row affected)
-		# So, we determine if the execution is success by searching the keyword "(1 row affected)".
-		grep "(1 row affected)" $tmpfile1
-		if [[ $? = 0 ]]
-		then
-			ocf_log debug "ASEHAagent: Deep probe sucess."
-			break
-		else
-			sleep 1
-			t=`expr $t+1`
-		fi
-	done	
-
-	# If $t is larger than deep_probe_timeout, it means the isql command line cannot finish in given time.
-	# This means the deep probe failed. We need to kill the isql process manually.
-	if [[ $t -ge $OCF_RESKEY_deep_probe_timeout ]]
-	then
-		ocf_log err "ASEHAagent: Deep probe fail. The dataserver has no response."		
-
-		# Read the process id of isql process from tmpfile2
-		pid=`cat $tmpfile2 | awk '{print $1}'`
-
-		rm -f $tmpfile1
-		rm -f $tmpfile2
-
-		# Kill the isql process directly.
-		kill -9 $pid
-		return 1
-	fi
-
-	rm -f $tmpfile1
-	rm -f $tmpfile2
-
-	ocf_log debug "ASEHAagent: End 'deep_probe'."
-
-	return 0
-}
-
-trap terminate SIGTERM
-
-#############################
-# Do some real work here... #
-#############################
-case $1 in
-	start)
-		verify_all || exit 1
-		ase_start
-		exit $?
-		;;
-	stop)
-		verify_all || exit 1
-		ase_stop
-		exit $?
-		;;
-	status | monitor)
-		verify_all || exit 1
-		ase_status $OCF_CHECK_LEVEL
-		exit $?
-		;;
-	kill)
-		kill_ase $OCF_RESKEY_shutdown_timeout
-		;;
-	meta-data)
-		meta_data
-		exit $?
-		;;
-	validate-all)
-		verify_all
-		exit $?
-		;;
-	*)
-		echo "Usage: $SCRIPT {start|stop|monitor|status|validate-all|meta-data}"
-		exit $OCF_ERR_UNIMPLEMENTED
-		;;
-esac
-exit 0
-
diff --git a/rgmanager/src/resources/Makefile b/rgmanager/src/resources/Makefile
deleted file mode 100644
index 12a3f84..0000000
--- a/rgmanager/src/resources/Makefile
+++ /dev/null
@@ -1,78 +0,0 @@
-TARGET1=utils/config-utils.sh
-TARGET2=fs.sh
-TARGET3=oracledb.sh
-
-all: $(TARGET1) $(TARGET2) $(TARGET3)
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/clean.mk
-
-RESOURCES=service.sh ip.sh nfsclient.sh nfsexport.sh \
-	script.sh netfs.sh clusterfs.sh smb.sh \
-	apache.sh openldap.sh samba.sh mysql.sh \
-	postgres-8.sh tomcat-5.sh lvm.sh \
-	vm.sh SAPInstance SAPDatabase named.sh \
-	ASEHAagent.sh
-
-METADATA=apache.metadata openldap.metadata samba.metadata \
-	mysql.metadata postgres-8.metadata tomcat-5.metadata \
-	named.metadata lvm.metadata default_event_script.sl \
-	follow-service.sl
-
-GENERAL_TARGETS=ocf-shellfuncs svclib_nfslock lvm_by_lv.sh lvm_by_vg.sh
-
-UTIL_TARGETS= \
-	utils/ra-skelet.sh utils/messages.sh \
-	utils/httpd-parse-config.pl utils/tomcat-parse-config.pl \
-	utils/member_util.sh
-
-$(TARGET1):
-	mkdir -p utils
-	cat $(S)/$(TARGET1).in | sed \
-		-e 's#@CONFDIR@#${CONFDIR}#g' \
-		-e 's#@CONFFILE@#${CONFFILE}#g' \
-	> $(TARGET1)
-
-$(TARGET2):
-	cat $(S)/$(TARGET2).in | sed \
-		-e 's#@LOGDIR@#${logdir}#g' \
-	> $(TARGET2)
-
-$(TARGET3):
-	cat $(S)/$(TARGET3).in | sed \
-		-e 's#@LOGDIR@#${logdir}#g' \
-	> $(TARGET3)
-
-install:
-	install -d ${sharedir}/utils
-	for i in $(RESOURCES); do \
-	 install -m755 $(S)/$$i ${sharedir}; \
-	done
-	for i in $(METADATA); do \
-	 install -m644 $(S)/$$i ${sharedir}; \
-	done
-	for i in $(GENERAL_TARGETS); do \
-	 install -m755 $(S)/$$i ${sharedir}; \
-	done
-	for i in $(UTIL_TARGETS); do \
-	 install -m755 $(S)/$$i ${sharedir}/utils; \
-	done
-	install -m755 $(TARGET1) ${sharedir}/utils
-	install -m755 $(TARGET2) $(TARGET3) ${sharedir}
-
-uninstall:
-	${UNINSTALL} ${RESOURCES} ${GENERAL_TARGETS} \
-		     ${METADATA} ${UTIL_TARGETS} \
-		     $(TARGET1) $(TARGET2) $(TARGET3) \
-		     ${sharedir}
-
-clean: generalclean
-
-check: $(RESOURCES) $(TARGET2) $(TARGET3) ra-api-1-modified.dtd
-	@echo Validating resource agent meta-data
-	@for f in $(RESOURCES); do \
-		echo "   ./$$f "; \
-		./$$f meta-data | xmllint --dtdvalid \
-				  ./ra-api-1-modified.dtd --noout -; \
-		if [ $$? -ne 0 ]; then exit 1; fi \
-	done
diff --git a/rgmanager/src/resources/SAPDatabase b/rgmanager/src/resources/SAPDatabase
deleted file mode 100644
index 70adbcc..0000000
--- a/rgmanager/src/resources/SAPDatabase
+++ /dev/null
@@ -1,1000 +0,0 @@
-#!/bin/sh
-#
-# SAPDatabase
-#
-# Description:	Manages any type of SAP supported database instance
-#               as a High-Availability OCF compliant resource.
-#
-# Author:       Alexander Krauth, October 2006
-# Support:      linux@sap.com
-# License:      GNU General Public License (GPL)
-# Copyright:    (c) 2006, 2007 Alexander Krauth
-#
-# An example usage: 
-#      See usage() function below for more details...
-#
-# OCF instance parameters:
-#	OCF_RESKEY_SID
-#       OCF_RESKEY_DIR_EXECUTABLE   (optional, well known directories will be searched by default)
-#       OCF_RESKEY_DBTYPE
-#       OCF_RESKEY_NETSERVICENAME   (optional, non standard name of Oracle Listener)
-#       OCF_RESKEY_DBJ2EE_ONLY      (optional, default is false)
-#       OCF_RESKEY_JAVA_HOME        (optional, only needed if DBJ2EE_ONLY is true and JAVA_HOME enviroment variable is not set)
-#       OCF_RESKEY_STRICT_MONITORING (optional, activate application level monitoring - with Oracle a failover will occur in case of an archiver stuck)
-#       OCF_RESKEY_AUTOMATIC_RECOVER (optional, automatic startup recovery, default is false)
-#       OCF_RESKEY_DIR_BOOTSTRAP    (optional, if non standard J2EE server directory)
-#       OCF_RESKEY_DIR_SECSTORE     (optional, if non standard J2EE secure store directory)
-#       OCF_RESKEY_DB_JARS          (optional, if maintained in bootstrap.properties, mandatory for WebAS Java 7.10)
-#	OCF_RESKEY_PRE_START_USEREXIT	(optional, lists a script which can be executed before the resource is started)
-#	OCF_RESKEY_POST_START_USEREXIT	(optional, lists a script which can be executed after the resource is started)
-#	OCF_RESKEY_PRE_STOP_USEREXIT	(optional, lists a script which can be executed before the resource is stopped)
-#	OCF_RESKEY_POST_STOP_USEREXIT	(optional, lists a script which can be executed after the resource is stopped)
-#
-# ToDo:
-# Remove all the database dependend stuff from the agent and use
-# saphostcontrol daemon as soon as SAP will release it.
-#
-#######################################################################
-# Initialization:
-
-if [ -f ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs ]; then
-        . ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs
-elif [ -f /usr/share/cluster/ocf-shellfuncs ]; then
-        . /usr/share/cluster/ocf-shellfuncs
-else
-        echo Could not find ocf-shellfuncs!
-        exit 1
-fi
-
-#######################################################################
-
-SH=/bin/sh
-
-usage() {
-  methods=`sapdatabase_methods`
-  methods=`echo $methods | tr ' ' '|'`
-  cat <<-!
-	usage: $0 ($methods)
-
-	$0 manages a SAP database of any type as an HA resource.
-        Currently Oracle, MaxDB and DB/2 UDB are supported.
-        ABAP databases as well as JAVA only databases are supported.
-
-	The 'start' operation starts the instance.
-	The 'stop' operation stops the instance.
-	The 'status' operation reports whether the instance is running
-	The 'monitor' operation reports whether the instance seems to be working
-	The 'validate-all' operation reports whether the parameters are valid
-	The 'methods' operation reports on the methods $0 supports
-
-	!
-}
-
-meta_data() {
-	cat <<END
-<?xml version="1.0"?>
-<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="SAPDatabase">
-<version>1.92</version>
-
-<longdesc lang="en">
-Resource script for SAP databases. It manages a SAP database of any type as an HA resource.
-</longdesc>
-<shortdesc lang="en">SAP database resource agent</shortdesc>
-
-<parameters>
- <parameter name="SID" unique="1" required="1">
-  <longdesc lang="en">The unique SAP system identifier. e.g. P01</longdesc>
-  <shortdesc lang="en">SAP system ID</shortdesc>
-  <content type="string" default="" />
- </parameter>
- <parameter name="DIR_EXECUTABLE" unique="0" required="0">
-  <longdesc lang="en">The full qualified path where to find sapstartsrv and sapcontrol.</longdesc>
-  <shortdesc lang="en">path of sapstartsrv and sapcontrol</shortdesc>
-  <content type="string" default="" />
- </parameter>
- <parameter name="DBTYPE" unique="0" required="1">
-  <longdesc lang="en">The name of the database vendor you use. Set either: ORA,DB6,ADA</longdesc>
-  <shortdesc lang="en">database vendor</shortdesc>
-  <content type="string" default="" />
- </parameter>
- <parameter name="NETSERVICENAME" unique="0" required="0">
-  <longdesc lang="en">The Oracle TNS listener name.</longdesc>
-  <shortdesc lang="en">listener name</shortdesc>
-  <content type="string" default="" />
- </parameter>
- <parameter name="DBJ2EE_ONLY" unique="0" required="0">
-  <longdesc lang="en">If you do not have a ABAP stack installed in the SAP database, set this to TRUE</longdesc>
-  <shortdesc lang="en">only JAVA stack installed</shortdesc>
-  <content type="boolean" default="false"/>
- </parameter>
- <parameter name="JAVA_HOME" unique="0" required="0">
-  <longdesc lang="en">This is only needed if the DBJ2EE_ONLY parameter is set to true. Enter the path to the Java SDK which is used by the SAP WebAS Java</longdesc>
-  <shortdesc lang="en">Path to Java SDK</shortdesc>
-  <content type="string" default=""/>
- </parameter>
- <parameter name="STRICT_MONITORING" unique="0" required="0">
-  <longdesc lang="en">This controls how the resource agent monitors the database. If set to true, it will use SAP tools to test the connect to the database. Do not use with Oracle, because it will result in unwanted failovers in case of an archiver stuck</longdesc>
-  <shortdesc lang="en">Activates application level monitoring</shortdesc>
-  <content type="boolean" default="false"/>
- </parameter>
- <parameter name="AUTOMATIC_RECOVER" unique="0" required="0">
-  <longdesc lang="en">The SAPDatabase resource agent tries to recover a failed start attempt automaticaly one time. This is done by running a forced abort of the RDBMS and/or executing recovery commands.</longdesc>
-  <shortdesc lang="en">Enable or disable automatic startup recovery</shortdesc>
-  <content type="boolean" default="false"/>
- </parameter>
- <parameter name="DIR_BOOTSTRAP" unique="0" required="0">
-  <longdesc lang="en">The full qualified path where to find the J2EE instance bootstrap directory. e.g. /usr/sap/P01/J00/j2ee/cluster/bootstrap</longdesc>
-  <shortdesc lang="en">path to j2ee bootstrap directory</shortdesc>
-  <content type="string" default="" />
- </parameter>
- <parameter name="DIR_SECSTORE" unique="0" required="0">
-  <longdesc lang="en">The full qualified path where to find the J2EE security store directory. e.g. /usr/sap/P01/SYS/global/security/lib/tools</longdesc>
-  <shortdesc lang="en">path to j2ee secure store directory</shortdesc>
-  <content type="string" default="" />
- </parameter>
- <parameter name="DB_JARS" unique="0" required="0">
-  <longdesc lang="en">The full qualified filename of the jdbc driver for the database connection test. It will be automaticaly read from the bootstrap.properties file in Java engine 6.40 and 7.00. For Java engine 7.10 the parameter is mandatory.</longdesc>
-  <shortdesc lang="en">file name of the jdbc driver</shortdesc>
-  <content type="string" default="" />
- </parameter>
- <parameter name="PRE_START_USEREXIT" unique="0" required="0">
-  <longdesc lang="en">The full qualified path where to find a script or program which should be executed before this resource gets started.</longdesc>
-  <shortdesc lang="en">path to a pre-start script</shortdesc>
-  <content type="string" default="" />
- </parameter>
- <parameter name="POST_START_USEREXIT" unique="0" required="0">
-  <longdesc lang="en">The full qualified path where to find a script or program which should be executed after this resource got started.</longdesc>
-  <shortdesc lang="en">path to a post-start script</shortdesc>
-  <content type="string" default="" />
- </parameter>
- <parameter name="PRE_STOP_USEREXIT" unique="0" required="0">
-  <longdesc lang="en">The full qualified path where to find a script or program which should be executed before this resource gets stopped.</longdesc>
-  <shortdesc lang="en">path to a pre-start script</shortdesc>
-  <content type="string" default="" />
- </parameter>
- <parameter name="POST_STOP_USEREXIT" unique="0" required="0">
-  <longdesc lang="en">The full qualified path where to find a script or program which should be executed after this resource got stopped.</longdesc>
-  <shortdesc lang="en">path to a post-start script</shortdesc>
-  <content type="string" default="" />
- </parameter>
-</parameters>
-
-<actions>
-<action name="start" timeout="1800" />
-<action name="stop" timeout="1800" />
-<action name="status" depth="0" timeout="60" interval="120" start-delay="180" />
-<action name="monitor" depth="0" timeout="60" interval="120" start-delay="180" />
-<action name="validate-all" timeout="5" />
-<action name="meta-data" timeout="5" />
-<action name="methods" timeout="5" />
-</actions>
-</resource-agent>
-END
-}
-
-trap_handler() {
-  rm -f $TEMPFILE
-  exit $OCF_ERR_GENERIC
-}
-
-
-#
-# listener_start: Start the given listener
-#
-listener_start() {
-  orasid="ora`echo $SID | tr [:upper:] [:lower:]`"
-  rc=$OCF_SUCCESS
-  output=`echo "lsnrctl start $NETSERVICENAME" | su - $orasid 2>&1`
-  if [ $? -eq 0 ]
-  then
-    ocf_log info "Oracle Listener $NETSERVICENAME started: $output"
-    rc=$OCF_SUCCESS
-  else
-    ocf_log err "Oracle Listener $NETSERVICENAME start failed: $output"
-    rc=$OCF_ERR_GENERIC
-  fi
-  return $rc
-}
-
-#
-# listener_stop: Stop the given listener
-#
-listener_stop() {
-  orasid="ora`echo $SID | tr [:upper:] [:lower:]`"
-  rc=$OCF_SUCCESS
-  if
-      listener_status
-  then
-      : listener is running, trying to stop it later...
-  else
-      return $OCF_SUCCESS
-  fi
-  output=`echo "lsnrctl stop $NETSERVICENAME" | su - $orasid 2>&1`
-  if [ $? -eq 0 ]
-  then
-    ocf_log info "Oracle Listener $NETSERVICENAME stopped: $output"
-  else
-    ocf_log err "Oracle Listener $NETSERVICENAME stop failed: $output"
-    rc=$OCF_ERR_GENERIC
-  fi
-  return $rc
-}
-
-#
-# listener_status: is the given listener running?
-#
-listener_status() {
-  orasid="ora`echo $SID | tr [:upper:] [:lower:]`"
-  # Note: ps cuts off it's output at column $COLUMNS, so "ps -ef" can not be used here
-  # as the output might be to long.
-  cnt=`ps efo args --user $orasid | grep $NETSERVICENAME | grep -c tnslsnr`
-  if [ $cnt -eq 1 ]
-  then
-    rc=$OCF_SUCCESS
-  else
-    ocf_log info "listener process not running for $NETSERVICENAME for $SID"
-    rc=$OCF_ERR_GENERIC
-  fi
-  return $rc
-}
-
-#
-# x_server_start: Start the given x_server
-#
-x_server_start() {
-  rc=$OCF_SUCCESS
-  output=`echo "x_server start" | su - $sidadm 2>&1`
-  if [ $? -eq 0 ]
-  then
-    ocf_log info "MaxDB x_server start: $output"
-    rc=$OCF_SUCCESS
-  else
-    ocf_log err "MaxDB x_server start failed: $output"
-    rc=$OCF_ERR_GENERIC
-  fi
-  return $rc
-}
-
-#
-# x_server_stop: Stop the x_server
-#
-x_server_stop() {
-  rc=$OCF_SUCCESS
-  output=`echo "x_server stop" | su - $sidadm 2>&1`
-  if [ $? -eq 0 ]
-  then
-    ocf_log info "MaxDB x_server stop: $output"
-  else
-    ocf_log err "MaxDB x_server stop failed: $output"
-    rc=$OCF_ERR_GENERIC
-  fi
-  return $rc
-}
-
-#
-# x_server_status: is the x_server running?
-#
-x_server_status() {
-  sdbuser=`grep "^SdbOwner" /etc/opt/sdb | awk -F'=' '{print $2}'`
-  # Note: ps cuts off it's output at column $COLUMNS, so "ps -ef" can not be used here
-  # as the output might be to long.
-  cnt=`ps efo args --user $sdbuser | grep -c vserver`
-  if [ $cnt -ge 1 ]
-  then
-    rc=$OCF_SUCCESS
-  else
-    ocf_log info "x_server process not running"
-    rc=$OCF_ERR_GENERIC
-  fi
-  return $rc
-}
-
-#
-# oracle_stop: Stop the Oracle database without any condition
-#
-oracle_stop() {
-echo '#!/bin/sh
-LOG=$HOME/stopdb.log
-date > $LOG
-
-if [ -x "${ORACLE_HOME}/bin/sqlplus" ]
-then
-    SRVMGRDBA_EXE="${ORACLE_HOME}/bin/sqlplus"
-else
-   echo "Can not find executable sqlplus" >> $LOG
-   exit 1
-fi
-
-$SRVMGRDBA_EXE /NOLOG >> $LOG << !
-connect / as sysdba
-shutdown immediate
-exit
-!
-rc=$?
-cat $LOG
-exit $rc' > $TEMPFILE
-
-chmod 700 $TEMPFILE
-chown $sidadm $TEMPFILE
-
-su - $sidadm -c $TEMPFILE
-retcode=$?
-rm -f $TEMPFILE
-
-if [ $retcode -eq 0 ]; then
-  sapdatabase_status
-  if [ $? -ne $OCF_NOT_RUNNING ]; then
-    retcode=1
-  fi
-fi
-
-return $retcode
-}
-
-#
-# maxdb_stop: Stop the MaxDB database without any condition
-#
-maxdb_stop() {
-
-# x_Server must be running to stop database
-x_server_status
-if [ $? -ne $OCF_SUCCESS ]; then x_server_start; fi
-
-if [ $DBJ2EE_ONLY -eq 1 ]; then
-   userkey=c_J2EE
-else
-   userkey=c
-fi
-
-echo "#!/bin/sh
-LOG=\$HOME/stopdb.log
-date > \$LOG
-echo \"Stop database with xuserkey >$userkey<\" >> \$LOG
-dbmcli -U ${userkey} db_offline >> \$LOG 2>&1
-exit \$?" > $TEMPFILE
-
-chmod 700 $TEMPFILE
-chown $sidadm $TEMPFILE
-
-su - $sidadm -c $TEMPFILE
-retcode=$?
-rm -f $TEMPFILE
-
-if [ $retcode -eq 0 ]; then
-  sapdatabase_status
-  if [ $? -ne $OCF_NOT_RUNNING ]; then
-    retcode=1
-  fi
-fi
-
-return $retcode
-}
-
-#
-# db6udb_stop: Stop the DB2/UDB database without any condition
-#
-db6udb_stop() {
-echo '#!/bin/sh
-LOG=$HOME/stopdb.log
-date > $LOG
-echo "Shut down the database" >> $LOG
-$INSTHOME/sqllib/bin/db2 deactivate database $DB2DBDFT |tee -a $LOG  2>&1
-$INSTHOME/sqllib/adm/db2stop force |tee -a $LOG  2>&1
-exit $?' > $TEMPFILE
-
-chmod 700 $TEMPFILE
-chown $sidadm $TEMPFILE
-
-su - $sidadm -c $TEMPFILE
-retcode=$?
-rm -f $TEMPFILE
-
-if [ $retcode -eq 0 ]; then
-  sapdatabase_status
-  if [ $? -ne $OCF_NOT_RUNNING ]; then
-    retcode=1
-  fi
-fi
-
-return $retcode
-}
-
-#
-# oracle_recover: try to clean up oracle after a crash
-#
-oracle_recover() {
-echo '#!/bin/sh
-LOG=$HOME/recover.log
-date > $LOG
-echo "Logfile written by heartbeat SAPDatabase resource agent" >> $LOG
-
-if [ -x "${ORACLE_HOME}/bin/sqlplus" ]
-then
-    SRVMGRDBA_EXE="${ORACLE_HOME}/bin/sqlplus"
-else
-   echo "Can not find executable sqlplus" >> $LOG
-   exit 1
-fi
-
-$SRVMGRDBA_EXE /NOLOG >> $LOG << !
-connect / as sysdba
-shutdown abort
-startup mount
-WHENEVER SQLERROR EXIT SQL.SQLCODE
-WHENEVER OSERROR EXIT FAILURE
-alter database recover automatic database;
-alter database open;
-exit
-!
-rc=$?
-cat $LOG
-exit $rc' > $TEMPFILE
-
-  chmod 700 $TEMPFILE
-  chown $sidadm $TEMPFILE
-
-  su - $sidadm -c $TEMPFILE
-  retcode=$?
-  rm -f $TEMPFILE
-
-  return $retcode
-}
-
-#
-# maxdb_recover: try to clean up MaxDB after a crash
-#
-maxdb_recover() {
-  # x_Server must be running to stop database
-  x_server_status
-  if [ $? -ne $OCF_SUCCESS ]; then x_server_start; fi
-
-  if [ $DBJ2EE_ONLY -eq 1 ]; then
-     userkey=c_J2EE
-  else
-     userkey=c
-  fi
-
-echo "#!/bin/sh
-LOG=\$HOME/recover.log
-date > \$LOG
-echo \"Logfile written by heartbeat SAPDatabase resource agent\" >> \$LOG
-echo \"Cleanup database with xuserkey >$userkey<\" >> \$LOG
-echo \"db_stop\" >> \$LOG 2>&1
-dbmcli -U ${userkey} db_stop >> \$LOG 2>&1
-echo \"db_clear\" >> \$LOG 2>&1
-dbmcli -U ${userkey} db_clear >> \$LOG 2>&1
-echo \"db_online\" >> \$LOG 2>&1
-dbmcli -U ${userkey} db_online >> \$LOG 2>&1
-rc=\$?
-cat \$LOG
-exit \$rc" > $TEMPFILE
-
-  chmod 700 $TEMPFILE
-  chown $sidadm $TEMPFILE
-
-  su - $sidadm -c $TEMPFILE
-  retcode=$?
-  rm -f $TEMPFILE
-
-  return $retcode
-}
-
-#
-# db6udb_recover: try to recover DB/2 after a crash
-#
-db6udb_recover() {
-  db2sid="db2`echo $SID | tr [:upper:] [:lower:]`"
-
-echo '#!/bin/sh
-LOG=$HOME/recover.log
-date > $LOG
-echo "Logfile written by heartbeat SAPDatabase resource agent" >> $LOG
-$INSTHOME/sqllib/bin/db2_kill >> $LOG  2>&1
-$INSTHOME/sqllib/adm/db2start >> $LOG  2>&1
-$INSTHOME/sqllib/bin/db2 activate database $DB2DBDFT >> $LOG  2>&1
-rc=$?
-cat $LOG
-exit $rc' > $TEMPFILE
-
-  chmod 700 $TEMPFILE
-  chown $db2sid $TEMPFILE
-
-  su - $db2sid -c $TEMPFILE
-  retcode=$?
-  rm -f $TEMPFILE
-
-  return $retcode
-}
-
-#
-# methods: What methods/operations do we support?
-#
-sapdatabase_methods() {
-  cat <<-!
-	start
-	stop
-	status
-	monitor
-	validate-all
-	methods
-	meta-data
-	usage
-	!
-}
-
-
-#
-# sapuserexit : Many SAP customers need some additional processes/tools to run their SAP systems.
-#               This specialties do not allow a totally generic SAP cluster resource agent.
-#               Someone should write a resource agent for each additional process you need, if it
-#               is required to monitor that process within the cluster manager. To enable
-#               you to extent this resource agent without developing a new one, this user exit
-#               was introduced.
-#
-sapuserexit() {
-  NAME="$1"
-  VALUE="$2"
-
-  if [ -n "$VALUE" ]
-  then
-    if [ -x "$VALUE" ]
-    then
-      ocf_log info "Calling userexit ${NAME} with customer script file ${VALUE}"
-      eval "$VALUE" >& /dev/null
-      ocf_log info "Exiting userexit ${NAME} with customer script file ${VALUE}, returncode: $?"
-    else
-      ocf_log warn "Attribute ${NAME} is set to ${VALUE}, but this file is not executable"
-    fi
-  fi
-  return 0
-}
-
-
-#
-# sapdatabase_start : Start the SAP database
-#
-sapdatabase_start() {
-  sapuserexit PRE_START_USEREXIT "$OCF_RESKEY_PRE_START_USEREXIT"
-
-  case $DBTYPE in
-    ADA) x_server_start
-         ;;
-    ORA) listener_start
-         ;;
-  esac
-
-  output=`su - $sidadm -c $SAPSTARTDB`
-  rc=$?
-
-  if [ $DBJ2EE_ONLY -eq 1 ]
-  then
-    sapdatabase_monitor 1
-    rc=$?
-  fi
-
-  if [ $rc -ne 0 -a $OCF_RESKEY_AUTOMATIC_RECOVER -eq 1 ]
-  then
-    ocf_log warn "SAP database $SID start failed: $output"
-    ocf_log warn "Try to recover database $SID"
-
-    output=''
-    sapdatabase_recover
-    rc=$?
-  fi
-
-  if [ $rc -eq 0 ]
-  then
-    ocf_log info "SAP database $SID started: $output"
-    rc=$OCF_SUCCESS
-    sapuserexit POST_START_USEREXIT "$OCF_RESKEY_POST_START_USEREXIT"
-  else
-    ocf_log err "SAP database $SID start failed: $output"
-    rc=$OCF_ERR_GENERIC
-  fi
-
-  return $rc
-}
-
-#
-# sapdatabase_stop: Stop the SAP database
-#
-sapdatabase_stop() {
-
-  sapuserexit PRE_STOP_USEREXIT "$OCF_RESKEY_PRE_STOP_USEREXIT"
-
-  # use of the stopdb kernel script is not possible, because there are to may checks in that
-  # script. We want to stop the database regardless of anything.
-  #output=`su - $sidadm -c $SAPSTOPDB`
-
-  case $DBTYPE in
-    ORA) output=`oracle_stop`
-         ;;
-    ADA) output=`maxdb_stop`
-         ;;
-    DB6) output=`db6udb_stop`
-         ;;
-  esac
-
-  if [ $? -eq 0 ]
-  then
-    ocf_log info "SAP database $SID stopped: $output"
-    rc=$OCF_SUCCESS
-  else
-    ocf_log err "SAP database $SID stop failed: $output"
-    rc=$OCF_ERR_GENERIC
-  fi
-
-  case $DBTYPE in
-    ORA) listener_stop
-         ;;
-    ADA) x_server_stop
-         ;;
-  esac
-
-  sapuserexit POST_STOP_USEREXIT "$OCF_RESKEY_POST_STOP_USEREXIT"
-
-  return $rc
-}
-
-
-#
-# sapdatabase_monitor: Can the given database instance do anything useful?
-#
-sapdatabase_monitor() {
-  strict=$1
-  rc=$OCF_SUCCESS
-
-  case $DBTYPE in
-    ADA) x_server_status 
-         if [ $? -ne $OCF_SUCCESS ]; then x_server_start; fi
-         ;;
-    ORA) listener_status
-         if [ $? -ne $OCF_SUCCESS ]; then listener_start; fi
-         ;;
-  esac
-
-  if [ $strict -eq 0 ]
-  then
-    sapdatabase_status
-    rc=$?
-  else
-    if [ $DBJ2EE_ONLY -eq 0 ]
-    then
-      output=`echo "$SAPDBCONNECT -d -w /dev/null" | su $sidadm 2>&1`
-      if [ $? -le 4 ]
-      then
-        rc=$OCF_SUCCESS
-      else
-        rc=$OCF_NOT_RUNNING
-      fi
-    else
-      MYCP=""
-      EXECMD=""
-
-      # WebAS Java 6.40+7.00
-      IAIK_JCE="$SECSTORE"/iaik_jce.jar
-      IAIK_JCE_EXPORT="$SECSTORE"/iaik_jce_export.jar
-      EXCEPTION="$BOOTSTRAP"/exception.jar
-      LOGGING="$BOOTSTRAP"/logging.jar
-      OPENSQLSTA="$BOOTSTRAP"/opensqlsta.jar
-      TC_SEC_SECSTOREFS="$BOOTSTRAP"/tc_sec_secstorefs.jar
-      JDDI="$BOOTSTRAP"/../server0/bin/ext/jdbdictionary/jddi.jar
-      ANTLR="$BOOTSTRAP"/../server0/bin/ext/antlr/antlr.jar
-      FRAME="$BOOTSTRAP"/../server0/bin/system/frame.jar
-  
-      # only start jdbcconnect when all jars available
-      if [ -f "$EXCEPTION" -a -f "$LOGGING" -a -f "$OPENSQLSTA" -a -f "$TC_SEC_SECSTOREFS" -a -f "$JDDI" -a -f "$ANTLR" -a -f "$FRAME" -a -f "$SAPDBCONNECT" ]
-      then
-        MYCP=".:$FRAME:$ANTLR:$JDDI:$IAIK_JCE_EXPORT:$IAIK_JCE:$EXCEPTION:$LOGGING:$OPENSQLSTA:$TC_SEC_SECSTOREFS:$DB_JARS:$SAPDBCONNECT" 
-        EXECMD="com.sap.inst.jdbc.connect.JdbcCon -sec $SID:$SID"
-      else
-      # WebAS Java 7.10
-        LAUNCHER=${BOOTSTRAP}/sap.com~tc~bl~offline_launcher~impl.jar
-
-        if [ -f "$DB_JARS" -a -f "$SAPDBCONNECT" -a -f "$LAUNCHER" ]
-        then
-          MYCP="$LAUNCHER"
-          EXECMD="com.sap.engine.offline.OfflineToolStart com.sap.inst.jdbc.connect.JdbcCon ${SAPDBCONNECT}:${SECSTORE}:${DB_JARS}:${BOOTSTRAP} -sec $SID:$SID"
-        fi
-      fi
-
-      if [ -n "$EXECMD" ]
-      then
-        output=`eval ${JAVA_HOME}/bin/java -cp $MYCP $EXECMD`
-        if [ $? -le 0 ]
-        then
-          rc=$OCF_SUCCESS
-        else
-          rc=$OCF_NOT_RUNNING
-        fi
-      else
-        output="Cannot find all jar files needed for database monitoring."
-        rc=$OCF_ERR_GENERIC
-      fi
-    fi
-  fi
-
-  if [ $rc -ne $OCF_SUCCESS ]
-  then
-    ocf_log err "The SAP database $SID ist not running: $output"
-  fi
-  return $rc
-}
-
-
-#
-# sapdatabase_status: Are there any database processes on this host ?
-#
-sapdatabase_status() {
-  case $DBTYPE in
-    ADA) SEARCH="$SID/db/pgm/kernel"
-         SUSER=`grep "^SdbOwner" /etc/opt/sdb | awk -F'=' '{print $2}'`
-         SNUM=2
-         ;;
-    ORA) SEARCH="ora_[a-z][a-z][a-z][a-z]_"
-         SUSER="ora`echo $SID | tr [:upper:] [:lower:]`"
-         SNUM=4
-         ;;
-    DB6) SEARCH="db2[a-z][a-z][a-z][a-z][a-z]"
-         SUSER="db2`echo $SID | tr [:upper:] [:lower:]`"
-         SNUM=5
-         ;;
-  esac
-
-  # Note: ps cuts off it's output at column $COLUMNS, so "ps -ef" can not be used here
-  # as the output might be to long.
-  cnt=`ps efo args --user $SUSER 2> /dev/null | grep -c "$SEARCH"`
-  if [ $cnt -ge $SNUM ]
-  then
-    rc=$OCF_SUCCESS
-  else
-    # ocf_log info "Database Instance $SID is not running on `hostname`"
-    rc=$OCF_NOT_RUNNING
-  fi
-  return $rc
-}
-
-
-#
-# sapdatabase_recover:
-#
-sapdatabase_recover() {
-
-  case $DBTYPE in
-    ORA) recoutput=`oracle_recover`
-         ;;
-    ADA) recoutput=`maxdb_recover`
-         ;;
-    DB6) recoutput=`db6udb_recover`
-         ;;
-  esac
-
-  sapdatabase_monitor 1
-  retcode=$?
-
-  if [ $retcode -eq $OCF_SUCCESS ]
-  then
-    ocf_log info "Recover of SAP database $SID was successful: $recoutput"
-  else
-    ocf_log err "Recover of SAP database $SID failed: $recoutput"
-  fi
-
-  return $retcode
-}
-
-
-#
-# sapdatabase_validate: Check the symantic of the input parameters 
-#
-sapdatabase_validate() {
-  rc=$OCF_SUCCESS
-  if [ `echo "$SID" | grep -c '^[A-Z][A-Z0-9][A-Z0-9]$'` -ne 1 ]
-  then
-    ocf_log err "Parsing parameter SID: '$SID' is not a valid system ID!"
-    rc=$OCF_ERR_ARGS
-  fi
-
-  case "$DBTYPE" in
-   ORA|ADA|DB6) ;;
-   *) ocf_log err "Parsing parameter DBTYPE: '$DBTYPE' is not a supported database type!"
-      rc=$OCF_ERR_ARGS ;;
-  esac
-
-  return $rc
-}
-
-
-#
-#	'main' starts here...
-#
-
-if
-  ( [ $# -ne 1 ] )
-then
-  usage
-  exit $OCF_ERR_ARGS
-fi
-
-# Set a tempfile and make sure to clean it up again
-TEMPFILE="/tmp/SAPDatabase.$$.tmp"
-trap trap_handler INT TERM
-
-# These operations don't require OCF instance parameters to be set
-case "$1" in
-  meta-data)	meta_data
-		exit $OCF_SUCCESS;;
-
-  usage) 	usage
-		exit $OCF_SUCCESS;;
-
-  methods)	sapdatabase_methods
-		exit $?;;
-
-  *);;
-esac
-
-US=`id -u -n`
-US=`echo $US`
-if
-  [ $US != root  ]
-then
-  ocf_log err "$0 must be run as root"
-  exit $OCF_ERR_PERM
-fi
-
-# mandatory parameter check
-if  [ -z "$OCF_RESKEY_SID" ]; then
-  ocf_log err "Please set OCF_RESKEY_SID to the SAP system id!"
-  exit $OCF_ERR_ARGS
-fi
-SID=`echo "$OCF_RESKEY_SID"`
-
-if [ -z "$OCF_RESKEY_DBTYPE" ]; then
-  ocf_log err "Please set OCF_RESKEY_DBTYPE to the database vendor specific tag (ORA,ADA,DB6)!"
-  exit $OCF_ERR_ARGS
-fi
-DBTYPE=`echo "$OCF_RESKEY_DBTYPE" | tr "[a-z]" "[A-Z]"`
-
-# optional OCF parameters, we try to guess which directories are correct
-EXESTARTDB="startdb"
-EXESTOPDB="stopdb"
-EXEDBCONNECT="R3trans"
-if [ -z "$OCF_RESKEY_DBJ2EE_ONLY" ]; then
-  DBJ2EE_ONLY=0
-else
-  case "$OCF_RESKEY_DBJ2EE_ONLY" in
-   1|true|TRUE|yes|YES) DBJ2EE_ONLY=1
-                        EXESTARTDB="startj2eedb"
-                        EXESTOPDB="stopj2eedb"
-                        EXEDBCONNECT="jdbcconnect.jar"
-                        ;;
-   0|false|FALSE|no|NO) DBJ2EE_ONLY=0;;
-   *) ocf_log err "Parsing parameter DBJ2EE_ONLY: '$DBJ2EE_ONLY' is not a boolean value!"
-      exit $OCF_ERR_ARGS ;;
-  esac
-fi
-
-if [ -z "$OCF_RESKEY_NETSERVICENAME" ]; then
-  case "$DBTYPE" in
-    ORA|ora) NETSERVICENAME="LISTENER";;
-    *)       NETSERVICENAME="";;
-  esac
-else
-  NETSERVICENAME="$OCF_RESKEY_NETSERVICENAME"
-fi
-
-if [ -z "$OCF_RESKEY_STRICT_MONITORING" ]; then
-  OCF_RESKEY_STRICT_MONITORING=0
-else
-  case "$OCF_RESKEY_STRICT_MONITORING" in
-   1|true|TRUE|yes|YES) OCF_RESKEY_STRICT_MONITORING=1;;
-   0|false|FALSE|no|NO) OCF_RESKEY_STRICT_MONITORING=0;;
-   *)  ocf_log err "Parsing parameter STRICT_MONITORING: '$OCF_RESKEY_STRICT_MONITORING' is not a boolean value!"
-       exit $OCF_ERR_ARGS ;;
-  esac
-fi
-
-PATHLIST="
-$OCF_RESKEY_DIR_EXECUTABLE
-/usr/sap/$SID/*/exe
-/usr/sap/$SID/SYS/exe/run
-/sapmnt/$SID/exe
-"
-DIR_EXECUTABLE=""
-for EXEPATH in $PATHLIST
-do
-  if [ -x $EXEPATH/$EXESTARTDB -a -x $EXEPATH/$EXESTOPDB -a -x $EXEPATH/$EXEDBCONNECT ]
-  then
-    DIR_EXECUTABLE=$EXEPATH
-    SAPSTARTDB=$EXEPATH/$EXESTARTDB
-    SAPSTOPDB=$EXEPATH/$EXESTOPDB
-    SAPDBCONNECT=$EXEPATH/$EXEDBCONNECT
-    break
-  fi
-done
-if [ -z "$DIR_EXECUTABLE" ]
-then
-  ocf_log warn "Cannot find $EXESTARTDB,$EXESTOPDB and $EXEDBCONNECT executable, please set DIR_EXECUTABLE parameter!"
-  exit $OCF_NOT_RUNNING
-fi
-
-if [ $DBJ2EE_ONLY -eq 1 ]
-then
-  if [ -n "$OCF_RESKEY_DIR_BOOTSTRAP" ]
-  then
-    BOOTSTRAP="$OCF_RESKEY_DIR_BOOTSTRAP"
-  else
-    BOOTSTRAP=`echo /usr/sap/$SID/*/j2ee/cluster/bootstrap | head -1`
-  fi
-
-  if [ -n "$OCF_RESKEY_DIR_SECSTORE" ]
-  then
-    SECSTORE="$OCF_RESKEY_DIR_SECSTORE"
-  else
-    SECSTORE=/usr/sap/$SID/SYS/global/security/lib/tools
-  fi
-
-  if [ -n "$OCF_RESKEY_JAVA_HOME" ]
-  then
-    JAVA_HOME="$OCF_RESKEY_JAVA_HOME"
-    PATH=$JAVA_HOME/bin:$PATH
-  else
-    if [ -n "$JAVA_HOME" ]
-    then
-      PATH=$JAVA_HOME/bin:$PATH
-    else
-      ocf_log err "Cannot find JAVA_HOME directory, please set JAVA_HOME parameter!"
-      exit $OCF_NOT_RUNNING
-    fi
-  fi
-
-  if [ -n "$OCF_RESKEY_DB_JARS" ]
-  then
-    DB_JARS=$OCF_RESKEY_DB_JARS
-  else
-    if [ -f "$BOOTSTRAP"/bootstrap.properties ]; then
-      DB_JARS=`cat $BOOTSTRAP/bootstrap.properties | grep -i rdbms.driverLocation | sed -e 's/\\\:/:/g' | awk -F= '{print $2}'`
-    fi
-  fi
-fi
-
-if [ -z "$OCF_RESKEY_AUTOMATIC_RECOVER" ]
-then
-  OCF_RESKEY_AUTOMATIC_RECOVER=0
-else
-  case "$OCF_RESKEY_AUTOMATIC_RECOVER" in
-   1|true|TRUE|yes|YES) OCF_RESKEY_AUTOMATIC_RECOVER=1;;
-   0|false|FALSE|no|NO) OCF_RESKEY_AUTOMATIC_RECOVER=0;;
-  esac
-fi
-
-# as root user we need the library path to the SAP kernel to be able to call executables
-if [ `echo $LD_LIBRARY_PATH | grep -c "^$DIR_EXECUTABLE\>"` -eq 0 ]; then
-  LD_LIBRARY_PATH=$DIR_EXECUTABLE:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH
-fi
-sidadm="`echo $SID | tr [:upper:] [:lower:]`adm"
-
-# What kind of method was invoked?
-case "$1" in
-
-  start)	sapdatabase_start
-		exit $?;;
-
-  stop)		sapdatabase_stop
-		exit $?;;
-
-  monitor)
-          	sapdatabase_monitor $OCF_RESKEY_STRICT_MONITORING
-		exit $?;;
-
-  status)
-                sapdatabase_status
-                exit $?;;
-
-  validate-all)	sapdatabase_validate
-		exit $?;;
-
-  *)		sapdatabase_methods
-		exit $OCF_ERR_UNIMPLEMENTED;;
-esac
diff --git a/rgmanager/src/resources/SAPInstance b/rgmanager/src/resources/SAPInstance
deleted file mode 100644
index d04fcb3..0000000
--- a/rgmanager/src/resources/SAPInstance
+++ /dev/null
@@ -1,587 +0,0 @@
-#!/bin/sh
-#
-# SAPInstance
-#
-# Description:	Manages a single SAP Instance as a High-Availability
-#		resource. One SAP Instance is defined by one 
-#               SAP Instance-Profile. start/stop handels all services
-#               of the START-Profile, status and monitor care only
-#               about essential services.
-#
-# Author:       Alexander Krauth, June 2006
-# Support:      linux@sap.com
-# License:      GNU General Public License (GPL)
-# Copyright:    (c) 2006, 2007 Alexander Krauth
-#
-# An example usage: 
-#      See usage() function below for more details...
-#
-# OCF instance parameters:
-#	OCF_RESKEY_InstanceName
-#	OCF_RESKEY_DIR_EXECUTABLE   (optional, well known directories will be searched by default)
-#	OCF_RESKEY_DIR_PROFILE      (optional, well known directories will be searched by default)
-#	OCF_RESKEY_START_PROFILE    (optional, well known directories will be searched by default)
-#	OCF_RESKEY_START_WAITTIME   (optional, to solve timing problems during J2EE-Addin start)
-#	OCF_RESKEY_AUTOMATIC_RECOVER    (optional, automatic startup recovery using cleanipc, default is false)
-#	OCF_RESKEY_PRE_START_USEREXIT	(optional, lists a script which can be executed before the resource is started)
-#	OCF_RESKEY_POST_START_USEREXIT	(optional, lists a script which can be executed after the resource is started)
-#	OCF_RESKEY_PRE_STOP_USEREXIT	(optional, lists a script which can be executed before the resource is stopped)
-#	OCF_RESKEY_POST_STOP_USEREXIT	(optional, lists a script which can be executed after the resource is stopped)
-#
-#######################################################################
-# Initialization:
-
-if [ -f ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs ]; then
-        . ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs
-elif [ -f /usr/share/cluster/ocf-shellfuncs ]; then
-        . /usr/share/cluster/ocf-shellfuncs
-else
-        echo Could not find ocf-shellfuncs!
-        exit 1
-fi
-
-
-#######################################################################
-
-SH=/bin/sh
-
-usage() {
-  methods=`sapinstance_methods`
-  methods=`echo $methods | tr ' ' '|'`
-  cat <<-!
-	usage: $0 ($methods)
-
-	$0 manages a SAP Instance as an HA resource.
-
-	The 'start' operation starts the instance.
-	The 'stop' operation stops the instance.
-	The 'status' operation reports whether the instance is running
-	The 'monitor' operation reports whether the instance seems to be working
-	The 'validate-all' operation reports whether the parameters are valid
-	The 'methods' operation reports on the methods $0 supports
-
-	!
-}
-
-meta_data() {
-	cat <<END
-<?xml version="1.0"?>
-<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
-<resource-agent name="SAPInstance">
-<version>1.92</version>
-
-<longdesc lang="en">
-Resource script for SAP. It manages a SAP Instance as an HA resource.
-</longdesc>
-<shortdesc lang="en">SAP instance resource agent</shortdesc>
-
-<parameters>
- <parameter name="InstanceName" unique="1" required="1">
-  <longdesc lang="en">The full qualified SAP instance name. e.g. P01_DVEBMGS00_sapp01ci</longdesc>
-  <shortdesc lang="en">instance name: SID_INSTANCE_VIR-HOSTNAME</shortdesc>
-  <content type="string" default="" />
- </parameter>
- <parameter name="DIR_EXECUTABLE" unique="0" required="0">
-  <longdesc lang="en">The full qualified path where to find sapstartsrv and sapcontrol.</longdesc>
-  <shortdesc lang="en">path of sapstartsrv and sapcontrol</shortdesc>
-  <content type="string" default="" />
- </parameter>
- <parameter name="DIR_PROFILE" unique="0" required="0">
-  <longdesc lang="en">The full qualified path where to find the SAP START profile.</longdesc>
-  <shortdesc lang="en">path of start profile</shortdesc>
-  <content type="string" default="" />
- </parameter>
- <parameter name="START_PROFILE" unique="0" required="0">
-  <longdesc lang="en">The name of the SAP START profile.</longdesc>
-  <shortdesc lang="en">start profile name</shortdesc>
-  <content type="string" default="" />
- </parameter>
- <parameter name="START_WAITTIME" unique="0" required="0">
-  <longdesc lang="en">After that time in seconds a monitor operation is executed by the resource agent. Does the monitor return SUCCESS, the start is handled as SUCCESS. This is useful to resolve timing problems with e.g. the J2EE-Addin instance.</longdesc>
-  <shortdesc lang="en">Check the successful start after that time (do not wait for J2EE-Addin)</shortdesc>
-  <content type="string" default="3600" />
- </parameter>
- <parameter name="AUTOMATIC_RECOVER" unique="0" required="0">
-  <longdesc lang="en">The SAPInstance resource agent tries to recover a failed start attempt automaticaly one time. This is done by killing runing instance processes and executing cleanipc.</longdesc>
-  <shortdesc lang="en">Enable or disable automatic startup recovery</shortdesc>
-  <content type="boolean" default="false"/>
- </parameter>
- <parameter name="PRE_START_USEREXIT" unique="0" required="0">
-  <longdesc lang="en">The full qualified path where to find a script or program which should be executed before this resource gets started.</longdesc>
-  <shortdesc lang="en">path to a pre-start script</shortdesc>
-  <content type="string" default="" />
- </parameter>
- <parameter name="POST_START_USEREXIT" unique="0" required="0">
-  <longdesc lang="en">The full qualified path where to find a script or program which should be executed after this resource got started.</longdesc>
-  <shortdesc lang="en">path to a post-start script</shortdesc>
-  <content type="string" default="" />
- </parameter>
- <parameter name="PRE_STOP_USEREXIT" unique="0" required="0">
-  <longdesc lang="en">The full qualified path where to find a script or program which should be executed before this resource gets stopped.</longdesc>
-  <shortdesc lang="en">path to a pre-start script</shortdesc>
-  <content type="string" default="" />
- </parameter>
- <parameter name="POST_STOP_USEREXIT" unique="0" required="0">
-  <longdesc lang="en">The full qualified path where to find a script or program which should be executed after this resource got stopped.</longdesc>
-  <shortdesc lang="en">path to a post-start script</shortdesc>
-  <content type="string" default="" />
- </parameter>
-</parameters>
-
-<actions>
-<action name="start" timeout="180" />
-<action name="stop" timeout="240" />
-<action name="status" timeout="60" depth="0" interval="120" start-delay="240" />
-<action name="monitor" depth="0" timeout="60" interval="120" start-delay="240" />
-<action name="validate-all" timeout="5" />
-<action name="meta-data" timeout="5" />
-<action name="methods" timeout="5" />
-</actions>
-</resource-agent>
-END
-}
-
-
-#
-# methods: What methods/operations do we support?
-#
-sapinstance_methods() {
-  cat <<-!
-	start
-	stop
-	status
-	monitor
-	validate-all
-	methods
-	meta-data
-	usage
-	!
-}
-
-
-#
-# check_sapstartsrv : Before using sapcontrol we make sure that the sapstartsrv is running for the correct instance.
-#                     We cannot use sapinit and the /usr/sap/sapservices file in case of an enquerep instance,
-#                     because then we have two instances with the same instance number.
-#
-check_sapstartsrv() {
-  restart=0
-  runninginst=""
-  chkrc=$OCF_SUCCESS
-
-  output=`$SAPCONTROL -nr $InstanceNr -function ParameterValue INSTANCE_NAME -format script`
-  if [ $? -eq 0 ]
-  then
-    runninginst=`echo "$output" | grep '^0 : ' | cut -d' ' -f3`
-    if [ "$runninginst" != "$InstanceName" ]
-    then 
-      ocf_log warn "sapstartsrv is running for instance $runninginst, that service will be killed"
-      restart=1
-    fi
-  else
-    ocf_log warn "sapstartsrv is not running for instance $SID-$InstanceName, it will be started now"
-    restart=1
-  fi
-
-  if [ -z "$runninginst" ]; then runninginst=$InstanceName; fi
-
-  if [ $restart -eq 1 ]
-  then
-    pkill -9 -f "sapstartsrv.*$runninginst"
-    $SAPSTARTSRV pf=$SAPSTARTPROFILE -D -u $sidadm
-
-    # now make sure the daemon has been started and is able to respond
-    srvrc=1
-    while [ $srvrc -eq 1 -a `pgrep -f "sapstartsrv.*$runninginst" | wc -l` -gt 0 ]
-    do
-      sleep 1
-      $SAPCONTROL -nr $InstanceNr -function GetProcessList > /dev/null 2>&1
-      srvrc=$?
-    done
-
-    if [ $srvrc -ne 1 ]
-    then
-      ocf_log info "sapstartsrv for instance $SID-$InstanceName was restarted !"
-      chkrc=$OCF_SUCCESS
-    else
-      ocf_log error "sapstartsrv for instance $SID-$InstanceName could not be started!"
-      chkrc=$OCF_NOT_RUNNING
-    fi
-  fi
-
-  return $chkrc
-}
-
-
-#
-# sapuserexit : Many SAP customers need some additional processes/tools to run their SAP systems.
-#               This specialties do not allow a totally generic SAP cluster resource agent.
-#               Someone should write a resource agent for each additional process you need, if it
-#               is required to monitor that process within the cluster manager. To enable 
-#               you to extent this resource agent without developing a new one, this user exit
-#               was introduced.
-#
-sapuserexit() {
-  NAME="$1"
-  VALUE="$2"
-
-  if [ -n "$VALUE" ]
-  then
-    if [ -x "$VALUE" ]
-    then
-      ocf_log info "Calling userexit ${NAME} with customer script file ${VALUE}"
-      eval "$VALUE" >& /dev/null
-      ocf_log info "Exiting userexit ${NAME} with customer script file ${VALUE}, returncode: $?"
-    else
-      ocf_log warn "Attribute ${NAME} is set to ${VALUE}, but this file is not executable"
-    fi
-  fi
-  return 0
-}
-
-
-#
-# cleanup_instance : remove resources (processes and shared memory) from a crashed instance)
-#
-cleanup_instance() {
-  pkill -9 -f -U $sidadm $InstanceName
-  $DIR_EXECUTABLE/cleanipc $InstanceNr remove
-  return 0
-}
-
-#
-# sapinstance_start : Start the SAP instance
-#
-sapinstance_start() {
-
-  sapuserexit PRE_START_USEREXIT "$OCF_RESKEY_PRE_START_USEREXIT"
-
-  rc=$OCF_NOT_RUNNING
-  loopcount=0
-  while [ $loopcount -lt 2 ]
-  do
-    loopcount=$(($loopcount + 1))
-
-    check_sapstartsrv
-    output=`$SAPCONTROL -nr $InstanceNr -function Start`
-    rc=$?
-    ocf_log info "Starting SAP Instance $SID-$InstanceName: $output"
-
-    if [ $rc -ne 0 ]
-    then
-      ocf_log err "SAP Instance $SID-$InstanceName start failed."
-      return $OCF_ERR_GENERIC
-    fi
-
-    startrc=1
-    while [ $startrc -gt 0 ]
-    do
-      waittime_start=`date +%s`
-      output=`$SAPCONTROL -nr $InstanceNr -function WaitforStarted $OCF_RESKEY_START_WAITTIME 10`
-      startrc=$?
-      waittime_stop=`date +%s`
-
-      if [ $startrc -ne 0 ]
-      then
-        if [ $(($waittime_stop - $waittime_start)) -ge $OCF_RESKEY_START_WAITTIME ]
-        then
-          sapinstance_monitor NOLOG
-          if [ $? -eq $OCF_SUCCESS ]
-          then
-            output="START_WAITTIME ($OCF_RESKEY_START_WAITTIME) has elapsed, but instance monitor returned SUCCESS. Instance considered running."
-            startrc=0; loopcount=2
-          fi
-        else
-          if [ $loopcount -eq 1 -a $OCF_RESKEY_AUTOMATIC_RECOVER -eq 1 ]
-          then
-            ocf_log warn "SAP Instance $SID-$InstanceName start failed: $output"
-            ocf_log warn "Try to recover $SID-$InstanceName"
-            cleanup_instance
-          else
-            loopcount=2
-          fi
-          startrc=-1
-        fi
-      else
-        loopcount=2
-      fi
-    done
-  done
-
-  if [ $startrc -eq 0 ]
-  then
-    ocf_log info "SAP Instance $SID-$InstanceName started: $output"
-    rc=$OCF_SUCCESS
-    sapuserexit POST_START_USEREXIT "$OCF_RESKEY_POST_START_USEREXIT"
-  else
-    ocf_log err "SAP Instance $SID-$InstanceName start failed: $output"
-    rc=$OCF_NOT_RUNNING
-  fi
-
-  return $rc
-}
-
-
-#
-# sapinstance_recover: Try startup of failed instance by cleaning up resources
-#
-sapinstance_recover() {
-  cleanup_instance
-  sapinstance_start
-  return $?
-}
-
-
-#
-# sapinstance_stop: Stop the SAP instance
-#
-sapinstance_stop() {
-  sapuserexit PRE_STOP_USEREXIT "$OCF_RESKEY_PRE_STOP_USEREXIT"
-
-  check_sapstartsrv
-
-  output=`$SAPCONTROL -nr $InstanceNr -function Stop`
-  if [ $? -eq 0 ]
-  then
-    output=`$SAPCONTROL -nr $InstanceNr -function WaitforStopped 3600 1`
-    if [ $? -eq 0 ]
-    then
-      ocf_log info "SAP Instance $SID-$InstanceName stopped: $output"
-      rc=$OCF_SUCCESS
-    else
-      ocf_log err "SAP Instance $SID-$InstanceName stop failed: $output"
-      rc=$OCF_ERR_GENERIC
-    fi
-  else
-    ocf_log err "SAP Instance $SID-$InstanceName stop failed: $output"
-    rc=$OCF_ERR_GENERIC
-  fi
-
-  sapuserexit POST_STOP_USEREXIT "$OCF_RESKEY_POST_STOP_USEREXIT"
-
-  return $rc
-}
-
-
-#
-# sapinstance_monitor: Can the given SAP instance do anything useful?
-#
-sapinstance_monitor() {
-  MONLOG=$1
-  check_sapstartsrv
-  rc=$?
-
-  if [ $rc -eq $OCF_SUCCESS ]
-  then
-    count=0
-    LOCALHOST=`hostname`
-    output=`$SAPCONTROL -nr $InstanceNr -host $LOCALHOST -function GetProcessList -format script`
-
-    # we have to parse the output, because the returncode doesn't tell anything about the instance status
-    for SERVNO in `echo "$output" | grep '^[0-9] ' | cut -d' ' -f1 | sort -u`
-    do
-      COLOR=`echo "$output" | grep "^$SERVNO dispstatus: " | cut -d' ' -f3`
-      SERVICE=`echo "$output" | grep "^$SERVNO name: " | cut -d' ' -f3`
-      STATE=0
-
-      case $COLOR in
-        GREEN|YELLOW)       STATE=$OCF_SUCCESS;;
-        *)                  STATE=$OCF_NOT_RUNNING;;
-      esac 
-
-      case $SERVICE in
-        disp+work|msg_server|enserver|enrepserver|jcontrol|jstart)
-                      if [ $STATE -eq $OCF_NOT_RUNNING ]
-                      then
-                        if [ "$MONLOG" != "NOLOG" ]
-                        then
-                          ocf_log err "SAP instance service $SERVICE is not running with status $COLOR !"
-                        fi
-                        rc=$STATE
-                      fi
-                      count=1;;
-        *);;
-      esac
-    done
-
-    if [ $count -eq 0 -a $rc -eq $OCF_SUCCESS ]
-    then
-      if [ "$MONLOG" != "NOLOG" ]
-      then
-        ocf_log err "The SAP instance does not run any services which this RA could monitor!"
-      fi
-      rc=$OCF_ERR_ARGS
-    fi
-  fi
-  
-  return $rc
-}
-
-#
-# sapinstance_validate: Check the symantic of the input parameters 
-#
-sapinstance_validate() {
-  rc=$OCF_SUCCESS
-  if [ `echo "$SID" | grep -c '^[A-Z][A-Z0-9][A-Z0-9]$'` -ne 1 ]
-  then
-    ocf_log err "Parsing instance profile name: '$SID' is not a valid system ID!"
-    rc=$OCF_ERR_ARGS
-  fi
-
-  if [ `echo "$InstanceName" | grep -c '^[A-Z].*[0-9][0-9]$'` -ne 1 ]
-  then
-    ocf_log err "Parsing instance profile name: '$InstanceName' is not a valid instance name!"
-    rc=$OCF_ERR_ARGS
-  fi
-
-  if [ `echo "$InstanceNr" | grep -c '^[0-9][0-9]$'` -ne 1 ]
-  then
-    ocf_log err "Parsing instance profile name: '$InstanceNr' is not a valid instance number!"
-    rc=$OCF_ERR_ARGS
-  fi
-
-  if [ `echo "$SAPVIRHOST" | grep -c '^[A-Za-z][A-Za-z0-9_-]*$'` -ne 1 ]
-  then
-    ocf_log err "Parsing instance profile name: '$SAPVIRHOST' is not a valid hostname!"
-    rc=$OCF_ERR_ARGS
-  fi
-
-  return $rc
-}
-
-
-#
-#	'main' starts here...
-#
-
-if
-  ( [ $# -ne 1 ] )
-then
-  usage
-  exit $OCF_ERR_ARGS
-fi
-
-# These operations don't require OCF instance parameters to be set
-case "$1" in
-  meta-data)	meta_data
-		exit $OCF_SUCCESS;;
-
-  usage) 	usage
-		exit $OCF_SUCCESS;;
-
-  methods)	sapinstance_methods
-		exit $?;;
-
-  *);;
-esac
-
-US=`id -u -n`
-US=`echo $US`
-if
-  [ $US != root  ]
-then
-  ocf_log err "$0 must be run as root"
-  exit $OCF_ERR_PERM
-fi
-
-# parameter check
-if  [ -z "$OCF_RESKEY_InstanceName" ]
-then
-  ocf_log err "Please set OCF_RESKEY_InstanceName to the name to the SAP instance profile!"
-  exit $OCF_ERR_ARGS
-fi
-
-SID=`echo "$OCF_RESKEY_InstanceName" | cut -d_ -f1`
-InstanceName=`echo "$OCF_RESKEY_InstanceName" | cut -d_ -f2`
-InstanceNr=`echo "$InstanceName" | sed 's/.*\([0-9][0-9]\)$/\1/'`
-SAPVIRHOST=`echo "$OCF_RESKEY_InstanceName" | cut -d_ -f3`
-
-# optional OCF parameters, we try to guess which directories are correct
-if  [ -z "$OCF_RESKEY_DIR_EXECUTABLE" ]
-then
-  if [ -x /usr/sap/$SID/$InstanceName/exe/sapstartsrv -a -x /usr/sap/$SID/$InstanceName/exe/sapcontrol ]
-  then
-    DIR_EXECUTABLE="/usr/sap/$SID/$InstanceName/exe"
-    SAPSTARTSRV="/usr/sap/$SID/$InstanceName/exe/sapstartsrv"
-    SAPCONTROL="/usr/sap/$SID/$InstanceName/exe/sapcontrol"
-  elif [ -x /usr/sap/$SID/SYS/exe/run/sapstartsrv -a -x /usr/sap/$SID/SYS/exe/run/sapcontrol ]
-  then
-    DIR_EXECUTABLE="/usr/sap/$SID/SYS/exe/run"
-    SAPSTARTSRV="/usr/sap/$SID/SYS/exe/run/sapstartsrv"
-    SAPCONTROL="/usr/sap/$SID/SYS/exe/run/sapcontrol"
-  else
-    ocf_log warn "Cannot find sapstartsrv and sapcontrol executable, please set DIR_EXECUTABLE parameter!"
-    exit $OCF_NOT_RUNNING
-  fi
-else
-  DIR_EXECUTABLE="$OCF_RESKEY_DIR_EXECUTABLE"
-  SAPSTARTSRV="$OCF_RESKEY_DIR_EXECUTABLE/sapstartsrv"
-  SAPCONTROL="$OCF_RESKEY_DIR_EXECUTABLE/sapcontrol"
-fi
-
-if [ -z "$OCF_RESKEY_DIR_PROFILE" ]
-then
-  if [ -d /usr/sap/$SID/SYS/profile/ ]
-  then
-    DIR_PROFILE="/usr/sap/$SID/SYS/profile"
-  else
-    ocf_log warn "Expected /usr/sap/$SID/SYS/profile/ to be a directory, please set DIR_PROFILE parameter!"
-    exit $OCF_NOT_RUNNING
-  fi
-else
-  DIR_PROFILE="$OCF_RESKEY_DIR_PROFILE"
-fi
-
-if [ -z "$OCF_RESKEY_START_PROFILE" ]
-then
-  SAPSTARTPROFILE="$DIR_PROFILE/START_${InstanceName}_${SAPVIRHOST}"
-  if [ ! -r $SAPSTARTPROFILE ]
-  then
-    ocf_log warn "Expected $SAPSTARTPROFILE to be the instance START profile, please set START_PROFILE parameter!"
-    exit $OCF_NOT_RUNNING
-  fi
-else
-  SAPSTARTPROFILE="$OCF_RESKEY_START_PROFILE"
-fi
-
-if [ -z "$OCF_RESKEY_START_WAITTIME" ]
-then
-  OCF_RESKEY_START_WAITTIME=3600
-fi
-
-
-if [ -z "$OCF_RESKEY_AUTOMATIC_RECOVER" ]
-then
-  OCF_RESKEY_AUTOMATIC_RECOVER=0
-else
-  case "$OCF_RESKEY_AUTOMATIC_RECOVER" in
-   1|true|TRUE|yes|YES) OCF_RESKEY_AUTOMATIC_RECOVER=1;;
-   0|false|FALSE|no|NO) OCF_RESKEY_AUTOMATIC_RECOVER=0;;
-  esac
-fi
-
-# as root user we need the library path to the SAP kernel to be able to call sapcontrol
-if [ `echo $LD_LIBRARY_PATH | grep -c "^$DIR_EXECUTABLE\>"` -eq 0 ]; then
-  LD_LIBRARY_PATH=$DIR_EXECUTABLE:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH
-fi
-sidadm="`echo $SID | tr [:upper:] [:lower:]`adm"
-
-# What kind of method was invoked?
-case "$1" in
-
-  start)	sapinstance_start
-		exit $?;;
-
-  stop)		sapinstance_stop
-		exit $?;;
-
-  status|monitor)
-          	sapinstance_monitor
-		exit $?;;
-
-  validate-all)	sapinstance_validate
-		exit $?;;
-
-  *)		sapinstance_methods
-		exit $OCF_ERR_UNIMPLEMENTED;;
-esac
diff --git a/rgmanager/src/resources/apache.metadata b/rgmanager/src/resources/apache.metadata
deleted file mode 100644
index 727d138..0000000
--- a/rgmanager/src/resources/apache.metadata
+++ /dev/null
@@ -1,95 +0,0 @@
-<?xml version="1.0"?>
-<resource-agent version="rgmanager 2.0" name="apache">
-    <version>1.0</version>
-
-    <longdesc lang="en">
-        This defines an instance of Apache web server
-    </longdesc>
-    <shortdesc lang="en">
-        Defines an Apache web server
-    </shortdesc>
-
-    <parameters>
-        <parameter name="name" primary="1">
-	    <longdesc lang="en">
-	        Define a name for use in &lt;IfDefine name&gt; directive.
-	    </longdesc>
-            <shortdesc lang="en">
-                Name
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="server_root">
-            <longdesc lang="en">
-                Define an alternate initial ServerRoot
-            </longdesc>
-            <shortdesc lang="en">
-                Initial ServerRoot
-            </shortdesc>
-	    <content type="string" default="/etc/httpd"/>
-        </parameter>
-
-        <parameter name="config_file">
-            <longdesc lang="en">
-                Define an alternate ServerConfigFile
-            </longdesc>
-            <shortdesc lang="en">
-                Initial ServerConfigFile
-            </shortdesc>
-            <content type="string" default="conf/httpd.conf"/>
-        </parameter>
-
-	<parameter name="httpd_options">
-	    <longdesc lang="en">
-		Other command-line options for httpd
-	    </longdesc>
-	    <shortdesc lang="en">
-		Other command-line options for httpd
-	    </shortdesc>
-	    <content type="string" />
-	</parameter>
-
-	<parameter name="shutdown_wait">
-	    <longdesc lang="en">
-		Wait X seconds for correct end of service shutdown
-	    </longdesc>
-	    <shortdesc lang="en">
-		Wait X seconds for correct end of service shutdown
-	    </shortdesc>
-	    <content type="integer" />
-	</parameter>
-
-        <parameter name="service_name" inherit="service%name">
-            <longdesc lang="en">
-	    	Inherit the service name.  We need to know
-		the service name in order to determine file
-		systems and IPs for this service.
-            </longdesc>
-            <shortdesc lang="en">
-	    	Inherit the service name.
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-    </parameters>
-
-    <actions>
-        <action name="start" timeout="0"/>
-	<action name="stop" timeout="0"/>
-
-	<!-- Checks to see if it''s mounted in the right place -->
-	<action name="status" interval="1m" timeout="10"/>
-	<action name="monitor" interval="1m" timeout="10"/>
-
-	<!-- Checks to see if we can read from the mountpoint -->
-	<action name="status" depth="10" timeout="30" interval="5m"/>
-	<action name="monitor" depth="10" timeout="30" interval="5m"/>
-
-	<action name="meta-data" timeout="1"/>
-	<action name="validate-all" timeout="1"/>
-    </actions>
-
-    <special tag="rgmanager">
-    </special>
-</resource-agent>
diff --git a/rgmanager/src/resources/apache.sh b/rgmanager/src/resources/apache.sh
deleted file mode 100644
index 7f86838..0000000
--- a/rgmanager/src/resources/apache.sh
+++ /dev/null
@@ -1,251 +0,0 @@
-#!/bin/bash
-
-export LC_ALL=C
-export LANG=C
-export PATH=/bin:/sbin:/usr/bin:/usr/sbin
-
-. $(dirname $0)/ocf-shellfuncs
-. $(dirname $0)/utils/config-utils.sh
-. $(dirname $0)/utils/messages.sh
-. $(dirname $0)/utils/ra-skelet.sh
-
-if [ -x /usr/sbin/httpd ]; then
-	declare APACHE_HTTPD=/usr/sbin/httpd
-elif [ -x /usr/sbin/apache2 ]; then
-	declare APACHE_HTTPD=/usr/sbin/apache2
-fi
-declare APACHE_serverConfigFile
-declare APACHE_pid_file="`generate_name_for_pid_file`"
-declare APACHE_conf_dir="`generate_name_for_conf_dir`"
-declare APACHE_genConfig="$APACHE_conf_dir/httpd.conf"
-
-declare APACHE_parseConfig=$(dirname $0)/utils/httpd-parse-config.pl
-
-apache_serverConfigFile()
-{
-	if $(echo $OCF_RESKEY_config_file | grep -q "^/"); then
-		APACHE_serverConfigFile="$OCF_RESKEY_config_file"
-	else 
-		APACHE_serverConfigFile="$OCF_RESKEY_server_root/$OCF_RESKEY_config_file"
-	fi
-
-	return;
-}
-
-verify_all()
-{
-	clog_service_verify $CLOG_INIT 
-
-	if [ -z "$OCF_RESKEY_name" ]; then
-		clog_service_verify $CLOG_FAILED "Invalid Name Of Service"
-		return $OCF_ERR_ARGS
-	fi
-
-	if [ -z "$OCF_RESKEY_service_name" ]; then
-		clog_service_verify $CLOG_FAILED_NOT_CHILD
-		return $OCF_ERR_ARGS
-	fi
-                                                	
-	if [ -z "$OCF_RESKEY_server_root" ]; then
-		clog_service_verify $CLOG_FAILED "Invalid ServerRoot"
-		return $OCF_ERR_ARGS
-	fi
-
-	if [ ! -d "$OCF_RESKEY_server_root" ]; then
-		clog_service_verify $CLOG_FAILED "ServerRoot Directory Is Missing"
-		return $OCF_ERR_ARGS
-	fi
-
-	if [ -z "$OCF_RESKEY_config_file" ]; then
-		clog_check_file_exist $CLOG_FAILED_INVALID "$OCF_RESKEY_config_file"
-		return $OCF_ERR_ARGS
-	fi
-
-	if [ ! -r "$APACHE_serverConfigFile" ]; then
-		clog_check_file_exist $CLOG_FAILED_NOT_READABLE "$APACHE_config_file"
-		return $OCF_ERR_ARGS
-	fi
-
-	if [ -z "$APACHE_pid_file" ]; then
-		clog_service_verify $CLOG_FAILED "Invalid name of PID file"
-		return $OCF_ERR_ARGS
-	fi
-
-	clog_check_syntax $CLOG_INIT "$APACHE_serverConfigFile"
-
-	"$APACHE_HTTPD" -t \
-		-D"$OCF_RESKEY_name" \
-		-d "$OCF_RESKEY_server_root" \
-		-f "$APACHE_serverConfigFile" \
-		$OCF_RESKEY_httpd_options &> /dev/null
-		
-	if [ $? -ne 0 ]; then
-		clog_check_syntax $CLOG_FAILED "$APACHE_config_file"
-		return $OCF_ERR_GENERIC
-	fi
-
-	clog_check_syntax $CLOG_SUCCEED "$APACHE_config_file"
-
-	return 0
-}
-
-generate_configFile()
-{
-	declare originalConfigFile=$1;
-	declare generatedConfigFile=$2;
-	declare ip_addresses=$3;
-
-	if [ -f "$generatedConfigFile" ]; then
-		sha1_verify "$generatedConfigFile"
-		if [ $? -ne 0 ]; then
-			clog_check_sha1 $CLOG_FAILED
-			return 0
-		fi
-	fi	
-
-	clog_generate_config $CLOG_INIT "$originalConfigFile" "$generatedConfigFile"
-
-	generate_configTemplate "$generatedConfigFile" "$1"
-	cat >> "$generatedConfigFile" << EOT
-# From a cluster perspective, the key fields are:
-#     Listen - must be set to service floating IP address.
-#     ServerRoot - path to the ServerRoot (initial value is set in service conf)
-#
-
-EOT
-
-	IFS_old="$IFS"
-	IFS=$'\n'
-	for i in `"$APACHE_parseConfig" -D"$OCF_RESKEY_name" < "$originalConfigFile" | grep -E '(^Listen)|(^Port)' | grep -v ':'`; do 
-		port=`echo $i | sed 's/^Listen \(.*\)/\1/;s/^Port \(.*\)/\1/'`;
-		IFS=$' ';
-		for z in $ip_addresses; do 
-			echo "Listen $z:$port" >> "$generatedConfigFile";
-		done
-		IFS=$'\n';
-	done;
-	IFS="$IFS_old"
-
-	echo "PidFile \"$APACHE_pid_file\"" >> "$generatedConfigFile";
-	echo >> "$generatedConfigFile"
-
-	cat "$originalConfigFile" | sed 's/^Listen/### Listen/;s/^Port/### Port/;s/^PidFile/### PidFile/' | \
-	"$APACHE_parseConfig" -D"$OCF_RESKEY_name" >> "$generatedConfigFile"
-
-	sha1_addToFile "$generatedConfigFile"
-	clog_generate_config $CLOG_SUCCEED "$originalConfigFile" "$generatedConfigFile"
-}
-
-start()
-{
-	declare ip_addresses
-
-	clog_service_start $CLOG_INIT	
-
-	create_pid_directory
-	create_conf_directory "$APACHE_conf_dir"
-	check_pid_file "$APACHE_pid_file"
-
-	if [ $? -ne 0 ]; then
-		clog_check_pid $CLOG_FAILED "$APACHE_pid_file"
-		clog_service_start $CLOG_FAILED
-		return $OCF_ERR_GENERIC
-	fi
-
-	clog_looking_for $CLOG_INIT "IP Addresses"
-
-	get_service_ip_keys "$OCF_RESKEY_service_name"
-	ip_addresses=`build_ip_list`
-
-	if [ -z "$ip_addresses" ]; then
-		clog_looking_for $CLOG_FAILED_NOT_FOUND "IP Addresses"
-		return $OCF_ERR_GENERIC
-	fi
-	
-	clog_looking_for $CLOG_SUCCEED "IP Addresses"
-
-	generate_configFile "$APACHE_serverConfigFile" "$APACHE_genConfig" "$ip_addresses"
-
-	"$APACHE_HTTPD" \
-		"-D$OCF_RESKEY_name" \
-		-d "$OCF_RESKEY_server_root" \
-		-f "$APACHE_genConfig" \
-		$OCF_RESKEY_httpd_options \
-		-k start
-
-	if [ $? -ne 0 ]; then
-		clog_service_start $CLOG_FAILED		
-		return $OCF_ERR_GENERIC
-	else
-		clog_service_start $CLOG_SUCCEED
-	fi
-
-	return 0;
-}
-
-stop()
-{
-	clog_service_stop $CLOG_INIT
-
-	stop_generic "$APACHE_pid_file" "$OCF_RESKEY_shutdown_wait"
-	
-	if [ $? -ne 0 ]; then
-		clog_service_stop $CLOG_FAILED
-		return $OCF_ERR_GENERIC
-	fi
-	
-	clog_service_stop $CLOG_SUCCEED
-	return 0;
-}
-
-status()
-{
-	clog_service_status $CLOG_INIT
-
-	status_check_pid "$APACHE_pid_file"
-	if [ $? -ne 0 ]; then
-		clog_service_status $CLOG_FAILED "$APACHE_pid_file"
-		return $OCF_ERR_GENERIC
-	fi
-
-	clog_service_status $CLOG_SUCCEED
-	return 0
-}
-
-if [ "$1" != "meta-data" ]; then
-	apache_serverConfigFile
-fi;
-		
-case $1 in
-	meta-data)
-		cat `echo $0 | sed 's/^\(.*\)\.sh$/\1.metadata/'`
-		exit 0
-		;;
-	validate-all|verify-all)
-		verify_all
-		exit $?
-		;;
-	start)
-		verify_all && start
-		exit $?
-		;;
-	stop)
-		verify_all && stop
-		exit $?
-		;;
-	status|monitor)
-		verify_all
-		status
-		exit $?
-		;;
-	restart)
-		verify_all
-		stop
-		start
-		exit $?
-		;;
-	*)
-		echo "Usage: $0 {start|stop|status|monitor|restart|meta-data|validate-all}"
-		exit $OCF_ERR_UNIMPLEMENTED
-		;;
-esac
diff --git a/rgmanager/src/resources/clusterfs.sh b/rgmanager/src/resources/clusterfs.sh
deleted file mode 100644
index 127c5eb..0000000
--- a/rgmanager/src/resources/clusterfs.sh
+++ /dev/null
@@ -1,962 +0,0 @@
-#!/bin/bash
-
-#
-# File system (normal) mount/umount/fsck/etc. agent
-#
-
-LC_ALL=C
-LANG=C
-PATH=/bin:/sbin:/usr/bin:/usr/sbin
-export LC_ALL LANG PATH
-
-#
-# XXX todo - search and replace on these
-#
-SUCCESS=0
-FAIL=2
-YES=0
-NO=1
-YES_STR="yes"
-
-# Grab nfs lock tricks if available
-export NFS_TRICKS=1
-if [ -f "$(dirname $0)/svclib_nfslock" ]; then
-	. $(dirname $0)/svclib_nfslock
-	NFS_TRICKS=0
-else
-	unset OCF_RESKEY_nfslock
-fi
-
-
-. $(dirname $0)/ocf-shellfuncs
-
-
-meta_data()
-{
-	cat <<EOT
-<?xml version="1.0" ?>
-<resource-agent name="clusterfs" version="rgmanager 2.0">
-    <version>1.0</version>
-
-    <longdesc lang="en">
-        This defines a cluster file system mount (i.e. GFS)
-    </longdesc>
-    <shortdesc lang="en">
-        Defines a cluster file system mount.
-    </shortdesc>
-
-    <parameters>
-        <parameter name="name" primary="1">
-	    <longdesc lang="en">
-	        Symbolic name for this file system.
-	    </longdesc>
-            <shortdesc lang="en">
-                File System Name
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="mountpoint" unique="1" required="1">
-	    <longdesc lang="en">
-	        Path in file system heirarchy to mount this file system.
-	    </longdesc>
-            <shortdesc lang="en">
-                Mount Point
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="device" unique="1" required="1">
-	    <longdesc lang="en">
-	        Block device, file system label, or UUID of file system.
-	    </longdesc>
-            <shortdesc lang="en">
-                Device or Label
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="fstype">
-	    <longdesc lang="en">
-	        File system type.  If not specified, mount(8) will attempt to
-		determine the file system type.
-	    </longdesc>
-            <shortdesc lang="en">
-                File system type
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="force_unmount">
-            <longdesc lang="en">
-                If set, the cluster will kill all processes using 
-                this file system when the resource group is 
-                stopped.  Otherwise, the unmount will fail, and
-                the resource group will be restarted.
-            </longdesc>
-            <shortdesc lang="en">
-                Force Unmount
-            </shortdesc>
-	    <content type="boolean"/>
-        </parameter>
-
-        <parameter name="options">
-            <longdesc lang="en">
-                If set, the file system will be checked (even if
-                it is a journalled file system).  This option is
-                ignored for non-journalled file systems such as
-                ext2.
-            </longdesc>
-            <shortdesc lang="en">
-                Mount Options
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-	<parameter name="self_fence">
-	    <longdesc lang="en">
-	        If set and unmounting the file system fails, the node will
-		immediately reboot.  Generally, this is used in conjunction
-		with force-unmount support, but it is not required.
-	    </longdesc>
-	    <shortdesc lang="en">
-	        Seppuku Unmount
-	    </shortdesc>
-	    <content type="boolean"/>
-	</parameter>
-
-	<parameter name="fsid">
-	    <longdesc lang="en">
-	    	File system ID for NFS exports.  This can be overridden
-		in individual nfsclient entries.
-	    </longdesc>
-	    <shortdesc lang="en">
-	    	NFS File system ID
-	    </shortdesc>
-	    <content type="string"/>
-	</parameter>
-
-	<parameter name="nfslock" inherit="service%nfslock">
-	    <longdesc lang="en">
-	        If set, the node will try to kill lockd and issue 
-		reclaims across all remaining network interface cards.
-		This happens always, regardless of unmounting failed.
-	    </longdesc>
-	    <shortdesc lang="en">
-	        Enable NFS lock workarounds
-	    </shortdesc>
-	    <content type="boolean"/>
-	</parameter>
-
-    </parameters>
-
-    <actions>
-        <action name="start" timeout="900"/>
-	<action name="stop" timeout="30"/>
-	<!-- Recovery isn't possible; we don't know if resources are using
-	     the file system. -->
-
-	<!-- Checks to see if it's mounted in the right place -->
-	<action name="status" interval="1m" timeout="10"/>
-	<action name="monitor" interval="1m" timeout="10"/>
-
-	<!-- Checks to see if we can read from the mountpoint -->
-	<action name="status" depth="10" timeout="30" interval="5m"/>
-	<action name="monitor" depth="10" timeout="30" interval="5m"/>
-
-	<!-- Checks to see if we can write to the mountpoint (if !ROFS) -->
-	<action name="status" depth="20" timeout="30" interval="10m"/>
-	<action name="monitor" depth="20" timeout="30" interval="10m"/>
-
-	<action name="meta-data" timeout="5"/>
-	<action name="validate-all" timeout="5"/>
-    </actions>
-
-    <special tag="rgmanager">
-    	<child type="fs" start="1" stop="3"/>
-    	<child type="clusterfs" start="1" stop="3"/>
-        <child type="nfsexport" start="3" stop="1"/>
-    </special>
-</resource-agent>
-EOT
-}
-
-
-verify_name()
-{
-	[ -n "$OCF_RESKEY_name" ] || exit $OCF_ERR_ARGS
-}
-
-
-verify_mountpoint()
-{
-	if [ -z "$OCF_RESKEY_mountpoint" ]; then
-		ocf_log err "No mount point specified."
-		return $OCF_ERR_ARGS
-	fi
-
-	if ! [ -e "$OCF_RESKEY_mountpoint" ]; then
-		ocf_log info "Mount point $OCF_RESKEY_mountpoint will be "
-			     "created at mount time."
-		return 0
-	fi
-
-	[ -d "$OCF_RESKEY_mountpoint" ] && return 0
-
-	ocf_log err "$OCF_RESKEY_mountpoint is not a directory"
-	return $OCF_ERR_ARGS
-}
-
-
-real_device()
-{
-	declare dev=$1
-	declare realdev
-
-	[ -z "$dev" ] && return 1
-
-	if [ -h "$dev" ]; then 
-		realdev=$(readlink -f $dev)
-		if [ $? -ne 0 ]; then
-			return 1
-		fi
-		echo $realdev
-		return 0
-	fi
-
-	if [ -b "$dev" ]; then
-		echo $dev
-	       	return 0
-	fi
-		
-	realdev=$(findfs $dev 2> /dev/null) 
-	if [ -n "$realdev" ] && [ -b "$realdev" ]; then
-		echo $realdev
-		return 0
-	fi
-
-	return 1
-}
-
-
-verify_device()
-{
-	declare realdev
-
-	if [ -z "$OCF_RESKEY_device" ]; then
-	       ocf_log err "No device or label specified."
-	       return $OCF_ERR_ARGS
-	fi
-
-	realdev=$(real_device $OCF_RESKEY_device)
-	if [ -n "$realdev" ]; then
-		if [ "$realdev" != "$OCF_RESKEY_device" ]; then
-			echo "Specified $OCF_RESKEY_device maps to $realdev"
-		fi
-		return $OCF_SUCCESS
-	fi
-
-	ocf_log "Device or label \"$OCF_RESKEY_device\" not valid"
-
-	return $OCF_ERR_ARGS
-}
-
-
-verify_fstype()
-{
-	# Auto detect?
-	[ -z "$OCF_RESKEY_fstype" ] && return $OCF_SUCCESS
-
-	case $OCF_RESKEY_fstype in
-	gfs|gfs2)
-		return $OCF_SUCCESS
-		;;
-	*)
-		ocf_log err "File system type $OCF_RESKEY_fstype not supported"
-		return $OCF_ERR_ARGS
-		;;
-	esac
-}
-
-
-verify_options()
-{
-	declare -i ret=$OCF_SUCCESS
-
-	#
-	# From mount(8)
-	#
-	for o in `echo $OCF_RESKEY_options | sed -e s/,/\ /g`; do
-		case $o in
-		async|atime|auto|defaults|dev|exec|_netdev|noatime)
-			continue
-			;;
-		noauto|nodev|noexec|nosuid|nouser|ro|rw|suid|sync)
-			continue
-			;;
-		dirsync|user|users)
-			continue
-			;;
-		esac
-
-		case $OCF_RESKEY_fstype in
-		gfs)
-			case $o in
-				lockproto=*|locktable=*|hostdata=*)
-					continue;
-					;;
-				localcaching|localflocks|ignore_local_fs)
-					continue;
-					;;
-				num_glockd|acl|suiddir)	
-					continue
-					;;
-			esac
-			;;
-		gfs2)
-			# XXX
-			continue
-			;;
-		esac
-
-
-		ocf_log err "Option $o not supported for $OCF_RESKEY_fstype"
-		ret=$OCF_ERR_ARGS
-	done
-
-	return $ret
-}
-
-
-verify_all()
-{
-	verify_name || return $OCF_ERR_ARGS
-	verify_fstype || return $OCF_ERR_ARGS
-	verify_device || return $OCF_ERR_ARGS
-	verify_mountpoint || return $OCF_ERR_ARGS
-	verify_options || return $OCF_ERR_ARGS
-}
-
-
-#
-# mountInUse device mount_point
-#
-# Check to see if either the device or mount point are in use anywhere on
-# the system.  It is not required that the device be mounted on the named
-# moint point, just if either are in use.
-#
-mountInUse () {
-	typeset mp tmp_mp
-	typeset dev tmp_dev
-	typeset junk
-
-	if [ $# -ne 2 ]; then
-		ocf_log err "Usage: mountInUse device mount_point".
-		return $FAIL
-	fi
-
-	dev=$1
-	mp=$2
-
-	while read tmp_dev tmp_mp junk; do
-		if [ -n "$tmp_dev" -a "$tmp_dev" = "$dev" ]; then
-			return $YES
-		fi
-		
-		if [ -n "$tmp_mp" -a "$tmp_mp" = "$mp" ]; then
-			return $YES
-		fi
-	done < <(mount | awk '{print $1,$3}')
-
-	return $NO
-}
-
-
-#
-# isMounted device mount_point
-#
-# Check to see if the device is mounted.  Print a warning if its not
-# mounted on the directory we expect it to be mounted on.
-#
-isMounted () {
-
-	typeset mp tmp_mp
-	typeset dev tmp_dev
-
-	if [ $# -ne 2 ]; then
-		ocf_log err "Usage: isMounted device mount_point"
-		return $FAIL
-	fi
-
-	dev=$(real_device $1)
-	if [ -z "$dev" ]; then
-		ocf_log err "isMounted: Could not match $1 with a real device"
-		return $FAIL
-	fi
-	mp=$(readlink -f $2)
-	
-	while read tmp_dev tmp_mp
-	do
-		#echo "spec=$1 dev=$dev  tmp_dev=$tmp_dev"
-		tmp_dev=$(real_device $tmp_dev)
-
-		if [ -n "$tmp_dev" -a "$tmp_dev" = "$dev" ]; then
-			#
-			# Check to see if its mounted in the right
-			# place
-			#
-			if [ -n "$tmp_mp"  -a "$tmp_mp"  != "$mp" ]; then
-				ocf_log warn "\
-Device $dev is mounted on $tmp_mp instead of $mp"
-			fi
-			return $YES
-		fi
-	done < <(mount | awk '{print $1,$3}')
-
-	return $NO
-}
-
-
-# 
-# isAlive mount_point
-# 
-# Check to see if mount_point is alive (testing read/write)
-# 
-isAlive()
-{
-	declare mount_point
-	declare file=".writable_test"
-	declare rw
-	
-	if [ $# -ne 1 ]; then
-	        ocf_log err "Usage: isAlive mount_point"
-		return $FAIL
-	fi
-	mount_point=$1
-	
-	test -d $mount_point
-	if [ $? -ne 0 ]; then
-		ocf_log err "$mount_point is not a directory"
-		return $FAIL
-	fi
-	
-	[ $OCF_CHECK_LEVEL -lt 10 ] && return $YES
-	
-	# depth 10 test (read test)
-	ls $mount_point > /dev/null 2> /dev/null
-	if [ $? -ne 0 ]; then
-	       return $NO
-	fi
-	
-	[ $OCF_CHECK_LEVEL -lt 20 ] && return $YES
-	
-	# depth 20 check (write test)
-	rw=$YES
-	for o in `echo $OCF_RESKEY_options | sed -e s/,/\ /g`; do
-                if [ "$o" = "ro" ]; then
-		        rw=$NO
-                fi
-	done
-	if [ $rw -eq $YES ]; then
-	        file=$mount_point/$file
-		while true; do
-			if [ -e "$file" ]; then
-				file=${file}_tmp
-				continue
-			else
-			        break
-			fi
-		done
-		touch $file > /dev/null 2> /dev/null
-		[ $? -ne 0 ] && return $NO
-		rm -f $file > /dev/null 2> /dev/null
-	fi
-	
-	return $YES
-}
-
-
-#
-# killMountProcesses device mount_point
-#
-# Using lsof or fuser try to unmount the mount by killing of the processes
-# that might be keeping it busy.
-#
-killMountProcesses()
-{
-	typeset -i ret=$SUCCESS
-	typeset have_lsof=""
-	typeset have_fuser=""
-	typeset try
-
-	if [ $# -ne 1 ]; then
-		ocf_log err \
-			"Usage: killMountProcesses mount_point"
-		return $FAIL
-	fi
-
-	typeset mp=$1
-
-	ocf_log notice "Forcefully unmounting $mp"
-
-	#
-	# Not all distributions have lsof.  If not use fuser.  If it
-	# does, try both.
-  	#
-	file=$(which lsof 2>/dev/null)
-	if [ -f "$file" ]; then
-		have_lsof=$YES
-	fi
-
-	file=$(which fuser 2>/dev/null)
-	if [ -f "$file" ]; then
-		have_fuser=$YES
-	fi             
-
-	if [ -z "$have_lsof" -a -z "$have_fuser" ]; then
-		ocf_log warn \
-	"Cannot forcefully unmount $mp; cannot find lsof or fuser commands"
-		return $FAIL
-	fi
-
-	for try in 1 2 3; do
-		if [ -n "$have_lsof" ]; then
-			#
-			# Use lsof to free up mount point
-			#
-	    		while read command pid user
-			do
-				if [ -z "$pid" ]; then
-					continue
-				fi
-
-				if [ $try -eq 1 ]; then
-					ocf_log warn \
-			 	  "killing process $pid ($user $command $mp)"
-				elif [ $try -eq 3 ]; then
-					ocf_log crit \
-		    		  "Could not clean up mountpoint $mp"
-				ret=$FAIL
-				fi
-
-				if [ $try -gt 1 ]; then
-					kill -9 $pid
-				else
-					kill -TERM $pid
-				fi
-			done < <(lsof -b 2>/dev/null | \
-			    grep -E "$mp(/.*|)\$" | \
-			    awk '{print $1,$2,$3}' | \
-			    sort -u -k 1,3)
-		elif [ -n "$have_fuser" ]; then
-			#
-			# Use fuser to free up mount point
-			#
-			while read command pid user
-			do
-				if [ -z "$pid" ]; then
-					continue
-				fi
-
-				if [ $try -eq 1 ]; then
-					ocf_log warn \
-			 	  "killing process $pid ($user $command $mp)"
-				elif [ $try -eq 3 ]; then
-					ocf_log crit \
-				    "Could not clean up mount point $mp"
-					ret=$FAIL
-				fi
-
-				if [ $try -gt 1 ]; then
-					kill -9 $pid
-				else
-					kill -TERM $pid
-				fi
-			done < <(fuser -vm $mp 2>&1 | \
-			    grep -v PID | \
-			    sed 's;^'$mp:';;' | \
-			    awk '{print $4,$2,$1}' | \
-			    sort -u -k 1,3)
-		fi
-	done
-
-	return $ret
-}
-
-#
-# startFilesystem
-#
-startFilesystem() {
-	typeset -i ret_val=$SUCCESS
-	typeset mp=""			# mount point
-	typeset dev=""			# device
-	typeset fstype=""
-	typeset opts=""
-	typeset device_in_use=""
-	typeset mount_options=""
-
-	#
-	# Get the mount point, if it exists.  If not, no need to continue.
-	#
-	mp=${OCF_RESKEY_mountpoint}
-	case "$mp" in 
-      	""|"[ 	]*")		# nothing to mount
-    		return $SUCCESS
-    		;;
-	/*)			# found it
-	  	;;
-	*)	 		# invalid format
-			ocf_log err \
-"startFilesystem: Invalid mount point format (must begin with a '/'): \'$mp\'"
-	    	return $FAIL
-	    	;;
-	esac
-	
-	#
-	# Get the device
-	#
-	dev=$(real_device $OCF_RESKEY_device)
-	if [ -z "$dev" ]; then
-			ocf_log err "\
-startFilesystem: Could not match $OCF_RESKEY_device with a real device"
-			return $FAIL
-	fi
-
-	#
-	# Ensure we've got a valid directory
-	#
-	if [ -e "$mp" ]; then
-		if ! [ -d "$mp" ]; then
-			ocf_log err "\
-startFilesystem: Mount point $mp exists but is not a directory"
-			return $FAIL
-		fi
-	else
-		ocf_log info "\
-startFilesystem: Creating mount point $mp for device $dev"
-		mkdir -p $mp
-	fi
-
-	#
-	# Get the filesystem type, if specified.
-	#
-	fstype_option=""
-	fstype=${OCF_RESKEY_fstype}
-       	case "$fstype" in 
-	""|"[ 	]*")
-		fstype=""
-		;;
-	*)	# found it
-		fstype_option="-t $fstype"
-		;;
-	esac
-
-	#
-	# See if the device is already mounted.
-	# 
-	isMounted $dev $mp
-	case $? in
-	$YES)		# already mounted
-		ocf_log debug "$dev already mounted"
-		return $SUCCESS
-		;;
-	$NO)		# not mounted, continue
-		;;
-	$FAIL)
-		return $FAIL
-		;;
-	esac
-
-
-	#
-	# Make sure that neither the device nor the mount point are mounted
-	# (i.e. they may be mounted in a different location).  The'mountInUse'
-	# function checks to see if either the device or mount point are in
-	# use somewhere else on the system.
-	#
-	mountInUse $dev $mp
-	case $? in
-	$YES)		# uh oh, someone is using the device or mount point
-		ocf_log err "\
-Cannot mount $dev on $mp, the device or mount point is already in use!"
-		return $FAIL
-		;;
-	$NO)		# good, no one else is using it
-		;;
-	$FAIL)
-		return $FAIL
-		;;
-	*)
-		ocf_log err "Unknown return from mountInUse"
-		return $FAIL
-		;;
-	esac
-
-	#
-	# Make sure the mount point exists.
-	#
-	if [ ! -d $mp ]; then
-		rm -f $mp			# rm in case its a plain file
-		mkdir -p $mp			# create the mount point
-		ret_val=$?
-		if [ $ret_val -ne 0 ]; then
-			ocf_log err \
-				"'mkdir -p $mp' failed, error=$ret_val"
-			return $FAIL
-		fi
-	fi
-
-	#
-	# Get the mount options, if they exist.
-	#
-	mount_options=""
-	opts=${OCF_RESKEY_options}
-	case "$opts" in 
-	""|"[ 	]*")
-		opts=""
-		;;
-	*)	# found it
-		mount_options="-o $opts"
-		;;
-	esac
-
-	#
-	# Mount the device
-	#
-	ocf_log debug "mount $fstype_option $mount_options $dev $mp"
-	mount $fstype_option $mount_options $dev $mp
-	ret_val=$?
-	if [ $ret_val -ne 0 ]; then
-		ocf_log err "\
-'mount $fstype_option $mount_options $dev $mp' failed, error=$ret_val"
-		return $FAIL
-	fi
-	
-	return $SUCCESS
-}
-
-
-#
-# stopFilesystem serviceID deviceID
-#
-# Run the stop actions
-#
-stopFilesystem() {
-	typeset -i ret_val=0
-	typeset -i try=1
-	typeset -i max_tries=3		# how many times to try umount
-	typeset -i sleep_time=2		# time between each umount failure
-	typeset -i refs=0
-	typeset done=""
-	typeset umount_failed=""
-	typeset force_umount=""
-	typeset self_fence=""
-	typeset fstype=""
-
-
-	#
-	# Get the mount point, if it exists.  If not, no need to continue.
-	#
-	mp=${OCF_RESKEY_mountpoint}
-	case "$mp" in 
-      	""|"[ 	]*")		# nothing to mount
-    		return $SUCCESS
-    		;;
-	/*)			# found it
-	  	;;
-	*)	 		# invalid format
-			ocf_log err \
-"stopFilesystem: Invalid mount point format (must begin with a '/'): \'$mp\'"
-	    	return $FAIL
-	    	;;
-	esac
-	
-	#
-	# Get the device
-	#
-	dev=$(real_device $OCF_RESKEY_device)
-	if [ -z "$dev" ]; then
-			ocf_log err "\
-stop: Could not match $OCF_RESKEY_device with a real device"
-			return $FAIL
-	fi
-
-
-	#
-	# Get the force unmount setting if there is a mount point.
-	#
-	if [ -n "$mp" ]; then
-		case ${OCF_RESKEY_force_unmount} in
-	        $YES_STR)	force_umount=$YES ;;
-		1)		force_umount=$YES ;;
-	        *)		force_umount="" ;;
-		esac
-	fi
-
-	if [ -n "$mp" ]; then
-		case ${OCF_RESKEY_self_fence} in
-	        $YES_STR)	self_fence=$YES ;;
-		1)		self_fence=$YES ;;
-	        *)		self_fence="" ;;
-		esac
-	fi
-
-	#
-	# Check the rgmanager-supplied reference count if one exists.
-	# If the reference count is <= 1, we can safely proceed
-	#
-	if [ -n "$OCF_RESKEY_RGMANAGER_meta_refcnt" ]; then
-		refs=$OCF_RESKEY_RGMANAGER_meta_refcnt
-		if [ $refs -gt 1 ]; then
-			((refs--))
-			ocf_log debug "Not unmounting $OCF_RESOURCE_INSTANCE - still in use by $refs other service(s)"
-			return $OCF_SUCCESS
-		fi
-	fi
-
-	#
-	# Always do this hackery on clustered file systems.
-	#
-	if [ "$OCF_RESKEY_nfslock" = "yes" ] || \
-	   [ "$OCF_RESKEY_nfslock" = "1" ]; then
-		ocf_log warning "Dropping node-wide NFS locks"
-		mkdir -p $mp/.clumanager/statd
-		pkill -KILL -x lockd
-		# Copy out the notify list; our 
-		# IPs are already torn down
-		if notify_list_store $mp/.clumanager/statd; then
-			notify_list_broadcast $mp/.clumanager/statd
-		fi
-	fi
-
-	# Always invalidate buffers on clusterfs resources
-	clubufflush -f $dev
-
-	if [ -z "$force_umount" ]; then
-		ocf_log debug "Not umounting $dev (clustered file system)"
-		return $SUCCESS
-	fi
-
-	#
-	# Unmount the device.  
-	#
-	while [ ! "$done" ]; do
-		isMounted $dev $mp
-		case $? in
-		$NO)
-			ocf_log info "$dev is not mounted"
-			umount_failed=
-			done=$YES
-			;;
-		$FAIL)
-			return $FAIL
-			;;
-		$YES)
-			sync; sync; sync
-			ocf_log info "unmounting $dev ($mp)"
-
-			umount $mp
-			if  [ $? -eq 0 ]; then
-				umount_failed=
-				done=$YES
-				continue
-			fi
-
-			umount_failed=yes
-
-			if [ "$force_umount" ]; then
-				killMountProcesses $mp
-			fi
-
-			if [ $try -ge $max_tries ]; then
-				done=$YES
-			else
-				sleep $sleep_time
-				let try=try+1
-			fi
-			;;
-		*)
-			return $FAIL
-			;;
-		esac
-
-		if [ $try -ge $max_tries ]; then
-			done=$YES
-		else
-			sleep $sleep_time
-			let try=try+1
-		fi
-	done # while 
-
-	if [ -n "$umount_failed" ]; then
-		ocf_log err "'umount $mp' failed, error=$ret_val"
-
-		if [ "$self_fence" ]; then
-			ocf_log alert "umount failed - REBOOTING"
-			sync
-			reboot -fn
-		fi
-		return $FAIL
-	fi
-
-	return $SUCCESS
-}
-
-
-case $1 in
-start)
-	declare tries=0
-	declare rv
-
-	while [ $tries -lt 3 ]; do
-		startFilesystem
-		rv=$?
-		if [ $rv -eq 0 ]; then
-			exit 0
-		fi
-
-		((tries++))
-		sleep 3
-	done
-	exit $rv
-	;;
-stop)
-	stopFilesystem
-	exit $?
-	;;
-status|monitor)
-  	isMounted ${OCF_RESKEY_device} ${OCF_RESKEY_mountpoint}
- 	[ $? -ne $YES ] && exit $OCF_ERR_GENERIC
-
- 	isAlive ${OCF_RESKEY_mountpoint}
- 	[ $? -ne $YES ] && exit $OCF_ERR_GENERIC
- 	
-	exit 0
-	;;
-restart)
-	stopFilesystem
-	if [ $? -ne 0 ]; then
-		exit $OCF_ERR_GENERIC
-	fi
-
-	startFilesystem
-	if [ $? -ne 0 ]; then
-		exit $OCF_ERR_GENERIC
-	fi
-
-	exit 0
-	;;
-meta-data)
-	meta_data
-	exit 0
-	;;
-validate-all)
-	verify_all
-	;;
-*)
-	echo "usage: $0 {start|stop|status|monitor|restart|meta-data|validate-all}"
-	exit $OCF_ERR_UNIMPLEMENTED
-	;;
-esac
-
-exit 0
diff --git a/rgmanager/src/resources/default_event_script.sl b/rgmanager/src/resources/default_event_script.sl
deleted file mode 100644
index 3f1379a..0000000
--- a/rgmanager/src/resources/default_event_script.sl
+++ /dev/null
@@ -1,319 +0,0 @@
-define node_in_set(node_list, node)
-{
-	variable x, len;
-
-	len = length(node_list);
-	for (x = 0; x < len; x++) {
-		if (node_list[x] == node)
-			return 1;
-	}
-
-	return 0;
-}
-
-define move_or_start(service, node_list)
-{
-	variable len;
-	variable state, owner;
-	variable depends;
-
-	depends = service_property(service, "depend");
-	if (depends != "") {
-		(owner, state) = service_status(depends);
-		if (owner < 0) {
-			debug(service, " is not runnable; dependency not met");
-			return ERR_DEPEND;
-		}
-	}
-
-	(owner, state) = service_status(service);
-	debug("Evaluating ", service, " state=", state, " owner=", owner);
-
-	len = length(node_list);
-	if (len == 0) {
-		notice(service, " is not runnable - restricted domain offline");
-		()=service_stop(service);
-		return ERR_DOMAIN;
-	}
-
-	if (((event_type != EVENT_USER) and (state == "disabled")) or
-            ((state == "failed") or (state == "frozen"))) {
-		%
-		% Commenting out this block will -not- allow you to
-		% recover failed services from event scripts.  Sorry.
-		% All it will get you is a false log message about
-		% starting this service.
-		%
-		% You may enable disabled services, but I recommend
-		% against it.
-		%
-		debug(service, " is not runnable");
-		return -1;
-	}
-
-	if (node_list[0] == owner) {
-		debug(service, " is already running on best node");
-		return ERR_RUNNING;
-	}
-
-	if ((owner >= 0) and (node_in_set(node_list, owner) == 1)) {
-		notice("Moving ", service, " from ", owner,
-		       " to ", node_list);
-		if (service_stop(service) < 0) {
-			return ERR_ABORT;
-		}
-	} else {
-		notice("Starting ", service, " on ", node_list);
-	}
-
-	return service_start(service, node_list);
-}
-
-
-%
-% Returns the set of online nodes in preferred/shuffled order which
-% are allowed to run this service.  Gives highest preference to current
-% owner if nofailback is specified.
-% 
-define allowed_nodes(service)
-{
-	variable anodes;
-	variable online;
-	variable nodes_domain;
-	variable ordered, restricted, nofailback;
-	variable state, owner;
-	variable depends;
-
-	(nofailback, restricted, ordered, nodes_domain) =
-			service_domain_info(service);
-
-	(owner, state) = service_status(service);
-
-	anodes = nodes_online();
-
-	% Shuffle the array so we don't start all services on the same
-	% node.  TODO - add RR, Least-services, placement policies...
-	online = shuffle(anodes);
-
-	if (restricted == 1) {
-		anodes = intersection(nodes_domain, online);
-	} else {
-		% Ordered failover domains (nodes_domain) unioned with the
-		% online nodes basically just reorders the online node list
-		% according to failover domain priority rules.
-		anodes = union(intersection(nodes_domain, online),
-			       online);
-	}
-
-	if ((nofailback == 1) or (ordered == 0)) {
-		
-		if ((owner < 0) or (node_in_set(anodes, owner) == 0)) {
-			return anodes;
-		}
-		
-		% Because union takes left as priority, we can
-		% return the union of the current owner with the
-		% allowed node list.  This means the service will
-		% remain on the same node it's currently on.
-		return union(owner, anodes);
-	}
-
-	return anodes;
-}
-
-
-define default_node_event_handler()
-{
-	variable services = service_list();
-	variable x;
-	variable nodes;
-
-	% debug("Executing default node event handler");
-	for (x = 0; x < length(services); x++) {
-		nodes = allowed_nodes(services[x]);
-		()=move_or_start(services[x], nodes);
-	}
-}
-
-
-define default_service_event_handler()
-{
-	variable services = service_list();
-	variable x;
-	variable depends;
-	variable depend_mode;
-	variable policy;
-	variable nodes;
-	variable tmp;
-	variable owner;
-	variable state;
-
-	% debug("Executing default service event handler");
-
-	if (service_state == "recovering") {
-
-		policy = service_property(service_name, "recovery");
-		debug("Recovering",
-		      " Service: ", service_name,
-		      " Last owner: ", service_last_owner,
-		      " Policy: ", policy);
-
-		if (policy == "disable") {
-			() = service_stop(service_name, 1);
-			return;
-		}
-
-		nodes = allowed_nodes(service_name);
-		if (policy == "restart") {
-			tmp = union(service_last_owner, nodes);
-		} else {
-			% relocate 
-			tmp = subtract(nodes, service_last_owner);
-			nodes = tmp;
-			tmp = union(nodes, service_last_owner);
-		}
-
-		()=move_or_start(service_name, nodes);
-
-		return;
-	}
-
-	for (x = 0; x < length(services); x++) {
-		if (service_name == services[x]) {
-			% don't do anything to ourself! 
-			continue;
-		}
-
-		%
-		% Simplistic dependency handling
-		%
-		depends = service_property(services[x], "depend");
-		depend_mode = service_property(services[x], "depend_mode");
-
-		% No dependency; do nothing
-		if (depends != service_name) {
-			continue;
-		}
-
-		(owner, state) = service_status(services[x]);
-		if ((service_state == "started") and (owner < 0) and
-		    (state == "stopped")) {
-			info("Dependency met; starting ", services[x]);
-			nodes = allowed_nodes(services[x]);
-			()=move_or_start(services[x], nodes);
-		}
-
-		% service died - stop service(s) that depend on the dead
-		if ((service_owner < 0) and (owner >= 0) and
-		    (depend_mode != "soft")) {
-			info("Dependency lost; stopping ", services[x]);
-			()=service_stop(services[x]);
-		}
-	}
-}
-
-define default_config_event_handler()
-{
-	% debug("Executing default config event handler");
-}
-
-define default_user_event_handler()
-{
-	variable ret;
-	variable nodes;
-	variable reordered;
-	variable x;
-	variable target = user_target;
-	variable found = 0;
-	variable owner, state;
-
-	nodes = allowed_nodes(service_name);
-	(owner, state) = service_status(service_name);
-
-	if (user_request == USER_RESTART) {
-
-		if (owner >= 0) {
-			reordered = union(owner, nodes);
-			nodes = reordered;
-		}
-
-		notice("Stopping ", service_name, " for relocate to ", nodes);
-
-		found = service_stop(service_name);
-		if (found < 0) {
-			return ERR_ABORT;
-		}
-
-		ret = move_or_start(service_name, nodes);
-
-	} else if ((user_request == USER_RELOCATE) or 
-		   (user_request == USER_ENABLE)) {
-
-		if (user_target > 0) {
-			for (x = 0; x < length(nodes); x++) {
-				%
-				% Put the preferred node at the front of the 
-				% list for a user-relocate operation
-				%
-				if (nodes[x] == user_target) {
-					reordered = union(user_target, nodes);
-					nodes = reordered;
-					found = 1;
-				}
-			}
-	
-			if (found == 0) {
-				warning("User specified node ", user_target,
-					" is offline");
-			}
-		}
-
-		if ((owner >= 0) and (user_request == USER_RELOCATE)) {
-			if (service_stop(service_name) < 0) {
-				return ERR_ABORT;
-			}
-
-			%
-			% The current owner shouldn't be the default
-			% for a relocate operation
-			%
-			reordered = subtract(nodes, owner);
-			nodes = union(reordered, owner);
-		}
-
-		ret = move_or_start(service_name, nodes);
-
-	} else if (user_request == USER_DISABLE) {
-
-		ret = service_stop(service_name, 1);
-
-	} else if (user_request == USER_STOP) {
-
-		ret = service_stop(service_name);
-
-	} else if (user_request == USER_FREEZE) {
-
-		ret = service_freeze(service_name);
-
-	} else if (user_request == USER_UNFREEZE) {
-
-		ret = service_unfreeze(service_name);
-
-	}
-
-	%
-	% todo - migrate
-	%
-
-	return ret;
-}
-
-if (event_type == EVENT_NODE)
-	default_node_event_handler();
-if (event_type == EVENT_SERVICE)
-	default_service_event_handler();
-if (event_type == EVENT_CONFIG)
-	default_config_event_handler();
-if (event_type == EVENT_USER)
-	user_return=default_user_event_handler();
-
diff --git a/rgmanager/src/resources/follow-service.sl b/rgmanager/src/resources/follow-service.sl
deleted file mode 100644
index 7cf2680..0000000
--- a/rgmanager/src/resources/follow-service.sl
+++ /dev/null
@@ -1,151 +0,0 @@
-% follow-service.sl
-%
-% Description:	Implements the "follow service" mechanism based on the Red Hat RIND event 
-%               scripting mechanism.
-%
-% Author:       Marc Grimme, Mark Hlawatschek, October 2008
-% Support:      support@atix.de
-% License:      GNU General Public License (GPL), version 2 or later
-% Copyright:    (c) 2008 ATIX AG
-
-
-debug("*** follow-service.sl");
-
-
-%
-% Returns a list of nodes for the given service that are online and in the failoverdomain.
-%
-define nodelist_online(service_name) {
-   variable nodes, nofailback, restricted, ordered, node_list;
-   nodes=nodes_online();
-   
-   (nofailback, restricted, ordered, node_list) = service_domain_info(service_name);
-   
-   return intersection(nodes, node_list);
-}
-
-%
-% Idea: 
-%   General purpose function of a construct when Service(svc1) and Service(svc2) 
-%   should not be running on the same node even after failover.
-%   There are to options to influence the behaviour. If both services have to be 
-%   running on the same node (only one node is left in the failovergroup) what 
-%   service is the master and should both services be running or only the master
-%   service survives. If master is not svc1 or svc2 both service might run on the 
-%   same node. If master is either svc1 or svc2 the specified one will be the 
-%   surviving service.
-%   If followslave is not 0 the svc1 always follows svc2. That means it will be 
-%   started on on the same node as svc1. And if available svc2 will be relocated
-%   to any other node.
-%
-define follow_service(svc1, svc2, master) %, followslave)
-{
-	variable state, owner_svc1, owner_svc2;
-	variable nodes1, nodes2, allowed;
-
-	debug("*** FOLLOW_SERVICE: follow_service(",svc1,", ",svc2,", ", master, ")");
-	debug("*** FOLLOW_SERVICE: event_type: ", event_type, ", service_name: ", service_name, ", service_state: ", service_state);
-
-	%
-	% setup the master
-	%
-	if ((master != svc1) and (master != svc2)) {
-		debug("*** FOLLOW_SERVICE: master=NULL");
-		master=NULL;
-	}
-
-	% get infos we need to decide further
-	(owner_svc1, state) = service_status(svc1);
-	(owner_svc2, state) = service_status(svc2);
-	nodes1 = nodelist_online(svc1);
-	nodes2 = nodelist_online(svc2);
-	debug("*** FOLLOW_SERVICE: service_status(",svc1,"): ", service_status(svc1));
-	debug("*** FOLLOW_SERVICE: owner_svc1: ", owner_svc1, ", owner_svc2: ", owner_svc2, ", nodes1: ", nodes1, ", nodes2: ", nodes2);
-
-	if (((event_type == EVENT_NODE)    and (owner_svc1 == node_id) and (node_state == NODE_OFFLINE) and (owner_svc2 >=0)) or 
-		((event_type == EVENT_SERVICE) and (service_name == svc1)  and (service_state == "recovering" ) and (owner_svc2 >= 0))) {
-		%
-		% uh oh, the owner of the master server died.  Restart it
-		% on the node running the slave server or if we should not 
-		% follow the slave start it somewhere else.
-		% We should end up here if svc1 has to be restarted
-
-		%
-		% If this was a service event, don't execute the default event
-		% script trigger after this script completes.
-		%
-		if (event_type == EVENT_SERVICE) {
-			stop_processing();
-		}
-		% were to start svc2
-		allowed=subtract(nodes2, owner_svc2);
-		if (length(allowed) > 1) {
-			allowed=subtract(allowed, service_last_owner);
-		}
-		debug("*** FOLLOW SERVICE: service event triggered following svc2 to ",owner_svc2, " svc2 on : ",allowed);
-
-		% either svc1 is the master or there are node were to start svc2
-		if ((master == svc1) or (length(allowed) > 0)) {
-			()=service_start(svc1, owner_svc2);
-		}
-		% either svc2 is the master or there are node were to start svc2
-		if ((master == svc2) or (length(allowed) > 0)) {
-			()=service_stop(svc2);
-        	()=service_start(svc2, allowed);
-		} 
-	}
-	else if (((event_type == EVENT_NODE) and (owner_svc2 == node_id) and (node_state == NODE_OFFLINE) and (owner_svc2 >=0)) or 
-		((event_type == EVENT_SERVICE) and (service_name == svc2) and (service_state == "recovering" ) and (owner_svc1 >= 0))) {
-		%
-		% uh oh, the owner of the svc2 died.  Restart it
-		% on any other node but not the one running the svc1.
-		% If svc1 is the only one left only start it there 
-		% if master==svc2
-		%
-		% Just relocate svc2 or if svc2 is master stop svc1 and start svc2 on owner_svc1
-
-		%
-		% If this was a service event, don't execute the default event
-		% script trigger after this script completes.
-		%
-	  
-		if (event_type == EVENT_SERVICE) {
-			stop_processing();
-		}
-
-		allowed=subtract(nodes2, owner_svc1);
-		if (length(allowed) > 1) {
-			allowed=subtract(allowed, service_last_owner);
-		}
-
-		debug("*** FOLLOW SERVICE: service event triggered relocating svc2 to ",allowed, " svc1 on : ",owner_svc1);
-
-		if (length(allowed) > 0) {
-			()=service_stop(svc2);
-			()=service_start(svc2, allowed);
-		} else if (master == svc2) {
-			()=service_stop(svc1);
-			()=service_start(svc2, owner_svc1);
-		}
-	}
-	else if (((event_type == EVENT_SERVICE) and (service_state == "started") and (owner_svc2 == owner_svc1) and (owner_svc1 > 0) and (owner_svc2 > 0)) or
-    		((event_type == EVENT_CONFIG) and (owner_svc2 == owner_svc1))) {
-		allowed=subtract(nodes2, owner_svc1);
-		debug("*** FOLLOW SERVICE: service event both running on same node triggered.", allowed);
-		if (length(allowed) > 0) {
-			%()=service_stop(svc1);
-			%()=service_start(svc1, owner_svc2);
-			()=service_stop(svc2);
-			()=service_start(svc2, allowed);
-		} else if ((master == svc2) and (owner_svc2 > 0)){
-			debug("*** FOLLOW SERVICE: will stop service .", svc1); 
-			()=service_stop(svc1);
-		} else if ((master == svc1) and (owner_svc1 > 0)) {
-			debug("*** FOLLOW SERVICE: will stop service .", svc2);
-			()=service_stop(svc2);
-		} else {
-			debug("*** FOLLOW SERVICE: both services running on the same node or only one is running.", allowed, ", ", master);
-		}
-	}
-	return;
-}
diff --git a/rgmanager/src/resources/fs.sh.in b/rgmanager/src/resources/fs.sh.in
deleted file mode 100644
index b00cf46..0000000
--- a/rgmanager/src/resources/fs.sh.in
+++ /dev/null
@@ -1,1304 +0,0 @@
-#!/bin/bash
-
-#
-# File system (normal) mount/umount/fsck/etc. agent
-#
-
-LC_ALL=C
-LANG=C
-PATH=/bin:/sbin:/usr/bin:/usr/sbin
-export LC_ALL LANG PATH
-
-#
-# XXX todo - search and replace on these
-#
-SUCCESS=0
-FAIL=2
-YES=0
-NO=1
-YES_STR="yes"
-INVALIDATEBUFFERS="/bin/true"
-
-# Grab nfs lock tricks if available
-export NFS_TRICKS=1
-if [ -f "$(dirname $0)/svclib_nfslock" ]; then
-	. $(dirname $0)/svclib_nfslock
-	NFS_TRICKS=0
-fi
-
-. $(dirname $0)/ocf-shellfuncs
-
-meta_data()
-{
-	cat <<EOT
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<resource-agent name="fs" version="rgmanager 2.0">
-    <version>1.0</version>
-
-    <longdesc lang="en">
-        This defines a standard file system mount (= not a clustered
-	or otherwise shared file system).
-    </longdesc>
-    <shortdesc lang="en">
-        Defines a file system mount.
-    </shortdesc>
-
-    <parameters>
-        <parameter name="name" primary="1">
-	    <longdesc lang="en">
-	        Symbolic name for this file system.
-	    </longdesc>
-            <shortdesc lang="en">
-                File System Name
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="mountpoint" unique="1" required="1">
-	    <longdesc lang="en">
-	        Path in file system heirarchy to mount this file system.
-	    </longdesc>
-            <shortdesc lang="en">
-                Mount Point
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="device" unique="1" required="1">
-	    <longdesc lang="en">
-	        Block device, file system label, or UUID of file system.
-	    </longdesc>
-            <shortdesc lang="en">
-                Device or Label
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="fstype">
-	    <longdesc lang="en">
-	        File system type.  If not specified, mount(8) will attempt to
-		determine the file system type.
-	    </longdesc>
-            <shortdesc lang="en">
-                File system type
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="force_unmount">
-            <longdesc lang="en">
-                If set, the cluster will kill all processes using 
-                this file system when the resource group is 
-                stopped.  Otherwise, the unmount will fail, and
-                the resource group will be restarted.
-            </longdesc>
-            <shortdesc lang="en">
-                Force Unmount
-            </shortdesc>
-	    <content type="boolean"/>
-        </parameter>
-
-	<!-- 
-        <parameter name="active_monitor">
-            <longdesc lang="en">
-	    	If set, the cluster will spawn an active monitoring 
-		daemon which watches the ability to issue I/Os to the
-		file system.  Requires a file system with O_DIRECT
-		support.
-            </longdesc>
-            <shortdesc lang="en">
-	    	Active Monitoring
-            </shortdesc>
-	    <content type="boolean"/>
-        </parameter>
-	-->
-
-	<parameter name="self_fence">
-	    <longdesc lang="en">
-	        If set and unmounting the file system fails, the node will
-		immediately reboot.  Generally, this is used in conjunction
-		with force-unmount support, but it is not required.
-	    </longdesc>
-	    <shortdesc lang="en">
-	        Seppuku Unmount
-	    </shortdesc>
-	    <content type="boolean"/>
-	</parameter>
-
-	<parameter name="nfslock" inherit="nfslock">
-	    <longdesc lang="en">
-	        If set and unmounting the file system fails, the node will
-		try to kill lockd and issue reclaims across all remaining
-		network interface cards.
-	    </longdesc>
-	    <shortdesc lang="en">
-	        Enable NFS lock workarounds
-	    </shortdesc>
-	    <content type="boolean"/>
-	</parameter>
-
-	<parameter name="fsid">
-	    <longdesc lang="en">
-	    	File system ID for NFS exports.  This can be overridden
-		in individual nfsclient entries.
-	    </longdesc>
-	    <shortdesc lang="en">
-	    	NFS File system ID
-	    </shortdesc>
-	    <content type="string"/>
-	</parameter>
-
-        <parameter name="force_fsck">
-            <longdesc lang="en">
-                If set, the file system will be checked (even if
-                it is a journalled file system).  This option is
-                ignored for non-journalled file systems such as
-                ext2.
-            </longdesc>
-            <shortdesc lang="en">
-                Force fsck support
-            </shortdesc>
-	    <content type="boolean"/>
-        </parameter>
-
-        <parameter name="options">
-            <longdesc lang="en">
-	    	Options used when the file system is mounted.  These
-		are often file-system specific.  See mount(8) for supported
-		mount options.
-            </longdesc>
-            <shortdesc lang="en">
-                Mount Options
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-    </parameters>
-
-    <actions>
-        <action name="start" timeout="900"/>
-	<action name="stop" timeout="30"/>
-	<!-- Recovery isn't possible; we don't know if resources are using
-	     the file system. -->
-
-	<!-- Checks to see if it's mounted in the right place -->
-	<action name="status" interval="1m" timeout="10"/>
-	<action name="monitor" interval="1m" timeout="10"/>
-
-	<!-- Note: active monitoring is constant and supplants all
-	     check depths -->
-	<!-- Checks to see if we can read from the mountpoint -->
-	<action name="status" depth="10" timeout="30" interval="30"/>
-	<action name="monitor" depth="10" timeout="30" interval="30"/>
-
-	<!-- Checks to see if we can write to the mountpoint (if !ROFS) -->
-	<action name="status" depth="20" timeout="30" interval="1m"/>
-	<action name="monitor" depth="20" timeout="30" interval="1m"/>
-
-	<action name="meta-data" timeout="5"/>
-	<action name="validate-all" timeout="5"/>
-    </actions>
-
-    <special tag="rgmanager">
-	<attributes maxinstances="1"/>
-        <child type="fs" start="1" stop="3"/>
-        <child type="clusterfs" start="1" stop="3"/>
-        <child type="nfsexport" start="3" stop="1"/>
-    </special>
-</resource-agent>
-EOT
-}
-
-verify_name()
-{
-	if [ -z "$OCF_RESKEY_name" ]; then
-		ocf_log err "No file system name specified."
-		return $OCF_ERR_ARGS
-	fi
-	return $OCF_SUCCESS
-}
-
-
-verify_mountpoint()
-{
-	if [ -z "$OCF_RESKEY_mountpoint" ]; then
-		ocf_log err "No mount point specified."
-		return $OCF_ERR_ARGS
-	fi
-
-	if ! [ -e "$OCF_RESKEY_mountpoint" ]; then
-		ocf_log info "Mount point $OCF_RESKEY_mountpoint will be "\
-				"created at mount time."
-		return $OCF_SUCCESS
-	fi
-
-	[ -d "$OCF_RESKEY_mountpoint" ] && return $OCF_SUCCESS
-
-	ocf_log err "$OCF_RESKEY_mountpoint exists but is not a directory."
-	
-	return $OCF_ERR_ARGS
-}
-
-
-real_device()
-{
-	declare dev=$1
-	declare realdev
-
-	[ -z "$dev" ] && return $OCF_ERR_ARGS
-
-	if [ -h "$dev" ]; then 
-		realdev=$(readlink -f $dev)
-		if [ $? -ne 0 ]; then
-			return $OCF_ERR_ARGS
-		fi
-		echo $realdev
-		return $OCF_SUCCESS
-	fi
-
-	if [ -b "$dev" ]; then
-		echo $dev
-	       	return $OCF_SUCCESS
-	fi
-		
-	realdev=$(findfs $dev 2> /dev/null)
-	if [ -n "$realdev" ] && [ -b "$realdev" ]; then
-		echo $realdev
-		return $OCF_SUCCESS
-	fi
-
-	return $OCF_ERR_GENERIC
-}
-
-
-verify_device()
-{
-	declare realdev
-
-	if [ -z "$OCF_RESKEY_device" ]; then
-	       ocf_log err "No device or label specified."
-	       return $OCF_ERR_ARGS
-	fi
-
-	realdev=$(real_device $OCF_RESKEY_device)
-	if [ -n "$realdev" ]; then
-		if [ "$realdev" != "$OCF_RESKEY_device" ]; then
-			ocf_log info "Specified $OCF_RESKEY_device maps to $realdev"
-		fi
-		return $OCF_SUCCESS
-	fi
-
-	ocf_log err "Device or label \"$OCF_RESKEY_device\" not valid"
-
-	return $OCF_ERR_ARGS
-}
-
-
-verify_fstype()
-{
-	# Auto detect?
-	[ -z "$OCF_RESKEY_fstype" ] && return 0
-
-	case $OCF_RESKEY_fstype in
-	ext2|ext3|jfs|xfs|reiserfs|vfat|tmpfs|vxfs)
-		return 0
-		;;
-	*)
-		echo "File system type $OCF_RESKEY_fstype not supported"
-		return $OCF_ERR_ARGS
-		;;
-	esac
-}
-
-
-verify_options()
-{
-	declare -i ret=$OCF_SUCCESS
-	declare o
-
-	#
-	# From mount(8)
-	#
-	for o in `echo $OCF_RESKEY_options | sed -e s/,/\ /g`; do
-		case $o in
-		async|atime|auto|defaults|dev|exec|_netdev|noatime)
-			continue
-			;;
-		noauto|nodev|noexec|nosuid|nouser|ro|rw|suid|sync)
-			continue
-			;;
-		dirsync|user|users)
-			continue
-			;;
-		esac
-
-		case $OCF_RESKEY_fstype in
-		ext2|ext3)
-			case $o in
-			bsddf|minixdf|check|check=*|nocheck|debug)
-				continue
-				;;
-			errors=*|grpid|bsdgroups|nogrpid|sysvgroups)
-				continue
-				;;
-			resgid=*|resuid=*|sb=*|grpquota|noquota)
-				continue
-				;;
-			quota|usrquota|nouid32)
-				continue
-				;;
-			esac
-
-			if [ "$OCF_RESKEY_fstype" = "ext3" ]; then
-				case $0 in
-				noload|data=*)
-					continue
-					;;
-				esac
-			fi
-			;;
-		vfat)
-			case $o in
-			blocksize=512|blocksize=1024|blocksize=2048)
-				continue
-				;;
-			uid=*|gid=*|umask=*|dmask=*|fmask=*)
-				continue
-				;;
-			check=r*|check=n*|check=s*|codepage=*)
-				continue
-				;;
-			conv=b*|conv=t*|conv=a*|cvf_format=*)
-				continue
-				;;
-			cvf_option=*|debug|fat=12|fat=16|fat=32)
-				continue
-				;;
-			iocharset=*|quiet)
-				continue
-				;;
-			esac
-			;;
-
-		jfs)
-			case $o in
-			conv|hash=rupasov|hash=tea|hash=r5|hash=detect)
-				continue
-				;;
-			hashed_relocation|no_unhashed_relocation)
-				continue
-				;;
-			noborder|nolog|notail|resize=*)
-				continue
-				;;
-			esac
-			;;
-
-		xfs)
-			case $o in
-			biosize=*|dmapi|xdsm|logbufs=*|logbsize=*)
-				continue
-				;;
-			logdev=*|rtdev=*|noalign|noatime)
-				continue
-				;;
-			norecovery|osyncisdsync|quota|userquota)
-				continue
-				;;
-			uqnoenforce|grpquota|gqnoenforce)
-				continue
-				;;
-			sunit=*|swidth=*)
-				continue
-				;;
-			esac
-			;;
-
-		tmpfs)
-			case $o in
-			size=*|nr_blocks=*|mode=*)
-				continue
-				;;
-			esac
-			;;
-		esac
-
-		echo Option $o not supported for $OCF_RESKEY_fstype
-		ret=$OCF_ERR_ARGS
-	done
-
-	return $ret
-}
-
-
-verify_all()
-{
-	verify_name || return $OCF_ERR_ARGS
-	verify_fstype || return $OCF_ERR_ARGS
-	verify_device || return $OCF_ERR_ARGS
-	verify_mountpoint || return $OCF_ERR_ARGS
-	verify_options || return $OCF_ERR_ARGS
-}
-
-
-#
-# mountInUse device mount_point
-#
-# Check to see if either the device or mount point are in use anywhere on
-# the system.  It is not required that the device be mounted on the named
-# moint point, just if either are in use.
-#
-mountInUse () {
-	typeset mp tmp_mp
-	typeset dev tmp_dev
-	typeset junk
-
-	if [ $# -ne 2 ]; then
-		ocf_log err "Usage: mountInUse device mount_point".
-		return $FAIL
-	fi
-
-	dev=$1
-	mp=$2
-
-	while read tmp_dev tmp_mp junk; do
-		if [ -n "$tmp_dev" -a "$tmp_dev" = "$dev" ]; then
-			return $YES
-		fi
-		
-		if [ -n "$tmp_mp" -a "$tmp_mp" = "$mp" ]; then
-			return $YES
-		fi
-	done < <(mount | awk '{print $1,$3}')
-
-	return $NO
-}
-
-
-#
-# trim_trailing_slash path
-#
-# Trim trailing slash from given path.
-#
-trim_trailing_slash() {
-	declare mpath=$1
-
-	echo $mpath | sed -e 's/\/*$//'
-}
-
-
-#
-# isMounted device mount_point
-#
-# Check to see if the device is mounted.  Print a warning if its not
-# mounted on the directory we expect it to be mounted on.
-#
-isMounted () {
-
-	typeset mp tmp_mp
-	typeset dev tmp_dev
-
-	if [ $# -ne 2 ]; then
-		ocf_log err "Usage: isMounted device mount_point"
-		return $FAIL
-	fi
-
-	dev=$(real_device $1)
-	if [ -z "$dev" ]; then
-		ocf_log err \
-			"fs (isMounted): Could not match $1 with a real device"
-		return $OCF_ERR_ARGS
-	fi
-	mp=$(readlink -f $2)
-	
-	while read tmp_dev tmp_mp
-	do
-		#echo "spec=$1 dev=$dev  tmp_dev=$tmp_dev"
-		tmp_dev=$(real_device $tmp_dev)
-		tmp_mp=${tmp_mp/%\//}  #$(trim_trailing_slash $tmp_mp)
-		mp=${mp/%\//}		       #$(trim_trailing_slash $mp)
-
-		if [ -n "$tmp_dev" -a "$tmp_dev" = "$dev" ]; then
-			#
-			# Check to see if its mounted in the right
-			# place
-			#
-			if [ -n "$tmp_mp"  -a "$tmp_mp"  != "$mp" ]; then
-				ocf_log warn \
-"Device $dev is mounted on $tmp_mp instead of $mp"
-			fi
-			return $YES
-		fi
-	done < <(mount | awk '{print $1,$3}')
-
-	return $NO
-}
-
-
-# 
-# isAlive mount_point
-# 
-# Check to see if mount_point is alive (testing read/write)
-# 
-isAlive()
-{
-	declare mount_point
-	declare file=".writable_test"
-	declare rw
-	
-	if [ $# -ne 1 ]; then
-	        ocf_log err "Usage: isAlive mount_point"
-		return $FAIL
-	fi
-	mount_point=$1
-	
-	test -d $mount_point
-	if [ $? -ne 0 ]; then
-		ocf_log err "fs (isAlive): $mount_point is not a directory"
-		return $FAIL
-	fi
-	
-	[ $OCF_CHECK_LEVEL -lt 10 ] && return $YES
-	
-	# depth 10 test (read test)
-	ls $mount_point > /dev/null 2> /dev/null
-	if [ $? -ne 0 ]; then
-	       return $NO
-	fi
-	
-	[ $OCF_CHECK_LEVEL -lt 20 ] && return $YES
-	
-	# depth 20 check (write test)
-	rw=$YES
-	for o in `echo $OCF_RESKEY_options | sed -e s/,/\ /g`; do
-                if [ "$o" = "ro" ]; then
-		        rw=$NO
-                fi
-	done
-	if [ $rw -eq $YES ]; then
-	        file=$mount_point/$file
-		while true; do
-			if [ -e "$file" ]; then
-				file=${file}_tmp
-				continue
-			else
-			        break
-			fi
-		done
-		touch $file > /dev/null 2> /dev/null
-		[ $? -ne 0 ] && return $NO
-		rm -f $file > /dev/null 2> /dev/null
-	fi
-	
-	return $YES
-}
-
-
-#
-# killMountProcesses mount_point
-#
-# Using lsof or fuser try to unmount the mount by killing of the processes
-# that might be keeping it busy.
-#
-killMountProcesses()
-{
-	typeset -i ret=$SUCCESS
-	typeset have_lsof=""
-	typeset have_fuser=""
-	typeset try
-
-	if [ $# -ne 1 ]; then
-		ocf_log err \
-			"Usage: killMountProcesses mount_point"
-		return $FAIL
-	fi
-
-	typeset mp=$1
-
-	ocf_log notice "Forcefully unmounting $mp"
-
-	#
-	# Not all distributions have lsof.  If not use fuser.  If it
-	# does, try both.
-  	#
-	file=$(which lsof 2>/dev/null)
-	if [ -f "$file" ]; then
-		have_lsof=$YES
-	fi
-
-	file=$(which fuser 2>/dev/null)
-	if [ -f "$file" ]; then
-		have_fuser=$YES
-	fi             
-
-	if [ -z "$have_lsof" -a -z "$have_fuser" ]; then
-		ocf_log warn \
-	"Cannot forcefully unmount $mp; cannot find lsof or fuser commands"
-		return $FAIL
-	fi
-
-	for try in 1 2 3; do
-		if [ -n "$have_lsof" ]; then
-			#
-			# Use lsof to free up mount point
-			#
-	    		while read command pid user
-			do
-				if [ -z "$pid" ]; then
-					continue
-				fi
-
-				if [ $try -eq 1 ]; then
-					ocf_log warn \
-			 	  "killing process $pid ($user $command $mp)"
-				elif [ $try -eq 3 ]; then
-					ocf_log crit \
-		    		  "Could not clean up mountpoint $mp"
-				ret=$FAIL
-				fi
-
-				if [ $try -gt 1 ]; then
-					kill -9 $pid
-				else
-					kill -TERM $pid
-				fi
-			done < <(lsof -bn 2>/dev/null | \
-			    grep -E "$mp(/.*|)\$" | \
-			    awk '{print $1,$2,$3}' | \
-			    sort -u -k 1,3)
-		elif [ -n "$have_fuser" ]; then
-			#
-			# Use fuser to free up mount point
-			#
-			while read command pid user
-			do
-				if [ -z "$pid" ]; then
-					continue
-				fi
-
-				if [ $try -eq 1 ]; then
-					ocf_log warn \
-			 	  "killing process $pid ($user $command $mp)"
-				elif [ $try -eq 3 ]; then
-					ocf_log crit \
-				    "Could not clean up mount point $mp"
-					ret=$FAIL
-				fi
-
-				if [ $try -gt 1 ]; then
-					kill -9 $pid
-				else
-					kill -TERM $pid
-				fi
-			done < <(fuser -vm $mp 2>&1 | \
-			    grep -v PID | \
-			    sed 's;^'$mp:';;' | \
-			    awk '{print $4,$2,$1}' | \
-			    sort -u -k 1,3)
-		fi
-	done
-
-	return $ret
-}
-
-
-activeMonitor() {
-	declare monpath=$OCF_RESKEY_mountpoint/.clumanager
-	declare p
-	declare pid
-
-	if [ -z "$OCF_RESKEY_mountpoint" ]; then
-		ocf_log err "activeMonitor: No mount point specified"
-		return $OCF_ERR_ARGS
-	fi
-
-	if [ "$OCF_RESKEY_active_monitor" != "1" ] &&
-	   [ "$OCF_RESKEY_active_monitor" != "yes" ]; then
-		# Nothing bad happened; but no active monitoring specified.
-		return $OCF_SUCCESS
-	fi
-
-	if [ "$OCF_RESKEY_self_fence" = "1" ] ||
-	   [ "$OCF_RESKEY_self_fence" = "yes" ]; then
-		args="-i 2 -a reboot"
-	else
-		args="-i 2"
-	fi
-
-	case $1 in
-	start)
-		ocf_log info "Starting active monitoring of $OCF_RESKEY_mountpoint"
-		mkdir -p $(dirname $monpath) || return $OCF_ERR_GENERIC
-		devmon $args -p $monpath/devmon.data -P $monpath/devmon.pid
-		;;
-	stop)
-		ocf_log info "Stopping active monitoring of $OCF_RESKEY_mountpoint"
-		if ! [ -f $monpath/devmon.pid ]; then
-			# Someone removed the file or it wasn't there for
-			# some reason... Force unmount will kill us
-			return 0
-		fi
-
-		pid=$(cat $monpath/devmon.pid)
-		if [ -z "$pid" ]; then
-			# Someone emptied the file?
-			return 0
-		fi
-
-		for p in $(pidof devmon); do
-			if [ "$pid" = "$p" ]; then
-				ocf_log debug "Killing devmon $p for $OCF_RESKEY_mountpoint"
-				kill -TERM $p
-				return 0
-			fi
-		done
-		# none matching
-
-		return 0
-		;;
-	status)
-		pid=$(cat $monpath/devmon.pid)
-		for p in $(pidof devmon); do
-			if [ "$pid" = "$p" ]; then
-				return 0
-			fi
-		done
-
-		# none matching
-		ocf_log err "Active Monitor for $OCF_RESKEY_mountpoint has exited"
-		return $OCF_ERR_GENERIC
-		;;
-	*)
-		ocf_log err "usage: activeMonitor <start|stop|status>"
-		return $OCF_ERR_ARGS
-		;;
-	esac
-}
-
-
-#
-# Decide which quota options are enabled and return a string 
-# which we can pass to quotaon
-#
-quota_opts()
-{
-	declare quotaopts=""
-	declare opts=$1
-	declare mopt
-
-	for mopt in `echo $opts | sed -e s/,/\ /g`; do
-		case $mopt in
-		usrquota)
-			quotaopts="u$quotaopts"
-			continue
-			;;
-		grpquota)
-			quotaopts="g$quotaopts"
-			continue
-			;;
-		noquota)
-			quotaopts=""
-			return 0
-			;;
-		esac
-	done
-
-	echo $quotaopts
-	return 0
-}
-
-
-
-#
-# Enable quotas on the mount point if the user requested them
-#
-enable_fs_quotas()
-{
-	declare -i need_check=0
-	declare -i rv
-	declare quotaopts=""
-	declare mopt
-	declare opts=$1
-	declare mp=$2
-
-	if [ -z "`which quotaon`" ]; then
-		ocf_log err "quotaon not found in $PATH"
-		return $OCF_ERR_GENERIC
-	fi
-
-	quotaopts=$(quota_opts $opts)
-
-	ocf_log info "quotaopts = $quotaopts"
-
-	[ -z "$quotaopts" ] && return 0
-
-	# Ok, create quota files if they don't exist
-	for f in quota.user aquota.user quota.group aquota.group; do
-		if ! [ -f "$mp/$f" ]; then
-			ocf_log info "$mp/$f was missing - creating"
-			touch "$mp/$f" 
-			chmod 600 "$mp/$f"
-			need_check=1
-		fi
-	done
-
-	if [ $need_check -eq 1 ]; then
-		ocf_log info "Checking quota info in $mp"
-		quotacheck -$quotaopts $mp
-	fi
-
-	ocf_log info "Enabling Quotas on $mp"
-	ocf_log debug "quotaon -$quotaopts $mp"
-	quotaon -$quotaopts $mp
-	rv=$?
-	if [ $rv -ne 0 ]; then
-		# Just a warning
-		ocf_log warn "Unable to turn on quotas for $mp; return = $rv"
-	fi
-
-	return $rv
-}
-
-
-#
-# startFilesystem
-#
-startFilesystem() {
-	typeset -i ret_val=$SUCCESS
-	typeset mp=""			# mount point
-	typeset dev=""			# device
-	typeset fstype=""
-	typeset opts=""
-	typeset device_in_use=""
-	typeset mount_options=""
-
-	#
-	# Get the mount point, if it exists.  If not, no need to continue.
-	#
-	mp=${OCF_RESKEY_mountpoint}
-	case "$mp" in 
-      	""|"[ 	]*")		# nothing to mount
-    		return $OCF_SUCCESS
-    		;;
-	/*)			# found it
-	  	;;
-	*)	 		# invalid format
-			ocf_log err \
-"startFilesystem: Invalid mount point format (must begin with a '/'): \'$mp\'"
-	    	return $OCF_ERR_ARGS
-	    	;;
-	esac
-	
-	#
-	# Get the device
-	#
-	dev=$(real_device $OCF_RESKEY_device)
-	if [ -z "$dev" ]; then
-			ocf_log err "\
-startFilesystem: Could not match $OCF_RESKEY_device with a real device"
-			return $OCF_ERR_ARGS
-	fi
-
-	#
-	# Ensure we've got a valid directory
-	#
-	if [ -e "$mp" ]; then
-		if ! [ -d "$mp" ]; then
-			ocf_log err"\
-startFilesystem: Mount point $mp exists but is not a directory"
-			return $OCF_ERR_ARGS
-		fi
-	else
-		ocf_log err "\
-startFilesystem: Creating mount point $mp for device $dev"
-		mkdir -p $mp
-	fi
-
-	#
-	# Get the filesystem type, if specified.
-	#
-	fstype_option=""
-	fstype=${OCF_RESKEY_fstype}
-       	case "$fstype" in 
-	""|"[ 	]*")
-		fstype=""
-		;;
-	*)	# found it
-		fstype_option="-t $fstype"
-		;;
-	esac
-
-	#
-	# See if the device is already mounted.
-	# 
-	isMounted $dev $mp
-	case $? in
-	$YES)		# already mounted
-		ocf_log debug "$dev already mounted"
-		return $OCF_SUCCESS
-		;;
-	$NO)		# not mounted, continue
-		;;
-	*)
-		return $FAIL
-		;;
-	esac
-
-
-	#
-	# Make sure that neither the device nor the mount point are mounted
-	# (i.e. they may be mounted in a different location).  The'mountInUse'
-	# function checks to see if either the device or mount point are in
-	# use somewhere else on the system.
-	#
-	mountInUse $dev $mp
-	case $? in
-	$YES)		# uh oh, someone is using the device or mount point
-		ocf_log err "\
-Cannot mount $dev on $mp, the device or mount point is already in use!"
-		return $FAIL
-		;;
-	$NO)		# good, no one else is using it
-		;;
-	$FAIL)
-		return $FAIL
-		;;
-	*)
-		ocf_log err "Unknown return from mountInUse"
-		return $FAIL
-		;;
-	esac
-
-	#
-	# Make sure the mount point exists.
-	#
-	if [ ! -d $mp ]; then
-		rm -f $mp			# rm in case its a plain file
-		mkdir -p $mp			# create the mount point
-		ret_val=$?
-		if [ $ret_val -ne 0 ]; then
-			ocf_log err \
-				"'mkdir -p $mp' failed, error=$ret_val"
-			return $FAIL
-		fi
-	fi
-
-	#
-	# Get the mount options, if they exist.
-	#
-	mount_options=""
-	opts=${OCF_RESKEY_options}
-	case "$opts" in 
-	""|"[ 	]*")
-		opts=""
-		;;
-	*)	# found it
-		mount_options="-o $opts"
-		;;
-	esac
-
-
-	#
-	# Check to determine if we need to fsck the filesystem.
-	#
-	# Note: this code should not indicate in any manner suggested
-	# file systems to use in the cluster.  Known filesystems are
-	# listed here for correct operation.
-	#
-        case "$fstype" in
-        reiserfs) typeset fsck_needed="" ;;
-        ext3)     typeset fsck_needed="" ;;
-        jfs)      typeset fsck_needed="" ;;
-        xfs)      typeset fsck_needed="" ;;
-        ext2)     typeset fsck_needed=yes ;;
-        minix)    typeset fsck_needed=yes ;;
-        vfat)     typeset fsck_needed=yes ;;
-        msdos)    typeset fsck_needed=yes ;;
-	"")       typeset fsck_needed=yes ;;		# assume fsck
-	*)
-		typeset fsck_needed=yes 		# assume fsck
-	     	ocf_log warn "\
-Unknown file system type '$fstype' for device $dev.  Assuming fsck is required."
-		;;
-	esac
-
-
-	#
-	# Fsck the device, if needed.
-	#
-	if [ -n "$fsck_needed" ] || [ "${OCF_RESKEY_force_fsck}" = "yes" ] ||\
-	   [ "${OCF_RESKEY_force_fsck}" = "1" ]; then
-		typeset fsck_log=@LOGDIR@/$(basename $dev).fsck.log
-		ocf_log debug "Running fsck on $dev"
-		fsck -p $dev >> $fsck_log 2>&1
-		ret_val=$?
-		if [ $ret_val -gt 1 ]; then
-			ocf_log err "\
-'fsck -p $dev' failed, error=$ret_val; check $fsck_log for errors"
-			ocf_log debug "Invalidating buffers for $dev"
-			$INVALIDATEBUFFERS -f $dev
-			return $FAIL
-		fi
-		rm -f $fsck_log
-	fi
-
-	#
-	# Mount the device
-	#
-	ocf_log info "mounting $dev on $mp"
-	ocf_log debug "mount $fstype_option $mount_options $dev $mp"
-	mount $fstype_option $mount_options $dev $mp
-	ret_val=$?
-	if [ $ret_val -ne 0 ]; then
-		ocf_log err "\
-'mount $fstype_option $mount_options $dev $mp' failed, error=$ret_val"
-		return $FAIL
-	fi
-
-	#
-	# Create this for the NFS NLM broadcast bit
-	#
-	if [ $NFS_TRICKS -eq 0 ]; then
-		if [ "$OCF_RESKEY_nfslock" = "yes" ] || \
-	   	   [ "$OCF_RESKEY_nfslock" = "1" ]; then
-			mkdir -p $mp/.clumanager/statd
-			notify_list_merge $mp/.clumanager/statd
-		fi
-	fi
-
-	enable_fs_quotas $opts $mp
-	activeMonitor start || return $OCF_ERR_GENERIC
-	
-	return $SUCCESS
-}
-
-
-#
-# stopFilesystem serviceID deviceID
-#
-# Run the stop actions
-#
-stopFilesystem() {
-	typeset -i ret_val=0
-	typeset -i try=1
-	typeset -i max_tries=3		# how many times to try umount
-	typeset -i sleep_time=5		# time between each umount failure
-	typeset -i nfslock_reclaim=0
-	typeset done=""
-	typeset umount_failed=""
-	typeset force_umount=""
-	typeset self_fence=""
-	typeset fstype=""
-	typeset quotaopts=""
-
-
-	#
-	# Get the mount point, if it exists.  If not, no need to continue.
-	#
-	mp=${OCF_RESKEY_mountpoint}
-	case "$mp" in 
-      	""|"[ 	]*")		# nothing to mount
-    		return $SUCCESS
-    		;;
-	/*)			# found it
-	  	;;
-	*)	 		# invalid format
-			ocf_log err \
-"stopFilesystem: Invalid mount point format (must begin with a '/'): \'$mp\'"
-	    	return $FAIL
-	    	;;
-	esac
-	
-
-	#
-	# Get the device
-	#
-	dev=$(real_device $OCF_RESKEY_device)
-	if [ -z "$dev" ]; then
-			ocf_log err "\
-stop: Could not match $OCF_RESKEY_device with a real device"
-			return $FAIL
-	fi
-
-	#
-	# Get the force unmount setting if there is a mount point.
-	#
-	if [ -n "$mp" ]; then
-		case ${OCF_RESKEY_force_unmount} in
-	        $YES_STR)	force_umount=$YES ;;
-		1)		force_umount=$YES ;;
-	        *)		force_umount="" ;;
-		esac
-	fi
-
-	if [ -n "$mp" ]; then
-		case ${OCF_RESKEY_self_fence} in
-	        $YES_STR)	self_fence=$YES ;;
-		1)		self_fence=$YES ;;
-	        *)		self_fence="" ;;
-		esac
-	fi
-
-	#
-	# Unmount the device.  
-	#
-	while [ ! "$done" ]; do
-		isMounted $dev $mp
-		case $? in
-		$NO)
-			ocf_log info "$dev is not mounted"
-			umount_failed=
-			done=$YES
-			;;
-		$FAIL)
-			return $FAIL
-			;;
-		$YES)
-			sync; sync; sync
-			quotaopts=$(quota_opts $OCF_RESKEY_options)
-			if [ -n "$quotaopts" ]; then
-				ocf_log debug "Turning off quotas for $mp"
-		       		quotaoff -$quotaopts $mp &> /dev/null
-			fi
-
-			activeMonitor stop || return $OCF_ERR_GENERIC
-
-			ocf_log info "unmounting $mp"
-			umount $mp
-			if  [ $? -eq 0 ]; then
-				umount_failed=
-				done=$YES
-				continue
-			fi
-
-			umount_failed=yes
-
-			if [ "$force_umount" ]; then
-				killMountProcesses $mp
-				if [ $try -eq 1 ]; then
-	        		  if [ "$OCF_RESKEY_nfslock" = "yes" ] || \
-				     [ "$OCF_RESKEY_nfslock" = "1" ]; then
-				    ocf_log warning \
-					"Dropping node-wide NFS locks"
-				    pkill -KILL -x lockd
-	          		    mkdir -p $mp/.clumanager/statd
-				    # Copy out the notify list; our 
-				    # IPs are already torn down
-				    notify_list_store $mp/.clumanager/statd
-				    nfslock_reclaim=1
-				  fi
-				fi
-			fi
-
-			if [ $try -ge $max_tries ]; then
-				done=$YES
-			else
-				sleep $sleep_time
-				let try=try+1
-			fi
-			;;
-		*)
-			return $FAIL
-			;;
-		esac
-
-		if [ $try -ge $max_tries ]; then
-			done=$YES
-		else
-			sleep $sleep_time
-			let try=try+1
-		fi
-	done # while 
-
-	if [ $nfslock_reclaim -eq 1 ]; then
-		# If we have this flag set, do a full reclaim broadcast
-		notify_list_broadcast $mp/.clumanager/statd
-	fi
-
-	if [ -n "$umount_failed" ]; then
-		ocf_log err "'umount $mp' failed, error=$ret_val"
-
-		if [ "$self_fence" ]; then
-			ocf_log alert "umount failed - REBOOTING"
-			sync
-			reboot -fn
-		fi
-		return $FAIL
-	else
-		return $SUCCESS
-	fi
-}
-
-
-case $1 in
-start)
-	startFilesystem
-	exit $?
-	;;
-stop)
-	stopFilesystem
-	exit $?
-	;;
-status|monitor)
-  	isMounted ${OCF_RESKEY_device} ${OCF_RESKEY_mountpoint}
-	case $? in
-	$NO)
-		ocf_log info "fs:${OCF_RESKEY_name}: ${OCF_RESKEY_device} is not mounted on ${OCF_RESKEY_mountpoint}"
-		exit $OCF_NOT_RUNNING
-		;;
-	$YES)
-		;;
-	*)
-		ocf_log err "fs:${OCF_RESKEY_name}: ${OCF_RESKEY_device} is not mounted on ${OCF_RESKEY_mountpoint}"
-		exit $OCF_ERR_GENERIC
-		;;
-	esac
-		
- 	if [ $? -ne $YES ]; then
-		ocf_log err "fs:${OCF_RESKEY_name}: ${OCF_RESKEY_device} is not mounted on ${OCF_RESKEY_mountpoint}"
-		exit $OCF_ERR_GENERIC
-	fi
-
-	if [ "$OCF_RESKEY_active_monitor" = "yes" ] ||
-	   [ "$OCF_RESKEY_active_monitor" = "1" ]; then
-
-	   	activeMonitor status
-		[ $? -eq 0 ] && exit 0
-		ocf_log err "fs:${OCF_RESKEY_name}: Active Monitoring reported a failure"
-		exit $OCF_ERR_GENERIC
-	fi
- 	
- 	isAlive ${OCF_RESKEY_mountpoint}
- 	[ $? -eq $YES ] && exit 0
-
-	ocf_log err "fs:${OCF_RESKEY_name}: Mount point is not accessible!"
-	exit $OCF_ERR_GENERIC
-	;;
-restart)
-	stopFilesystem
-	if [ $? -ne 0 ]; then
-		exit $OCF_ERR_GENERIC
-	fi
-
-	startFilesystem
-	if [ $? -ne 0 ]; then
-		exit $OCF_ERR_GENERIC
-	fi
-
-	exit 0
-	;;
-meta-data)
-	meta_data
-	exit 0
-	;;
-validate-all)
-	verify_all
-	exit $?
-	;;
-*)
-	echo "usage: $0 {start|stop|status|monitor|restart|meta-data|validate-all}"
-	exit $OCF_ERR_UNIMPLEMENTED
-	;;
-esac
-
-exit 0
diff --git a/rgmanager/src/resources/ip.sh b/rgmanager/src/resources/ip.sh
deleted file mode 100644
index 245dcf5..0000000
--- a/rgmanager/src/resources/ip.sh
+++ /dev/null
@@ -1,952 +0,0 @@
-#!/bin/bash
-
-#
-# IPv4/IPv6 address management using new /sbin/ifcfg instead of 
-# ifconfig utility.
-#
-
-LC_ALL=C
-LANG=C
-PATH=/bin:/sbin:/usr/bin:/usr/sbin
-export LC_ALL LANG PATH
-
-# Grab nfs lock tricks if available
-export NFS_TRICKS=1
-if [ -f "$(dirname $0)/svclib_nfslock" ]; then
-	. $(dirname $0)/svclib_nfslock
-	NFS_TRICKS=0
-fi
-
-. $(dirname $0)/ocf-shellfuncs
-
-
-meta_data()
-{
-    cat <<EOT
-<?xml version="1.0" ?>
-<resource-agent version="rgmanager 2.0" name="ip">
-    <version>1.0</version>
-
-    <longdesc lang="en">
-        This is an IP address.  Both IPv4 and IPv6 addresses are supported,
-        as well as NIC link monitoring for each IP address.
-    </longdesc>
-    <shortdesc lang="en">
-        This is an IP address.
-    </shortdesc>
-
-    <parameters>
-        <parameter name="address" unique="1" primary="1">
-            <longdesc lang="en">
-                IPv4 or IPv6 address to use as a virtual IP
-                resource.
-            </longdesc>
-
-            <shortdesc lang="en">
-                IP Address
-            </shortdesc>
-
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="family">
-            <longdesc lang="en">
-                IPv4 or IPv6 address protocol family.
-            </longdesc>
-
-            <shortdesc lang="en">
-                Family
-            </shortdesc>
-
-            <!--
-            <val>auto</val>
-            <val>inet</val>
-            <val>inet6</val>
-            -->
-            <content type="string"/>
-        </parameter>
-
-        <parameter name="monitor_link">
-            <longdesc lang="en">
-                Enabling this causes the status check to fail if
-                the link on the NIC to which this IP address is
-                bound is not present.
-            </longdesc>
-            <shortdesc lang="en">
-                Monitor NIC Link
-            </shortdesc>
-            <content type="boolean" default="1"/>
-        </parameter>
-
-	<parameter name="nfslock" inherit="service%nfslock">
-	    <longdesc lang="en">
-	        If set and unmounting the file system fails, the node will
-		try to kill lockd and issue reclaims across all remaining
-		network interface cards.
-	    </longdesc>
-	    <shortdesc lang="en">
-	        Enable NFS lock workarounds
-	    </shortdesc>
-	    <content type="boolean"/>
-	</parameter>
-
-	<parameter name="sleeptime">
-	    <longdesc lang="en">
-		Amount of time to sleep after removing an IP address.
-		Value is specified in seconds. Default value is 10.
-	    </longdesc>
-	    <shortdesc lang="en">
-		Amount of time (seconds) to sleep.
-	    </shortdesc>
-	    <content type="string"/>
-	</parameter>
-
-    </parameters>
-
-    <actions>
-        <action name="start" timeout="20"/>
-        <action name="stop" timeout="20"/>
-	<!-- No recover action.  If the IP address is not useable, then
-	     resources may or may not depend on it.  If it's been 
-	     deconfigured, resources using it are in a bad state. -->
-
-	<!-- Checks to see if the IP is up and (optionally) the link is
-	     working -->
-        <action name="status" interval="20" timeout="10"/>
-        <action name="monitor" interval="20" timeout="10"/>
-
-	<!-- Checks to see if we can ping the IP address locally -->
-        <action name="status" depth="10" interval="60" timeout="20"/>
-        <action name="monitor" depth="10" interval="60" timeout="20"/>
-
-        <action name="meta-data" timeout="20"/>
-        <action name="validate-all" timeout="20"/>
-    </actions>
-
-    <special tag="rgmanager">
-	<attributes maxinstances="1"/>
-	<child type="nfsclient" forbid="1"/>
-	<child type="nfsexport" forbid="1"/>
-    </special>
-</resource-agent>
-EOT
-}
-
-
-verify_address()
-{
-	# XXX TBD
-	return 0
-}
-
-
-verify_all()
-{
-	# XXX TBD
-	return 0
-}
-
-
-#
-# Expand an IPv6 address.
-#
-ipv6_expand()
-{
-	typeset addr=$1
-	typeset maskbits
-	typeset -i x
-	
-	maskbits=${addr/*\//}
-	if [ "$maskbits" = "$addr" ]; then
-		maskbits=""
-	else
-		# chop off mask bits
-		addr=${addr/\/*/}
-	fi
-
-	# use space as placeholder
-	addr=${addr/::/\ }
-
-	# get rid of colons
-	addr=${addr//:/}
-
-	# add in zeroes where the doublecolon was
-	len=$((${#addr}-1))
-	zeroes=
-	while [ $len -lt 32 ]; do
-		zeroes="0$zeroes"
-		((len++))
-	done
-	addr=${addr/\ /$zeroes}
-
-	# probably a better way to do this
-	for (( x=0; x < ${#addr} ; x++)); do
-		naddr=$naddr${addr:x:1}
-
-		if (( x < (${#addr} - 1) && x%4 == 3)); then
-			naddr=$naddr:
-		fi
-	done
-
-	if [ -n "$maskbits" ]; then
-		echo "$naddr/$maskbits"
-		return 0
-	fi
-
-	echo "$naddr"
-	return 0
-}
-
-
-#
-# see if two ipv6 addrs are in the same subnet
-#
-ipv6_same_subnet()
-{
-	declare addrl=$1
-	declare addrr=$2
-	declare m=$3 
-	declare r x llsb rlsb
-
-	if [ $# -lt 2 ]; then
-		ocf_log err "usage: ipv6_same_subnet addr1 addr2 [mask]"
-		return 255
-	fi
-
-	if [ -z "$m" ]; then
-		m=${addrl/*\//}
-
-		[ -n "$m" ] || return 1
-
-	fi
-
-	if [ "${addrr}" != "${addrr/*\//}" ] &&
-	   [ "$m" != "${addrr/*\//}" ]; then
-		return 1
-	fi
-
-	addrl=${addrl/\/*/}
-	if [ ${#addrl} -lt 39 ]; then
-		addrl=$(ipv6_expand $addrl)
-	fi
-
-	addrr=${addrr/\/*/}
-	if [ ${#addrr} -lt 39 ]; then
-		addrr=$(ipv6_expand $addrr)
-	fi
-
-	# Calculate the amount to compare directly
-	x=$(($m/4+$m/16-(($m%4)==0)))
-
-	# and the remaining number of bits
-	r=$(($m%4))
-
-	if [ $r -ne 0 ]; then
-		# If we have any remaining bits, we will need to compare
-		# them later.  Get them now.
-		llsb=`printf "%d" 0x${addrl:$x:1}`
-		rlsb=`printf "%d" 0x${addrr:$x:1}`
-
-		# One less byte to compare directly, please
-		((--x))
-	fi
-	
-	# direct (string comparison) to see if they are equal
-	if [ "${addrl:0:$x}" != "${addrr:0:$x}" ]; then
-		return 1
-	fi
-
-	case $r in
-	0)
-		return 0
-		;;
-	1)	
-		[ $(($llsb & 8)) -eq $(($rlsb & 8)) ]
-		return $?
-		;;
-	2)
-		[ $(($llsb & 12)) -eq $(($rlsb & 12)) ]
-		return $?
-		;;
-	3)
-		[ $(($llsb & 14)) -eq $(($rlsb & 14)) ]
-		return $?
-		;;
-	esac
-
-	return 1
-}
-
-
-ipv4_same_subnet()
-{
-	declare addrl=$1
-	declare addrr=$2
-	declare m=$3 
-	declare r x llsb rlsb
-
-	if [ $# -lt 2 ]; then
-		ocf_log err "usage: ipv4_same_subnet current_addr new_addr [maskbits]"
-		return 255
-	fi
-
-
-	#
-	# Chop the netmask off of the ipaddr:
-	# e.g. 1.2.3.4/22 -> 22
-	#
-	if [ -z "$m" ]; then
-		m=${addrl/*\//}
-		[ -n "$m" ] || return 1
-	fi
-
-	#
-	# Check to see if there was a subnet mask provided on the
-	# new IP address.  If there was one and it does not match
-	# our expected subnet mask, we are done.
-	#
-	if [ "${addrr}" != "${addrr/\/*/}" ] &&
-	   [ "$m" != "${addrr/*\//}" ]; then
-		return 1
-	fi
-
-	#
-	# Chop off subnet bits for good.
-	#
-	addrl=${addrl/\/*/}
-	addrr=${addrr/\/*/}
-
-	#
-	# Remove '.' characters from dotted decimal notation and save
-	# in arrays. i.e.
-	#
-	#	192.168.1.163 -> array[0] = 192
-	#	                 array[1] = 168
-	#	                 array[2] = 1
-	#	                 array[3] = 163
-	#
-
-	let x=0
-	for quad in ${addrl//./\ }; do
-		ip1[((x++))]=$quad
-	done
-
-	x=0
-	for quad in ${addrr//./\ }; do
-		ip2[((x++))]=$quad
-	done
-
-	x=0
-
-	while [ $m -ge 8 ]; do
-		((m-=8))
-		if [ ${ip1[x]} -ne ${ip2[x]} ]; then
-			return 1
-		fi
-		((x++))
-	done
-
-	case $m in
-	0)
-		return 0
-		;;
-	1)	
-		[ $((${ip1[x]} & 128)) -eq $((${ip2[x]} & 128)) ]
-		return $?
-		;;
-	2)
-		[ $((${ip1[x]} & 192)) -eq $((${ip2[x]} & 192)) ]
-		return $?
-		;;
-	3)
-		[ $((${ip1[x]} & 224)) -eq $((${ip2[x]} & 224)) ]
-		return $?
-		;;
-	4)
-		[ $((${ip1[x]} & 240)) -eq $((${ip2[x]} & 240)) ]
-		return $?
-		;;
-	5)
-		[ $((${ip1[x]} & 248)) -eq $((${ip2[x]} & 248)) ]
-		return $?
-		;;
-	6)
-		[ $((${ip1[x]} & 252)) -eq $((${ip2[x]} & 252)) ]
-		return $?
-		;;
-	7)
-		[ $((${ip1[x]} & 254)) -eq $((${ip2[x]} & 254)) ]
-		return $?
-		;;
-	esac
-
-	return 1
-}
-
-
-ipv6_list_interfaces()
-{
-	declare idx dev ifaddr
-	declare ifaddr_exp
-	
-	while read idx dev ifaddr; do
-	    
-		isSlave $dev
-		if [ $? -ne 2 ]; then
-			continue
-		fi
-		
-		idx=${idx/:/}
-		
-		ifaddr_exp=$(ipv6_expand $ifaddr)
-		
-		echo $dev ${ifaddr_exp/\/*/} ${ifaddr_exp/*\//}
-		
-	done < <(/sbin/ip -o -f inet6 addr | awk '{print $1,$2,$4}')
-
-	return 0
-}
-
-
-#
-# Find slaves for a bonded interface
-#
-findSlaves()
-{
-	declare mastif=$1
-	declare line
-	declare intf
-	declare interfaces
-
-	if [ -z "$mastif" ]; then
-		ocf_log err "usage: findSlaves <master I/F>"
-		return $OCF_ERR_ARGS
-	fi
-
-	line=$(/sbin/ip link list dev $mastif | grep "<.*MASTER.*>")
-	if [ $? -ne 0 ]; then
-		ocf_log err "Error determining status of $mastif"
-		return $OCF_ERR_GENERIC
-	fi
-
-	if [ -z "`/sbin/ip link list dev $mastif | grep \"<.*MASTER.*>\"`" ]
-	then
-		ocf_log err "$mastif is not a master device"
-		return $OCF_ERR_GENERIC
-	fi
-
-	## Strip possible VLAN (802.1q) suffixes 
-	##  - Roland Gadinger <roland.gadinger@beko.at> 
-	mastif=${mastif%%.*} 
-
-	while read line; do
-		set - $line
-		interfaces="${2/:/} $interfaces"
-	done < <( /sbin/ip -o link list | grep "master $mastif" )
-
-	echo $interfaces
-}
-
-
-isSlave()
-{
-	declare intf=$1
-	declare line
-
-	if [ -z "$intf" ]; then
-		ocf_log err "usage: isSlave <I/F>"
-		return $OCF_ERR_ARGS
-	fi
-
-	line=$(/sbin/ip link list dev $intf)
-	if [ $? -ne 0 ]; then
-		ocf_log err "$intf not found"
-		return $OCF_ERR_GENERIC
-	fi
-
-	if [ "$line" = "${line/<*SLAVE*>/}" ]; then
-		return 2
-	fi
-
-	# Yes, it is a slave device.  Ignore.
-	return 0
-}
-
-
-# 
-# Check if interface is in UP state
-#
-interface_up()
-{
-       declare intf=$1
-       
-       if [ -z "$intf" ]; then
-		ocf_log err "usage: interface_up <I/F>"
-		return 1
-       fi
-       
-       line=$(/sbin/ip -o link show up dev $intf 2> /dev/null)
-       [ -z "$line" ] && return 2
-       
-       return 0
-}
-
-
-ethernet_link_up()
-{
-	declare linkstate=$(ethtool $1 | grep "Link detected:" |\
-			    awk '{print $3}')
-	
-	[ -n "$linkstate" ] || return 0
-
-	case $linkstate in
-	yes)
-		return 0
-		;;
-	*)
-		return 1
-		;;
-	esac
-	
-	return 1
-}
-
-
-#
-# Checks the physical link status of an ethernet or bonded interface.
-#
-network_link_up()
-{
-	declare slaves
-	declare intf_arg=$1
-	declare link_up=1		# Assume link down
-	declare intf_test
-
-	if [ -z "$intf_arg" ]; then
-		ocf_log err "usage: network_link_up <intf>"
-		return 1
-	fi
-	
-	#
-	# XXX assumes bond* interfaces are the bonding driver. (Fair
-	# assumption on Linux, I think)
-	#
-	if [ "${intf_arg/bond/}" != "$intf_arg" ]; then
-		
-		#
-		# With Xen we must check for slaves of pbondX, not bondX
-		#
-		masterif=$intf_arg
-		line=$(ip link list | awk {'print $2'} | grep "p$intf_arg:")
-		if [ $? -eq 0 ] ; then
-			masterif="p$intf_arg"
-		fi
-		
-		#
-		# Bonded driver.  Check link of all slaves for this interface.
-		# If any link is up, the bonding driver is expected to route
-		# traffic through that link.  Thus, the entire bonded link
-		# is declared up.
-		#
-		slaves=$(findSlaves $masterif)
-		if [ $? -ne 0 ]; then
-			ocf_log err "Error finding slaves of $intf_arg"
-			return 1
-		fi
-		for intf_test in $slaves; do
-			ethernet_link_up $intf_test && link_up=0
-		done
-	else
-		ethernet_link_up $intf_arg
-		link_up=$?
-	fi
-
-	if [ $link_up -eq 0 ]; then
-		ocf_log debug "Link for $intf_arg: Detected"
-	else
-		ocf_log warn "Link for $intf_arg: Not detected"
-	fi
-
-	return $link_up
-}
-
-
-ipv4_list_interfaces()
-{
-	declare idx dev ifaddr
-
-	while read idx dev ifaddr; do
-	        
-		isSlave $dev
-		if [ $? -ne 2 ]; then
-			continue
-		fi
-		
-		idx=${idx/:/}
-		
-		echo $dev ${ifaddr/\/*/} ${ifaddr/*\//}
-		
-	done < <(/sbin/ip -o -f inet addr | awk '{print $1,$2,$4}')
-	
-	return 0
-}
-
-
-#
-# Add an IP address to our interface.
-#
-ipv6()
-{
-	declare dev maskbits
-	declare addr=$2
-	declare addr_exp=$(ipv6_expand $addr)
-	
-	while read dev ifaddr_exp maskbits; do 
-	        if [ -z "$dev" ]; then
-		        continue
-		fi
-		
-		if [ "$1" = "add" ]; then
-			ipv6_same_subnet $ifaddr_exp/$maskbits $addr_exp
-			if [ $? -ne 0 ]; then
-                                continue
-                        fi
-                        interface_up $dev
-                        if [ $? -ne 0 ]; then
-                                continue
-                        fi
-                        network_link_up $dev
-                        if [ $? -ne 0 ]; then
-                                continue
-                        fi
-			if [ "${addr/\/*/}" = "${addr}" ]; then
-				addr="$addr/$maskbits"
-			fi
-			ocf_log info "Adding IPv6 address $addr to $dev"
-		fi
-		if [ "$1" = "del" ]; then
-		        if [ "${addr_exp/\/*/}" != "$ifaddr_exp" ]; then
-			        continue
-			fi
-			addr=`/sbin/ip addr list | grep "$addr" | head -n 1 | awk '{print $2}'`
-			ocf_log info "Removing IPv6 address $addr from $dev"
-                fi
-		
-		/sbin/ip -f inet6 addr $1 dev $dev $addr
-		[ $? -ne 0 ] && return 1
-		
-		#
-		# NDP should take of figuring out our new address.  Plus,
-		# we do not have something (like arping) to do this for ipv6
-		# anyway.
-		# 
-		# RFC 2461, section 7.2.6 states thusly:
-		#
-	   	# Note that because unsolicited Neighbor Advertisements do not
-		# reliably update caches in all nodes (the advertisements might
-		# not be received by all nodes), they should only be viewed as
-		# a performance optimization to quickly update the caches in
-		#  most neighbors. 
-		#
-		
-		# Not sure if this is necessary for ipv6 either.
-		file=$(which rdisc 2>/dev/null)
-		if [ -f "$file" ]; then
-		        killall -HUP rdisc || rdisc -fs
-		fi
-		
-		return 0
-	done < <(ipv6_list_interfaces)
-	
-	return 1
-}
-
-
-#
-# Add an IP address to our interface.
-#
-ipv4()
-{
-	declare dev ifaddr maskbits
-	declare addr=$2
-	
-	while read dev ifaddr maskbits; do
-	        if [ -z "$dev" ]; then
-		        continue
-		fi
-
-		if [ "$1" = "add" ]; then
-		        ipv4_same_subnet $ifaddr/$maskbits $addr
-			if [ $? -ne 0 ]; then
-			        continue
-			fi
-		        interface_up $dev
-			if [ $? -ne 0 ]; then
-			        continue
-			fi
-			network_link_up $dev
-			if [ $? -ne 0 ]; then
-				continue
-			fi
-
-			if [ "${addr/\/*/}" = "${addr}" ]; then
-				addr="$addr/$maskbits"
-			fi
-			ocf_log info "Adding IPv4 address $addr to $dev"
-		fi
-		if [ "$1" = "del" ]; then
-			if [ "${addr/\/*/}" != "$ifaddr" ]; then
-			        continue
-			fi
-			addr=`/sbin/ip addr list | grep "$ifaddr/" | head -n 1 | awk '{print $2}'`
-			ocf_log info "Removing IPv4 address $addr from $dev"
-		fi
-		
-		/sbin/ip -f inet addr $1 dev $dev $addr
-		[ $? -ne 0 ] && return 1
-		
-        	#
-	        # The following is needed only with ifconfig; ifcfg does it for us
-        	#
-		if [ "$1" = "add" ]; then
-        		# do that freak arp thing
-		    
- 		        hwaddr=$(/sbin/ip -o link show $dev)
-			hwaddr=${hwaddr/*link\/ether\ /}
-			hwaddr=${hwaddr/\ \*/}
-			
-			addr=${addr/\/*/}
-			ocf_log debug "Sending gratuitous ARP: $addr $hwaddr"
-			arping -q -c 2 -U -I $dev $addr
-		fi
-		
-		file=$(which rdisc 2>/dev/null)
-		if [ -f "$file" ]; then
-		        killall -HUP rdisc || rdisc -fs
-		fi
-		
-		return 0
-	done  < <(ipv4_list_interfaces)
-	
-	return 1
-}
-
-
-#
-# Usage:
-# ping_check <family> <address> [interface]
-#
-ping_check()
-{
-	declare ops="-c 1 -w 2"
-	declare pingcmd=""
-
-	if [ "$1" = "inet6" ]; then
-		pingcmd="ping6"
-	else
-		pingcmd="ping"
-	fi
-
-	if [ -n "$3" ]; then 
-		ops="$ops -I $3"
-	fi
-
-	return $($pingcmd $ops $2 &> /dev/null)
-}
-
-
-# 
-# Usage:
-# check_interface_up <family> <address>
-#
-check_interface_up()
-{
-	declare dev
-	declare addr=${2/\/*/}
-
-	dev=$(/sbin/ip -f $1 -o addr | grep " $addr/" | awk '{print $2}')
-	if [ -z "$dev" ]; then
-		return 1
-	fi
-	
-	interface_up $dev
-	return $?
-}
-
-
-# 
-# Usage:
-# address_configured <family> <address>
-#
-address_configured()
-{
-	declare line
-	declare addr
-
-	# Chop off maxk bits 
-	addr=${2/\/*/}
-        line=$(/sbin/ip -f $1 -o addr | grep " $addr/")
-
-        if [ -z "$line" ]; then
-		return 1
-	fi
-	return 0
-}
-
-
-#
-# Usage:
-# ip_op <family> <operation> <address> [quiet]
-#
-ip_op()
-{
-	declare dev
-	declare rtr
-	declare monitor_link
-	declare addr=${3/\/*/}
-	
-	monitor_link="yes"
-	if [ "${OCF_RESKEY_monitor_link}" = "no" ] ||
-	    [ "${OCF_RESKEY_monitor_link}" = "0" ]; then
-	        monitor_link="no"
-	fi
-	
-	if [ "$2" = "status" ]; then
-
-		ocf_log debug "Checking $3, Level $OCF_CHECK_LEVEL"
-	
-		dev=$(/sbin/ip -f $1 -o addr | grep " $addr/" | awk '{print $2}')
-		if [ -z "$dev" ]; then
-			ocf_log warn "$3 is not configured"
-			return 1
-		fi
-		ocf_log debug "$3 present on $dev"
-		
-		if [ "$monitor_link" = "yes" ]; then
-			if ! network_link_up $dev; then
-		        	ocf_log warn "No link on $dev..."
-				return 1
-			fi
-			ocf_log debug "Link detected on $dev"
-		fi
-		
-		[ $OCF_CHECK_LEVEL -lt 10 ] && return 0
-		if ! ping_check $1 $addr $dev; then
-			ocf_log warn "Failed to ping $addr"
-			return 1
-		fi
-		ocf_log debug "Local ping to $addr succeeded"
-		
-		return 0
-	fi
-
-	case $1 in
-	inet)
-		ipv4 $2 $3
-		return $?
-		;;
-	inet6)
-		ipv6 $2 $3
-		return $?
-		;;
-	esac
-	return 1
-}
-
-
-case ${OCF_RESKEY_family} in
-inet)
-	;;
-inet6)
-	;;
-*)
-	if [ "${OCF_RESKEY_address//:/}" != "${OCF_RESKEY_address}" ]; then
-		export OCF_RESKEY_family=inet6
-	else
-		export OCF_RESKEY_family=inet
-	fi
-	;;
-esac
-
-
-if [ -z "$OCF_CHECK_LEVEL" ]; then
-	OCF_CHECK_LEVEL=0
-fi
-
-if [ -z "$OCF_RESKEY_monitor_link" ]; then
-        OCF_RESKEY_monitor_link="yes"
-fi
-
-
-case $1 in
-start)
-	if address_configured ${OCF_RESKEY_family} ${OCF_RESKEY_address}; then
-		ocf_log debug "${OCF_RESKEY_address} already configured"
-		exit 0
-	fi
-	ip_op ${OCF_RESKEY_family} add ${OCF_RESKEY_address}
-	if [ $? -ne 0 ]; then
-		exit $OCF_ERR_GENERIC
-	fi
-
-	if [ $NFS_TRICKS -eq 0 ]; then
-		if [ "$OCF_RESKEY_nfslock" = "yes" ] || \
-	   	   [ "$OCF_RESKEY_nfslock" = "1" ]; then
-			notify_list_broadcast /var/lib/nfs/statd
-		fi
-	fi
-
-	exit $?
-	;;
-stop)
-	if address_configured ${OCF_RESKEY_family} ${OCF_RESKEY_address}; then
-		
-		ip_op ${OCF_RESKEY_family} del ${OCF_RESKEY_address}
-
-		# Make sure it's down
-		if address_configured ${OCF_RESKEY_family} ${OCF_RESKEY_address}; then
-			ocf_log err "Failed to remove ${OCF_RESKEY_address}"
-			exit 1
-		fi
-
-		# XXX Let nfsd/lockd clear their queues; we hope to have a
-		# way to enforce this in the future
-		if [ -z "$OCF_RESKEY_sleeptime" ]; then
-		    sleep 10
-		else
-		    if [ "$OCF_RESKEY_sleeptime" -gt "0" ]; then
-			sleep $OCF_RESKEY_sleeptime
-		    fi
-		fi
-	else
-		ocf_log debug "${OCF_RESKEY_address} is not configured"
-	fi
-	exit 0
-	;;
-status|monitor)
-	ip_op ${OCF_RESKEY_family} status ${OCF_RESKEY_address}
-	[ $? -ne 0 ] && exit $OCF_NOT_RUNNING
-	
-	check_interface_up ${OCF_RESKEY_family} ${OCF_RESKEY_address}
-	exit $?
-	;;
-restart)
-	$0 stop || exit $OCF_ERR_GENERIC
-	$0 start || exit $OCF_ERR_GENERIC
-	exit 0
-	;;
-meta-data)
-	meta_data
-	exit 0
-	;;
-validate-all|verify_all)
-	verify_all
-	exit $?
-	;;
-*)
-	echo "usage: $0 {start|stop|status|monitor|restart|meta-data|validate-all}"
-	exit $OCF_ERR_UNIMPLEMENTED
-	;;
-esac
-
-
diff --git a/rgmanager/src/resources/lvm.metadata b/rgmanager/src/resources/lvm.metadata
deleted file mode 100644
index 3759063..0000000
--- a/rgmanager/src/resources/lvm.metadata
+++ /dev/null
@@ -1,86 +0,0 @@
-<?xml version="1.0" ?>
-<resource-agent name="lvm" version="rgmanager 2.0">
-    <version>1.0</version>
-
-    <longdesc lang="en">
-	This defines a LVM volume group that is ...
-    </longdesc>
-
-    <shortdesc lang="en">
-	LVM Failover script
-    </shortdesc>
-
-    <parameters>
-        <parameter name="name" primary="1">
-            <longdesc lang="en">
-                Unique name for this LVM resource
-            </longdesc>
-            <shortdesc lang="en">
-                Name
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="vg_name" required="1">
-            <longdesc lang="en">
-                Name of the volume group being managed
-            </longdesc>
-            <shortdesc lang="en">
-                Volume group name
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="lv_name">
-            <longdesc lang="en">
-                Name of the logical volume being managed.  This
-		parameter is optional if there are more than one
-		logical volumes in the volume group to be managed.
-            </longdesc>
-            <shortdesc lang="en">
-                Logical Volume name (optional).
-            </shortdesc>
-	    <content type="string"/>
-	</parameter>
-
-	<parameter name="self_fence">
-	    <longdesc lang="en">
-		If set and the clean up of the tags fails, the node will
-		immediately reboot.
-	    </longdesc>
-	    <shortdesc lang="en">
-		Fence the node if it is not able to clean up LVM tags
-	    </shortdesc>
-	    <content type="boolean"/>
-	</parameter>
-
-	<parameter name="nfslock" inherit="service%nfslock">
-	    <longdesc lang="en">
-	        If set and unmounting the file system fails, the node will
-		try to kill lockd and issue reclaims across all remaining
-		network interface cards.
-	    </longdesc>
-	    <shortdesc lang="en">
-	        Enable NFS lock workarounds
-	    </shortdesc>
-	    <content type="boolean"/>
-	</parameter>
-
-    </parameters>
-
-    <actions>
-        <action name="start" timeout="5"/>
-	<action name="stop" timeout="5"/>
-
-	<action name="status" timeout="5" interval="1h"/>
-	<action name="monitor" timeout="5" interval="1h"/>
-
-	<action name="meta-data" timeout="5"/>
-	<action name="validate-all" timeout="30"/>
-    </actions>
-
-    <special tag="rgmanager">
-    	<attributes maxinstances="1"/>
-    </special>
-
-</resource-agent>
diff --git a/rgmanager/src/resources/lvm.sh b/rgmanager/src/resources/lvm.sh
deleted file mode 100644
index b19a8ac..0000000
--- a/rgmanager/src/resources/lvm.sh
+++ /dev/null
@@ -1,174 +0,0 @@
-#!/bin/bash
-
-#
-# LVM Failover Script.
-# NOTE: Changes to /etc/lvm/lvm.conf are required for proper operation.
-
-LC_ALL=C
-LANG=C
-PATH=/bin:/sbin:/usr/bin:/usr/sbin
-export LC_ALL LANG PATH
-
-. $(dirname $0)/ocf-shellfuncs
-. $(dirname $0)/utils/member_util.sh
-. $(dirname $0)/lvm_by_lv.sh
-. $(dirname $0)/lvm_by_vg.sh
-
-rv=0
-
-################################################################################
-# clvm_check
-#
-################################################################################
-function clvm_check
-{
-	if [[ $(vgs -o attr --noheadings $1) =~ .....c ]]; then
-		return 1
-	fi
-
-	return 0
-}
-
-################################################################################
-# ha_lvm_proper_setup_check
-#
-################################################################################
-function ha_lvm_proper_setup_check
-{
-	##
-	# The default for lvm.conf:activation/volume_list is empty,
-	# this must be changed for HA LVM.
-	##
-	if ! lvm dumpconfig activation/volume_list >& /dev/null; then
-		ocf_log err "HA LVM:  Improper setup detected"
-		ocf_log err "- \"volume_list\" not specified in lvm.conf."
-		return $OCF_ERR_GENERIC
-	fi
-
-	##
-	# Machine's cluster node name must be present as
-	# a tag in lvm.conf:activation/volume_list
-	##
-	if ! lvm dumpconfig activation/volume_list | grep $(local_node_name); then
-		ocf_log err "HA LVM:  Improper setup detected"
-		ocf_log err "- @$(local_node_name) missing from \"volume_list\" in lvm.conf"
-		return $OCF_ERR_GENERIC
-	fi
-
-	##
-	# The volume group to be failed over must NOT be in
-	# lvm.conf:activation/volume_list; otherwise, machines
-	# will be able to activate the VG regardless of the tags
-	##
-	if lvm dumpconfig activation/volume_list | grep $OCF_RESKEY_vg_name; then
-		ocf_log err "HA LVM:  Improper setup detected"
-		ocf_log err "- $OCF_RESKEY_vg_name found in \"volume_list\" in lvm.conf"
-		return $OCF_ERR_GENERIC
-	fi
-
-	##
-	# Next, we need to ensure that their initrd has been updated
-	# If not, the machine could boot and activate the VG outside
-	# the control of rgmanager
-	##
-	# Fixme: we might be able to perform a better check...
-	if [ "$(find /boot -name *.img -newer /etc/lvm/lvm.conf)" == "" ]; then
-		ocf_log err "HA LVM:  Improper setup detected"
-		ocf_log err "- initrd image needs to be newer than lvm.conf"
-		return $OCF_ERR_GENERIC
-	fi
-
-	return $OCF_SUCCESS
-}
-
-################################################################################
-# MAIN
-################################################################################
-
-case $1 in
-start)
-	##
-	# We can safely ignore clustered volume groups (VGs handled by CLVM)
-	##
-	if ! clvm_check $OCF_RESKEY_vg_name; then
-		ocf_log notice "$OCF_RESKEY_vg_name is a cluster volume.  Ignoring..."
-		exit 0
-	fi
-
-	ha_lvm_proper_setup_check || exit 1
-
-	rv=0
-
-	if [ -z $OCF_RESKEY_lv_name ]; then
-		vg_start || exit 1
-	else
-		lv_start || exit 1
-	fi
-	;;
-
-status|monitor)
-	ocf_log notice "Getting status"
-
-	if [ -z $OCF_RESKEY_lv_name ]; then
-		vg_status || exit 1
-	else
-		lv_status || exit 1
-	fi
-	rv=0
-	;;
-		    
-stop)
-	##
-	# We can safely ignore clustered volume groups (VGs handled by CLVM)
-	##
-	if ! clvm_check $OCF_RESKEY_vg_name; then
-		ocf_log notice "$OCF_RESKEY_vg_name is a cluster volume.  Ignoring..."
-		exit 0
-	fi
-
-	if ! ha_lvm_proper_setup_check; then
-		ocf_log err "WARNING: An improper setup can cause data corruption!"
-	fi
-
-	if [ -z $OCF_RESKEY_lv_name ]; then
-		vg_stop || exit 1
-	else
-		lv_stop || exit 1
-	fi
-	rv=0
-	;;
-
-recover|restart)
-	$0 stop || exit $OCF_ERR_GENERIC
-	$0 start || exit $OCF_ERR_GENERIC
-	rv=0
-	;;
-
-meta-data)
-	cat `echo $0 | sed 's/^\(.*\)\.sh$/\1.metadata/'`
-	rv=0
-	;;
-
-validate-all|verify-all)
-	##
-	# We can safely ignore clustered volume groups (VGs handled by CLVM)
-	##
-	if ! clvm_check $OCF_RESKEY_vg_name; then
-		ocf_log notice "$OCF_RESKEY_vg_name is a cluster volume.  Ignoring..."
-		exit 0
-	fi
-
-	if [ -z $OCF_RESKEY_lv_name ]; then
-		vg_verify || exit 1
-	else
-		lv_verify || exit 1
-	fi
-	rv=0
-	;;
-*)
-	echo "usage: $0 {start|status|monitor|stop|restart|meta-data|validate-all}"
-	exit $OCF_ERR_UNIMPLEMENTED
-	;;
-esac
-
-exit $rv
diff --git a/rgmanager/src/resources/lvm_by_lv.sh b/rgmanager/src/resources/lvm_by_lv.sh
deleted file mode 100644
index 2c6262f..0000000
--- a/rgmanager/src/resources/lvm_by_lv.sh
+++ /dev/null
@@ -1,337 +0,0 @@
-#!/bin/bash
-
-# lv_verify
-#
-# Verify the parameters passed in
-#
-lv_verify()
-{
-	# Anything to verify?  Perhaps the names?
-	return $OCF_SUCCESS
-}
-
-# lv_exec_resilient
-#
-# Sometimes, devices can come back.  Their metadata will conflict
-# with the good devices that remain.  This function filters out those
-# failed devices when executing the given command
-#
-# Finishing with vgscan resets the cache/filter
-lv_exec_resilient()
-{
-	declare command=$1
-	declare all_pvs
-
-	ocf_log notice "Making resilient : $command"
-
-	if [ -z $command ]; then
-		ocf_log err "lv_exec_resilient: Arguments not supplied"
-		return $OCF_ERR_ARGS
-	fi
-
-	# pvs will print out only those devices that are valid
-	# If a device dies and comes back, it will not appear
-	# in pvs output (but you will get a Warning).
-	all_pvs=(`pvs --noheadings -o pv_name | grep -v Warning`)
-
-	# Now we use those valid devices in a filter which we set up.
-	# The device will then be activated because there are no
-	# metadata conflicts.
-        command=$command" --config devices{filter=["
-	for i in ${all_pvs[*]}; do
-		command=$command'"a|'$i'|",'
-	done
-	command=$command"\"r|.*|\"]}"
-
-	ocf_log notice "Resilient command: $command"
-	if ! $command ; then
-		ocf_log err "lv_exec_resilient failed"
-		vgscan
-		return $OCF_ERR_GENERIC
-	else
-		vgscan
-		return $OCF_SUCCESS
-	fi
-}
-
-# lv_activate_resilient
-#
-# Sometimes, devices can come back.  Their metadata will conflict
-# with the good devices that remain.  We must filter out those
-# failed devices when trying to reactivate
-lv_activate_resilient()
-{
-	declare action=$1
-	declare lv_path=$2
-	declare op="-ay"
-
-	if [ -z $action ] || [ -z $lv_path ]; then
-		ocf_log err "lv_activate_resilient: Arguments not supplied"
-		return $OCF_ERR_ARGS
-	fi
-
-	if [ $action != "start" ]; then
-	        op="-an"
-	fi
-
-	if ! lv_exec_resilient "lvchange $op $lv_path" ; then
-		ocf_log err "lv_activate_resilient $action failed on $lv_path"
-		return $OCF_ERR_GENERIC
-	else
-		return $OCF_SUCCESS
-	fi
-}
-
-# lv_status
-#
-# Is the LV active?
-lv_status()
-{
-	declare lv_path="$OCF_RESKEY_vg_name/$OCF_RESKEY_lv_name"
-	declare dev="/dev/$lv_path"
-	declare realdev
-	declare owner
-	declare my_name
-
-	#
-	# Check if device is active
-	#
-	if [[ ! $(lvs -o attr --noheadings $lv_path) =~ ....a. ]]; then
-		return $OCF_ERR_GENERIC
-	fi
-
-	if [[ $(vgs -o attr --noheadings $OCF_RESKEY_vg_name) =~ .....c ]]; then
-		ocf_log notice "$OCF_RESKEY_vg_name is a cluster volume.  Ignoring..."
-		return $OCF_SUCCESS
-	fi
-
-	#
-	# Check if all links/device nodes are present
-	#
-        if [ -h "$dev" ]; then
-		realdev=$(readlink -f $dev)
-		if [ $? -ne 0 ]; then
-			ocf_log err "Failed to follow link, $dev"
-			return $OCF_ERR_ARGS
-		fi
-
-		if [ ! -b $realdev ]; then
-			ocf_log err "Device node for $lv_path is not present"
-			return $OCF_ERR_GENERIC
-		fi
-	else
-	        ocf_log err "Symbolic link for $lv_path is not present"
-		return $OCF_ERR_GENERIC
-	fi
-
-	#
-	# Verify that we are the correct owner
-	#
-	owner=`lvs -o tags --noheadings $lv_path`
-	my_name=$(local_node_name)
-	if [ -z $my_name ]; then
-		ocf_log err "Unable to determine local machine name"
-
-		# FIXME: I don't really want to fail on 1st offense
-		return $OCF_SUCCESS
-	fi
-
-	if [ -z $owner ] || [ $my_name != $owner ]; then
-		ocf_log err "WARNING: $lv_path should not be active"
-		ocf_log err "WARNING: $my_name does not own $lv_path"
-		ocf_log err "WARNING: Attempting shutdown of $lv_path"
-
-		lv_activate_resilient "stop" $lv_path
-		return $OCF_ERR_GENERIC
-	fi
-
-	return $OCF_SUCCESS
-}
-
-# lv_activate_and_tag
-lv_activate_and_tag()
-{
-	declare action=$1
-	declare tag=$2
-	declare lv_path=$3
-	typeset self_fence=""
-
-	case ${OCF_RESKEY_self_fence} in
-		"yes")          self_fence=1 ;;
-		1)              self_fence=1 ;;
-		*)              self_fence="" ;;
-	esac
-
-	if [ -z $action ] || [ -z $tag ] || [ -z $lv_path ]; then
-		ocf_log err "Supplied args: 1) $action, 2) $tag, 3) $lv_path"
-		return $OCF_ERR_ARGS
-	fi
-
-	if [ $action == "start" ]; then
-		ocf_log notice "Activating $lv_path"
-		lvchange --addtag $tag $lv_path
-		if [ $? -ne 0 ]; then
-			ocf_log err "Unable to add tag to $lv_path"
-			return $OCF_ERR_GENERIC
-		fi
-
-		if ! lv_activate_resilient $action $lv_path; then
-			ocf_log err "Unable to activate $lv_path"
-			return $OCF_ERR_GENERIC
-		fi
-	else
-		ocf_log notice "Deactivating $lv_path"
-		if ! lv_activate_resilient $action $lv_path; then
-			if [ "$self_fence" ]; then
-				ocf_log err "Unable to deactivate $lv_path: REBOOTING"
-				sync
-				reboot -fn
-			else
-				ocf_log err "Unable to deactivate $lv_path"
-			fi
-			return $OCF_ERR_GENERIC
-		fi
-
-		ocf_log notice "Removing ownership tag ($tag) from $lv_path"
-
-		lvchange --deltag $tag $lv_path
-		if [ $? -ne 0 ]; then
-			ocf_log err "Unable to delete tag from $lv_path"
-			return $OCF_ERR_GENERIC
-		fi
-	fi
-
-	return $OCF_SUCCESS
-}
-
-# lv_activate
-# $1: start/stop only
-#
-# Basically, if we want to [de]activate an LVM volume,
-# we must own it.  That means that our tag must be on it.
-# This requires a change to /etc/lvm/lvm.conf:
-#	volume_list = [ "root_volume", "@my_hostname" ]
-# where "root_volume" is your root volume group and
-# "my_hostname" is $(local_node_name)
-#
-# If there is a node failure, we may wish to "steal" the
-# LV.  For that, we need to check if the node that owns
-# it is still part of the cluster.  We use the tag to
-# determine who owns the volume then query for their
-# liveness.  If they are dead, we can steal.
-lv_activate()
-{
-	declare lv_path="$OCF_RESKEY_vg_name/$OCF_RESKEY_lv_name"
-	declare owner=`lvs -o tags --noheadings $lv_path`
-	declare my_name=$(local_node_name)
-
-	if [ -z $my_name ]; then
-		ocf_log err "Unable to determine cluster node name"
-		return $OCF_ERR_GENERIC
-	fi
-
-	#
-	# FIXME: This code block is repeated below... might be
-	# nice to put it in a function
-	#
-	if [ ! -z $owner ] && [ $owner != $my_name ]; then
-		if is_node_member_clustat $owner ; then
-			ocf_log err "$owner owns $lv_path unable to $1"
-			return $OCF_ERR_GENERIC
-		fi
-		ocf_log notice "Owner of $lv_path is not in the cluster"
-		ocf_log notice "Stealing $lv_path"
-
-		lvchange --deltag $owner $lv_path
-		if [ $? -ne 0 ]; then
-			ocf_log err "Failed to steal $lv_path from $owner"
-			return $OCF_ERR_GENERIC
-		fi
-
-		# Warning --deltag doesn't always result in failure
-		if [ ! -z `lvs -o tags --noheadings $lv_path` ]; then
-			ocf_log err "Failed to steal $lv_path from $owner."
-			return $OCF_ERR_GENERIC
-		fi
-	fi
-
-	if ! lv_activate_and_tag $1 $my_name $lv_path; then
-		ocf_log err "Failed to $1 $lv_path"
-
-		if [ "$1" == "start" ]; then
-			ocf_log notice "Attempting cleanup of $OCF_RESKEY_vg_name"
-
-			if vgreduce --removemissing --config \
-			    "activation { volume_list = \"$OCF_RESKEY_vg_name\" }" \
-			    $OCF_RESKEY_vg_name; then
-				ocf_log notice "$OCF_RESKEY_vg_name now consistent"
-				owner=`lvs -o tags --noheadings $lv_path`
-				if [ ! -z $owner ] && [ $owner != $my_name ]; then
-					if is_node_member_clustat $owner ; then
-						ocf_log err "$owner owns $lv_path unable to $1"
-						return $OCF_ERR_GENERIC
-					fi
-					ocf_log notice "Owner of $lv_path is not in the cluster"
-					ocf_log notice "Stealing $lv_path"
-
-					lvchange --deltag $owner $lv_path
-					if [ $? -ne 0 ]; then
-						ocf_log err "Failed to steal $lv_path from $owner"
-						return $OCF_ERR_GENERIC
-					fi
-
-					# Warning --deltag doesn't always result in failure
-					if [ ! -z `lvs -o tags --noheadings $lv_path` ]; then
-						ocf_log err "Failed to steal $lv_path from $owner."
-						return $OCF_ERR_GENERIC
-					fi
-				fi
-
-				if ! lv_activate_and_tag $1 $my_name $lv_path; then
-					ocf_log err "Failed second attempt to $1 $lv_path"
-					return $OCF_ERR_GENERIC
-				else
-					ocf_log notice "Second attempt to $1 $lv_path successful"
-					return $OCF_SUCCESS
-				fi
-			else
-				ocf_log err "Failed to make $OCF_RESKEY_vg_name consistent"
-				return $OCF_ERR_GENERIC
-			fi
-		else
-			ocf_log err "Failed to $1 $lv_path"
-			return $OCF_ERR_GENERIC
-		fi
-	fi
-	return $OCF_SUCCESS
-}
-
-function lv_start
-{
-	if ! lvs $OCF_RESKEY_vg_name >& /dev/null; then
-		lv_count=0
-	else
-		lv_count=`lvs --noheadings -o name $OCF_RESKEY_vg_name | grep -v _mlog | grep -v _mimage | grep -v nconsistent | wc -l`
-	fi
-	if [ $lv_count -gt 1 ]; then
-		ocf_log err "HA LVM requires Only one logical volume per volume group."
-		ocf_log err "There are currently $lv_count logical volumes in $OCF_RESKEY_vg_name"
-		ocf_log err "Failing HA LVM start of $OCF_RESKEY_vg_name/$OCF_RESKEY_lv_name"
-		exit $OCF_ERR_GENERIC
-	fi
-
-	if ! lv_activate start; then
-		return 1
-	fi
-
-	return 0
-}
-
-function lv_stop
-{
-	if ! lv_activate stop; then
-		return 1
-	fi
-
-	return 0
-}
diff --git a/rgmanager/src/resources/lvm_by_vg.sh b/rgmanager/src/resources/lvm_by_vg.sh
deleted file mode 100644
index 0c1bf0b..0000000
--- a/rgmanager/src/resources/lvm_by_vg.sh
+++ /dev/null
@@ -1,262 +0,0 @@
-#!/bin/bash
-
-# vg_owner
-#
-# Returns:
-#    1 == We are the owner
-#    2 == We can claim it
-#    0 == Owned by someone else
-function vg_owner
-{
-	local owner=`vgs -o tags --noheadings $OCF_RESKEY_vg_name`
-	local my_name=$(local_node_name)
-
-	if [ -z $my_name ]; then
-		ocf_log err "Unable to determine cluster node name"
-		return 0
-	fi
-
-	if [ -z $owner ]; then
-		# No-one owns this VG yet, so we can claim it
-		return 2
-	fi
-
-	if [ $owner != $my_name ]; then
-		if is_node_member_clustat $owner ; then
-			return 0
-		fi
-		return 2
-	fi
-
-	return 1
-}
-
-function strip_tags
-{
-	local i
-
-	for i in `vgs --noheadings -o tags $OCF_RESKEY_vg_name | sed s/","/" "/g`; do
-		ocf_log info "Stripping tag, $i"
-		vgchange --deltag $i $OCF_RESKEY_vg_name
-	done
-
-	if [ ! -z `vgs -o tags --noheadings $OCF_RESKEY_vg_name` ]; then
-		ocf_log err "Failed to remove ownership tags from $OCF_RESKEY_vg_name"
-		return $OCF_ERR_GENERIC
-	fi
-
-	return $OCF_SUCCESS
-}
-
-function strip_and_add_tag
-{
-	if ! strip_tags; then
-		ocf_log err "Failed to remove tags from volume group, $OCF_RESKEY_vg_name"
-		return $OCF_ERR_GENERIC
-	fi
-
-	vgchange --addtag $(local_node_name) $OCF_RESKEY_vg_name
-	if [ $? -ne 0 ]; then
-		ocf_log err "Failed to add ownership tag to $OCF_RESKEY_vg_name"
-		return $OCF_ERR_GENERIC
-        fi
-
-	ocf_log info "New tag \"$(local_node_name)\" added to $OCF_RESKEY_vg_name"
-
-	return $OCF_SUCCESS
-}
-
-# vg_status
-#
-# Are all the LVs active?
-function vg_status
-{
-	local i
-	local dev
-	local readdev
-	local my_name=$(local_node_name)
-
-	#
-	# Check that all LVs are active
-	#
-	for i in `lvs $OCF_RESKEY_vg_name --noheadings -o attr`; do
-		if [[ ! $i =~ ....a. ]]; then
-			return $OCF_ERR_GENERIC
-		fi
-	done
-
-	#
-	# Check if all links/device nodes are present
-	#
-	for i in `lvs $OCF_RESKEY_vg_name --noheadings -o name`; do
-		dev="/dev/$OCF_RESKEY_vg_name/$i"
-
-		if [ -h $dev ]; then
-			realdev=$(readlink -f $dev)
-			if [ $? -ne 0 ]; then
-				ocf_log err "Failed to follow link, $dev"
-				return $OCF_ERR_GENERIC
-			fi
-
-			if [ ! -b $realdev ]; then
-				ocf_log err "Device node for $dev is not present"
-				return $OCF_ERR_GENERIC
-			fi
-		else
-			ocf_log err "Symbolic link for $lv_path is not present"
-			return $OCF_ERR_GENERIC
-		fi
-	done
-
-	#
-	# Verify that we are the correct owner
-	#
-	vg_owner
-	if [ $? -ne 1 ]; then
-		ocf_log err "WARNING: $OCF_RESKEY_vg_name should not be active"
-		ocf_log err "WARNING: $my_name does not own $OCF_RESKEY_vg_name"
-		ocf_log err "WARNING: Attempting shutdown of $OCF_RESKEY_vg_name"
-
-		# FIXME: may need more force to shut this down
-		vgchange -an $OCF_RESKEY_vg_name
-		return $OCF_ERR_GENERIC
-	fi
-
-	return $OCF_SUCCESS
-}
-
-function vg_verify
-{
-	# Anything to verify?
-	return $OCF_SUCCESS
-}
-
-function vg_start
-{
-	local a
-	local results
-	local all_pvs
-	local resilience
-
-	ocf_log info "Starting volume group, $OCF_RESKEY_vg_name"
-
-	vg_owner
-	case $? in
-	0)
-		ocf_log info "Someone else owns this volume group"
-		return $OCF_ERR_GENERIC
-		;;
-	1)
-		ocf_log info "I own this volume group"
-		;;
-	2)
-		ocf_log info "I can claim this volume group"
-		;;
-	esac
-
-	if ! strip_and_add_tag ||
-	   ! vgchange -ay $OCF_RESKEY_vg_name; then
-		ocf_log err "Failed to activate volume group, $OCF_RESKEY_vg_name"
-		ocf_log notice "Attempting cleanup of $OCF_RESKEY_vg_name"
-
-		if ! vgreduce --removemissing --config \
-			"activation { volume_list = \"$OCF_RESKEY_vg_name\" }" \
-			$OCF_RESKEY_vg_name; then
-
-			ocf_log err "Failed to make $OCF_RESKEY_vg_name consistent"
-			return $OCF_ERR_GENERIC
-		fi
-
-		vg_owner
-		if [ $? -eq 0 ]; then
-			ocf_log err "Unable to claim ownership of $OCF_RESKEY_vg_name"
-			return $OCF_ERR_GENERIC
-		fi
-
-		if ! strip_and_add_tag ||
-		   ! vgchange -ay $OCF_RESKEY_vg_name; then
-			ocf_log err "Failed second attempt to activate $OCF_RESKEY_vg_name"
-			return $OCF_ERR_GENERIC
-		fi
-
-		ocf_log notice "Second attempt to activate $OCF_RESKEY_vg_name successful"
-		return $OCF_SUCCESS
-	else
-		# The activation commands succeeded, but did they do anything?
-		# Make sure all the logical volumes are active
-		results=(`lvs -o name,attr --noheadings $OCF_RESKEY_vg_name 2> /dev/null`)
-		a=0
-		while [ ! -z ${results[$a]} ]; do
-			if [[ ! ${results[$(($a + 1))]} =~ ....a. ]]; then
-				all_pvs=(`pvs --noheadings -o name 2> /dev/null`)
-				resilience=" --config devices{filter=["
-			        for i in ${all_pvs[*]}; do
-			                resilience=$resilience'"a|'$i'|",'
-        			done
-				resilience=$resilience"\"r|.*|\"]}"
-
-				vgchange -ay $OCF_RESKEY_vg_name $resilience
-				break
-			fi
-			a=$(($a + 2))
-		done
-
-		#  We need to check the LVs again if we made the command resilient
-		if [ ! -z $resilience ]; then
-			results=(`lvs -o name,attr --noheadings $OCF_RESKEY_vg_name $resilience 2> /dev/null`)
-			a=0
-			while [ ! -z ${results[$a]} ]; do
-				if [[ ! ${results[$(($a + 1))]} =~ ....a. ]]; then
-		                        ocf_log err "Failed to activate $OCF_RESKEY_vg_name"
-                		        return $OCF_ERR_GENERIC
-                		fi
-				a=$(($a + 2))
-			done
-			ocf_log err "Orphan storage device in $OCF_RESKEY_vg_name slowing operations"
-		fi
-	fi
-
-	return $OCF_SUCCESS
-}
-
-function vg_stop
-{
-	local a
-	local results
-	typeset self_fence=""
-
-	case ${OCF_RESKEY_self_fence} in
-		"yes")          self_fence=1 ;;
-		1)              self_fence=1 ;;
-		*)              self_fence="" ;;
-	esac
-
-	#  Shut down the volume group
-	#  Do we need to make this resilient?
-	vgchange -an $OCF_RESKEY_vg_name
-
-	#  Make sure all the logical volumes are inactive
-	results=(`lvs -o name,attr --noheadings $OCF_RESKEY_vg_name 2> /dev/null`)
-	a=0
-	while [ ! -z ${results[$a]} ]; do
-		if [[ ${results[$(($a + 1))]} =~ ....a. ]]; then
-			if [ "$self_fence" ]; then
-				ocf_log err "Unable to deactivate $lv_path REBOOT"
-				sync
-				reboot -fn
-			else
-				ocf_log err "Logical volume $OCF_RESKEY_vg_name/${results[$a]} failed to shutdown"
-			fi
-			return $OCF_ERR_GENERIC
-		fi
-		a=$(($a + 2))
-	done
-
-	#  Make sure we are the owner before we strip the tags
-	vg_owner
-	if [ $? -ne 0 ]; then
-		strip_tags
-	fi
-
-	return $OCF_SUCCESS
-}
diff --git a/rgmanager/src/resources/mysql.metadata b/rgmanager/src/resources/mysql.metadata
deleted file mode 100644
index edb3744..0000000
--- a/rgmanager/src/resources/mysql.metadata
+++ /dev/null
@@ -1,96 +0,0 @@
-<?xml version="1.0"?>
-<resource-agent version="rgmanager 2.0" name="mysql">
-    <version>1.0</version>
-
-    <longdesc lang="en">
-        This defines an instance of MySQL database server
-    </longdesc>
-    <shortdesc lang="en">
-        Defines a MySQL database server
-    </shortdesc>
-
-    <parameters>
-        <parameter name="name" primary="1">
-	    <longdesc lang="en">
-	        Define a name 
-	    </longdesc>
-            <shortdesc lang="en">
-                Name
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="config_file">
-            <longdesc lang="en">
-                Define configuration file
-            </longdesc>
-            <shortdesc lang="en">
-                Define configuration file
-            </shortdesc>
-	    <content type="string" default="/etc/my.cnf"/>
-        </parameter>
-
-        <parameter name="listen_address">
-            <longdesc lang="en">
-		Define an IP address for MySQL
-            </longdesc>
-            <shortdesc lang="en">
-		Define an IP address for MySQL server. If the address
-		is not given then first IP address from the service is taken.
-            </shortdesc>
-            <content type="string"/>
-        </parameter>
-
-	<parameter name="mysqld_options">
-		<longdesc lang="en">
-			Other command-line options for mysqld
-		</longdesc>
-		<shortdesc lang="en">
-			Other command-line options for mysqld
-		</shortdesc>
-		<content type="string" />
-	</parameter>
-
-	<parameter name="shutdown_wait">
-		<longdesc lang="en">
-			Wait X seconds for correct end of service shutdown
-		</longdesc>
-		<shortdesc lang="en">
-			Wait X seconds for correct end of service shutdown
-		</shortdesc>
-		<content type="integer" />
-	</parameter>
-
-        <parameter name="service_name" inherit="service%name">
-            <longdesc lang="en">
-	    	Inherit the service name.  We need to know
-		the service name in order to determine file
-		systems and IPs for this service.
-            </longdesc>
-            <shortdesc lang="en">
-	    	Inherit the service name.
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-    </parameters>
-
-    <actions>
-        <action name="start" timeout="0"/>
-	<action name="stop" timeout="0"/>
-
-	<!-- Checks to see if it''s mounted in the right place -->
-	<action name="status" interval="1m" timeout="10"/>
-	<action name="monitor" interval="1m" timeout="10"/>
-
-	<!-- Checks to see if we can read from the mountpoint -->
-	<action name="status" depth="10" timeout="30" interval="5m"/>
-	<action name="monitor" depth="10" timeout="30" interval="5m"/>
-
-	<action name="meta-data" timeout="0"/>
-	<action name="validate-all" timeout="0"/>
-    </actions>
-
-    <special tag="rgmanager">
-    </special>
-</resource-agent>
diff --git a/rgmanager/src/resources/mysql.sh b/rgmanager/src/resources/mysql.sh
deleted file mode 100644
index 7afd22f..0000000
--- a/rgmanager/src/resources/mysql.sh
+++ /dev/null
@@ -1,174 +0,0 @@
-#!/bin/bash
-
-export LC_ALL=C
-export LANG=C
-export PATH=/bin:/sbin:/usr/bin:/usr/sbin
-
-. $(dirname $0)/ocf-shellfuncs
-. $(dirname $0)/utils/config-utils.sh
-. $(dirname $0)/utils/messages.sh
-. $(dirname $0)/utils/ra-skelet.sh
-
-declare MYSQL_MYSQLD=/usr/bin/mysqld_safe
-declare MYSQL_ipAddress
-declare MYSQL_pid_file="`generate_name_for_pid_file`"
-declare MYSQL_timeout=30
-
-verify_all()
-{
-	clog_service_verify $CLOG_INIT
-
-	if [ -z "$OCF_RESKEY_name" ]; then
-		clog_service_verify $CLOG_FAILED "Invalid Name Of Service"
-		return $OCF_ERR_ARGS
-	fi
-
-	if [ -z "$OCF_RESKEY_service_name" ]; then
-		clog_service_verify $CLOG_FAILED_NOT_CHILD
-		return $OCF_ERR_ARGS
-	fi
-
-	if [ -z "$OCF_RESKEY_config_file" ]; then
-		clog_check_file_exist $CLOG_FAILED_INVALID "$OCF_RESKEY_config_file"
-		clog_service_verify $CLOG_FAILED
-		return $OCF_ERR_ARGS
-	fi
-
-	if [ ! -r "$OCF_RESKEY_config_file" ]; then
-		clog_check_file_exist $CLOG_FAILED_NOT_READABLE $OCF_RESKEY_config_file
-		clog_service_verify $CLOG_FAILED
-		return $OCF_ERR_ARGS
-	fi
-
-	if [ -z "$MYSQL_pid_file" ]; then
-		clog_service_verify $CLOG_FAILED "Invalid name of PID file"
-		return $OCF_ERR_ARGS
-	fi
-
-	clog_service_verify $CLOG_SUCCEED
-	return 0
-}
-
-start()
-{
-	clog_service_start $CLOG_INIT
-
-	create_pid_directory
-	check_pid_file "$MYSQL_pid_file"
-
-	if [ $? -ne 0 ]; then
-		clog_check_pid $CLOG_FAILED "$MYSQL_pid_file"
-		clog_service_start $CLOG_FAILED
-		return $OCF_ERR_GENERIC
-	fi
-
-	if [ -n "$OCF_RESKEY_listen_address" ]; then
-		MYSQL_ipAddress="$OCF_RESKEY_listen_address"
-	else
-		clog_looking_for $CLOG_INIT "IP Address"
-
-	        get_service_ip_keys "$OCF_RESKEY_service_name"
-	        ip_addresses=`build_ip_list`
-
-		if [ -n "$ip_addresses" ]; then
-			for i in $ip_addresses; do
-				MYSQL_ipAddress="$i"
-				break;
-			done
-		else
-			clog_looking_for $CLOG_FAILED_NOT_FOUND "IP Address"
-		fi
-	fi
-
-	clog_looking_for $CLOG_SUCCEED "IP Address"
-
-	$MYSQL_MYSQLD --defaults-file="$OCF_RESKEY_config_file" \
-		--pid-file="$MYSQL_pid_file" \
-		--bind-address="$MYSQL_ipAddress" \
-		$OCF_RESKEY_mysqld_options > /dev/null 2>&1 &
-
-	if [ $? -ne 0 ]; then
-		clog_service_start $CLOG_FAILED
-		return $OCF_ERR_GENERIC
-	fi
-
-	while [ "$MYSQL_timeout" -gt 0 ]; do
-		if [ -f "$MYSQL_pid_file" ]; then
-			break;			
-		fi
-		sleep 1
-		let MYSQL_timeout=${MYSQL_timeout}-1
-        done
-
-        if [ "$MYSQL_timeout" -eq 0 ]; then
-		clog_service_start $CLOG_FAILED_TIMEOUT
-		return $OCF_ERR_GENERIC
-	fi
-	
-	clog_service_start $CLOG_SUCCEED
-
-	return 0;
-}
-
-stop()
-{
-	clog_service_stop $CLOG_INIT
-
-	stop_generic "$MYSQL_pid_file" "$OCF_RESKEY_shutdown_wait"
-	
-	if [ $? -ne 0 ]; then
-		clog_service_stop $CLOG_FAILED
-		return $OCF_ERR_GENERIC
-	fi
-	
-	clog_service_stop $CLOG_SUCCEED
-	return 0;
-}
-
-status()
-{
-	clog_service_status $CLOG_INIT
-
-	status_check_pid "$MYSQL_pid_file"
-	if [ $? -ne 0 ]; then
-		clog_service_status $CLOG_FAILED "$MYSQL_pid_file"
-		return $OCF_ERR_GENERIC
-	fi
-
-	clog_service_status $CLOG_SUCCEED
-	return 0
-}
-
-case $1 in
-	meta-data)
-		cat `echo $0 | sed 's/^\(.*\)\.sh$/\1.metadata/'`
-		exit 0
-		;;
-	validate-all)
-		verify_all
-		exit $?
-		;;
-	start)
-		verify_all && start
-		exit $?
-		;;
-	stop)
-		verify_all && stop
-		exit $?
-		;;
-	status|monitor)
-		verify_all
-		status
-		exit $?
-		;;
-	restart)
-		verify_all
-		stop
-		start
-		exit $?
-		;;
-	*)
-		echo "Usage: $0 {start|stop|status|monitor|restart|meta-data|validate-all}"
-		exit $OCF_ERR_UNIMPLEMENTED
-		;;
-esac
diff --git a/rgmanager/src/resources/named.metadata b/rgmanager/src/resources/named.metadata
deleted file mode 100644
index 64442b1..0000000
--- a/rgmanager/src/resources/named.metadata
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0"?>
-<resource-agent version="rgmanager 2.0" name="named">
-    <version>1.0</version>
-
-    <longdesc lang="en">
-        This defines an instance of DNS named server
-    </longdesc>
-    <shortdesc lang="en">
-        Defines an instance of named server
-    </shortdesc>
-
-    <parameters>
-        <parameter name="name" primary="1">
-	    <longdesc lang="en">
-	        Specifies a service name for logging and other purposes
-	    </longdesc>
-            <shortdesc lang="en">
-                Name
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="config_file">
-            <longdesc lang="en">
-                Define absolute path to configuration file
-            </longdesc>
-            <shortdesc lang="en">
-                Config File
-            </shortdesc>
-	    <content type="string" default="/etc/named.conf"/>
-        </parameter>
-
-        <parameter name="named_sdb">
-            <longdesc lang="en">
-		Simplified Database Backend
-            </longdesc>
-            <shortdesc lang="en">
-		Simplified Database Backend
-            </shortdesc>
-	    <content type="boolean" default="0"/>
-        </parameter>
-
-	<parameter name="named_working_dir">
-		<longdesc lang="en">
-			Other command-line options for named
-		</longdesc>
-		<shortdesc lang="en">
-			Other command-line options for named
-		</shortdesc>
-		<content type="string" default="/var/named" />
-	</parameter>
-
-	<parameter name="named_options">
-		<longdesc lang="en">
-			Other command-line options for named
-		</longdesc>
-		<shortdesc lang="en">
-			Other command-line options for named
-		</shortdesc>
-		<content type="string" />
-	</parameter>
-
-	<parameter name="shutdown_wait">
-		<longdesc lang="en">
-			Wait X seconds for correct end of service shutdown
-		</longdesc>
-		<shortdesc lang="en">
-			Wait X seconds for correct end of service shutdown
-		</shortdesc>
-		<content type="integer" default="5" />
-	</parameter>
-
-        <parameter name="service_name" inherit="service%name">
-            <longdesc lang="en">
-	    	Inherit the service name.  We need to know
-		the service name in order to determine file
-		systems and IPs for this service.
-            </longdesc>
-            <shortdesc lang="en">
-	    	Inherit the service name.
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-    </parameters>
-
-    <actions>
-        <action name="start" timeout="0"/>
-	<action name="stop" timeout="0"/>
-
-	<!-- Checks to see if it''s mounted in the right place -->
-	<action name="status" interval="1m" timeout="10"/>
-	<action name="monitor" interval="1m" timeout="10"/>
-
-	<!-- Checks to see if we can read from the mountpoint -->
-	<action name="status" depth="10" timeout="30" interval="5m"/>
-	<action name="monitor" depth="10" timeout="30" interval="5m"/>
-
-	<action name="meta-data" timeout="0"/>
-	<action name="validate-all" timeout="0"/>
-    </actions>
-
-    <special tag="rgmanager">
-    </special>
-</resource-agent>
diff --git a/rgmanager/src/resources/named.sh b/rgmanager/src/resources/named.sh
deleted file mode 100644
index c8f65bb..0000000
--- a/rgmanager/src/resources/named.sh
+++ /dev/null
@@ -1,193 +0,0 @@
-#!/bin/bash
-
-export LC_ALL=C
-export LANG=C
-export PATH=/bin:/sbin:/usr/bin:/usr/sbin
-
-. $(dirname $0)/ocf-shellfuncs
-. $(dirname $0)/utils/config-utils.sh
-. $(dirname $0)/utils/messages.sh
-. $(dirname $0)/utils/ra-skelet.sh
-
-declare NAMED_NAMED=/usr/sbin/named
-declare NAMED_pid_file="`generate_name_for_pid_file`"
-declare NAMED_conf_dir="`generate_name_for_conf_dir`"
-declare NAMED_gen_config_file="$NAMED_conf_dir/named.conf"
-declare NAMED_url_list
-declare NAMED_parse_config=$(dirname $0)/utils/named-parse-config.pl
-
-verify_all()
-{
-	clog_service_verify $CLOG_INIT
-
-	if [ -z "$OCF_RESKEY_name" ]; then
-		clog_service_verify $CLOG_FAILED "Invalid Name Of Service"
-		return $OCF_ERR_ARGS
-	fi
-
-	if [ -z "$OCF_RESKEY_service_name" ]; then
-		clog_service_verify $CLOG_FAILED_NOT_CHILD
-		return $OCF_ERR_ARGS
-	fi
-
-	if [ -z "$OCF_RESKEY_config_file" ]; then
-		clog_check_file_exist $CLOG_FAILED_INVALID "$OCF_RESKEY_config_file"
-		clog_service_verify $CLOG_FAILED
-		return $OCF_ERR_ARGS
-	fi
-
-	if [ ! -r "$OCF_RESKEY_config_file" ]; then
-		clog_check_file_exist $CLOG_FAILED_NOT_READABLE $OCF_RESKEY_config_file
-		clog_service_verify $CLOG_FAILED
-		return $OCF_ERR_ARGS
-	fi
-
-	clog_service_verify $CLOG_SUCCEED
-		
-	return 0
-}
-
-generate_config_file()
-{
-	declare original_file="$1"
-	declare generated_file="$2"
-	declare ip_address="$3"
-
-	if [ -f "$generated_file" ]; then
-		sha1_verify "$generated_file"
-		if [ $? -ne 0 ]; then
-			clog_check_sha1 $CLOG_FAILED
-			return 0
-		fi
-	fi	
-
-	clog_generate_config $CLOG_INIT "$original_file" "$generated_file"
-
-	generate_configTemplate "$generated_file" "$1"
-	cat "$original_file" | grep -v "^[[:space:]]*listen-on" | \
-		grep -v "^[[:space:]]*pid-file" | \
-		grep -v "^[[:space:]]*directory" >> "$generated_file"
-
-	declare tmp_file=`mktemp -t cluster.XXXXXXXXXX`
-	mv "$generated_file" "$tmp_file"
-
-	"$NAMED_parse_config" "$OCF_RESKEY_named_working_dir" "$NAMED_pid_file" "$ip_address" \
-		 < "$tmp_file" > "$generated_file"
-
-	rm "$tmp_file"	
-        sha1_addToFile "$generated_file"
-	clog_generate_config $CLOG_SUCCEED "$original_file" "$generated_file"
-
-	return 0;
-}
-
-start()
-{
-	declare ip_list;
-	
-	clog_service_start $CLOG_INIT
-
-	create_pid_directory
-	create_conf_directory "$NAMED_conf_dir"
-	check_pid_file "$NAMED_pid_file"
-
-	if [ $? -ne 0 ]; then
-		clog_check_pid $CLOG_FAILED "$NAMED_pid_file"
-		clog_service_start $CLOG_FAILED
-		return $OCF_ERR_GENERIC
-	fi
-	clog_looking_for $CLOG_INIT "IP Addresses"
-
-        get_service_ip_keys "$OCF_RESKEY_service_name"
-        ip_addresses=`build_ip_list`
-
-	if [ -z "$ip_addresses" ]; then
-		clog_looking_for $CLOG_FAILED_NOT_FOUND "IP Addresses"
-		return $OCF_ERR_GENERIC
-	fi
-	
-	clog_looking_for $CLOG_SUCCEED "IP Addresses"
-
-	ip_list=`echo $ip_addresses | sed 's/ /;/;s/\([[:digit:]]\)$/\1;/' `
-
-	if [ -z "$ip_list" ]; then
-		clog_looking_for $CLOG_FAILED_NOT_FOUND "IP Addresses"
-		return $OCF_ERR_GENERIC
-	fi
-
-	generate_config_file "$OCF_RESKEY_config_file" "$NAMED_gen_config_file" "$ip_list"
-
-	$NAMED_NAMED -c "$NAMED_gen_config_file" $OCF_RESKEY_named_options
-
-	if [ $? -ne 0 ]; then
-		clog_service_start $CLOG_FAILED
-		return $OCF_ERR_GENERIC
-	fi
-
-	clog_service_start $CLOG_SUCCEED
-
-	return 0;
-}
-
-stop()
-{
-	clog_service_stop $CLOG_INIT
-
-	stop_generic "$NAMED_pid_file" "$OCF_RESKEY_shutdown_wait"
-	
-	if [ $? -ne 0 ]; then
-		clog_service_stop $CLOG_FAILED
-		return $OCF_ERR_GENERIC
-	fi
-	
-	clog_service_stop $CLOG_SUCCEED
-	return 0;
-}
-
-status()
-{
-	clog_service_status $CLOG_INIT
-
-	status_check_pid "$NAMED_pid_file"
-	if [ $? -ne 0 ]; then
-		clog_service_status $CLOG_FAILED "$NAMED_pid_file"
-		return $OCF_ERR_GENERIC
-	fi
-
-	clog_service_status $CLOG_SUCCEED
-	return 0
-}
-
-case $1 in
-	meta-data)
-		cat `echo $0 | sed 's/^\(.*\)\.sh$/\1.metadata/'`
-		exit 0
-		;;
-	validate-all)
-		verify_all
-		exit $?
-		;;
-	start)
-		verify_all && start
-		exit $?
-		;;
-	stop)
-		verify_all && stop
-		exit $?
-		;;
-	status|monitor)
-		verify_all
-		status
-		exit $?
-		;;
-	restart)
-		verify_all
-		stop
-		start
-		exit $?
-		;;
-	*)
-		echo "Usage: $0 {start|stop|status|monitor|restart|meta-data|validate-all}"
-		exit $OCF_ERR_UNIMPLEMENTED
-		;;
-esac
diff --git a/rgmanager/src/resources/netfs.sh b/rgmanager/src/resources/netfs.sh
deleted file mode 100644
index e6b0296..0000000
--- a/rgmanager/src/resources/netfs.sh
+++ /dev/null
@@ -1,712 +0,0 @@
-#!/bin/bash
-
-#
-# NFS/CIFS file system mount/umount/etc. agent
-#
-
-LC_ALL=C
-LANG=C
-PATH=/bin:/sbin:/usr/bin:/usr/sbin
-export LC_ALL LANG PATH
-
-#
-# XXX todo - search and replace on these
-#
-SUCCESS=0
-FAIL=2
-YES=0
-NO=1
-YES_STR="yes"
-
-
-. $(dirname $0)/ocf-shellfuncs
-
-
-meta_data()
-{
-	cat <<EOT
-<?xml version="1.0" ?>
-<resource-agent name="netfs" version="rgmanager 2.0">
-    <version>1.0</version>
-
-    <longdesc lang="en">
-        This defines an NFS/CIFS mount for use by cluster services.
-    </longdesc>
-    <shortdesc lang="en">
-        Defines an NFS/CIFS file system mount.
-    </shortdesc>
-
-    <parameters>
-        <parameter name="name" primary="1">
-	    <longdesc lang="en">
-	        Symbolic name for this file system.
-	    </longdesc>
-            <shortdesc lang="en">
-                File System Name
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="mountpoint" unique="1" required="1">
-	    <longdesc lang="en">
-	        Path in file system heirarchy to mount this file system.
-	    </longdesc>
-            <shortdesc lang="en">
-                Mount Point
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="host" required="1">
-	    <longdesc lang="en">
-	    	Server IP address or hostname
-	    </longdesc>
-            <shortdesc lang="en">
-	    	IP or Host
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="export" required="1">
-	    <longdesc lang="en">
-	    	NFS Export directory name or CIFS share
-	    </longdesc>
-            <shortdesc lang="en">
-	    	Export
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="fstype" required="0">
-	    <longdesc lang="en">
-	    	File System type (nfs, nfs4 or cifs)
-	    </longdesc>
-            <shortdesc lang="en">
-	    	File System Type
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="force_unmount">
-            <longdesc lang="en">
-                If set, the cluster will kill all processes using 
-                this file system when the resource group is 
-                stopped.  Otherwise, the unmount will fail, and
-                the resource group will be restarted.
-            </longdesc>
-            <shortdesc lang="en">
-                Force Unmount
-            </shortdesc>
-	    <content type="boolean"/>
-        </parameter>
-
-        <parameter name="options">
-            <longdesc lang="en">
-	    	Provides a list of mount options.  If none are specified,
-		the NFS file system is mounted -o sync.
-            </longdesc>
-            <shortdesc lang="en">
-                Mount Options
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-    </parameters>
-
-    <actions>
-        <action name="start" timeout="900"/>
-	<action name="stop" timeout="30"/>
-	<!-- Recovery isn't possible; we don't know if resources are using
-	     the file system. -->
-
-	<!-- Checks to see if it's mounted in the right place -->
-	<action name="status" interval="1m" timeout="10"/>
-	<action name="monitor" interval="1m" timeout="10"/>
-
-	<!-- Checks to see if we can read from the mountpoint -->
-	<action name="status" depth="10" timeout="30" interval="5m"/>
-	<action name="monitor" depth="10" timeout="30" interval="5m"/>
-
-	<!-- Checks to see if we can write to the mountpoint (if !ROFS) -->
-	<action name="status" depth="20" timeout="30" interval="10m"/>
-	<action name="monitor" depth="20" timeout="30" interval="10m"/>
-
-	<action name="meta-data" timeout="5"/>
-	<action name="validate-all" timeout="5"/>
-    </actions>
-
-    <special tag="rgmanager">
-        <child type="nfsexport" forbid="1"/>
-        <child type="nfsclient" forbid="1"/>
-    </special>
-</resource-agent>
-EOT
-}
-
-
-verify_name()
-{
-	[ -n "$OCF_RESKEY_name" ] || exit $OCF_ERR_ARGS
-}
-
-
-verify_mountpoint()
-{
-	if [ -z "$OCF_RESKEY_mountpoint" ]; then
-		ocf_log err "No mount point specified."
-		return $OCF_ERR_ARGS
-	fi
-
-	if ! [ -e "$OCF_RESKEY_mountpoint" ]; then
-		ocf_log info "Mount point $OCF_RESKEY_mountpoint will be created "\
-		     "at mount time."
-		return 0
-	fi
-
-	[ -d "$OCF_RESKEY_mountpoint" ] && return 0
-
-	ocf_log err "$OCF_RESKEY_mountpoint is not a directory"
-	
-	return 1
-}
-
-
-verify_host()
-{
-	if [ -z "$OCF_RESKEY_host" ]; then
-	       ocf_log err "No server hostname or IP address specified."
-	       return 1
-	fi
-
-	host $OCF_RESKEY_host 2>&1 | grep -vq "not found"
-	if [ $? -eq 0 ]; then
-		return 0
-	fi
-
-	ocf_log err "Hostname or IP address \"$OCF_RESKEY_host\" not valid"
-
-	return $OCF_ERR_ARGS
-}
-
-
-verify_fstype()
-{
-	# Auto detect?
-	[ -z "$OCF_RESKEY_fstype" ] && return 0
-
-	case $OCF_RESKEY_fstype in
-	nfs|nfs4|cifs)
-		return 0
-		;;
-	*)
-		ocf_log err "File system type $OCF_RESKEY_fstype not supported"
-		return $OCF_ERR_ARGS
-		;;
-	esac
-}
-
-
-verify_options()
-{
-	declare -i ret=0
-
-	#
-	# From mount(1)
-	#
-	for o in `echo $OCF_RESKEY_options | sed -e s/,/\ /g`; do
-		case $o in
-		async|atime|auto|defaults|dev|exec|_netdev|noatime)
-			continue
-			;;
-		noauto|nodev|noexec|nosuid|nouser|ro|rw|suid|sync)
-			continue
-			;;
-		dirsync|user|users)
-			continue
-			;;
-		esac
-
-		case $OCF_RESKEY_fstype in
-		cifs)
-			continue
-			;;
-		nfs|nfs4)
-			case $o in
-			#
-			# NFS / NFS4 common
-			#
-			rsize=*|wsize=*|timeo=*|retrans=*|acregmin=*)
-				continue
-				;;
-			acregmax=*|acdirmin=*|acdirmax=*|actimeo=*)
-				continue
-				;;
-			retry=*|port=*|bg|fg|soft|hard|intr|cto|ac|noac)
-				continue
-				;;
-			esac
-
-			#
-			# NFS v2/v3 only
-			#
-			if [ "$OCF_RESKEY_fstype" = "nfs" ]; then
-				case $o in
-				mountport=*|mounthost=*)
-					continue
-					;;
-				mountprog=*|mountvers=*|nfsprog=*|nfsvers=*)
-					continue
-					;;
-				namelen=*)
-					continue
-					;;
-				tcp|udp|lock|nolock)
-					continue
-					;;
-				esac
-			fi
-
-			#
-			# NFS4 only
-			#
-			if [ "$OCF_RESKEY_fstype" = "nfs4" ]; then
-				case $o in
-				proto=*|clientaddr=*|sec=*)
-					continue
-					;;
-				esac
-			fi
-
-			;;
-		esac
-
-		ocf_log err "Option $o not supported for $OCF_RESKEY_fstype"
-		ret=$OCF_ERR_ARGS
-	done
-
-	return $ret
-}
-
-
-verify_all()
-{
-	verify_name || return $OCF_ERR_ARGS
-	verify_fstype|| return $OCF_ERR_ARGS
-	verify_host || return $OCF_ERR_ARGS
-	verify_mountpoint || return $OCF_ERR_ARGS
-	verify_options || return $OCF_ERR_ARGS
-}
-
-
-
-#
-# isMounted fullpath mount_point
-#
-# Check to see if the full path is mounted where we need it.
-#
-isMounted () {
-
-	typeset mp tmp_mp
-	typeset fullpath tmp_fullpath
-
-	if [ $# -ne 2 ]; then
-		ocf_log err "Usage: isMounted host:/export mount_point"
-		return $FAIL
-	fi
-
-	fullpath=$1
-	mp=$(readlink -f $2)
-
-	while read tmp_fullpath tmp_mp
-	do
-		if [ "$tmp_fullpath" = "$fullpath" -a \
-		     "$tmp_mp" = "$mp" ]; then
-			return $YES
-		fi
-	done < <(mount | awk '{print $1,$3}')
-
-	return $NO
-}
-
-#
-# killMountProcesses mount_point
-#
-# Using lsof or fuser try to unmount the mount by killing of the processes
-# that might be keeping it busy.
-#
-killMountProcesses()
-{
-        typeset -i ret=$SUCCESS
-        typeset have_lsof=""
-        typeset have_fuser=""
-        typeset try
-
-        if [ $# -ne 1 ]; then
-                ocf_log err \
-                        "Usage: killMountProcesses mount_point"
-                return $FAIL
-        fi
-
-        typeset mp=$1
-
-        ocf_log notice "Forcefully unmounting $mp"
-
-        #
-        # Not all distributions have lsof.  If not use fuser.  If it
-        # does, try both.
-        #
-        file=$(which lsof 2>/dev/null)
-        if [ -f "$file" ]; then
-                have_lsof=$YES
-        fi
-
-        file=$(which fuser 2>/dev/null)
-        if [ -f "$file" ]; then
-                have_fuser=$YES
-        fi
-
-        if [ -z "$have_lsof" -a -z "$have_fuser" ]; then
-                ocf_log warn \
-        "Cannot forcefully unmount $mp; cannot find lsof or fuser commands"
-                return $FAIL
-        fi
-
-        for try in 1 2 3; do
-                if [ -n "$have_lsof" ]; then
-                        #
-                        # Use lsof to free up mount point
-                        #
-                        while read command pid user
-                        do
-                                if [ -z "$pid" ]; then
-                                        continue
-                                fi
-
-                                if [ $try -eq 1 ]; then
-                                        ocf_log warn \
-                                  "killing process $pid ($user $command $mp)"
-                                elif [ $try -eq 3 ]; then
-                                        ocf_log crit \
-                                  "Could not clean up mountpoint $mp"
-                                ret=$FAIL
-                                fi
-
-                                if [ $try -gt 1 ]; then
-                                        kill -9 $pid
-                                else
-                                        kill -TERM $pid
-                                fi
-                        done < <(lsof -w -bn 2>/dev/null | \
-                            grep -w -E "$mp(/.*|)\$" | \
-                            awk '{print $1,$2,$3}' | \
-                            sort -u -k 1,3)
-                elif [ -n "$have_fuser" ]; then
-                        #
-                        # Use fuser to free up mount point
-                        #
-                        while read command pid user
-                        do
-                                if [ -z "$pid" ]; then
-                                        continue
-                                fi
-
-                                if [ $try -eq 1 ]; then
-                                        ocf_log warn \
-                                  "killing process $pid ($user $command $mp)"
-                                elif [ $try -eq 3 ]; then
-                                        ocf_log crit \
-                                    "Could not clean up mount point $mp"
-                                        ret=$FAIL
-                                fi
-
-                                if [ $try -gt 1 ]; then
-                                        kill -9 $pid
-                                else
-                                        kill -TERM $pid
-                                fi
-			done < <(fuser -vm $mp 2>&1 | \
-                            grep -v PID | \
-			    sed 's;^'$mp:';;' | \
-                            awk '{print $4,$2,$1}' | \
-                            sort -u -k 1,3)
-                fi
-        done
-
-        return $ret
-}
-
-#
-# startNFSFilesystem
-#
-startNFSFilesystem() {
-	typeset -i ret_val=$SUCCESS
-	typeset mp=""			# mount point
-	typeset host=""
-	typeset fullpath=""
-	typeset exp=""
-	typeset opts=""
-	typeset mount_options=""
-
-	#
-	# Get the mount point, if it exists.  If not, no need to continue.
-	#
-	mp=${OCF_RESKEY_mountpoint}
-	case "$mp" in 
-      	""|"[ 	]*")		# nothing to mount
-    		return $SUCCESS
-    		;;
-	/*)			# found it
-	  	;;
-	*)	 		# invalid format
-			ocf_log err \
-"startFilesystem: Invalid mount point format (must begin with a '/'): \'$mp\'"
-	    	return $FAIL
-	    	;;
-	esac
-	#
-	# Get the device
-	#
-	host=${OCF_RESKEY_host}
-	exp=${OCF_RESKEY_export}
-
-	fullpath=$host:$exp
-
-	#
-	# Ensure we've got a valid directory
-	#
-	if [ -e "$mp" ]; then
-		if ! [ -d "$mp" ]; then
-			ocf_log err "\
-startFilesystem: Mount point $mp exists but is not a directory"
-			return $FAIL
-		fi
-	else
-		ocf_log info "\
-startFilesystem: Creating mount point $mp for $fullpath"
-		mkdir -p $mp
-	fi
-
-	#
-	# See if the mount path is already mounted.
-	# 
-	isMounted $fullpath $mp
-	case $? in
-	$YES)		# already mounted
-		ocf_log debug "$fullpath already mounted on $mp"
-		return $SUCCESS
-		;;
-	$NO)		# not mounted, continue
-		;;
-	$FAIL)
-		return $FAIL
-		;;
-	esac
-
-	#
-	# Get the mount options, if they exist.
-	#
-	mount_options=""
-	opts=${OCF_RESKEY_options}
-	case "$opts" in 
-	""|"[ 	]*")
-		opts=""
-		;;
-	*)	# found it
-		mount_options="-o $opts"
-		;;
-	esac
-
-	#
-	# Mount the NFS export
-	#
-	ocf_log debug "mount $fstype_option $mount_options $fullpath $mp"
-
-        case $OCF_RESKEY_fstype in
-		nfs|nfs4)
-			mount -t $OCF_RESKEY_fstype $mount_options $host:$exp $mp
-			;;
-		cifs)
-			mount -t $OCF_RESKEY_fstype $mount_options //$host/$exp $mp
-			;;
-	esac
-
-	ret_val=$?
-	if [ $ret_val -ne 0 ]; then
-		ocf_log err "\
-'mount $fstype_option $mount_options $fullpath $mp' failed, error=$ret_val"
-		return $FAIL
-	fi
-	
-	return $SUCCESS
-}
-
-
-#
-# stopFilesystem serviceID deviceID
-#
-# Run the stop actions
-#
-stopNFSFilesystem() {
-	typeset -i ret_val=0
-	typeset -i try=1
-	typeset -i max_tries=3		# how many times to try umount
-	typeset -i sleep_time=2		# time between each umount failure
-	typeset done=""
-	typeset umount_failed=""
-	typeset force_umount=""
-	typeset fstype=""
-
-
-	#
-	# Get the mount point, if it exists.  If not, no need to continue.
-	#
-	mp=${OCF_RESKEY_mountpoint}
-	case "$mp" in 
-      	""|"[ 	]*")		# nothing to mount
-    		return $SUCCESS
-    		;;
-	/*)			# found it
-	  	;;
-	*)	 		# invalid format
-			ocf_log err \
-"stopNFSFilesystem: Invalid mount point format (must begin with a '/'): \'$mp\'"
-	    	return $FAIL
-	    	;;
-	esac
-	
-	#
-	# Get the host/path
-	#
-	fullpath="${OCF_RESKEY_host}:${OCF_RESKEY_export}"
-
-	#
-	# Get the force unmount setting if there is a mount point.
-	#
-	if [ -n "$mp" ]; then
-		case ${OCF_RESKEY_force_unmount} in
-	        $YES_STR)	force_umount="$YES" ;;
-		1)		force_umount="$YES" ;;
-	        *)		force_umount="" ;;
-		esac
-	fi
-
-	#
-	# Unmount
-	#
-        while [ ! "$done" ]; do
-	isMounted $fullpath $mp
-	case $? in
-	$NO)
-		ocf_log debug "$fullpath is not mounted"
-		umount_failed=
-		done=$YES
-		;;
-	$FAIL)
-		return $FAIL
-		;;
-	$YES)
-		sync; sync; sync
-                        ocf_log info "unmounting $mp"
-
-                        umount $mp
-		if  [ $? -eq 0 ]; then
-                                umount_failed=
-                                done=$YES
-                                continue
-		fi
-
-		umount_failed=yes
-
-                        if [ "$force_umount" ]; then
-                                killMountProcesses $mp
-                        fi
-
-                        if [ $try -ge $max_tries ]; then
-                                done=$YES
-                        else
-                                sleep $sleep_time
-                                let try=try+1
-                        fi
-		;;
-	*)
-		return $FAIL
-		;;
-	esac
-
-                if [ $try -ge $max_tries ]; then
-                        done=$YES
-                else
-                        sleep $sleep_time
-                        let try=try+1
-                fi
-        done # while
-	if [ -n "$umount_failed" ]; then
-		ocf_log err "'umount $fullpath' failed ($mp), error=$ret_val"
-
-		return $FAIL
-	fi
-
-	return $SUCCESS
-}
-
-
-populate_defaults()
-{
-	if [ -z "$OCF_RESKEY_fstype" ]; then
-		export OCF_RESKEY_fstype=nfs
-	fi
-
-	if [ -z "$OCF_RESKEY_options" ]; then
-		export OCF_RESKEY_options=sync,soft,noac
-	fi
-}
-
-
-#
-# Main...
-#
-
-populate_defaults
-
-case $1 in
-start)
-	startNFSFilesystem
-	exit $?
-	;;
-stop)
-	stopNFSFilesystem
-	exit $?
-	;;
-status|monitor)
-	isMounted ${OCF_RESKEY_host}:${OCF_RESKEY_export} \
-		${OCF_RESKEY_mountpoint}
-	exit $?
-	;;
-restart)
-	stopNFSFilesystem
-	if [ $? -ne 0 ]; then
-		exit $OCF_ERR_GENERIC
-	fi
-
-	startNFSFilesystem
-	if [ $? -ne 0 ]; then
-		exit $OCF_ERR_GENERIC
-	fi
-
-	exit 0
-	;;
-meta-data)
-	meta_data
-	exit 0
-	;;
-validate-all)
-	verify_all
-	exit $?
-	;;
-*)
-	echo "usage: $0 {start|stop|status|monitor|restart|meta-data|validate-all}"
-	exit $OCF_ERR_UNIMPLEMENTED
-	;;
-esac
-
-exit 0
diff --git a/rgmanager/src/resources/nfsclient.sh b/rgmanager/src/resources/nfsclient.sh
deleted file mode 100644
index a526cca..0000000
--- a/rgmanager/src/resources/nfsclient.sh
+++ /dev/null
@@ -1,445 +0,0 @@
-#!/bin/bash
-
-#
-# NFS Export Client handler agent script
-#
-
-LC_ALL=C
-LANG=C
-PATH=/bin:/sbin:/usr/bin:/usr/sbin
-export LC_ALL LANG PATH
-
-. $(dirname $0)/ocf-shellfuncs
-
-meta_data()
-{
-	cat <<EOT
-<?xml version="1.0" ?>
-<resource-agent version="rgmanager 2.0" name="nfsclient">
-    <version>1.0</version>
-
-    <longdesc lang="en">
-        This defines how a machine or group of machines may access
-        an NFS export on the cluster.  IP addresses, IP wildcards,
-	hostnames, hostname wildcards, and netgroups are supported.
-    </longdesc>
-    <shortdesc lang="en">
-        Defines an NFS client.
-    </shortdesc>
-
-    <parameters>
-        <parameter name="name" unique="1" primary="1">
-            <longdesc lang="en">
-                This is a symbolic name of a client used to reference
-                it in the resource tree.  This is NOT the same thing
-                as the target option.
-            </longdesc>
-            <shortdesc lang="en">
-                Client Name
-            </shortdesc>
-            <content type="string"/>
-        </parameter>
-
-        <parameter name="target" required="1">
-            <longdesc lang="en">
-                This is either a hostname, a wildcard (IP address or
-                hostname based), or a netgroup to which defining a
-                host or hosts to export to.
-            </longdesc>
-            <shortdesc lang="en">
-                Target Hostname, Wildcard, or Netgroup
-            </shortdesc>
-            <content type="string"/>
-        </parameter>
-
-        <parameter name="path" inherit="path">
-            <longdesc lang="en">
-                This is the path to export to the target.  This
-                field is generally left blank, as it inherits the
-                path from the parent export.
-            </longdesc>
-            <shortdesc lang="en">
-                Path to Export
-            </shortdesc>
-            <content type="string"/>
-        </parameter>
-
-        <parameter name="svcname" inherit="service%name">
-            <longdesc lang="en">
-            </longdesc>
-            <shortdesc lang="en">
-            </shortdesc>
-            <content type="string"/>
-        </parameter>
-
-
-        <parameter name="fsid" inherit="fsid">
-            <longdesc lang="en">
-	    	File system ID inherited from the parent nfsexport/
-		clusterfs/fs resource.  Putting fsid in the options
-		field will override this.
-            </longdesc>
-            <shortdesc lang="en">
-	    	File system ID
-            </shortdesc>
-            <content type="string"/>
-        </parameter>
-
-        <parameter name="options">
-            <longdesc lang="en">Defines a list of options for this
-                particular client.  See 'man 5 exports' for a list
-                of available options.
-            </longdesc>
-            <shortdesc lang="en">
-                Export Options
-            </shortdesc>
-            <content type="string"/>
-        </parameter>
-
-        <parameter name="allow_recover">
-            <longdesc lang="en">
-		Allows recovery of this NFS client (default = 1) if it
-		disappears from the export list.  If set to 0, the service
-		will be restarted.  This is useful to help preserve export
-		ordering.
-            </longdesc>
-            <shortdesc lang="en">
-		Allow recovery
-            </shortdesc>
-            <content type="boolean"/>
-        </parameter>
-
-	<parameter name="service_name" inherit="service%name">
-            <longdesc lang="en">
-		Service this NFS export belongs to.  Used for caching
-		exports on a per-service basis.
-            </longdesc>
-            <shortdesc lang="en">
-                Service Name
-            </shortdesc>
-	    <content type="string"/>
-	</parameter>
-
-	<parameter name="use_cache" inherit="service%nfs_client_cache">
-            <longdesc lang="en">
-	   	On systems with large numbers of exports, a performance
-		problem in the exportfs command can cause inordinately long
-		status check times for services with lots of mounted
-		NFS clients.  This occurs because exportfs does DNS queries
-		on all clients in the export list.
-
-		Setting this option to '1' will enable caching of the export
-		list returned from the exportfs command on a per-service
-		basis.  The cache will last for 30 seconds before expiring
-		instead of being generated each time an nfsclient resource
-		is called.
-            </longdesc>
-            <shortdesc lang="en">
-	    	Enable exportfs list caching
-            </shortdesc>
-	    <content type="integer"/>
-	</parameter>
-
-
-    </parameters>
-
-    <actions>
-        <action name="start" timeout="90"/>
-        <action name="stop" timeout="5"/>
-        <action name="recover" timeout="90"/>
-
-	<!-- Checks to see if the export exists in /var/lib/nfs/etab -->
-        <action name="status" timeout="5" interval="1m"/>
-        <action name="monitor" timeout="5" interval="1m"/>
-
-        <action name="meta-data" timeout="5"/>
-        <action name="validate-all" timeout="30"/>
-    </actions>
-
-</resource-agent>
-EOT
-}
-
-
-verify_options()
-{
-	declare o
-	declare -i ret=0
-
-	[ -z "$OCF_RESKEY_options" ] && return 0
-	
-	#
-	# From exports(5)
-	#
-	for o in `echo $OCF_RESKEY_options | sed -e s/,/\ /g`; do
-		case $o in
-		fsid=*)
-			ocf_log debug "Using designated $o instead of fsid=$OCF_RESKEY_fsid"
-			unset OCF_RESKEY_fsid
-			;;
-		secure)
-			;;
-		insecure)
-			;;
-
-		rw)
-			;;
-		ro)
-			;;
-		async)
-			;;
-		sync)
-			;;
-		wdelay)
-			;;
-		no_wdelay)
-			;;
-		hide)
-			;;
-		nohide)
-			;;
-		subtree_check)
-			;;
-		no_subtree_check)
-			;;
-		secure_locks)
-			;;
-		insecure_locks)
-			;;
-		auth_nlm)
-			;;
-		no_auth_nlm)
-			;;
-		mountpoint=*)
-			;;
-		mp=*)
-			;;
-		root_squash)
-			;;
-		no_root_squash)
-			;;
-		all_squash)
-			;;
-		no_all_squash)
-			;;
-		anonuid=*)
-			;;
-		anongid=*)
-			;;
-		*)
-			ocf_log err "Export Option $o invalid"
-			ret=$OCF_ERR_ARGS
-			;;
-		esac
-	done
-
-	return $ret
-}
-
-
-verify_target()
-{
-	# XXX need to add wildcards, hostname, ip, etc.
-	[ -n "$OCF_RESKEY_target" ] && return 0
-	
-	return $OCF_ERR_ARGS
-}
-
-
-verify_path()
-{
-	if [ -z "$OCF_RESKEY_path" ]; then
-		ocf_log err "No export path specified."
-		return $OCF_ERR_ARGS
-	fi
-
-	[ -d "$OCF_RESKEY_path" ] && return 0
-
-	ocf_log err "$OCF_RESKEY_path is not a directory"
-	
-	return $OCF_ERR_ARGS
-}
-
-
-verify_type()
-{
-	[ -z "$OCF_RESKEY_type" ] && return 0
-	[ "$OCF_RESKEY_type" = "nfs" ] && return 0
-
-	ocf_log err "Export type $OCF_RESKEY_type not supported yet"
-	return $OCF_ERR_ARGS
-}
-
-
-verify_all()
-{
-	declare -i ret=0
-
-	verify_type || ret=$OCF_ERR_ARGS
-	verify_options || ret=$OCF_ERR_ARGS
-	verify_target || ret=$OCF_ERR_ARGS
-	verify_path || ret=$OCF_ERR_ARGS
-
-	return $ret
-}
-
-
-case $1 in
-start)
-	declare option_str
-
-	verify_all || exit $OCF_ERR_ARGS
-
-	#
-	# XXX
-	# Bad: Side-effect of verify_options: unset OCF_RESKEY_fsid if
-	# fsid is specified in the options string.
-	#
-	if [ -z "$OCF_RESKEY_options" ] && [ -n "$OCF_RESKEY_fsid" ]; then
-		option_str="fsid=$OCF_RESKEY_fsid"
-	elif [ -n "$OCF_RESKEY_options" ] && [ -z "$OCF_RESKEY_fsid" ]; then
-		option_str="$OCF_RESKEY_options"
-	elif [ -n "$OCF_RESKEY_fsid" ] && [ -n "$OCF_RESKEY_options" ]; then
-		option_str="fsid=$OCF_RESKEY_fsid,$OCF_RESKEY_options"
-	fi
-
-	if [ -z "$option_str" ]; then
-		ocf_log info "Adding export: ${OCF_RESKEY_target}:${OCF_RESKEY_path}"
-		exportfs -i "${OCF_RESKEY_target}:${OCF_RESKEY_path}"
-		rv=$?
-	else
-		ocf_log info "Adding export: ${OCF_RESKEY_target}:${OCF_RESKEY_path} ($option_str)"
-		exportfs -i -o $option_str "${OCF_RESKEY_target}:${OCF_RESKEY_path}"
-		rv=$?
-	fi
-	;;
-
-stop)
-	verify_all || exit $OCF_ERR_ARGS
-
-	ocf_log info "Removing export: ${OCF_RESKEY_target}:${OCF_RESKEY_path}"
-	exportfs -u "${OCF_RESKEY_target}:${OCF_RESKEY_path}"
-	rv=$?
-	;;
-
-status|monitor)
-	verify_all || exit $OCF_ERR_ARGS
-
-	if [ "${OCF_RESKEY_target}" = "*" ]; then
-		export OCF_RESKEY_target="\<world\>"
-	fi
-
-	#
-	# Status check fix from Birger Wathne:
-	# * Exports longer than 14 chars have line breaks inserted, which
-	#   broke the way the status check worked.
-	#
-        # Status check fix from Craig Lewis: 
-        # * Exports with RegExp metacharacters need to be escaped. 
-        #   These metacharacters are: * ? . 
-        # 
-	export OCF_RESKEY_target_regexp=$(echo $OCF_RESKEY_target | \
-		sed -e 's/*/[*]/g' -e 's/?/[?]/g' -e 's/\./\\./g') 
-
-	declare tmpfn
-	declare time_created time_now
-	declare -i delta=0
-
-	#
-	# Don't let anyone read the cache files.
-	#
-	umask 066
-
-	mkdir -p /var/cache/cluster
-
-	if [ -n "$OCF_RESKEY_service_name" ] && [ "$OCF_RESKEY_use_cache" = "1" ]; then
-
-		#
-		# For large #s of exports, we need to cache the information
-		#
-		tmpfn=/var/cache/cluster/nfsclient-status-cache-$OCF_RESKEY_service_name
-
-		if [ -f "$tmpfn" ]; then
-			time_created=$(stat -c "%Y" $tmpfn)
-			time_now=$(date +"%s")
-			delta=$((time_now-time_created))
-		fi
-		#echo "Cache age = $delta seconds"
-	else
-		delta=100
-		#
-		# Create a different file if this is a separate instance
-		#
-		tmpfn=/var/cache/cluster/nfsclient-status-cache-$$
-	fi
-
-	if ! [ -f "$tmpfn" ] || [ $delta -gt 30 ]; then
-		#echo "Create $tmpfn. Nonexistent / expired / no service name"
-		exportfs -v > $tmpfn
-	fi
-
-        cat $tmpfn | tr -d "\n" | sed -e 's/([^)]*)/\n/g' | grep -iq \
-		"^${OCF_RESKEY_path}[\t ]*.*${OCF_RESKEY_target_regexp}" 
-	rv=$? 
-
-	if [ $rv -eq 0 ]; then
-		[ -z "$OCF_RESKEY_service_name" ] && rm -f $tmpfn
-		exit 0
-	fi
-
-	declare OCF_RESKEY_target_tmp=$(clufindhostname -i "$OCF_RESKEY_target")
-	if [ $? -ne 0 ]; then
-		[ -z "$OCF_RESKEY_service_name" ] && rm -f $tmpfn
-		ocf_log err "nfsclient:$OCF_RESKEY_name is missing!"
-		exit 1
-	fi
-
-        cat $tmpfn | tr -d "\n" | sed -e 's/([^)]*)/\n/g' | grep -q \
-		"^${OCF_RESKEY_path}[\t ]*.*${OCF_RESKEY_target_tmp}" 
-	rv=$? 
-
-	[ -z "$OCF_RESKEY_service_name" ] && rm -f $tmpfn
-	if [ $rv -eq 0 ]; then
-		exit 0
-	fi
-
-	ocf_log err "nfsclient:$OCF_RESKEY_name is missing!"
-	exit 1
-	;;
-
-recover)
-	if [ "$OCF_RESKEY_allow_recover" = "0" ] || \
-	   [ "$OCF_RESKEY_allow_recover" = "no" ] || \
-	   [ "$OCF_RESKEY_allow_recover" = "false" ]; then
-		exit 1
-	fi
-
-	$0 stop || exit 1
-	$0 start || exit 1
-	;;
-
-restart)
-	#
-	# Recover might better be "exportfs -r" - reexport
-	#
-	$0 stop || exit 1
-	$0 start || exit 1
-	;;
-
-meta-data)
-	meta_data
-	exit 0
-	;;
-
-validate-all)
-	verify_all
-	rv=$?
-	;;
-
-*)
-	echo "usage: $0 {start|stop|status|monitor|restart|meta-data|validate-all}"
-	rv=$OCF_ERR_UNIMPLEMENTED
-	;;
-esac
-
-exit $rv
diff --git a/rgmanager/src/resources/nfsexport.sh b/rgmanager/src/resources/nfsexport.sh
deleted file mode 100644
index cd5bfdf..0000000
--- a/rgmanager/src/resources/nfsexport.sh
+++ /dev/null
@@ -1,245 +0,0 @@
-#!/bin/bash
-
-#
-# NFS Export Script.  Handles starting/stopping clurmtabd and doing
-# the strange NFS stuff to get it to fail over properly.
-#
-
-LC_ALL=C
-LANG=C
-PATH=/bin:/sbin:/usr/bin:/usr/sbin
-export LC_ALL LANG PATH
-
-. $(dirname $0)/ocf-shellfuncs
-
-
-rmtabpid=""
-nfsop_arg=""
-rv=0
-
-meta_data()
-{
-	cat <<EOT
-<?xml version="1.0" ?>
-<resource-agent name="nfsexport" version="rgmanager 2.0">
-    <version>1.0</version>
-
-    <longdesc lang="en">
-        This defines an NFS export path.  Generally, these are
-        defined inline and implicitly; you should not have to 
-        configure one of these.  All of the relevant information
-        is inherited from the parent.
-    </longdesc>
-
-    <shortdesc lang="en">
-        This defines an NFS export.
-    </shortdesc>
-
-    <parameters>
-        <parameter name="name" primary="1">
-            <longdesc lang="en">
-                Descriptive name for this export.  Generally, only
-                one export is ever defined, and it's called "generic
-                nfs export".
-            </longdesc>
-            <shortdesc lang="en">
-                Name
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="device" inherit="device">
-            <longdesc lang="en">
-                If you can see this, your GUI is broken.
-            </longdesc>
-            <shortdesc lang="en">
-                If you can see this, your GUI is broken.
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="path" inherit="mountpoint">
-            <longdesc lang="en">
-                If you can see this, your GUI is broken.
-            </longdesc>
-            <shortdesc lang="en">
-                If you can see this, your GUI is broken.
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="fsid" inherit="fsid">
-            <longdesc lang="en">
-                If you can see this, your GUI is broken.
-            </longdesc>
-            <shortdesc lang="en">
-                If you can see this, your GUI is broken.
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-    </parameters>
-
-    <actions>
-        <action name="start" timeout="5"/>
-	<action name="stop" timeout="5"/>
-	<action name="recover" timeout="5"/>
-
-	<!-- NFS Exports really don't do anything except provide a path
-	     for nfs clients.  So, status and monitor are no-ops -->
-	<action name="status" timeout="5" interval="1h"/>
-	<action name="monitor" timeout="5" interval="1h"/>
-
-	<action name="meta-data" timeout="5"/>
-	<action name="validate-all" timeout="30"/>
-    </actions>
-
-    <special tag="rgmanager">
-	<child type="nfsexport" forbid="1"/>
-	<child type="nfsclient"/>
-    </special>
-
-</resource-agent>
-EOT
-}
-
-
-verify_device()
-{
-	if [ -z "$OCF_RESKEY_device" ]; then
-	       ocf_log err "No device or label specified."
-	       return $OCF_ERR_ARGS
-	fi
-
-	[ -b "$OCF_RESKEY_device" ] && return 0
-	[ -b "`findfs $OCF_RESKEY_device`" ] && return 0
-
-	ocf_log err "Device or label \"$OCF_RESKEY_device\" not valid"
-
-	return $OCF_ERR_ARGS
-}
-
-
-verify_path()
-{
-	if [ -z "$OCF_RESKEY_path" ]; then
-		ocf_log err "No export path specified."
-		return $OCF_ERR_ARGS
-	fi
-
-	[ -d "$OCF_RESKEY_path" ] && return 0
-
-	ocf_log err "$OCF_RESKEY_path is not a directory"
-	
-	return $OCF_ERR_ARGS
-}
-
-
-verify_all()
-{
-	declare -i ret=0
-
-	verify_device || ret=$OCF_ERR_ARGS
-	verify_path || ret=$OCF_ERR_ARGS
-
-	return $ret
-}
-
-
-#
-# Check if the NFS daemons are running.
-#
-nfs_daemons_running()
-{
-    declare NFS_DAEMONS="nfsd rpc.mountd rpc.statd"
-
-    for daemon in $NFS_DAEMONS; do
-        ps -ef | grep "$daemon" | grep -v grep >/dev/null 2>&1
-        if [ $? -ne 0 ]; then
-	    ocf_log err \
-            "NFS daemon $daemon is not running."
-	    ocf_log err \
-            "Verify that the NFS service run level script is enabled."
-            return 1
-        fi
-    done
-
-    return 0
-}
-
-
-nfs_check()
-{
-	declare junk
-
-	if nfs_daemons_running; then
-		return 0
-	fi
-
-	#
-	# Don't restart daemons during status check.
-	#
-	if [ "$1" = "status" ]; then
-		return 1;
-	fi
-		
-  	ocf_log err "Restarting NFS daemons"
-	# Note restart does less than stop/start
-	junk=$(/sbin/service nfslock stop)
-	junk=$(/sbin/service nfslock start)
-	junk=$(/sbin/service nfs stop)
-	junk=$(/sbin/service nfs start)
-	sleep 2
-	
-	if ! nfs_daemons_running; then
-		ocf_log err "Failed restarting NFS daemons"
-    		return 1
-	fi
-	ocf_log notice "Successfully restarted NFS daemons"
-}
-
-
-case $1 in
-start)
-	nfs_check start || exit 1
-	rv=0
-	;;
-
-status|monitor)
-	nfs_check status || exit 1
-	rv=0
-	;;
-		    
-stop)
-	nfs_check restart || exit 1
-	rv=0
-	;;
-
-recover|restart)
-	$0 stop || exit $OCF_ERR_GENERIC
-	$0 start || exit $OCF_ERR_GENERIC
-	rv=0
-	;;
-
-meta-data)
-	meta_data
-	rv=0
-	;;
-
-validate-all)
-	verify_all
-	rv=$?
-	;;
-*)
-	echo "usage: $0 {start|status|monitor|stop|recover|restart|meta-data|validate-all}"
-	exit $OCF_ERR_UNIMPLEMENTED
-	;;
-esac
-
-#
-# Flush NFS request queue.  This might be done in the ip resource in the
-# future, but keep this around for now.
-#
-# clunfsops $nfsop_arg -d ${OCF_RESKEY_device}
-#
-
-exit $rv
diff --git a/rgmanager/src/resources/nfsserver.sh b/rgmanager/src/resources/nfsserver.sh
deleted file mode 100644
index 6df0c1a..0000000
--- a/rgmanager/src/resources/nfsserver.sh
+++ /dev/null
@@ -1,409 +0,0 @@
-#!/bin/bash
-
-#
-# NFS Server Script.  Handles starting/stopping Servand doing
-# the strange NFS stuff to get it to fail over properly.
-#
-
-LC_ALL=C
-LANG=C
-PATH=/bin:/sbin:/usr/bin:/usr/sbin
-export LC_ALL LANG PATH
-
-. $(dirname $0)/ocf-shellfuncs
-
-log_do()
-{
-	ocf_log debug $*
-	$* &> /dev/null
-	ret=$?
-	if [ $ret -ne 0 ]; then
-		ocf_log debug "Failed: $*"
-	fi
-	return $ret
-}
-
-
-meta_data()
-{
-	cat <<EOT
-<?xml version="1.0" ?>
-<resource-agent name="nfsserver" version="rgmanager 2.0">
-    <version>1.0</version>
-
-    <longdesc lang="en">
-        This defines an NFS server. 
-    </longdesc>
-
-    <shortdesc lang="en">
-        This defines an NFS server.
-    </shortdesc>
-
-    <parameters>
-        <parameter name="name" primary="1">
-            <longdesc lang="en">
-                Descriptive name for this server.  Generally, only
-                one serveris ever defined.
-            </longdesc>
-            <shortdesc lang="en">
-                Name
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="path" inherit="mountpoint">
-            <longdesc lang="en">
-	        This is the path you intend to export.  Usually, this is
-		left blank, and the mountpoint of the parent file system
-		is used.
-            </longdesc>
-            <shortdesc lang="en">
-	    	This is the path you intend to export.
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="nfspath">
-            <longdesc lang="en">
-	        This is the path containing shared NFS information.  This
-		is relative to the export path.
-            </longdesc>
-            <shortdesc lang="en">
-	        This is the path containing shared NFS information.
-            </shortdesc>
-	    <content type="string" default=".clumanager/nfs"/>
-        </parameter>
-
-    </parameters>
-
-    <actions>
-        <action name="start" timeout="5"/>
-	<action name="stop" timeout="5"/>
-	<action name="recover" timeout="5"/>
-
-	<action name="status" timeout="5" interval="30"/>
-	<action name="monitor" timeout="5" interval="30"/>
-
-	<action name="meta-data" timeout="5"/>
-	<action name="validate-all" timeout="30"/>
-    </actions>
-
-    <special tag="rgmanager">
-    	<attributes maxinstances="1"/>
-	<child type="nfsexport" forbid="1"/>
-	<child type="nfsserver" forbid="1"/>
-	<child type="nfsclient" start="1" stop="2"/>
-	<child type="ip" start="2" stop="1"/>
-    </special>
-
-</resource-agent>
-EOT
-}
-
-
-verify_path()
-{
-	if [ -z "$OCF_RESKEY_path" ]; then
-		ocf_log err "No server path specified."
-		return $OCF_ERR_ARGS
-	fi
-
-	[ -d "$OCF_RESKEY_path" ] && return 0
-
-	ocf_log err "$OCF_RESKEY_path is not a directory"
-	
-	return $OCF_ERR_ARGS
-}
-
-
-verify_nfspath()
-{
-	if [ -z "$OCF_RESKEY_nfspath" ]; then
-		echo No NFS data path specified.
-		return 1
-	fi
-
-	[ -d "$OCF_RESKEY_path" ] && return 0
-	
-	# xxx do nothing for now.
-	return 0
-}
-
-
-verify_all()
-{
-	verify_path || return 1
-	verify_nfspath || return 1
-
-	return 0
-}
-
-
-nfs_daemons()
-{
-	declare oper
-	case $1 in
-	start)
-		ocf_log info "Starting NFS daemons"
-		/etc/init.d/nfs start
-		if [ $? -ne 0 ]; then
-			ocf_log err "Failed to start NFS daemons"
-			return 1
-		fi
-
-		ocf_log debug "NFS daemons are running"
-		return 0
-		;;
-	stop)
-		ocf_log info "Stopping NFS daemons"
-		if ! /etc/init.d/nfs stop; then
-			ocf_log err "Failed to stop NFS daemons"
-			return 1
-		fi
-
-		ocf_log debug "NFS daemons are stopped"
-		return 0
-		;;
-	status|monitor)
-		/etc/init.d/nfs status
-		if [ $? -eq 0 ]; then
-			ocf_log debug "NFS daemons are running"
-			return 0
-		fi
-		return 1
-		;;
-	esac
-}
-
-
-create_tree()
-{
-	declare fp="$OCF_RESKEY_path/$OCF_RESKEY_nfspath"
-
-	[ -d "$fp" ] || mkdir -p $fp
-	#
-	# is this really needed?
-	#
-	#[ -d "$fp/rpc_pipefs" ] || mkdir -p $fp/rpc_pipefs
-
-	[ -d "$fp/statd" ] || mkdir -p $fp/statd
-
-	#
-	# Create our own private copy which we use for notifies.
-	# This way, we can be sure to advertise on possibly multiple
-	# IP addresses.
-	#
-	[ -d "$fp/statd/sm-ha" ] || mkdir -p $fp/statd/sm-ha
-
-	# Create if they don't exist
-	[ -f "$fp/etab" ] || touch $fp/etab
-	[ -f "$fp/xtab" ] || touch $fp/xtab
-	[ -f "$fp/rmtab" ] || touch $fp/rmtab
-	[ -f "$fp/state" ] || touch $fp/state
-}
-
-
-is_bound()
-{
-	mount | grep -q "$1 on $2 type none (.*bind)"
-	return $?
-}
-
-
-mount_tree()
-{
-	declare fp="$OCF_RESKEY_path/$OCF_RESKEY_nfspath"
-
-	# what about /var/lib/nfs/rpc_pipefs ?  sunrpc mount?
-	# is that really needed?
-
-	if is_bound $fp /var/lib/nfs; then
-		ocf_log debug "$fp is already bound to /var/lib/nfs"
-		return 0
-	fi
-
-	log_do mount -o bind $fp /var/lib/nfs
-}
-
-
-umount_tree()
-{
-	declare fp="$OCF_RESKEY_path/$OCF_RESKEY_nfspath"
-
-	if is_bound $fp /var/lib/nfs; then
-		log_do umount /var/lib/nfs
-		return $?
-	fi
-
-	ocf_log debug "$fp is not bound to /var/lib/nfs"
-	return 0
-}
-
-start_locking()
-{
-	declare ret
-	[ -x /sbin/rpc.statd ] || return 1
-	
-	#
-	# Synchronize these before starting statd
-	#
-	cp -f /var/lib/nfs/statd/sm-ha/* /var/lib/nfs/statd/sm/* 2> /dev/null
-	cp -f /var/lib/nfs/statd/sm/* /var/lib/nfs/statd/sm-ha/* 2> /dev/null
-
-	if pidof rpc.statd &> /dev/null; then
-		ocf_log debug "rpc.statd is already running"
-		return 0
-	fi
-
-	#
-	# Set this resrouce script as the callout program.  We are evil.
-	# In cases where we want to preserve lock information, this is needed
-	# because we can't do the "copy" that we do on the down-state...
-	#
-	ocf_log info "Starting rpc.statd"
-	rpc.statd -H $0 -Fd &
-	ret=$?
-	if [ $ret -ne 0 ]; then
-		ocf_log err "Failed to start rpc.statd"
-		return $ret
-	fi
-	touch /var/lock/subsys/nfslock
-	return $ret
-}
-
-
-terminate()
-{
-	declare pids
-	declare i=0
-
-	while : ; do
-		pids=$(pidof $1)
-		[ -z "$pids" ] && return 0
-	 	kill $pids
-		sleep 1
-		((i++))
-		[ $i -gt 3 ] && return 1
-	done
-}
-
-
-killkill()
-{
-	declare pids
-	declare i=0
-
-	while : ; do
-		pids=$(pidof $1)
-		[ -z "$pids" ] && return 0
-	 	kill -9 $pids
-		sleep 1
-		((i++))
-		[ $i -gt 3 ] && return 1
-	done
-}
-
-
-stop_locking()
-{
-	declare ret 
-
-	# Rip from nfslock
-	ocf_log info "Stopping NFS lockd"
-	if killkill lockd; then
-		ocf_log debug "NFS lockd is stopped"
-	else
-		ocf_log err "Failed to stop NFS lockd"
-	 	return 1
-	fi
-	
-	ocf_log info "Stopping rpc.statd"
-	if terminate rpc.statd; then
-		ocf_log debug "rpc.statd is stopped"
-	else
-		if killkill rpc.statd; then
-			ocf_log debug "rpc.statd is stopped"
-		else
-			ocf_log debug "Failed to stop rpc.statd"
-			return 1
-		fi
-	fi
-}
-
-
-case $1 in
-start)
-	# Check for and source configuration file
-	ocf_log info "Starting NFS Server $OCF_RESKEY_name"
-	create_tree
-	mount_tree
-
-	start_locking
-	nfs_daemons start
-	if [ $? -eq 0 ]; then
-		ocf_log info "Started NFS Server $OCF_RESKEY_name"
-		exit 0
-	fi
-
-	ocf_log err "Failed to start NFS Server $OCF_RESKEY_name"
-	exit $?
-	;;
-
-status|monitor)
-	nfs_daemons status 
-	exit $?
-	;;
-		    
-stop)
-	if ! nfs_daemons stop; then
-		ocf_log err "Failed to stop NFS Server $OCF_RESKEY_name"
-		exit $OCF_ERR_GENERIC
-	fi
-
-	# Copy the current notify list into our private area
-	ocf_log debug "Copying sm files for future notification..."
-	rm -f /var/lib/nfs/statd/sm-ha/* &> /dev/null
-	cp -f /var/lib/nfs/statd/sm/* /var/lib/nfs/statd/sm-ha &> /dev/null
-
-	stop_locking
-	umount_tree
-	# todo - error check here?
-	exit 0
-	;;
-
-add-client)
-	ocf_log debug "$0 $1 $2 $3"
-	touch /var/lib/nfs/statd/sm/$2
-	touch /var/lib/nfs/statd/sm-ha/$2
-	exit 0
-	;;
-
-del-client)
-	ocf_log debug "$0 $1 $2 $3"
-	touch /var/lib/nfs/statd/sm/$2
-	rm -f /var/lib/nfs/statd/sm-ha/$2
-	exit 0
-	;;
-
-recover|restart)
-	$0 stop || exit $OCF_ERR_GENERIC
-	$0 start || exit $OCF_ERR_GENERIC
-	exit 0
-	;;
-
-meta-data)
-	meta_data
-	exit 0
-	;;
-
-validate-all)
-	verify_all
-	exit $?
-	;;
-*)
-	echo "usage: $0 {start|stop|status|monitor|restart|recover|add-client|del-client|meta-data|validate-all}"
-	exit $OCF_ERR_UNIMPLEMENTED
-	;;
-esac
-
-exit 0
diff --git a/rgmanager/src/resources/ocf-shellfuncs b/rgmanager/src/resources/ocf-shellfuncs
deleted file mode 100644
index f8226cb..0000000
--- a/rgmanager/src/resources/ocf-shellfuncs
+++ /dev/null
@@ -1,165 +0,0 @@
-#! /bin/bash
-#
-# 	$Id$
-#
-# 	Common helper functions for the OCF Resource Agents supplied by
-# 	heartbeat.
-
-
-# TODO: Some of this should probably split out into a generic OCF
-# library for shell scripts, but for the time being, we'll just use it
-# ourselves...
-#
-
-# TODO wish-list:
-# - Generic function for evaluating version numbers
-# - Generic function(s) to extract stuff from our own meta-data
-# - Logging function which automatically adds resource identifier etc
-#   prefixes
-# TODO: Move more common functionality for OCF RAs here.
-#
-__SCRIPT_NAME=`basename $0`
-
-# lhh - determine if we're a dumb terminal
-consoletype &> /dev/null
-if [ $? -eq 1 ]; then
-	__SERIAL="yes"
-fi
-
-__LOG_PID=$PPID
-__LOG_NAME=$(basename $(readlink /proc/$PPID/exe))
-
-pretty_echo() {
-	declare pretty
-	declare n=""
-        declare __OCF_PRIO="$1"
-        shift
-        declare __OCF_MSG="$*"
-
-	if [ -n "$__SERIAL" ]; then
-		echo "<$__OCF_PRIO> $__OCF_MSG"
-		return 0
-	fi
-
-	case $__OCF_PRIO in
-	emerg)		pretty="";;
-	alert)		pretty="";;
-        crit|critical)	pretty="";;
-        err|error)	pretty="";;
-        warn|warning)	pretty="";;
-	note|notice)	pretty="";;
-        info)		pretty="";;
-        debug|dbg)	pretty="";;
-        *)		pretty="";;
-	esac
-
-	echo "$n<$pretty$__OCF_PRIO$n> $__OCF_MSG"
-	return 0
-}
-
-__ocf_set_defaults() {
-	__OCF_ACTION="$1"
-
-	# Return to sanity for the agents...
-	unset LANG
-	LC_ALL=C
-	export LC_ALL
-
-	# TODO: Review whether we really should source this. Or rewrite
-	# to match some emerging helper function syntax...? This imports
-	# things which no OCF RA should be using...
-
-	OCF_SUCCESS=0
-	OCF_ERR_GENERIC=1
-	OCF_ERR_ARGS=2
-	OCF_ERR_UNIMPLEMENTED=3
-	OCF_ERR_PERM=4
-	OCF_ERR_INSTALLED=5
-	OCF_ERR_CONFIGURED=6
-	OCF_NOT_RUNNING=7
-
-	if [ -z "$OCF_RESOURCE_TYPE" ]; then
-		: ${OCF_RESOURCE_TYPE:=$__SCRIPT_NAME}
-	fi
-
-	if [ -z "$OCF_RA_VERSION_MAJOR" ]; then
-		: We are being invoked as an init script.
-		: Fill in some things with reasonable values.
-		: ${OCF_RESOURCE_INSTANCE:="default"}
-		return 0
-        fi
-
-	if [ -z "$OCF_ROOT" ]; then
-		OCF_ROOT=$(dirname $0)
-	fi
-	if [ ! -d "$OCF_ROOT" ]; then
-		ocf_log err "OCF_ROOT points to non-directory $OCF_ROOT."
-		exit $OCF_ERR_GENERIC
-	fi
-
-	# TODO: Anything else we should be setting and thus checking?
-        # There is nothing in this script which depends on the version
-	# of the API.  TESTING THIS HERE IS A BUG.  THIS SHOULD BE
-	# tested by the script that's invoked us.  FIXME!!
-	if [ "x$OCF_RA_VERSION_MAJOR" != "x1" ]; then
-		ocf_log err "This script is OCF RA API 1.x compliant only!"
-		exit $OCF_ERR_UNIMPLEMENTED
-	fi
-	# TODO: Should the minor level really be a number and not rather
-	# a list of flags...?
-        # AlanR says -- absolutely not -- a list of flags is good for a list
-	# of implemented features, not a version compiliance
-	# perhaps some future version might have such a list of
-	# flags, but that would be _in addition to_ the minor version number
-	if [ -z "$OCF_RA_VERSION_MINOR" ]; then
-		ocf_log err "No OCF RA minor version set."
-		exit $OCF_ERR_UNIMPLEMENTED
-	fi
-
-	if [ "x$__OCF_ACTION" = "xmeta-data" ]; then
-		OCF_RESOURCE_INSTANCE="undef"
-	fi	
-
-	if [ -z "$OCF_RESOURCE_INSTANCE" ]; then
-		ocf_log err "Need to tell us our resource instance name."
-		exit $OCF_ERR_ARGS
-	fi
-}
-
-
-ocf_log() {
-	# TODO: Revisit and implement internally.
-	if
-          [ $# -lt 2 ]
-        then
-          ocf_log err "Not enough arguments [$#] to ocf_log."
-        fi
-
-        declare __OCF_PRIO="$1"
-	declare -i __OCF_PRIO_N
-
-        shift
-
-        declare __OCF_MSG="$*"
-
-        case "${__OCF_PRIO}" in
-	emerg)		__OCF_PRIO_N=0;; # Not in original ocf-shellfuncs
-	alert)		__OCF_PRIO_N=1;; # Not in original ocf-shellfuncs
-        crit|critical)	__OCF_PRIO_N=2;;
-        err|error)	__OCF_PRIO_N=3;;
-        warn|warning)	__OCF_PRIO_N=4;;
-	note|notice)	__OCF_PRIO_N=5;; # Not in original ocf-shellfuncs
-        info)		__OCF_PRIO_N=6;;
-        debug|dbg)	__OCF_PRIO_N=7;;
-        *)		__OCF_PRIO_N=5;; # Defaults to INFO
-	esac
-
-	pretty_echo $__OCF_PRIO "$__OCF_MSG"
-
-	if [ -z "`which clulog 2> /dev/null`" ]; then
-		return 0
-	fi
-	clulog -s $__OCF_PRIO_N "$__OCF_MSG"
-}
-
-__ocf_set_defaults "$@"
diff --git a/rgmanager/src/resources/openldap.metadata b/rgmanager/src/resources/openldap.metadata
deleted file mode 100644
index 9bd7193..0000000
--- a/rgmanager/src/resources/openldap.metadata
+++ /dev/null
@@ -1,98 +0,0 @@
-<?xml version="1.0"?>
-<resource-agent version="rgmanager 2.0" name="openldap">
-    <version>1.0</version>
-
-    <longdesc lang="en">
-        This defines an instance of Open LDAP 
-    </longdesc>
-    <shortdesc lang="en">
-        Defines an Open LDAP server
-    </shortdesc>
-
-    <parameters>
-        <parameter name="name" primary="1">
-	    <longdesc lang="en">
-	        Specifies a service name for logging and other purposes
-	    </longdesc>
-            <shortdesc lang="en">
-                Name
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="config_file">
-            <longdesc lang="en">
-                Define absolute path to configuration file
-            </longdesc>
-            <shortdesc lang="en">
-                Config File
-            </shortdesc>
-	    <content type="string" default="/etc/openldap/slapd.conf"/>
-        </parameter>
-
-        <parameter name="url_list">
-            <longdesc lang="en">
-               Serve URL list. Default behaviour of URL list is changed and 
-		enhanced. eg. ldap:/// won't bind all IP address on the
-		computer but to all IP addresses in service. Using
-		ldap://0:port/ will bind to all IP addresses for service on
-		given port.
-            </longdesc>
-            <shortdesc lang="en">
-                URL list
-            </shortdesc>
-	    <content type="string" default="ldap:///"/>
-        </parameter>
-
-	<parameter name="slapd_options">
-		<longdesc lang="en">
-			Other command-line options for slapd
-		</longdesc>
-		<shortdesc lang="en">
-			Other command-line options for slapd
-		</shortdesc>
-		<content type="string" />
-	</parameter>
-
-	<parameter name="shutdown_wait">
-		<longdesc lang="en">
-			Wait X seconds for correct end of service shutdown
-		</longdesc>
-		<shortdesc lang="en">
-			Wait X seconds for correct end of service shutdown
-		</shortdesc>
-		<content type="integer" />
-	</parameter>
-
-        <parameter name="service_name" inherit="service%name">
-            <longdesc lang="en">
-	    	Inherit the service name.  We need to know
-		the service name in order to determine file
-		systems and IPs for this service.
-            </longdesc>
-            <shortdesc lang="en">
-	    	Inherit the service name.
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-    </parameters>
-
-    <actions>
-        <action name="start" timeout="0"/>
-	<action name="stop" timeout="0"/>
-
-	<!-- Checks to see if it''s mounted in the right place -->
-	<action name="status" interval="1m" timeout="10"/>
-	<action name="monitor" interval="1m" timeout="10"/>
-
-	<!-- Checks to see if we can read from the mountpoint -->
-	<action name="status" depth="10" timeout="30" interval="5m"/>
-	<action name="monitor" depth="10" timeout="30" interval="5m"/>
-
-	<action name="meta-data" timeout="0"/>
-	<action name="validate-all" timeout="0"/>
-    </actions>
-
-    <special tag="rgmanager">
-    </special>
-</resource-agent>
diff --git a/rgmanager/src/resources/openldap.sh b/rgmanager/src/resources/openldap.sh
deleted file mode 100644
index 49ff81f..0000000
--- a/rgmanager/src/resources/openldap.sh
+++ /dev/null
@@ -1,209 +0,0 @@
-#!/bin/bash
-
-export LC_ALL=C
-export LANG=C
-export PATH=/bin:/sbin:/usr/bin:/usr/sbin
-
-. $(dirname $0)/ocf-shellfuncs
-. $(dirname $0)/utils/config-utils.sh
-. $(dirname $0)/utils/messages.sh
-. $(dirname $0)/utils/ra-skelet.sh
-
-declare LDAP_SLAPD=/usr/sbin/slapd
-declare LDAP_pid_file="`generate_name_for_pid_file`"
-declare LDAP_conf_dir="`generate_name_for_conf_dir`"
-declare LDAP_gen_config_file="$LDAP_conf_dir/slapd.conf"
-declare LDAP_url_list
-
-verify_all()
-{
-	clog_service_verify $CLOG_INIT
-
-	if [ -z "$OCF_RESKEY_name" ]; then
-		clog_service_verify $CLOG_FAILED "Invalid Name Of Service"
-		return $OCF_ERR_ARGS
-	fi
-
-	if [ -z "$OCF_RESKEY_service_name" ]; then
-		clog_service_verify $CLOG_FAILED_NOT_CHILD
-		return $OCF_ERR_ARGS
-	fi
-
-	if [ -z "$OCF_RESKEY_config_file" ]; then
-		clog_check_file_exist $CLOG_FAILED_INVALID "$OCF_RESKEY_config_file"
-		clog_service_verify $CLOG_FAILED
-		return $OCF_ERR_ARGS
-	fi
-
-	if [ ! -r "$OCF_RESKEY_config_file" ]; then
-		clog_check_file_exist $CLOG_FAILED_NOT_READABLE $OCF_RESKEY_config_file
-		clog_service_verify $CLOG_FAILED
-		return $OCF_ERR_ARGS
-	fi
-
-	clog_service_verify $CLOG_SUCCEED
-		
-	return 0
-}
-
-generate_url_list()
-{
-	declare ldap_url_source=$1
-	declare ip_addresses=$2
-	declare url_list
-	declare tmp;
-	
-	for u in $ldap_url_source; do 
-		if [[ "$u" =~ ':///' ]]; then
-			for z in $ip_addresses; do
-				tmp=`echo $u | sed "s,://,://$z,"`
-				url_list="$url_list $tmp"
-			done
-		elif [[ "$u" =~ '://0:' ]]; then
-			for z in $ip_addresses; do
-				tmp=`echo $u | sed "s,://0:,://$z:,"`
-				url_list="$url_list $tmp"
-			done
-		else
-			url_list="$url_list $u"
-		fi
-	done
-	
-	echo $url_list
-}
-
-generate_config_file()
-{
-	declare original_file="$1"
-	declare generated_file="$2"
-
-	if [ -f "$generated_file" ]; then
-		sha1_verify "$generated_file"
-		if [ $? -ne 0 ]; then
-			clog_check_sha1 $CLOG_FAILED
-			return 0
-		fi
-	fi	
-
-	clog_generate_config $CLOG_INIT "$original_file" "$generated_file"
-
-	generate_configTemplate "$generated_file" "$1"
-	echo "pidfile \"$LDAP_pid_file\"" >> $generated_file
-	echo >> $generated_file	
-	sed 's/^[[:space:]]*pidfile/### pidfile/i' < "$original_file" >> "$generated_file"
-	
-        sha1_addToFile "$generated_file"
-	clog_generate_config $CLOG_SUCCEED "$original_file" "$generated_file"
-               
-	return 0;
-}
-
-start()
-{
-	clog_service_start $CLOG_INIT
-
-	create_pid_directory
-	create_conf_directory "$LDAP_conf_dir"
-	check_pid_file "$LDAP_pid_file"
-
-	if [ $? -ne 0 ]; then
-		clog_check_pid $CLOG_FAILED "$LDAP_pid_file"
-		clog_service_start $CLOG_FAILED
-		return $OCF_ERR_GENERIC
-	fi
-	clog_looking_for $CLOG_INIT "IP Addresses"
-
-        get_service_ip_keys "$OCF_RESKEY_service_name"
-        ip_addresses=`build_ip_list`
-
-	if [ -z "$ip_addresses" ]; then
-		clog_looking_for $CLOG_FAILED_NOT_FOUND "IP Addresses"
-		return $OCF_ERR_GENERIC
-	fi
-	
-	clog_looking_for $CLOG_SUCCEED "IP Addresses"
-
-	LDAP_url_list=`generate_url_list "$OCF_RESKEY_url_list" "$ip_addresses"`
-
-	if [ -z "$LDAP_url_list" ]; then
-		ocf_log error "Generating URL List for $OCF_RESOURCE_INSTANCE > Failed"
-		return $OCF_ERR_GENERIC
-	fi
-
-	generate_config_file "$OCF_RESKEY_config_file" "$LDAP_gen_config_file"
-
-	$LDAP_SLAPD -f "$LDAP_gen_config_file" -n "$OCF_RESOURCE_INSTANCE" \
-		-h "$LDAP_url_list" $OCF_RESKEY_slapd_options
-
-	if [ $? -ne 0 ]; then
-		clog_service_start $CLOG_FAILED
-		return $OCF_ERR_GENERIC
-	fi
-
-	clog_service_start $CLOG_SUCCEED
-
-	return 0;
-}
-
-stop()
-{
-	clog_service_stop $CLOG_INIT
-
-	stop_generic "$LDAP_pid_file" "$OCF_RESKEY_shutdown_wait"
-	
-	if [ $? -ne 0 ]; then
-		clog_service_stop $CLOG_FAILED
-		return $OCF_ERR_GENERIC
-	fi
-	
-	clog_service_stop $CLOG_SUCCEED
-	return 0;
-}
-
-status()
-{
-	clog_service_status $CLOG_INIT
-
-	status_check_pid "$LDAP_pid_file"
-	if [ $? -ne 0 ]; then
-		clog_service_status $CLOG_FAILED "$LDAP_pid_file"
-		return $OCF_ERR_GENERIC
-	fi
-
-	clog_service_status $CLOG_SUCCEED
-	return 0
-}
-
-case $1 in
-	meta-data)
-		cat `echo $0 | sed 's/^\(.*\)\.sh$/\1.metadata/'`
-		exit 0
-		;;
-	validate-all)
-		verify_all
-		exit $?
-		;;
-	start)
-		verify_all && start
-		exit $?
-		;;
-	stop)
-		verify_all && stop
-		exit $?
-		;;
-	status|monitor)
-		verify_all
-		status
-		exit $?
-		;;
-	restart)
-		verify_all
-		stop
-		start
-		exit $?
-		;;
-	*)
-		echo "Usage: $0 {start|stop|status|monitor|restart|meta-data|validate-all}"
-		exit $OCF_ERR_UNIMPLEMENTED
-		;;
-esac
diff --git a/rgmanager/src/resources/oracledb.sh.in b/rgmanager/src/resources/oracledb.sh.in
deleted file mode 100644
index 4041a34..0000000
--- a/rgmanager/src/resources/oracledb.sh.in
+++ /dev/null
@@ -1,888 +0,0 @@
-#!/bin/bash
-# Author(s):
-#     Hardy Merrill <hmerrill at redhat.com>
-#     Lon Hohberger <lhh at redhat.com>
-#     Michael Moon <Michael dot Moon at oracle.com>
-#
-# chkconfig: 345 99 01
-# description: Service script for starting/stopping      \
-#	       Oracle(R) Database 10g on                 \
-#		        Red Hat Enterprise Linux 5
-#
-# NOTES:
-#
-# (1) You can comment out the LOCKFILE declaration below.  This will prevent
-# the need for this script to access anything outside of the ORACLE_HOME 
-# path.
-#
-# (2) You MUST customize ORACLE_USER, ORACLE_HOME, ORACLE_SID, and
-# ORACLE_HOSTNAME to match your installation if not running from within
-# rgmanager.
-#
-# (3) Do NOT place this script in shared storage; place it in ORACLE_USER's
-# home directory in non-clustered environments and /usr/share/cluster
-# in rgmanager/Red Hat cluster environments.
-#
-# Oracle is a registered trademark of Oracle Corporation.
-# Oracle9i is a trademark of Oracle Corporation.
-# Oracle10g is a trademark of Oracle Corporation.
-# All other trademarks are property of their respective owners.
-#
-
-. /etc/init.d/functions
-
-#
-# Source stuff from /etc/sysconfig, but this may be overridden if
-# this is being called as a cluster resource agent instead.
-#. /etc/sysconfig/oracledb
-
-declare SCRIPT="`basename $0`"
-declare SCRIPTDIR="`dirname $0`"
-
-[ -n "$OCF_RESKEY_user" ] && ORACLE_USER=$OCF_RESKEY_user
-[ -n "$OCF_RESKEY_home" ] && ORACLE_HOME=$OCF_RESKEY_home
-[ -n "$OCF_RESKEY_name" ] && ORACLE_SID=$OCF_RESKEY_name
-[ -n "$OCF_RESKEY_listener_name" ] && ORACLE_LISTENER=$OCF_RESKEY_listener_name
-[ -n "$OCF_RESKEY_lockfile" ] && LOCKFILE=$OCF_RESKEY_lockfile
-[ -n "$OCF_RESKEY_type" ] && ORACLE_TYPE=$OCF_RESKEY_type
-[ -n "$OCF_RESKEY_vhost" ] && ORACLE_HOSTNAME=$OCF_RESKEY_vhost
-
-######################################################
-# Customize these to match your Oracle installation. #
-######################################################
-#
-# 1. Oracle user.  Must be the same across all cluster members.  In the event
-#    that this script is run by the super-user, it will automatically switch
-#    to the Oracle user and restart.  Oracle needs to run as the Oracle
-#    user, not as root.
-#
-#[ -n "$ORACLE_USER" ] || ORACLE_USER=oracle
-
-#
-# 2. Oracle home.  This is set up during the installation phase of Oracle.
-#    From the perspective of the cluster, this is generally the mount point
-#    you intend to use as the mount point for your Oracle Infrastructure
-#    service.
-#
-#[ -n "$ORACLE_HOME" ] || ORACLE_HOME=/mnt/oracle/home
-
-#
-# 3. This is your SID.  This is set up during oracle installation as well.
-#
-#[ -n "$ORACLE_SID" ] || ORACLE_SID=orcl
-
-#
-# 4. The oracle user probably doesn't have the permission to write to 
-# /var/lock/subsys, so use the user's home directory.
-#
-#[ -n "$LOCKFILE" ] || LOCKFILE="/home/$ORACLE_USER/.oracle-ias.lock"
-[ -n "$LOCKFILE" ] || LOCKFILE="$ORACLE_HOME/.oracle-ias.lock"
-#[ -n "$LOCKFILE" ] || LOCKFILE="/var/lock/subsys/oracle-ias" # Watch privileges
-
-#
-# 5. Type of Oracle Database.  Currently supported: 10g 10g-iAS(untested!)
-#
-[ -n "$ORACLE_TYPE" ] || ORACLE_TYPE="base-em"
-
-#
-# 6. Oracle virtual hostname.  This is the hostname you gave Oracle during
-#    installation.
-#
-#[ -n "$ORACLE_HOSTNAME" ] || ORACLE_HOSTNAME=svc0.foo.test.com
-
-
-
-###########################################################################
-ORACLE_TYPE=`echo $ORACLE_TYPE | tr A-Z a-z`
-export ORACLE_USER ORACLE_HOME ORACLE_SID LOCKFILE ORACLE_TYPE
-export ORACLE_HOSTNAME
-
-
-##########################
-# Set up paths we'll use.  Not all are used by all the different types of
-# Oracle installations
-#
-export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/opmn/lib
-export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/opmn/bin:$ORACLE_HOME/dcm/bin:$PATH
-
-declare -i	RESTART_RETRIES=3
-declare -r	DB_PROCNAMES="pmon"
-#declare -r	DB_PROCNAMES="pmonXX" # testing
-#declare -r	DB_PROCNAMES="pmon smon dbw0 lgwr"
-
-declare -r	LSNR_PROCNAME="tnslsnr"
-#declare -r	LSNR_PROCNAME="tnslsnrXX" # testing
-
-
-##########################################################
-# (Hopefully) No user-serviceable parts below this line. #
-##########################################################
-meta_data()
-{
-	cat <<EOT
-<?xml version="1.0" ?>
-<resource-agent name="oracledb" version="rgmanager 2.0">
-    <version>1.0</version>
-
-    <longdesc lang="en">
-	Oracle 10g Failover Instance
-    </longdesc>
-    <shortdesc lang="en">
-	Oracle 10g Failover Instance
-    </shortdesc>
-
-    <parameters>
-        <parameter name="name" primary="1">
-	    <longdesc lang="en">
-		Instance name (SID) of oracle instance
-	    </longdesc>
-            <shortdesc lang="en">
-		Oracle SID
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="listener_name" unique="1">
-	    <longdesc lang="en">
-		Oracle Listener Instance Name.  If you have multiple 
-		instances of Oracle running, it may be necessary to 
-		have multiple listeners on the same machine with
-		different names.
-	    </longdesc>
-            <shortdesc lang="en">
-		Oracle Listener Instance Name
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-
-        <parameter name="user" required="1">
-	    <longdesc lang="en">
-		Oracle user name.  This is the user name of the Oracle
-		user which the Oracle AS instance runs as.
-	    </longdesc>
-            <shortdesc lang="en">
-		Oracle User Name
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="home" required="1">
-	    <longdesc lang="en">
-		This is the Oracle (application, not user) home directory.
-		This is configured when you install Oracle.
-	    </longdesc>
-            <shortdesc lang="en">
-		Oracle Home Directory
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="type" required="0">
-	    <longdesc lang="en">
-		This is the Oracle installation type:
-		base - Database Instance and Listener only
-		base-em (or 10g) - Database, Listener, Enterprise Manager,
-				   and iSQL*Plus
-		ias (or 10g-ias) - Internet Application Server (Infrastructure)
-	    </longdesc>
-            <shortdesc lang="en">
-		Oracle Installation Type
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="vhost" required="0" unique="1">
-	    <longdesc lang="en">
-	        Virtual Hostname matching the installation hostname of
-		Oracle 10g.  Note that during the start/stop of an oracledb
-		resource, your hostname will temporarily be changed to
-		this hostname.  As such, it is recommended that oracledb
-		resources be instanced as part of an exclusive service only.
-	    </longdesc>
-            <shortdesc lang="en">
-		Virtual Hostname
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-    </parameters>
-
-    <actions>
-        <action name="start" timeout="900"/>
-	<action name="stop" timeout="90"/>
-        <action name="recover" timeout="990"/>
-
-	<!-- Checks to see if it's mounted in the right place -->
-	<action name="status" timeout="10"/>
-	<action name="monitor" timeout="10"/>
-
-	<!-- Checks to see if we can read from the mountpoint -->
-	<action name="status" depth="10" timeout="30" interval="5m"/>
-	<action name="monitor" depth="10" timeout="30" interval="5m"/>
-
-	<!-- Checks to see if we can write to the mountpoint (if !ROFS) -->
-	<action name="status" depth="20" timeout="90" interval="10m"/>
-	<action name="monitor" depth="20" timeout="90" interval="10m"/>
-
-	<action name="meta-data" timeout="5"/>
-	<action name="validate-all" timeout="5"/>
-    </actions>
-
-    <special tag="rgmanager">
-	<attributes maxinstances="1"/>
-    </special>
-</resource-agent>
-EOT
-}
-
-
-#
-# "action"-like macro supporting functions
-#
-faction()
-{
-	echo -n "$1"
-	shift
-	$*
-	if [ $? -eq 0 ]; then
-		echo_success
-		echo
-		return 0
-	fi
-
-	echo_failure
-	echo
-	return 1
-}
-
-
-#
-# Start Oracle9i (database portion)
-#
-start_db()
-{
-	declare tmpfile
-	declare logfile
-	declare -i rv
-
-	tmpfile="$(mktemp /tmp/$SCRIPT-start.XXXXXX)"
-	logfile=@LOGDIR@/$SCRIPT-start.log
-
-	#
-	# Set up our sqlplus script.  Basically, we're trying to 
-	# capture output in the hopes that it's useful in the case
-	# that something doesn't work properly.
-	#
-	echo "startup" > $tmpfile
-	echo "quit" >> $tmpfile
-
-	sqlplus "/ as sysdba" < $tmpfile &> $logfile
-	rv=$?
-
-	rm -f $tmpfile
-
-	# Dump logfile to /var/log/messages
-	initlog -q -c "cat $logfile"
-
-	if [ $rv -ne 0 ]; then
-		echo "ORACLE_HOME Incorrectly set?"
-		echo "See $logfile for more information."
-		return 1
-	fi
-
-	# 
-	# If we see:
-	# ORA-.....: failure, we failed
-	#
-
-	grep -q "failure" $logfile
-	if [ $? -eq 0 ]; then
-		echo "ORACLE_SID Incorrectly set?"
-		echo "See $logfile for more information."
-		return 1
-	fi
-
-	return 0
-}
-
-
-#
-# Stop Oracle9i (database portion)
-#
-stop_db()
-{
-	declare tmpfile
-	declare logfile
-	declare -i rv
-
-	tmpfile="$(mktemp /tmp/$SCRIPT-stop.XXXXXX)"
-	logfile=@LOGDIR@/$SCRIPT-stop.log
-
-	# Setup for Stop ...
-	echo "shutdown abort" > $tmpfile
-	echo "quit" >> $tmpfile
-
-	sqlplus "/ as sysdba" < $tmpfile &> $logfile
-	rv=$?
-
-	rm -f $tmpfile
-
-	# Dump logfile to /var/log/messages
-	initlog -q -c "cat $logfile"
-
-	if [ $rv -ne 0 ]; then
-		echo "ORACLE_HOME Incorrectly set?"
-		echo "See $logfile for more information."
-		return 1
-	fi
-
-	# 
-	# If we see 'failure' in the log, we're done.
-	#
-	grep -q failure $logfile
-	if [ $? -eq 0 ]; then
-		echo_failure
-		echo
-		echo "Possible reason: ORACLE_SID Incorrectly set."
-		echo "See $logfile for more information."
-		return 1
-	fi
-
-	return 0
-}
-
-
-#
-# Destroy any remaining processes with refs to $ORACLE_HOME
-#
-force_cleanup()
-{
-	declare pids
-	declare pid
-
-	pids=`ps ax | grep $ORACLE_HOME | grep -v grep | awk '{print $1}'`
-
-	initlog -n $SCRIPT -s "<err> Not all Oracle processes exited cleanly, killing"
-	
-	for pid in $pids; do
-		kill -9 $pid
-		if [ $? -eq 0 ]; then
-			initlog -n $SCRIPT -s "Killed $pid"
-		fi
-	done
-
-	return 0
-}
-
-
-
-#
-# Wait for oracle processes to exit.  Time out after 60 seconds
-#
-exit_idle()
-{
-	declare -i n=0
-	while ps ax | grep $ORACLE_HOME | grep -q -v grep; do
-		if [ $n -ge 90 ]; then
-			force_cleanup
-			return 0
-		fi
-		sleep 1
-		((n++))
-	done
-	return 0
-}
-
-
-#
-# Get database background process status.  Restart it if it failed and
-# we have seen the lock file.
-#
-get_db_status()
-{
-	declare -i subsys_lock=$1
-	declare -i i=0
-	declare -i rv=0
-	declare ora_procname
-
-	for procname in $DB_PROCNAMES ; do
-
-		ora_procname="ora_${procname}_${ORACLE_SID}"
-		
-		status $ora_procname
-		if [ $? -eq 0 ] ; then
-			# This one's okay; go to the next one.
-			continue
-		fi
-
-		#
-		# We're not supposed to be running, and we are,
-		# in fact, not running...
-		# XXX only works when monitoring one db process; consider
-		# extending in future.
-		#
-		if [ $subsys_lock -ne 0 ]; then
-			return 3
-		fi
-
-		for (( i=$RESTART_RETRIES ; i; i-- )) ; do
-			# this db process is down - stop and
-			# (re)start all ora_XXXX_$ORACLE_SID processes
-			initlog -q -n $SCRIPT -s "Restarting Oracle Database..."
-			stop_db
-			if [ $? != 0 ] ; then
-				# stop failed - return 1
-				return 1
-			fi
-
-			start_db
-			if [ $? == 0 ] ; then
-				# ora_XXXX_$ORACLE_SID processes started
-				# successfully, so break out of the
-				# stop/start # 'for' loop
-				break
-			fi
-		done
-
-		if [ $i -eq 0 ]; then
-			# stop/start's failed - return 1 (failure)
-			return 1
-		fi
-	done
-	return 0
-}
-
-
-#
-# Get the status of the Oracle listener process
-#
-get_lsnr_status() 
-{
-	declare -i subsys_lock=$1
-	declare -i rv
-
-	status $LSNR_PROCNAME
-	rv=$?
-	if [ $rv == 0 ] ; then
-		return 0 # Listener is running fine
-	fi
-
-	#
-	# We're not supposed to be running, and we are,
-	# in fact, not running.  Return 3
-	#
-	if [ $subsys_lock -ne 0 ]; then
-		return 3
-	fi
-
-	#
-	# Listener is NOT running (but should be) - try to restart
-	#
-	for (( i=$RESTART_RETRIES ; i; i-- )) ; do
-
-		action "Restarting Oracle listener:" lsnrctl start \
-					$ORACLE_LISTENER
-		lsnrctl status $ORACLE_LISTENER >& /dev/null
-		if [ $? == 0 ] ; then
-			break # Listener was (re)started and is running fine
-		fi
-	done
-
-	if [ $i -eq 0 ]; then
-		# stop/start's failed - return 1 (failure)
-		return 1
-	fi
-
-	status $LSNR_PROCNAME
-	if [ $? != 0 ] ; then
-		return 1 # Problem restarting the Listener
-	fi
-	return 0 # Success restarting the Listener
-}
-
-
-#
-# usage: get_opmn_proc_status <ias-component> [process-type]
-#
-# Get the status of a specific OPMN-managed process.  If process-type
-# is not specified, assume the process-type is the same as the ias-component.
-# If the lock-file exists (or no lock file is specified), try to restart
-# the given process-type if it is not running.
-#
-get_opmn_proc_status()
-{
-	declare comp=$1
-	declare opmntype=$2
-	declare type_pretty
-	declare _pid _status
-	
-	[ -n "$comp" ] || return 1
-	if [ -z "$opmntype" ]; then
-		opmntype=$comp
-	else
-		type_pretty=" [$opmntype]"
-	fi
-
-	for (( i=$RESTART_RETRIES ; i; i-- )) ; do
-
-		_status=`opmnctl status | grep "^$comp " | grep " $opmntype " | cut -d '|' -f3,4 | sed -e 's/ //g' -e 's/|/ /g'`
-
-		_pid=`echo $_status | cut -f1 -d' '`
-		_status=`echo $_status | cut -f2 -d' '`
-		if [ "${_status}" == "Alive" ] || [ "${_status}" == "Init" ]; then
-			if [ $i -lt $RESTART_RETRIES ] ; then
-				echo "  $comp$type_pretty restarted"
-			fi
-			echo "  $comp$type_pretty (pid $_pid) is running..."
-			break
-		else
-			echo "  $comp$type_pretty is stopped"
-
-			#
-			# Try to restart it, but don't worry if we fail.  OPMN
-			# is supposed to handle restarting these anyway.
-			#
-			# If it's running and you tell OPMN to "start" it,
-			# you will get an error.
-			#
-			# If it's NOT running and you tell OPMN to "restart"
-			# it, you will also get an error.
-			#
-			opmnctl startproc process-type=$opmntype &> /dev/null
-		fi
-	done
-
-	if [ $i -eq 0 ]; then
-		# restarts failed - return 1 (failure)
-		return 1
-	fi
-
-	return 0
-}
-
-
-#
-# Get the status of the OPMN-managed processes.
-#
-get_opmn_status()
-{
-	declare -i subsys_lock=$1
-	declare -i ct_errors=0
-
-	opmnctl status &> /dev/null
-	if [ $? -eq 2 ]; then
-		#
-		# OPMN not running??
-		#
-		echo "opmn is stopped"
-
-		if [ $subsys_lock -eq 0 ]; then
-			#
-			# Don't handle full opmn-restart. XXX
-			#
-			return 1
-		fi
-
-		# That's okay, it's not supposed to be!
-		return 3
-	fi
-
-	#
-	# Print out the PIDs for everyone.
-	#
-	echo "opmn is running..."
-	echo "opmn components:"
-
-	#
-	# Check the OPMN-managed processes
-	#
-	get_opmn_proc_status OID || ((ct_errors++))
-	get_opmn_proc_status HTTP_Server || ((ct_errors++))
-	get_opmn_proc_status OC4J OC4J_SECURITY || ((ct_errors++))
-
-	#
-	# One or more OPMN-managed processes failed and could not be
-	# restarted.
-	#
-	if [ $ct_errors -ne 0 ]; then
-		return 1
-	fi
-	return 0
-}
-
-
-#
-# Helps us keep a running status so we know what our ultimate return
-# code will be.  Returns 1 if the $1 and $2 are not equivalent, otherwise
-# returns $1.  The return code is meant to be the next $1 when this is
-# called, so, for example:
-#
-# update_status 0   <-- returns 0
-# update_status $? 0 <-- returns 0
-# update_status $? 3 <-- returns 1 (values different - error condition)
-# update_status $? 1 <-- returns 1 (same, but happen to be error state!)
-#
-# update_status 3
-# update_status $? 3 <-- returns 3
-#
-# (and so forth...)
-#
-update_status()
-{
-	declare -i old_status=$1
-	declare -i new_status=$2
-
-	if [ -z "$2" ]; then
-		return $old_status
-	fi
-
-	if [ $old_status -ne $new_status ]; then
-		return 1
-	fi
-
-	return $old_status
-}
-
-
-#
-# Print an error message to the user and exit.
-#
-oops()
-{
-	echo "Please configure this script ($0) to"
-	echo "match your installation."
-	echo 
-	echo "    $1 failed validation checks."
-	exit 1
-}
-
-
-#
-# Do some validation on the user-configurable stuff at the beginning of the
-# script.
-#
-validation_checks()
-{
-	#
-	# If the oracle user doesn't exist, we're done.
-	#
-	[ -n "$ORACLE_USER" ] || oops "ORACLE_USER"
-	id -u $ORACLE_USER > /dev/null || oops "ORACLE_USER"
-	id -g $ORACLE_USER > /dev/null || oops "ORACLE_USER"
-
-	#
-	# If the oracle home isn't a directory, we're done
-	#
-	[ -n "$ORACLE_HOME" ] || oops ORACLE_HOME
-	#[ -d "$ORACLE_HOME" ] || oops ORACLE_HOME
-
-	#
-	# If the oracle SID is NULL, we're done
-	#
-	[ -n "$ORACLE_SID" ] || oops ORACLE_SID
-
-	#
-	# If we don't know the type, we're done
-	#
-	if [ "$ORACLE_TYPE" = "base" ]; then
-		# Other names for base
-		ORACLE_TYPE="base"
-	elif [ "$ORACLE_TYPE" = "10g" ] || [ "$ORACLE_TYPE" = "base-em" ]; then
-		ORACLE_TYPE="base-em"
-	elif [ "$ORACLE_TYPE" = "10g-ias" ] || [ "$ORACLE_TYPE" = "ias" ]; then
-		ORACLE_TYPE="ias"
-	else
-		oops ORACLE_TYPE
-	fi
-
-	#
-	# If the hostname is zero-length, fix it
-	#
-	[ -n "$ORACLE_HOSTNAME" ] || ORACLE_HOSTNAME=`hostname`
-
-	#
-	# Super user? Automatically change UID and exec as oracle user.
-	# Oracle needs to be run as the Oracle user, not root!
-	#
-	if [ "`id -u`" = "0" ]; then
-		echo "Restarting $0 as $ORACLE_USER."
-		#
-		# Breaks on RHEL5 
-		# exec sudo -u $ORACLE_USER $0 $*
-		#
-		su $ORACLE_USER -c "$0 $*"
-		exit $?
-	fi
-
-	#
-	# If we're not root and not the Oracle user, we're done.
-	#
-	[ "`id -u`" = "`id -u $ORACLE_USER`" ] || exit 1
-	[ "`id -g`" = "`id -g $ORACLE_USER`" ] || exit 1
-
-	#
-	# Go home.
-	#
-	cd $ORACLE_HOME
-
-	return 0
-}
-
-
-#
-# Start Oracle9i Application Server Infrastructure
-#
-start_oracle()
-{
-	faction "Starting Oracle Database:" start_db || return 1
-	action "Starting Oracle Listener:" lsnrctl start $ORACLE_LISTENER || return 1
-
-	if [ "$ORACLE_TYPE" = "base-em" ]; then
-		action "Starting iSQL*Plus:" isqlplusctl start || return 1
-		action "Starting Oracle EM DB Console:" emctl start dbconsole || return 1
-	elif [ "$ORACLE_TYPE" = "ias" ]; then
-		action "Starting Oracle EM:" emctl start em || return 1
-		action "Starting iAS Infrastructure:" opmnctl startall || return 1
-	fi
-
-	if [ -n "$LOCKFILE" ]; then
-		touch $LOCKFILE
-	fi
-	return 0
-}
-
-
-#
-# Stop Oracle9i Application Server Infrastructure
-#
-stop_oracle()
-{
-	if ! [ -e "$ORACLE_HOME/bin/lsnrctl" ]; then
-		echo "Oracle Listener Control is not available"
-		echo "    ($ORACLE_HOME not mounted?)"
-		return 0
-	fi
-
-	if [ "$ORACLE_TYPE" = "base-em" ]; then
-		action "Stopping Oracle EM DB Console:" emctl stop dbconsole || return 1
-		action "Stopping iSQL*Plus:" isqlplusctl stop || return 1
-	elif [ "$ORACLE_TYPE" = "ias" ]; then
-		action "Stopping iAS Infrastructure:" opmnctl stopall || return 1
-		action "Stopping Oracle EM:" emctl stop em || return 1
-	fi
-
-	faction "Stopping Oracle Database:" stop_db || return 1
-	action "Stopping Oracle Listener:" lsnrctl stop $ORACLE_LISTENER
-	faction "Waiting for all Oracle processes to exit:" exit_idle 
-
-	if [ $? -ne 0 ]; then
-		echo "WARNING: Not all Oracle processes exited cleanly"
-	fi
-
-	if [ -n "$LOCKFILE" ]; then
-		rm -f $LOCKFILE
-	fi
-	return 0
-}
-
-
-#
-# Find and display the status of iAS infrastructure.
-#
-# This has three parts:
-# (1) Oracle database itself
-# (2) Oracle listener process
-# (3) OPMN and OPMN-managed processes
-#
-# - If all are (cleanly) down, we return 3.  In order for this to happen,
-# $LOCKFILE must not exist.  In this case, we try and restart certain parts
-# of the service - as this may be running in a clustered environment.
-#
-# - If some but not all are running (and, if $LOCKFILE exists, we could not
-# restart the failed portions), we return 1 (ERROR)
-#
-# - If all are running, return 0.  In the "all-running" case, we recreate
-# $LOCKFILE if it does not exist.
-#
-status_oracle()
-{
-	declare -i subsys_lock=1
-	declare -i last 
-	declare -i depth=$1
-
-	#
-	# Check for lock file.  Crude and rudimentary, but it works
-	#
-	if [ -z "$LOCKFILE" ] || [ -f $LOCKFILE ]; then
-		subsys_lock=0 
-	fi
-
-	# Check database status
-	get_db_status $subsys_lock $depth
-	update_status $? # Start
-	last=$?
-
-	# Check & report listener status
-	get_lsnr_status $subsys_lock $depth
-	update_status $? $last
-	last=$?
-	
-	if [ "$ORACLE_TYPE" = "base-em" ]; then
-		# XXX Add isqlplus status check?!
-		emctl status dbconsole 2>&1 | grep "is running"
-		update_status $? $last
-		last=$?
-	elif [ "$ORACLE_TYPE" = "ias" ]; then
-		# Check & report opmn / opmn-managed process status
-		get_opmn_status $subsys_lock $depth
-		update_status $? $last
-		last=$?
-	fi
-
-	#
-	# No lock file, but everything's running.  Put the lock
-	# file back. XXX - this kosher?
-	#
-	if [ $last -eq 0 ] && [ $subsys_lock -ne 0 ]; then
-		touch $LOCKFILE
-	fi
-
-	return $last
-}
-
-
-########################
-# Do some real work... #
-########################
-if [ "$1" = "meta-data" ]; then
-	meta_data
-	exit 0
-fi
-
-validation_checks $*
-
-case $1 in
-	start)
-		start_oracle
-		exit $?
-		;;
-	stop)
-		stop_oracle
-		exit $?
-		;;
-	status|monitor)
-		status_oracle $OCF_CHECK_LEVEL
-		exit $?
-		;;
-	restart)
-		$0 stop || exit $?
-		$0 start || exit $?
-		exit 0
-		;;
-	*)
-		echo "usage: $SCRIPT {start|stop|status|restart|meta-data}"
-		exit 1
-		;;
-esac
-exit 0
diff --git a/rgmanager/src/resources/postgres-8.metadata b/rgmanager/src/resources/postgres-8.metadata
deleted file mode 100644
index ad3f84e..0000000
--- a/rgmanager/src/resources/postgres-8.metadata
+++ /dev/null
@@ -1,95 +0,0 @@
-<?xml version="1.0"?>
-<resource-agent version="rgmanager 2.0" name="postgres-8">
-    <version>1.0</version>
-
-    <longdesc lang="en">
-        This defines an instance of PostgreSQL server
-    </longdesc>
-    <shortdesc lang="en">
-        Defines a PostgreSQL server
-    </shortdesc>
-
-    <parameters>
-        <parameter name="name" primary="1">
-	    <longdesc lang="en">
-	        Specifies a service name for logging and other purposes
-	    </longdesc>
-            <shortdesc lang="en">
-                Name
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="config_file">
-            <longdesc lang="en">
-                Define absolute path to configuration file
-            </longdesc>
-            <shortdesc lang="en">
-                Config File
-            </shortdesc>
-	    <content type="string" default="/var/lib/pgsql/data/postgresql.conf"/>
-        </parameter>
-
-	<parameter name="postmaster_user">
-		<longdesc lang="en">
-			User who runs the database server because it can't be
-			run by root.
-		</longdesc>
-		<shortdesc lang="en">
-			User who runs the database server
-		</shortdesc>
-		<content type="string" default="postgres" />
-	</parameter>
-
-	<parameter name="postmaster_options">
-		<longdesc lang="en">
-			Other command-line options for postmaster
-		</longdesc>
-		<shortdesc lang="en">
-			Other command-line options for postmaster
-		</shortdesc>
-		<content type="string" default="-D /var/lib/pgsql/data"/>
-	</parameter>
-
-	<parameter name="shutdown_wait">
-		<longdesc lang="en">
-			Wait X seconds for correct end of service shutdown
-		</longdesc>
-		<shortdesc lang="en">
-			Wait X seconds for correct end of service shutdown
-		</shortdesc>
-		<content type="integer" />
-	</parameter>
-
-        <parameter name="service_name" inherit="service%name">
-            <longdesc lang="en">
-	    	Inherit the service name.  We need to know
-		the service name in order to determine file
-		systems and IPs for this service.
-            </longdesc>
-            <shortdesc lang="en">
-	    	Inherit the service name.
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-    </parameters>
-
-    <actions>
-        <action name="start" timeout="0"/>
-	<action name="stop" timeout="0"/>
-
-	<!-- Checks to see if it''s mounted in the right place -->
-	<action name="status" interval="1m" timeout="10"/>
-	<action name="monitor" interval="1m" timeout="10"/>
-
-	<!-- Checks to see if we can read from the mountpoint -->
-	<action name="status" depth="10" timeout="30" interval="5m"/>
-	<action name="monitor" depth="10" timeout="30" interval="5m"/>
-
-	<action name="meta-data" timeout="0"/>
-	<action name="validate-all" timeout="0"/>
-    </actions>
-
-    <special tag="rgmanager">
-    </special>
-</resource-agent>
diff --git a/rgmanager/src/resources/postgres-8.sh b/rgmanager/src/resources/postgres-8.sh
deleted file mode 100644
index 563c700..0000000
--- a/rgmanager/src/resources/postgres-8.sh
+++ /dev/null
@@ -1,204 +0,0 @@
-#!/bin/bash
-
-export LC_ALL=C
-export LANG=C
-export PATH=/bin:/sbin:/usr/bin:/usr/sbin
-
-. $(dirname $0)/ocf-shellfuncs
-. $(dirname $0)/utils/config-utils.sh
-. $(dirname $0)/utils/messages.sh
-. $(dirname $0)/utils/ra-skelet.sh
-
-declare PSQL_POSTMASTER="/usr/bin/postmaster"
-declare PSQL_pid_file="`generate_name_for_pid_file`"
-declare PSQL_conf_dir="`generate_name_for_conf_dir`"
-declare PSQL_gen_config_file="$PSQL_conf_dir/postgresql.conf"
-
-verify_all()
-{
-	clog_service_verify $CLOG_INIT
-
-	if [ -z "$OCF_RESKEY_name" ]; then
-		clog_service_verify $CLOG_FAILED "Invalid Name Of Service"
-		return $OCF_ERR_ARGS
-	fi
-
-	if [ -z "$OCF_RESKEY_service_name" ]; then
-		clog_service_verify $CLOG_FAILED_NOT_CHILD
-		return $OCF_ERR_ARGS
-	fi
-
-	if [ -z "$OCF_RESKEY_config_file" ]; then
-		clog_check_file_exist $CLOG_FAILED_INVALID "$OCF_RESKEY_config_file"
-		clog_service_verify $CLOG_FAILED
-		return $OCF_ERR_ARGS
-	fi
-
-	if [ ! -r "$OCF_RESKEY_config_file" ]; then
-		clog_check_file_exist $CLOG_FAILED_NOT_READABLE $OCF_RESKEY_config_file
-		clog_service_verify $CLOG_FAILED
-		return $OCF_ERR_ARGS
-	fi
-
-	if [ -z "$OCF_RESKEY_postmaster_user" ]; then
-		clog_servicer_verify $CLOG_FAILED "Invalid User"
-		return $OCF_ERR_ARGS
-	fi
-
-	clog_service_verify $CLOG_SUCCEED
-		
-	return 0
-}
-
-generate_config_file()
-{
-	declare original_file="$1"
-	declare generated_file="$2"
-	declare ip_addressess="$3"
-	
-	declare ip_comma="";
-
-	if [ -f "$generated_file" ]; then
-		sha1_verify "$generated_file"
-		if [ $? -ne 0 ]; then
-			clog_check_sha1 $CLOG_FAILED
-			return 0
-		fi
-	fi	
-
-	clog_generate_config $CLOG_INIT "$original_file" "$generated_file"
-
-	declare x=1
-	for i in $ip_addressess; do
-		if [ $x -eq 1 ]; then
-			x=0
-			ip_comma=$i
-		else
-			ip_comma=$ip_comma,$i
-		fi 
-	done
-
-	generate_configTemplate "$generated_file" "$1"
-	echo "external_pid_file = '$PSQL_pid_file'" >> "$generated_file"
-	echo "listen_addresses = '$ip_comma'" >> "$generated_file"
-
-	echo >> "$generated_file"	
-	sed 's/^[[:space:]]*external_pid_file/### external_pid_file/i;s/^[[:space:]]*listen_addresses/### listen_addresses/i' < "$original_file" >> "$generated_file"
-	
-        sha1_addToFile "$generated_file"
-	clog_generate_config $CLOG_SUCCEED "$original_file" "$generated_file"
-               
-	return 0;
-}
-
-start()
-{
-	declare pguser_group
-	clog_service_start $CLOG_INIT
-
-	create_pid_directory
-	create_conf_directory "$PSQL_conf_dir"
-	check_pid_file "$PSQL_pid_file"
-
-	if [ $? -ne 0 ]; then
-		clog_check_pid $CLOG_FAILED "$PSQL_pid_file"
-		clog_service_start $CLOG_FAILED
-		return $OCF_ERR_GENERIC
-	fi
-
-	#
-	# Create an empty PID file for the postgres user and
-	# change it to be owned by the postgres user so that
-	# postmaster doesn't complain.
-	#
-	pguser_group=`groups $OCF_RESKEY_postmaster_user | cut -f1 -d ' '`
-	touch $PSQL_pid_file
-	chown $OCF_RESKEY_postmaster_user.$pguser_group $PSQL_pid_file
-
-	clog_looking_for $CLOG_INIT "IP Addresses"
-
-        get_service_ip_keys "$OCF_RESKEY_service_name"
-        ip_addresses=`build_ip_list`
-
-	if [ -z "$ip_addresses" ]; then
-		clog_looking_for $CLOG_FAILED_NOT_FOUND "IP Addresses"
-		return $OCF_ERR_GENERIC
-	fi
-	
-	clog_looking_for $CLOG_SUCCEED "IP Addresses"
-
-	generate_config_file "$OCF_RESKEY_config_file" "$PSQL_gen_config_file" "$ip_addresses"
-
-	su - "$OCF_RESKEY_postmaster_user" -c "$PSQL_POSTMASTER -c config_file=\"$PSQL_gen_config_file\" \
-		$OCF_RESKEY_postmaster_options" &> /dev/null &
-
-	if [ $? -ne 0 ]; then
-		clog_service_start $CLOG_FAILED
-		return $OCF_ERR_GENERIC
-	fi
-
-	clog_service_start $CLOG_SUCCEED
-	return 0;
-}
-
-stop()
-{
-	clog_service_stop $CLOG_INIT
-
-	stop_generic "$PSQL_pid_file" "$OCF_RESKEY_shutdown_wait"
-	if [ $? -ne 0 ]; then
-		clog_service_stop $CLOG_FAILED
-		return $OCF_ERR_GENERIC
-	fi
-	
-	clog_service_stop $CLOG_SUCCEED
-	return 0;
-}
-
-status()
-{
-	clog_service_status $CLOG_INIT
-
-	status_check_pid "$PSQL_pid_file"
-	if [ $? -ne 0 ]; then
-		clog_service_status $CLOG_FAILED "$PSQL_pid_file"
-		return $OCF_ERR_GENERIC
-	fi
-
-	clog_service_status $CLOG_SUCCEED
-	return 0
-}
-
-case $1 in
-	meta-data)
-		cat `echo $0 | sed 's/^\(.*\)\.sh$/\1.metadata/'`
-		exit 0
-		;;
-	validate-all)
-		verify_all
-		exit $?
-		;;
-	start)
-		verify_all && start
-		exit $?
-		;;
-	stop)
-		verify_all && stop
-		exit $?
-		;;
-	status|monitor)
-		verify_all
-		status
-		exit $?
-		;;
-	restart)
-		verify_all
-		stop
-		start
-		exit $?
-		;;
-	*)
-		echo "Usage: $0 {start|stop|status|monitor|restart|meta-data|validate-all}"
-		exit $OCF_ERR_UNIMPLEMENTED
-		;;
-esac
diff --git a/rgmanager/src/resources/ra-api-1-modified.dtd b/rgmanager/src/resources/ra-api-1-modified.dtd
deleted file mode 100644
index 51354d6..0000000
--- a/rgmanager/src/resources/ra-api-1-modified.dtd
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-
-<!-- This is based on the RA-API-1.0 DTD from:
-     http://www.opencf.org/cgi-bin/viewcvs.cgi/specs/ra/ra-api-1.dtd
-
-     There are additions for rgmanager.  These additions should be
-     ignored by other RMs.
- -->
-
-<!ELEMENT resource-agent (version,longdesc,shortdesc,parameters,actions,special*) >
-<!ATTLIST resource-agent
-	name	CDATA	#REQUIRED
-	version CDATA   #IMPLIED>
-
-<!ELEMENT version (#PCDATA)>
-
-<!ELEMENT parameters (parameter*)>
-
-<!ELEMENT actions (action*)>
-
-<!-- Primary and required are for rgmanager use. -->
-<!ELEMENT parameter (longdesc+,shortdesc+,content)>
-<!ATTLIST parameter
-	name	CDATA	#REQUIRED
-	primary (1|0)   "0"
-	required (1|0)	"0"
-	inherit CDATA	""
-	unique	(1|0)	"0"
-	reconfig (1|0)  "0">
-
-<!ELEMENT longdesc ANY>
-<!ATTLIST longdesc
-	lang	NMTOKEN	#IMPLIED>
-
-<!ELEMENT shortdesc ANY>
-<!ATTLIST shortdesc
-	lang	NMTOKEN	#IMPLIED>
-
-<!ELEMENT content EMPTY>
-<!ATTLIST content
-	type	(string|integer|boolean)	#REQUIRED
-	default CDATA	#IMPLIED>
-
-<!ELEMENT action EMPTY>
-<!ATTLIST action
-	name	(start|stop|recover|status|reconfig|monitor|reload|meta-data|validate-all|migrate|reconfig|methods)	#REQUIRED
-	timeout		CDATA	#REQUIRED
-	interval 	CDATA	#IMPLIED
-	start-delay 	CDATA	#IMPLIED
-	depth		CDATA	#IMPLIED>
-
-<!-- Special tag list for rgmanager -->
-<!ELEMENT special (attributes*, child*)>
-<!ATTLIST special
-	tag	CDATA	#REQUIRED>
-
-<!ELEMENT attributes EMPTY>
-<!ATTLIST attributes
-	maxinstances CDATA "0"
-	init_on_add CDATA "0"
-	destroy_on_delete CDATA "0">
-
-<!ELEMENT child EMPTY>
-<!ATTLIST child
-	type CDATA #REQUIRED
-	forbid (1|0) "0"
-	start CDATA "100"
-	stop CDATA "0">
diff --git a/rgmanager/src/resources/samba.metadata b/rgmanager/src/resources/samba.metadata
deleted file mode 100644
index 1e03fcd..0000000
--- a/rgmanager/src/resources/samba.metadata
+++ /dev/null
@@ -1,89 +0,0 @@
-<?xml version="1.0"?>
-<resource-agent version="rgmanager 2.0" name="samba">
-    <version>1.0</version>
-
-    <longdesc lang="en">
-    	Dynamic smbd/nmbd resource agent
-    </longdesc>
-    <shortdesc lang="en">
-    	Dynamic smbd/nmbd resource agent
-    </shortdesc>
-
-    <parameters>
-        <parameter name="name" unique="1" primary="1">
-            <longdesc lang="en">
-                Samba Symbolic Name.
-            </longdesc>
-            <shortdesc lang="en">
-                Samba Name
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="config_file">
-            <longdesc lang="en">
-                Define absolute path to configuration file
-            </longdesc>
-            <shortdesc lang="en">
-                Config File
-            </shortdesc>
-	    <content type="string" default="/etc/samba/smb.conf"/>
-        </parameter>
-
-	<parameter name="smbd_options">
-		<longdesc lang="en">
-			Other command-line options for smbd
-		</longdesc>
-		<shortdesc lang="en">
-			Other command-line options for smbd
-		</shortdesc>
-		<content type="string" />
-	</parameter>
-
-	<parameter name="nmbd_options">
-		<longdesc lang="en">
-			Other command-line options for nmbd
-		</longdesc>
-		<shortdesc lang="en">
-			Other command-line options for nmbd
-		</shortdesc>
-		<content type="string" />
-	</parameter>
-
-	<parameter name="shutdown_wait">
-		<longdesc lang="en">
-			Wait X seconds for correct end of service shutdown
-		</longdesc>
-		<shortdesc lang="en">
-			Wait X seconds for correct end of service shutdown
-		</shortdesc>
-		<content type="integer" />
-	</parameter>
-
-        <parameter name="service_name" inherit="service%name">
-            <longdesc lang="en">
-	    	Inherit the service name.  We need to know
-		the service name in order to determine file
-		systems and IPs for this smb service.
-            </longdesc>
-            <shortdesc lang="en">
-	    	Inherit the service name.
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-    </parameters>
-
-    <actions>
-        <action name="start" timeout="0"/>
-        <action name="stop" timeout="0"/>
-
-	<!-- This is just a wrapper for LSB init scripts, so monitor
-	     and status can't have a timeout, nor do they do any extra
-	     work regardless of the depth -->
-        <action name="status" interval="30s" timeout="0"/>
-        <action name="monitor" interval="30s" timeout="0"/>
-
-        <action name="meta-data" timeout="0"/>
-        <action name="validate-all" timeout="0"/>
-    </actions>
-</resource-agent>
diff --git a/rgmanager/src/resources/samba.sh b/rgmanager/src/resources/samba.sh
deleted file mode 100644
index 1990803..0000000
--- a/rgmanager/src/resources/samba.sh
+++ /dev/null
@@ -1,223 +0,0 @@
-#!/bin/bash
-
-export LC_ALL=C
-export LANG=C
-export PATH=/bin:/sbin:/usr/bin:/usr/sbin
-
-. $(dirname $0)/ocf-shellfuncs
-. $(dirname $0)/utils/config-utils.sh
-. $(dirname $0)/utils/messages.sh
-. $(dirname $0)/utils/ra-skelet.sh
-
-declare SAMBA_SMBD=/usr/sbin/smbd
-declare SAMBA_NMBD=/usr/sbin/nmbd
-declare SAMBA_pid_dir="`generate_name_for_pid_dir`"
-declare SAMBA_conf_dir="`generate_name_for_conf_dir`"
-declare SAMBA_smbd_pid_file="$SAMBA_pid_dir/smbd.pid"
-declare SAMBA_nmbd_pid_file="$SAMBA_pid_dir/nmbd.pid"
-declare SAMBA_gen_config_file="$SAMBA_conf_dir/smb.conf"
-
-verify_all()
-{
-	clog_service_verify $CLOG_INIT
-
-	if [ -z "$OCF_RESKEY_name" ]; then
-		clog_service_verify $CLOG_FAILED "Invalid Name Of Service"
-		return $OCF_ERR_ARGS
-	fi
-
-	if [ -z "$OCF_RESKEY_service_name" ]; then
-		clog_service_verify $CLOG_FAILED_NOT_CHILD
-		return $OCF_ERR_ARGS
-	fi
-
-	if [ -z "$OCF_RESKEY_config_file" ]; then
-		clog_check_file_exist $CLOG_FAILED_INVALID "$OCF_RESKEY_config_file"
-		clog_service_verify $CLOG_FAILED
-		return $OCF_ERR_ARGS
-	fi
-
-	if [ ! -r "$OCF_RESKEY_config_file" ]; then
-		clog_check_file_exist $CLOG_FAILED_NOT_READABLE $OCF_RESKEY_config_file
-		clog_service_verify $CLOG_FAILED
-		return $OCF_ERR_ARGS
-	fi
-
-	clog_service_verify $CLOG_SUCCEED
-		
-	return 0
-}
-
-generate_config_file()
-{
-	declare original_file="$1"
-	declare generated_file="$2"
-	declare ip_addresses="$3"
-
-	if [ -f "$generated_file" ]; then
-		sha1_verify "$generated_file"
-		if [ $? -ne 0 ]; then
-			clog_check_sha1 $CLOG_FAILED
-			return 0
-		fi
-	fi	
-
-	clog_generate_config $CLOG_INIT "$original_file" "$generated_file"
-
-	generate_configTemplate "$generated_file" "$1"
-
-	echo "pid directory = \"$SAMBA_pid_dir\"" >> "$generated_file"
-	echo "interfaces = $ip_addresses" >> "$generated_file"
-	echo "bind interfaces only = Yes" >> "$generated_file"
-	echo "netbios name = \"$OCF_RESKEY_name\"" >> "$generated_file"
-	echo >> "$generated_file"	
-	sed 's/^[[:space:]]*pid directory/### pid directory/i;s/^[[:space:]]*interfaces/### interfaces/i;s/^[[:space:]]*bind interfaces only/### bind interfaces only/i;s/^[[:space:]]*netbios name/### netbios name/i' \
-	     < "$original_file" >> "$generated_file"
-	
-        sha1_addToFile "$generated_file"
-	clog_generate_config $CLOG_SUCCEED "$original_file" "$generated_file"
-               
-	return 0;
-}
-
-start()
-{
-	clog_service_start $CLOG_INIT
-
-	create_pid_directory
-	mkdir -p "$SAMBA_pid_dir"
-	create_conf_directory "$SAMBA_conf_dir"
-	check_pid_file "$SAMBA_smbd_pid_file"
-
-	if [ $? -ne 0 ]; then
-		clog_check_pid $CLOG_FAILED "$SAMBA_smbd_pid_file"
-		clog_service_start $CLOG_FAILED
-		return $OCF_ERR_GENERIC
-	fi
-
-	check_pid_file "$SAMBA_nmbd_pid_file"
-
-	if [ $? -ne 0 ]; then
-		clog_check_pid $CLOG_FAILED "$SAMBA_nmbd_pid_file"
-		clog_service_start $CLOG_FAILED
-		return $OCF_ERR_GENERIC
-	fi
-
-	clog_looking_for $CLOG_INIT "IP Addresses"
-
-        get_service_ip_keys "$OCF_RESKEY_service_name"
-        ip_addresses=`build_ip_list`
-
-	if [ -z "$ip_addresses" ]; then
-		clog_looking_for $CLOG_FAILED_NOT_FOUND "IP Addresses"
-		return $OCF_ERR_GENERIC
-	fi
-	
-	clog_looking_for $CLOG_SUCCEED "IP Addresses"
-
-	generate_config_file "$OCF_RESKEY_config_file" "$SAMBA_gen_config_file" "$ip_addresses"
-
-	$SAMBA_SMBD -D -s "$SAMBA_gen_config_file" $OCF_RESKEY_smbd_options
-
-	if [ $? -ne 0 ]; then
-		clog_service_start $CLOG_FAILED
-		return $OCF_ERR_GENERIC
-	fi
-
-	$SAMBA_NMBD -D -s "$SAMBA_gen_config_file" $OCF_RESKEY_nmbd_options	
-
-	if [ $? -ne 0 ]; then
-		clog_service_start $CLOG_FAILED
-		return $OCF_ERR_GENERIC
-	fi
-	 
-	clog_service_start $CLOG_SUCCEED
-
-	return 0;
-}
-
-stop()
-{
-	clog_service_stop $CLOG_INIT
-
-	stop_generic "$SAMBA_smbd_pid_file" "$OCF_RESKEY_shutdown_wait"
-	
-	if [ $? -ne 0 ]; then
-		clog_service_stop $CLOG_FAILED
-		return $OCF_ERR_GENERIC
-	fi
-
-	stop_generic "$SAMBA_nmbd_pid_file"
-	
-	if [ $? -ne 0 ]; then
-		clog_service_stop $CLOG_FAILED
-		return $OCF_ERR_GENERIC
-	fi
-
-	if [ -e "$SAMBA_smbd_pid_file" ]; then
-		rm -f "$SAMBA_smbd_pid_file"
-	fi
-
-	if [ -e "$SAMBA_nmbd_pid_file" ]; then
-		rm -f "$SAMBA_nmbd_pid_file"
-	fi
-	
-	clog_service_stop $CLOG_SUCCEED
-	return 0;
-}
-
-status()
-{
-	clog_service_status $CLOG_INIT
-
-	status_check_pid "$SAMBA_smbd_pid_file"
-
-	if [ $? -ne 0 ]; then
-		clog_service_status $CLOG_FAILED "$SAMBA_smbd_pid_file"
-		return $OCF_ERR_GENERIC
-	fi
-
-	status_check_pid "$SAMBA_nmbd_pid_file"
-
-	if [ $? -ne 0 ]; then
-		clog_service_status $CLOG_FAILED "$SAMBA_nmbd_pid_file"
-		return $OCF_ERR_GENERIC
-	fi
-
-	clog_service_status $CLOG_SUCCEED
-	return 0
-}
-
-case $1 in
-	meta-data)
-		cat `echo $0 | sed 's/^\(.*\)\.sh$/\1.metadata/'`
-		exit 0
-		;;
-	validate-all)
-		verify_all
-		exit $?
-		;;
-	start)
-		verify_all && start
-		exit $?
-		;;
-	stop)
-		verify_all && stop
-		exit $?
-		;;
-	status|monitor)
-		verify_all
-		status
-		exit $?
-		;;
-	restart)
-		verify_all
-		stop
-		start
-		exit $?
-		;;
-	*)
-		echo "Usage: $0 {start|stop|status|monitor|restart|meta-data|validate-all}"
-		exit $OCF_ERR_UNIMPLEMENTED
-		;;
-esac
diff --git a/rgmanager/src/resources/script.sh b/rgmanager/src/resources/script.sh
deleted file mode 100644
index 4129811..0000000
--- a/rgmanager/src/resources/script.sh
+++ /dev/null
@@ -1,103 +0,0 @@
-#!/bin/bash
-
-#
-# Script to handle a non-OCF script (e.g. a normal init-script)
-#
-
-LC_ALL=C
-LANG=C
-PATH=/bin:/sbin:/usr/bin:/usr/sbin
-export LC_ALL LANG PATH
-
-. $(dirname $0)/ocf-shellfuncs
-
-meta_data()
-{
-    cat <<EOT
-<?xml version="1.0"?>
-<resource-agent version="rgmanager 2.0" name="script">
-    <version>1.0</version>
-
-    <longdesc lang="en">
-        The script resource allows a standard LSB-compliant init script
-	to be used to start a clustered service.
-    </longdesc>
-    <shortdesc lang="en">
-        LSB-compliant init script as a clustered resource.
-    </shortdesc>
-
-    <parameters>
-        <parameter name="name" unique="1" primary="1">
-            <longdesc lang="en">
-                Name
-            </longdesc>
-            <shortdesc lang="en">
-                Name
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="file" unique="1" required="1">
-            <longdesc lang="en">
-                Path to script
-            </longdesc>
-            <shortdesc lang="en">
-                Path to script
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="service_name" inherit="service%name">
-            <longdesc lang="en">
-	    	Inherit the service name, in case the
-		script wants to know this information.
-            </longdesc>
-            <shortdesc lang="en">
-	    	Inherit the service name.
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-    </parameters>
-
-    <actions>
-        <action name="start" timeout="0"/>
-        <action name="stop" timeout="0"/>
-
-	<!-- This is just a wrapper for LSB init scripts, so monitor
-	     and status can't have a timeout, nor do they do any extra
-	     work regardless of the depth -->
-        <action name="status" interval="30s" timeout="0"/>
-        <action name="monitor" interval="30s" timeout="0"/>
-
-        <action name="meta-data" timeout="0"/>
-        <action name="validate-all" timeout="0"/>
-    </actions>
-</resource-agent>
-EOT
-}
-
-case $1 in
-	meta-data)
-		meta_data
-		exit 0
-		;;
-	validate-all)
-		exit 0 # XXX XXX XXX
-		;;
-	*)
-		;;
-esac
-
-[ -n "${OCF_RESKEY_file}" ] || exit $OCF_ERR_ARGS      # Invalid Argument
-[ -f "${OCF_RESKEY_file}" ] || exit $OCF_ERR_INSTALLED # Program not installed
-[ -x "${OCF_RESKEY_file}" ] || exit $OCF_ERR_GENERIC   # Generic error
-
-# Don't need to catch return codes; this one will work.
-ocf_log info "Executing ${OCF_RESKEY_file} $1"
-${OCF_RESKEY_file} $1
-
-declare -i rv=$?
-if [ $rv -ne 0 ]; then
-	ocf_log err "script:$OCF_RESKEY_name: $1 of $OCF_RESKEY_file failed (returned $rv)"
-	exit $OCF_ERR_GENERIC
-fi
diff --git a/rgmanager/src/resources/service.sh b/rgmanager/src/resources/service.sh
deleted file mode 100644
index 04f968d..0000000
--- a/rgmanager/src/resources/service.sh
+++ /dev/null
@@ -1,280 +0,0 @@
-#!/bin/bash
-
-#
-# Dummy OCF script for resource group
-#
-
-# Grab nfs lock tricks if available
-export NFS_TRICKS=1
-if [ -f "$(dirname $0)/svclib_nfslock" ]; then
-	. $(dirname $0)/svclib_nfslock
-	NFS_TRICKS=0
-fi
-
-meta_data()
-{
-    cat <<EOT
-<?xml version="1.0"?>
-<resource-agent version="rgmanager 2.0" name="service">
-    <version>1.0</version>
-
-    <longdesc lang="en">
-        This defines a collection of resources, known as a resource
-        group or cluster service.
-    </longdesc>
-    <shortdesc lang="en">
-        Defines a services.
-    </shortdesc>
-
-    <parameters>
-        <parameter name="name" unique="1" required="1" primary="1">
-            <longdesc lang="en">
-                This is the name of the resource group.
-            </longdesc>
-            <shortdesc lang="en">
-                Name
-            </shortdesc>
-            <content type="string"/>
-        </parameter>
-    
-        <parameter name="domain" reconfig="1">
-            <longdesc lang="en">
-                Fail over domains define lists of cluster members
-                to try in the event that a resource group fails.
-            </longdesc>
-            <shortdesc lang="en">
-                Fail over Domain
-            </shortdesc>
-            <content type="string"/>
-        </parameter>
-
-        <parameter name="autostart" reconfig="1">
-            <longdesc lang="en">
-	    	If set to yes, this resource group will automatically be started
-		after the cluster forms a quorum.  If set to no, this resource
-		group will start in the 'disabled' state after the cluster forms
-		a quorum.
-            </longdesc>
-            <shortdesc lang="en">
-	    	Automatic start after quorum formation
-            </shortdesc>
-            <content type="boolean" default="1"/>
-        </parameter>
-
-        <parameter name="hardrecovery" reconfig="1">
-            <longdesc lang="en">
-	    	If set to yes, the last owner will reboot if this resource
-		group fails to stop cleanly, thus allowing the resource
-		group to fail over to another node.  Use with caution; a
-		badly-behaved resource could cause the entire cluster to
-		reboot.  This should never be enabled if the automatic
-		start feature is used.
-            </longdesc>
-            <shortdesc lang="en">
-	    	Reboot if stop phase fails
-            </shortdesc>
-            <content type="boolean" default="0"/>
-        </parameter>
-
-        <parameter name="exclusive" reconfig="1">
-            <longdesc lang="en">
-	    	If set, this resource group will only relocate to
-		nodes which have no other resource groups running in the
-		event of a failure.  If no empty nodes are available,
-		this resource group will not be restarted after a failure.
-		Additionally, resource groups will not automatically
-		relocate to the node running this resource group.  This
-		option can be overridden by manual start and/or relocate
-		operations.
-            </longdesc>
-            <shortdesc lang="en">
-	        Exclusive resource group
-            </shortdesc>
-            <content type="boolean" default="0"/>
-        </parameter>
-
-	<parameter name="nfslock">
-	    <longdesc lang="en">
-	    	Enable NFS lock workarounds.  When used with a compatible
-		HA-callout program like clunfslock, this could be used
-		to provide NFS lock failover, but at significant cost to
-		other services on the machine.  This requires a compatible
-		version of nfs-utils and manual configuration of rpc.statd;
-		see 'man rpc.statd' to see if your version supports
-		the -H parameter.
-	    </longdesc>
-	    <shortdesc lang="en">
-	        Enable NFS lock workarounds
-	    </shortdesc>
-	    <content type="boolean" default="0"/>
-	</parameter>
-
-	<parameter name="nfs_client_cache">
-            <longdesc lang="en">
-	   	On systems with large numbers of exports, a performance
-		problem in the exportfs command can cause inordinately long
-		status check times for services with lots of mounted
-		NFS clients.  This occurs because exportfs does DNS queries
-		on all clients in the export list.
-
-		Setting this option to '1' will enable caching of the export
-		list returned from the exportfs command on a per-service
-		basis.  The cache will last for 30 seconds before expiring
-		instead of being generated each time an nfsclient resource
-		is called.
-            </longdesc>
-            <shortdesc lang="en">
-	    	Enable exportfs list caching
-            </shortdesc>
-	    <content type="integer" default="0"/>
-	</parameter>
-
-                
-        <parameter name="recovery" reconfig="1">
-            <longdesc lang="en">
-	        This currently has three possible options: "restart" tries
-		to restart failed parts of this resource group locally before
-		attempting to relocate (default); "relocate" does not bother
-		trying to restart the service locally; "disable" disables
-		the resource group if any component fails.  Note that
-		any resource with a valid "recover" operation which can be
-		recovered without a restart will be.
-            </longdesc>
-            <shortdesc lang="en">
-	    	Failure recovery policy
-            </shortdesc>
-            <content type="string" default="restart"/>
-        </parameter>
-
-        <parameter name="depend">
-            <longdesc lang="en">
-		Top-level service this depends on, in "service:name" format.
-            </longdesc>
-            <shortdesc lang="en">
-		Service dependency; will not start without the specified
-		service running.
-            </shortdesc>
-            <content type="string"/>
-        </parameter>
-
-        <parameter name="depend_mode">
-            <longdesc lang="en">
-	    	Dependency mode
-            </longdesc>
-            <shortdesc lang="en">
-		Service dependency mode.
-		hard - This service is stopped/started if its dependency
-		       is stopped/started
-		soft - This service only depends on the other service for
-		       initial startip.  If the other service stops, this
-		       service is not stopped.
-            </shortdesc>
-            <content type="string" default="hard"/>
-        </parameter>
-
-        <parameter name="max_restarts">
-            <longdesc lang="en">
-	    	Maximum restarts for this service.
-            </longdesc>
-            <shortdesc lang="en">
-	    	Maximum restarts for this service.
-            </shortdesc>
-            <content type="string" default="0"/>
-        </parameter>
-
-        <parameter name="restart_expire_time">
-            <longdesc lang="en">
-	    	Restart expiration time
-            </longdesc>
-            <shortdesc lang="en">
-	    	Restart expiration time.  A restart is forgotten
-		after this time.  When combined with the max_restarts
-		option, this lets administrators specify a threshold
-		for when to fail over services.  If max_restarts
-		is exceeded in this given expiration time, the service
-		is relocated instead of restarted again.
-            </shortdesc>
-            <content type="string" default="0"/>
-        </parameter>
-
-    </parameters>
-
-    <actions>
-        <action name="start" timeout="5"/>
-        <action name="stop" timeout="5"/>
-	
-	<!-- No-ops.  Groups are abstract resource types.  -->
-        <action name="status" timeout="5" interval="1h"/>
-        <action name="monitor" timeout="5" interval="1h"/>
-
-        <action name="reconfig" timeout="5"/>
-        <action name="recover" timeout="5"/>
-        <action name="reload" timeout="5"/>
-        <action name="meta-data" timeout="5"/>
-        <action name="validate-all" timeout="5"/>
-    </actions>
-    
-    <special tag="rgmanager">
-        <attributes maxinstances="1"/>
-        <child type="lvm" start="1" stop="9"/>
-        <child type="fs" start="2" stop="8"/>
-        <child type="clusterfs" start="3" stop="7"/>
-        <child type="netfs" start="4" stop="6"/>
-	<child type="nfsexport" start="5" stop="5"/>
-
-	<child type="nfsclient" start="6" stop="4"/>
-
-        <child type="ip" start="7" stop="2"/>
-        <child type="smb" start="8" stop="3"/>
-        <child type="script" start="9" stop="1"/>
-    </special>
-</resource-agent>
-EOT
-}
-
-
-#
-# A Resource group is abstract, but the OCF RA API doesn't allow for abstract
-# resources, so here it is.
-#
-case $1 in
-	start)
-		#
-		# XXX If this is set, we kill lockd.  If there is no
-		# child IP address, then clients will NOT get the reclaim
-		# notification.
-		#
-		if [ $NFS_TRICKS -eq 0 ]; then
-			if [ "$OCF_RESKEY_nfslock" = "yes" ] || \
-	   		   [ "$OCF_RESKEY_nfslock" = "1" ]; then
-				pkill -KILL -x lockd
-			fi
-		fi
-		exit 0
-		;;
-	stop)
-		exit 0
-		;;
-	recover|restart)
-		exit 0
-		;;
-	status|monitor)
-		exit 0
-		;;
-	reload)
-		exit 0
-		;;
-	meta-data)
-		meta_data
-		exit 0
-		;;
-	validate-all)
-		exit 0
-		;;
-	reconfig)
-		exit 0
-		;;
-	*)
-		exit 0
-		;;
-esac
diff --git a/rgmanager/src/resources/smb.sh b/rgmanager/src/resources/smb.sh
deleted file mode 100644
index c2a9d9d..0000000
--- a/rgmanager/src/resources/smb.sh
+++ /dev/null
@@ -1,674 +0,0 @@
-#!/bin/bash
-
-#
-# Script to manage a Samba file-sharing service component.
-# Unline NFS, this should be placed at the top level of a service
-# because it will try to gather information necessary to run the
-# smbd/nmbd daemons at run-time from the service structure.
-#
-
-LC_ALL=C
-LANG=C
-PATH=/bin:/sbin:/usr/bin:/usr/sbin
-export LC_ALL LANG PATH
-
-#
-# Definitions!
-#
-declare SAMBA_CONFIG_DIR=/etc/samba
-declare SMBD_COMMAND=/usr/sbin/smbd
-declare NMBD_COMMAND=/usr/sbin/nmbd
-declare KILLALL_COMMAND=/usr/bin/killall
-declare SAMBA_PID_DIR=/var/run/samba
-declare SAMBA_LOCK_DIR=/var/cache/samba
-
-#
-# gross globals
-#
-declare -a ipkeys
-declare -a fskeys
-
-# Don't change please :)
-_FAIL=255
-
-. $(dirname $0)/ocf-shellfuncs
-
-meta_data()
-{
-    cat <<EOT
-<?xml version="1.0"?>
-<resource-agent version="rgmanager 2.0" name="smb">
-    <version>1.0</version>
-
-    <longdesc lang="en">
-    	Dynamic smbd/nmbd resource agent
-    </longdesc>
-    <shortdesc lang="en">
-    	Dynamic smbd/nmbd resource agent
-    </shortdesc>
-
-    <parameters>
-        <parameter name="name" unique="1" primary="1">
-            <longdesc lang="en">
-                Samba Symbolic Name.  This name will
-		correspond to /etc/samba/smb.conf.NAME
-            </longdesc>
-            <shortdesc lang="en">
-                Samba Name
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="workgroup">
-            <longdesc lang="en">
-	    	Workgroup name
-            </longdesc>
-            <shortdesc lang="en">
-	    	Workgroup name
-            </shortdesc>
-	    <content type="string" default="LINUXCLUSTER"/>
-        </parameter>
-
-        <parameter name="service_name" inherit="service%name">
-            <longdesc lang="en">
-	    	Inherit the service name.  We need to know
-		the service name in order to determine file
-		systems and IPs for this smb service.
-            </longdesc>
-            <shortdesc lang="en">
-	    	Inherit the service name.
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-    </parameters>
-
-    <actions>
-        <action name="start" timeout="0"/>
-        <action name="stop" timeout="0"/>
-
-	<!-- This is just a wrapper for LSB init scripts, so monitor
-	     and status can't have a timeout, nor do they do any extra
-	     work regardless of the depth -->
-        <action name="status" interval="30s" timeout="0"/>
-        <action name="monitor" interval="30s" timeout="0"/>
-
-        <action name="meta-data" timeout="0"/>
-        <action name="validate-all" timeout="0"/>
-    </actions>
-</resource-agent>
-EOT
-}
-
-
-#
-# Usage: ccs_get key
-#
-ccs_get()
-{
-	declare outp
-	declare key
-
-	[ -n "$1" ] || return $_FAIL
-
-	key="$*"
-
-	outp=$(ccs_tool query "$key" 2>&1)
-	if [ $? -ne 0 ]; then
-		if [ "$outp" = "${outp/No data available/}" ] || [ "$outp" = "${outp/Operation not permitted/}" ]; then
-			ocf_log err "$outp ($key)"
-			return $_FAIL
-		fi
-
-		# no real error, just no data available
-		return 0
-	fi
-
-	echo $outp
-
-	return 0
-}
-
-
-#
-# Build a list of service IP keys; traverse refs if necessary
-#
-get_service_ip_keys()
-{
-	declare svc=$1
-	declare -i x y=0
-	declare outp
-	declare key
-
-	#
-	# Find service-local IP keys
-	#
-	x=1
-	while : ; do
-		key="/cluster/rm/service[@name=\"$svc\"]/ip[$x]"
-
-		#
-		# Try direct method
-		#
-		outp=$(ccs_get "$key/@address")
-		if [ $? -ne 0 ]; then
-			return 1
-		fi
-
-		#
-		# Try by reference
-		#
-		if [ -z "$outp" ]; then
-			outp=$(ccs_get "$key/@ref")
-			if [ $? -ne 0 ]; then
-				return 1
-			fi
-			key="/cluster/rm/resources/ip[@address=\"$outp\"]"
-		fi
-
-		if [ -z "$outp" ]; then
-			break
-		fi
-
-		#ocf_log debug "IP $outp found @ $key"
-
-		ipkeys[$y]="$key"
-
-		((y++))
-		((x++))
-	done
-
-	ocf_log debug "$y IP addresses found for $svc/$OCF_RESKEY_name"
-
-	return 0
-}
-
-
-#
-# Build a list of service fs keys, traverse refs if necessary
-#
-get_service_fs_keys()
-{
-	declare svc=$1
-	declare -i x y=0
-	declare outp
-	declare key
-
-	#
-	# Find service-local IP keys
-	#
-	x=1
-	while : ; do
-		key="/cluster/rm/service[@name=\"$svc\"]/fs[$x]"
-
-		#
-		# Try direct method
-		#
-		outp=$(ccs_get "$key/@name")
-		if [ $? -ne 0 ]; then
-			return 1
-		fi
-
-		#
-		# Try by reference
-		#
-		if [ -z "$outp" ]; then
-			outp=$(ccs_get "$key/@ref")
-			if [ $? -ne 0 ]; then
-				return 1
-			fi
-			key="/cluster/rm/resources/fs[@name=\"$outp\"]"
-		fi
-
-		if [ -z "$outp" ]; then
-			break
-		fi
-
-		#ocf_log debug "filesystem $outp found @ $key"
-
-		fskeys[$y]="$key"
-
-		((y++))
-		((x++))
-	done
-
-	ocf_log debug "$y filesystems found for $svc/$OCF_RESKEY_name"
-
-	return 0
-}
-
-
-build_ip_list()
-{
-	declare ipaddrs ipaddr
-	declare -i x=0
-
-	while [ -n "${ipkeys[$x]}" ]; do
-		ipaddr=$(ccs_get "${ipkeys[$x]}/@address")
-		if [ -z "$ipaddr" ]; then
-			break
-		fi
-
-		ipaddrs="$ipaddrs $ipaddr"
-
-		((x++))
-	done
-
-	echo $ipaddrs
-}
-
-
-add_sha1()
-{
-	declare sha1line="# rgmanager-sha1 $(sha1sum "$1")"
-	echo $sha1line >> "$1"
-}
-
-
-verify_sha1()
-{
-	declare tmpfile="$(mktemp /tmp/smb-$OCF_RESKEY_name.tmp.XXXXXX)"
-	declare current exp
-
-	exp=$(grep "^# rgmanager-sha1.*$1" "$1" | head -1)
-	if [ -z "$exp" ]; then
-		# No sha1 line.  We're done.
-		ocf_log debug "No SHA1 info in $1"
-		return 1
-	fi
-
-	#
-	# Find expected sha1 and expected file name
-	#
-	exp=${exp/*sha1 /}
-	exp=${exp/ */}
-
-	grep -v "^# rgmanager-sha1" "$1" > "$tmpfile"
-	current=$(sha1sum "$tmpfile")
-	current=${current/ */}
-
-	rm -f "$tmpfile"
-
-	if [ "$current" = "$exp" ]; then
-		ocf_log debug "SHA1 sum matches for $1"
-		return 0
-	fi
-	ocf_log debug "SHA1 sum does not match for $1"
-	return 1
-}
-
-
-add_fs_entries()
-{
-	declare conf="$1"
-	declare sharename
-	declare sharepath key
-
-	declare -i x=0
-
-	while [ -n "${fskeys[$x]}" ]; do
-		key="${fskeys[$x]}/@name"
-
-		sharename=$(ccs_get "$key")
-		if [ -z "$sharename" ]; then
-			break
-		fi
-
-		key="${fskeys[$x]}/@mountpoint"
-		sharepath=$(ccs_get "$key")
-		if [ -z "$sharepath" ]; then
-			break
-		fi
-
-		cat >> "$conf" <<EODEV
-[$sharename]
-	comment = Auto-generated $sharename share
-	# Hide the secret cluster files
-	veto files = /.clumanager/.rgmanager/
-	browsable = yes
-	writable = no
-	public = yes
-	path = $sharepath
-
-EODEV
-
-		((x++))
-	done
-}
-
-
-#
-# Generate the samba configuration if neede for this service.
-#
-gen_smb_conf()
-{
-	declare conf="$1"
-	declare lvl="debug"
-
-	if [ -f "$conf" ]; then
-		verify_sha1 "$conf"
-		if [ $? -ne 0 ]; then
-			ocf_log debug "Config file changed; skipping"
-			return 0
-		fi
-	else
-		lvl="info"
-	fi
-
-	ocf_log $lvl "Creating $conf"
-
-	get_service_ip_keys "$OCF_RESKEY_service_name"
-	get_service_fs_keys "$OCF_RESKEY_service_name"
-
-	cat > "$conf" <<EOT
-#
-# "$conf"
-#
-# This template configuration wass automatically generated, and will
-# be automatically regenerated if removed.  Please modify this file to
-# speficy subdirectories and/or client access permissions.
-#
-# Once this file has been altered, automatic re-generation will stop.
-# Remember to copy this file to all other cluster members after making
-# changes, or your SMB service will not operate correctly.
-#
-# From a cluster perspective, the key fields are:
-#     lock directory - must be unique per samba service.
-#     bind interfaces only - must be present set to yes.
-#     interfaces - must be set to service floating IP address.
-#     path - must be the service mountpoint or subdirectory thereof.
-#
-
-[global]
-        workgroup = $OCF_RESKEY_workgroup
-        pid directory = /var/run/samba/$OCF_RESKEY_name
-        lock directory = /var/cache/samba/$OCF_RESKEY_name
-	log file = /var/log/samba/%m.log
-	#private dir = /var/
-	encrypt passwords = yes
-	bind interfaces only = yes
-	netbios name = ${OCF_RESKEY_name/ /_}
-
-	#
-	# Interfaces are based on ip resources at the top level of
-	# "$OCF_RESKEY_service_name"; IPv6 addresses may or may not
-	# work correctly.
-	#
-	interfaces = $(build_ip_list)
-
-#
-# Shares based on fs resources at the top level of "$OCF_RESKEY_service_name"
-#
-EOT
-	add_fs_entries "$conf"
-	add_sha1 "$conf"
-
-	return 0
-}
-
-
-#
-# Kill off the specified PID
-# (from clumanager 1.0.x/1.2.x)
-#
-# Killing off the samba daemons was miserable to implement, merely
-# because killall doesn't distinguish by program commandline.
-# Consequently I had to implement these routines to selectively pick 'em off.
-#
-# Kills of either the {smbd|nmbd} which is running and was started with
-# the specified argument.  Can't use `killall` to do this because it
-# doesn't allow you to distinguish which process to kill based on any
-# of the program arguments.
-#
-# This routine is also called on "status" checks.  In this case it doesn't
-# actually kill anything.
-#
-# Parameters:
-#       daemonName - daemon name, can be either smbd or nmbd
-#       command - [stop|start|status]
-#       arg     - argument passed to daemon.  In this case its not the
-#                 full set of program args, rather its really just the
-#                 samba config file.
-#
-# Returns: 0 - success (or the daemon isn't currently running)
-#          1 - failure
-#
-kill_daemon_by_arg()
-{
-    	declare daemonName=$1
-	declare action=$2
-	declare arg=$3
-	# Create a unique temporary file to stash off intermediate results
-	declare tmpfile_str=/tmp/sambapids.XXXXXX
-	declare tmpfile
-	declare ret
-
-	tmpfile=$(mktemp $tmpfile_str); ret_val=$?
-
-	if [ -z "$tmpfile" ]; then
-		ocf_log err "kill_daemon_by_arg: Can't create tmp file"
-		return $_FAIL
-	fi
-
-	# Mumble, need to strip off the /etc/samba portion, otherwise the
-	# grep pattern matching will fail.
-	declare confFile="$(basename $arg)"
-
-	# First generate a list of candidate pids.
-	pidof $daemonName > $tmpfile
-	if [ $? -ne 0 ]; then
-		ocf_log debug "kill_daemon_by_arg: no pids for $daemonName"
-		rm -f $tmpfile
-		case "$action" in
-		'stop')
-			return 0
-		;;
-		'status')
-			return $_FAIL
-		;;
-		esac
-		return 0
-	fi
-
-	# If you don't find any matching daemons for a "stop" operation, thats
-	# considered success; whereas for "status" inquiries its a failure.
-	case "$action" in
-	'stop')
-		ret=0
-	;;
-	'status')
-		ret=$_FAIL
-	;;
-	esac
-	#
-	# At this point tmpfile contains a set of pids for the corresponding
-	# {smbd|nmbd}.  Now look though this candidate set of pids and compare
-	# the program arguments (samba config file name).  This distinguishes
-	# which ones should be killed off.
-	#
-	declare daemonPid=""
-	for daemonPid in $(cat $tmpfile); do
-		declare commandLine=$(cat /proc/$daemonPid/cmdline)
-		declare confBase="$(basename $commandLine)"
-		if [ "$confBase" = "$confFile" ]; then
-			case "$action" in
-			'status')
-				rm -f $tmpfile
-				return 0
-			;;
-			esac
-			kill_daemon_pid $daemonPid
-			if [ $? -ne 0 ]; then
-				ret=$_FAIL
-				ocf_log err \
-				"kill_daemon_by_arg: kill_daemon_pid $daemonPid failed"
-			else
-				ocf_log debug \
-				 "kill_daemon_by_arg: kill_daemon_pid $daemonPid success"
-			fi
-		fi
-	done
-	rm -f $tmpfile
-	return $ret
-}
-
-
-#
-# Kill off the specified PID
-# (from clumanager 1.0.x/1.2.x)
-#
-kill_daemon_pid()
-{
-	declare pid=$1
-	declare retval=0
-
-
-	kill -TERM $pid
-	if [ $? -eq 0 ]; then
-		ocf_log debug "Samba: successfully killed $pid"
-	else
-		ocf_log debug "Samba: failed to kill $pid"
-		retval=$_FAIL
-	fi
-	return $retval
-}
-
-
-share_start_stop()
-{
-	declare command=$1
-	declare conf="$SAMBA_CONFIG_DIR/smb.conf.$OCF_RESKEY_name"
-	declare smbd_command
-	declare nmbd_command
-	declare netbios_name
-	
-	#
-	# Specify daemon options
-	# -D = spawn off as separate daemon
-	# -s = the following arg specifies the config file
-	#
-	declare smbd_options="-D -s"
-	declare nmbd_options="-D -s"
-
-	if [ "$command" = "start" ]; then
-		gen_smb_conf "$conf"
-	else 
-		if ! [ -f "$conf" ]; then
-			ocf_log warn "\"$conf\" missing during $command"
-		fi
-	fi
-
-	#
-	# On clusters with multiple samba shares, we need to ensure (as much
-	# as possible) that each service is advertised as a separate netbios
-	# name.
-	#
-	# Generally, the admin sets this in smb.conf.NAME - but since
-	# it is not required, we need another option.  Consequently, we use
-	# smb instance name (which must be unique)
-	#
-	if [ -f "$conf" ]; then
-		grep -qe "^\([[:space:]]\+n\|n\)etbios[[:space:]]\+name[[:space:]]*=[[:space:]]*[[:alnum:]]\+" "$conf"
-		if [ $? -ne 0 ]; then
-
-			netbios_name=$OCF_RESKEY_name
-
-			ocf_log notice "Using $netbios_name as NetBIOS name (service $OCF_RESKEY_service_name)"
-			nmbd_options=" -n $netbios_name $nmbd_options"
-		fi
-	fi
-
-	case $command in
-	start)
-		ocf_log info "Starting Samba instance \"$OCF_RESKEY_name\""
-		mkdir -p "$SAMBA_PID_DIR/$OCF_RESKEY_name"
-		mkdir -p "$SAMBA_LOCK_DIR/$OCF_RESKEY_name"
-
-		# Kick off the per-service smbd
-		$SMBD_COMMAND $smbd_options "$conf"
-		ret_val=$?
-		if [ $ret_val -ne 0 ]; then
-			ocf_log err "Samba service failed: $SMBD_COMMAND $smbd_options \"$conf\""
-			return $_FAIL
-		fi
-		ocf_log debug "Samba service succeeded: $SMBD_COMMAND $smbd_options \"$conf\""
-
-		# Kick off the per-service nmbd
-		$NMBD_COMMAND $nmbd_options "$conf"
-		ret_val=$?
-		if [ $ret_val -ne 0 ]; then
-			ocf_log err "Samba service failed: $NMBD_COMMAND $nmbd_options \"$conf\""
-			return $_FAIL
-		fi
-		ocf_log debug "Samba service succeeded: $NMBD_COMMAND $nmbd_options \"$conf\""
-	;;
-	stop)
-		ocf_log info "Stopping Samba instance \"$OCF_RESKEY_name\""
-
-       		kill_daemon_by_arg "nmbd" $command "$conf"
-       		kill_daemon_by_arg "smbd" $command "$conf"
-       		if [ "$SAMBA_PID_DIR/$OCF_RESKEY_name" != "/" ]; then
-       			pushd "$SAMBA_PID_DIR" &> /dev/null
-       			rm -rf "$OCF_RESKEY_name"
-	       		popd &> /dev/null
-		fi
-		if [ "$SAMBA_LOCK_DIR/$OCF_RESKEY_name" != "/" ]; then
-     			pushd "$SAMBA_LOCK_DIR" &> /dev/null
-			rm -rf "$OCF_RESKEY_name"
-			popd &> /dev/null
-		fi
-	;;
-	status)
-		ocf_log debug "Checking Samba instance \"$OCF_RESKEY_name\""
-		kill_daemon_by_arg "nmbd" $command "$conf"
-		if [ $? -ne 0 ]; then
-			ocf_log err \
-			"share_start_stop: nmbd for service $svc_name died!"
-			return $_FAIL
-		fi
-		kill_daemon_by_arg "smbd" $command "$conf"
-		if [ $? -ne 0 ]; then
-			ocf_log err \
-		"share_start_stop: nmbd for service $svc_name died!"
-			return $_FAIL
-		fi
-	;;
-	esac
-}
-
-
-verify_all()
-{
-	[ -z "$OCF_RESKEY_workgroup" ] && export OCF_RESKEY_workgroup="LINUXCLUSTER"
-	[ -n "${OCF_RESKEY_name}" ] || exit $OCF_ERR_ARGS      # Invalid Argument
-	if [ -z "${OCF_RESKEY_service_name}" ]; then
-		ocf_log ERR "Samba service ${OCF_RESKEY_name} is not the child of a service"
-		exit $OCF_ERR_ARGS
-	fi
-}
-
-case $1 in
-	meta-data)
-		meta_data
-		exit 0
-	;;
-	start|stop)
-		verify_all
-		share_start_stop $1
-		exit $?
-	;;
-	status|monitor)
-		verify_all
-		share_start_stop status
-		exit $?
-	;;
-	validate-all)
-		verify_all
-		echo "Yer radio's workin', driver!"
-		exit 0
-	;;
-	*)
-		echo "usage: $0 {start|stop|status|monitor|meta-data|validate-all}"
-		exit $OCF_ERR_UNIMPLEMENTED
-	;;
-esac
-
diff --git a/rgmanager/src/resources/svclib_nfslock b/rgmanager/src/resources/svclib_nfslock
deleted file mode 100644
index f69a57c..0000000
--- a/rgmanager/src/resources/svclib_nfslock
+++ /dev/null
@@ -1,260 +0,0 @@
-#!/bin/bash
-# Do reclaim-broadcasts when we kill lockd during shutdown/startup
-# of a cluster service.
-#
-# Exported functions:
-#
-#  notify_list_store
-#  notify_list_merge
-#  notify_list_broadcast
-#
-
-#
-# Usage:
-# statd_notify <directory> <hostname|ip>
-#
-# Copy out a list from <directory>, merge them with the system nfs lock
-# list, and send them out as <hostname|ip> after generating a random
-# state (needed so clients will reclaim their locks)
-#
-nfslock_statd_notify()
-{
-	declare tmpdir=$(mktemp -d /tmp/statd-$2.XXXXXX)
-	declare nl_dir=$1
-	declare nl_ip=$2
-	declare command		# Work around bugs in rpc.statd
-	declare pid_xxx		# Work around bugs in rpc.statd
-	declare owner
-
-	[ -z "$lockd_pid" ] && return 0
-	if ! [ -d $nl_dir ]; then
-		return 0
-	fi
-
-	if [ -z "`ls $nl_dir/sm/* 2> /dev/null`" ]; then
-		ocf_log debug "No hosts to notify"
-		return 0
-	fi
-
-	# Ok, copy the HA directory to something we can use.
-       	mkdir -p $tmpdir/sm
-	
-	# Copy in our specified entries
-	cp -f $nl_dir/sm/* $tmpdir/sm
-
-	# Copy in our global entries
-	# XXX This might be what we just copied.
-
-	if [ -d "/var/lib/nfs/statd/sm" ]; then
-		owner=$(ls -dl /var/lib/nfs/statd/sm | awk '{print $3"."$4}')
-		cp -f /var/lib/nfs/statd/sm/* $tmpdir/sm
-	elif [ -d "/var/lib/nfs/sm" ]; then
-		owner=$(ls -dl /var/lib/nfs/statd/sm | awk '{print $3"."$4}')
-		cp -f /var/lib/nfs/sm/* $tmpdir/sm
-	fi
-
-	#
-	# Generate a random state file.  If this ends up being what a client
-	# already has in its list, that's bad, but the chances of this
-	# are small - and relocations should be rare.
-	#
-	dd if=/dev/urandom of=$tmpdir/state bs=1 count=4 &> /dev/null
-
-	#
-	# Make sure we set permissions, or statd will not like it.
-	#
-	chown -R $owner $tmpdir
-
-	#
-	# Tell rpc.statd to notify clients.  Don't go into background, 
-	# because statd is buggy and won't exit like it's supposed to after
-	# sending the notifications out.
-	#
-	ocf_log info "Sending reclaim notifications via $nl_ip"
-	command="rpc.statd -NFP $tmpdir -n $nl_ip"
-	eval $command 2>&1 &
-	sleep 3 # XXX - the instance of rpc.statd we just spawned is supposed
-	        # to exit after it finishes notifying clients.
-	        # rpc.statd spawned which is still running handles the actual
-	        # new SM_MON requests... we hope 3 seconds is enough time
-	        # to get all the SM_NOTIFY messages out.  rpc.statd = bugged
-	#
-	# clean up
-	#
-	pid_xxx=`ps auwwx | grep "$command" | grep -v grep | awk '{print $2}'`
-	kill $pid_xxx
-	rm -rf $tmpdir
-
-	return 0
-}
-
-
-#
-# Copy of isSlave from svclib_ip and/or ip.sh
-#
-nfslock_isSlave()
-{
-        declare intf=$1
-        declare line
-
-        if [ -z "$intf" ]; then
-                ocf_log err "usage: isSlave <I/F>"
-                return 1
-        fi
-
-        line=$(/sbin/ip link list dev $intf)
-        if [ $? -ne 0 ]; then
-                ocf_log err "$intf not found"
-                return 1
-        fi
-
-        if [ "$line" = "${line/<*SLAVE*>/}" ]; then
-                return 2
-        fi
-
-        # Yes, it is a slave device.  Ignore.
-        return 0
-}
-
-
-#
-# Get all the IPs on the system except loopback IPs
-#
-nfslock_ip_address_list()
-{
-        declare idx dev family ifaddr
-
-        while read idx dev family ifaddr; do
-
-		if [ "$family" != "inet" ] && [ "$family" != "inet6" ]; then
-			continue
-		fi
-
-		if [ "$dev" = "lo" ]; then
-			# Ignore loopback
-			continue
-		fi
-
-                nfslock_isSlave $dev
-                if [ $? -ne 2 ]; then
-                        continue
-                fi
-
-                idx=${idx/:/}
-
-                echo $dev $family ${ifaddr/\/*/} ${ifaddr/*\//}
-
-        done < <(/sbin/ip -o addr list | awk '{print $1,$2,$3,$4}')
-
-        return 0
-}
-	
-
-#
-# Usage: broadcast_notify <state_directory>
-#
-# Send the contents of <state_directory> out via all IPs on the system.
-#
-notify_list_broadcast()
-{
-        declare dev family addr maskbits ip_name
-	declare lockd_pid=$(pidof lockd)
-	declare nl_dir=$1
-
-	# First of all, send lockd a SIGKILL.  We hope nfsd is running.
-	# If it is, this will cause lockd to reset the grace period for
-	# lock reclaiming.
-	if [ -n "$lockd_pid" ]; then
-		ocf_log info "Asking lockd to drop locks (pid $lockd_pid)"
-		kill -9 $lockd_pid
-	else
-		ocf_log warning "lockd not running; cannot notify clients"
-		return 1
-	fi
-	
-        while read dev family addr maskbits; do
-		if [ "$family" != "inet" ]; then
-			continue
-		fi
-
-		ip_name=$(clufindhostname -i $addr)
-		if [ -z "$ip_name" ]; then
-			nfslock_statd_notify $nl_dir $addr
-		else
-			nfslock_statd_notify $nl_dir $ip_name
-		fi
-
-	done < <(nfslock_ip_address_list)
-}
-
-
-#
-# Store the lock monitor list from rpc.statd - do this during a teardown
-# after the IP addresses of a service have been taken offline.  Note that
-# this should be done by HA-callout programs, but this feature is not in
-# RHEL3. 
-#
-notify_list_store()
-{
-	declare nl_dir=$1
-	declare owner
-
-	mkdir -p $nl_dir/sm
-
-	if [ -d "/var/lib/nfs/statd/sm" ]; then
-	        if [ -z "`ls /var/lib/nfs/statd/sm/* 2> /dev/null`" ]; then
-			return 1
-			# nothing to do!
-		fi
-
-		owner=$(ls -dl /var/lib/nfs/statd/sm | awk '{print $3"."$4}')
-		cp -af /var/lib/nfs/statd/sm/* $nl_dir/sm
-		chown -R $owner $nl_dir
-		return 0
-	elif [ -d "/var/lib/nfs/sm" ]; then
-	        if [ -z "`ls /var/lib/nfs/sm/* 2> /dev/null`" ]; then
-			return 1
-			# nothing to do!
-		fi
-
-		owner=$(ls -dl /var/lib/nfs/sm | awk '{print $3"."$4}')
-		cp -af /var/lib/nfs/sm/* $nl_dir/sm
-		chown -R $owner $nl_dir
-		return 0
-	fi
-
-	return 1
-}
-
-
-#
-# Merge the contents of <nl_dir>/sm with the system-wide list
-# Make sure ownership is right, or statd will hiccup.  This should not
-# actually ever be needed because statd will, upon getting a SM_MON
-# request, create all the entries in this list.  It's mostly for
-# housekeeping for next time we relocate the service.
-#
-notify_list_merge()
-{
-	declare nl_dir=$1
-	declare owner
-
-	if [ -z "`ls $nl_dir/* 2> /dev/null`" ]; then
-		return 1
-	fi
-
-	if [ -d "/var/lib/nfs/statd/sm" ]; then
-		owner=$(ls -dl /var/lib/nfs/statd/sm | awk '{print $3"."$4}')
- 		cp -af $nl_dir/sm/* /var/lib/nfs/statd/sm
-		chown -R $owner $nl_dir
-		return 0
-	elif [ -d "/var/lib/nfs/sm" ]; then
-		owner=$(ls -dl /var/lib/nfs/sm | awk '{print $3"."$4}')
- 		cp -af $nl_dir/sm/* /var/lib/nfs/sm
-		chown -R $owner $nl_dir
-		return 0
-	fi
-
-	return 1
-}
-
diff --git a/rgmanager/src/resources/tomcat-5.metadata b/rgmanager/src/resources/tomcat-5.metadata
deleted file mode 100644
index 021bef7..0000000
--- a/rgmanager/src/resources/tomcat-5.metadata
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0"?>
-<resource-agent version="rgmanager 2.0" name="tomcat-5">
-    <version>1.0</version>
-
-    <longdesc lang="en">
-        This defines an instance of Tomcat server
-    </longdesc>
-    <shortdesc lang="en">
-        Defines a Tomcat server
-    </shortdesc>
-
-    <parameters>
-        <parameter name="name" primary="1">
-	    <longdesc lang="en">
-	        Specifies a service name for logging and other purposes
-	    </longdesc>
-            <shortdesc lang="en">
-                Name
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-
-        <parameter name="config_file">
-            <longdesc lang="en">
-                Define absolute path to configuration file
-            </longdesc>
-            <shortdesc lang="en">
-                Config File
-            </shortdesc>
-	    <content type="string" default="/etc/tomcat5/tomcat5.conf"/>
-        </parameter>
-
-	<parameter name="tomcat_user">
-		<longdesc lang="en">
-			User who runs the Tomcat server
-		</longdesc>
-		<shortdesc lang="en">
-			User who runs the Tomcat server
-		</shortdesc>
-		<content type="string" default="tomcat" />
-	</parameter>
-
-	<parameter name="catalina_options">
-		<longdesc lang="en">
-			Other command-line options for Catalina
-		</longdesc>
-		<shortdesc lang="en">
-			Other command-line options for Catalina
-		</shortdesc>
-		<content type="string" />
-	</parameter>
-
-	<parameter name="catalina_base">
-		<longdesc lang="en">
-			Cataliny base directory
-		</longdesc>
-		<shortdesc lang="en">
-			Catalina base directory (differs for each service)
-		</shortdesc>
-		<content type="string" default="/usr/share/tomcat5" />
-	</parameter>
-
-	<parameter name="shutdown_wait">
-		<longdesc lang="en">
-			Wait X seconds for correct end of service shutdown
-		</longdesc>
-		<shortdesc lang="en">
-			Wait X seconds for correct end of service shutdown
-		</shortdesc>
-		<content type="integer" default="30" />
-	</parameter>
-
-        <parameter name="service_name" inherit="service%name">
-            <longdesc lang="en">
-	    	Inherit the service name.  We need to know
-		the service name in order to determine file
-		systems and IPs for this service.
-            </longdesc>
-            <shortdesc lang="en">
-	    	Inherit the service name.
-            </shortdesc>
-	    <content type="string"/>
-        </parameter>
-    </parameters>
-
-    <actions>
-        <action name="start" timeout="0"/>
-	<action name="stop" timeout="0"/>
-
-	<!-- Checks to see if it''s mounted in the right place -->
-	<action name="status" interval="1m" timeout="10"/>
-	<action name="monitor" interval="1m" timeout="10"/>
-
-	<!-- Checks to see if we can read from the mountpoint -->
-	<action name="status" depth="10" timeout="30" interval="5m"/>
-	<action name="monitor" depth="10" timeout="30" interval="5m"/>
-
-	<action name="meta-data" timeout="0"/>
-	<action name="validate-all" timeout="0"/>
-    </actions>
-
-    <special tag="rgmanager">
-    </special>
-</resource-agent>
diff --git a/rgmanager/src/resources/tomcat-5.sh b/rgmanager/src/resources/tomcat-5.sh
deleted file mode 100644
index 37a5a21..0000000
--- a/rgmanager/src/resources/tomcat-5.sh
+++ /dev/null
@@ -1,256 +0,0 @@
-#!/bin/bash
-
-export LC_ALL=C
-export LANG=C
-export PATH=/bin:/sbin:/usr/bin:/usr/sbin
-
-. $(dirname $0)/ocf-shellfuncs
-. $(dirname $0)/utils/config-utils.sh
-. $(dirname $0)/utils/messages.sh
-. $(dirname $0)/utils/ra-skelet.sh
-
-declare TOMCAT_TOMCAT=/usr/bin/dtomcat5
-declare TOMCAT_RELINK=/usr/share/tomcat5/bin/relink
-declare TOMCAT_pid_file="`generate_name_for_pid_file`"
-declare TOMCAT_conf_dir="`generate_name_for_conf_dir`/conf"
-declare TOMCAT_gen_config_file="$TOMCAT_conf_dir/server.xml"
-declare TOMCAT_gen_catalina_base="`generate_name_for_conf_dir`"
-
-declare JAVA_HOME
-declare CATALINA_HOME
-declare CATALINA_BASE
-declare CATALINA_TMPDIR
-declare CLASSPATH
-declare TOMCAT_USER
-##
-
-verify_all()
-{
-	clog_service_verify $CLOG_INIT
-
-	if [ -z "$OCF_RESKEY_name" ]; then
-		clog_service_verify $CLOG_FAILED "Invalid Name Of Service"
-		return $OCF_ERR_ARGS
-	fi
-
-	if [ -z "$OCF_RESKEY_service_name" ]; then
-		clog_service_verify $CLOG_FAILED_NOT_CHILD
-		return $OCF_ERR_ARGS
-	fi
-
-	if [ -z "$OCF_RESKEY_config_file" ]; then
-		clog_check_file_exist $CLOG_FAILED_INVALID "$OCF_RESKEY_config_file"
-		clog_service_verify $CLOG_FAILED
-		return $OCF_ERR_ARGS
-	fi
-
-	if [ ! -r "$OCF_RESKEY_config_file" ]; then
-		clog_check_file_exist $CLOG_FAILED_NOT_READABLE $OCF_RESKEY_config_file
-		clog_service_verify $CLOG_FAILED
-		return $OCF_ERR_ARGS
-	fi
-
-	. "$OCF_RESKEY_config_file"
-	
-	if [ $? -ne 0 ]; then
-		clog_service_verify $CLOG_FAILED "Error In The File \"$OCF_RESKEY_config_file\""
-		return $OCF_ERR_ARGS
-	fi 
-
-	if [ -z "$JAVA_HOME" ]; then
-		clog_service_verify $CLOG_FAILED "JAVA_HOME Not Specified In ${OCF_RESKEY_config_file}"
-		return $OCF_ERR_ARGS;
-	fi	
-
-	if [ ! -d "$JAVA_HOME" ]; then
-		clog_service_verify $CLOG_FAILED "JAVA_HOME Does Not Exist"
-		return $OCF_ERR_ARGS;
-	fi
-
-	if [ -z "$JAVA_ENDORSED_DIRS" ]; then
-		clog_service_verify $CLOG_FAILED "JAVA_ENDORSED_DIRS Not Specified In ${OCF_RESKEY_config_file}"
-		return $OCF_ERR_ARGS;
-	fi	
-
-	if [ ! -d "$JAVA_ENDORSED_DIRS" ]; then
-		clog_service_verify $CLOG_FAILED "JAVA_ENDORSED_DIRS Does Not Exist"
-		return $OCF_ERR_ARGS;
-	fi
-
-	if [ -z "$CATALINA_HOME" ]; then
-		clog_service_verify $CLOG_FAILED "CATALINA_HOME Not Specified In ${OCF_RESKEY_config_file}"
-		return $OCF_ERR_ARGS;
-	fi	
-
-	if [ ! -d "$CATALINA_HOME" ]; then
-		clog_service_verify $CLOG_FAILED "CATALINA_HOME Does Not Exist"
-		return $OCF_ERR_ARGS;
-	fi
-
-	if [ -z "$CATALINA_TMPDIR" ]; then
-		clog_service_verify $CLOG_FAILED "CATALINA_TMPDIR Not Specified In ${OCF_RESKEY_config_file}"
-		return $OCF_ERR_ARGS;
-	fi	
-
-	if [ ! -d "$CATALINA_TMPDIR" ]; then
-		clog_service_verify $CLOG_FAILED "CATALINA_TMPDIR Does Not Exist"
-		return $OCF_ERR_ARGS;
-	fi
-
-	if [ -z "$TOMCAT_USER" ]; then
-		clog_service_verify $CLOG_FAILED "TOMCAT_USER Does Not Exist"
-		return $OCF_ERR_ARGS;
-	fi
-
-	clog_service_verify $CLOG_SUCCEED
-		
-	return 0
-}
-
-generate_config_file()
-{
-	declare original_file="$1"
-	declare generated_file="$2"
-	declare ip_addresses="$3"
-
-	if [ -f "$generated_file" ]; then
-		sha1_verify "$generated_file"
-		if [ $? -ne 0 ]; then
-			clog_check_sha1 $CLOG_FAILED
-			return 0
-		fi
-	fi	
-
-	clog_generate_config $CLOG_INIT "$original_file" "$generated_file"
-
-#	generate_configTemplate "$generated_file" "$original_file"
-	$(dirname $0)/utils/tomcat-parse-config.pl $ip_addresses < "$original_file" >> "$generated_file"
-
-        sha1_addToFile "$generated_file"
-	clog_generate_config $CLOG_SUCCEED "$original_file" "$generated_file"
-               
-	return 0;
-}
-
-start()
-{
-	clog_service_start $CLOG_INIT
-
-	create_pid_directory
-	create_conf_directory "$TOMCAT_conf_dir"
-	check_pid_file "$TOMCAT_pid_file"
-
-	if [ $? -ne 0 ]; then
-		clog_check_pid $CLOG_FAILED "$TOMCAT_pid_file"
-		clog_service_start $CLOG_FAILED
-		return $OCF_ERR_GENERIC
-	fi
-	clog_looking_for $CLOG_INIT "IP Addresses"
-
-        get_service_ip_keys "$OCF_RESKEY_service_name"
-        ip_addresses=`build_ip_list`
-
-	if [ -z "$ip_addresses" ]; then
-		clog_looking_for $CLOG_FAILED_NOT_FOUND "IP Addresses"
-		return $OCF_ERR_GENERIC
-	fi
-	
-	clog_looking_for $CLOG_SUCCEED "IP Addresses"
-	generate_config_file "$OCF_RESKEY_catalina_base/conf/server.xml" "$TOMCAT_gen_config_file" "$ip_addresses"
-	ln -s "$OCF_RESKEY_catalina_base"/* "$TOMCAT_gen_catalina_base" &> /dev/null
-	ln -s "$OCF_RESKEY_catalina_base"/conf/* "$TOMCAT_gen_catalina_base"/conf &> /dev/null
-	
-	CLASSPATH="$JAVA_HOME"/lib/tools.jar:"$CATALINA_HOME"/bin/bootstrap.jar:"$CATALINA_HOME"/bin/commons-logging-api.jar:`/usr/bin/build-classpath mx4j/mx4j-impl`:`/usr/bin/build-classpath mx4j/mx4j-jmx`
-
-	sudo -u "$TOMCAT_USER" "$JAVA_HOME/bin/java" $JAVA_OPTS $OCF_RESKEY_catalina_options \
-		-Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
-		-Dcatalina.base="$TOMCAT_gen_catalina_base" \
-		-Dcatalina.home="$CATALINA_HOME" \
-		-Djava.io.tmpdir="$CATALINA_TMPDIR" \
-		org.apache.catalina.startup.Bootstrap "$@" start \
-		>> "$TOMCAT_gen_catalina_base"/logs/catalina.out 2>&1 &
-	                                                
-
-	if [ $? -ne 0 ]; then
-		clog_service_start $CLOG_FAILED
-		return $OCF_ERR_GENERIC
-	fi
-
-	if [ -z "$!" ]; then
-		clog_service_start $CLOG_FAILED
-		return $OCF_ERR_GENERIC
-	fi
-	
-	echo $! > "$TOMCAT_pid_file"
-
-	clog_service_start $CLOG_SUCCEED
-
-	return 0;
-}
-
-stop()
-{
-	clog_service_stop $CLOG_INIT
-
-	stop_generic "$TOMCAT_pid_file" "$OCF_RESKEY_shutdown_wait"
-	
-	if [ $? -ne 0 ]; then
-		clog_service_stop $CLOG_FAILED
-		return $OCF_ERR_GENERIC
-	fi
-
-        if [ -e "$TOMCAT_pid_file" ]; then
-		rm -f "$TOMCAT_pid_file"
-	fi
-                                
-	clog_service_stop $CLOG_SUCCEED
-	return 0;
-}
-
-status()
-{
-	clog_service_status $CLOG_INIT
-
-	status_check_pid "$TOMCAT_pid_file"
-	if [ $? -ne 0 ]; then
-		clog_service_status $CLOG_FAILED "$TOMCAT_pid_file"
-		return $OCF_ERR_GENERIC
-	fi
-
-	clog_service_status $CLOG_SUCCEED
-	return 0
-}
-
-case $1 in
-	meta-data)
-		cat `echo $0 | sed 's/^\(.*\)\.sh$/\1.metadata/'`
-		exit 0
-		;;
-	validate-all)
-		verify_all
-		exit $?
-		;;
-	start)
-		verify_all && start
-		exit $?
-		;;
-	stop)
-		verify_all && stop
-		exit $?
-		;;
-	status|monitor)
-		verify_all
-		status
-		exit $?
-		;;
-	restart)
-		verify_all
-		stop
-		start
-		exit $?
-		;;
-	*)
-		echo "Usage: $0 {start|stop|status|monitor|restart|meta-data|validate-all}"
-		exit $OCF_ERR_UNIMPLEMENTED
-		;;
-esac
diff --git a/rgmanager/src/resources/utils/config-utils.sh.in b/rgmanager/src/resources/utils/config-utils.sh.in
deleted file mode 100644
index b5fcf84..0000000
--- a/rgmanager/src/resources/utils/config-utils.sh.in
+++ /dev/null
@@ -1,228 +0,0 @@
-#!/bin/bash
-
-declare RA_COMMON_pid_dir=/var/run/cluster
-declare RA_COMMON_conf_dir=@CONFDIR@
-
-declare -i FAIL=-1
-declare -a ip_keys
-
-generate_configTemplate()
-{
-	cat > $1 << EOT
-#
-# "$1" was created from the "$2"
-#
-# This template configuration was automatically generated, and will be
-# automatically regenerated if removed. Once this file has been altered,
-# automatic re-generation will stop. Remember to copy this file to all 
-# other cluster members after making changes, or your service will not 
-# operate correctly.
-#
-EOT
-}
-
-sha1_addToFile()
-{
-        declare sha1line="# rgmanager-sha1 $(sha1sum "$1")"
-        echo $sha1line >> "$1"
-}
-
-sha1_verify()
-{
-	declare sha1_new sha1_old
-	declare oldFile=$1
-
-	ocf_log debug "Checking: SHA1 checksum of config file $oldFile"
-
-	sha1_new=`cat $oldFile | grep -v "# rgmanager-sha1" | sha1sum | sed 's/^\([a-z0-9]\+\) .*$/\1/'`
-	sha1_old=`tail -n 1 $oldFile | sed 's/^# rgmanager-sha1 \(.*\)$/\1/' | sed 's/^\([a-z0-9]\+\) .*$/\1/'`
-
-	if [ $sha1_new = $sha1_old ]; then
-	        ocf_log debug "Checking: SHA1 checksum > succeed"
-		return 0;
-	else
-		ocf_log debug "Checking: SHA1 checksum > failed - file changed"
-		return 1;
-	fi
-}
-
-#
-# Usage: ccs_get key
-#
-ccs_get()
-{
-	declare outp
-	declare key
-
-	[ -n "$1" ] || return $FAIL
-
-	key="$*"
-
-	outp=$(ccs_tool query "$key" 2>&1)
-	if [ $? -ne 0 ]; then
-		if [ "$outp" = "${outp/No data available/}" ] || [ "$outp" = "${outp/Operation not permitted/}" ]; then
-			ocf_log err "$outp ($key)"
-			return $FAIL
-		fi
-
-		# no real error, just no data available
-		return 0
-	fi
-
-	echo $outp
-
-	return 0
-}
-
-#
-# Build a list of service IP keys; traverse refs if necessary
-# Usage: get_service_ip_keys desc serviceName
-#
-get_service_ip_keys()
-{
-	declare svc=$1
-	declare -i x y=0
-	declare outp
-	declare key
-
-	#
-	# Find service-local IP keys
-	#
-	x=1
-	while : ; do
-		key="/cluster/rm/service[@name=\"$svc\"]/ip[$x]"
-
-		#
-		# Try direct method
-		#
-		outp=$(ccs_get "$key/@address")
-		if [ $? -ne 0 ]; then
-			return 1
-		fi
-
-		#
-		# Try by reference
-		#
-		if [ -z "$outp" ]; then
-			outp=$(ccs_get "$key/@ref")
-			if [ $? -ne 0 ]; then
-				return 1
-			fi
-			key="/cluster/rm/resources/ip[@address=\"$outp\"]"
-		fi
-
-		if [ -z "$outp" ]; then
-			break
-		fi
-
-		#ocf_log debug "IP $outp found @ $key"
-
-		ip_keys[$y]="$key"
-
-		((y++))
-		((x++))
-	done
-
-	ocf_log debug "$y IP addresses found for $svc/$OCF_RESKEY_name"
-
-	return 0
-}
-
-build_ip_list()
-{
-        declare ipaddrs ipaddr
-        declare -i x=0
-                        
-        while [ -n "${ip_keys[$x]}" ]; do
-              ipaddr=$(ccs_get "${ip_keys[$x]}/@address")
-              if [ -z "$ipaddr" ]; then
-                                   break
-              fi
-
-              ipaddrs="$ipaddrs $ipaddr"
-             ((x++))
-        done
-
-        echo $ipaddrs
-}
-
-generate_name_for_pid_file()
-{
-	declare filename=$(basename $0)
-	
-	echo "$RA_COMMON_pid_dir/$(basename $0 | sed 's/^\(.*\)\..*/\1/')/$OCF_RESOURCE_INSTANCE.pid"
-	
-	return 0;
-}
-
-generate_name_for_pid_dir()
-{
-	declare filename=$(basename $0)
-	
-	echo "$RA_COMMON_pid_dir/$(basename $0 | sed 's/^\(.*\)\..*/\1/')/$OCF_RESOURCE_INSTANCE"
-	
-	return 0;
-}
-
-generate_name_for_conf_dir()
-{
-	declare filename=$(basename $0)
-
-	echo "$RA_COMMON_conf_dir/$(basename $0 | sed 's/^\(.*\)\..*/\1/')/$OCF_RESOURCE_INSTANCE"
-	
-	return 0;
-}
-
-create_pid_directory()
-{
-	declare program_name="$(basename $0 | sed 's/^\(.*\)\..*/\1/')"
-	declare dirname="$RA_COMMON_pid_dir/$program_name"
-
-	if [ -d "$dirname" ]; then
-		return 0;
-	fi
-	
-	chmod 711 "$RA_COMMON_pid_dir"
-	mkdir -p "$dirname"
-	
-	if [ "$program_name" = "mysql" ]; then
-		chown mysql.root "$dirname"
-	elif [ "$program_name" = "tomcat-5" ]; then
-		chown tomcat.root "$dirname"
-	fi
-
-	return 0;
-}
-
-create_conf_directory()
-{
-	declare dirname="$1"
-
-	if [ -d "$dirname" ]; then
-		return 0;
-	fi
-	
-	mkdir -p "$dirname"
-	
-	return 0;
-}
-
-check_pid_file() {
-	declare pid_file="$1"
-
-	if [ -z "$pid_file" ]; then
-		return 1;
-	fi
-
-	if [ ! -e "$pid_file" ]; then
-		return 0;
-	fi
-
-	if [ ! -d /proc/`cat "$pid_file"` ]; then	
-		rm "$pid_file"
-		ocf_log debug "PID File \"$pid_file\" Was Removed - PID Does Not Exist";
-		return 0;
-	fi
-
-	return 1;
-}
diff --git a/rgmanager/src/resources/utils/httpd-parse-config.pl b/rgmanager/src/resources/utils/httpd-parse-config.pl
deleted file mode 100644
index 26ef378..0000000
--- a/rgmanager/src/resources/utils/httpd-parse-config.pl
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/usr/bin/perl -w
-
-##
-##  This script removes <IfDefine foo> sections from the
-##  Apache httpd.conf file. This is quite useful because we
-##  don't have any direct access to the parsed configuration
-##  file of the httpd server.
-##
-##  Usage: ./httpd-parse-config.pl -Dfoo1 -Dfoo2 < httpd.conf
-##         where fooX are defines as passed to the httpd server
-##
-##  Note:  All whitespace characters at the beginning and end 
-##         of lines are removed.
-##
-use strict;
-
-my @defines = ();
-## Default behaviour is to show all lines when we are not
-## in the <IfDefine foo> sections.
-my @show = (1);
-
-sub testIfDefine($) {
-	my $param = $1;
-	my $positiveTest = 1;
-	if ($param =~ /^!(.*)$/) {
-		$param = $1;
-		$positiveTest = 0;
-	}
-
-	foreach my $def (@defines) {
-		if ($def eq $param) {
-			return $positiveTest;
-		}
-	}
-
-	return (1-$positiveTest);	
-}
-
-foreach my $arg (@ARGV) {
-	if ($arg =~ /^-D(.*)$/) {
-		push(@defines, $1);
-	}
-}
-
-## Parse config file and remove IfDefine sections 
-while (my $line = <STDIN>) {
-	chomp($line);
-	$line =~ s/^\s*(.*?)\s*$/$1/;
-	if ($line =~ /<IfDefine (.*)>/) {
-		if (testIfDefine($1) == 1) {
-			if ($show[$#show] == 1) {
-				push (@show, 1);
-			} else {
-				push (@show, 0);
-			}
-		} else {
-			push (@show, 0);
-		}
-	} elsif ($line =~ /<\/IfDefine>/) {
-		pop(@show);
-	} elsif ($show[$#show] == 1) {
-		print $line, "\n";
-	}
-}
-
diff --git a/rgmanager/src/resources/utils/member_util.sh b/rgmanager/src/resources/utils/member_util.sh
deleted file mode 100644
index f9a0906..0000000
--- a/rgmanager/src/resources/utils/member_util.sh
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/bin/bash
-
-#
-# Use clustat to figure out if the specified node is a member
-# of the cluster.  Returns 2 if not found, 1 if not a member, and
-# 0 if the node is happily running.
-# Tested on RHEL4 and RHEL5; requires RHCS 5.1 or 4.5 to operate
-# properly in all cases.
-#
-is_node_member_clustat()
-{
-	declare line=$(clustat -xm $1 | grep "name=\"$1\"")
-	declare tmp
-
-	# Done if there's no node in the list with that name: not a 
-	# cluster member, and not in the configuration.
-	[ -n "$line" ] || return 2
-
-	# Clear out xml tag seps.
-	line=${line/*</}
-	line=${line/\/>/}
-
-	# Make vars out of XML attributes.
-	for tmp in $line; do
-		eval declare __$tmp
-	done
-
-	# Flip the value.  clustat reports 1 for member, 0 for not;
-	# Exactly the opposite of what a shell script expects.
-	((__state = !__state))
-	return $__state
-}
-
-
-#
-# Print the local node name to stdout
-# Returns 0 if could be found, 1 if not
-# Tested on RHEL4 (magma) and RHEL5 (cman)
-#
-local_node_name()
-{
-	declare node state line
-
-	if which magma_tool &> /dev/null; then
-		# Use magma_tool, if available.
-		line=$(magma_tool localname | grep "^Local")
-
-		if [ -n "$line" ]; then
-			echo ${line/* = /}
-			return 0
-		fi
-	fi
-
-	if ! which cman_tool &> /dev/null; then
-		# No cman tool? :(
-		return 2
-	fi
-
-	# Use cman_tool
-
-	line=$(cman_tool status | grep -i "Node name: $1")
-	[ -n "$line" ] || return 1
-	echo ${line/*name: /}
-	return 0
-}
-
diff --git a/rgmanager/src/resources/utils/messages.sh b/rgmanager/src/resources/utils/messages.sh
deleted file mode 100644
index 6148fa6..0000000
--- a/rgmanager/src/resources/utils/messages.sh
+++ /dev/null
@@ -1,243 +0,0 @@
-#!/bin/bash
-
-declare CLOG_INIT=100
-declare CLOG_SUCCEED=200
-
-declare CLOG_FAILED=400
-declare CLOG_FAILED_TIMEOUT=401
-declare CLOG_FAILED_NOT_FOUND=403
-declare CLOG_FAILED_INVALID=404
-declare CLOG_FAILED_NOT_READABLE=405
-
-##
-## Usage:
-##	clog_service_start %operation%
-##
-clog_service_start()
-{
-	case $1 in
-		$CLOG_INIT)
-			ocf_log info "Starting Service $OCF_RESOURCE_INSTANCE"
-			;;
-		$CLOG_SUCCEED)
-			ocf_log debug "Starting Service $OCF_RESOURCE_INSTANCE > Succeed"
-			;;
-		$CLOG_FAILED)
-			ocf_log error "Starting Service $OCF_RESOURCE_INSTANCE > Failed"
-			;;
-		$CLOG_FAILED_TIMEOUT)
-			ocf_log error "Starting Service $OCF_RESOURCE_INSTANCE > Failed - Timeout Error"
-			;;
-	esac
-	return 0
-}
-
-##
-## Usage:
-##	clog_service_stop %operation%
-##
-clog_service_stop()
-{
-	case $1 in
-		$CLOG_INIT)
-			ocf_log info "Stopping Service $OCF_RESOURCE_INSTANCE"
-			;;
-		$CLOG_SUCCEED)
-			ocf_log info "Stopping Service $OCF_RESOURCE_INSTANCE > Succeed"
-			;;
-		$CLOG_FAILED)
-			ocf_log error "Stopping Service $OCF_RESOURCE_INSTANCE > Failed"
-			;;
-		$CLOG_FAILED_NOT_STOPPED)
-			ocf_log error "Stopping Service $OCF_RESOURCE_INSTANCE > Failed - Application Is Still Running"
-			;;
-	esac
-	return 0
-}
-
-##
-## Usage:
-##	clog_service_status %operation%
-##
-clog_service_status()
-{
-	case $1 in
-		$CLOG_INIT)
-			ocf_log debug "Monitoring Service $OCF_RESOURCE_INSTANCE"
-			;;
-		$CLOG_SUCCEED)
-			ocf_log debug "Monitoring Service $OCF_RESOURCE_INSTANCE > Service Is Running"
-			;;
-		$CLOG_FAILED)
-			ocf_log error "Monitoring Service $OCF_RESOURCE_INSTANCE > Service Is Not Running"
-			;;
-		$CLOG_FAILED_NOT_FOUND)
-			ocf_log error "Monitoring Service $OCF_RESOURCE_INSTANCE > Service Is Not Running - PID File Not Found"
-			;;
-	esac
-	return 0
-}
-
-##
-## Usage:
-##	clog_service_verify %operation%
-##	clog_service_verify $CLOG_FAILED %reason%
-##
-clog_service_verify()
-{
-	case $1 in
-		$CLOG_INIT)
-			ocf_log debug "Verifying Configuration Of $OCF_RESOURCE_INSTANCE"
-			;;
-		$CLOG_SUCCEED)
-			ocf_log debug "Verifying Configuration Of $OCF_RESOURCE_INSTANCE > Succeed"
-			;;
-		$CLOG_FAILED_NOT_CHILD)
-			ocf_log error "Service $OCF_RESOURCE_INSTANCE Is Not A Child Of A Service"
-			;;
-		$CLOG_FAILED)
-			if [ "x$2" = "x" ]; then
-				ocf_log error "Verifying Configuration Of $OCF_RESOURCE_INSTANCE > Failed"
-			else
-				ocf_log error "Verifying Configuration Of $OCF_RESOURCE_INSTANCE > Failed - $2"
-			fi
-			;;
-	esac
-	return 0
-}
-
-
-##
-## Usage:
-##	clog_check_sha1 %operation% %filename%
-##
-clog_check_sha1()
-{
-	case $1 in
-		$CLOG_INIT)
-			ocf_log debug "Checking SHA1 Checksum Of File $1"
-			;;
-		$CLOG_SUCCEED)
-			ocf_log debug "Checking SHA1 Checksum Of File > Succeed"
-			;;
-		$CLOG_FAILED)
-			ocf_log debug "Checking SHA1 Checksum Of File > Failed - File Changed"
-			;;
-	esac
-	return 0;
-} 
-
-##
-## Usage:
-##	clog_check_file_exist %operation% %filename%
-##
-clog_check_file_exist()
-{
-	case $1 in
-		$CLOG_INIT)
-			ocf_log debug "Checking Existence Of File $2"
-			;;
-		$CLOG_SUCCEED)
-			ocf_log debug "Checking Existence Of File $2 > Succeed"
-			;;
-		$CLOG_FAILED)
-			ocf_log error "Checking Existence Of File $2 [$OCF_RESOURCE_INSTANCE] > Failed"
-			;;
-		$CLOG_FAILED_INVALID)
-			ocf_log error "Checking Existence Of File $2 [$OCF_RESOURCE_INSTANCE] > Failed - Invalid Argument"
-			;;
-		$CLOG_FAILED_NOT_FOUND)
-			ocf_log error "Checking Existence Of File $2 [$OCF_RESOURCE_INSTANCE] > Failed - File Doesn't Exist"
-			;;
-		$CLOG_FAILED_NOT_READABLE)
-			ocf_log error "Checking Existence Of File $2 [$OCF_RESOURCE_INSTANCE] > Failed - File Is Not Readable"
-			;;
-	esac
-	return 0;
-} 
-
-##
-## Usage:
-##	clog_check_pid %operation% %filename%
-##
-clog_check_pid()
-{
-	case $1 in
-		$CLOG_INIT)
-			ocf_log debug "Checking Non-Existence Of PID File $2"
-			return 0
-			;;
-		$CLOG_SUCCEED)
-			ocf_log debug "Checking Non-Existence of PID File $2 > Succeed"
-			;;
-		$CLOG_FAILED)
-			ocf_log error "Checking Non-Existence of PID File $2 [$OCF_RESOURCE_INSTANCE] > Failed - PID File Exists For $OCF_RESOURCE_INSTANCE"
-			;;
-	esac
-	return 0;
-}
-
-##
-## Usage:
-##	clog_check_syntax %operation% %filename%
-##
-clog_check_syntax()
-{
-	case $1 in
-		$CLOG_INIT)
-			ocf_log debug "Checking Syntax Of The File $2"
-			;;
-		$CLOG_SUCCEED)
-			ocf_log debug "Checking Syntax Of The File $2 > Succeed"
-			;;
-		$CLOG_FAILED)
-			ocf_log error "Checking Syntax Of The File $2 [$OCF_RESOURCE_INSTANCE] > Failed"
-			;;		
-	esac
-	return 0;
-}
-
-##
-## Usage:
-##	clog_generate_config %operation% %old filename% %new filename%
-##
-clog_generate_config()
-{
-	case $1 in
-		$CLOG_INIT)
-			ocf_log debug "Generating New Config File $3 From $2"
-			;;
-		$CLOG_SUCCEED)
-			ocf_log debug "Generating New Config File $3 From $2 > Succeed"
-			;;
-		$CLOG_FAILED)
-			ocf_log error "Generating New Config File $3 From $2 [$OCF_RESOURCE_INSTANCE] > Failed"
-			;;		
-	esac
-	return 0;
-}
-
-##
-## Usage:
-##	clog_looking_for %operation% %resource%
-##	clog_looking_for %operation% "IP Addresses"
-##	clog_looking_for %operation% "Filesystems"
-##
-clog_looking_for()
-{
-	case $1 in
-		$CLOG_INIT)
-			ocf_log debug "Looking For $2"
-			;;
-		$CLOG_SUCCEED)
-			ocf_log debug "Looking For $2 > Succeed - $3 $2 Found"
-			;;
-		$CLOG_FAILED)
-			ocf_log error "Looking For $2 [$OCF_RESOURCE_INSTANCE] > Failed"
-			;;		
-		$CLOG_FAILED_NOT_FOUND)
-			ocf_log error "Looking For $2 [$OCF_RESOURCE_INSTANCE] > Failed - No $2 Found"
-			;;		
-	esac
-	return 0;
-}
diff --git a/rgmanager/src/resources/utils/named-parse-config.pl b/rgmanager/src/resources/utils/named-parse-config.pl
deleted file mode 100644
index 7a8b2dd..0000000
--- a/rgmanager/src/resources/utils/named-parse-config.pl
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/perl -w
-
-##
-##  Parse named.conf (from STDIN) and add options from cluster.conf
-##  
-##  ./named-parse-config.pl "directory" "pid-file" "listen-on"
-##
-use strict;
-
-if ($#ARGV < 2) {
-	die ("Not enough arguments");
-}
-
-while (my $line = <STDIN>) {
-	chomp($line);
-	$line =~ s/(.*?)\s*$/$1/;
-	if ($line =~ /^\s*options\s+\{/) {
-		print $line, "\n";
-		print "\tdirectory \"$ARGV[0]\";\n";
-		print "\tpid-file \"$ARGV[1]\";\n";
-		print "\tlisten-on { $ARGV[2] };\n";
-	} else {
-		print $line, "\n";
-	}
-}
-
diff --git a/rgmanager/src/resources/utils/ra-skelet.sh b/rgmanager/src/resources/utils/ra-skelet.sh
deleted file mode 100644
index 982bbc6..0000000
--- a/rgmanager/src/resources/utils/ra-skelet.sh
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/bin/bash
-
-status_check_pid()
-{
-	declare pid_file="$1"
-
-	if [ -z "$pid_file" ]; then
-		clog_check_file_exist $CLOG_FAILED_INVALID "$pid_file"
-		return $OCF_ERR_GENERIC
-	fi
-
-	if [ ! -e "$pid_file" ]; then
-		clog_check_file_exist $CLOG_FAILED "$pid_file"
-		return $OCF_ERR_GENERIC
-	fi
-
-	if [ ! -d /proc/`cat "$pid_file"` ]; then
-		return $OCF_ERR_GENERIC
-	fi	
-
-	return 0
-}
-
-stop_generic()
-{
-	declare pid_file="$1"
-	declare kill_timeout="$2"
-	declare pid;
-	declare count=0;
-
-	if [ ! -e "$pid_file" ]; then
-		clog_check_file_exist $CLOG_FAILED_NOT_FOUND "$pid_file"
-		return $OCF_ERR_GENERIC
-	fi
-
-	if [ -z "$kill_timeout" ]; then
-		kill_timeout=20
-	fi
-
-	read pid < "$pid_file"
-
-	# @todo: PID file empty -> error?
-	if [ -z "$pid" ]; then
-		return 0;
-	fi
-
-	# @todo: PID is not running -> error?
-	if [ ! -d "/proc/$pid" ]; then
-		return 0;
-	fi
-
-	kill -TERM "$pid"
-
-	if [ $? -ne 0 ]; then
-		return $OCF_ERR_GENERIC
-	fi
-
-	until [ `ps --pid "$pid" &> /dev/null; echo $?` = '1' ] || [ $count -gt $kill_timeout ]
-	do
-		sleep 1
-		let count=$count+1
-	done
-
-	if [ $count -gt $kill_timeout ]; then
-		clog_service_stop $CLOG_FAILED_NOT_STOPPED
-		return $OCF_ERR_GENERIC
-	fi
-	
-	return 0;
-}
diff --git a/rgmanager/src/resources/utils/tomcat-parse-config.pl b/rgmanager/src/resources/utils/tomcat-parse-config.pl
deleted file mode 100644
index 109ecae..0000000
--- a/rgmanager/src/resources/utils/tomcat-parse-config.pl
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/perl -w
-
-##
-##  This script replace IP addresses on which tomcat server
-##  should listen. Tomcat can't listen on every IP because that 
-##  way we can run only on instance. 
-##
-##  Usage: ./tomcat-parse-config.pl ip1 ip2 < /etc/tomcat/server.xml
-##         where ipXX defines an IP address [eg. 127.0.0.1 134.45.11.1]
-##
-##
-use strict;
-
-while (my $line = <STDIN>) {
-	chomp ($line);
-
-	if ($line =~ /(.*?)<Connector (.*)/) {
-		my $tmp = $2;
-		my $content = "<Connector ";
-		my $start = $1;
-		my $rest = "";
-
-		while (($tmp =~ />/) == 0) {
-			$content .= $tmp . "\n";
-			$tmp = <STDIN>;
-			chomp($tmp);
-		}
-
-		if ($tmp =~ /(.*?)>(.*)/) {
-			$content .= $1 . ">\n";
-			$rest = $2;
-			chomp($rest);
-		}
-		
-		print $start;
-		foreach my $arg (@ARGV) {
-			$content =~ s/\s+address=".*?"/ /;
-			$content =~ s/Connector /Connector address="$arg" /;
-			print $content;
-		}
-		print $rest;
-	} else {
-		print $line,"\n";
-	}
-}
diff --git a/rgmanager/src/resources/vm.sh b/rgmanager/src/resources/vm.sh
deleted file mode 100644
index 07561d0..0000000
--- a/rgmanager/src/resources/vm.sh
+++ /dev/null
@@ -1,576 +0,0 @@
-#!/bin/bash
-
-PATH=/bin:/sbin:/usr/bin:/usr/sbin
-
-export PATH
-
-. $(dirname $0)/ocf-shellfuncs || exit 1
-
-. $(dirname $0)/ocf-shellfuncs
-
-#
-# Virtual Machine start/stop script (requires the xm command)
-#
-
-meta_data()
-{
-    cat <<EOT
-<?xml version="1.0"?>
-<resource-agent version="rgmanager 2.0" name="vm">
-    <version>1.0</version>
-
-    <longdesc lang="en">
-	Defines a Virtual Machine
-    </longdesc>
-    <shortdesc lang="en">
-        Defines a Virtual Machine
-    </shortdesc>
-
-    <parameters>
-        <parameter name="name" primary="1">
-            <longdesc lang="en">
-                This is the name of the virtual machine.
-            </longdesc>
-            <shortdesc lang="en">
-                Name
-            </shortdesc>
-            <content type="string"/>
-        </parameter>
-    
-        <parameter name="domain" reconfig="1">
-            <longdesc lang="en">
-                Fail over domains define lists of cluster members
-                to try in the event that the host of the virtual machine
-		fails.
-            </longdesc>
-            <shortdesc lang="en">
-                Cluster Fail Over Domain
-            </shortdesc>
-            <content type="string"/>
-        </parameter>
-
-        <parameter name="autostart" reconfig="1">
-            <longdesc lang="en">
-	    	If set to yes, this resource group will automatically be started
-		after the cluster forms a quorum.  If set to no, this virtual
-		machine will start in the 'disabled' state after the cluster
-		forms a quorum.
-            </longdesc>
-            <shortdesc lang="en">
-	    	Automatic start after quorum formation
-            </shortdesc>
-            <content type="boolean" default="1"/>
-        </parameter>
-
-        <parameter name="hardrecovery" reconfig="1">
-            <longdesc lang="en">
-	    	If set to yes, the last owner will reboot if this resource
-		group fails to stop cleanly, thus allowing the resource
-		group to fail over to another node.  Use with caution; a
-		badly-behaved resource could cause the entire cluster to
-		reboot.  This should never be enabled if the automatic
-		start feature is used.
-            </longdesc>
-            <shortdesc lang="en">
-	    	Reboot if stop phase fails
-            </shortdesc>
-            <content type="boolean" default="0"/>
-        </parameter>
-
-        <parameter name="exclusive" reconfig="1">
-            <longdesc lang="en">
-	    	If set, this resource group will only relocate to
-		nodes which have no other resource groups running in the
-		event of a failure.  If no empty nodes are available,
-		this resource group will not be restarted after a failure.
-		Additionally, resource groups will not automatically
-		relocate to the node running this resource group.  This
-		option can be overridden by manual start and/or relocate
-		operations.
-            </longdesc>
-            <shortdesc lang="en">
-	        Exclusive resource group
-            </shortdesc>
-            <content type="boolean" default="0"/>
-        </parameter>
-
-        <parameter name="recovery" reconfig="1">
-            <longdesc lang="en">
-	        This currently has three possible options: "restart" tries
-		to restart this virtual machine locally before
-		attempting to relocate (default); "relocate" does not bother
-		trying to restart the VM locally; "disable" disables
-		the VM if it fails.
-            </longdesc>
-            <shortdesc lang="en">
-	    	Failure recovery policy
-            </shortdesc>
-            <content type="string"/>
-        </parameter>
-
-	<parameter name="memory" reconfig="1">
-	    <longdesc lang="en">
-		Memory size.  This can be reconfigured on the fly.
-	    </longdesc>
-	    <shortdesc lang="en">
-		Memory Size
-	    </shortdesc>
-            <content type="integer"/>
-        </parameter>
-
-       <parameter name="migration_mapping">
-           <longdesc lang="en">
-               Mapping of the hostname of a target cluster member to a different hostname
-           </longdesc>
-           <shortdesc lang="en">
-               memeberhost:targethost,memeberhost:targethost ..
-           </shortdesc>
-            <content type="string"/>
-        </parameter>
-
-	<parameter name="bootloader">
-	    <longdesc lang="en">
-		Boot loader that can start the VM from physical image
-	    </longdesc>
-	    <shortdesc lang="en">
-		Boot loader that can start the VM from physical image
-	    </shortdesc>
-            <content type="string"/>
-        </parameter>
-
-	<parameter name="path">
-	    <longdesc lang="en">
-	    	Path specification 'xm create' will search for the specified
-		VM configuration file
-	    </longdesc>
-	    <shortdesc lang="en">
-	    	Path to virtual machine configuration files
-	    </shortdesc>
-            <content type="string"/>
-        </parameter>
-
-
-	<parameter name="rootdisk_physical" unique="1">
-	    <longdesc lang="en">
-		Root disk for the virtual machine.  (physical, on the host)
-	    </longdesc>
-	    <shortdesc lang="en">
-		Root disk (physical)
-	    </shortdesc>
-            <content type="string"/>
-        </parameter>
-        
-	<parameter name="rootdisk_virtual">
-	    <longdesc lang="en">
-		Root disk for the virtual machine.  (as presented to the VM)
-	    </longdesc>
-	    <shortdesc lang="en">
-		Root disk (virtual)
-	    </shortdesc>
-            <content type="string"/>
-        </parameter>
-
-
-	<parameter name="swapdisk_physical" unique="1">
-	    <longdesc lang="en">
-		Swap disk for the virtual machine.  (physical, on the host)
-	    </longdesc>
-	    <shortdesc lang="en">
-		Swap disk (physical)
-	    </shortdesc>
-            <content type="string"/>
-        </parameter>
-        
-	<parameter name="swapdisk_virtual">
-	    <longdesc lang="en">
-		Swap disk for the virtual machine.  (as presented to the VM)
-	    </longdesc>
-	    <shortdesc lang="en">
-		Swap disk (virtual)
-	    </shortdesc>
-            <content type="string"/>
-        </parameter>
-
-	<parameter name="vif">
-	    <longdesc lang="en">
-		Virtual interface MAC address
-	    </longdesc>
-	    <shortdesc lang="en">
-		Virtual interface MAC address
-	    </shortdesc>
-            <content type="string"/>
-        </parameter>
-
-	<parameter name="migrate">
-	    <longdesc lang="en">
-	    	Migration type live or pause, default = live.
-	    </longdesc>
-	    <shortdesc lang="en">
-	    	Migration type live or pause, default = live.
-	    </shortdesc>
-            <content type="string" default="live"/>
-        </parameter>
-
-	<parameter name="snapshot">
-	    <longdesc lang="en">
-	    	Path to the snapshot directory where the virtual machine
-		image will be stored.
-	    </longdesc>
-	    <shortdesc lang="en">
-	    	Path to the snapshot directory where the virtual machine
-		image will be stored.
-	    </shortdesc>
-            <content type="string" default=""/>
-        </parameter>
-
-        <parameter name="depend">
-            <longdesc lang="en">
-		Top-level service this depends on, in "service:name" format.
-            </longdesc>
-            <shortdesc lang="en">
-		Service dependency; will not start without the specified
-		service running.
-            </shortdesc>
-            <content type="string"/>
-        </parameter>
-
-        <parameter name="depend_mode">
-            <longdesc lang="en">
-	    	Dependency mode
-            </longdesc>
-            <shortdesc lang="en">
-		Service dependency mode.
-		hard - This service is stopped/started if its dependency
-		       is stopped/started
-		soft - This service only depends on the other service for
-		       initial startip.  If the other service stops, this
-		       service is not stopped.
-            </shortdesc>
-            <content type="string" default="hard"/>
-        </parameter>
-
-        <parameter name="max_restarts" reconfig="1">
-            <longdesc lang="en">
-	    	Maximum restarts for this service.
-            </longdesc>
-            <shortdesc lang="en">
-	    	Maximum restarts for this service.
-            </shortdesc>
-            <content type="string" default="0"/>
-        </parameter>
-
-        <parameter name="restart_expire_time" reconfig="1">
-            <longdesc lang="en">
-	    	Restart expiration time
-            </longdesc>
-            <shortdesc lang="en">
-	    	Restart expiration time.  A restart is forgotten
-		after this time.  When combined with the max_restarts
-		option, this lets administrators specify a threshold
-		for when to fail over services.  If max_restarts
-		is exceeded in this given expiration time, the service
-		is relocated instead of restarted again.
-            </shortdesc>
-            <content type="string" default="0"/>
-        </parameter>
-
-    </parameters>
-
-    <actions>
-        <action name="start" timeout="20"/>
-        <action name="stop" timeout="120"/>
-	
-        <action name="status" timeout="10" interval="30"/>
-        <action name="monitor" timeout="10" interval="30"/>
-
-	<!-- reconfigure - reconfigure with new OCF parameters.
-	     NOT OCF COMPATIBLE AT ALL -->
-	<action name="reconfig" timeout="10"/>
-
-	<!-- Suspend: if available, suspend this resource instead of
-	     doing a full stop. -->
-	<!-- <action name="suspend" timeout="10m"/> -->
-	<action name="migrate" timeout="10m"/>
-
-        <action name="meta-data" timeout="5"/>
-        <action name="validate-all" timeout="5"/>
-
-    </actions>
-    
-    <special tag="rgmanager">
-    	<!-- Destroy_on_delete / init_on_add are currently only
-	     supported for migratory resources (no children
-	     and the 'migrate' action; see above.  Do not try this
-	     with normal services -->
-        <attributes maxinstances="1" destroy_on_delete="0" init_on_add="0"/>
-    </special>
-</resource-agent>
-EOT
-}
-
-
-build_xm_cmdline()
-{
-	#
-	# Virtual domains should never restart themselves when 
-	# controlled externally; the external monitoring app
-	# should.
-	#
-	declare cmdline="on_shutdown=\"destroy\" on_reboot=\"destroy\" on_crash=\"destroy\""
-	declare varp val temp
-
-	#
-	# Transliterate the OCF_RESKEY_* to something the xm
-	# command can recognize.
-	#
-	for var in ${!OCF_RESKEY_*}; do
-		varp=${var/OCF_RESKEY_/}
-		val=`eval "echo \\$$var"`
-
-		case $varp in
-		bootloader)
-			cmdline="$cmdline bootloader=\"$val\""
-			;;
-		rootdisk_physical)
-			[ -n "$OCF_RESKEY_rootdisk_virtual" ] || exit 2
-			cmdline="$cmdline disk=\"phy:$val,$OCF_RESKEY_rootdisk_virtual,w\""
-			;;
-		swapdisk_physical)
-			[ -n "$OCF_RESKEY_swapdisk_virtual" ] || exit 2
-			cmdline="$cmdline disk=\"phy:$val,$OCF_RESKEY_swapdisk_virtual,w\""
-			;;
-		vif)
-			cmdline="$cmdline vif=\"mac=$val\""
-			;;
-		recovery|autostart|domain)
-			;;
-		memory)
-			cmdline="$cmdline $varp=$val"
-			;;
-		swapdisk_virtual)
-			;;
-		rootdisk_virtual)
-			;;
-		name)	# Do nothing with name; add it later
-			;;
-		path)
-			cmdline="$cmdline --path=\"$val\""
-			;;
-		migrate)
-			;;
-		snapshot)
-			;;
-		*)
-			cmdline="$cmdline $varp=\"$val\""
-			;;
-		esac
-	done
-
-	if [ -n "$OCF_RESKEY_name" ]; then
-		cmdline="$OCF_RESKEY_name $cmdline"
-	fi
-
-	echo $cmdline
-}
-
-
-#
-# Start a virtual machine given the parameters from
-# the environment.
-#
-do_start()
-{
-	# Use /dev/null for the configuration file, if xmdefconfig
-	# doesn't exist...
-	#
-	declare cmdline
-	declare snapshotimage
-
-	status && return 0
-
-	snapshotimage="$OCF_RESKEY_snapshot/$OCF_RESKEY_name"
-
-        if [ -n "$OCF_RESKEY_snapshot" -a -f "$snapshotimage" ]; then
-		eval xm restore $snapshotimage
-		if [ $? -eq 0 ]; then
-			rm -f $snapshotimage
-			return 0
-		fi
-		return 1
-	fi
-
-	cmdline="`build_xm_cmdline`"
-
-	echo "# xm command line: $cmdline"
-
-	eval xm create $cmdline
-	return $?
-}
-
-
-#
-# Stop a VM.  Try to shut it down.  Wait a bit, and if it
-# doesn't shut down, destroy it.
-#
-do_stop()
-{
-	declare -i timeout=60
-	declare -i ret=1
-	declare st
-
-	if [ -n "$OCF_RESKEY_snapshot" ]; then
-		xm save $OCF_RESKEY_name "$OCF_RESKEY_snapshot/$OCF_RESKEY_name"
-	fi
-
-	for op in $*; do
-		echo xm $op $OCF_RESKEY_name ...
-		xm $op $OCF_RESKEY_name
-
-		timeout=60
-		while [ $timeout -gt 0 ]; do
-			sleep 5
-			((timeout -= 5))
-			status || return 0
-			while read dom state; do
-				#
-				# State is "stopped".  Kill it.
-				#
-				if [ "$dom" != "$OCF_RESKEY_name" ]; then
-					continue
-				fi
-				if [ "$state" != "---s-" ]; then
-					continue
-				fi
-				xm destroy $OCF_RESKEY_name
-			done < <(xm list | awk '{print $1, $5}')
-		done
-	done
-
-	return 1
-}
-
-
-#
-# Reconfigure a running VM.  Currently, all we support is
-# memory ballooning.
-#
-reconfigure()
-{
-	if [ -n "$OCF_RESKEY_memory" ]; then
-		echo "xm balloon $OCF_RESKEY_name $OCF_RESKEY_memory"
-		xm balloon $OCF_RESKEY_name $OCF_RESKEY_memory
-		return $?
-	fi
-	return 0
-}
-
-
-#
-# Simple status check: Find the VM in the list of running
-# VMs
-#
-do_status()
-{
-	xm list $OCF_RESKEY_name &> /dev/null
-	if [ $? -eq 0 ]; then
-		return 0
-	fi
-	xm list migrating-$OCF_RESKEY_name &> /dev/null
-	return $?
-}
-
-
-verify_all()
-{
-	declare errors=0
-
-	if [ -n "$OCF_RESKEY_bootloader" ] && \
-	   ! [ -x "$OCF_RESKEY_bootloader" ]; then
-		echo "$OCF_RESKEY_bootloader is not executable"
-		((errors++))
-	fi
-}
-
-
-migrate()
-{
-	declare target=$1
-	declare errstr rv migrate_opt
-
-	if [ "$OCF_RESKEY_migrate" = "live" ]; then
-		migrate_opt="-l"
-	fi
-
-	# Patch from Marcelo Azevedo to migrate over private
-	# LANs instead of public LANs
-        if [ -n "$OCF_RESKEY_migration_mapping" ] ; then
-                target=${OCF_RESKEY_migration_mapping#*$target:} target=${target%%,*}
-        fi
-
-	err=$(xm migrate $migrate_opt $OCF_RESKEY_name $target 2>&1 | head -1; exit ${PIPESTATUS[0]})
-	rv=$?
-
-	if [ $rv -ne 0 ]; then
-		if [ "$err" != "${err/does not exist/}" ]; then
-			ocf_log warn "Trying to migrate '$OCF_RESKEY_name' - domain does not exist"
-			return $OCF_NOT_RUNNING
-		fi
-		if [ "$err" != "${err/Connection refused/}" ]; then
-			ocf_log warn "Trying to migrate '$OCF_RESKEY_name' - connect refused"
-			return $OCF_ERR_CONFIGURED
-		fi
-	fi
-
-	return $?
-}
-
-#
-# A Resource group is abstract, but the OCF RA API doesn't allow for abstract
-# resources, so here it is.
-#
-
-case $1 in
-	start)
-		do_start
-		exit $?
-		;;
-	stop)
-		do_stop shutdown destroy
-		exit $?
-		;;
-	kill)
-		stop destroy
-		exit $?
-		;;
-	recover|restart)
-		exit 0
-		;;
-	status|monitor)
-		do_status
-		exit $?
-		;;
-	migrate)
-		migrate $2 # Send VM to this node
-		exit $?
-		;;
-	reload)
-		exit 0
-		;;
-	reconfig)
-		echo "$0 RECONFIGURING $OCF_RESKEY_memory"
-		reconfigure
-		exit $?
-		;;
-	meta-data)
-		meta_data
-		exit 0
-		;;
-	validate-all)
-		verify_all
-		exit $?
-		;;
-	*)
-		echo "usage: $0 {start|stop|restart|status|reload|reconfig|meta-data|validate-all}"
-		exit 1
-		;;
-esac
diff --git a/rgmanager/src/utils/Makefile b/rgmanager/src/utils/Makefile
deleted file mode 100644
index a458c6a..0000000
--- a/rgmanager/src/utils/Makefile
+++ /dev/null
@@ -1,75 +0,0 @@
-TARGET1= clubufflush
-TARGET2= clufindhostname
-TARGET3= clustat
-TARGET4= clusvcadm
-TARGET5= clulog
-TARGET6= clunfslock
-
-SBINDIRT=$(TARGET1) $(TARGET2) $(TARGET3) $(TARGET4) $(TARGET5) $(TARGET6)
-
-all: depends ${TARGET1} ${TARGET2} ${TARGET3} ${TARGET4} ${TARGET5} ${TARGET6}
-
-include ../../../make/defines.mk
-include $(OBJDIR)/make/cobj.mk
-include $(OBJDIR)/make/clean.mk
-include $(OBJDIR)/make/install.mk
-include $(OBJDIR)/make/uninstall.mk
-
-DISABLEDTARGETS= cluarp
-
-CFLAGS += -Werror -Wstrict-prototypes -Wshadow -fPIC -D_GNU_SOURCE
-CFLAGS += -I${ccsincdir} -I${cmanincdir} -I${dlmincdir}
-CFLAGS += -I${logtincdir} -I${ncursesincdir}
-CFLAGS += -I$(S)/../../include
-CFLAGS += -I${incdir}
-
-LDFLAGS += -L../clulib -lclulib
-LDFLAGS += -L${libdir}
-
-LDDEPS += ../clulib/libclulib.a
-
-CCS_LDFLAGS += -L${ccslibdir} -lccs
-CMAN_LDFLAGS += -L${cmanlibdir} -lcman
-LOGSYS_LDFLAGS += -L${logtlibdir} -llogthread
-NCURSES_LDFLAGS += -L${ncurseslibdir} -lncurses
-PTHREAD_LDFLAGS += -lpthread 
-
-OBJS1=	$(TARGET1).o
-OBJS2=	$(TARGET2).o
-OBJS3=	$(TARGET3).o
-OBJS4=	$(TARGET4).o
-OBJS5=	$(TARGET5).o
-
-${TARGET1}: ${OBJS1} ${LDDEPS}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-${TARGET2}: ${OBJS2} ${LDDEPS}
-	$(CC) -o $@ $^ $(LDFLAGS)
-
-${TARGET3}: ${OBJS3} ${LDDEPS}
-	$(CC) -o $@ $^ $(CCS_LDFLAGS) $(CMAN_LDFLAGS) \
-			$(NCURSES_LDFLAGS) $(PTHREAD_LDFLAGS) \
-			$(LOGSYS_LDFLAGS) $(LDFLAGS)
-
-${TARGET4}: ${OBJS4} ${LDDEPS}
-	$(CC) -o $@ $^ $(CMAN_LDFLAGS) $(PTHREAD_LDFLAGS) \
-			$(LOGSYS_LDFLAGS) $(LDFLAGS)
-
-${TARGET5}: ${OBJS5} ${LDDEPS}
-	$(CC) -o $@ $^ $(CCS_LDFLAGS) $(CMAN_LDFLAGS) \
-			$(LOGSYS_LDFLAGS) $(LDFLAGS)
-
-${TARGET6}:
-	cp $(S)/${TARGET6}.sh ${TARGET6}
-	chmod 755 ${TARGET6}
-
-depends:
-	$(MAKE) -C ../clulib all
-
-clean: generalclean
-
--include $(OBJS1:.o=.d)
--include $(OBJS2:.o=.d)
--include $(OBJS3:.o=.d)
--include $(OBJS4:.o=.d)
--include $(OBJS5:.o=.d)
diff --git a/rgmanager/src/utils/cluarp.c b/rgmanager/src/utils/cluarp.c
deleted file mode 100644
index 08f123e..0000000
--- a/rgmanager/src/utils/cluarp.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/** @file
- * Utility to generate a gratuitous ARP request on a given interface.
- */
-
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <sys/socket.h>
-#include <netinet/if_ether.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <string.h>
-
-#define	IP_ADDR_LEN	4
-#define	DEFAULT_DEVICE	"eth0"
-#define SA_DATA_LEN     14   /* Taken from include/linux/socket.h */
-
-/**
- * ARP frame structure.
- */
-struct arp_frame {
-	u_char	ether_dest_hw_addr[ETH_ALEN];
-	u_char	ether_src_hw_addr[ETH_ALEN];
-	u_short	ether_packet_type;
-	u_short	arp_hw_type;
-	u_short	arp_proto_type;
-	u_char	arp_hlen;
-	u_char	arp_plen;
-	u_short	op;
-	u_char	arp_sender_ha[ETH_ALEN];
-	u_char	arp_sender_ip[IP_ADDR_LEN];
-	u_char	arp_target_ha[ETH_ALEN];
-	u_char	arp_target_ip[IP_ADDR_LEN];
-	u_char	padding[18];
-};
-
-
-/**
- * Display usage information.
- */
-void usage(void)
-{
-    fprintf(stdout, 
-  "myarp <src_ip> <src_hw> <targ_ip> <targ_hw> [device]\n");
-}
-
-
-/**
- * Change a hardware ethernet address into an array of characters.
- * Warning: Unchecked bounds in copy_to.
- *
- * @param addr_string	NULL-terminated string in the format:
- *			"aa:bb:cc:dd:ee:ff"
- * @param copy_to	Pre-allocated array of at least 6 bytes,
- *			preferrably set to 0.
- */
-void
-parse_hw_addr(char *addr_string, u_char *copy_to)
-{
-        char	*c = addr_string, p, result=' ';  
-	int	i;
-
-	for (i = 0; i < ETH_ALEN; i++) {
-	    /* first digit */
-		if (*c == ':') 
-			c++;
-		p = tolower(*c++);	
-		if (isdigit(p))
-			result = p - '0'; 
-		else if (p >= 'a' && p <= 'z')
-			result = p - 'a' + 10;
-		*copy_to = result << 4;
-	    /* second digit */
-		if (*c == ':') 
-			c++;
-		p = tolower(*c++);	
-		if (isdigit(p))
-			result = p - '0'; 
-		else if (p >= 'a' && p <= 'z')
-			result = p - 'a' + 10;
-		*copy_to++ |= result;
-	}
-	return;
-}
-
-
-/**
- * Change an IP address into an array of characters.
- * Warning: Unchecked bounds in copy_to.
- *
- * @param addr_string	NULL-terminated string in the format:
- *			"10.1.2.3" (standard IPv4 dotted-quad).
- * @param copy_to	Pre-allocated array of at least 4 bytes,
- *			preferrably set to 0.
- */
-void
-parse_ip_addr(char *addr_string, u_char *copy_to)
-{
-	unsigned long		inaddr;
-
-	inaddr = inet_addr(addr_string);
-	memcpy(copy_to, &inaddr, IP_ADDR_LEN);
-
-}
-
-
-/**
- * Driver for cluarp.
- *
- * @return		0 on success, 1 on any failure.
- */
-int
-main(int argc, char **argv)
-{    
-
-	int	s;
-	struct arp_frame	arp_packet;
-	struct sockaddr		sockaddr;
-/* 	unsigned long		inaddr; */
-
-	if ((argc != 5) && (argc != 6)) {
-		usage();	
-		exit(1);
-	}
-
-	bzero(&arp_packet, sizeof(struct arp_frame));
-
-	parse_ip_addr(argv[1], arp_packet.arp_sender_ip);
-	parse_hw_addr(argv[2], arp_packet.ether_src_hw_addr);
-	parse_hw_addr(argv[2], arp_packet.arp_sender_ha);
-	parse_ip_addr(argv[3], arp_packet.arp_target_ip);
-	parse_hw_addr(argv[4], arp_packet.ether_dest_hw_addr);
-	parse_hw_addr(argv[4], arp_packet.arp_target_ha);
-
-	arp_packet.ether_packet_type	= htons(ETH_P_ARP);
-	arp_packet.arp_hw_type 		= htons(ETH_P_802_3);
-	arp_packet.arp_proto_type	= htons(ETH_P_IP);
-	arp_packet.arp_hlen		= ETH_ALEN;
-	arp_packet.arp_plen		= IP_ADDR_LEN;
-	arp_packet.op			= htons(ARPOP_REPLY);
-
-	s = socket(AF_PACKET,SOCK_PACKET,htons(ETH_P_RARP));
-
-	if (argc == 5)
-		strncpy(sockaddr.sa_data, DEFAULT_DEVICE, SA_DATA_LEN);
-	else
-		strncpy(sockaddr.sa_data, argv[5], SA_DATA_LEN);
-
-	if (sendto(s, &arp_packet, sizeof(struct arp_frame), 0,
-		   &sockaddr, sizeof(struct sockaddr)) < 0) {
-		perror("sendto");
-		exit(1);
-	}
-	exit(0);
-}
-
-
diff --git a/rgmanager/src/utils/clubufflush.c b/rgmanager/src/utils/clubufflush.c
deleted file mode 100644
index 3eaed48..0000000
--- a/rgmanager/src/utils/clubufflush.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/** @file
- * Calls ioctl to invalidate/flush buffers on a given device.
- *
- * Author: Gregory P. Myrdal <Myrdal@MissionCriticalLinux.Com>
- *
- * invalidatebuffers.c
- */
-
-/*
- * Version string that is filled in by CVS
- */
-static const char *version __attribute__ ((unused)) = "$Revision$";
-
-/*
- * System includes
- */
-#include <unistd.h>
-#include <stdio.h>
-#include <syslog.h>
-#include <linux/fs.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <errno.h>
-
-#ifdef __NFDBITS
-#undef __NFDBITS
-#endif
-
-#ifdef __FDMASK
-#undef __FDMASK
-#endif
-
-#include <sys/types.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <stdlib.h>
-/*
- * Cluster includes
- */
-#include <logging.h>
-
-/***************************************************************************
- *
- * Functions
- *
- ***************************************************************************/
-
-/**
- * printUsage
- *
- * Print out usage string to stdout.
- */
-static void
-printUsage(char *progName)
-{
-	printf("Usage: %s [-h] [-f device]\n", progName);
-}
-
-/***************************************************************************
- *
- * Main
- *
- ***************************************************************************/
-int
-main(int argc, char **argv)
-{
-	int opt;
-	uid_t uid;
-	char *devicename = (char *)NULL;
-	int fd;
-
-	uid=getuid();
-	if (uid)
-	  {
-	    printf("%s should only be run as user root\n", argv[0]);
-	    exit(1);
-	  }
-
-	while ((opt = getopt(argc, argv, "f:h")) != -1)
-	  {
-	    switch (opt)
-	      {
-              case 'f':			// stop services
-	        devicename = strdup(optarg);
-	        break;
-
-              case 'h':			// command line help
-                printUsage(argv[0]);
-	        exit(0);
-
-              default:			// unknown option
-                printUsage(argv[0]);     
-	        exit(0);
-	      }
-	  }
-
-	if (devicename == (char *)NULL)
-	  {
-	    printUsage(argv[0]);
-	    exit(1);
-	  }
-
-	fd = open(devicename, O_RDONLY, 0);
-
-	if (fd < 0)
-	  {
-	    printf("Cannot open %s for flushing: %s\n",
-	            devicename, strerror(errno));
-	    exit(1);
-	  }
-
-	if (ioctl(fd, BLKFLSBUF, 0) < 0)
-	  {
-	    printf("Cannot flush %s: %s\n", devicename, strerror(errno));
-	    exit(1);
-	  }
-	free(devicename);
-	close(fd);           
-
-	exit(0);
-}
diff --git a/rgmanager/src/utils/clufindhostname.c b/rgmanager/src/utils/clufindhostname.c
deleted file mode 100644
index db0929c..0000000
--- a/rgmanager/src/utils/clufindhostname.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/** @file
- * Utility/command to return name found by gethostbyname and gethostbyaddr.
- *
- * Author: Richard Rabbat <rabbat@missioncriticallinux.com>
- * IPv6 support added 7/2006
- */
-#include <netdb.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <arpa/inet.h>
-#include <string.h>
-
-void
-usage(char *progname)
-{
-	fprintf(stderr, "Usage: %s [-i ip_addr] [-n ip_name]\n", progname);
-}
-
-int
-main(int argc, char **argv)
-{
-	struct hostent *hp;
-	void *ptr;
-	struct in_addr  addr4;
-	struct in6_addr addr6;
-	int opt, size, family;
-	char *sep;
-
-	if (argc != 3) {
-		usage(argv[0]);
-		exit(1);
-	}
-
-	while ((opt = getopt(argc, argv, "i:n:")) != EOF) {
-		switch (opt) {
-		case 'i':
-			/* Check for IPv4 address */
-			sep = strchr(optarg, '.');
-			if (sep) {
-				family = AF_INET;
-				ptr = &addr4;
-				size = sizeof(addr4);
-			} else {
-				family = AF_INET6;
-				ptr = &addr6;
-				size = sizeof(addr6);
-			}
-
-			if (inet_pton(family, optarg, ptr) < 0) {
-				perror("inet_pton");
-				exit(2);
-			}
-
-			if (!(hp = gethostbyaddr(ptr, size, family))) {
-				exit(2);
-			} else {
-				fprintf(stdout, "%s\n", hp->h_name);
-				exit(0);
-			}
-			break;
-		case 'n':
-			if (!(hp = gethostbyname(argv[2]))) {
-				exit(2);
-			} else {
-				fprintf(stdout, "%s\n", hp->h_name);
-				exit(0);
-			}
-			break;
-		default:
-			break;
-		}
-	}
-	exit(0);
-}
diff --git a/rgmanager/src/utils/clulog.c b/rgmanager/src/utils/clulog.c
deleted file mode 100644
index fe4c6a1..0000000
--- a/rgmanager/src/utils/clulog.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/** @file
- * Utility for logging arbitrary strings to the cluster log file via syslog.
- *
- * Author: Lon Hohberger <lhh at redhat.com>
- * Based on original code by: Jeff Moyer <jmoyer at redhat.com>
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <limits.h>
-#include <libgen.h>
-#include <getopt.h>
-#include <string.h>
-#include <ccs.h>
-#include <logging.h>
-
-void
-usage(char *progname)
-{
-	fprintf(stdout, "%s -s severity \"message text\"\n", progname);
-	exit(0);
-}
-
-
-char *
-log_name(void)
-{
-	char lnk[PATH_MAX];
-	static char file[PATH_MAX];
-
-	snprintf(lnk, sizeof(lnk), "/proc/%d/exe", getppid());
-
-	printf("%s\n", lnk);
-
-	if (readlink(lnk, file, sizeof(file)) < 0) {
-		perror("readlink");
-		return NULL;
-	}
-	printf("%s\n", basename(file));
-
-	return basename(file);
-}
-
-
-int
-main(int argc, char **argv)
-{
-	int opt, ccsfd;
-	int severity = -1;
-
-	char *logmsg = argv[argc-1];
-	--argc;
-
-	while ((opt = getopt(argc, argv, "s:h")) != EOF) {
-		switch(opt) {
-		case 's':
-			severity = atoi(optarg);
-			break;
-		case 'h':
-		default:
-			usage(argv[0]);
-			break;
-		}
-	}
-
-	if (severity < 0)
-		severity = SYSLOGLEVEL;
-
-	init_logging(log_name(), 1, severity);
-	ccsfd = ccs_connect();
-	setup_logging(ccsfd);
-	ccs_disconnect(ccsfd);
-
-	logt_print(severity, "%s\n", logmsg);
-
-	close_logging();
-	return 0;
-}
diff --git a/rgmanager/src/utils/clunfslock.sh b/rgmanager/src/utils/clunfslock.sh
deleted file mode 100644
index 67b2d6d..0000000
--- a/rgmanager/src/utils/clunfslock.sh
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/bin/bash
-#
-# rpc.statd -H $0 to enable.  This provides the HA-callout capability
-# for RHCS-managed NFS services.  Note that you must edit
-# /etc/sysconfig/nfs in order to make this work; clumanager/rgmanager
-# will not interfere with a running nfs statd.
-#
-# Arg 3 (server as known to client) does not work; it's always 127.0.0.1
-# so we traverse all cluster mount points.
-#
-
-clustered_mounts()
-{
-	declare dev mp
-
-	while read dev mp; do
-		if [ "${dev:0:4}" != "/dev" ]; then
-			continue
-		fi
-
-		# XXX Need clumanager to create this on mount
-		if [ -d "$mp/.clumanager" ]; then
-			echo $dev $mp
-		fi
-	done < <(cat /proc/mounts | awk '{print $1,$2}')
-}
-
-
-add-client()
-{
-	declare dev mp
-
-	while read dev mp; do
-		[ -d "$mp/.clumanager/statd/sm" ] || \
-			mkdir -p $mp/.clumanager/statd/sm
-		touch $mp/.clumanager/statd/sm/$1
-	done < <(clustered_mounts)
-}
-
-
-del-client()
-{
-	while read $dev $mp; do
-		[ -d "$mp/.clumanager/statd/sm" ] || \
-			mkdir -p $mp/.clumanager/statd/sm
-		rm -f $mp/.clumanager/statd/sm/$1
-	done < <(clustered_mounts)
-}
-
-case "$1" in
-	add-client)
-		:
-		;;
-	del-client)
-		:
-		;;
-	*)
-		echo "Usage: $0 <add-client|del-client> <host> [server]"
-		exit 0
-esac
-
-
-if [ -z "$2" ]; then
-	echo "Usage: $0 <add-client|del-client> <host> [server]"
-	exit 1
-fi
-
-$1 $2 $3
-exit 0
diff --git a/rgmanager/src/utils/clunfsops.c b/rgmanager/src/utils/clunfsops.c
deleted file mode 100644
index 2a2d16a..0000000
--- a/rgmanager/src/utils/clunfsops.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/** @file
- * This program simply parses command line args and then calls the
- * corresponding system call.
- * These operations are for NFS failover semantics in an attempt to
- * shield clients from unnecessary stale file handle errors.
- *
- * File Origin - this command was reverse-engineered by starting with the
- * GPL syscall interfaces defined in <linux/nfsd/syscall.h>.
- */
- 
-#ifdef X86_64
-#define __ASM_SYSTEM_H
-#define __ASM_X86_64_PROCESSOR_H
-#endif
-
- 
-#define _LVM_H_INCLUDE /* XXX */
-#include <linux/list.h>
-#include <linux/kdev_t.h>
-#undef _LVM_H_INCLUDE
-#include <linux/socket.h>
-#include <linux/types.h>
-
-#ifdef S390
-#define __ssize_t_defined
-#endif
-
-#include <linux/unistd.h>
-/* 
- * lhh - someone thought it would be cute to remove the #ifdef __KERNEL__
- * around some of the system includes.  Now we have to fudge the #inclusion
- * of linux/types.h _AS_ sys/types.h just to compile.
- */
-#define _SYS_TYPES_H
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/errno.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/param.h>
-#include <signal.h>
-#include <syslog.h>
-
-/* XXX - should be this file, 
-#include <linux/nfsd/syscall.h>
- */
-/*
- * But, temporarily include this file to simplify the build on 
- * systems which aren't yet installed and therefore don't have the
- * header file w/ updated defines for new nfs syscalls.
- */
-#include "syscall.h"
-
-/*
- * Cluster include
- */
-#include <logging.h>
-
-
-/* Forward routine declarations. */
-static void usage(const char * cmd);
-int validateDevice(char *name);
-int nfsctl(int cmd, struct nfsctl_arg * argp, void * resp);
-
-/* Program Globals */
-static int verbose = 0;
-static char *cmdname;
-
-static void
-usage(const char * cmd)
-{
-        fprintf(stderr, "\n");
-        fprintf(stderr, "usage: %s [-ehsv] "
-		        "[-d deviceName] "
-		        "\n", cmd);
-        fprintf(stderr, "Options:\n");
-        fprintf(stderr, "-e\t\tInitiate flush of pending requests.\n");
-        fprintf(stderr, "-h\t\tPrints this help message.\n");
-        fprintf(stderr, "-s\t\tCancel pending flush of pending requests.\n");
-        fprintf(stderr, "-v\t\tIncreases verbose debugging level.\n");
-        fprintf(stderr, "\n");
-        fprintf(stderr, "NOTE: this command will only successfully run\n");
-        fprintf(stderr, "      if the correspoinding NFS kernel patches\n");
-        fprintf(stderr, "      are built into the kernel.\n");
-        fprintf(stderr, "\n");
-										        exit(1);
-}
-
-int
-main(int argc, char** argv)
-{
-	extern char *	optarg;
-	extern int	optind, opterr, optopt;
-	int errors = 0;
-	int errno_save = 0;
-	int nfsSyscallNum = 0;
-	char *nfsSyscallString = "BOGUS";
-	char *deviceName = NULL;
-	int c;
-	struct nfsctl_arg nfsctlarg;
-	int retval;
-
-    	if (geteuid() != (uid_t)0) {
-          	logt_print_and_print(LOG_ERR, "%s must be run as the root user.\n",
-                	argv[0]);
-        	exit(1);    
-    	}
-	if ((cmdname = strrchr(argv[0], '/')) == NULL) {
-		cmdname = argv[0];
-	}
-	else{
-		++cmdname;
-	}
-
-	while ((c = getopt(argc, argv, "d:ehsv")) != -1) {
-		switch(c) {
-		case 'd':	deviceName = optarg;
-				break;
-		case 'e':	
-				nfsSyscallNum = NFSCTL_FODROP;
-				nfsSyscallString = "NFSCTL_FODROP";
-				break;
-		case 'h':	usage(cmdname);
-				break;
-		case 's':	
-				nfsSyscallNum = NFSCTL_STOPFODROP;
-				nfsSyscallString = "NFSCTL_STOPFODROP";
-				break;
-		case 'v':	++verbose;
-				break;
-		default:	++errors;
-				break;
-		}
-	}
-	if (nfsSyscallNum == 0) {
-		logt_print_and_print(LOG_ERR, "%s: No NFS syscall has been "
-				 "specified.\n",cmdname);
-		++errors;
-	}
-	if (deviceName == NULL) {
-		logt_print_and_print(LOG_ERR, "%s: No device name has been "
-				 "specified.\n", cmdname);
-		++errors;
-	}
-	if (validateDevice(deviceName)) {
-		++errors;
-	}
-	if (errors) {
-		usage(cmdname);
-	}
-	if (verbose) {
-		printf("Calling: nfsSyscall = %s, deviceName = %s.\n", 
-				nfsSyscallString, deviceName);
-	}
-	/*
-	 * Setup the data structure expected by the kernel.
-	 */
-	memset(&nfsctlarg, 0, sizeof(struct nfsctl_arg));
-	nfsctlarg.ca_version = NFSCTL_VERSION;
-	strncpy(nfsctlarg.ca_fodrop.fo_dev, deviceName,
-	       sizeof(nfsctlarg.ca_fodrop.fo_dev));
-	nfsctlarg.ca_fodrop.fo_timeout = 1000; /* range 600-1200 */
-	/*
-	 * Jump into the kernel syscall.
-	 */
-	retval = nfsctl(nfsSyscallNum, &nfsctlarg, NULL);
-	if (retval != 0) {
-		/* logt_print_and_print calls syslog(), which modifies errno */
-		errno_save = errno;
-		logt_print_and_print(LOG_WARNING, "#72: %s: NFS syscall %s failed: "
-				 "%s.\n", cmdname, nfsSyscallString, 
-				 strerror(errno_save));
-		if (errno_save == EINVAL) {
-			logt_print_and_print(LOG_WARNING,
-				         "#73: %s: Kernel may not "
-					 "have NFS failover enhancements.\n",
-					 cmdname);
-		}
-		exit(errno_save);
-	}
-	else {
-	    if (verbose) {
-		printf("SUCCESS: nfsSyscall = %s, deviceName = %s.\n", 
-				nfsSyscallString, deviceName);
-	    }
-	}
-	exit(0);
-}
-
-/*
- * Validate the device parameter.  Make sure it refers to a block
- * device special file.
- * Returns: 0=success, nonzero=error.
- */
-int
-validateDevice(char *name) {
-	struct stat stat_st, *stat_ptr;
-	stat_ptr = &stat_st;
-
-	if (stat(name, stat_ptr) < 0) {
-		logt_print_and_print(LOG_ERR, "%s: Unable to stat %s.\n", cmdname, name);
-		return(1);
-	}
-	/*
-	 * Verify that its a block or character special file.
-	 */
-	if (S_ISBLK(stat_st.st_mode) == 0) {
-		logt_print_and_print(LOG_ERR, "%s: %s is not a block special file.\n", cmdname, name);
-		return(1);
-	}
-	return(0); // success
-}
-
-/*
- * Routine to format make appropriate NFS syscall.
- * Leveraged from nfs-utils.
- */
-int
-nfsctl(int cmd, struct nfsctl_arg * argp, void * resp)
-{
-	  return syscall (__NR_nfsservctl, cmd, argp, resp);
-}
-
diff --git a/rgmanager/src/utils/clustat.c b/rgmanager/src/utils/clustat.c
deleted file mode 100644
index 8a33fac..0000000
--- a/rgmanager/src/utils/clustat.c
+++ /dev/null
@@ -1,1148 +0,0 @@
-#include <members.h>
-#include <message.h>
-#include <msgsimple.h>
-#include <resgroup.h>
-#include <platform.h>
-#include <libgen.h>
-#include <ncurses.h>
-#include <term.h>
-#include <rg_types.h>
-#include <termios.h>
-#include <ccs.h>
-#include <libcman.h>
-#include <signal.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#define FLAG_UP    0x1
-#define FLAG_LOCAL 0x2
-#define FLAG_RGMGR 0x4
-#define FLAG_NOCFG 0x8	/* Shouldn't happen */
-#define FLAG_QDISK 0x10
-#define FLAG_RGMAST 0x20 /* for RIND */
-
-#define RG_VERBOSE 0x1
-
-#define QSTAT_ONLY 1
-#define VERSION_ONLY 2
-#define NODEID_ONLY 3
-
-
-int running = 1;
-int dimx = 80, dimy = 24, stdout_is_tty = 0;
-int rgmanager_master_present = 0;
-
-void
-term_handler(int sig)
-{
-	running = 0;
-}
-
-
-typedef struct {
-	int rgl_count;
-	rg_state_t rgl_states[0];
-} rg_state_list_t;
-
-
-int
-rg_name_sort(const void *left, const void *right)
-{
-	return strcmp(((rg_state_t *)left)->rs_name,
-		      ((rg_state_t *)right)->rs_name);
-}
-
-
-int
-member_id_sort(const void *left, const void *right)
-{
-	cman_node_t *l = (cman_node_t *)left;
-	cman_node_t *r = (cman_node_t *)right;
-
-	if (l->cn_nodeid < r->cn_nodeid)
-		return -1;
-	if (l->cn_nodeid > r->cn_nodeid)
-		return 1;
-	return 0;
-}
-
-
-void
-flag_rgmanager_nodes(cluster_member_list_t *cml)
-{
-	msgctx_t ctx;
-	int max = 0, n;
-	generic_msg_hdr *msgp;
-	fd_set rfds;
-
-	struct timeval tv;
-
-	if (msg_open(MSG_SOCKET, 0, 0, &ctx, 10) < 0) {
-		//perror("msg_open");
-		return;
-	}
-
-	msg_send_simple(&ctx, RG_STATUS_NODE, 0, 0);
-
-	while (1) {
-		FD_ZERO(&rfds);
-		msg_fd_set(&ctx, &rfds, &max);
-		tv.tv_sec = 10;
-		tv.tv_usec = 0;
-
-		n = select(max+1, &rfds, NULL, NULL, &tv);
-		if (n == 0) {
-			fprintf(stderr, "Timed out waiting for a response "
-				"from Resource Group Manager\n");
-			break;
-		}
-
-		if (n < 0) {
-			if (errno == EAGAIN ||
-			    errno == EINTR)
-				continue;
-			fprintf(stderr, "Failed to receive "
-				"service data: select: %s\n",
-				strerror(errno));
-			break;
-		}
-
-		n = msg_receive_simple(&ctx, &msgp, tv.tv_sec);
-
-		if (n < 0) {
-			if (errno == EAGAIN)
-				continue;
-			perror("msg_receive_simple");
-			break;
-		}
-	        if (n < sizeof(generic_msg_hdr)) {
-			printf("Error: Malformed message\n");
-			break;
-		}
-
-		if (!msgp) {
-			printf("Error: no message?!\n");
-			break;
-		}
-
-		swab_generic_msg_hdr(msgp);
-
-		if (msgp->gh_command == RG_FAIL) {
-			printf("Member states unavailable: %s\n", 
-			       rg_strerror(msgp->gh_arg1));
-			free(msgp);
-			msg_close(&ctx);
-			return;
-		}	
-
-		if (msgp->gh_command == RG_SUCCESS) {
-			free(msgp);
-			break;
-		}
-
-		for (n = 0; n < cml->cml_count; n++) {
-			if (cml->cml_members[n].cn_nodeid != msgp->gh_arg1)
-				continue;
-			cml->cml_members[n].cn_member |= FLAG_RGMGR;
-			if (msgp->gh_arg2) {
-				rgmanager_master_present = 1;
-				cml->cml_members[n].cn_member |= FLAG_RGMAST;
-			}
-		}
-
-		free(msgp);
-		msgp = NULL;
-	}
-
-	msg_send_simple(&ctx, RG_SUCCESS, 0, 0);
-	msg_close(&ctx);
-
-	return;
-}
-
-
-rg_state_list_t *
-rg_state_list(int local_node_id, int fast)
-{
-	msgctx_t ctx;
-	int max = 0, n, x;
-	rg_state_list_t *rsl = NULL;
-	generic_msg_hdr *msgp = NULL;
-	rg_state_msg_t *rsmp = NULL;
-	fd_set rfds;
-
-	struct timeval tv;
-
-	if (msg_open(MSG_SOCKET, 0, 0, &ctx, 10) < 0) {
-		//perror("msg_open");
-		return NULL;
-	}
-
-	msg_send_simple(&ctx, RG_STATUS, fast, 0);
-
-	rsl = malloc(sizeof(rg_state_list_t));
-	if (!rsl) {
-		printf("Try again, out of memory\n");
-		exit(0);
-	}
-	memset(rsl, 0, sizeof(rg_state_list_t));
-
-	while (1) {
-		FD_ZERO(&rfds);
-		msg_fd_set(&ctx, &rfds, &max);
-		tv.tv_sec = 10;
-		tv.tv_usec = 0;
-
-		n = select(max+1, &rfds, NULL, NULL, &tv);
-		if (n == 0) {
-			fprintf(stderr, "Timed out waiting for a response "
-				"from Resource Group Manager\n");
-			break;
-		}
-
-		if (n < 0) {
-			if (errno == EAGAIN ||
-			    errno == EINTR)
-				continue;
-			fprintf(stderr, "Failed to receive "
-				"service data: select: %s\n",
-				strerror(errno));
-			break;
-		}
-
-		n = msg_receive_simple(&ctx, &msgp, tv.tv_sec);
-
-		if (n < 0) {
-			if (errno == EAGAIN)
-				continue;
-			perror("msg_receive_simple");
-			break;
-		}
-	        if (n < sizeof(generic_msg_hdr)) {
-			printf("Error: Malformed message\n");
-			break;
-		}
-
-		if (!msgp) {
-			printf("Error: no message?!\n");
-			break;
-		}
-
-		swab_generic_msg_hdr(msgp);
-
-		if (msgp->gh_command == RG_FAIL) {
-			printf("Service states unavailable: %s\n", 
-			       rg_strerror(msgp->gh_arg1));
-			msg_close(&ctx);
-			return NULL;
-		}	
-
-		if (msgp->gh_command == RG_SUCCESS) {
-			free(msgp);
-			break;
-		}
-
-		if (n < sizeof(*rsmp)) {
-			msg_close(&ctx);
-			return NULL;
-		}
-
-		rsmp = (rg_state_msg_t *)msgp;
-
-		swab_rg_state_t(&rsmp->rsm_state);
-
-		rsl->rgl_count++;
-		x = sizeof(rg_state_list_t) +
-			(sizeof(rg_state_t) * rsl->rgl_count);
-		rsl = realloc(rsl, x);
-		if (!rsl) {
-			printf("Try again; out of RAM\n");
-			exit(1);
-		}
-		
-		memcpy(&rsl->rgl_states[(rsl->rgl_count-1)], 
-		       &rsmp->rsm_state, sizeof(rg_state_t));
-
-		free(msgp);
-		msgp = NULL;
-	}
-
-	msg_send_simple(&ctx, RG_SUCCESS, 0, 0);
-	msg_close(&ctx);
-
-	if (!rsl->rgl_count) {
-		free(rsl);
-		return NULL;
-	}
-
-	qsort(rsl->rgl_states, rsl->rgl_count, sizeof(rg_state_t),
-	      rg_name_sort);
-
-	return rsl;
-}
-
-
-cluster_member_list_t *ccs_member_list(void)
-{
-	int desc;
-	int x;
-	char buf[128];
-	char *name;
-	cluster_member_list_t *ret = NULL;
-	cman_node_t *nodes = NULL;
-
-	desc = ccs_connect();
-	if (desc < 0) {
-		return NULL;
-	}
-
-	while ((ret = malloc(sizeof(*ret))) == NULL)
-		sleep(1);
-	
-	x = 0;
-	memset(buf, 0, sizeof(buf));
-
-	while (++x) {
-		name = NULL;
-		snprintf(buf, sizeof(buf)-1,
-			"/cluster/clusternodes/clusternode[%d]/@name", x);
-
-		if (ccs_get(desc, buf, &name) != 0)
-			break;
-
-		if (!name)
-			break;
-		if (!strlen(name)) {
-			free(name);
-			continue;
-		}
-
-		if (!nodes) {
-			nodes = malloc(x * sizeof(cman_node_t));
-			if (!nodes) {
-				perror("malloc");
-				ccs_disconnect(desc);
-				exit(1);
-			}
-		} else {
-			nodes = realloc(nodes, x * sizeof(cman_node_t));
-			if (!nodes) {
-				perror("realloc");
-				ccs_disconnect(desc);
-				exit(1);
-			}
-		}
-
-		memset(&nodes[x-1], 0, sizeof(cman_node_t));
-		strncpy(nodes[x-1].cn_name, name,
-			sizeof(nodes[x-1].cn_name));
-		free(name);
-
-		/* Add node ID */
-		snprintf(buf, sizeof(buf)-1,
-			 "/cluster/clusternodes/clusternode[%d]/@nodeid", x);
-		if (ccs_get(desc, buf, &name) == 0) {
-			nodes[x-1].cn_nodeid = atoi(name);
-			free(name);
-		}
-
-		ret->cml_count = x;
-	}
-
-	ccs_disconnect(desc);
-	ret->cml_members = nodes;
-
-	qsort(ret->cml_members, ret->cml_count, sizeof(cman_node_t),
-	      member_id_sort);
-
-	return ret;
-}
-
-
-void
-flag_nodes(cluster_member_list_t *all, cluster_member_list_t *these,
-	   uint8_t flag)
-{
-	int x;
-	cman_node_t *m;
-
-	for (x=0; x<all->cml_count; x++) {
-
-		m = memb_name_to_p(these, all->cml_members[x].cn_name);
-
-		if (m && m->cn_member) {
-			all->cml_members[x].cn_nodeid = m->cn_nodeid;
-			all->cml_members[x].cn_member |= flag;
-		}
-	}
-}
-
-
-cluster_member_list_t *
-add_missing(cluster_member_list_t *all, cluster_member_list_t *these)
-{
-	int x, y, addflag;
-	cman_node_t *m, *nn;
-
-	if (!these)
-		return all;
-
-	for (x=0; x<these->cml_count; x++) {
-
-		m = NULL;
-        	for (y = 0; y < all->cml_count; y++) {
-			if (!strcmp(all->cml_members[y].cn_name,
-				    these->cml_members[x].cn_name))
-                        	m = &all->cml_members[y];
-		}
-        	
-		if (!m) {
-			all->cml_members = realloc(all->cml_members,
-						   (all->cml_count+1) *
-						   sizeof(cman_node_t));
-			if (!all->cml_members) {
-				perror("realloc");
-				exit(1);
-			}
-			
-			nn = &all->cml_members[all->cml_count];
-
-			memcpy(nn, &these->cml_members[x],
-			       sizeof(cman_node_t));
-			
-			if (nn->cn_nodeid == 0) { /* quorum disk? */
-				addflag = FLAG_QDISK;
-			} else {
-				addflag = FLAG_NOCFG;
-			}
-
-			if (nn->cn_member) {
-				nn->cn_member = FLAG_UP | addflag;
-			} else {
-				nn->cn_member = addflag;
-			}
-			++all->cml_count;
-
-		}
-	}
-
-	return all;
-}
-
-
-char *
-my_memb_id_to_name(cluster_member_list_t *members, int memb_id)
-{
-	int x;
-
-	if (memb_id == 0)
-		return "none";
-
-	for (x = 0; x < members->cml_count; x++) {
-		if (members->cml_members[x].cn_nodeid == memb_id)
-			return members->cml_members[x].cn_name;
-	}
-
-	return "unknown";
-}
-
-
-void
-_txt_rg_state(rg_state_t *rs, cluster_member_list_t *members, int flags,
-	      int svcsize, int nodesize, int statsize)
-{
-	char owner[MAXHOSTNAMELEN+1];
-	char *name = rs->rs_name, *ptr;
-	int l;
-
-	if (stdout_is_tty) {
-		ptr = strchr(rs->rs_name, ':');
-		if (ptr) {
-			l = (int)(ptr - rs->rs_name);
-			if ((l == 7) &&  /* strlen("service") == 7 */
-			    (strncmp(rs->rs_name, "service", l) == 0)) 
-				name = ptr+1;
-		}
-	}
-
-	memset(owner, 0, sizeof(owner));
-
-	if (rs->rs_state == RG_STATE_STOPPED ||
-	    rs->rs_state == RG_STATE_DISABLED ||
-	    rs->rs_state == RG_STATE_ERROR ||
-	    rs->rs_state == RG_STATE_FAILED) {
-
-		snprintf(owner, sizeof(owner)-1, "(%-.*s)", nodesize-2,
-			 my_memb_id_to_name(members, rs->rs_last_owner));
-	} else {
-
-		snprintf(owner, sizeof(owner)-1, "%-.*s", nodesize,
-			 my_memb_id_to_name(members, rs->rs_owner));
-	}
-	
-	printf(" %-*.*s %-*.*s %-*.*s\n",
-	       svcsize, svcsize, rs->rs_name,
-	       nodesize, nodesize, owner,
-	       statsize, statsize, rg_state_str(rs->rs_state));
-}
-
-
-void
-_txt_rg_state_v(rg_state_t *rs, cluster_member_list_t *members, int flags)
-{
-	time_t t;
-
-	printf("Service Name      : %s\n", rs->rs_name);
-	printf("  Current State   : %s (%d)\n",
-	       rg_state_str(rs->rs_state), rs->rs_state);
-	printf("  Owner           : %s\n",
-	       my_memb_id_to_name(members, rs->rs_owner));
-	printf("  Last Owner      : %s\n",
-	       my_memb_id_to_name(members, rs->rs_last_owner));
-
-	t = (time_t)(rs->rs_transition);
-	printf("  Last Transition : %s\n", ctime(&t));
-}
-
-
-void
-txt_rg_state(rg_state_t *rs, cluster_member_list_t *members, int flags, int svcsize, 
-	     int nodesize, int statsize)
-{
-	if (flags & RG_VERBOSE) 
-		_txt_rg_state_v(rs, members, flags);
-	else
-		_txt_rg_state(rs, members, flags, svcsize, nodesize, statsize);
-}
-
-
-void
-xml_rg_state(rg_state_t *rs, cluster_member_list_t *members, int flags)
-{
-	char time_str[32];
-	int x;
-	time_t t;
-
-	/* Chop off newlines */
-       	t = (time_t)(rs->rs_transition);
-	ctime_r(&t, time_str);
-	for (x = 0; time_str[x]; x++) {
-		if (time_str[x] < 32) {
-			time_str[x] = 0;
-			break;
-		}
-	}
-
-	printf("    <group name=\"%s\" state=\"%d\" state_str=\"%s\" "
-	       " owner=\"%s\" last_owner=\"%s\" restarts=\"%d\""
-	       " last_transition=\"%llu\" last_transition_str=\"%s\"/>\n",
-	       rs->rs_name,
-	       rs->rs_state,
-	       rg_state_str(rs->rs_state),
-	       my_memb_id_to_name(members, rs->rs_owner),
-	       my_memb_id_to_name(members, rs->rs_last_owner),
-	       rs->rs_restarts,
-	       (long long unsigned)rs->rs_transition,
-	       time_str);
-}
-
-
-void
-build_service_field_sizes(int cols, int *svcsize, int *nodesize, int *statsize)
-{
-	/* Based on 80 columns */
-	*svcsize = 30;
-	*nodesize = 30;
-	*statsize = 14;	/* uninitialized */
-	int pad = 6;		/* Spaces and such; newline */
-
-	*svcsize = (cols - (*statsize + pad)) / 2;
-	*nodesize = (cols - (*statsize + pad)) / 2;
-	if (*svcsize > MAXHOSTNAMELEN)
-		*svcsize = MAXHOSTNAMELEN;
-	if (*nodesize > MAXHOSTNAMELEN)
-		*nodesize = MAXHOSTNAMELEN;
-}
-
-
-int
-txt_rg_states(rg_state_list_t *rgl, cluster_member_list_t *members, 
-	      char *svcname, int flags)
-{
-	int x, ret = 0, svcsize, nodesize, statsize;
-
-	if (!rgl || !members)
-		return -1;
-
-	if (svcname)
-		ret = -1;
-
-	build_service_field_sizes(dimx, &svcsize, &nodesize, &statsize);
-
-	if (!(flags & RG_VERBOSE)) {
-
-		printf(" %-*.*s %-*.*s %-*.*s\n",
-		       svcsize, svcsize, "Service Name",
-		       nodesize, nodesize, "Owner (Last)",
-	       	       statsize, statsize, "State");
-		printf(" %-*.*s %-*.*s %-*.*s\n",
-		       svcsize, svcsize, "------- ----",
-		       nodesize, nodesize, "----- ------",
-		       statsize, statsize, "-----");
-	} else {
-		printf("Service Information\n"
-		       "------- -----------\n\n");
-	}
-
-	for (x = 0; x < rgl->rgl_count; x++) {
-		if (svcname &&
-		    strcmp(rgl->rgl_states[x].rs_name, svcname))
-			continue;
-		txt_rg_state(&rgl->rgl_states[x], members, flags,
-			     svcsize, nodesize, statsize);
-		if (svcname) {
-			switch (rgl->rgl_states[x].rs_state) {
-			case RG_STATE_STARTING:
-			case RG_STATE_STARTED:
-			case RG_STATE_STOPPING:
-				ret = 0;
-				break;
-			default:
-				ret = rgl->rgl_states[x].rs_state;
-			}
-		}
-	}
-
-	return ret;
-}
-
-
-int
-xml_rg_states(rg_state_list_t *rgl, cluster_member_list_t *members,
-	      char *svcname, int flags)
-{
-	int x;
-	int ret = 0;
-
-	if (!rgl || !members)
-		return -1;
-
-	printf("  <groups>\n");
-
-	for (x = 0; x < rgl->rgl_count; x++) {
-		if (svcname &&
-		    strcmp(rgl->rgl_states[x].rs_name, svcname))
-			continue;
-		xml_rg_state(&rgl->rgl_states[x], members, flags);
-		if (svcname) {
-			switch (rgl->rgl_states[x].rs_state) {
-			case RG_STATE_STARTING:
-			case RG_STATE_STARTED:
-			case RG_STATE_STOPPING:
-				break;
-			default:
-				ret = rgl->rgl_states[x].rs_state;
-			}
-		}
-	}
-
-	printf("  </groups>\n");
-	return ret;
-}
-
-
-void
-txt_quorum_state(int qs)
-{
-	printf("Member Status: ");
-
-	if (qs) {
-		printf("Quorate\n\n");
-	} else {
-		printf("Inquorate\n\n");
-	}
-}
-
-
-void
-txt_cluster_info(cman_cluster_t *ci) 
-{
-	time_t now = time(NULL);
-
-	printf("Cluster Status for %s @ %s",
-	       ci->ci_name, ctime(&now));
-}
-
-
-void
-xml_cluster_info(cman_cluster_t *ci) 
-{
-	printf("  <cluster name=\"%s\" id=\"%d\" generation=\"%d\"/>\n",
-	       ci->ci_name, ci->ci_number, ci->ci_generation);
-}
-
-
-void
-xml_quorum_state(int qs)
-{
-	/* XXX output groupmember attr (carry over from RHCS4) */
-	printf("  <quorum ");
-
-	if (qs & FLAG_UP) {
-		printf("quorate=\"1\"");
-	} else {
-		printf("quorate=\"0\"\n");
-	}
-	if (qs & FLAG_RGMGR) {
-		printf(" groupmember=\"1\"");
-	} else {
-		printf(" groupmember=\"0\"");
-	}
-
-	printf("/>\n");
-}
-
-void
-build_member_field_size(int cols, int *nodesize)
-{
-	/* Based on 80 columns */
-	*nodesize = 40;
-
-	*nodesize = (cols / 2);
-	if (*nodesize > MAXHOSTNAMELEN)
-		*nodesize = MAXHOSTNAMELEN;
-}
-
-
-void
-txt_member_state(cman_node_t *node, int nodesize)
-{
-	/* If it's down and not in cluster.conf, don't show it */
-	if ((node->cn_member & (FLAG_NOCFG | FLAG_UP)) == FLAG_NOCFG)
-		return;
-
-	printf(" %-*.*s ", nodesize, nodesize, node->cn_name);
-	printf("%4d ", node->cn_nodeid);
-
-	if (node->cn_member & FLAG_UP)
-		printf("Online");
-	else
-		printf("Offline");
-
-	if (node->cn_member & FLAG_LOCAL)
-		printf(", Local");
-	
-	if (node->cn_member & FLAG_NOCFG)
-		printf(", Estranged");
-	
-	if (node->cn_member & FLAG_RGMGR) {
-		if (rgmanager_master_present) {
-			if (node->cn_member & FLAG_RGMAST) 
-				printf(", RG-Master");
-			else
-				printf(", RG-Worker");
-		} else {
-			printf(", rgmanager");
-		}
-	}
-	
-	if (node->cn_member & FLAG_QDISK)
-		printf(", Quorum Disk");
-
-	printf("\n");
-}
-
-
-void
-xml_member_state(cman_node_t *node)
-{
-	/* If it's down and not in cluster.conf, don't show it */
-	if ((node->cn_member & (FLAG_NOCFG | FLAG_UP)) == FLAG_NOCFG)
-		return;
-
-	printf("    <node name=\"%s\" state=\"%d\" local=\"%d\" "
-	       "estranged=\"%d\" rgmanager=\"%d\" rgmanager_master=\"%d\" "
-	       "qdisk=\"%d\" nodeid=\"0x%08x\"/>\n",
-	       node->cn_name,
-	       !!(node->cn_member & FLAG_UP),
-	       !!(node->cn_member & FLAG_LOCAL),
-	       !!(node->cn_member & FLAG_NOCFG),
-	       !!(node->cn_member & FLAG_RGMGR),
-	       !!(node->cn_member & FLAG_RGMAST),
-	       !!(node->cn_member & FLAG_QDISK),
-	       (uint32_t)((node->cn_nodeid      )&0xffffffff));
-}
-
-
-int
-txt_member_states(cluster_member_list_t *membership, char *name)
-{
-	int x, ret = 0, nodesize;
-
-  	if (!membership) {
-  		printf("Membership information not available\n");
- 		return -1;
-  	}
-
-	build_member_field_size(dimx, &nodesize);
-
-	printf(" %-*.*s", nodesize, nodesize, "Member Name");
-	printf("%-4.4s %s\n", "ID", "Status");
-	printf(" %-*.*s", nodesize, nodesize, "------ ----");
-	printf("%-4.4s %s\n", "----", "------");
-
-	for (x = 0; x < membership->cml_count; x++) {
-		if (name && strcmp(membership->cml_members[x].cn_name, name))
-			continue;
-		txt_member_state(&membership->cml_members[x], nodesize);
- 		ret = !(membership->cml_members[x].cn_member & FLAG_UP);
-	}
-
-	printf("\n");
-	return ret;
-}
-
-
-int
-xml_member_states(cluster_member_list_t *membership, char *name)
-{
-	int x, ret = 0;
-
-	if (!membership) {
-		printf("  <nodes/>\n");
-		return -1;
-	}
-
-	printf("  <nodes>\n");
-	for (x = 0; x < membership->cml_count; x++) {
-		if (name && strcmp(membership->cml_members[x].cn_name, name))
-			continue;
-		xml_member_state(&membership->cml_members[x]);
-		if (name)
-			ret = !(membership->cml_members[x].cn_member & FLAG_UP);
-	}
-	printf("  </nodes>\n");
-	
-	return ret;
-}
-
-
-int 
-txt_cluster_status(cman_cluster_t *ci,
-		   int qs, cluster_member_list_t *membership,
-		   rg_state_list_t *rgs, char *name, char *svcname, 
-		   int flags)
-{
-	int ret = 0;
-	
-	if (!svcname && !name) {
-  		txt_cluster_info(ci);
-		txt_quorum_state(qs);
-		if (!membership) {
-			/* XXX Check for rgmanager?! */
-			printf("Resource Group Manager not running; "
-			       "no service information available.\n\n");
-		}
-	}
-
-  	if (!svcname || (name && svcname))
- 		ret = txt_member_states(membership, name);
- 	if (name && !svcname)
- 		return ret;
- 	if (!name || (name && svcname))
- 		ret = txt_rg_states(rgs, membership, svcname, flags);
-
- 	return ret;
-}
-
-
-int
-xml_cluster_status(cman_cluster_t *ci, int qs,
-		   cluster_member_list_t *membership,
-		   rg_state_list_t *rgs, char *name, char *svcname,
-		   int flags)
-{
- 	int ret1 = 0, ret2 = -1;
-	int x;
-
-	printf("<?xml version=\"1.0\"?>\n");
-	printf("<clustat version=\"4.1.1\">\n");
-
-	if (qs) {
-		qs = FLAG_UP;
-		if (membership) {
-			for (x = 0; x < membership->cml_count; x++) {
-				if ((membership->cml_members[x].cn_member &
-				     (FLAG_LOCAL|FLAG_RGMGR)) ==
-				     (FLAG_LOCAL|FLAG_RGMGR)) {
-					qs |= FLAG_RGMGR;
-					break;
-				}
-			}
-		}
-	}
-
-  	if (!svcname && !name)
-  		xml_cluster_info(ci);
-  	if (!svcname && !name)
-  		xml_quorum_state(qs);
-  	if (!svcname || (name && svcname)) 
- 		ret1 = xml_member_states(membership, name);
- 	
-  	if (rgs &&
-  	    (!name || (name && svcname)))
- 		ret2 = xml_rg_states(rgs, membership, svcname, flags);
-  	printf("</clustat>\n");
- 	
- 	if (name && ret1)
- 		return ret1;
- 	if (svcname && ret2)
- 		return ret2;
- 	return 0;
-}
-
-
-cluster_member_list_t *
-build_member_list(cman_handle_t ch, int *lid)
-{
-	cluster_member_list_t *all, *part;
-	cman_node_t *m;
-	int root = 0;
-	int x;
-
-	/* Get all members from ccs, and all members reported by the cluster
-	   infrastructure */
-	root = (getuid() == 0 || geteuid() == 0);
-
-	part = get_member_list(ch);
-
-	if (root && (all = ccs_member_list())) {
-
-		/* See if our config has anyone missed.  If so, flag
-		   them as missing from the config file */
-		all = add_missing(all, part);
-
-		/* Flag online nodes */
-		flag_nodes(all, part, FLAG_UP);
-		free_member_list(part);
-	} else {
-		/* not root - keep it simple for the next block */
-		all = part;
-	}
-
-	if (!all) {
-		*lid = 0;
-		return NULL;
-	}
-
-	/* Grab the local node ID and flag it from the list of reported
-	   online nodes */
-	*lid = get_my_nodeid(ch);
-	/* */
-	for (x=0; x<all->cml_count; x++) {
-		if (all->cml_members[x].cn_nodeid == *lid) {
-			m = &all->cml_members[x];
-			m->cn_member |= FLAG_LOCAL;
-			break;
-		}
-	}
-
-	return all;
-}
-
-
-void
-usage(char *arg0)
-{
-	printf(
-"usage: %s <options>\n"
-"    -i <interval>      Refresh every <interval> seconds.  May not be used\n"
-"                       with -x.\n"
-"    -I                 Display local node ID and exit\n"
-"    -m <member>        Display status of <member> and exit\n"
-"    -s <service>       Display status of <service> and exit\n"
-"    -v                 Display version & cluster plugin and exit\n"
-"    -x                 Dump information as XML\n"
-"    -Q			Return 0 if quorate, 1 if not (no output)\n"
-"    -f			Enable fast clustat reports\n"
-"    -l			Use long format for services\n"
-"\n", basename(arg0));
-}
-
-
-int
-main(int argc, char **argv)
-{
-	int qs, ret = 0;
-	cluster_member_list_t *membership;
-	rg_state_list_t *rgs = NULL;
-	int local_node_id;
-	int fast = 0;
-	int runtype = 0;
-	time_t now;
-	cman_handle_t ch = NULL;
-	cman_cluster_t ci;
-
-	int refresh_sec = 0, errors = 0;
-	int opt, xml = 0, flags = 0;
-	char *member_name = NULL;
-	char *rg_name = NULL, real_rg_name[64];
-
-	while ((opt = getopt(argc, argv, "fIls:m:i:xvQh?")) != EOF) {
-		switch(opt) {
-		case 'v':
-			runtype = VERSION_ONLY;
-			break;
-
-		case 'I':
-			runtype = NODEID_ONLY;
-			break;
-
-		case 'i':
-			refresh_sec = atoi(optarg);
-			if (refresh_sec <= 0)
-				refresh_sec = 1;
-			break;
-		case 'l':
-			flags |= RG_VERBOSE;
-			break;
-
-		case 'm':
-			member_name = optarg;
-			break;
-
-		case 'Q':
-			/* Return to shell: 0 true, 1 false... */
-			runtype = QSTAT_ONLY;
-			break;
-
-		case 's':
-			rg_name = optarg;
-			if (!strchr(rg_name,':')) {
-				memset(real_rg_name, 0, sizeof(real_rg_name));
-				snprintf(real_rg_name,
-					 sizeof(real_rg_name)-1,
-					 "service:%s", rg_name);
-				rg_name = real_rg_name;
-			}
-			break;
-
-		case 'x':
-			if (refresh_sec) {
-				printf("Error: Options '-i' and '-x' are "
-				       "mutually exclusive\n");
-				ret = 1;
-				goto cleanup;
-			}
-
-			xml = 1;
-			break;
-		case 'f':
-			++fast;
-			break;
-		case '?':
-		case 'h':
-			usage(argv[0]);
-			return 0;
-			break;
-		default:
-			errors++;
-			break;
-		}
-	}
-
-	if (errors) {
-		usage(argv[0]);
-		return 1;
-	}
-
-	signal(SIGPIPE, SIG_IGN);
-
-	/* Connect & grab all our info */
-	ch = cman_init(NULL);
-	if (!ch) {
-		perror("Could not connect to CMAN");
-		return 1;
-	}
-
-	switch(runtype) {
-	case QSTAT_ONLY:
-		if (!ch)
-		       break;
-		ret = !(cman_is_quorate(ch));
-		goto cleanup;
-	case VERSION_ONLY:
-		printf("%s version %s\n", basename(argv[0]),
-		       RELEASE_VERSION);
-		if (!ch)
-		       break;
-		goto cleanup;
-	case NODEID_ONLY:
-		if (!ch)
-		       break;
-		local_node_id = get_my_nodeid(ch);
-		printf("0x%08x\n",(uint32_t)(local_node_id)); 
-		goto cleanup;
-	}
-
-	if (!ch) {
-		printf("Could not connect to cluster service\n");
-		return 1;
-	}
-
-	/* XXX add member/rg single-shot state */
-	signal(SIGINT, term_handler);
-	signal(SIGTERM, term_handler);
-
-	if (isatty(STDOUT_FILENO)) {
-		stdout_is_tty = 1;
-		setupterm((char *) 0, STDOUT_FILENO, (int *) 0);
-		dimx = tigetnum("cols");
-		dimy = tigetnum("lines");
-	}
-
-	memset(&ci, 0, sizeof(ci));
-	cman_get_cluster(ch, &ci);
-
-	while (1) {
-		qs = cman_is_quorate(ch);
-		membership = build_member_list(ch, &local_node_id);
-		
-		if (!member_name)
-			rgs = rg_state_list(local_node_id, fast);
-		if (rgs) {
-			flag_rgmanager_nodes(membership);
-		}
-
-		if (refresh_sec) {
-			tputs(clear_screen, lines > 0 ? lines : 1, putchar);
-			now = time(NULL);
-		}
-
-		if (xml)
-			ret = xml_cluster_status(&ci, qs, membership, rgs,
-						 member_name, rg_name,
-						 flags);
-		else
-			ret = txt_cluster_status(&ci, qs, membership, rgs,
-						 member_name, rg_name,
-						 flags);
-
-		if (membership)
-			free_member_list(membership);
-		if (rgs)
-			free(rgs);
-
-		if (!refresh_sec || !running)
-			break;
-
-		sleep(refresh_sec);
-	}
-
-cleanup:
-	cman_finish(ch);
-
-	return ret;
-}
diff --git a/rgmanager/src/utils/clusvcadm.c b/rgmanager/src/utils/clusvcadm.c
deleted file mode 100644
index bfd9d51..0000000
--- a/rgmanager/src/utils/clusvcadm.c
+++ /dev/null
@@ -1,442 +0,0 @@
-/** @file
- * The New And Improved Cluster Service Admin Utility.
- * TODO Clean up the code.
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/param.h>
-#include <libgen.h>
-#include <resgroup.h>
-#include <platform.h>
-#include <members.h>
-#include <message.h>
-#include <libcman.h>
-#include <resgroup.h>
-#include <msgsimple.h>
-#include <signal.h>
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-void
-build_message(SmMessageSt *msgp, int action, char *svcName, int target,
-		int arg1, int arg2)
-{
-	msgp->sm_hdr.gh_magic = GENERIC_HDR_MAGIC;
-	msgp->sm_hdr.gh_command = RG_ACTION_REQUEST;
-	msgp->sm_hdr.gh_length = sizeof(*msgp);
-	msgp->sm_hdr.gh_arg1 = arg1;
-	msgp->sm_hdr.gh_arg2 = arg2;
-	msgp->sm_data.d_action = action;
-	strncpy(msgp->sm_data.d_svcName, svcName,
-		sizeof(msgp->sm_data.d_svcName));
-	msgp->sm_data.d_svcOwner = target;
-	msgp->sm_data.d_ret = 0;
-
-	swab_SmMessageSt(msgp);
-}
-
-
-int
-do_lock_req(int req)
-{
-	cman_handle_t ch;
-	msgctx_t ctx;
-	int ret = RG_FAIL;
-	cluster_member_list_t *membership = NULL;
-	int me;
-	generic_msg_hdr hdr;
-
-	ch = cman_init(NULL);
-	if (!ch) {
-		printf("Could not connect to cluster service\n");
-		goto out;
-	}
-
-	membership = get_member_list(ch);
-	me = get_my_nodeid(ch);
-
-	if (msg_open(MSG_SOCKET, 0, RG_PORT, &ctx, 5) < 0) {
-		printf("Could not connect to resource group manager\n");
-		goto out;
-	}
-
-	if (msg_send_simple(&ctx, req, 0, 0) < 0) {
-		printf("Communication failed\n");
-		goto out;
-	}
-
-	if (msg_receive(&ctx, &hdr, sizeof(hdr), 5) < sizeof(hdr)) {
-		printf("Receive failed\n");
-		goto out;
-	}
-
-	swab_generic_msg_hdr(&hdr);
-	ret = hdr.gh_command;
-
-out:
-	if (membership)
-		free_member_list(membership);
-
-	if (ctx.type >= 0)
-		msg_close(&ctx);
-
-	if (ch)
-		cman_finish(ch);
-
-	return ret;
-}
-
-
-int
-do_lock(void)
-{
-	if (do_lock_req(RG_LOCK) != RG_SUCCESS) {
-		printf("Lock operation failed\n");
-		return 1;
-	}
-	printf("Resource groups locked\n");
-	return 0;
-}
-
-
-int
-do_unlock(void)
-{
-	if (do_lock_req(RG_UNLOCK) != RG_SUCCESS) {
-		printf("Unlock operation failed\n");
-		return 1;
-	}
-	printf("Resource groups unlocked\n");
-	return 0;
-}
-
-
-int
-do_query_lock(void)
-{
-	switch(do_lock_req(RG_QUERY_LOCK)) {
-	case RG_LOCK:
-		printf("Resource groups locked\n");
-		break;
-	case RG_UNLOCK:
-		printf("Resource groups unlocked\n");
-		break;
-	default:
-		printf("Query operation failed\n");
-		return 1;
-	}
-	return 0;
-}
-
-
-void
-usage(char *name)
-{
-printf("usage: %s [command]\n\n", name);
-
-printf("Resource Group Control Commands:\n");
-printf("  -v                     Display version and exit\n");
-printf("  -d <group>             Disable <group>.  This stops a group\n"
-       "                         until an administrator enables it again,\n"
-       "                         the cluster loses and regains quorum, or\n"
-       "                         an administrator-defined event script\n"
-       "                         explicitly enables it again.\n");
-printf("  -e <group>             Enable <group>\n");
-printf("  -e <group> -F          Enable <group> according to failover\n"
-       "                         domain rules (deprecated; always the\n"
-       "                         case when using central processing)\n");
-printf("  -e <group> -m <member> Enable <group> on <member>\n");
-printf("  -r <group> -m <member> Relocate <group> [to <member>]\n"
-       "                         Stops a group and starts it on another"
-       "                         cluster member.\n");
-printf("  -M <group> -m <member> Migrate <group> to <member>\n");
-printf("                         (e.g. for live migration of VMs)\n");
-printf("  -q                     Quiet operation\n");
-printf("  -R <group>             Restart a group in place.\n");
-printf("  -s <group>             Stop <group>.  This temporarily stops\n"
-       "                         a group.  After the next group or\n"
-       "                         or cluster member transition, the group\n"
-       "                         will be restarted (if possible).\n");
-printf("Resource Group Locking (for cluster Shutdown / Debugging):\n");
-printf("  -l                     Lock local resource group managers.\n"
-       "                         This prevents resource groups from\n"
-       "                         starting.\n");
-printf("  -S                     Show lock state\n");
-printf("  -u                     Unlock resource group managers.\n"
-       "                         This allows resource groups to start.\n");
-}
-
-
-int
-find_closest_node(cluster_member_list_t *cml, char *name, size_t maxlen)
-{
-	int x, c = 0, cl = 0, nc = 0, ncl = 0, cur = 0;
-
-	for (x=0; x<cml->cml_count; x++) {
-		cur = 0;
-
-		while (cml->cml_members[x].cn_name[cur] && name[cur] &&
-		       (cml->cml_members[x].cn_name[cur] == name[cur]))
-			cur++;
-		if (!cur)
-			continue;
-		if (cur >= cl) {
-			ncl = cl; /* Next-closest */
-			nc = c;
-			cl = cur;
-			c = x;
-		}
-	}
-
-	if (!cl) {
-		printf("No matches for '%s' found\n", name);
-		return 0;
-	}
-
-	if (ncl == cl) {
-		printf("More than one possible match for '%s' found\n",
-		       name);
-		return 0;
-	}
-
-	printf("Closest match: '%s'\n", 
-	       cml->cml_members[c].cn_name);
-
-	strncpy(name, cml->cml_members[c].cn_name, maxlen);
-	return cml->cml_members[c].cn_nodeid;
-}
-
-
-int
-main(int argc, char **argv)
-{
-	extern char *optarg;
-	char *svcname=NULL, nodename[256], realsvcname[64];
-	int opt;
-	msgctx_t ctx;
-	cman_handle_t ch;
-	SmMessageSt msg;
-	generic_msg_hdr *h = (generic_msg_hdr *)&msg;
-	int action = RG_STATUS;
-	int fod = 0;
-	int node_specified = 0;
-       	int me, svctarget = 0;
-	char *actionstr = NULL;
-	cluster_member_list_t *membership;
-
-	if (geteuid() != (uid_t) 0) {
-		fprintf(stderr, "%s must be run as the root user.\n", argv[0]);
-		return 1;
-	}
-
-	while ((opt = getopt(argc, argv, "lSue:M:d:r:n:m:FvR:s:Z:U:qh?")) != EOF) {
-		switch (opt) {
-		case 'l':
-			return do_lock();
-
-		case 'S':
-			return do_query_lock();
-
-		case 'u':
-			return do_unlock();
-
-		case 'e':
-			/* ENABLE */
-			actionstr = "trying to enable";
-			action = RG_ENABLE;
-			svcname = optarg;
-			break;
-               case 'F':
-                       if (node_specified) {
-                               fprintf(stderr,
-                                       "Cannot use '-F' with '-n' or '-m'\n");
-                               return 1;
-                       }
-                       fod = 1;
-                       break;
-		case 'd':
-			/* DISABLE */
-			actionstr = "disabling";
-			action = RG_DISABLE;
-			svcname = optarg;
-			break;
-		case 'r':
-			/* RELOCATE */
-			actionstr = "relocate";
-			action = RG_RELOCATE;
-			svcname = optarg;
-			break;
-		case 'M':
-			/* MIGRATE */
-			actionstr = "migrate";
-			action = RG_MIGRATE;
-			svcname = optarg;
-			break;
-		case 's':
-			/* stop */
-			actionstr = "stopping";
-			action = RG_STOP_USER;
-			svcname = optarg;
-			break;
-		case 'R':
-			actionstr = "trying to restart";
-			action = RG_RESTART;
-			svcname = optarg;
-			break;
-		case 'm': /* member ... */
-		case 'n': /* node .. same thing */
-                       if (fod) {
-                               fprintf(stderr,
-                                       "Cannot use '-F' with '-n' or '-m'\n");
-                               return 1;
-                       }
-			strncpy(nodename,optarg,sizeof(nodename));
-			node_specified = 1;
-			break;
-		case 'v':
-			printf("%s\n", RELEASE_VERSION);
-			return 0;
-		case 'Z':
-			actionstr = "freezing";
-			action = RG_FREEZE;
-			svcname = optarg;
-			break;
-		case 'U':
-			actionstr = "unfreezing";
-			action = RG_UNFREEZE;
-			svcname = optarg;
-			break;
-		case 'q':
-			close(STDOUT_FILENO);
-			break;
-		case 'h':
-		case '?':
-		default:
-			usage(basename(argv[0]));
-			return 1;
-		}
-	}
-
-	if (!svcname) {
-		usage(basename(argv[0]));
-		return 1;
-	}
-
-	if (action == RG_MIGRATE && !node_specified) {
-		printf("Migration requires a target cluster member\n");
-		return 1;
-	}
-
-	if (!strchr(svcname,':')) {
-		snprintf(realsvcname, sizeof(realsvcname), "service:%s",
-			 svcname);
-		svcname = realsvcname;
-	}
-
-	signal(SIGPIPE, SIG_IGN);
-
-	/* No login */
-	ch = cman_init(NULL);
-	if (!ch) {
-		printf("Could not connect to cluster service\n");
-		return 1;
-	}
-
-	membership = get_member_list(ch);
-	me = get_my_nodeid(ch);
-
-	if (node_specified) {
-		svctarget = memb_name_to_id(membership, nodename);
-		if (svctarget == 0) {
-			printf("'%s' not in membership list\n",
-			       nodename);
-			svctarget = find_closest_node(membership, nodename,
-						      sizeof(nodename));
-			if (!svctarget)
-				return 1;
-		}
-	} else {
-		svctarget = 0;
-		/*
-		clu_local_nodename(RG_SERVICE_GROUP, nodename,
-				   sizeof(nodename));
-				   */
-		//strcpy(nodename,"me");
-	}
-
-	build_message(&msg, action, svcname, svctarget, fod, 0);
-
-	if (action != RG_RELOCATE && action != RG_MIGRATE) {
-		if (!node_specified)
-			printf("Local machine %s %s", actionstr, svcname);
-		else
-			printf("Member %s %s %s", nodename, actionstr, svcname);
-		printf("...");
-		fflush(stdout);
-		if (msg_open(MSG_SOCKET, 0, RG_PORT, &ctx, 5) < 0) {
-			printf("Could not connect to resource group manager\n");
-			return 1;
-		}
-	} else {
-		if (!svctarget)
-			printf("Trying to %s %s", actionstr, svcname);
-		else 
-			printf("Trying to %s %s to %s", actionstr, svcname,
-			       nodename);
-		printf("...");
-		fflush(stdout);
-		if (msg_open(MSG_SOCKET, 0, RG_PORT, &ctx, 5) < 0) {
-			printf("Could not connect to resource group manager\n");
-			return 1;
-		}
-	}
-
-	if (ctx.type < 0) {
-		fprintf(stderr,
-			"Could not connect to resource group manager!\n");
-		return 1;
-	}
-
-	msg_send(&ctx, &msg, sizeof(msg));
-
-	/* Reusing opt here */
-	if ((opt = msg_receive(&ctx, &msg, sizeof(msg), 0)) < sizeof(*h)) {
-		perror("msg_receive");
-		fprintf(stderr, "Error receiving reply!\n");
-		return 1;
-	}
-
-	/* Decode */
-	if (opt < sizeof(msg)) {
-		swab_generic_msg_hdr(h);
-		printf("%s\n", rg_strerror(h->gh_arg1));
-		return h->gh_arg1;
-	}
-
-	swab_SmMessageSt(&msg);
-	printf("%s\n", rg_strerror(msg.sm_data.d_ret));
-	if (msg.sm_data.d_ret == RG_ERUN)
-		return 0;
-	if (msg.sm_data.d_ret)
-		return msg.sm_data.d_ret;
-	
-	switch (action) {
-	/*case RG_MIGRATE:*/
-	case RG_RELOCATE:
-	case RG_START:
-	case RG_ENABLE:
-		printf("%s%s is now running on %s\n",
-		       (!node_specified ||
-		       msg.sm_data.d_svcOwner==svctarget)?"":"Warning: ",
-		       svcname, memb_id_to_name(membership,
-		       			        msg.sm_data.d_svcOwner));
-		break;
-	default:
-		break;
-	}
-	
-	return msg.sm_data.d_ret;
-}
diff --git a/rgmanager/src/utils/syscall.h b/rgmanager/src/utils/syscall.h
deleted file mode 100644
index 4c2541e..0000000
--- a/rgmanager/src/utils/syscall.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/** @file
- * Taken from: /usr/include/linux/nfsd/syscall.h (we hope).
- *
- * This file holds all declarations for the knfsd syscall interface.
- */
-
-#ifndef NFSD_SYSCALL_H
-#define NFSD_SYSCALL_H
-
-#include <asm/types.h>
-# include <linux/config.h>
-# include <linux/types.h>
-# include <linux/in.h>
-#include <linux/posix_types.h>
-#include <linux/nfsd/const.h>
-#include <linux/nfsd/export.h>
-// TIMXXX - took out to pacify user level compilation.
-//#include <linux/nfsd/nfsfh.h>
-#include <linux/nfsd/auth.h>
-
-/*
- * Version of the syscall interface
- */
-#define NFSCTL_VERSION		0x0201
-
-/*
- * These are the commands understood by nfsctl().
- */
-#define NFSCTL_SVC		0	/* This is a server process. */
-#define NFSCTL_ADDCLIENT	1	/* Add an NFS client. */
-#define NFSCTL_DELCLIENT	2	/* Remove an NFS client. */
-#define NFSCTL_EXPORT		3	/* export a file system. */
-#define NFSCTL_UNEXPORT		4	/* unexport a file system. */
-#define NFSCTL_UGIDUPDATE	5	/* update a client's uid/gid map. */
-#define NFSCTL_GETFH		6	/* get an fh by ino (used by mountd) */
-#define NFSCTL_GETFD		7	/* get an fh by path (used by mountd) */
-#define	NFSCTL_GETFS		8	/* get an fh by path with max FH len */
-#define NFSCTL_FODROP		50	/* drop requests during failover */
-#define NFSCTL_STOPFODROP	51	/* stop dropping requests */
-#define NFSCTL_FOLOCKS		52	/* drop locks for failover */
-#define NFSCTL_FOGRACE		53	/* set grace period for failover */
-#define NFSCTL_FOSERV		54	/* remove service mon for failover */
-#define NFSCTL_FO_MIN		NFSCTL_FODROP
-#define NFSCTL_FO_MAX		NFSCTL_FOSERV
-
-/* SVC */
-struct nfsctl_svc {
-	unsigned short		svc_port;
-	int			svc_nthreads;
-};
-
-/* ADDCLIENT/DELCLIENT */
-struct nfsctl_client {
-	char			cl_ident[NFSCLNT_IDMAX+1];
-	int			cl_naddr;
-	struct in_addr		cl_addrlist[NFSCLNT_ADDRMAX];
-	int			cl_fhkeytype;
-	int			cl_fhkeylen;
-	unsigned char		cl_fhkey[NFSCLNT_KEYMAX];
-};
-
-/* EXPORT/UNEXPORT */
-struct nfsctl_export {
-	char			ex_client[NFSCLNT_IDMAX+1];
-	char			ex_path[NFS_MAXPATHLEN+1];
-	__kernel_dev_t		ex_dev;
-	__kernel_ino_t		ex_ino;
-	int			ex_flags;
-	__kernel_uid_t		ex_anon_uid;
-	__kernel_gid_t		ex_anon_gid;
-};
-
-/* UGIDUPDATE */
-struct nfsctl_uidmap {
-	char *			ug_ident;
-	__kernel_uid_t		ug_uidbase;
-	int			ug_uidlen;
-	__kernel_uid_t *	ug_udimap;
-	__kernel_gid_t		ug_gidbase;
-	int			ug_gidlen;
-	__kernel_gid_t *	ug_gdimap;
-};
-
-/* GETFH */
-struct nfsctl_fhparm {
-	struct sockaddr		gf_addr;
-	__kernel_dev_t		gf_dev;
-	__kernel_ino_t		gf_ino;
-	int			gf_version;
-};
-
-/* GETFD */
-struct nfsctl_fdparm {
-	struct sockaddr		gd_addr;
-	char			gd_path[NFS_MAXPATHLEN+1];
-	int			gd_version;
-};
-
-/* GETFS - GET Filehandle with Size */
-struct nfsctl_fsparm {
-	struct sockaddr		gd_addr;
-	char			gd_path[NFS_MAXPATHLEN+1];
-	int			gd_maxlen;
-};
-
-/* FODROP/STOPFODROP */
-struct nfsctl_fodrop {
-	char			fo_dev[NFS_MAXPATHLEN+1];
-	__u32			fo_timeout;
-};
-
-/*
- * This is the argument union.
- */
-struct nfsctl_arg {
-	int			ca_version;	/* safeguard */
-	union {
-		struct nfsctl_svc	u_svc;
-		struct nfsctl_client	u_client;
-		struct nfsctl_export	u_export;
-		struct nfsctl_uidmap	u_umap;
-		struct nfsctl_fhparm	u_getfh;
-		struct nfsctl_fdparm	u_getfd;
-		struct nfsctl_fsparm	u_getfs;
-		struct nfsctl_fodrop	u_fodrop;
-	} u;
-#define ca_svc		u.u_svc
-#define ca_client	u.u_client
-#define ca_export	u.u_export
-#define ca_umap		u.u_umap
-#define ca_getfh	u.u_getfh
-#define ca_getfd	u.u_getfd
-#define	ca_getfs	u.u_getfs
-#define ca_authd	u.u_authd
-#define ca_fodrop	u.u_fodrop
-};
-
-// TIMXXX - took out to pacify user level compilation.
-//union nfsctl_res {
-	//__u8			cr_getfh[NFS_FHSIZE];
-	//struct knfsd_fh		cr_getfs;
-//};
-
-#ifdef __KERNEL__
-/*
- * Kernel syscall implementation.
- */
-#if defined(CONFIG_NFSD) || defined(CONFIG_NFSD_MODULE)
-extern asmlinkage long	sys_nfsservctl(int, void *, void *);
-#else
-#define sys_nfsservctl		sys_ni_syscall
-#endif
-extern int		exp_addclient(struct nfsctl_client *ncp);
-extern int		exp_delclient(struct nfsctl_client *ncp);
-extern int		exp_export(struct nfsctl_export *nxp);
-extern int		exp_unexport(struct nfsctl_export *nxp);
-extern int		exp_fodrop(struct nfsctl_fodrop *nfp);
-extern int		exp_stopfodrop(struct nfsctl_fodrop *nfp);
-extern int		nfsd_lockd_founlock(struct nfsctl_fodrop *nfp);
-extern int		nfsd_lockd_fograce(struct nfsctl_fodrop *nfp);
-extern int		nfsd_lockd_foservice(struct nfsctl_fodrop *nfp);
-
-#endif /* __KERNEL__ */
-
-#endif /* NFSD_SYSCALL_H */
diff --git a/scripts/fenceparse b/scripts/fenceparse
deleted file mode 100644
index 8b00698..0000000
--- a/scripts/fenceparse
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/bash
-
-set -e
-
-definefile="$1"
-define="$2"
-release="$3"
-srcdir="$4"
-infile="$5"
-
-definedata="$(cat $definefile | grep "^\#define $define" | sed -e 's/.*'$define' //')"
-
-realinfile="$(ls $srcdir/$infile.*)"
-
-interpreter="$(cat $realinfile | head -n 1 | awk -F "/" '{print $NF}')"
-interpreter="$(echo $interpreter)"
-
-case "$interpreter" in
-	perl)
-		start="\$"
-		end=";"
-	;;
-	*)
-		start=""
-		end=""
-	;;
-esac
-
-awk "{print}(\$1 ~ /#BEGIN_VERSION_GENERATION/){exit 0}" $realinfile
-echo ${start}RELEASE_VERSION=\"${release}\"${end}
-echo ${start}REDHAT_COPYRIGHT=${definedata}${end}
-echo ${start}BUILD_DATE=\"\(built $(date)\)\"${end}
-awk -v p=0 "(\$1 ~ /#END_VERSION_GENERATION/){p = 1} {if(p==1)print}" $realinfile
-
-exit 0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]